diff --git a/.gitattributes b/.gitattributes index 0029dcc879e7cbac0f1f38dbf3d88977cf69f687..645649360acf190a3091a08dd23177e689c203be 100644 --- a/.gitattributes +++ b/.gitattributes @@ -641,7 +641,6 @@ ecrire/inc/distant.php -text ecrire/inc/documenter.php -text ecrire/inc/drapeau_edition.php -text ecrire/inc/editer.php -text -ecrire/inc/editer_article.php -text ecrire/inc/editer_auteurs.php -text ecrire/inc/editer_mot.php -text ecrire/inc/envoyer_mail.php -text diff --git a/dist/formulaires/editer_article.html b/dist/formulaires/editer_article.html index eebe3e2ad98ccb88c585ad1bcf02295490ea1793..06487c3dff6083b4a9400d1cb31081525b0b3a9a 100644 --- a/dist/formulaires/editer_article.html +++ b/dist/formulaires/editer_article.html @@ -3,7 +3,7 @@ [<p class="formulaire_message">(#ENV*{message_ok})</p>] [<p class='formulaire_erreur'>(#ENV*{message_erreur})</p>] [(#ENV{editable}) - <form method='post' action='#ENV{action}' enctype='multipart/form-data' > + <form method='post' action='#ENV{action}' enctype='multipart/form-data' class='noajax'> [(#REM) declarer les hidden qui declencheront le service du formulaire parametre : url d'action ] #ACTION_FORMULAIRE{#ENV{action}} @@ -16,7 +16,7 @@ <input type='text' name='surtitre' id='surtitre' class='forml' value="[(#ENV**{surtitre})]" /> [<span class='erreur'>(#ENV**{erreurs}|table_valeur{surtitre})</span>] </li>] - <li class="gauche gauche_obligatoire"> + <li class="gauche obligatoire"> <label for="titre"><:info_titre:><em>#AIDER{arttitre}</em></label> <input type='text' name='titre' id='titre' class='formo' value="[(#ENV**{titre,#REM|concat{info_nouvel_article}|_T})]" [(#ENV{titre,''}|?{'',' '})onfocus="if(!antifocus){this.value='';antifocus=true;}"]/> @@ -68,6 +68,7 @@ [(#ENV**{config}|table_valeur{articles_texte}|=={non}|?{#ENV**{texte,''},' '}|?{' '}) <li class="haut"> <label for="text_area"><:info_texte:><em>#AIDER{arttexte}</em></label> + [(#ENV**{_texte_trop_long,''})] <div class="commentaire"><:texte_enrichir_mise_a_jour:><em>#AIDER{raccourcis}</em></div> [(#ENV**{config}|table_valeur{afficher_barre}|?{#VAL{text_area}|barre_typo{#LANG}})] <textarea name='texte' id='text_area' class='formo barre_inserer' rows='[(#ENV**{config}|table_valeur{lignes}|plus{2})]' cols='40'[ diff --git a/dist/formulaires/editer_article/charger.php b/dist/formulaires/editer_article/charger.php index e7cf94e4aeb390359466c7d8b9dc51a21c8bc60a..f0e422d469fa57142e15767da32d1e252b0dd0c8 100644 --- a/dist/formulaires/editer_article/charger.php +++ b/dist/formulaires/editer_article/charger.php @@ -14,7 +14,6 @@ if (!defined("_ECRIRE_INC_VERSION")) return; include_spip('inc/actions'); include_spip('inc/editer'); -include_spip('inc/editer_article'); // http://doc.spip.org/@inc_editer_article_dist function formulaires_editer_article_charger_dist($id_article='new', $id_rubrique=0, $lier_trad=0, $retour='', $config_fonc='articles_edit_config', $row=array(), $hidden=''){ @@ -34,6 +33,12 @@ function formulaires_editer_article_charger_dist($id_article='new', $id_rubrique $contexte = $row; $contexte['config'] = $config = $config_fonc($row); + $att_text = " class='formo' " + . $GLOBALS['browser_caret'] + . " rows='" + . ($config['lignes'] +15) + . "' cols='40'"; + list($contexte['texte'],$contexte['_texte_trop_long']) = editer_article_recolle($contexte['texte'],$att_text); // on veut conserver la langue de l'interface ; // on passe cette donnee sous un autre nom, au cas ou le squelette @@ -70,4 +75,76 @@ function formulaires_editer_article_charger_dist($id_article='new', $id_rubrique return $contexte; } + +// +// Gestion des textes trop longs (limitation brouteurs) +// utile pour les textes > 32ko + +// http://doc.spip.org/@coupe_trop_long +function coupe_trop_long($texte){ + $aider = charger_fonction('aider', 'inc'); + if (strlen($texte) > 28*1024) { + $texte = str_replace("\r\n","\n",$texte); + $pos = strpos($texte, "\n\n", 28*1024); // coupe para > 28 ko + if ($pos > 0 and $pos < 32 * 1024) { + $debut = substr($texte, 0, $pos)."\n\n<!--SPIP-->\n"; + $suite = substr($texte, $pos + 2); + } else { + $pos = strpos($texte, " ", 28*1024); // sinon coupe espace + if (!($pos > 0 and $pos < 32 * 1024)) { + $pos = 28*1024; // au pire (pas d'espace trouv'e) + $decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere + } else { + $decalage = 1; + } + $debut = substr($texte,0,$pos + $decalage); // Il faut conserver l'espace s'il y en a un + $suite = substr($texte,$pos + $decalage); + } + return (array($debut,$suite)); + } + else + return (array($texte,'')); +} + +// http://doc.spip.org/@editer_article_recolle +function editer_article_recolle($texte, $att_text) +{ + if ((strlen($texte)<29*1024) + /*OR pas le navigateur qui pose probleme */ ) + return array($texte,""); + + include_spip('inc/barre'); + $textes_supplement = "<br /><span style='color: red'>"._T('info_texte_long')."</span>\n"; + $nombre = 0; + + while (strlen($texte)>29*1024) { + $nombre ++; + list($texte1,$texte) = coupe_trop_long($texte); + $id = "document.getElementById('texte$nombre')"; + $textes_supplement .= "<br />" . afficher_barre($id) . + "<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n"; + } + return array($texte,$textes_supplement); +} + + +// Choix par defaut des options de presentation +// http://doc.spip.org/@articles_edit_config +function articles_edit_config($row) +{ + global $champs_extra, $spip_ecran, $spip_lang, $spip_display; + + $config = $GLOBALS['meta']; + $config['lignes'] = ($spip_ecran == "large")? 8 : 5; + $config['afficher_barre'] = $spip_display != 4; + $config['langue'] = $spip_lang; + + if ($champs_extra) { + include_spip('inc/extra'); + $config['extra'] = true; + } else $config['extra'] = false; + + $config['restreint'] = ($row['statut'] == 'publie'); + return $config; +} ?> \ No newline at end of file diff --git a/dist/formulaires/editer_article/traiter.php b/dist/formulaires/editer_article/traiter.php index 9b28cfed17578eef91baff6ca521a7e4ab3b7063..974df0ca479e84aefd8a6a5b338f26f78694f5e4 100644 --- a/dist/formulaires/editer_article/traiter.php +++ b/dist/formulaires/editer_article/traiter.php @@ -14,7 +14,6 @@ if (!defined("_ECRIRE_INC_VERSION")) return; include_spip('inc/actions'); include_spip('inc/editer'); -include_spip('inc/editer_article'); // http://doc.spip.org/@inc_editer_article_dist function formulaires_editer_article_traiter_dist($id_article='new', $id_rubrique=0, $lier_trad=0, $retour='', $config_fonc='articles_edit_config', $row=array(), $hidden=''){ diff --git a/dist/style_prive.html b/dist/style_prive.html index 7667b70cb375232c3cabfed78c5fe0ad5d9ed402..3fdfd5609a5ba683ca8650111e5f82079d66412f 100644 --- a/dist/style_prive.html +++ b/dist/style_prive.html @@ -138,6 +138,10 @@ ol.formfx .commentaire_bas{ float: #GET{left}; margin-#GET{left}: -20px; } +ol.formfx li.obligatoire label { + font-weight: bold; +} + ol.formfx li.gauche { clear: left; list-style: none; @@ -153,7 +157,7 @@ ol.formfx li.gauche label { width: 110px; - background: url([(#REM|sinon{[(#EVAL{ _DIR_IMG_PACK})]label-fond-gauche-[(#ENV{ltr})].gif}|image_sepia{#ENV{couleur_foncee,3874b0}}|extraire_attribut{src})]) center [(#GET{right})] no-repeat; + background: url([(#EVAL{_DIR_IMG_PACK}|concat{label-fond-gauche-,#ENV{ltr},.gif}|image_sepia{#ENV{couleur_foncee,3874b0}}|extraire_attribut{src})]) center [(#GET{right})] no-repeat; font-size: 9px; color: white; @@ -166,14 +170,13 @@ ol.formfx li.gauche label { padding-left: 5px; padding-right: 5px; } -ol.formfx li.gauche_obligatoire label { - background: url([(#REM|sinon{[(#EVAL{ _DIR_IMG_PACK})]label-fond-gauche-[(#ENV{ltr})].gif}|image_sepia{#666666}|extraire_attribut{src})]) center [(#GET{right})] no-repeat; - font-weight: bold; +ol.formfx li.gauche.obligatoire label { + background: url([(#EVAL{_DIR_IMG_PACK}|concat{label-fond-gauche-,#ENV{ltr},.gif}|image_sepia{#666666}|extraire_attribut{src})]) center [(#GET{right})] no-repeat; } ol.formfx li.gauche input, ol.formfx textarea { // border-color: #GET{foncee}; } -ol.formfx li.gauche_obligatoire input, ol.formfx li.haut_obligatoire input { +ol.formfx li.obligatoire input { font-weight: bold; border-color: #GET{foncee}; } @@ -200,9 +203,12 @@ ol.formfx li.haut label { padding-left: 5px; padding-right: 5px; margin-bottom: 0px; - background: url([(#REM|sinon{[(#EVAL{ _DIR_IMG_PACK})]label-fond-haut-[(#ENV{ltr})].gif}|image_sepia{#ENV{couleur_foncee,3874b0}}|extraire_attribut{src})]) bottom [(#GET{left})] no-repeat; + background: url([(#EVAL{_DIR_IMG_PACK}|concat{label-fond-haut-,#ENV{ltr},.gif}|image_sepia{#ENV{couleur_foncee,3874b0}}|extraire_attribut{src})]) bottom [(#GET{left})] no-repeat; -} +} +ol.formfx li.haut.obligatoire label { + background: url([(#EVAL{_DIR_IMG_PACK}|concat{label-fond-haut-,#ENV{ltr},.gif}|image_sepia{#666666}|extraire_attribut{src})]) bottom [(#GET{left})] no-repeat; +} ol.formfx fieldset { margin-top: 7px; border: 1px solid #GET{foncee}; @@ -215,7 +221,7 @@ ol.formfx fieldset legend { clear: #GET{left}; margin-#GET{left}: -20px; - background: url([(#REM|sinon{[(#EVAL{ _DIR_IMG_PACK})]label-fond-haut-[(#ENV{ltr})].gif}|image_sepia{#ENV{couleur_foncee,3874b0}}|extraire_attribut{src})]) bottom [(#GET{left})] no-repeat; + background: url([(#EVAL{_DIR_IMG_PACK}|concat{label-fond-haut-,#ENV{ltr},.gif}|image_sepia{#ENV{couleur_foncee,3874b0}}|extraire_attribut{src})]) bottom [(#GET{left})] no-repeat; font-size: 9px; color: white; @@ -237,7 +243,7 @@ table.spip_barre { table.spip_barre a img { background: #GET{claire}; - background: url([(#REM|sinon{[(#EVAL{ _DIR_IMG_PACK})]fond-fondo.gif}|image_sepia{#ENV{couleur_claire,edf3fe}}|extraire_attribut{src})]) center center; + background: url([(#EVAL{_DIR_IMG_PACK}|concat{fond-fondo.gif}|image_sepia{#ENV{couleur_claire,edf3fe}}|extraire_attribut{src})]) center center; padding: 3px; border: 1px outset #GET{claire}; } table.spip_barre a:hover img { background: #FFF; border: 1px solid #CC9; } table.spip_barre input.barre { width: 99%; background: transparent; border: 0; color: #F57900; } diff --git a/ecrire/exec/articles_edit.php b/ecrire/exec/articles_edit.php index b903ae50958da66863a99611c3793532bb8c014e..fbb91dc3a07b9e4dd1d6346c3d1694188c71a9be 100644 --- a/ecrire/exec/articles_edit.php +++ b/ecrire/exec/articles_edit.php @@ -89,8 +89,6 @@ function articles_edit($id_article, $id_rubrique, $lier_trad, $id_version, $new, echo debut_cadre_formulaire("", true); echo articles_edit_presentation($new, $row['id_rubrique'], $lier_trad, $row['id_article'], $row['titre'],$config_fonc); - /*$editer_article = charger_fonction('editer_article', 'inc'); - echo $editer_article($new, $id_rubrique, $lier_trad, generer_url_ecrire("articles"), $config_fonc, $row);*/ echo fin_cadre_formulaire(true); echo pipeline('affiche_milieu',array('args'=>array('exec'=>'articles_edit','id_article'=>$id_article),'data'=>'')); diff --git a/ecrire/exec/breves_edit.php b/ecrire/exec/breves_edit.php index 5227d0636440be6b01e6dd6bb2f0fb76cdb74061..68fa0cfaba12fa58e027fc82a1ff3c5d22fff00e 100644 --- a/ecrire/exec/breves_edit.php +++ b/ecrire/exec/breves_edit.php @@ -139,7 +139,7 @@ if ($connect_statut=="0minirezo" OR $statut=="prop" OR $new == "oui") { $chercher_rubrique = charger_fonction('chercher_rubrique', 'inc'); $form = "<ol class='formfx'>"; - $form .= "<li class='gauche gauche_obligatoire'><label for='titre'>" . _T('info_titre') . "</label>" + $form .= "<li class='gauche obligatoire'><label for='titre'>" . _T('info_titre') . "</label>" . "<input type='text' class='formo' name='titre' id='titre' value=\"$titre\" size='40' $onfocus /></li>" . "<input type='hidden' name='id_rubrique_old' value=\"$id_rubrique\" />" ."<li class='haut'>" diff --git a/ecrire/exec/mots_edit.php b/ecrire/exec/mots_edit.php index b7aa46a5f41b55baf81bd93f425f106b1067671f..f81947bd96b0274dcc9f8344576906051aa6a8c8 100644 --- a/ecrire/exec/mots_edit.php +++ b/ecrire/exec/mots_edit.php @@ -183,7 +183,7 @@ function exec_mots_edit_args($id_mot, $id_groupe, $new, $table='', $table_id='', $res .= "<ol class='formfx'>"; - $res .= "<li class='gauche gauche_obligatoire'>"; + $res .= "<li class='gauche obligatoire'>"; $res .= "<label for='titre'>"._T('info_titre_mot_cle'); $res .= aide ("mots")."</label>"; diff --git a/ecrire/exec/rubriques_edit.php b/ecrire/exec/rubriques_edit.php index 63cab8693e5fcab082c87054cb6e334a329c5afb..4919bb7729ac422ef26055ec9884b057714421cb 100644 --- a/ecrire/exec/rubriques_edit.php +++ b/ecrire/exec/rubriques_edit.php @@ -113,7 +113,7 @@ function exec_rubriques_edit_args($id_rubrique, $id_parent, $new) $form = "<ol class='formfx'>"; - $form .= "<li class='gauche gauche_obligatoire'><label for='titre'>" . _T('info_titre') ."</label>" + $form .= "<li class='gauche obligatoire'><label for='titre'>" . _T('info_titre') ."</label>" . "<input type='text' class='formo' name='titre' id='titre' value=\"$titre\" size='40' $onfocus /></li>"; $form .= "<li>" diff --git a/ecrire/inc/editer_article.php b/ecrire/inc/editer_article.php deleted file mode 100644 index c4a8104aee3af2e5e238c69f0dbb729011f22eef..0000000000000000000000000000000000000000 --- a/ecrire/inc/editer_article.php +++ /dev/null @@ -1,199 +0,0 @@ -<?php - -/***************************************************************************\ - * SPIP, Systeme de publication pour l'internet * - * * - * Copyright (c) 2001-2008 * - * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * - * * - * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * - * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * -\***************************************************************************/ - -if (!defined("_ECRIRE_INC_VERSION")) return; - -include_spip('inc/actions'); -include_spip('inc/editer'); - -// http://doc.spip.org/@inc_editer_article_dist -function inc_editer_article_dist($new, $id_rubrique=0, $lier_trad=0, $retour='', $config_fonc='articles_edit_config', $row=array(), $hidden='') -{ - // Appel en tant que filtre d'un squelette - if (!$row) { - include_spip('inc/presentation'); - include_spip('inc/article_select'); - $row = article_select($new, $id_rubrique, $lier_trad); - if (!$row) return ''; - if (is_numeric($new)) $new = ''; - } - - // Gaffe: sans ceci, on ecrase systematiquement l'article d'origine - // (et donc: pas de lien de traduction) - $id_article = ($new OR $lier_trad) ? 'oui' : $row['id_article']; - - $contexte = $row; - $contexte['config'] = $config = $config_fonc($row); - - $form = "<input type='hidden' name='editer_article' value='oui' />\n" . - (!$lier_trad ? '' : - ("\n<input type='hidden' name='lier_trad' value='" . - $lier_trad . - "' />" . - "\n<input type='hidden' name='changer_lang' value='" . - $config['langue'] . - "' />")); - - - // on veut conserver la langue de l'interface ; - // on passe cette donnee sous un autre nom, au cas ou le squelette - // voudrait l'exploiter - if (isset($contexte['lang'])) { - $contexte['langue'] = $contexte['lang']; - unset($contexte['lang']); - } - - $contexte['browser_caret']=$GLOBALS['browser_caret']; - include_spip('public/assembler'); - $form .= recuperer_fond("prive/editer/article", $contexte); - - // Ajouter le controles md5 - if (intval($id_article)) { - include_spip('inc/editer'); - $form .= controles_md5($row); - } - - $form .= $hidden - . ("<div style='text-align: right'><input class='fondo' type='submit' value='" - . _T('bouton_enregistrer') - . "' /></div>"); - - $form = pipeline( - 'editer_contenu_objet', - array( - 'data'=>$form, - 'args'=>array('type'=>'article','id'=>$id_article,'contexte'=>$contexte) - ) - ); - - return generer_action_auteur("editer_article", $id_article, $retour, $form, " method='post'"); -} - - -/* -// code mort -// http://doc.spip.org/@editer_article_texte -function editer_article_texte($texte, $config, $aider, $lang='') -{ - // cette meta n'est pas activable par l'interface, mais elle peut venir - // d'ailleurs : http://www.spip-contrib.net/Personnaliser-les-champs-de-l - if (($config['articles_texte'] == 'non') AND !strlen($texte)) - return ''; - - $att_text = " class='formo' " - . $GLOBALS['browser_caret'] - . " rows='" - . ($config['lignes'] +15) - . "' cols='40'"; - - if ($config['afficher_barre']) { - include_spip('inc/barre'); - $afficher_barre = '<div>' - . afficher_barre("document.getElementById('text_area')",false,$lang) - . '</div>'; - } else $afficher_barre = ''; - - $texte = entites_html($texte); - // texte > 32 ko -> decouper en morceaux - if (strlen($texte)>29*1024) { - list($texte, $sup) = editer_article_recolle($texte, $att_text); - } else $sup=''; - - return "\n<p><label for='text_area'><b>" ._T('info_texte') ."</b></label>" - . $aider ("arttexte") . "<br />\n" - . _T('texte_enrichir_mise_a_jour') - . $aider("raccourcis") - . "</p>" - . $sup - . "<br />" - . $afficher_barre - . "<textarea id='text_area' name='texte'$att_text>" - . $texte - . "</textarea>\n" - . (test_espace_prive() - ? "<script type='text/javascript'><!-- - jQuery(function(){ - jQuery('#text_area') - .css('height',(jQuery(window).height()-80)+'px'); - });\n//--></script>\n" - : '' - ); -} -*/ - -// -// Gestion des textes trop longs (limitation brouteurs) -// utile pour les textes > 32ko - -// http://doc.spip.org/@coupe_trop_long -function coupe_trop_long($texte){ - $aider = charger_fonction('aider', 'inc'); - if (strlen($texte) > 28*1024) { - $texte = str_replace("\r\n","\n",$texte); - $pos = strpos($texte, "\n\n", 28*1024); // coupe para > 28 ko - if ($pos > 0 and $pos < 32 * 1024) { - $debut = substr($texte, 0, $pos)."\n\n<!--SPIP-->\n"; - $suite = substr($texte, $pos + 2); - } else { - $pos = strpos($texte, " ", 28*1024); // sinon coupe espace - if (!($pos > 0 and $pos < 32 * 1024)) { - $pos = 28*1024; // au pire (pas d'espace trouv'e) - $decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere - } else { - $decalage = 1; - } - $debut = substr($texte,0,$pos + $decalage); // Il faut conserver l'espace s'il y en a un - $suite = substr($texte,$pos + $decalage); - } - return (array($debut,$suite)); - } - else - return (array($texte,'')); -} - -// http://doc.spip.org/@editer_article_recolle -function editer_article_recolle($texte, $att_text) -{ - $textes_supplement = "<br /><span style='color: red'>"._T('info_texte_long')."</span>\n"; - $nombre = 0; - - while (strlen($texte)>29*1024) { - $nombre ++; - list($texte1,$texte) = coupe_trop_long($texte); - $id = "document.getElementById('texte$nombre')"; - $textes_supplement .= "<br />" . afficher_barre($id) . - "<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n"; - } - return array($texte,$textes_supplement); -} - -// Choix par defaut des options de presentation -// http://doc.spip.org/@articles_edit_config -function articles_edit_config($row) -{ - global $champs_extra, $spip_ecran, $spip_lang, $spip_display; - - $config = $GLOBALS['meta']; - $config['lignes'] = ($spip_ecran == "large")? 8 : 5; - $config['afficher_barre'] = $spip_display != 4; - $config['langue'] = $spip_lang; - - if ($champs_extra) { - include_spip('inc/extra'); - $config['extra'] = true; - } else $config['extra'] = false; - - $config['restreint'] = ($row['statut'] == 'publie'); - return $config; -} - -?> diff --git a/ecrire/inc/headers.php b/ecrire/inc/headers.php index b4e840468b5a62447146bcfc24920a1dd37e0176..ec22c409ade1725e17e9f9c575e8d40c0a22f89d 100644 --- a/ecrire/inc/headers.php +++ b/ecrire/inc/headers.php @@ -58,7 +58,7 @@ function redirige_par_entete($url, $equiv='') { // http://doc.spip.org/@redirige_formulaire function redirige_formulaire($url, $equiv = '') { if (!_request('var_ajax') && !_request('var_ajaxcharset')) - redirige_par_entete($url, $equiv); + redirige_par_entete(str_replace('&','&',$url), $equiv); else { $url = strtr($url, "\n\r", " "); # en theorie on devrait faire ca tout le temps, mais quand la chaine