From 531e0d2bda4bda382f1a4719ce379127e0a0c0f4 Mon Sep 17 00:00:00 2001 From: Fil <fil@rezo.net> Date: Fri, 16 May 2008 20:05:09 +0000 Subject: [PATCH] inutile de passer le formulaire de date en display:none -- si on ne l'affiche pas il ne se passe rien (elle n'est pas remise a zero) ; par ailleurs ne pas afficher la date du doc si on ne peut pas la modifier : considerer que c'est juste non pertinent. --- ecrire/configuration/documents.php | 18 ++++++++--------- ecrire/inc/documents.php | 3 +-- ecrire/inc/legender.php | 31 +++++++++++++++--------------- 3 files changed, 25 insertions(+), 27 deletions(-) diff --git a/ecrire/configuration/documents.php b/ecrire/configuration/documents.php index 6bff2d428c..8baf795a33 100644 --- a/ecrire/configuration/documents.php +++ b/ecrire/configuration/documents.php @@ -21,11 +21,7 @@ include_spip('inc/config'); function configuration_documents_dist(){ global $spip_lang_left, $spip_lang_right; - - $documents_rubrique = $GLOBALS['meta']["documents_rubrique"]; - $documents_article = $GLOBALS['meta']["documents_article"]; - $documents_date = $GLOBALS['meta']["documents_date"]; - + $res = "<table border='0' cellspacing='1' cellpadding='3' width=\"100%\">"; $res .= "<tr><td class='verdana2'>"; $res .= _T('texte_documents_joints'); @@ -34,15 +30,18 @@ function configuration_documents_dist(){ $res .= "<tr>"; $res .= "<td align='$spip_lang_left' class='verdana2'>"; - $res .= afficher_choix('documents_article', $documents_article, + $res .= afficher_choix('documents_article', + $GLOBALS['meta']["documents_article"], array('oui' => _T('item_autoriser_documents_joints'), 'non' => _T('item_non_autoriser_documents_joints')), "<br />\n"); $res .= "<br /><br />\n"; - $res .= afficher_choix('documents_rubrique', $documents_rubrique, + $res .= afficher_choix('documents_rubrique', + $GLOBALS['meta']["documents_rubrique"], array('oui' => _T('item_autoriser_documents_joints_rubriques'), 'non' => _T('item_non_autoriser_documents_joints_rubriques')), "<br />\n"); $res .= "<br /><br />\n"; - $res .= afficher_choix('documents_date', $documents_date, + $res .= afficher_choix('documents_date', + $GLOBALS['meta']["documents_date"], array('oui' => _L('Pouvoir sélectionner la date de mise en ligne de chaque document'), 'non' => _L('Ne pas pouvoir changer manuellement la date des documents')), "<br />\n"); $res .= "</td></tr>"; @@ -54,6 +53,5 @@ function configuration_documents_dist(){ return ajax_action_greffe('configurer-documents', '', $res); } -?> - +?> diff --git a/ecrire/inc/documents.php b/ecrire/inc/documents.php index cc3f38b717..8317b308dc 100644 --- a/ecrire/inc/documents.php +++ b/ecrire/inc/documents.php @@ -330,8 +330,7 @@ function est_inclus($id_document) { // http://doc.spip.org/@afficher_case_document function afficher_case_document($id_document, $id, $script, $type, $deplier=false) { global $spip_lang_right; - $documents_date = $GLOBALS['meta']["documents_date"]; - + $table = 'spip_documents_' . $type . 's'; $prim = id_table_objet($table); if (!$prim) return ''; diff --git a/ecrire/inc/legender.php b/ecrire/inc/legender.php index d70daab27b..4d0914a45d 100644 --- a/ecrire/inc/legender.php +++ b/ecrire/inc/legender.php @@ -79,7 +79,8 @@ function inc_legender_dist($id_document, $document, $script, $type, $id, $ancre, else $contenu .= taille_en_octets($document['taille']); - if ($date) $contenu .= "<br />\n" . affdate($date); + if ($date AND ($GLOBALS['meta']["documents_date"] == 'oui')) + $contenu .= "<br />\n" . affdate($date); include_spip('inc/editer'); $corps = (!$contenu ? '' : @@ -87,9 +88,11 @@ function inc_legender_dist($id_document, $document, $script, $type, $id, $ancre, "<label for='titre_document$id_document'><b>$label</b></label><br />\n" . "<input type='text' name='titre_document' id='titre_document$id_document' class='formo' value=\"".entites_html($titre). - "\" size='40' onfocus=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\" /><br />\n" . - date_formulaire_legender($date, $id_document) . - "<label for='descriptif_document$id_document'><b>". + "\" size='40' onfocus=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\" /><br />\n" + . (($GLOBALS['meta']["documents_date"] == 'oui') + ? date_formulaire_legender($date, $id_document) + :'' ) + . "<label for='descriptif_document$id_document'><b>". _T('info_description_2'). "</b></label><br />\n" . "<textarea name='descriptif_document' id='descriptif_document$id_document' rows='4' class='formo' cols='*' onfocus=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\">" . @@ -231,7 +234,6 @@ function formulaire_taille($document) { // http://doc.spip.org/@date_formulaire_legender function date_formulaire_legender($date, $id_document) { - $documents_date = $GLOBALS['meta']["documents_date"]; if (preg_match(",([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2}):([0-9]{2}),", $date, $regs)){ $mois = $regs[2]; @@ -240,17 +242,16 @@ function date_formulaire_legender($date, $id_document) { $heure = $regs[4]; $minute = $regs[5]; } - if ($documents_date != "oui") $style = " style='display: none;'"; - - return "<div $style><b>"._T('info_mise_en_ligne')."</b><br />\n" . - afficher_jour($jour, "name='jour_doc' id='jour_doc$id_document' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\"") . - afficher_mois($mois, "name='mois_doc' id='mois_doc$id_document' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\"") . - afficher_annee($annee, "name='annee_doc' id='annee_doc$id_document' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block')\"") . - "<br />". - afficher_heure($heure, "name='heure_doc' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block')\"") . + + return "<div><b>"._T('info_mise_en_ligne')."</b><br />\n" . + afficher_jour($jour, "name='jour_doc' id='jour_doc$id_document' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\"") . + afficher_mois($mois, "name='mois_doc' id='mois_doc$id_document' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block');\"") . + afficher_annee($annee, "name='annee_doc' id='annee_doc$id_document' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block')\"") . + "<br />". + afficher_heure($heure, "name='heure_doc' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block')\"") . " : ". - afficher_minute($minute, "name='minute_doc' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block')\"") . - "<br /><br /></div>\n"; + afficher_minute($minute, "name='minute_doc' size='1' class='fondl spip_xx-small'\n\tonchange=\"changeVisible(true, 'valider_doc$id_document', 'block', 'block')\"") . + "<br /><br /></div>\n"; } -- GitLab