diff --git a/ecrire/articles_tous.php3 b/ecrire/articles_tous.php3 index 0759e6e88a8d046650fb1cf7f78547c4e25f947b..4bd7ade28425ef8f78e83ee01417dd865e7007d3 100644 --- a/ecrire/articles_tous.php3 +++ b/ecrire/articles_tous.php3 @@ -140,65 +140,40 @@ debut_boite_info(); echo "<B>"._T('titre_cadre_afficher_article')." :</B><BR>"; - - - - -if ($aff_statut["prepa"]) { - if (ereg('prepa', $aff_art)) { - echo "<input type='checkbox' CHECKED name='aff_art[]' value='prepa' id='prepa'>"; - } - else { - echo "<input type='checkbox' name='aff_art[]' value='prepa' id='prepa'>"; - } - echo " <label for='prepa'>". http_img_pack('puce-blanche-breve.gif', "", "width='8' height='9' border='0'"); - echo " "._T('texte_statut_en_cours_redaction')."</label><BR>"; -} - - -if ($aff_statut["prop"]) { - if (ereg('prop', $aff_art)) { - echo "<input type='checkbox' CHECKED name='aff_art[]' value='prop' id='prop'>"; - } - else { - echo "<input type='checkbox' name='aff_art[]' value='prop' id='prop'>"; - } - echo " <label for='prop'>". http_img_pack('puce-orange-breve.gif', "", "width='8' height='9' border='0'"); - echo " "._T('texte_statut_attente_validation')."</label><BR>"; -} +if ($aff_statut['prepa']) + echo http_label_img('prepa', + strpos($aff_art, 'prepa'), + 'aff_art', + 'puce-blanche-breve.gif', + _T('texte_statut_en_cours_redaction')); + +if ($aff_statut['prop']) + echo http_label_img('prop', + strpos($aff_art, 'prop'), + 'aff_art', + 'puce-orange-breve.gif', + _T('texte_statut_attente_validation')); -if ($aff_statut["publie"]) { - if (ereg('publie', $aff_art)) { - echo "<input type='checkbox' CHECKED name='aff_art[]' value='publie' id='publie'>"; - } - else { - echo "<input type='checkbox' name='aff_art[]' value='publie' id='publie'>"; - } - echo " <label for='publie'>". http_img_pack('puce-verte-breve.gif', "", "width='8' height='9' border='0'"); - echo " "._T('texte_statut_publies')."</label><BR>"; -} - -if ($aff_statut["refuse"]) { - if (ereg("refuse",$aff_art)) { - echo "<input type='checkbox' CHECKED name='aff_art[]' value='refuse' id='refuse'>"; - } - else { - echo "<input type='checkbox' name='aff_art[]' value='refuse' id='refuse'>"; - } - echo " <label for='refuse'>" . http_img_pack('puce-rouge-breve.gif', "", "width='8' height='9' border='0'"); - echo " "._T('texte_statut_refuses')."</label><BR>"; -} - -if ($aff_statut["poubelle"]) { - if (ereg('poubelle',$aff_art)) { - echo "<input type='checkbox' CHECKED name='aff_art[]' value='poubelle' id='poubelle'>"; - } - else { - echo "<input type='checkbox' name='aff_art[]' value='poubelle' id='poubelle'>"; - } - echo " <label for='poubelle'>" . http_img_pack('puce-poubelle-breve.gif', "", "width='8' height='9' border='0'"); - echo " "._T('texte_statut_poubelle')."</label>"; -} +if ($aff_statut['publie']) + echo http_label_img('publie', + strpos($aff_art, 'publie'), + 'aff_art', + 'puce-verte-breve.gif', + _T('texte_statut_refuse')); + +if ($aff_statut['refuse']) + echo http_label_img('refuse', + strpos($aff_art, 'refuse'), + 'aff_art', + 'puce-rouge-breve.gif', + _T('texte_statut_refuses')); + +if ($aff_statut['poubelle']) + echo http_label_img('poubelle', + strpos($aff_art, 'poubelle'), + 'aff_art', + 'puce-poubelle-breve.gif', + _T('texte_statut_poubelle')); echo "<div align='$spip_lang_right'><INPUT TYPE='submit' NAME='Changer' CLASS='fondo' VALUE='"._T('bouton_changer')."'></div>"; diff --git a/ecrire/inc_filtres.php3 b/ecrire/inc_filtres.php3 index f7f1066d7b14642bbfc56bdd00a262053379bc8e..79b009bbafbd4ce0bc36d8687d040ebc26d2fe88 100644 --- a/ecrire/inc_filtres.php3 +++ b/ecrire/inc_filtres.php3 @@ -171,15 +171,30 @@ function http_href($href, $clic, $title='', $style='', $class='', $evt='') { '</a>'; } -// produit une balise img avec un champ alt d'office (et different) si vide +// produit une balise img avec un champ alt d'office si vide // attention le htmlentities et la traduction doivent etre appliques avant. function http_img_pack($img, $alt, $att, $title='') { - static $num = 0; return "<img src='" . _DIR_IMG_PACK . $img - . ("'\nalt=\"" . ($alt ? $alt : ('img_pack' . $num++)) . '" ') - . ($title ? " title=\"$title\"" : '') - . $att . " />"; + . ("'\nalt=\"" . + ($alt ? $alt : ($title ? $title : ereg_replace('\..*$','',$img))) + . '" ') + . ($title ? " title=\"$title\"" : '') + . $att . " />"; +} + +// variante avec un label et un checkbox + +function http_label_img($statut, $etat, $var, $img, $texte) { + return "<label for='$statut'>". + "<input type='checkbox' " . + (($etat !== false) ? ' checked="checked"' : '') . + " name='$var" . + "[]' value='$statut' id='$statut'> " . + http_img_pack($img, $texte, "width='8' height='9' border='0'", $texte) . + " " . + $texte . + "</label><br />"; } function http_href_img($href, $img, $att, $title='', $style='', $class='', $evt='') { diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index c42eda2a7f01c75740f19ebb5ab747a364cffa0a..b682a41eee787ef6abd3cf082216a59165a74baf 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -72,7 +72,7 @@ function bouton_imessage($destinataire, $row = '') { if ($destinataire) $title = _T('info_envoyer_message_prive'); else $title = _T('info_ecire_message_prive'); - $texte_bouton = http_img_pack("m_envoi$spip_lang_rtl.gif", "m>", "width='14' height='7' border='0' title='$title'"); + $texte_bouton = http_img_pack("m_envoi$spip_lang_rtl.gif", "m>", "width='14' height='7' border='0'", $title); $ret .= "<a href='". $url->getUrl() ."' title=\"$title\">"; @@ -809,8 +809,8 @@ function afficher_articles($titre_table, $requete, $afficher_visites = false, $a $s = "<div>"; if (acces_restreint_rubrique($id_rubrique)) - $s .= http_img_pack("admin-12.gif", "", "width='12' height='12' title='"._T('titre_image_admin_article')."'") . " "; - $s .= "<a href=\"articles.php3?id_article=$id_article\"$descriptif$dir_lang style=\"display:block;\">"; + $s .= http_img_pack("admin-12.gif", "", "width='12' height='12'", _T('titre_image_admin_article')) + . " <a href=\"articles.php3?id_article=$id_article\"$descriptif$dir_lang style=\"display:block;\">"; if ($spip_display != 1 AND $spip_display != 4 AND lire_meta('image_process') != "non") { include_ecrire("inc_logos.php3"); @@ -1086,27 +1086,26 @@ function bonhomme_statut($row) { switch($row['statut']) { case "0minirezo": - $image = http_img_pack("admin-12.gif", "", "title='"._T('titre_image_administrateur')."' border='0'"); + return http_img_pack("admin-12.gif", "", "border='0'", + _T('titre_image_administrateur')); break; case "1comite": if ($connect_statut == '0minirezo' AND ($row['source'] == 'spip' AND !($row['pass'] AND $row['login']))) - $image = http_img_pack("visit-12.gif", "", "title='"._T('titre_image_redacteur')."' border='0'"); + return http_img_pack("visit-12.gif",'', "border='0'", _T('titre_image_redacteur')); else - $image = http_img_pack("redac-12.gif", "", "title='"._T('titre_image_redacteur_02')."' border='0'"); + return http_img_pack("redac-12.gif",'', "border='0'", _T('titre_image_redacteur_02')); break; case "5poubelle": - $image = http_img_pack("poubelle.gif", "", "title='"._T('titre_image_auteur_supprime')."' border='0'"); + return http_img_pack("poubelle.gif", '', "border='0'",_T('titre_image_auteur_supprime')); break; case "6forum": - $image = http_img_pack("visit-12.gif", "", "title='"._T('titre_image_visiteur')."' border='0'"); + return http_img_pack("visit-12.gif", '', "border='0'",_T('titre_image_visiteur')); break; case "nouveau": default: - $image = ''; + return ''; break; } - - return $image; } // La couleur du statut