1 | <?php |
---|
2 | |
---|
3 | /***************************************************************************\ |
---|
4 | * SPIP, Systeme de publication pour l'internet * |
---|
5 | * * |
---|
6 | * Copyright (c) 2001-2011 * |
---|
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * |
---|
8 | * * |
---|
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 | \***************************************************************************/ |
---|
12 | |
---|
13 | if (!defined('_ECRIRE_INC_VERSION')) return; |
---|
14 | |
---|
15 | include_spip('inc/presentation'); |
---|
16 | include_spip('inc/date'); |
---|
17 | include_spip('inc/agenda'); |
---|
18 | |
---|
19 | |
---|
20 | // http://doc.spip.org/@exec_message_edit_dist |
---|
21 | function exec_message_edit_dist() |
---|
22 | { |
---|
23 | exec_message_edit_args(intval(_request('id_message')), |
---|
24 | _request('new'), |
---|
25 | intval(_request('dest'))); |
---|
26 | } |
---|
27 | // http://doc.spip.org/@exec_message_edit_args |
---|
28 | function exec_message_edit_args($id_message, $new, $dest) |
---|
29 | { |
---|
30 | global $connect_id_auteur, $connect_statut; |
---|
31 | |
---|
32 | if ($new == 'oui') { |
---|
33 | $onfocus = "\nonfocus=\"if(!antifocus){this.value='';antifocus=true;}\""; |
---|
34 | } else $onfocus = ''; |
---|
35 | |
---|
36 | $row = sql_fetsel("*", "spip_messages", "id_message=$id_message"); |
---|
37 | |
---|
38 | $id_message = $row['id_message']; |
---|
39 | $date_heure = $row["date_heure"]; |
---|
40 | $date_fin = $row["date_fin"]; |
---|
41 | $titre = entites_html($row["titre"]); |
---|
42 | $texte = entites_html($row["texte"]); |
---|
43 | $type = $row["type"]; |
---|
44 | $statut = $row["statut"]; |
---|
45 | $rv = $row["rv"]; |
---|
46 | $expediteur = $row["id_auteur"]; |
---|
47 | |
---|
48 | if (!($expediteur == $connect_id_auteur OR ($type == 'affich' AND $connect_statut == '0minirezo'))) { |
---|
49 | include_spip('inc/minipres'); |
---|
50 | echo minipres(); |
---|
51 | } else { |
---|
52 | |
---|
53 | $commencer_page = charger_fonction('commencer_page', 'inc'); |
---|
54 | echo $commencer_page(_T('titre_page_message_edit'), "accueil", "messagerie"); |
---|
55 | |
---|
56 | if ($type == 'normal') { |
---|
57 | $le_type = _T('bouton_envoi_message_02'); |
---|
58 | $logo = "message"; |
---|
59 | } |
---|
60 | if ($type == 'pb') { |
---|
61 | $le_type = _T('bouton_pense_bete'); |
---|
62 | $logo = "pense-bete"; |
---|
63 | } |
---|
64 | if ($type == 'affich') { |
---|
65 | $le_type = _T('bouton_annonce'); |
---|
66 | $logo = "annonce"; |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | echo debut_gauche('', true); |
---|
71 | |
---|
72 | if($type == 'normal' AND $dest) { |
---|
73 | $email = sql_getfetsel("email", "spip_auteurs", "id_auteur=$dest"); |
---|
74 | if (strlen($email) > 3) { |
---|
75 | echo icone_verticale(_T('info_envoyer_message_prive'), "mailto:".$email, "envoi-message-24.gif"); |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | echo debut_droite('', true); |
---|
80 | |
---|
81 | $res = "<div class='arial2'>" |
---|
82 | . "<span style='color:green' class='verdana1 spip_small'><b>$le_type</b></span>"; |
---|
83 | if ($type == "affich") |
---|
84 | $res .="<p style='color:red;' class='verdana1 spip_x-small'>" . _T('texte_message_edit')."</p>"; |
---|
85 | |
---|
86 | $res .= '<br /><br />'."<label for='titre'>" . _T('texte_titre_obligatoire')."</label><br />\n"; |
---|
87 | $res .="<input type='text' class='formo' name='titre' id='titre' value=\"$titre\" size='40' $onfocus />"; |
---|
88 | |
---|
89 | if (!$dest) { |
---|
90 | if ($type == 'normal') { |
---|
91 | $res .="<br /><label for='cherche_auteur'><b>"._T('info_nom_destinataire')."</b></label><br />\n"; |
---|
92 | $res .="<input type='text' class='formo' name='cherche_auteur' id='cherche_auteur' value='' size='40'/>"; |
---|
93 | } |
---|
94 | } else { |
---|
95 | $nom = sql_getfetsel("nom", "spip_auteurs", "id_auteur=$dest"); |
---|
96 | $res .= "<br /><b>" . |
---|
97 | _T('info_nom_destinataire') . |
---|
98 | "</b> : " . |
---|
99 | $nom . |
---|
100 | "<br /><br />\n"; |
---|
101 | } |
---|
102 | $res .= '<br />'; |
---|
103 | |
---|
104 | ////////////////////////////////////////////////////// |
---|
105 | // Fixer rendez-vous? |
---|
106 | // |
---|
107 | if ($rv == "oui") $fonction = "rv.gif"; else $fonction = ""; |
---|
108 | |
---|
109 | $res .= debut_cadre_trait_couleur($logo.".gif", true, $fonction, _T('titre_rendez_vous')) |
---|
110 | . afficher_si_rdv($date_heure, $date_fin, ($rv == "oui")) |
---|
111 | . fin_cadre_trait_couleur(true) |
---|
112 | . "\n<p><label for='texte'><b>" |
---|
113 | . _T('info_texte_message_02') |
---|
114 | . "</b></label><br />" |
---|
115 | . "<textarea name='texte' id='texte' rows='20' class='formo' cols='40'>" |
---|
116 | . $texte |
---|
117 | . "</textarea></p><br />\n" |
---|
118 | . "\n<div style='text-align: right'><input type='submit' value='" |
---|
119 | . _T('bouton_valider') |
---|
120 | . "' class='fondo'/></div>" |
---|
121 | . "\n</div>"; |
---|
122 | |
---|
123 | echo redirige_action_post('editer_message', $id_message, 'message',"id_message=$id_message", $res); |
---|
124 | |
---|
125 | echo fin_gauche(), fin_page(); |
---|
126 | } |
---|
127 | } |
---|
128 | |
---|
129 | // http://doc.spip.org/@afficher_si_rdv |
---|
130 | function afficher_si_rdv($date_heure, $date_fin, $choix) |
---|
131 | { |
---|
132 | $heures_debut = heures($date_heure); |
---|
133 | $minutes_debut = minutes($date_heure); |
---|
134 | $heures_fin = heures($date_fin); |
---|
135 | $minutes_fin = minutes($date_fin); |
---|
136 | |
---|
137 | if ($date_fin == "0000-00-00 00:00:00") { |
---|
138 | $date_fin = $date_heure; |
---|
139 | $heures_fin = $heures_debut + 1; |
---|
140 | } |
---|
141 | |
---|
142 | if ($heures_fin >=24){ |
---|
143 | $heures_fin = 23; |
---|
144 | $minutes_fin = 59; |
---|
145 | } |
---|
146 | |
---|
147 | $lib = _T('item_non_afficher_calendrier'); |
---|
148 | if (!$choix) $lib = "<b>$lib</b>"; |
---|
149 | |
---|
150 | $res = "\n<div><input type='radio' name='rv' value='non' id='rv_off'" . |
---|
151 | (!$choix ? " checked='checked' " : '') |
---|
152 | . "\nonclick=\"changeVisible(this.checked, 'heure-rv', 'none', 'block');\"/>" |
---|
153 | . "<label for='rv_off'>" |
---|
154 | . $lib |
---|
155 | . "</label>" |
---|
156 | . "</div>"; |
---|
157 | |
---|
158 | $lib = _T('item_afficher_calendrier'); |
---|
159 | if ($choix) $lib = "<b>$lib</b>"; |
---|
160 | |
---|
161 | $res .= "\n<div><input type='radio' name='rv' value='oui' id='rv_on' " . |
---|
162 | ($choix ? " checked='checked' " : '') . |
---|
163 | "\nonclick=\"changeVisible(this.checked, 'heure-rv', 'block', 'none');\"/>" . |
---|
164 | "<label for='rv_on'>" |
---|
165 | . $lib |
---|
166 | . "</label>" |
---|
167 | . '</div>'; |
---|
168 | |
---|
169 | $display = ($choix ? "block" : "none"); |
---|
170 | |
---|
171 | return $res . |
---|
172 | "\n<div id='heure-rv' style='display: $display; padding-top: 4px; padding-left: 24px;'>" . |
---|
173 | afficher_jour_mois_annee_h_m($date_heure, $heures_debut, $minutes_debut) . |
---|
174 | "<br />". |
---|
175 | afficher_jour_mois_annee_h_m($date_fin, $heures_fin, $minutes_fin, '_fin') . |
---|
176 | "</div>"; |
---|
177 | } |
---|
178 | |
---|
179 | ?> |
---|