0337d704 |
1 | {**************************************************************************} |
2 | {* *} |
5ddeb07c |
3 | {* Copyright (C) 2003-2007 Polytechnique.org *} |
0337d704 |
4 | {* http://opensource.polytechnique.org/ *} |
5 | {* *} |
6 | {* This program is free software; you can redistribute it and/or modify *} |
7 | {* it under the terms of the GNU General Public License as published by *} |
8 | {* the Free Software Foundation; either version 2 of the License, or *} |
9 | {* (at your option) any later version. *} |
10 | {* *} |
11 | {* This program is distributed in the hope that it will be useful, *} |
12 | {* but WITHOUT ANY WARRANTY; without even the implied warranty of *} |
13 | {* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *} |
14 | {* GNU General Public License for more details. *} |
15 | {* *} |
16 | {* You should have received a copy of the GNU General Public License *} |
17 | {* along with this program; if not, write to the Free Software *} |
18 | {* Foundation, Inc., *} |
19 | {* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *} |
20 | {* *} |
21 | {**************************************************************************} |
22 | |
81b5b746 |
23 | <h1>Envoyer un mail</h1> |
0337d704 |
24 | |
0337d704 |
25 | <script type="text/javascript">//<![CDATA[ |
26 | {literal} |
91a14f73 |
27 | function _selectAll(id) { |
28 | var list = document.getElementById(id); |
29 | for (i = 0 ; i < list.length ; i++) { |
30 | list.options[i].selected = true; |
31 | } |
32 | } |
33 | |
f3fb8eda |
34 | function check(form) |
35 | { |
36 | var send = true; |
91a14f73 |
37 | _selectAll('to_contacts'); |
38 | _selectAll('cc_contacts'); |
f3fb8eda |
39 | if(form.sujet.value == "" && !confirm("Le sujet du mail est vide, veux-tu continuer ?")) { |
40 | form.sujet.focus(); |
41 | return false; |
42 | } |
43 | if (form.to.value == "" && form.cc.value == "" |
44 | && document.getElementById('to_contacts').length == 0 && document.getElementById('cc_contacts').length == 0) { |
45 | if (form.bcc.value == "") { |
46 | alert("Il faut définir au moins un destinataire au mail"); |
47 | return false; |
48 | } |
49 | if (!confirm("Tous les destinataires sont en copie cachée, veux-tu continuer ?")) { |
50 | form.to.focus(); |
51 | return false; |
52 | } |
0337d704 |
53 | } |
54 | return true; |
55 | } |
91a14f73 |
56 | |
57 | function _move(idFrom, idTo) { |
58 | var from = document.getElementById(idFrom); |
59 | var to = document.getElementById(idTo); |
60 | |
61 | var index = new Array(); |
62 | var j = 0; |
63 | for (i = 0 ; i < from.length ; i++) { |
64 | if (from.options[i].selected) { |
65 | var option = document.createElement('option'); |
66 | option.value = from.options[i].value; |
67 | option.text = from.options[i].text; |
68 | try { |
69 | to.add(option, null); |
70 | } catch(ex) { |
71 | to.add(option); |
72 | } |
73 | index[j++] = i; |
74 | } |
75 | } |
76 | for (i = index.length - 1 ; i >= 0 ; i--) { |
77 | from.remove(index[i]); |
78 | } |
79 | } |
80 | |
81 | function addTo() { |
82 | _move('contacts', 'to_contacts'); |
83 | } |
84 | |
85 | function removeTo() { |
86 | _move('to_contacts', 'contacts'); |
87 | } |
88 | |
89 | function addCc() { |
90 | _move('contacts', 'cc_contacts'); |
91 | } |
92 | |
93 | function removeCc() { |
94 | _move('cc_contacts', 'contacts'); |
95 | } |
0337d704 |
96 | {/literal} |
97 | //]]> |
98 | </script> |
99 | |
91a14f73 |
100 | <form action="emails/send" method="post" enctype="multipart/form-data" onsubmit="return check(this);"> |
0337d704 |
101 | <table class="bicol" cellpadding="2" cellspacing="0"> |
102 | <tr> |
103 | <th colspan="2">Destinataires</th> |
104 | </tr> |
105 | <tr> |
106 | <td class="titre">de :</td> |
107 | <td> |
108 | <input type='hidden' name='signature' value='1' /> |
109 | <input type='text' name='from' size='60' value='{if $smarty.request.from} |
110 | {$smarty.request.from} |
111 | {else} |
ff5e5034 |
112 | "{$smarty.session.prenom} {$smarty.session.nom}" <{$smarty.session.bestalias}@{#globals.mail.domain#}> |
0337d704 |
113 | {/if}' /> |
114 | </td> |
115 | </tr> |
116 | <tr> |
a7de4ef7 |
117 | <td class="titre">à :</td> |
0337d704 |
118 | <td> |
119 | <input type='text' name='to' size='60' value="{$smarty.request.to}" /> |
120 | </td> |
121 | </tr> |
122 | <tr> |
123 | <td class="titre">copie :</td> |
124 | <td> |
125 | <input type='text' name='cc' size='60' value="{$smarty.request.cc}" /> |
126 | </td> |
127 | </tr> |
128 | <tr> |
a7de4ef7 |
129 | <td class="titre">copie cachée :</td> |
0337d704 |
130 | <td> |
131 | <input type='text' name='bcc' size='60' value="{$smarty.request.bcc}" /> |
132 | </td> |
133 | </tr> |
91a14f73 |
134 | <tr class="pair"> |
135 | <td colspan="2" class="smaller"> |
a7de4ef7 |
136 | • Les destinataires sont simplement séparés par des virgules<br /> |
137 | • Pense à te mettre en copie cachée du mail pour en avoir une trace |
0337d704 |
138 | </td> |
139 | </tr> |
91a14f73 |
140 | {if $contacts|@count} |
141 | <tr> |
142 | <th colspan="2"> |
143 | Destinataires parmi tes contacts |
0337d704 |
144 | </th> |
145 | </tr> |
91a14f73 |
146 | <tr> |
147 | <td colspan="2" style="padding: 4px"> |
148 | <div style="float: right; width: 40%;"> |
149 | <select id="to_contacts" name="to_contacts[]" multiple="multiple" style="width: 100%; height: 5em"> |
150 | {foreach key=key item=contact from=$contacts} |
151 | {if in_array($contact.forlife, $smarty.request.to_contacts)} |
152 | <option value="{$contact.forlife}"> |
153 | {$contact.prenom} {$contact.nom} (X{$contact.promo}) |
154 | </option> |
155 | {/if} |
156 | {/foreach} |
157 | </select><br /> |
158 | <select id="cc_contacts" name="cc_contacts[]" multiple="multiple" style="width: 100%; height: 5em"> |
159 | {foreach key=key item=contact from=$contacts} |
160 | {if in_array($contact.forlife, $smarty.request.cc_contacts)} |
161 | <option value="{$contact.forlife}"> |
162 | {$contact.prenom} {$contact.nom} (X{$contact.promo}) |
163 | </option> |
164 | {/if} |
165 | {/foreach} |
166 | </select> |
167 | </div> |
168 | <div style="width: 19%; text-align: center; height: 8em; float: right;"> |
169 | <div style="height: 4em"> |
170 | Destinataires<br /> |
db0873ff |
171 | <a href="" onclick="addTo(); return false" style="text-decoration: none">>> >></a><br /> |
172 | <a href="" onclick="removeTo(); return false" style="text-decoration: none"><< <<</a> |
91a14f73 |
173 | </div> |
174 | <div style="height: 4em"> |
175 | En copie<br /> |
db0873ff |
176 | <a href="" onclick="addCc(); return false" style="text-decoration: none">>> >></a><br /> |
177 | <a href="" onclick="removeCc(); return false" style="text-decoration: none"><< <<</a> |
91a14f73 |
178 | </div> |
179 | </div> |
180 | <div style="float: right; width: 40%"> |
181 | <select id="contacts" name="all_contacts[]" multiple="multiple" style="height: 10em; width: 100%"> |
182 | {foreach item=contact from=$contacts} |
183 | {if !in_array($contact.forlife, $smarty.request.to_contacts) && !in_array($contact.forlife, $smarty.request.cc_contacts)} |
184 | <option value="{$contact.forlife}"> |
185 | {$contact.prenom} {$contact.nom} (X{$contact.promo}) |
186 | </option> |
187 | {/if} |
188 | {/foreach} |
189 | </select> |
190 | </div> |
191 | {foreach item=contact from=$contacts} |
192 | <input type="hidden" name="contacts[{$contact.forlife}]" value="{$contact.prenom} {$contact.nom} <{$contact.forlife}@{#globals.mail.domain#}>" /> |
193 | {/foreach} |
194 | </td> |
195 | </tr> |
196 | {/if} |
197 | </table> |
198 | |
199 | <fieldset> |
200 | <legend>Sujet : <input type='text' name='sujet' size='60' value="{$smarty.request.sujet}" /></legend> |
5b21237d |
201 | <div class="center"> |
72b2f8bb |
202 | Tu peux utiliser des <a href="wiki_help" class="popup3">{icon name=information title="Syntaxe wiki"} marqueurs wiki</a> pour formatter ton texte.<br /> |
5b21237d |
203 | <small><input type="checkbox" name="nowiki" value="1" {if $smarty.request.nowiki}checked="checked"{/if} /> |
204 | coche cette case pour envoyer le mail en texte brut, sans formattage</small> |
205 | </div> |
91a14f73 |
206 | <textarea name='contenu' rows="30" cols="75"> |
0337d704 |
207 | {$smarty.request.contenu} |
208 | {if !$smarty.request.contenu} |
209 | -- |
210 | {$smarty.session.prenom} {$smarty.session.nom} |
211 | {/if}</textarea> |
da419622 |
212 | <script type="text/javascript">//<![CDATA[ |
213 | {literal} |
214 | function removeAttachments() |
215 | { |
216 | Ajax.update_html(null, 'emails/send', null); |
217 | document.getElementById('att_already').style.display = 'none'; |
218 | document.getElementById('att_form').style.display = ''; |
219 | } |
220 | {/literal} |
221 | //]]></script> |
222 | {if $uploaded_f|@count} |
223 | <div id="att_already"> |
224 | <strong>{icon name=email_attach} Pièce jointe : </strong> |
225 | {$uploaded_f[0]} |
226 | <a href="javascript:removeAttachments()"> |
227 | <img src="images/icons/bin_empty.gif" alt="Supprimer" title="Supprimer la pièce jointe" /> |
228 | </a> |
229 | </div> |
230 | {/if} |
231 | <div id="att_form" {if $uploaded_f|@count neq 0}style="display: none"{/if}> |
f3fb8eda |
232 | <strong>{icon name=email_attach} Ajouter une pièce jointe (max. {$maxsize}) : </strong> |
91a14f73 |
233 | <input type="file" name="uploaded" /> |
234 | </div> |
235 | <div class="center"> |
236 | <input type="submit" name="submit" value="Envoyer" /> |
237 | </div> |
238 | </fieldset> |
0337d704 |
239 | </form> |
240 | |
241 | |
a7de4ef7 |
242 | {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *} |