1 {**************************************************************************}
3 {* Copyright (C) 2003-2007 Polytechnique.org *}
4 {* http://opensource.polytechnique.org/ *}
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. *}
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. *}
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 *}
21 {**************************************************************************}
23 <h1>Envoyer un mail</h1>
25 <script type="text/javascript">//<![CDATA[
27 function _selectAll(id) {
28 var list = document.getElementById(id);
29 for (i = 0 ; i < list.length ; i++) {
30 list.options[i].selected = true;
34 function check(form) {
35 _selectAll('to_contacts');
36 _selectAll('cc_contacts');
37 if(form.sujet.value == "") {
39 return confirm ("Le sujet du mail est vide, veux tu continuer ?");
44 function _move(idFrom, idTo) {
45 var from = document.getElementById(idFrom);
46 var to = document.getElementById(idTo);
48 var index = new Array();
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;
63 for (i = index.length - 1 ; i >= 0 ; i--) {
64 from.remove(index[i]);
69 _move('contacts', 'to_contacts');
73 _move('to_contacts', 'contacts');
77 _move('contacts', 'cc_contacts');
81 _move('cc_contacts', 'contacts');
87 <form action="emails/send" method="post" enctype="multipart/form-data" onsubmit="return check(this);">
88 <table class="bicol" cellpadding="2" cellspacing="0">
90 <th colspan="2">Destinataires</th>
93 <td class="titre">de :</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}
99 "{$smarty.session.prenom} {$smarty.session.nom}" <{$smarty.session.bestalias}@{#globals.mail.domain#}>
104 <td class="titre">à :</td>
106 <input type='text' name='to' size='60' value="{$smarty.request.to}" />
110 <td class="titre">copie :</td>
112 <input type='text' name='cc' size='60' value="{$smarty.request.cc}" />
116 <td class="titre">copie cachée :</td>
118 <input type='text' name='bcc' size='60' value="{$smarty.request.bcc}" />
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
127 {if $contacts|@count}
130 Destinataires parmi tes contacts
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})
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})
155 <div style="width: 19%; text-align: center; height: 8em; float: right;">
156 <div style="height: 4em">
158 <a href="" onclick="addTo(); return false" style="text-decoration: none">>> >></a><br />
159 <a href="" onclick="removeTo(); return false" style="text-decoration: none"><< <<</a>
161 <div style="height: 4em">
163 <a href="" onclick="addCc(); return false" style="text-decoration: none">>> >></a><br />
164 <a href="" onclick="removeCc(); return false" style="text-decoration: none"><< <<</a>
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})
178 {foreach item=contact from=$contacts}
179 <input type="hidden" name="contacts[{$contact.forlife}]" value="{$contact.prenom} {$contact.nom} <{$contact.forlife}@{#globals.mail.domain#}>" />
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">
190 {$smarty.request.contenu}
191 {if !$smarty.request.contenu}
193 {$smarty.session.prenom} {$smarty.session.nom}
196 <strong>{icon name=email_attach} Ajouter une pièce jointe : </strong>
197 <input type="file" name="uploaded" />
200 <input type="submit" name="submit" value="Envoyer" />
206 {* vim:set et sw=2 sts=2 sws=2: *}