diff --git a/ecrire/exec/articles.php b/ecrire/exec/articles.php index 15a9f67bd62b1df04131d7fc63a12db86195790a..17cfe730312d9da8cf3a3af0f3ba740b3fc01561 100644 --- a/ecrire/exec/articles.php +++ b/ecrire/exec/articles.php @@ -794,6 +794,7 @@ function langues_articles($id_article, $langue_article, $flag_editable, $id_rubr // Afficher la liste des traductions + $ret = false; if ($id_trad != 0) { $result_trad = spip_query("SELECT id_article, id_rubrique, titre, lang, statut FROM spip_articles WHERE id_trad = $id_trad"); @@ -831,7 +832,7 @@ function langues_articles($id_article, $langue_article, $flag_editable, $id_rubr else $vals[] = http_img_pack('langues-off-12.gif', "", "width='12' height='12' border='0'"); } - $ret .= "</td>"; + $ret = true; $s = typo($titre_trad); if ($id_article_trad != $id_article) diff --git a/ecrire/inc/date.php b/ecrire/inc/date.php index d6d033158e33d56dd92d48ec1a979540ca69ef29..485a3d3fa751a28e2e4168aad7532418f6676470 100644 --- a/ecrire/inc/date.php +++ b/ecrire/inc/date.php @@ -69,6 +69,7 @@ function afficher_jour($jour, $attributs, $autre=false){ } function afficher_heure($heure, $attributs, $autre=false){ + $res = ''; for($i=0;$i<=23;$i++){ $aff = sprintf("%02s", $i); $res .= my_sel($i,$aff,$heure); @@ -77,6 +78,7 @@ function afficher_heure($heure, $attributs, $autre=false){ } function afficher_minute($minute, $attributs, $autre=false){ + $res = ''; for($i=0;$i<=59;$i+=5){ $aff = sprintf("%02s", $i); $res .= my_sel($i,$aff,$minute); diff --git a/ecrire/inc/layer.php b/ecrire/inc/layer.php index d119075249ff822471865a0f3e45a3dcb9213cfe..5dfdd1fdd50c3c234503d9188110bb596567981c 100644 --- a/ecrire/inc/layer.php +++ b/ecrire/inc/layer.php @@ -11,6 +11,10 @@ \***************************************************************************/ if (!defined("_ECRIRE_INC_VERSION")) return; +global $numero_block, $compteur_block; + +$numero_block = array(); +$compteur_block = 0; function debut_block_visible($nom_block){ global $numero_block, $compteur_block, $browser_layer; @@ -44,7 +48,6 @@ function fin_block() { function bouton_block_invisible($nom_block, $icone='') { global $numero_block, $compteur_block, $browser_layer, $spip_lang_rtl; - if (!$browser_layer) return ''; $blocks = explode(",", $nom_block); $javasc = array(); @@ -69,7 +72,6 @@ function bouton_block_invisible($nom_block, $icone='') { function bouton_block_visible($nom_block){ global $numero_block, $compteur_block, $browser_layer, $spip_lang_rtl; - if (!$browser_layer) return ''; $blocks = explode(",", $nom_block); $javasc = array(); diff --git a/ecrire/inc/mots.php b/ecrire/inc/mots.php index 5c8f8137b8723093c92ded65e51e9be20468f314..c5e8f5bfcf4945927c80ac12d32fbed09d6adfaa 100644 --- a/ecrire/inc/mots.php +++ b/ecrire/inc/mots.php @@ -258,8 +258,8 @@ function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot, $reindexer = true; } - if ($flag_editable && ($supp_mot = intval($supp_mot))) { - $result = spip_query("DELETE FROM spip_mots_$table WHERE $table_id=$id_objet" . (($supp_mot == -1) ? "" : " AND id_mot=$supp_mot")); + if ($flag_editable && $supp_mot) { + $result = spip_query("DELETE FROM spip_mots_$table WHERE $table_id=$id_objet" . (($supp_mot == -1) ? "" : " AND id_mot=" . intval($supp_mot) )); $reindexer = true; } @@ -276,6 +276,7 @@ function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot, $les_mots = array(); $id_groupes_vus = array(); + $groupes_vus = array(); $result = spip_query("SELECT mots.* FROM spip_mots AS mots, spip_mots_$table AS lien WHERE lien.$table_id=$id_objet AND mots.id_mot=lien.id_mot ORDER BY mots.type, mots.titre"); @@ -389,7 +390,7 @@ function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot, // if ($flag_editable) { - if ($nouveaux_mots.$cherche_mot.$supp_mot) + if ($nouveaux_mots||$cherche_mot||$supp_mot) echo debut_block_visible("lesmots"); else if ($nb_groupes > 0) { echo debut_block_visible("lesmots"); @@ -412,93 +413,21 @@ function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot, $form_mot = generer_url_post_ecrire($url_base,"$table_id=$id_objet", '', "#mots"); - if ($table == 'rubriques') $form_mot .= "<INPUT TYPE='Hidden' NAME='id_rubrique' VALUE='$id_objet' />"; + if ($table == 'rubriques') $form_mot .= "<input type='hidden' name='id_rubrique' value='$id_objet' />"; - $message_ajouter_mot = "<span class='verdana1'><B>"._T('titre_ajouter_mot_cle')."</B></span> \n"; echo "<table border='0' width='100%' style='text-align: $spip_lang_right'>"; - $result_groupes = spip_query("SELECT *, ".creer_objet_multi ("titre", $spip_lang)." FROM spip_groupes_mots WHERE $table = 'oui' AND ".substr($connect_statut,1)." = 'oui' AND (unseul != 'oui' OR (unseul = 'oui' AND id_groupe NOT IN ($id_groupes_vus))) ORDER BY multi"); + $result_groupes = spip_query("SELECT id_groupe,unseul,obligatoire,titre, ".creer_objet_multi ("titre", $spip_lang)." FROM spip_groupes_mots WHERE $table = 'oui' AND ".substr($connect_statut,1)." = 'oui' AND (unseul != 'oui' OR (unseul = 'oui' AND id_groupe NOT IN ($id_groupes_vus))) ORDER BY multi"); // Afficher un menu par groupe de mots + $message_ajouter_mot = "<span class='verdana1'><b>"._T('titre_ajouter_mot_cle')."</b></span> \n"; while ($row_groupes = spip_fetch_array($result_groupes)) { - $id_groupe = $row_groupes['id_groupe']; - $titre_groupe = entites_html(textebrut(typo($row_groupes['titre']))); - $unseul = $row_groupes['unseul']; - $obligatoire = $row_groupes['obligatoire']; - $articles = $row_groupes['articles']; - $breves = $row_groupes['breves']; - $rubriques = $row_groupes['rubriques']; - $syndic = $row_groupes['syndic']; - $acces_minirezo = $row_groupes['minirezo']; - $acces_comite = $row_groupes['comite']; - $acces_forum = $row_groupes['forum']; - - $result = spip_query("SELECT * FROM spip_mots WHERE id_groupe =$id_groupe " . ($les_mots ? "AND id_mot NOT IN ($les_mots) " : '') . "ORDER BY type, titre"); - - if (spip_num_rows($result) > 0) { - if ((spip_num_rows($result) > 50)) { - echo "\n<tr>"; - echo $form_mot; - echo "\n<td>"; - echo $message_ajouter_mot; - $message_ajouter_mot = ""; - echo "</td>\n<td>"; - $jscript = "onfocus=\"setvisibility('valider_groupe_$id_groupe', 'visible'); if(!antifocus_mots[$id_groupe]){this.value='';antifocus_mots[$id_groupe]=true;}\""; - - if ($obligatoire == "oui" AND !$groupes_vus[$id_groupe]) - echo "<INPUT TYPE='text' NAME='cherche_mot' CLASS='fondl' STYLE='width: 180px; background-color:#E86519;' VALUE=\"$titre_groupe\" SIZE='20' $jscript>"; - else if ($unseul == "oui") - echo "<INPUT TYPE='text' NAME='cherche_mot' CLASS='fondl' STYLE='width: 180px; background-color:#cccccc;' VALUE=\"$titre_groupe\" SIZE='20' $jscript>"; - else - echo "<INPUT TYPE='text' NAME='cherche_mot' CLASS='fondl' STYLE='width: 180px; ' VALUE=\"$titre_groupe\" SIZE='20' $jscript>"; - - echo "</td>\n<td>"; - echo "<INPUT TYPE='hidden' NAME='select_groupe' VALUE='$id_groupe'>"; - - echo "<span class='visible_au_chargement' id='valider_groupe_$id_groupe'>"; - echo " <INPUT TYPE='submit' NAME='Chercher' VALUE='"._T('bouton_chercher')."' CLASS='fondo' STYLE='font-size:10px'>"; - echo "</span>"; - echo "</td></FORM>"; - echo "</tr>"; - } - else { - echo "\n<tr>"; - echo $form_mot; - echo "\n<td>"; - echo $message_ajouter_mot; - $message_ajouter_mot = ""; - echo "</td>\n<td>"; - - if ($obligatoire == "oui" AND !$groupes_vus[$id_groupe]) - echo "<SELECT NAME='nouv_mot' SIZE='1' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" STYLE='width: 180px; background-color:#E86519;' CLASS='fondl'>"; - else if ($unseul == "oui") - echo "<SELECT NAME='nouv_mot' SIZE='1' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" STYLE='width: 180px; background-color:#cccccc;' CLASS='fondl'>"; - else - echo "<SELECT NAME='nouv_mot' SIZE='1' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" STYLE='width: 180px; ' CLASS='fondl'>"; - - $ifond == 0; - echo "\n<option value='x' style='font-variant: small-caps;'>$titre_groupe</option>"; - while($row = spip_fetch_array($result)) { - $id_mot = $row['id_mot']; - $titre_mot = $row['titre']; - $texte_option = entites_html(textebrut(typo($titre_mot))); - echo "\n<OPTION VALUE=\"$id_mot\">"; - echo " "; - echo "$texte_option</option>"; - } - echo "</SELECT>"; - echo "</td>\n<td>"; - echo "<span class='visible_au_chargement' id='valider_groupe_$id_groupe'>"; - echo " <INPUT TYPE='submit' NAME='Choisir' VALUE='"._T('bouton_choisir')."' CLASS='fondo'>"; - echo "</span>"; - echo "</td></FORM>"; - echo "</tr>"; - } - } + if (menu_mots($row_groupes, $form_mot, $groupes_vus, $les_mots, $message_ajouter_mot)) + $message_ajouter_mot = ""; } if ($connect_statut == '0minirezo' AND $flag_editable AND $options == "avancees" AND $connect_toutes_rubriques) { @@ -509,16 +438,72 @@ function formulaire_mots($table, $id_objet, $nouv_mot, $supp_mot, $cherche_mot, echo "</td></tr>"; } - - echo "</table>"; echo fin_block(); } - fin_cadre_enfonce(); } +function menu_mots($row, $form_mot, $groupes_vus, $les_mots, $message_ajouter_mot) +{ + $id_groupe = $row['id_groupe']; + $titre_groupe = entites_html(textebrut(typo($row['titre']))); + $unseul = $row['unseul']; + $obligatoire = $row['obligatoire']; + + $result = spip_query("SELECT id_mot, type, titre FROM spip_mots WHERE id_groupe =$id_groupe " . ($les_mots ? "AND id_mot NOT IN ($les_mots) " : '') . "ORDER BY type, titre"); + + $n = spip_num_rows($result); + if (!$n) return false; + + // faudrait rendre ca validable quand meme + echo $form_mot, "\n<tr><td>", $message_ajouter_mot, "</td>\n<td>"; + + if ($n > 50) { + $jscript = "onfocus=\"setvisibility('valider_groupe_$id_groupe', 'visible'); if(!antifocus_mots[$id_groupe]){this.value='';antifocus_mots[$id_groupe]=true;}\""; + + if ($obligatoire == "oui" AND !$groupes_vus[$id_groupe]) + echo "<input type='text' name='cherche_mot' class='fondl' style='width: 180px; background-color:#E86519;' value=\"$titre_groupe\" size='20' $jscript>"; + else if ($unseul == "oui") + echo "<input type='text' name='cherche_mot' class='fondl' style='width: 180px; background-color:#cccccc;' value=\"$titre_groupe\" size='20' $jscript>"; + else + echo "<input type='text' name='cherche_mot' class='fondl' style='width: 180px; ' value=\"$titre_groupe\" size='20' $jscript>"; + + echo "</td>\n<td>"; + echo "<input type='hidden' name='select_groupe' value='$id_groupe'>"; + echo "<span class='visible_au_chargement' id='valider_groupe_$id_groupe'>"; + echo " <input type='submit' value='"._T('bouton_chercher')."' class='fondo' style='font-size:10px'>"; + echo "</span>"; + } else { + + if ($obligatoire == "oui" AND !$groupes_vus[$id_groupe]) + echo "<SELECT NAME='nouv_mot' SIZE='1' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" STYLE='width: 180px; background-color:#E86519;' CLASS='fondl'>"; + else if ($unseul == "oui") + echo "<SELECT NAME='nouv_mot' SIZE='1' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" STYLE='width: 180px; background-color:#cccccc;' CLASS='fondl'>"; + else + echo "<SELECT NAME='nouv_mot' SIZE='1' onChange=\"setvisibility('valider_groupe_$id_groupe', 'visible');\" STYLE='width: 180px; ' CLASS='fondl'>"; + + echo "\n<option value='x' style='font-variant: small-caps;'>$titre_groupe</option>"; + while($row = spip_fetch_array($result)) { + $id_mot = $row['id_mot']; + $titre_mot = $row['titre']; + $texte_option = entites_html(textebrut(typo($titre_mot))); + echo "\n<OPTION VALUE=\"$id_mot\">"; + echo " "; + echo "$texte_option</option>"; + } + echo "</SELECT>"; + echo "</td>\n<td>"; + echo "<span class='visible_au_chargement' id='valider_groupe_$id_groupe'>"; + echo " <input type='submit' value='"._T('bouton_choisir')."' CLASS='fondo'>"; + echo "</span>"; + } + echo "</td></tr></form>\n"; + + return true; +} + // // Calculer les nombres d'elements (articles, etc.) lies a chaque mot