X-Git-Url: http://git.cyclocoop.org/?p=velocampus%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fecrire%2Finc%2Fforum_envoi.php;fp=www%2Fecrire%2Finc%2Fforum_envoi.php;h=9426ee8f81426784f3f2ce348c086ed622c44cfc;hp=0000000000000000000000000000000000000000;hb=80b4d3e85f78d402ed2e73f8f5d1bf4c19962eed;hpb=aaf970bf4cdaf76689ecc10609048e18d073820c
diff --git a/www/ecrire/inc/forum_envoi.php b/www/ecrire/inc/forum_envoi.php
new file mode 100644
index 0000000..9426ee8
--- /dev/null
+++ b/www/ecrire/inc/forum_envoi.php
@@ -0,0 +1,270 @@
+'', 'texte' =>'', 'id_forum' =>0);
+ else $row = forum_envoi_parent($row);
+
+ // apres le premier appel, afficher la saisie precedente
+ if ($modif_forum == "oui") {
+ $row['texte'] = forum_envoi_entete($row['texte'], $row['titre'], $texte, $titre_message, $nom_site, $url_site);
+ }
+
+ // determiner le retour et l'action
+
+ list($script,$retour) = preg_split(',\?,', urldecode($script));
+ if (function_exists($f = 'forum_envoi_' . $script))
+ list($table, $objet, $titre, $num, $retour, $id, $corps) =
+ $f($id, $row, $retour);
+ else $table = $objet = $titre = $num = $retour = $corps ='';
+
+ if (!$titre_message) {
+ if ($table) {
+ $titre_message = sql_getfetsel($titre, "spip_$table", "$objet=$id");
+ } else $titre_message = _T('texte_nouveau_message');
+ }
+
+ $h = _AJAX ? '' : generer_url_ecrire($script, $retour);
+
+ $form = forum_envoi_formulaire($id, $h, $statut, $texte, $titre_message, $nom_site, $url_site);
+
+ return forum_envoi_form($id, $row, $script, $statut, $titre, $row['texte'] . $corps, $form, $objet, $retour);
+}
+
+// http://doc.spip.org/@forum_envoi_form
+function forum_envoi_form($id, $row, $script, $statut, $titre, $corps, $form, $objet, $args, $fct_ajax='') {
+
+ $id_parent = $row['id_forum'];
+ $cat = $id . '/'
+ . $id_parent . '/'
+ . $statut . '/'
+ . $script . '/'
+ . $objet;
+
+ // si reponse directe a l'article etc, reincruster tout le forum
+ // sinon incruster juste le fil
+ $args .= "#poster_forum_prive"
+ . (!$id_parent ? '' : ("-" . $row['id_thread']));
+
+ $corps .= "\n
" .
+ debut_cadre_formulaire(($statut == 'privac') ? "" : 'background-color: #dddddd;', true) .
+$form
+ . ""
+ . "
"
+ . fin_cadre_formulaire(true);
+
+ if (_AJAX)
+ return ajax_action_post('poster_forum_prive',$cat, $script, $args, $corps, array(),'','', "&id=$id&id_parent=$id_parent&statut=$statut", $fct_ajax);
+ else return redirige_action_auteur('poster_forum_prive',$cat, $script, $args, $corps, "\nmethod='post' id='formulaire'");
+}
+
+// Chercher a quoi on repond pour l'afficher au debut
+
+// http://doc.spip.org/@forum_envoi_parent
+function forum_envoi_parent($row)
+{
+ $titre = typo($row['titre']);
+ $texte = $row['texte'];
+ $auteur = $row['auteur'];
+ $id_auteur = $row['id_auteur'];
+ $date_heure = $row['date_heure'];
+ $nom_site = $row['nom_site'];
+ $url_site = $row['url_site'];
+
+ $parent = debut_cadre_forum("forum-interne-24.gif", true, "", $titre)
+ . "$date_heure ";
+
+ if ($id_auteur) {
+ $formater_auteur = charger_fonction('formater_auteur', 'inc');
+ list($s, $mail, $nom, $w, $p) = $formater_auteur($id_auteur);
+ $parent .="$mail $nom";
+ } else $parent .=" " . typo($auteur);
+
+ $parent .= justifier(propre($texte));
+
+ if (strlen($url_site) > 10 AND $nom_site) {
+ $parent .="$nom_site
";
+ }
+ $parent .= fin_cadre_forum(true);
+
+ $row['texte'] = $parent;
+
+ return $row;
+}
+
+// http://doc.spip.org/@forum_envoi_articles
+function forum_envoi_articles($id, $row, $retour) {
+ $table ='articles';
+ $objet = 'id_article';
+ $titre = 'titre';
+ $num = _T('info_numero_article');
+ if (!$id) $id = $row['id_article'];
+ if (!$retour) $retour = "$objet=$id";
+ return array($table, $objet, $titre, $num, $retour, $id, '');
+}
+
+// http://doc.spip.org/@forum_envoi_breves_voir
+function forum_envoi_breves_voir($id, $row, $retour) {
+ $table = 'breves';
+ $objet = 'id_breve';
+ $titre = 'titre';
+ $num = _T('info_gauche_numero_breve');
+ if (!$id) $id = $row['id_breve'];
+ if (!$retour) $retour = "$objet=$id";
+ return array($table, $objet, $titre, $num, $retour, $id, '');
+}
+
+// http://doc.spip.org/@forum_envoi_message
+function forum_envoi_message($id, $row, $retour) {
+ $table = 'messages';
+ $objet = 'id_message';
+ $titre = 'titre';
+ $num = _T('message') . ' ' ._T('info_numero_abbreviation');
+ if (!$id) $id = $row['id_message'];
+ if (!$retour) $retour = "$objet=$id";
+ return array($table, $objet, $titre, $num, $retour, $id, '');
+}
+
+// http://doc.spip.org/@forum_envoi_naviguer
+function forum_envoi_naviguer($id, $row, $retour) {
+ $table = 'rubriques';
+ $objet = 'id_rubrique';
+ $titre = 'titre';
+ $num = _T('titre_numero_rubrique');
+ if (!$id) $id = $row['id_rubrique'];
+ if (!$retour) $retour = "$objet=$id";
+ return array($table, $objet, $titre, $num, $retour, $id, '');
+}
+
+// http://doc.spip.org/@forum_envoi_sites
+function forum_envoi_sites($id, $row, $retour) {
+ $table = 'syndic';
+ $objet = 'id_syndic';
+ $titre = 'nom_site';
+ $num = _T('titre_site_numero');
+ if (!$id) $id = $row['id_syndic'];
+ if (!$retour) $retour = "$objet=$id";
+ return array($table, $objet, $titre, $num, $retour, $id, '');
+}
+
+// http://doc.spip.org/@forum_envoi_forum
+function forum_envoi_forum($id, $row, $retour) {
+
+ $table = $titre = $num = '';
+ $id = 0; // pour forcer la creation dans action/poster
+ $objet = 'id_forum';
+ $debut = intval(_request('debut'));
+ $retour = ("debut=$debut");
+ $corps .= "";
+ return array($table, $objet, $titre, $num, $retour, $id, $corps);
+}
+
+// http://doc.spip.org/@forum_envoi_forum_admin
+function forum_envoi_forum_admin($id, $row, $retour) {
+ return forum_envoi_forum($id, $row, $retour);
+}
+
+// http://doc.spip.org/@forum_envoi_formulaire
+function forum_envoi_formulaire($id, $retour, $statut, $texte, $titre, $nom_site, $url_site)
+{
+
+ return (!$retour ? '' : "".icone(_T('icone_retour'), $retour, forum_logo($statut), '','', false)."
")
+ . "";
+
+}
+
+// http://doc.spip.org/@forum_envoi_entete
+function forum_envoi_entete($parent, $titre_parent, $texte, $titre, $nom_site, $url_site)
+{
+ global $spip_lang_rtl;
+
+ return "\n
";
+}
+?>