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;
37 _selectAll('to_contacts');
38 _selectAll('cc_contacts');
39 if(form.sujet.value == "" && !confirm("Le sujet du mail est vide, veux-tu continuer ?")) {
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");
49 if (!confirm("Tous les destinataires sont en copie cachée, veux-tu continuer ?")) {
57 function _move(idFrom, idTo) {
58 var from = document.getElementById(idFrom);
59 var to = document.getElementById(idTo);
61 var index = new Array();
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;
76 for (i = index.length - 1 ; i >= 0 ; i--) {
77 from.remove(index[i]);
82 _move('contacts', 'to_contacts');
86 _move('to_contacts', 'contacts');
90 _move('contacts', 'cc_contacts');
94 _move('cc_contacts', 'contacts');
100 <form action="emails/send" method="post" enctype="multipart/form-data" onsubmit="return check(this);">
101 <table class="bicol" cellpadding="2" cellspacing="0">
103 <th colspan="2">Destinataires</th>
106 <td class="titre">de :</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}
112 "{$smarty.session.prenom} {$smarty.session.nom}" <{$smarty.session.bestalias}@{#globals.mail.domain#}>
117 <td class="titre">à :</td>
119 <input type='text' name='to' size='60' value="{$smarty.request.to}" />
123 <td class="titre">copie :</td>
125 <input type='text' name='cc' size='60' value="{$smarty.request.cc}" />
129 <td class="titre">copie cachée :</td>
131 <input type='text' name='bcc' size='60' value="{$smarty.request.bcc}" />
135 <td colspan="2" class="smaller">
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
140 {if $contacts|@count}
143 Destinataires parmi tes contacts
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})
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})
168 <div style="width: 19%; text-align: center; height: 8em; float: right;">
169 <div style="height: 4em">
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>
174 <div style="height: 4em">
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>
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})
191 {foreach item=contact from=$contacts}
192 <input type="hidden" name="contacts[{$contact.forlife}]" value="{$contact.prenom} {$contact.nom} <{$contact.forlife}@{#globals.mail.domain#}>" />
200 <legend>Sujet : <input type='text' name='sujet' size='60' value="{$smarty.request.sujet}" /></legend>
201 <div class="center">Ne mets que du texte dans le contenu, pas de tags HTML</div>
202 <textarea name='contenu' rows="30" cols="75">
203 {$smarty.request.contenu}
204 {if !$smarty.request.contenu}
206 {$smarty.session.prenom} {$smarty.session.nom}
208 <script type="text/javascript">//<![CDATA[
210 function removeAttachments()
212 Ajax.update_html(null, 'emails/send', null);
213 document.getElementById('att_already').style.display = 'none';
214 document.getElementById('att_form').style.display = '';
218 {if $uploaded_f|@count}
219 <div id="att_already">
220 <strong>{icon name=email_attach} Pièce jointe : </strong>
222 <a href="javascript:removeAttachments()">
223 <img src="images/icons/bin_empty.gif" alt="Supprimer" title="Supprimer la pièce jointe" />
227 <div id="att_form" {if $uploaded_f|@count neq 0}style="display: none"{/if}>
228 <strong>{icon name=email_attach} Ajouter une pièce jointe (max. {$maxsize}) : </strong>
229 <input type="file" name="uploaded" />
232 <input type="submit" name="submit" value="Envoyer" />
238 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}