Projet

Général

Profil

dico_synonymes.tpl.php

Alexandre Boucher, 11/09/2013 13:51

 
1
<?php
2
// +-------------------------------------------------+
3
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
4
// +-------------------------------------------------+
5
// $Id: dico_synonymes.tpl.php,v 1.4 2013-04-11 08:47:35 mbertin Exp $
6

    
7
if (stristr($_SERVER['REQUEST_URI'], ".tpl.php")) die("no access");
8

    
9
// template pour le form de dictionnaire des synonymes
10

    
11
$select_prop = "scrollbars=yes, toolbar=no, dependent=yes, resizable=yes";
12

    
13
$aff_liste_mots="
14
<script type='text/javascript'>
15
<!--
16
        function test_form(form)
17
        {
18
                if(form.word_search.value.length == 0)
19
                        {
20
                                alert('Le champ de recherche est vide.');
21
                                return false;
22
                        } else return true;
23
        }
24
-->
25
</script>
26
<h1>".$msg["semantique"]." : ".$msg["dico_syn"]."</h1>
27
<div class='row'>
28
        <form class='form-$current_module' name='search_mots' method='post' action='./autorites.php?categ=semantique&sub=synonyms&action=search' onSubmit='if (test_form(search_mots)) return true; else return false;'>
29
        <h3>".$msg["357"]." : ".$msg["dico_syn"]."</h3>\n
30
        <div class='form-contenu'>
31
                <input type='text' class='saisie-30em' name='word_search' value=''>
32
        </div>
33
        <div class='row'>
34
        <div class='left'><input type='submit' class='bouton' value='".$msg["142"]."'>\n
35
        &nbsp;<input type='button' class='bouton' value='".$msg["word_create"]."' onclick=\"document.location='./autorites.php?categ=semantique&sub=synonyms&action=view';\"></div>\n
36
        !!see_last_words!!
37
        </div>
38
        <div class='row'></div>        
39
        </form>
40
        </div>\n
41
<div class='row'>&nbsp;</div>\n
42
<div class='row'><h3>".$msg["search_words_libelle"]." !!cle!!</h3></div>\n
43
!!lettres!!\n
44
<div class='row'>&nbsp;</div>\n
45
!!liste_mots!!\n
46
<script> document.search_mots.word_search.focus(); </script>
47
";
48

    
49
//template pour le form ajout/modification d'un mot
50
$aff_modif_mot="
51
<script src='javascript/ajax.js'></script>
52
!!mots_js!!\n
53
<h1>".$msg["semantique"]." : ".$msg["dico_syn"]."</h1>
54
<div class='row'>&nbsp;</div>
55
<form class='form-$current_module' id='words' name='words' method='post' action='!!action!!&action=modif'>\n
56
<h3><div class='left'>".$msg["syn_word"]."</div></h3><div class='row'></div><hr class='spacer' />\n
57
<div class='form-contenu'>
58
".$msg["word_selected"]." : <input type='text' class='saisie-20em' name='word_selected' value=\"!!mot_original!!\">\n
59
<input type='hidden' name='word_code_selected' value='!!id_mot!!'>
60
<input type='hidden' name='max_word' value=\"!!max_word!!\" />
61
<div class='row'>&nbsp;</div>
62
<b>".$msg["word_syn"]." :</b><div class='row'>&nbsp;</div>
63
!!mots_lie!!
64
<div id='addword'/>
65
</div>\n
66
</div><div class='row'><hr class='spacer' />
67
<div class='left'><input type='button' class='bouton' value='".$msg["76"]."' onClick=\"history.back(-1);\">&nbsp;<input type='button' class='bouton' value='".$msg["77"]."' onClick='document.words.submit();'></div>
68
!!supprimer!!
69
</div><div class='row'></div></form>\n
70
<script> 
71
ajax_pack_element(document.words.f_word0);
72
document.words.word_selected.focus(); 
73
</script>";
74

    
75
//fonctions ajax ajout de zones de texte
76
$mot_js="
77
<script>
78
        function fonction_selecteur_word() {
79
        name=this.getAttribute('id').substring(4);
80
                name_id = name.substr(0,6)+'_code'+name.substr(6);
81
        openPopUp('./select.php?what=synonyms&caller=words&p1='+name_id+'&p2='+name, 'select_word', 400, 400, -2, -2, '$select_prop');
82
    }
83
    function fonction_raz_word() {
84
        name=this.getAttribute('id').substring(4);
85
                name_id = name.substr(0,6)+'_code'+name.substr(6);
86
        document.getElementById(name).value='';
87
                document.getElementById(name_id).value='';
88
    }
89
    function add_word() {
90
        template = document.getElementById('addword');
91
        word=document.createElement('div');
92
        word.className='row';
93

94
        suffixe = eval('document.words.max_word.value')
95
        nom_id = 'f_word'+suffixe
96
        f_word = document.createElement('input');
97
        f_word.setAttribute('name',nom_id);
98
        f_word.setAttribute('id',nom_id);
99
        f_word.setAttribute('type','text');
100
        f_word.className='saisie-30emr';
101
        f_word.setAttribute('value','');
102
                f_word.setAttribute('completion','synonyms');
103
        
104
                id = 'f_word_code'+suffixe
105
                f_word_code = document.createElement('input');
106
                f_word_code.setAttribute('name',id);
107
        f_word_code.setAttribute('id',id);
108
        f_word_code.setAttribute('type','hidden');
109
                f_word_code.setAttribute('value','');
110
 
111
        del_f_word = document.createElement('input');
112
        del_f_word.setAttribute('id','del_f_word'+suffixe);
113
        del_f_word.onclick=fonction_raz_word;
114
        del_f_word.setAttribute('type','button');
115
        del_f_word.className='bouton';
116
        del_f_word.setAttribute('readonly','');
117
        del_f_word.setAttribute('value','$msg[raz]');
118

119
        sel_f_word = document.createElement('input');
120
        sel_f_word.setAttribute('id','sel_f_word'+suffixe);
121
        sel_f_word.setAttribute('type','button');
122
        sel_f_word.className='bouton';
123
        sel_f_word.setAttribute('readonly','');
124
        sel_f_word.setAttribute('value','$msg[parcourir]');
125
        sel_f_word.onclick=fonction_selecteur_word;
126

127
        word.appendChild(f_word);
128
                word.appendChild(f_word_code);
129
        space=document.createTextNode(' ');
130
        word.appendChild(space);
131
        word.appendChild(sel_f_word);
132
        word.appendChild(space.cloneNode(false));
133
        word.appendChild(del_f_word);
134
        
135
        template.appendChild(word);
136

137
        document.words.max_word.value=suffixe*1+1*1 ;
138
        ajax_pack_element(f_word);
139
    }
140
</script>";
141

    
142
//template de zone de texte pour chaque mot lié                                
143
$aff_mot_lie="
144
<div class='row'>
145
<input type='text' class='saisie-30emr' id='f_word!!iword!!' name='f_word!!iword!!' value=\"!!word!!\" autfield='f_word_code!!iword!!' completion=\"synonyms\" />
146
<input type='hidden' id='f_word_code!!iword!!' name='f_word_code!!iword!!' value='!!id_word!!'>
147
<input type='button' class='bouton' value='$msg[parcourir]' onclick=\"openPopUp('./select.php?what=synonyms&caller=words&p1=f_word_code!!iword!!&p2=f_word!!iword!!&deb_rech='+".pmb_escape()."(this.form.f_word!!iword!!.value), 'select_word', 400, 400, -2, -2, '$select_prop')\" />
148
<input type='button' class='bouton' value='$msg[raz]' onclick=\"this.form.f_word!!iword!!.value='';this.form.f_word_code!!iword!!.value=''; \" />
149
!!bouton_ajouter!!
150
</div>\n";
151
?>