0337d704 |
1 | {**************************************************************************} |
2 | {* *} |
50a40a33 |
3 | {* Copyright (C) 2003-2006 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 | |
0337d704 |
34 | function check(form) { |
91a14f73 |
35 | _selectAll('to_contacts'); |
36 | _selectAll('cc_contacts'); |
0337d704 |
37 | if(form.sujet.value == "") { |
38 | form.sujet.focus(); |
39 | return confirm ("Le sujet du mail est vide, veux tu continuer ?"); |
40 | } |
41 | return true; |
42 | } |
91a14f73 |
43 | |
44 | function _move(idFrom, idTo) { |
45 | var from = document.getElementById(idFrom); |
46 | var to = document.getElementById(idTo); |
47 | |
48 | var index = new Array(); |
49 | var j = 0; |
50 | for (i = 0 ; i < from.length ; i++) { |
51 | if (from.options[i].selected) { |
52 | var option = document.createElement('option'); |
53 | option.value = from.options[i].value; |
54 | option.text = from.options[i].text; |
55 | try { |
56 | to.add(option, null); |
57 | } catch(ex) { |
58 | to.add(option); |
59 | } |
60 | index[j++] = i; |
61 | } |
62 | } |
63 | for (i = index.length - 1 ; i >= 0 ; i--) { |
64 | from.remove(index[i]); |
65 | } |
66 | } |
67 | |
68 | function addTo() { |
69 | _move('contacts', 'to_contacts'); |
70 | } |
71 | |
72 | function removeTo() { |
73 | _move('to_contacts', 'contacts'); |
74 | } |
75 | |
76 | function addCc() { |
77 | _move('contacts', 'cc_contacts'); |
78 | } |
79 | |
80 | function removeCc() { |
81 | _move('cc_contacts', 'contacts'); |
82 | } |
0337d704 |
83 | {/literal} |
84 | //]]> |
85 | </script> |
86 | |
91a14f73 |
87 | <form action="emails/send" method="post" enctype="multipart/form-data" onsubmit="return check(this);"> |
0337d704 |
88 | <table class="bicol" cellpadding="2" cellspacing="0"> |
89 | <tr> |
90 | <th colspan="2">Destinataires</th> |
91 | </tr> |
92 | <tr> |
93 | <td class="titre">de :</td> |
94 | <td> |
95 | <input type='hidden' name='signature' value='1' /> |
96 | <input type='text' name='from' size='60' value='{if $smarty.request.from} |
97 | {$smarty.request.from} |
98 | {else} |
ff5e5034 |
99 | "{$smarty.session.prenom} {$smarty.session.nom}" <{$smarty.session.bestalias}@{#globals.mail.domain#}> |
0337d704 |
100 | {/if}' /> |
101 | </td> |
102 | </tr> |
103 | <tr> |
104 | <td class="titre">à :</td> |
105 | <td> |
106 | <input type='text' name='to' size='60' value="{$smarty.request.to}" /> |
107 | </td> |
108 | </tr> |
109 | <tr> |
110 | <td class="titre">copie :</td> |
111 | <td> |
112 | <input type='text' name='cc' size='60' value="{$smarty.request.cc}" /> |
113 | </td> |
114 | </tr> |
115 | <tr> |
116 | <td class="titre">copie cachée :</td> |
117 | <td> |
118 | <input type='text' name='bcc' size='60' value="{$smarty.request.bcc}" /> |
119 | </td> |
120 | </tr> |
91a14f73 |
121 | <tr class="pair"> |
122 | <td colspan="2" class="smaller"> |
123 | • Les destinataires sont simplement séparés par des virgules<br /> |
124 | • Pense à te mettre en copie cachée du mail pour en avoir une trace |
0337d704 |
125 | </td> |
126 | </tr> |
91a14f73 |
127 | {if $contacts|@count} |
128 | <tr> |
129 | <th colspan="2"> |
130 | Destinataires parmi tes contacts |
0337d704 |
131 | </th> |
132 | </tr> |
91a14f73 |
133 | <tr> |
134 | <td colspan="2" style="padding: 4px"> |
135 | <div style="float: right; width: 40%;"> |
136 | <select id="to_contacts" name="to_contacts[]" multiple="multiple" style="width: 100%; height: 5em"> |
137 | {foreach key=key item=contact from=$contacts} |
138 | {if in_array($contact.forlife, $smarty.request.to_contacts)} |
139 | <option value="{$contact.forlife}"> |
140 | {$contact.prenom} {$contact.nom} (X{$contact.promo}) |
141 | </option> |
142 | {/if} |
143 | {/foreach} |
144 | </select><br /> |
145 | <select id="cc_contacts" name="cc_contacts[]" multiple="multiple" style="width: 100%; height: 5em"> |
146 | {foreach key=key item=contact from=$contacts} |
147 | {if in_array($contact.forlife, $smarty.request.cc_contacts)} |
148 | <option value="{$contact.forlife}"> |
149 | {$contact.prenom} {$contact.nom} (X{$contact.promo}) |
150 | </option> |
151 | {/if} |
152 | {/foreach} |
153 | </select> |
154 | </div> |
155 | <div style="width: 19%; text-align: center; height: 8em; float: right;"> |
156 | <div style="height: 4em"> |
157 | Destinataires<br /> |
158 | <a href="" onclick="addTo(); return false">>> >></a><br /> |
159 | <a href="" onclick="removeTo(); return false"><< <<</a> |
160 | </div> |
161 | <div style="height: 4em"> |
162 | En copie<br /> |
163 | <a href="" onclick="addCc(); return false">>> >></a><br /> |
164 | <a href="" onclick="removeCc(); return false"><< <<</a> |
165 | </div> |
166 | </div> |
167 | <div style="float: right; width: 40%"> |
168 | <select id="contacts" name="all_contacts[]" multiple="multiple" style="height: 10em; width: 100%"> |
169 | {foreach item=contact from=$contacts} |
170 | {if !in_array($contact.forlife, $smarty.request.to_contacts) && !in_array($contact.forlife, $smarty.request.cc_contacts)} |
171 | <option value="{$contact.forlife}"> |
172 | {$contact.prenom} {$contact.nom} (X{$contact.promo}) |
173 | </option> |
174 | {/if} |
175 | {/foreach} |
176 | </select> |
177 | </div> |
178 | {foreach item=contact from=$contacts} |
179 | <input type="hidden" name="contacts[{$contact.forlife}]" value="{$contact.prenom} {$contact.nom} <{$contact.forlife}@{#globals.mail.domain#}>" /> |
180 | {/foreach} |
181 | </td> |
182 | </tr> |
183 | {/if} |
184 | </table> |
185 | |
186 | <fieldset> |
187 | <legend>Sujet : <input type='text' name='sujet' size='60' value="{$smarty.request.sujet}" /></legend> |
188 | <div class="center">Ne mets que du texte dans le contenu, pas de tags HTML</div> |
189 | <textarea name='contenu' rows="30" cols="75"> |
0337d704 |
190 | {$smarty.request.contenu} |
191 | {if !$smarty.request.contenu} |
192 | -- |
193 | {$smarty.session.prenom} {$smarty.session.nom} |
194 | {/if}</textarea> |
91a14f73 |
195 | <div> |
196 | <strong>Ajouter une pièce jointe : </strong> |
197 | <input type="file" name="uploaded" /> |
198 | </div> |
199 | <div class="center"> |
200 | <input type="submit" name="submit" value="Envoyer" /> |
201 | </div> |
202 | </fieldset> |
0337d704 |
203 | </form> |
204 | |
205 | |
206 | {* vim:set et sw=2 sts=2 sws=2: *} |