4 |
david |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/***************************************************************************\
|
|
|
4 |
* SPIP, Systeme de publication pour l'internet *
|
|
|
5 |
* *
|
|
|
6 |
* Copyright (c) 2001-2005 *
|
|
|
7 |
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
|
|
|
8 |
* *
|
|
|
9 |
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
|
|
|
10 |
* Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
|
|
|
11 |
\***************************************************************************/
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
//
|
|
|
15 |
// Ce fichier ne sera execute qu'une fois
|
|
|
16 |
if (defined("_ECRIRE_INC_MOTS")) return;
|
|
|
17 |
define("_ECRIRE_INC_MOTS", "1");
|
|
|
18 |
|
|
|
19 |
include_ecrire("inc_filtres.php3"); # pour http_script (normalement déjà fait)
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
// ne pas faire d'erreur si les chaines sont > 254 caracteres
|
|
|
23 |
function levenshtein255 ($a, $b) {
|
|
|
24 |
$a = substr($a, 0, 254);
|
|
|
25 |
$b = substr($b, 0, 254);
|
|
|
26 |
return @levenshtein($a,$b);
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
function mots_ressemblants($mot, $table_mots, $table_ids='') {
|
|
|
30 |
$lim = 2;
|
|
|
31 |
$nb = 0;
|
|
|
32 |
$opt = 1000000;
|
|
|
33 |
$mot_opt = '';
|
|
|
34 |
$mot = translitteration(strtolower(trim($mot)));
|
|
|
35 |
$len = strlen($mot);
|
|
|
36 |
|
|
|
37 |
if (!$table_mots) return '';
|
|
|
38 |
|
|
|
39 |
while (!$nb AND $lim < 10) {
|
|
|
40 |
reset($table_mots);
|
|
|
41 |
if ($table_ids) reset($table_ids);
|
|
|
42 |
while (list(, $val) = each($table_mots)) {
|
|
|
43 |
if ($table_ids) list(, $id) = each($table_ids);
|
|
|
44 |
else $id = $val;
|
|
|
45 |
$val2 = trim($val);
|
|
|
46 |
if ($val2) {
|
|
|
47 |
if (!($m = $distance[$id])) {
|
|
|
48 |
$val2 = translitteration(strtolower($val2));
|
|
|
49 |
$len2 = strlen($val2);
|
|
|
50 |
if ($val2 == $mot)
|
|
|
51 |
$m = -2; # resultat exact
|
|
|
52 |
else if (substr($val2, 0, $len) == $mot)
|
|
|
53 |
$m = -1; # sous-chaine
|
|
|
54 |
else {
|
|
|
55 |
# distance
|
|
|
56 |
$m = levenshtein255($val2, $mot);
|
|
|
57 |
# ne pas compter la distance due a la longueur
|
|
|
58 |
$m -= max(0, $len2 - $len);
|
|
|
59 |
}
|
|
|
60 |
$distance[$id] = $m;
|
|
|
61 |
}
|
|
|
62 |
if ($m <= $lim) {
|
|
|
63 |
$selection[$id] = $m;
|
|
|
64 |
if ($m < $opt) {
|
|
|
65 |
$opt = $m;
|
|
|
66 |
$mot_opt = $val;
|
|
|
67 |
}
|
|
|
68 |
$nb++;
|
|
|
69 |
}
|
|
|
70 |
}
|
|
|
71 |
}
|
|
|
72 |
$lim += 2;
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
if (!$nb) return '';
|
|
|
76 |
reset($selection);
|
|
|
77 |
if ($opt > -1) {
|
|
|
78 |
$moy = 1;
|
|
|
79 |
while(list(, $val) = each($selection)) $moy *= $val;
|
|
|
80 |
if($moy) $moy = pow($moy, 1.0/$nb);
|
|
|
81 |
$lim = ($opt + $moy) / 2;
|
|
|
82 |
}
|
|
|
83 |
else $lim = -1;
|
|
|
84 |
|
|
|
85 |
reset($selection);
|
|
|
86 |
while (list($key, $val) = each($selection)) {
|
|
|
87 |
if ($val <= $lim) {
|
|
|
88 |
$result[] = $key;
|
|
|
89 |
}
|
|
|
90 |
}
|
|
|
91 |
return $result;
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
/*
|
|
|
96 |
* Affiche la liste des mots-cles associes a l'objet
|
|
|
97 |
* specifie, plus le formulaire d'ajout de mot-cle
|
|
|
98 |
*/
|
|
|
99 |
|
|
|
100 |
function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot, $flag_editable) {
|
|
|
101 |
global $connect_statut, $options;
|
|
|
102 |
global $spip_lang_rtl, $spip_lang_right;
|
|
|
103 |
|
|
|
104 |
$select_groupe = $GLOBALS['select_groupe'];
|
|
|
105 |
|
|
|
106 |
if ($table == 'articles') {
|
|
|
107 |
$id_table = 'id_article';
|
|
|
108 |
$objet = 'article';
|
|
|
109 |
$url_base = "articles.php3?id_article=$id_objet";
|
|
|
110 |
}
|
|
|
111 |
else if ($table == 'breves') {
|
|
|
112 |
$id_table = 'id_breve';
|
|
|
113 |
$objet = 'breve';
|
|
|
114 |
$url_base = "breves_voir.php3?id_breve=$id_objet";
|
|
|
115 |
}
|
|
|
116 |
else if ($table == 'rubriques') {
|
|
|
117 |
$id_table = 'id_rubrique';
|
|
|
118 |
$objet = 'rubrique';
|
|
|
119 |
$url_base = "naviguer.php3?id_rubrique=$id_objet";
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
else if ($table == 'syndic') {
|
|
|
123 |
$id_table = 'id_syndic';
|
|
|
124 |
$objet = 'syndic';
|
|
|
125 |
$url_base = "sites.php3?id_syndic=$id_objet";
|
|
|
126 |
}
|
|
|
127 |
|
|
|
128 |
list($nombre_mots) = spip_fetch_array(spip_query("SELECT COUNT(*) FROM spip_mots AS mots, spip_mots_$table AS lien WHERE lien.$id_table=$id_objet AND mots.id_mot=lien.id_mot"));
|
|
|
129 |
|
|
|
130 |
if (!$nombre_mots) {
|
|
|
131 |
if (!$flag_editable) return;
|
|
|
132 |
list($nombre_groupes) = spip_fetch_array(spip_query("SELECT COUNT(*) FROM spip_groupes_mots WHERE $table = 'oui'
|
|
|
133 |
AND ".substr($connect_statut,1)." = 'oui'"));
|
|
|
134 |
|
|
|
135 |
if (!$nombre_groupes) return;
|
|
|
136 |
}
|
|
|
137 |
|
|
|
138 |
echo "<a name='mots'></a>";
|
|
|
139 |
if ($flag_editable){
|
|
|
140 |
if ($nouv_mot.$cherche_mot.$supp_mot)
|
|
|
141 |
$bouton = bouton_block_visible("lesmots");
|
|
|
142 |
else
|
|
|
143 |
$bouton = bouton_block_invisible("lesmots");
|
|
|
144 |
}
|
|
|
145 |
debut_cadre_enfonce("mot-cle-24.gif", false, "", $bouton._T('titre_mots_cles').aide ("artmots"));
|
|
|
146 |
|
|
|
147 |
//////////////////////////////////////////////////////
|
|
|
148 |
// Recherche de mot-cle
|
|
|
149 |
//
|
|
|
150 |
|
|
|
151 |
if ($nouv_mot)
|
|
|
152 |
$nouveaux_mots[] = $nouv_mot;
|
|
|
153 |
|
|
|
154 |
$tous_les_mots = split(" *[,;] *", $cherche_mot);
|
|
|
155 |
while ((list(,$cherche_mot) = each ($tous_les_mots)) AND $cherche_mot) {
|
|
|
156 |
echo "<P ALIGN='left'>";
|
|
|
157 |
$query = "SELECT id_mot, titre FROM spip_mots WHERE id_groupe='$select_groupe'";
|
|
|
158 |
$result = spip_query($query);
|
|
|
159 |
unset($table_mots);
|
|
|
160 |
unset($table_ids);
|
|
|
161 |
while ($row = spip_fetch_array($result)) {
|
|
|
162 |
$table_ids[] = $row['id_mot'];
|
|
|
163 |
$table_mots[] = $row['titre'];
|
|
|
164 |
}
|
|
|
165 |
$resultat = mots_ressemblants($cherche_mot, $table_mots, $table_ids);
|
|
|
166 |
debut_boite_info();
|
|
|
167 |
if (!$resultat) {
|
|
|
168 |
echo "<B>"._T('info_non_resultat', array('cherche_mot' => $cherche_mot))."</B><BR>";
|
|
|
169 |
}
|
|
|
170 |
else if (count($resultat) == 1) {
|
|
|
171 |
list(, $nouv_mot) = each($resultat);
|
|
|
172 |
$nouveaux_mots[] = $nouv_mot;
|
|
|
173 |
echo "<B>"._T('info_mot_cle_ajoute')." ";
|
|
|
174 |
if ($table == 'articles') echo _T('info_l_article');
|
|
|
175 |
else if ($table == 'breves') echo _T('info_la_breve');
|
|
|
176 |
else if ($table == 'rubriques') echo _T('info_la_rubrique');
|
|
|
177 |
echo " : </B><BR>";
|
|
|
178 |
$query = "SELECT * FROM spip_mots WHERE id_mot=$nouv_mot";
|
|
|
179 |
$result = spip_query($query);
|
|
|
180 |
echo "<UL>";
|
|
|
181 |
while ($row = spip_fetch_array($result)) {
|
|
|
182 |
$id_mot = $row['id_mot'];
|
|
|
183 |
$titre_mot = $row['titre'];
|
|
|
184 |
$type_mot = typo($row['type']);
|
|
|
185 |
$descriptif_mot = $row['descriptif'];
|
|
|
186 |
|
|
|
187 |
echo "<LI><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=2><B><FONT SIZE=3>".typo($titre_mot)."</FONT></B>";
|
|
|
188 |
echo "</FONT>\n";
|
|
|
189 |
}
|
|
|
190 |
echo "</UL>";
|
|
|
191 |
}
|
|
|
192 |
else {
|
|
|
193 |
reset($resultat);
|
|
|
194 |
unset($les_mots);
|
|
|
195 |
while (list(, $id_mot) = each($resultat)
|
|
|
196 |
AND $nombre ++ < 17)
|
|
|
197 |
$les_mots[] = $id_mot;
|
|
|
198 |
if ($les_mots) {
|
|
|
199 |
if (count($resultat) > 17) {
|
|
|
200 |
echo "<br /><b>"._T('info_trop_resultat', array('cherche_mot' => $cherche_mot))."</b><p />\n";
|
|
|
201 |
}
|
|
|
202 |
$les_mots = join(',', $les_mots);
|
|
|
203 |
echo "<B>"._T('info_plusieurs_mots_trouves', array('cherche_mot' => $cherche_mot))."</B><BR>";
|
|
|
204 |
$query = "SELECT * FROM spip_mots WHERE id_mot IN ($les_mots) ORDER BY titre";
|
|
|
205 |
$result = spip_query($query);
|
|
|
206 |
echo "<UL>";
|
|
|
207 |
while ($row = spip_fetch_array($result)) {
|
|
|
208 |
$id_mot = $row['id_mot'];
|
|
|
209 |
$titre_mot = $row['titre'];
|
|
|
210 |
$type_mot = typo($row['type']);
|
|
|
211 |
$descriptif_mot = $row['descriptif'];
|
|
|
212 |
|
|
|
213 |
echo "<LI><FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=2><B><FONT SIZE=3>".typo($titre_mot)."</FONT></B>";
|
|
|
214 |
|
|
|
215 |
if ($type_mot) echo " ($type_mot)";
|
|
|
216 |
echo " | <A HREF=\"$url_base&nouv_mot=$id_mot#mots\">"._T('info_ajouter_mot')."</A>";
|
|
|
217 |
|
|
|
218 |
if (strlen($descriptif_mot) > 1) {
|
|
|
219 |
echo "<BR><FONT SIZE=1>".propre(couper($descriptif_mot, 100))."</FONT>\n";
|
|
|
220 |
}
|
|
|
221 |
echo "</FONT><p>\n";
|
|
|
222 |
}
|
|
|
223 |
echo "</UL>";
|
|
|
224 |
}
|
|
|
225 |
}
|
|
|
226 |
|
|
|
227 |
if ($GLOBALS['connect_statut'] == '0minirezo') {
|
|
|
228 |
echo "<div style='width: 200px;'>";
|
|
|
229 |
$retour = urlencode($GLOBALS['clean_link']->getUrl());
|
|
|
230 |
$titre = urlencode($cherche_mot);
|
|
|
231 |
icone_horizontale(_T('icone_creer_mot_cle'), "mots_edit.php3?new=oui&ajouter_id_article=$id_objet&table=$table&id_table=$id_table&titre=$titre&redirect=$retour", "mot-cle-24.gif", "creer.gif");
|
|
|
232 |
echo "</div> ";
|
|
|
233 |
}
|
|
|
234 |
|
|
|
235 |
fin_boite_info();
|
|
|
236 |
echo "<P>";
|
|
|
237 |
|
|
|
238 |
}
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
//////////////////////////////////////////////////////
|
|
|
242 |
// Appliquer les modifications sur les mots-cles
|
|
|
243 |
//
|
|
|
244 |
|
|
|
245 |
if ($nouveaux_mots && $flag_editable) {
|
|
|
246 |
while ((list(,$nouv_mot) = each($nouveaux_mots)) AND $nouv_mot!='x') {
|
|
|
247 |
$query = "SELECT * FROM spip_mots_$table WHERE id_mot=$nouv_mot AND $id_table=$id_objet";
|
|
|
248 |
$result = spip_query($query);
|
|
|
249 |
if (!spip_num_rows($result)) {
|
|
|
250 |
$query = "INSERT INTO spip_mots_$table (id_mot,$id_table) VALUES ($nouv_mot, $id_objet)";
|
|
|
251 |
$result = spip_query($query);
|
|
|
252 |
}
|
|
|
253 |
}
|
|
|
254 |
$reindexer = true;
|
|
|
255 |
}
|
|
|
256 |
|
|
|
257 |
if ($supp_mot && $flag_editable) {
|
|
|
258 |
if ($supp_mot == -1)
|
|
|
259 |
$mots_supp = "";
|
|
|
260 |
else
|
|
|
261 |
$mots_supp = " AND id_mot=$supp_mot";
|
|
|
262 |
$query = "DELETE FROM spip_mots_$table WHERE $id_table=$id_objet $mots_supp";
|
|
|
263 |
$result = spip_query($query);
|
|
|
264 |
$reindexer = true;
|
|
|
265 |
}
|
|
|
266 |
|
|
|
267 |
|
|
|
268 |
if ($reindexer AND lire_meta('activer_moteur') == 'oui') {
|
|
|
269 |
include_ecrire ("inc_index.php3");
|
|
|
270 |
marquer_indexer($objet, $id_objet);
|
|
|
271 |
}
|
|
|
272 |
|
|
|
273 |
//
|
|
|
274 |
// Afficher les mots-cles
|
|
|
275 |
//
|
|
|
276 |
|
|
|
277 |
$query = "SELECT DISTINCT type FROM spip_mots";
|
|
|
278 |
$result = spip_query($query);
|
|
|
279 |
$plusieurs_types = (spip_num_rows($result) > 1);
|
|
|
280 |
|
|
|
281 |
unset($les_mots);
|
|
|
282 |
|
|
|
283 |
$query = "SELECT mots.* FROM spip_mots AS mots, spip_mots_$table AS lien WHERE lien.$id_table=$id_objet AND mots.id_mot=lien.id_mot ORDER BY mots.type, mots.titre";
|
|
|
284 |
$result = spip_query($query);
|
|
|
285 |
|
|
|
286 |
if (spip_num_rows($result) > 0) {
|
|
|
287 |
echo "<div class='liste'>";
|
|
|
288 |
echo "<table width='100%' cellpadding='3' cellspacing='0' border='0' background=''>";
|
|
|
289 |
|
|
|
290 |
$ifond=0;
|
|
|
291 |
|
|
|
292 |
$tableau= '';
|
|
|
293 |
while ($row = spip_fetch_array($result)) {
|
|
|
294 |
$vals = '';
|
|
|
295 |
|
|
|
296 |
$id_mot = $row['id_mot'];
|
|
|
297 |
$titre_mot = $row['titre'];
|
|
|
298 |
$type_mot = typo($row['type']);
|
|
|
299 |
$descriptif_mot = $row['descriptif'];
|
|
|
300 |
$id_groupe = $row['id_groupe'];
|
|
|
301 |
|
|
|
302 |
$query_groupe = "SELECT * FROM spip_groupes_mots WHERE id_groupe = $id_groupe";
|
|
|
303 |
$result_groupe = spip_query($query_groupe);
|
|
|
304 |
while($row_groupe = spip_fetch_array($result_groupe)) {
|
|
|
305 |
$id_groupe = $row_groupe['id_groupe'];
|
|
|
306 |
$titre_groupe = entites_html($row_groupe['titre']);
|
|
|
307 |
$unseul = $row_groupe['unseul'];
|
|
|
308 |
$obligatoire = $row_groupe['obligatoire'];
|
|
|
309 |
$acces_admin = $row_groupe['minirezo'];
|
|
|
310 |
$acces_redacteur = $row_groupe['comite'];
|
|
|
311 |
|
|
|
312 |
$flag_groupe = ($flag_editable AND (($connect_statut == '1comite' AND $acces_redacteur == 'oui') OR ($connect_statut == '0minirezo' AND $acces_admin == 'oui')));
|
|
|
313 |
}
|
|
|
314 |
|
|
|
315 |
$groupes_vus[$id_groupe] = true;
|
|
|
316 |
$id_groupes_vus[] = $id_groupe;
|
|
|
317 |
|
|
|
318 |
if ($ifond==0){
|
|
|
319 |
$ifond=1;
|
|
|
320 |
$couleur="#FFFFFF";
|
|
|
321 |
}else{
|
|
|
322 |
$ifond=0;
|
|
|
323 |
$couleur="#EDF3FE";
|
|
|
324 |
}
|
|
|
325 |
|
|
|
326 |
$url = "mots_edit.php3?id_mot=$id_mot&redirect=".rawurlencode($url_base.'#mots');
|
|
|
327 |
|
|
|
328 |
$vals[] = "<A HREF='$url'>" . http_img_pack('petite-cle.gif', "", "width='23' height='12' border='0'") ."</A>";
|
|
|
329 |
|
|
|
330 |
|
|
|
331 |
// Changer
|
|
|
332 |
if ($unseul == "oui" AND $flag_groupe) {
|
|
|
333 |
$s = "<form action='$url_base#mots' method='post' style='margin:0px; padding: 0px'>";
|
|
|
334 |
$s .= "<INPUT TYPE='Hidden' NAME='$id_table' VALUE='$id_objet'>";
|
|
|
335 |
if ($table == 'rubriques') $s .= "<INPUT TYPE='Hidden' NAME='id_rubrique' VALUE='$id_objet'>";
|
|
|
336 |
$s .= "<select name='nouv_mot' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" CLASS='fondl' STYLE='font-size:10px; width:90px;'>";
|
|
|
337 |
|
|
|
338 |
$query_autres_mots = "SELECT * FROM spip_mots WHERE id_groupe = $id_groupe ORDER by titre";
|
|
|
339 |
$result_autres_mots = spip_query($query_autres_mots);
|
|
|
340 |
while ($row_autres = spip_fetch_array($result_autres_mots)) {
|
|
|
341 |
$le_mot = $row_autres['id_mot'];
|
|
|
342 |
$le_titre_mot = supprimer_tags(typo($row_autres['titre']));
|
|
|
343 |
|
|
|
344 |
if ($le_mot == $id_mot) $selected = "SELECTED";
|
|
|
345 |
else $selected = "";
|
|
|
346 |
$s .= "<option value='$le_mot' $selected> $le_titre_mot";
|
|
|
347 |
}
|
|
|
348 |
$s .= "</select>";
|
|
|
349 |
$s .= "<INPUT TYPE='Hidden' NAME='supp_mot' VALUE='$id_mot'>";
|
|
|
350 |
$s .= "<span class='visible_au_chargement' id='valider_groupe_$id_groupe'>";
|
|
|
351 |
$s .= " <INPUT TYPE='submit' NAME='Choisir' VALUE='"._T('bouton_changer')."' CLASS='fondo' style='font-size: 10px';>";
|
|
|
352 |
$s .= "</span>";
|
|
|
353 |
$s .= "</form>";
|
|
|
354 |
|
|
|
355 |
} else {
|
|
|
356 |
$s = "<A HREF='$url'>".typo($titre_mot)."</A>";
|
|
|
357 |
}
|
|
|
358 |
$vals[] = $s;
|
|
|
359 |
|
|
|
360 |
$vals[] = "$type_mot";
|
|
|
361 |
|
|
|
362 |
if ($flag_editable){
|
|
|
363 |
$s = "";
|
|
|
364 |
if ($flag_groupe)
|
|
|
365 |
$s .= "<A HREF=\"$url_base&supp_mot=$id_mot#mots\">"._T('info_retirer_mot')." " . http_img_pack('croix-rouge.gif', "X", "width='7' height='7' border='0' align='middle'") ."</A>";
|
|
|
366 |
else $s .= " ";
|
|
|
367 |
}
|
|
|
368 |
$vals[] = $s;
|
|
|
369 |
|
|
|
370 |
$tableau[] = $vals;
|
|
|
371 |
|
|
|
372 |
$les_mots[] = $id_mot;
|
|
|
373 |
}
|
|
|
374 |
|
|
|
375 |
$largeurs = array('25', '', '', '');
|
|
|
376 |
$styles = array('arial11', 'arial2', 'arial2', 'arial1');
|
|
|
377 |
afficher_liste($largeurs, $tableau, $styles);
|
|
|
378 |
|
|
|
379 |
|
|
|
380 |
echo "</table></div>";
|
|
|
381 |
}
|
|
|
382 |
|
|
|
383 |
if ($les_mots) {
|
|
|
384 |
$nombre_mots_associes = count($les_mots);
|
|
|
385 |
$les_mots = join($les_mots, ",");
|
|
|
386 |
} else {
|
|
|
387 |
$les_mots = "0";
|
|
|
388 |
}
|
|
|
389 |
if ($id_groupes_vus) $id_groupes_vus = join($id_groupes_vus, ",");
|
|
|
390 |
else $id_groupes_vus = "0";
|
|
|
391 |
|
|
|
392 |
$query_groupes = "SELECT * FROM spip_groupes_mots WHERE $table = 'oui'
|
|
|
393 |
AND ".substr($connect_statut,1)." = 'oui' AND obligatoire = 'oui'
|
|
|
394 |
AND id_groupe NOT IN ($id_groupes_vus)";
|
|
|
395 |
$nb_groupes = spip_num_rows(spip_query($query_groupes));
|
|
|
396 |
|
|
|
397 |
//
|
|
|
398 |
// Afficher le formulaire d'ajout de mots-cles
|
|
|
399 |
//
|
|
|
400 |
|
|
|
401 |
if ($flag_editable) {
|
|
|
402 |
if ($nouveaux_mots.$cherche_mot.$supp_mot)
|
|
|
403 |
echo debut_block_visible("lesmots");
|
|
|
404 |
else if ($nb_groupes > 0) {
|
|
|
405 |
echo debut_block_visible("lesmots");
|
|
|
406 |
// vilain hack pour redresser un triangle
|
|
|
407 |
$couche_a_redresser = $GLOBALS['numero_block']['lesmots'];
|
|
|
408 |
if ($GLOBALS['browser_layer']) echo http_script("
|
|
|
409 |
triangle = findObj('triangle' + $couche_a_redresser);
|
|
|
410 |
if (triangle) triangle.src = '" . _DIR_IMG_PACK . "deplierbas$spip_lang_rtl.gif';");
|
|
|
411 |
}
|
|
|
412 |
else
|
|
|
413 |
echo debut_block_invisible("lesmots");
|
|
|
414 |
|
|
|
415 |
if ($nombre_mots_associes > 3) {
|
|
|
416 |
echo "<div align='right' class='arial1'>";
|
|
|
417 |
echo "<a href=\"$url_base&supp_mot=-1#mots\">"._T('info_retirer_mots')."</a>";
|
|
|
418 |
echo "</div><br />\n";
|
|
|
419 |
}
|
|
|
420 |
|
|
|
421 |
|
|
|
422 |
$form_mot = "<FORM ACTION='$url_base#mots' METHOD='post' STYLE='margin:1px;'>"
|
|
|
423 |
."<INPUT TYPE='Hidden' NAME='$id_table' VALUE='$id_objet'>";
|
|
|
424 |
|
|
|
425 |
if ($table == 'rubriques') $form_mot .= "<INPUT TYPE='Hidden' NAME='id_rubrique' VALUE='$id_objet'>";
|
|
|
426 |
|
|
|
427 |
$message_ajouter_mot = "<span class='verdana1'><B>"._T('titre_ajouter_mot_cle')."</B></span> \n";
|
|
|
428 |
|
|
|
429 |
echo "<table border='0' width='100%' style='text-align: $spip_lang_right'>";
|
|
|
430 |
|
|
|
431 |
$query_groupes = "SELECT * FROM spip_groupes_mots WHERE $table = 'oui'
|
|
|
432 |
AND ".substr($connect_statut,1)." = 'oui' AND (unseul != 'oui' OR
|
|
|
433 |
(unseul = 'oui' AND id_groupe NOT IN ($id_groupes_vus)))
|
|
|
434 |
ORDER BY titre";
|
|
|
435 |
$result_groupes = spip_query($query_groupes);
|
|
|
436 |
|
|
|
437 |
// Afficher un menu par groupe de mots
|
|
|
438 |
|
|
|
439 |
|
|
|
440 |
while ($row_groupes = spip_fetch_array($result_groupes)) {
|
|
|
441 |
$id_groupe = $row_groupes['id_groupe'];
|
|
|
442 |
$titre_groupe = entites_html(textebrut(typo($row_groupes['titre'])));
|
|
|
443 |
$unseul = $row_groupes['unseul'];
|
|
|
444 |
$obligatoire = $row_groupes['obligatoire'];
|
|
|
445 |
$articles = $row_groupes['articles'];
|
|
|
446 |
$breves = $row_groupes['breves'];
|
|
|
447 |
$rubriques = $row_groupes['rubriques'];
|
|
|
448 |
$syndic = $row_groupes['syndic'];
|
|
|
449 |
$acces_minirezo = $row_groupes['minirezo'];
|
|
|
450 |
$acces_comite = $row_groupes['comite'];
|
|
|
451 |
$acces_forum = $row_groupes['forum'];
|
|
|
452 |
|
|
|
453 |
$query = "SELECT * FROM spip_mots WHERE id_groupe = '$id_groupe' ";
|
|
|
454 |
if ($les_mots) $query .= "AND id_mot NOT IN ($les_mots) ";
|
|
|
455 |
$query .= "ORDER BY type, titre";
|
|
|
456 |
$result = spip_query($query);
|
|
|
457 |
if (spip_num_rows($result) > 0) {
|
|
|
458 |
if ((spip_num_rows($result) > 50)) {
|
|
|
459 |
echo "\n<tr>";
|
|
|
460 |
echo $form_mot;
|
|
|
461 |
echo "\n<td>";
|
|
|
462 |
echo $message_ajouter_mot;
|
|
|
463 |
$message_ajouter_mot = "";
|
|
|
464 |
echo "</td>\n<td>";
|
|
|
465 |
$jscript = "onfocus=\"setvisibility('valider_groupe_$id_groupe', 'visible'); if(!antifocus_mots[$id_groupe]){this.value='';antifocus_mots[$id_groupe]=true;}\"";
|
|
|
466 |
|
|
|
467 |
if ($obligatoire == "oui" AND !$groupes_vus[$id_groupe])
|
|
|
468 |
echo "<INPUT TYPE='text' NAME='cherche_mot' CLASS='fondl' STYLE='width: 180px; background-color:#E86519;' VALUE=\"$titre_groupe\" SIZE='20' $jscript>";
|
|
|
469 |
else if ($unseul == "oui")
|
|
|
470 |
echo "<INPUT TYPE='text' NAME='cherche_mot' CLASS='fondl' STYLE='width: 180px; background-color:#cccccc;' VALUE=\"$titre_groupe\" SIZE='20' $jscript>";
|
|
|
471 |
else
|
|
|
472 |
echo "<INPUT TYPE='text' NAME='cherche_mot' CLASS='fondl' STYLE='width: 180px; ' VALUE=\"$titre_groupe\" SIZE='20' $jscript>";
|
|
|
473 |
|
|
|
474 |
echo "</td>\n<td>";
|
|
|
475 |
echo "<INPUT TYPE='hidden' NAME='select_groupe' VALUE='$id_groupe'>";
|
|
|
476 |
|
|
|
477 |
echo "<span class='visible_au_chargement' id='valider_groupe_$id_groupe'>";
|
|
|
478 |
echo " <INPUT TYPE='submit' NAME='Chercher' VALUE='"._T('bouton_chercher')."' CLASS='fondo' STYLE='font-size:10px'>";
|
|
|
479 |
echo "</span>";
|
|
|
480 |
echo "</td></FORM>";
|
|
|
481 |
echo "</tr>";
|
|
|
482 |
}
|
|
|
483 |
else {
|
|
|
484 |
echo "\n<tr>";
|
|
|
485 |
echo $form_mot;
|
|
|
486 |
echo "\n<td>";
|
|
|
487 |
echo $message_ajouter_mot;
|
|
|
488 |
$message_ajouter_mot = "";
|
|
|
489 |
echo "</td>\n<td>";
|
|
|
490 |
|
|
|
491 |
if ($obligatoire == "oui" AND !$groupes_vus[$id_groupe])
|
|
|
492 |
echo "<SELECT NAME='nouv_mot' SIZE='1' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" STYLE='width: 180px; background-color:#E86519;' CLASS='fondl'>";
|
|
|
493 |
else if ($unseul == "oui")
|
|
|
494 |
echo "<SELECT NAME='nouv_mot' SIZE='1' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" STYLE='width: 180px; background-color:#cccccc;' CLASS='fondl'>";
|
|
|
495 |
else
|
|
|
496 |
echo "<SELECT NAME='nouv_mot' SIZE='1' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" STYLE='width: 180px; ' CLASS='fondl'>";
|
|
|
497 |
|
|
|
498 |
$ifond == 0;
|
|
|
499 |
echo "\n<option value='x' style='font-variant: small-caps;'>$titre_groupe</option>";
|
|
|
500 |
while($row = spip_fetch_array($result)) {
|
|
|
501 |
$id_mot = $row['id_mot'];
|
|
|
502 |
$titre_mot = $row['titre'];
|
|
|
503 |
$texte_option = entites_html(textebrut(typo($titre_mot)));
|
|
|
504 |
echo "\n<OPTION VALUE=\"$id_mot\">";
|
|
|
505 |
echo " ";
|
|
|
506 |
echo "$texte_option</option>";
|
|
|
507 |
}
|
|
|
508 |
echo "</SELECT>";
|
|
|
509 |
echo "</td>\n<td>";
|
|
|
510 |
echo "<span class='visible_au_chargement' id='valider_groupe_$id_groupe'>";
|
|
|
511 |
echo " <INPUT TYPE='submit' NAME='Choisir' VALUE='"._T('bouton_choisir')."' CLASS='fondo'>";
|
|
|
512 |
echo "</span>";
|
|
|
513 |
echo "</td></FORM>";
|
|
|
514 |
echo "</tr>";
|
|
|
515 |
}
|
|
|
516 |
}
|
|
|
517 |
}
|
|
|
518 |
|
|
|
519 |
if ($connect_statut == '0minirezo' AND $flag_editable AND $options == "avancees") {
|
|
|
520 |
echo "<tr><td></td><td colspan='2'>";
|
|
|
521 |
echo "<div style='width: 200px;'>";
|
|
|
522 |
$retour = urlencode($GLOBALS['clean_link']->getUrl());
|
|
|
523 |
icone_horizontale(_T('icone_creer_mot_cle'), "mots_edit.php3?new=oui&ajouter_id_article=$id_objet&table=$table&id_table=$id_table&redirect=$retour", "mot-cle-24.gif", "creer.gif");
|
|
|
524 |
echo "</div> ";
|
|
|
525 |
echo "</td></tr>";
|
|
|
526 |
}
|
|
|
527 |
|
|
|
528 |
|
|
|
529 |
|
|
|
530 |
echo "</table>";
|
|
|
531 |
echo fin_block();
|
|
|
532 |
}
|
|
|
533 |
|
|
|
534 |
|
|
|
535 |
fin_cadre_enfonce();
|
|
|
536 |
}
|
|
|
537 |
|
|
|
538 |
|
|
|
539 |
?>
|