3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2011 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
13 if (!defined('_ECRIRE_INC_VERSION')) return;
15 include_spip('inc/presentation');
16 include_spip('inc/actions');
17 include_spip('inc/texte');
19 // http://doc.spip.org/@inc_petitionner_dist
20 function inc_petitionner_dist($id_article, $script, $args, $ajax=false)
22 global $spip_lang_right;
24 $petition = sql_fetsel("*", "spip_petitions", "id_article=$id_article");
26 if (!autoriser('modererpetition', 'article', $id_article))
27 return petitionner_decompte($id_article, $petition);
29 $choix = petitionner_choisir($petition);
33 . petitionner_decompte($id_article, $petition)
34 . petitionner_params($petition)
35 . petitionner_message($petition);
39 $class = $ajax ?
'' : ' visible_au_chargement';
42 $atts = " class='$class' style='float: $spip_lang_right;' id='valider_petition'";
44 $res = ajax_action_post('petitionner', $id_article, $script, $args, $res,_T('bouton_changer'), $atts);
46 return ajax_action_greffe("petitionner", $id_article, $res);
49 // http://doc.spip.org/@petitionner_choisir
50 function petitionner_choisir($petition)
54 'on' => _T('bouton_radio_petition_activee'),
55 'off'=> _T('bouton_radio_supprimer_petition')
60 'off'=> _T('bouton_radio_pas_petition'),
61 'on' => _T('bouton_radio_activer_petition')
67 foreach ($menu as $val => $desc) {
68 $res .= "<option" . (($val_menu == $val) ?
" selected='selected'" : '') . " value='$val'>".$desc."</option>\n";
71 return "<select name='change_petition' id='change_petition'
73 onchange=\"\$('#valider_petition').css('visibility','visible');\"
74 >\n$res</select><br />\n";
77 // http://doc.spip.org/@petitionner_decompte
78 function petitionner_decompte($id_article, $petition)
80 $signatures = sql_countsel("spip_signatures", "id_article=$id_article");
82 if (!$signatures) return '';
84 return '<!-- visible -->' // message pour l'appelant
86 $signatures.' '. _T('info_signatures'),
87 generer_url_ecrire("controle_petition", "id_article=$id_article",'', false),
88 "suivi-petition-24.gif",
94 // http://doc.spip.org/@petitionner_message
95 function petitionner_message($petition)
97 return "<br /><label for='texte_petition'>"._T('texte_descriptif_petition')."</label> :<br />"
98 . "<textarea name='texte_petition' id='texte_petition' class='forml' rows='4' cols='10'>"
99 . entites_html($petition["texte"])
103 // http://doc.spip.org/@petitionner_params
104 function petitionner_params($petition)
106 $email_unique=$petition["email_unique"];
107 $site_obli=$petition["site_obli"];
108 $site_unique=$petition["site_unique"];
109 $message=$petition["message"];
111 $res = "<input type='checkbox' name='email_unique' id='emailunique' "
112 . (($email_unique=="oui")?
"checked='checked' ":"")
114 . " <label for='emailunique'>"._T('bouton_checkbox_signature_unique_email')."</label><br />";
116 $res .= "<input type='checkbox' name='site_obli' id='siteobli' "
117 . ($site_obli=="oui"?
"checked='checked'":"")
121 . " <label for='siteobli'>"._T('bouton_checkbox_indiquer_site')."</label><br />"
122 . "<input type='checkbox' name='site_unique' id='siteunique' "
123 . ($site_unique=="oui"?
"checked='checked'":"")
125 . " <label for='siteunique'>"._T('bouton_checkbox_signature_unique_site')."</label><br />"
126 . "<input type='checkbox' name='message' id='message' "
127 . ($message=="oui"?
"checked='checked'":"")
129 . " <label for='message'>"._T('bouton_checkbox_envoi_message')."</label>";