Convert source code to UTF-8
[platal.git] / templates / emails / send.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2007 Polytechnique.org                             *}
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
23 <h1>Envoyer un mail</h1>
24
25 <script type="text/javascript">//<![CDATA[
26   {literal}
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
34   function check(form) {
35     _selectAll('to_contacts');
36     _selectAll('cc_contacts');
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   }
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   }
83   {/literal}
84 //]]>
85 </script>
86
87 <form action="emails/send" method="post" enctype="multipart/form-data" onsubmit="return check(this);">
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&nbsp;:</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}
99 "{$smarty.session.prenom} {$smarty.session.nom}" &lt;{$smarty.session.bestalias}@{#globals.mail.domain#}&gt;
100 {/if}' />
101       </td>
102     </tr>
103     <tr> 
104       <td class="titre">à&nbsp;:</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&nbsp;:</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&nbsp;:</td>
117       <td>
118         <input type='text' name='bcc' size='60' value="{$smarty.request.bcc}" />
119       </td>
120     </tr>
121     <tr class="pair">
122       <td colspan="2" class="smaller">
123         &bull;&nbsp;Les destinataires sont simplement séparés par des virgules<br />
124         &bull;&nbsp;Pense à te mettre en copie cachée du mail pour en avoir une trace
125       </td>
126     </tr>
127     {if $contacts|@count}
128     <tr>
129       <th colspan="2">
130         Destinataires parmi tes contacts
131       </th>
132     </tr>
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" style="text-decoration: none">&gt;&gt; &gt;&gt;</a><br />
159               <a href="" onclick="removeTo(); return false" style="text-decoration: none">&lt;&lt; &lt;&lt;</a>
160           </div>
161           <div style="height: 4em">
162               En copie<br />
163               <a href="" onclick="addCc(); return false" style="text-decoration: none">&gt;&gt; &gt;&gt;</a><br />
164               <a href="" onclick="removeCc(); return false" style="text-decoration: none">&lt;&lt; &lt;&lt;</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} &lt;{$contact.forlife}@{#globals.mail.domain#}&gt;" />
180         {/foreach}
181       </td>
182     </tr>
183     {/if}
184   </table>
185
186   <fieldset>
187     <legend>Sujet&nbsp;:&nbsp;<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}
192 -- 
193 {$smarty.session.prenom} {$smarty.session.nom}
194 {/if}</textarea>
195     <div>
196       <strong>{icon name=email_attach}&nbsp;Ajouter une pièce jointe&nbsp;:&nbsp;</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>
203 </form>
204
205
206 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}