diff --git a/.gitattributes b/.gitattributes
index e5588847a3cf59a66f8138759b1126fbeb1b027b..a0090c14c826691c8556d4db1d8c4c7a2b0d564b 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -259,6 +259,7 @@ ecrire/img_pack/xml.gif -text
 ecrire/inc_aide_index.php -text
 ecrire/inc_ajax.php3 -text
 ecrire/inc_articles.php -text
+ecrire/inc_articles_edit.php -text
 ecrire/inc_auteur_infos.php -text
 ecrire/inc_barre.php3 -text
 ecrire/inc_breves.php -text
diff --git a/ecrire/articles_edit.php3 b/ecrire/articles_edit.php3
index 141dc4ce397d8ec286582c3bf7edb76cbf3abb52..8f562fbc0d436c883a1e6bf3c91f30b0eb641ea6 100644
--- a/ecrire/articles_edit.php3
+++ b/ecrire/articles_edit.php3
@@ -15,15 +15,9 @@ include ("inc.php3");
 include_ecrire ("inc_documents.php3");
 include_ecrire ("inc_barre.php3");
 
-$articles_surtitre = lire_meta("articles_surtitre");
-$articles_soustitre = lire_meta("articles_soustitre");
-$articles_descriptif = lire_meta("articles_descriptif");
-$articles_urlref = lire_meta("articles_urlref");
-$articles_chapeau = lire_meta("articles_chapeau");
-$articles_ps = lire_meta("articles_ps");
-$articles_redac = lire_meta("articles_redac");
-$articles_mots = lire_meta("articles_mots");
-$articles_modif = lire_meta("articles_modif");
+$var_f = find_in_path("inc_articles_edit.php");
+include($var_f ? $var_f : (_DIR_INCLUDE . "inc_articles_edit.php"));
+
 
 // securite
 $id_article = intval($id_article);
@@ -144,398 +138,12 @@ if (!$flag_editable) {
 }
 
 
-// Qui veut modifier l'article ?
 spip_query("UPDATE spip_articles SET date_modif=NOW(), auteur_modif=$connect_id_auteur WHERE id_article=$id_article");
-$id_article_bloque = $id_article;	// message pour inc_presentation
-
-
-
-
-//
-// Gestion des textes trop longs (limitation brouteurs)
-//
-
-function coupe_trop_long($texte){	// utile pour les textes > 32ko
-	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,''));
-}
-
-
-debut_page(_T('titre_page_articles_edit', array('titre' => $titre)), "documents", "articles", "hauteurTextarea();");
-
-
-debut_grand_cadre();
-
-afficher_hierarchie($id_rubrique);
-
-fin_grand_cadre();
-
-
-
-debut_gauche();
-
-
-
-//
-// Pave "documents associes a l'article"
-//
-
-if ($new != 'oui'){
-	# modifs de la description d'un des docs joints
-	if ($flag_editable) maj_documents($id_article, 'article');
-
-	# affichage
-	afficher_documents_colonne($id_article, 'article', $flag_editable);
-}
-
-debut_droite();
-debut_cadre_formulaire();
-
-
-function enfant($leparent){
-	global $id_parent;
-	global $id_rubrique;
-	static $i = 0, $premier = 1;
-	global $statut;
-	global $connect_toutes_rubriques;
-	global $couleur_claire, $spip_lang_left;
-	global $browser_name, $browser_version;
-	global $ja_rub;
-
-	$i++;
- 	$query="SELECT * FROM spip_rubriques WHERE id_parent='$leparent' ORDER BY 0+titre, titre";
- 	$result=spip_query($query);
-
-	while($row=spip_fetch_array($result)){
-		$my_rubrique=$row['id_rubrique'];
-		$titre=$row['titre'];
-		$statut_rubrique=$row['statut'];
-		$lang_rub = $row['lang'];
-		$langue_choisie_rub = $row['langue_choisie'];
-		$style = "";
-		$espace = "";
-
-		// si l'article est publie il faut etre admin pour avoir le menu
-		// sinon le menu est present en entier (proposer un article)
-		if ($statut != "publie" OR acces_rubrique($my_rubrique)) {
-			$rubrique_acceptable = true;
-		} else {
-			$rubrique_acceptable = false;
-		}
-
-
-		if (eregi("mozilla", $browser_name)) {
-			$style .= "padding-$spip_lang_left: 16px; ";
-			$style .= "margin-$spip_lang_left: ".(($i-1)*16)."px;";
-		} else {
-			for ($count = 0; $count <= $i; $count ++) $espace .= "&nbsp;&nbsp;&nbsp;&nbsp;";
-		}
-		switch ($i) {
-		case 1:
-			$espace= "";
-			$style .= "font-weight: bold;";
-			break;
-		case 2:
-			$style .= "color: #202020;";
-			break;
-		case 3:
-			$style .= "color: #404040;";
-			break;
-		case 4:
-			$style .= "color: #606060;";
-			break;
-		case 5:
-			$style .= "color: #808080;";
-			break;
-		default:
-			$style .= "color: #A0A0A0;";
-			break;
-		}
-		if ($i==1) {
-			$style .= "background-image: url(" . _DIR_IMG_PACK. "secteur-12.gif);";
-			$style .= "background-color: $couleur_claire;";
-			$style .= "font-weight: bold;";
-		}
-		else if ($i==2) {
-			//$style .= "background: url(" . _DIR_IMG_PACK. "rubrique-12.gif) $spip_lang_left no-repeat;";
-			$style .= "border-bottom: 1px solid $couleur_claire;";
-			$style .= "font-weight: bold;";
-		}
-		else {
-			//$style .= "background: url(" . _DIR_IMG_PACK. "rubrique-12.gif) $spip_lang_left no-repeat;";
-		}
-
-			$selec_rub = "selec_rub";
-			if ($browser_name == "MSIE" AND floor($browser_version) == "5") $selec_rub = ""; // Bug de MSIE MacOs 9.0
-
-		if ($rubrique_acceptable) {
-			if ($i == 1 && !$premier) echo "<option value='$my_rubrique'>\n"; // sert a separer les secteurs
-			// largeur maxi a 50
-			$titre = couper(supprimer_tags(typo(extraire_multi($titre)))." ", 50);
-			if (lire_meta('multi_rubriques') == 'oui' AND ($langue_choisie_rub == "oui" OR $leparent == 0)) $titre = $titre." [".traduire_nom_langue($lang_rub)."]";
-			echo "<option".mySel($my_rubrique,$id_rubrique)." class='$selec_rub' style=\"$style\">$espace$titre</option>\n";
-		
-		
-			$ja_rub .= addslashes("[$my_rubrique] $titre ///");
-		}
-		$premier = 0;
-		enfant($my_rubrique);
-	}
-	$i=$i-1;
-}
-
-
-echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>";
-echo "<tr width='100%'>";
-echo "<td>";
-	if ($lier_trad) icone(_T('icone_retour'), "articles.php3?id_article=$lier_trad", "article-24.gif", "rien.gif");
-	else icone(_T('icone_retour'), "articles.php3?id_article=$id_article", "article-24.gif", "rien.gif");
-
-echo "</td>";
-echo "<td>". http_img_pack('rien.gif', " ", "width='10'") . "</td>\n";
-echo "<td width='100%'>";
-echo _T('texte_modifier_article');
-gros_titre($titre);
-echo "</td></tr></table>";
-echo "<p>";
-
-echo "<P><HR><P>";
-
-	$titre = entites_html($titre);
-	$soustitre = entites_html($soustitre);
-	$surtitre = entites_html($surtitre);
-
-	$descriptif = entites_html($descriptif);
-	$nom_site = entites_html($nom_site);
-	$url_site = entites_html($url_site);
-	$chapo = entites_html($chapo);
-	$texte = entites_html($texte);
-	$ps = entites_html($ps);
-
-	$lien = 'articles.php3';
-	if ($id_article) $lien .= "?id_article=$id_article";
-	echo "<FORM ACTION='$lien' METHOD='post' name='formulaire'>\n";
-
-	if ($id_article)
-		echo "<INPUT TYPE='Hidden' NAME='id_article' VALUE='$id_article'>";
-	else if ($new == 'oui')
-		echo "<INPUT TYPE='Hidden' NAME='new' VALUE='oui'>";
-
-	if ($lier_trad) {
-		echo "<INPUT TYPE='Hidden' NAME='lier_trad' VALUE='$lier_trad'>";
-		echo "<INPUT TYPE='Hidden' NAME='changer_lang' VALUE='$spip_lang'>";
-	}
-
-	if (($options == "avancees" AND $articles_surtitre != "non") OR $surtitre) {
-		echo "<B>"._T('texte_sur_titre')."</B>";
-		echo aide ("arttitre");
-		echo "<BR><INPUT TYPE='text' NAME='surtitre' CLASS='forml' VALUE=\"$surtitre\" SIZE='40'><P>";
-	}
-	else {
-		echo "<INPUT TYPE='hidden' NAME='surtitre' VALUE=\"$surtitre\" >";
-	}
-
-	echo _T('texte_titre_obligatoire');
-	echo aide ("arttitre");
-	echo "<BR><INPUT TYPE='text' NAME='titre' style='font-weight: bold; font-size: 13px;' CLASS='formo' VALUE=\"$titre\" SIZE='40' $onfocus><P>";
-
-	if (($articles_soustitre != "non") OR $soustitre) {
-		echo "<B>"._T('texte_sous_titre')."</B>";
-		echo aide ("arttitre");
-		echo "<BR><INPUT TYPE='text' NAME='soustitre' CLASS='forml' VALUE=\"$soustitre\" SIZE='40'><br><br>";
-	}
-	else {
-		echo "<INPUT TYPE='hidden' NAME='soustitre' VALUE=\"$soustitre\">";
-	}
-
-
-	/// Dans la rubrique....
-	if ($id_rubrique == 0) $logo_parent = "racine-site-24.gif";
-	else {
-		$query = "SELECT id_parent, titre FROM spip_rubriques WHERE id_rubrique='$id_rubrique'";
-		$result=spip_query($query);
-		while($row=spip_fetch_array($result)){
-			$parent_parent=$row['id_parent'];
-			$titre_parent = $row["titre"];
-		}
-		if ($parent_parent == 0) $logo_parent = "secteur-24.gif";
-		else $logo_parent = "rubrique-24.gif";
-	}
-	debut_cadre_couleur("$logo_parent", false, "", _T('titre_cadre_interieur_rubrique').aide ("artrub"));
-
-	if ($spip_display == 4) {
-
-	
-	
-	
-		// Integrer la recherche de rubrique au clavier
-		echo "<script language='JavaScript' type='text/javascript' src='filtery.js'></script>\n";
-		echo "<input type='text' size='10' style='font-size: 90%; width: 15%;' onkeyup=\"filtery(this.value,this.form.id_rubrique);\" onChange=\"filtery(this.value,this.form.id_rubrique);\"> ";
-	
-		echo "<SELECT NAME='id_rubrique' style='font-size: 90%; width:80%; font-face:verdana,arial,helvetica,sans-serif; max-height: 24px;' SIZE=1>\n";
-		enfant(0);
-		echo "</SELECT><BR>\n";
-		
-		echo _T('texte_rappel_selection_champs');
-	
-	} else {
-		echo "<table width='100%'><tr width='100%'><td width='45'>";
-		echo "<a href=\"#\" onClick=\"javascript:if(findObj('selection_rubrique').style.display=='none') {charger_id_url_si_vide('ajax_page.php?fonction=aff_rubrique&id_rubrique=$id_rubrique','selection_rubrique');} else {findObj('selection_rubrique').style.display='none';}\"><img src='img_pack/loupe.png' style='border: 0px; vertical-align: middle;' /></a> ";
-		echo "<img src='img_pack/searching.gif' id='img_selection_rubrique' style='visibility: hidden;'>";
-		echo "</td><td>";
-		echo "<input type='text' id='titreparent' name='titreparent' disabled='disabled' class='forml' value=\"$titre_parent\" />";
-		echo "<input type='hidden' id='id_rubrique' name='id_rubrique' value='$id_rubrique' />";
-		echo "</td></tr></table>";
-		
-		echo "<div id='selection_rubrique' style='display: none;'></div>";
-	
-	}
-	fin_cadre_couleur();
-	
-	if ($new != 'oui') echo "<INPUT TYPE='hidden' NAME='id_rubrique_old' VALUE=\"$id_rubrique\" >";
-
-	if (($options == "avancees" AND $articles_descriptif != "non") OR $descriptif) {
-		echo "<P><B>"._T('texte_descriptif_rapide')."</B>";
-		echo aide ("artdesc");
-		echo "<BR>"._T('texte_contenu_article')."<BR>";
-		echo "<TEXTAREA NAME='descriptif' CLASS='forml' ROWS='2' COLS='40' wrap=soft>";
-		echo $descriptif;
-		echo "</TEXTAREA><P>\n";
-	}
-	else {
-		echo "<INPUT TYPE='hidden' NAME='descriptif' VALUE=\"$descriptif\">";
-	}
-
-	if (($options == "avancees" AND $articles_urlref != "non") OR $nom_site OR $url_site) {
-		echo _T('entree_liens_sites')."<br />\n";
-		echo _T('info_titre')." ";
-		echo "<input type='text' name='nom_site' class='forml' width='40' value=\"$nom_site\"/><br />\n";
-		echo _T('info_url')." ";
-		echo "<input type='text' name='url_site' class='forml' width='40' value=\"$url_site\"/>";
-	}
-
-	if (substr($chapo, 0, 1) == '=') {
-		$virtuel = substr($chapo, 1);
-		$chapo = "";
-	}
-
-	if ($connect_statut=="0minirezo" AND $virtuel){
-		echo "<p><div style='border: 1px dashed #666666; background-color: #f0f0f0; padding: 5px;'>";
-		echo "<table width=100% cellspacing=0 cellpadding=0 border=0>";
-		echo "<tr><td valign='top'>";
-		echo "<font face='Verdana,Arial,Sans,sans-serif' size=2>";
-		echo "<B><label for='confirme-virtuel'>"._T('info_redirection')."&nbsp;:</label></B>";
-		echo aide ("artvirt");
-		echo "</font>";
-		echo "</td>";
-		echo "<td width=10>&nbsp;</td>";
-		echo "<td valign='top' width='50%'>";
-		if (!$virtuel) $virtuel = "http://";
-		echo "<INPUT TYPE='text' NAME='virtuel' CLASS='forml' style='font-size:9px;' VALUE=\"$virtuel\" SIZE='40'>";
-		echo "<input type='hidden' name='changer_virtuel' value='oui'>";
-		echo "</td></tr></table>\n";
-		echo "<font face='Verdana,Arial,Sans,sans-serif' size=2>";
-		echo _T('texte_article_virtuel_reference');
-		echo "</font>";
-		echo "</div><p>\n";
-	}
-
-	else {
-		echo "<HR>";
-
-		if (($articles_chapeau != "non") OR $chapo) {
-			if ($spip_ecran == "large") $rows = 8;
-			else $rows = 5;
-			echo "<B>"._T('info_chapeau')."</B>";
-			echo aide ("artchap");
-			echo "<BR>"._T('texte_introductif_article')."<BR>";
-			echo "<TEXTAREA NAME='chapo' CLASS='forml' ROWS='$rows' COLS='40' wrap=soft>";
-			echo $chapo;
-			echo "</TEXTAREA><P>\n";
-		}
-		else {
-			echo "<INPUT TYPE='hidden' NAME='chapo' VALUE=\"$chapo\">";
-		}
-
-	}
-
-	if ($spip_ecran == "large") $rows = 28;
-	else $rows = 20;
-
-	if (strlen($texte)>29*1024) // texte > 32 ko -> decouper en morceaux
-	{
-		$textes_supplement = "<br><font color='red'>"._T('info_texte_long')."</font>\n";
-		while (strlen($texte)>29*1024)
-		{
-			$nombre_textes ++;
-			list($texte1,$texte) = coupe_trop_long($texte);
-
-			$textes_supplement .= "<BR>";
-			$textes_supplement .= afficher_barre('document.formulaire.texte'.$nombre_textes);
-			$textes_supplement .= "<TEXTAREA NAME='texte$nombre_textes'".
-				" CLASS='formo' ".$GLOBALS['browser_caret']." ROWS='$rows' COLS='40' wrap=soft>" .
-				$texte1 . "</TEXTAREA><P>\n";
-		}
-	}
-	echo "<B>"._T('info_texte')."</B>";
-	echo aide ("arttexte");
-	echo "<br>"._T('texte_enrichir_mise_a_jour');
-	echo aide("raccourcis");
-
-	echo $textes_supplement;
-
-	//echo "<BR>";
-	echo afficher_barre('document.formulaire.texte');
-	echo "<TEXTAREA id='text_area' NAME='texte' ".$GLOBALS['browser_caret']." CLASS='formo' ROWS='$rows' COLS='40' wrap=soft>";
-	echo $texte;
-	echo "</TEXTAREA>\n";
-
-	if (($articles_ps != "non" AND $options == "avancees") OR $ps) {
-		echo "<P><B>"._T('info_post_scriptum')."</B><BR>";
-		echo "<TEXTAREA NAME='ps' CLASS='forml' ROWS='5' COLS='40' wrap=soft>";
-		echo $ps;
-		echo "</TEXTAREA><P>\n";
-	}
-	else {
-		echo "<INPUT TYPE='hidden' NAME='ps' VALUE=\"$ps\">";
-	}
-
-	if ($champs_extra) {
-		include_ecrire("inc_extra.php3");
-		extra_saisie($extra, 'articles', $id_secteur);
-	}
-
-	if ($date)
-		echo "<INPUT TYPE='Hidden' NAME='date' VALUE=\"$date\" SIZE='40'><P>";
-
-	if ($new == "oui")
-		echo "<INPUT TYPE='Hidden' NAME='statut_nouv' VALUE=\"prepa\" SIZE='40'><P>";
-
-	echo "<DIV ALIGN='right'>";
-	echo "<INPUT CLASS='fondo' TYPE='submit' NAME='Valider' VALUE='"._T('bouton_enregistrer')."'>";
-	echo "</DIV></FORM>";
-
-fin_cadre_formulaire();
 
-fin_page();
+if (function_exists('affiche_articles_edit'))
+  $var_nom = 'affiche_articles_edit';
+ else
+  $var_nom = 'affiche_articles_edit_dist';
 
+$var_nom($flag_editable, $id_article, $id_rubrique, $titre, $soustitre, $surtitre, $descriptif, $nom, $url, $chapo, $texte, $ps, $new, $nom_site, $url_site, $champs_extra, $extra, $id_secteur, $date, $onfocus, $lier_trad);
 ?>
diff --git a/ecrire/inc_articles_edit.php b/ecrire/inc_articles_edit.php
new file mode 100644
index 0000000000000000000000000000000000000000..b08abfce9bb08720f0833072c78dd66f67d850b5
--- /dev/null
+++ b/ecrire/inc_articles_edit.php
@@ -0,0 +1,426 @@
+<?php
+
+/***************************************************************************\
+ *  SPIP, Systeme de publication pour l'internet                           *
+ *                                                                         *
+ *  Copyright (c) 2001-2005                                                *
+ *  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.   *
+\***************************************************************************/
+
+
+function enfant($leparent){
+	global $id_parent;
+	global $id_rubrique;
+	static $i = 0, $premier = 1;
+	global $statut;
+	global $connect_toutes_rubriques;
+	global $couleur_claire, $spip_lang_left;
+	global $browser_name, $browser_version;
+	global $ja_rub;
+
+	$i++;
+ 	$query="SELECT * FROM spip_rubriques WHERE id_parent='$leparent' ORDER BY 0+titre, titre";
+ 	$result=spip_query($query);
+
+	while($row=spip_fetch_array($result)){
+		$my_rubrique=$row['id_rubrique'];
+		$titre=$row['titre'];
+		$statut_rubrique=$row['statut'];
+		$lang_rub = $row['lang'];
+		$langue_choisie_rub = $row['langue_choisie'];
+		$style = "";
+		$espace = "";
+
+		// si l'article est publie il faut etre admin pour avoir le menu
+		// sinon le menu est present en entier (proposer un article)
+		if ($statut != "publie" OR acces_rubrique($my_rubrique)) {
+			$rubrique_acceptable = true;
+		} else {
+			$rubrique_acceptable = false;
+		}
+
+
+		if (eregi("mozilla", $browser_name)) {
+			$style .= "padding-$spip_lang_left: 16px; ";
+			$style .= "margin-$spip_lang_left: ".(($i-1)*16)."px;";
+		} else {
+			for ($count = 0; $count <= $i; $count ++) $espace .= "&nbsp;&nbsp;&nbsp;&nbsp;";
+		}
+		switch ($i) {
+		case 1:
+			$espace= "";
+			$style .= "font-weight: bold;";
+			break;
+		case 2:
+			$style .= "color: #202020;";
+			break;
+		case 3:
+			$style .= "color: #404040;";
+			break;
+		case 4:
+			$style .= "color: #606060;";
+			break;
+		case 5:
+			$style .= "color: #808080;";
+			break;
+		default:
+			$style .= "color: #A0A0A0;";
+			break;
+		}
+		if ($i==1) {
+			$style .= "background-image: url(" . _DIR_IMG_PACK. "secteur-12.gif);";
+			$style .= "background-color: $couleur_claire;";
+			$style .= "font-weight: bold;";
+		}
+		else if ($i==2) {
+			//$style .= "background: url(" . _DIR_IMG_PACK. "rubrique-12.gif) $spip_lang_left no-repeat;";
+			$style .= "border-bottom: 1px solid $couleur_claire;";
+			$style .= "font-weight: bold;";
+		}
+		else {
+			//$style .= "background: url(" . _DIR_IMG_PACK. "rubrique-12.gif) $spip_lang_left no-repeat;";
+		}
+
+			$selec_rub = "selec_rub";
+			if ($browser_name == "MSIE" AND floor($browser_version) == "5") $selec_rub = ""; // Bug de MSIE MacOs 9.0
+
+		if ($rubrique_acceptable) {
+			if ($i == 1 && !$premier) echo "<option value='$my_rubrique'>\n"; // sert a separer les secteurs
+			// largeur maxi a 50
+			$titre = couper(supprimer_tags(typo(extraire_multi($titre)))." ", 50);
+			if (lire_meta('multi_rubriques') == 'oui' AND ($langue_choisie_rub == "oui" OR $leparent == 0)) $titre = $titre." [".traduire_nom_langue($lang_rub)."]";
+			echo "<option".mySel($my_rubrique,$id_rubrique)." class='$selec_rub' style=\"$style\">$espace$titre</option>\n";
+		
+		
+			$ja_rub .= addslashes("[$my_rubrique] $titre ///");
+		}
+		$premier = 0;
+		enfant($my_rubrique);
+	}
+	$i=$i-1;
+}
+
+
+//
+// Gestion des textes trop longs (limitation brouteurs)
+//
+
+function coupe_trop_long($texte){	// utile pour les textes > 32ko
+	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,''));
+}
+
+
+function rubrique_articles_edit($titre_parent, $id_rubrique)
+{
+	global $spip_display;
+
+	if ($spip_display == 4) {
+	
+		// Integrer la recherche de rubrique au clavier
+		echo "<script language='JavaScript' type='text/javascript' src='filtery.js'></script>\n";
+		echo "<input type='text' size='10' style='font-size: 90%; width: 15%;' onkeyup=\"filtery(this.value,this.form.id_rubrique);\" onChange=\"filtery(this.value,this.form.id_rubrique);\"> ";
+	
+		echo "<SELECT NAME='id_rubrique' style='font-size: 90%; width:80%; font-face:verdana,arial,helvetica,sans-serif; max-height: 24px;' SIZE=1>\n";
+		enfant(0);
+		echo "</SELECT><BR>\n";
+		
+		echo _T('texte_rappel_selection_champs');
+	
+	} else {
+		echo "<table width='100%'><tr width='100%'><td width='45'>";
+		echo "<a href=\"#\" onClick=\"javascript:if(findObj('selection_rubrique').style.display=='none') {charger_id_url_si_vide('ajax_page.php?fonction=aff_rubrique&id_rubrique=$id_rubrique','selection_rubrique');} else {findObj('selection_rubrique').style.display='none';}\"><img src='img_pack/loupe.png' style='border: 0px; vertical-align: middle;' /></a> ";
+		echo "<img src='img_pack/searching.gif' id='img_selection_rubrique' style='visibility: hidden;'>";
+		echo "</td><td>";
+		echo "<input type='text' id='titreparent' name='titreparent' disabled='disabled' class='forml' value=\"$titre_parent\" />";
+		echo "<input type='hidden' id='id_rubrique' name='id_rubrique' value='$id_rubrique' />";
+		echo "</td></tr></table>";
+		
+		echo "<div id='selection_rubrique' style='display: none;'></div>";
+	
+	}
+}
+
+
+function chapo_articles_edit($chapo, $articles_chapeau)
+{
+	global $connect_statut, $spip_ecran;
+
+	if (substr($chapo, 0, 1) == '=') {
+		$virtuel = substr($chapo, 1);
+		$chapo = "";
+	}
+
+	if ($connect_statut=="0minirezo" AND $virtuel){
+		echo "<p><div style='border: 1px dashed #666666; background-color: #f0f0f0; padding: 5px;'>";
+		echo "<table width=100% cellspacing=0 cellpadding=0 border=0>";
+		echo "<tr><td valign='top'>";
+		echo "<font face='Verdana,Arial,Sans,sans-serif' size=2>";
+		echo "<B><label for='confirme-virtuel'>"._T('info_redirection')."&nbsp;:</label></B>";
+		echo aide ("artvirt");
+		echo "</font>";
+		echo "</td>";
+		echo "<td width=10>&nbsp;</td>";
+		echo "<td valign='top' width='50%'>";
+		if (!$virtuel) $virtuel = "http://";
+		echo "<INPUT TYPE='text' NAME='virtuel' CLASS='forml' style='font-size:9px;' VALUE=\"$virtuel\" SIZE='40'>";
+		echo "<input type='hidden' name='changer_virtuel' value='oui'>";
+		echo "</td></tr></table>\n";
+		echo "<font face='Verdana,Arial,Sans,sans-serif' size=2>";
+		echo _T('texte_article_virtuel_reference');
+		echo "</font>";
+		echo "</div><p>\n";
+	}
+
+	else {
+		echo "<HR>";
+
+		if (($articles_chapeau != "non") OR $chapo) {
+			if ($spip_ecran == "large") $rows = 8;
+			else $rows = 5;
+			echo "<B>"._T('info_chapeau')."</B>";
+			echo aide ("artchap");
+			echo "<BR>"._T('texte_introductif_article')."<BR>";
+			echo "<TEXTAREA NAME='chapo' CLASS='forml' ROWS='$rows' COLS='40' wrap=soft>";
+			echo $chapo;
+			echo "</TEXTAREA><P>\n";
+		}
+		else {
+			echo "<INPUT TYPE='hidden' NAME='chapo' VALUE=\"$chapo\">";
+		}
+	}
+}
+//// a TESTER
+function formulaire_articles_edit($id_article, $id_rubrique, $titre, $soustitre, $surtitre, $descriptif, $nom, $url, $chapo, $texte, $ps, $new, $nom_site, $url_site, $champs_extra, $extra, $id_secteur, $date, $onfocus, $lier_trad)
+{
+ global  $spip_lang, $options , $spip_ecran;
+
+$articles_surtitre = lire_meta("articles_surtitre");
+$articles_soustitre = lire_meta("articles_soustitre");
+$articles_descriptif = lire_meta("articles_descriptif");
+$articles_urlref = lire_meta("articles_urlref");
+$articles_chapeau = lire_meta("articles_chapeau");
+$articles_ps = lire_meta("articles_ps");
+$articles_redac = lire_meta("articles_redac");
+$articles_mots = lire_meta("articles_mots");
+$articles_modif = lire_meta("articles_modif");
+
+echo "\n<table cellpadding=0 cellspacing=0 border=0 width='100%'>";
+echo "<tr width='100%'>";
+echo "<td>";
+	if ($lier_trad) icone(_T('icone_retour'), "articles.php3?id_article=$lier_trad", "article-24.gif", "rien.gif");
+	else icone(_T('icone_retour'), "articles.php3?id_article=$id_article", "article-24.gif", "rien.gif");
+
+echo "</td>";
+echo "<td>". http_img_pack('rien.gif', " ", "width='10'") . "</td>\n";
+echo "<td width='100%'>";
+echo _T('texte_modifier_article');
+gros_titre($titre);
+echo "</td></tr></table>";
+echo "<p>";
+
+echo "<P><HR><P>";
+
+	$titre = entites_html($titre);
+	$soustitre = entites_html($soustitre);
+	$surtitre = entites_html($surtitre);
+
+	$descriptif = entites_html($descriptif);
+	$nom_site = entites_html($nom_site);
+	$url_site = entites_html($url_site);
+	$chapo = entites_html($chapo);
+	$texte = entites_html($texte);
+	$ps = entites_html($ps);
+
+	echo "<FORM ACTION='",
+	  'articles.php3', 
+	  ($id_article ? "?id_article=$id_article" : ""),
+	  "' METHOD='post' name='formulaire'>\n";
+
+	if ($id_article)
+		echo "<INPUT TYPE='Hidden' NAME='id_article' VALUE='$id_article'>";
+	else if ($new == 'oui')
+		echo "<INPUT TYPE='Hidden' NAME='new' VALUE='oui'>";
+
+	if ($lier_trad) {
+		echo "<INPUT TYPE='Hidden' NAME='lier_trad' VALUE='$lier_trad'>";
+		echo "<INPUT TYPE='Hidden' NAME='changer_lang' VALUE='$spip_lang'>";
+	}
+
+	if (($options == "avancees" AND $articles_surtitre != "non") OR $surtitre) {
+		echo "<B>"._T('texte_sur_titre')."</B>";
+		echo aide ("arttitre");
+		echo "<BR><INPUT TYPE='text' NAME='surtitre' CLASS='forml' VALUE=\"$surtitre\" SIZE='40'><P>";
+	}
+	else {
+		echo "<INPUT TYPE='hidden' NAME='surtitre' VALUE=\"$surtitre\" >";
+	}
+
+	echo _T('texte_titre_obligatoire');
+	echo aide ("arttitre");
+	echo "<BR><INPUT TYPE='text' NAME='titre' style='font-weight: bold; font-size: 13px;' CLASS='formo' VALUE=\"$titre\" SIZE='40' $onfocus><P>";
+
+	if (($articles_soustitre != "non") OR $soustitre) {
+		echo "<B>"._T('texte_sous_titre')."</B>";
+		echo aide ("arttitre");
+		echo "<BR><INPUT TYPE='text' NAME='soustitre' CLASS='forml' VALUE=\"$soustitre\" SIZE='40'><br><br>";
+	}
+	else {
+		echo "<INPUT TYPE='hidden' NAME='soustitre' VALUE=\"$soustitre\">";
+	}
+
+
+	/// Dans la rubrique....
+	if ($id_rubrique == 0) $logo_parent = "racine-site-24.gif";
+	else {
+		$query = "SELECT id_parent, titre FROM spip_rubriques WHERE id_rubrique='$id_rubrique'";
+		$result=spip_query($query);
+		while($row=spip_fetch_array($result)){
+			$parent_parent=$row['id_parent'];
+			$titre_parent = $row["titre"];
+		}
+		if ($parent_parent == 0) $logo_parent = "secteur-24.gif";
+		else $logo_parent = "rubrique-24.gif";
+	}
+	debut_cadre_couleur("$logo_parent", false, "", _T('titre_cadre_interieur_rubrique').aide ("artrub"));
+
+	rubrique_articles_edit($titre_parent, $id_rubrique);
+
+	fin_cadre_couleur();
+	
+	if ($new != 'oui') echo "<INPUT TYPE='hidden' NAME='id_rubrique_old' VALUE=\"$id_rubrique\" >";
+
+	if (($options == "avancees" AND $articles_descriptif != "non") OR $descriptif) {
+		echo "<P><B>"._T('texte_descriptif_rapide')."</B>";
+		echo aide ("artdesc");
+		echo "<BR>"._T('texte_contenu_article')."<BR>";
+		echo "<TEXTAREA NAME='descriptif' CLASS='forml' ROWS='2' COLS='40' wrap=soft>";
+		echo $descriptif;
+		echo "</TEXTAREA><P>\n";
+	}
+	else {
+		echo "<INPUT TYPE='hidden' NAME='descriptif' VALUE=\"$descriptif\">";
+	}
+
+	if (($options == "avancees" AND $articles_urlref != "non") OR $nom_site OR $url_site) {
+		echo _T('entree_liens_sites')."<br />\n";
+		echo _T('info_titre')." ";
+		echo "<input type='text' name='nom_site' class='forml' width='40' value=\"$nom_site\"/><br />\n";
+		echo _T('info_url')." ";
+		echo "<input type='text' name='url_site' class='forml' width='40' value=\"$url_site\"/>";
+	}
+
+	chapo_articles_edit($chapo, $articles_chapeau);
+
+	if ($spip_ecran == "large") $rows = 28;
+	else $rows = 20;
+
+	if (strlen($texte)>29*1024) // texte > 32 ko -> decouper en morceaux
+	{
+		$textes_supplement = "<br><font color='red'>"._T('info_texte_long')."</font>\n";
+		while (strlen($texte)>29*1024)
+		{
+			$nombre_textes ++;
+			list($texte1,$texte) = coupe_trop_long($texte);
+
+			$textes_supplement .= "<BR>";
+			$textes_supplement .= afficher_barre('document.formulaire.texte'.$nombre_textes);
+			$textes_supplement .= "<TEXTAREA NAME='texte$nombre_textes'".
+				" CLASS='formo' ".$GLOBALS['browser_caret']." ROWS='$rows' COLS='40' wrap=soft>" .
+				$texte1 . "</TEXTAREA><P>\n";
+		}
+	}
+	echo "<B>"._T('info_texte')."</B>";
+	echo aide ("arttexte");
+	echo "<br>"._T('texte_enrichir_mise_a_jour');
+	echo aide("raccourcis");
+
+	echo $textes_supplement;
+
+	//echo "<BR>";
+	echo afficher_barre('document.formulaire.texte');
+	echo "<TEXTAREA id='text_area' NAME='texte' ".$GLOBALS['browser_caret']." CLASS='formo' ROWS='$rows' COLS='40' wrap=soft>";
+	echo $texte;
+	echo "</TEXTAREA>\n";
+
+	if (($articles_ps != "non" AND $options == "avancees") OR $ps) {
+		echo "<P><B>"._T('info_post_scriptum')."</B><BR>";
+		echo "<TEXTAREA NAME='ps' CLASS='forml' ROWS='5' COLS='40' wrap=soft>";
+		echo $ps;
+		echo "</TEXTAREA><P>\n";
+	}
+	else {
+		echo "<INPUT TYPE='hidden' NAME='ps' VALUE=\"$ps\">";
+	}
+
+	if ($champs_extra) {
+		include_ecrire("inc_extra.php3");
+		extra_saisie($extra, 'articles', $id_secteur);
+	}
+
+	if ($date)
+		echo "<INPUT TYPE='Hidden' NAME='date' VALUE=\"$date\" SIZE='40'><P>";
+
+	if ($new == "oui")
+		echo "<INPUT TYPE='Hidden' NAME='statut_nouv' VALUE=\"prepa\" SIZE='40'><P>";
+
+	echo "<DIV ALIGN='right'>";
+	echo "<INPUT CLASS='fondo' TYPE='submit' NAME='Valider' VALUE='"._T('bouton_enregistrer')."'>";
+	echo "</DIV></FORM>";
+}
+
+
+function affiche_articles_edit_dist($flag_editable, $id_article, $id_rubrique, $titre, $soustitre, $surtitre, $descriptif, $nom, $url, $chapo, $texte, $ps, $new, $nom_site, $url_site, $champs_extra, $extra, $id_secteur, $date, $onfocus, $lier_trad)
+{
+debut_page(_T('titre_page_articles_edit', array('titre' => $titre)), "documents", "articles", "hauteurTextarea();");
+
+debut_grand_cadre();
+
+afficher_hierarchie($id_rubrique);
+
+fin_grand_cadre();
+
+debut_gauche();
+
+//
+// Pave "documents associes a l'article"
+//
+
+if ($new != 'oui'){
+	# modifs de la description d'un des docs joints
+	if ($flag_editable) maj_documents($id_article, 'article');
+
+	# affichage
+	afficher_documents_colonne($id_article, 'article', $flag_editable);
+}
+$GLOBALS['id_article_bloque'] = $id_article;	// globale dans debut_droite
+debut_droite();
+debut_cadre_formulaire();
+ formulaire_articles_edit($id_article, $id_rubrique, $titre, $soustitre, $surtitre, $descriptif, $nom, $url, $chapo, $texte, $ps, $new, $nom_site, $url_site, $champs_extra, $extra, $id_secteur, $date, $onfocus, $lier_trad);
+fin_cadre_formulaire();
+
+fin_page();
+}
+?>