From af1381a67709bfabd77980cc2d0a682e8e010169 Mon Sep 17 00:00:00 2001
From: ARNO* <arno@rezo.net>
Date: Thu, 15 May 2008 16:22:39 +0000
Subject: [PATCH] Date de publication des documents passe en optionnel
 (desactive par defaut)

---
 ecrire/configuration/documents.php |  7 +++++++
 ecrire/inc/config.php              |  1 +
 ecrire/inc/documents.php           |  3 ++-
 ecrire/inc/legender.php            | 22 ++++++++++++++--------
 4 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/ecrire/configuration/documents.php b/ecrire/configuration/documents.php
index 558d84400f..6bff2d428c 100644
--- a/ecrire/configuration/documents.php
+++ b/ecrire/configuration/documents.php
@@ -24,6 +24,7 @@ function configuration_documents_dist(){
 	
 	$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'>";
@@ -40,6 +41,10 @@ function configuration_documents_dist(){
 	$res .= afficher_choix('documents_rubrique', $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,
+		array('oui' => _L('Pouvoir s&eacute;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>";
 	$res .= "</table>\n";
 
@@ -50,3 +55,5 @@ function configuration_documents_dist(){
 	return ajax_action_greffe('configurer-documents', '', $res);
 }
 ?>
+
+
diff --git a/ecrire/inc/config.php b/ecrire/inc/config.php
index a5d6126ee7..bf3c752fd9 100644
--- a/ecrire/inc/config.php
+++ b/ecrire/inc/config.php
@@ -83,6 +83,7 @@ function liste_metas()
 
 		'documents_article' => 'non',
 		'documents_rubrique' => 'non',
+		'documents_date' => 'non',
 		'syndication_integrale' => 'oui',
 		'charset' => _DEFAULT_CHARSET,
 		'dir_img' => substr(_DIR_IMG,strlen(_DIR_RACINE)),
diff --git a/ecrire/inc/documents.php b/ecrire/inc/documents.php
index 8317b308dc..cc3f38b717 100644
--- a/ecrire/inc/documents.php
+++ b/ecrire/inc/documents.php
@@ -330,7 +330,8 @@ 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 6ad0720a4d..d70daab27b 100644
--- a/ecrire/inc/legender.php
+++ b/ecrire/inc/legender.php
@@ -89,7 +89,7 @@ function inc_legender_dist($id_document, $document, $script, $type, $id, $ancre,
 	  "<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) .
-	  "<br />\n<label for='descriptif_document$id_document'><b>".
+	  "<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,6 +231,7 @@ 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];
@@ -239,13 +240,18 @@ function date_formulaire_legender($date, $id_document) {
 		$heure = $regs[4];
 		$minute = $regs[5];
 	}
-	return  "<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')\"") .
-		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 />\n";
+	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')\"") . 
+			" : ".
+			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