[ Index ] |
|
Code source de SPIP 1.9.2c |
1 <?php 2 3 /***************************************************************************\ 4 * SPIP, Systeme de publication pour l'internet * 5 * * 6 * Copyright (c) 2001-2007 * 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 if (!defined("_ECRIRE_INC_VERSION")) return; 14 15 include_spip('inc/presentation'); 16 include_spip('base/abstract_sql'); 17 18 // http://doc.spip.org/@exec_mots_edit_dist 19 function exec_mots_edit_dist() 20 { 21 global 22 $ajouter_id_article, // attention, ce n'est pas forcement un id d'article 23 $champs_extra, 24 $connect_statut, 25 $descriptif, 26 $id_groupe, 27 $id_mot, 28 $table_id, 29 $new, 30 $options, 31 $redirect, 32 $spip_display, 33 $table, 34 $texte, 35 $titre, 36 $titre_mot, 37 $les_notes; 38 39 $id_groupe = intval($id_groupe); 40 $id_mot = intval($id_mot); 41 // Secu un peu superfetatoire car seuls les admin generaux les verront; 42 // mais si un jour on relache les droits, vaut mieux blinder. 43 $table = preg_replace('/\W/','',$table); 44 $table_id = preg_replace('/\W/','',$table_id); 45 $ajouter_id_article = intval($ajouter_id_article); 46 // 47 // Recupere les donnees 48 // 49 $row = spip_fetch_array(spip_query("SELECT * FROM spip_mots WHERE id_mot=$id_mot")); 50 if ($row) { 51 $id_mot = $row['id_mot']; 52 $titre_mot = $row['titre']; 53 $descriptif = $row['descriptif']; 54 $texte = $row['texte']; 55 $extra = $row['extra']; 56 $id_groupe = $row['id_groupe']; 57 $onfocus =''; 58 } else { 59 if (!$new OR !autoriser('modifier','groupemots',$id_groupe)) { 60 echo minipres(_T('info_mot_sans_groupe')); 61 exit; 62 } 63 $id_mot = 0; 64 65 if (!$titre_mot = $titre) { 66 $titre_mot = filtrer_entites(_T('texte_nouveau_mot')); 67 $onfocus = " onfocus=\"if(!antifocus){this.value='';antifocus=true;}\""; 68 } 69 $res = spip_num_rows(spip_query("SELECT id_groupe FROM spip_groupes_mots ". ($table ? "WHERE $table='oui'" : '') . " LIMIT 1")); 70 71 if (!$res) { 72 // cas pathologique: 73 // creation d'un mot sans groupe de mots cree auparavant 74 // (ne devrait arriver qu'en cas d'appel explicite ou 75 // destruction concomittante des groupes de mots idoines) 76 if ($redirect) 77 $redirect = '&redirect=' . $redirect; 78 if ($titre) 79 $titre = "&titre=".rawurlencode($titre); 80 include_spip('inc/headers'); 81 redirige_par_entete(redirige_action_auteur('instituer_groupe_mots', $table, 'mots_edit', "new=$new&table=$table&table_id=$table_id&ajouter_id_article=$ajouter_id_article$titre$redirect", true)); 82 } 83 } 84 85 pipeline('exec_init',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); 86 87 $commencer_page = charger_fonction('commencer_page', 'inc'); 88 $out = $commencer_page("« $titre_mot »", "naviguer", "mots") . debut_gauche('',true); 89 90 91 ////////////////////////////////////////////////////// 92 // Boite "voir en ligne" 93 // 94 95 if ($id_mot) { 96 97 $out .= debut_boite_info(true); 98 $out .= "\n<div style='font-weight: bold; text-align: center' class='verdana1 spip_xx-small'>" 99 . _T('titre_gauche_mots_edit') 100 . "<br /><span class='spip_xx-large'>" 101 . $id_mot 102 . '</span></div>'; 103 $out .= voir_en_ligne ('mot', $id_mot, false, 'racine-24.gif', false); 104 $out .= fin_boite_info(true); 105 106 // Logos du mot-clef 107 108 if (autoriser('modifier','groupemots',$id_groupe) AND ($spip_display != 4)) { 109 $iconifier = charger_fonction('iconifier', 'inc'); 110 $out .= $iconifier('id_mot', $id_mot, 'mots_edit'); 111 } 112 } 113 114 // 115 // Afficher les boutons de creation 116 // 117 118 $res =''; 119 120 if ($id_groupe AND autoriser('modifier','groupemots',$id_groupe)) { 121 $res = icone_horizontale(_T('icone_modif_groupe_mots'), generer_url_ecrire("mots_type","id_groupe=$id_groupe"), "groupe-mot-24.gif", "edit.gif", false) 122 . icone_horizontale(_T('icone_creation_mots_cles'), generer_url_ecrire("mots_edit", "new=oui&id_groupe=$id_groupe&redirect=" . generer_url_retour('mots_tous')), "mot-cle-24.gif", "creer.gif", false); 123 } 124 125 126 $out .= pipeline('affiche_gauche',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); 127 128 $out .= bloc_des_raccourcis($res . icone_horizontale(_T('icone_voir_tous_mots_cles'), generer_url_ecrire("mots_tous",""), "mot-cle-24.gif", "rien.gif", false)); 129 130 131 $out .= creer_colonne_droite('',true); 132 133 $out .= pipeline('affiche_droite',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); 134 135 $out .= debut_droite('',true); 136 137 $out .= debut_cadre_relief("mot-cle-24.gif",true); 138 139 140 $out .= "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>"; 141 $out .= "<tr>"; 142 $out .= "<td style='width: 100%' valign='top'>"; 143 $out .= gros_titre($titre_mot,'',false); 144 145 if ($descriptif) { 146 $out .= "<div style='border: 1px dashed #aaaaaa; ' class='verdana1 spip_small'>"; 147 $out .= "<b>" . _T('info_descriptif') . "</b> "; 148 $out .= propre($descriptif); 149 $out .= " "; 150 $out .= "</div>"; 151 } 152 153 $out .= "</td>"; 154 $out .= "</tr></table>\n"; 155 156 157 if (strlen($texte)>0){ 158 $out .= "<p class='verdana1 spip_small'>"; 159 $out .= propre($texte); 160 $out .= "</p>"; 161 } 162 163 if ($les_notes) { 164 $out .= debut_cadre_relief('',true); 165 $out .= "<div $dir_lang class='arial11'>"; 166 $out .= justifier("<b>"._T('info_notes')." :</b> ".$les_notes); 167 $out .= "</div>"; 168 $out .= fin_cadre_relief(true); 169 } 170 171 if ($id_mot) { 172 173 if ($connect_statut == "0minirezo") 174 $aff_articles = "'prepa','prop','publie','refuse'"; 175 else 176 $aff_articles = "'prop','publie'"; 177 178 $out .= afficher_rubriques('<b>' . _T('info_rubriques_liees_mot') . '</b>', array("FROM" => 'spip_rubriques AS rubrique, spip_mots_rubriques AS lien', 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_rubrique=rubrique.id_rubrique", 'ORDER BY' => "rubrique.titre")); 179 180 $out .= afficher_articles(_T('info_articles_lies_mot'), array('FROM' => "spip_articles AS articles, spip_mots_articles AS lien", 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_article=articles.id_article AND articles.statut IN ($aff_articles)", 'ORDER BY' => "articles.date DESC")); 181 182 $out .= afficher_breves('<b>' . _T('info_breves_liees_mot') . '</b>', array("FROM" => 'spip_breves AS breves, spip_mots_breves AS lien', 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_breve=breves.id_breve", 'ORDER BY' => "breves.date_heure DESC")); 183 184 include_spip('inc/sites_voir'); 185 $out .= afficher_sites('<b>' . _T('info_sites_lies_mot') . '</b>', array("FROM" => 'spip_syndic AS syndic, spip_mots_syndic AS lien', 'WHERE' => "lien.id_mot='$id_mot' AND lien.id_syndic=syndic.id_syndic", 'ORDER BY' => "syndic.nom_site DESC")); 186 } 187 188 $out .= fin_cadre_relief(true); 189 190 $out .= pipeline('affiche_milieu',array('args'=>array('exec'=>'mots_edit','id_mot'=>$id_mot),'data'=>'')); 191 192 if (autoriser('modifier','groupemots',$id_groupe)){ 193 194 $out .= debut_cadre_formulaire('',true); 195 196 $res = "<div class='serif'>"; 197 198 $titre_mot = entites_html($titre_mot); 199 $descriptif = entites_html($descriptif); 200 $texte = entites_html($texte); 201 202 $res .= "<b>"._T('info_titre_mot_cle')."</b> "._T('info_obligatoire_02'); 203 $res .= aide ("mots"); 204 205 $res .= "<br /><input type='text' name='titre' class='formo' value=\"$titre_mot\" size='40' $onfocus />"; 206 207 $res .= determine_groupe_mots($table, $id_groupe); 208 209 210 if ($options == 'avancees' OR $descriptif) { 211 $res .= "<b>"._T('texte_descriptif_rapide')."</b><br />"; 212 $res .= "<textarea name='descriptif' class='forml' rows='4' cols='40'>"; 213 $res .= $descriptif; 214 $res .= "</textarea><br />\n"; 215 } 216 else 217 $res .= "<input type='hidden' name='descriptif' value=\"$descriptif\" />"; 218 219 if ($options == 'avancees' OR $texte) { 220 $res .= "<b>"._T('info_texte_explicatif')."</b><br />"; 221 $res .= "<textarea name='texte' rows='8' class='forml' cols='40'>"; 222 $res .= $texte; 223 $res .= "</textarea><br />\n"; 224 } 225 else 226 $res .= "<input type='hidden' name='texte' value=\"$texte\" />"; 227 228 if ($champs_extra) { 229 include_spip('inc/extra'); 230 $res .= extra_saisie($extra, 'mots', $id_groupe); 231 } 232 233 $res .= "<div align='right'><input type='submit' value='"._T('bouton_enregistrer')."' class='fondo' /></div>"; 234 235 $res .= "</div>"; 236 237 if (!$redirect) 238 $redirect = generer_url_ecrire('mots_edit','id_mot='.$id_mot, '&',true); 239 else 240 $redirect = rawurldecode($redirect); 241 $arg = !$table ? $id_mot : "$id_mot,$ajouter_id_article,$table,$table_id"; 242 243 $out .= generer_action_auteur("instituer_mot", $arg, _DIR_RESTREINT_ABS . $redirect, $res); 244 245 $out .= fin_cadre_formulaire(true); 246 } 247 248 echo $out, fin_gauche(), fin_page(); 249 } 250 251 252 // http://doc.spip.org/@determine_groupe_mots 253 function determine_groupe_mots($table, $id_groupe) { 254 255 $q = spip_query("SELECT id_groupe, titre FROM spip_groupes_mots ". ($table ? "WHERE $table='oui'" : '') . " ORDER BY titre"); 256 257 if (spip_num_rows($q)>1) { 258 259 $res = " <select name='id_groupe' class='fondl'>\n"; 260 while ($row = spip_fetch_array($q)){ 261 $groupe = $row['id_groupe']; 262 $titre_groupe = texte_backend(supprimer_tags(typo($row['titre']))); 263 $res .= "<option".mySel($groupe, $id_groupe).">$titre_groupe</option>\n"; 264 } 265 $res .= "</select>"; 266 } else { 267 // pas de menu si un seul groupe 268 // (et on est sur qu'il y en a un grace au redirect preventif) 269 $row = spip_fetch_array($q); 270 $res = $row['titre'] 271 . "<br /><input type='hidden' name='id_groupe' value='".$row['id_groupe']."' />"; 272 } 273 274 return _T('info_dans_groupe') 275 . aide("motsgroupes") 276 . debut_cadre_relief("groupe-mot-24.gif", true) 277 . $res 278 . fin_cadre_relief(true); 279 } 280 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Wed Nov 21 10:20:27 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |