Adds XSRF protection to the Lists module.
[platal.git] / templates / lists / admin.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2008 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
24 {if !$details.own}
25 <p class='erreur'>
26 Tu n'es pas administrateur de la liste, mais du site.
27 </p>
28 {/if}
29
30 {include file="lists/header_listes.tpl" on=admin}
31
32 <p>
33 Pour inscrire un utilisateur, il faut remplir les champs prévus à cet effet en saisissant un de
34 ses identifiants, de la forme "prenom.nom", ou "prenom.nom.promo" en cas d'homonymie. Pour inscrire plusieurs utilisateurs, les séparer par des espaces.
35 L'icône {icon name=cross title='retirer membre'} permet de désinscrire de la liste quelqu'un
36 qui y était abonné.
37 </p>
38
39 {if $unregistered|@count neq 0}
40 <h1>Marketing d'utilisateurs non-inscrits</h1>
41
42 <p>
43 {if $unregistered|@count eq 1}
44 L'utilisateur suivant n'est pas inscrit à Polytechnique.org. Tu peux l'y inciter en lui faisant envoyer un mail de marketing. Une fois inscrit à Polytechnique.org, l'inscription à la liste lui sera automatiquement proposée.
45 {else}
46 Les utilisateurs suivants ne sont pas inscrits à Polytechnique.org. Tu peux les y inciter en leur faisant envoyer des
47 mails de marketing. Une fois inscrits à Polytechnique.org, l'inscription à la liste leur sera automatique proposée.
48 {/if}
49 <p>
50
51 <script type="text/javascript">
52   {literal}
53   function showEmail(val, login)
54   {
55       var span = document.getElementById("mk_s_mail[" + login + "]");
56       var state = (val == 'marketu' || val == 'markets') ? '' : 'none';
57       span.style.display = state;
58   }
59   {/literal}
60 </script>
61
62 <form method="post" action='{$smarty.server.REQUEST_URI}'>
63   {xsrf_token_field}
64   <table class="bicol">
65   {foreach from=$unregistered key=login item=it}
66     <tr class="{cycle values="pair,impair"}">
67       <td>{$login}</td>
68       <td>
69         Camarade&nbsp;:
70         <select name="mk_uid[{$login}]">
71         {iterate from=$it item=user}
72           <option value="{$user.user_id}">{$user.prenom} {$user.nom} (X{$user.promo})</option>
73         {/iterate}
74         </select><br />
75         Action*&nbsp;:
76         <select name="mk_action[{$login}]" onchange="showEmail(this.value, '{$login}');">
77           <option value="none">Aucune</option>
78           <option value="marketu">Envoyer un mail en ton nom</option>
79           <option value="markets">Envoyer un mail au nom de Polytechnique.org</option>
80           <option value="sub">Lui proposer l'inscription</option>
81         </select><br />
82         <span id="mk_s_mail[{$login}]" style="display: none">
83           Email&nbsp;: <input type="text" name="mk_email[{$login}]" value="" />
84         </span>
85       </td>
86     </tr>
87   {/foreach}
88   </table>
89   <p class="center">
90     <input type="submit" name="send_mark" value="Envoyer les marketings !" />
91   </p>
92 </form>
93
94 <p class="smaller">
95   *La dernière action ajoute simplement la liste de diffusion aux abonnements qui seront proposés au camarade
96   lors de son inscription à Polytechnique.org sans pour autant lui enovyer de mail de marketing. Cette action est
97   automatique si tu choisis l'envoi de mail.
98 </p>
99
100 {/if}
101
102 <h1>
103   modérateurs de la liste
104 </h1>
105
106 <form method='post' action='{$smarty.server.REQUEST_URI}'>
107   {xsrf_token_field}
108   <table class='tinybicol' cellpadding='0' cellspacing='0'>
109     {foreach from=$owners item=xs key=promo}
110     <tr>
111       <td class='titre'>{if $promo}{$promo}{else}non-X{/if}</td>
112       <td>
113         {foreach from=$xs item=x}
114         {if $promo && strpos($x.l, '@') === false}
115         <a href="profile/{$x.l}" class="popup2">{$x.n}</a>
116         {elseif $x.x}
117         <a href="{$platal->ns}member/{$x.x}">{if $x.n|trim}{$x.n}{else}{$x.l}{/if}</a>
118         {elseif $x.n}
119         {$x.n}
120         {else}
121         {$x.l}
122         {/if}
123         <a href='{$platal->pl_self(1)}?del_owner={$x.l}'>{icon name=cross title='retirer modérateur'}</a>
124         <br />
125         {/foreach}
126       </td>
127     </tr>
128     {/foreach}
129     <tr class="pair">
130       <td class='titre'>Ajouter</td>
131       <td>
132         <input type='text' size='30' name='add_owner' />
133         <input type='submit' value='ajouter' />
134       </td>
135     </tr>
136   </table>
137 </form>
138
139
140 <h1>
141   {$np_m|default:"0"} membre{if $np_m > 1}s{/if} dans la liste
142 </h1>
143
144 <form method='post' action='{$smarty.server.REQUEST_URI}' enctype="multipart/form-data">
145   {xsrf_token_field}
146   <table class='bicol' cellpadding='0' cellspacing='0'>
147     {foreach from=$members item=xs key=promo}
148     <tr>
149       <td class='titre'>{if $promo}{$promo}{else}non-X{/if}</td>
150       <td>
151         {foreach from=$xs item=x}
152         {if $promo && strpos($x.l, '@') === false}
153         <a href="profile/{$x.l}" class="popup2">{$x.n}</a>
154         {elseif $x.x}
155         <a href="{$platal->ns}member/{$x.x}">{if $x.n|trim}{$x.n}{else}{$x.l}{/if}</a>
156         {elseif $x.n}
157         {$x.n}
158         {else}
159         {$x.l}
160         {/if}
161         <a href='{$platal->pl_self(1)}?del_member={$x.l}&amp;token={xsrf_token}'>{icon name=cross title='retirer membre'}</a>
162         <br />
163         {/foreach}
164       </td>
165     </tr>
166     {/foreach}
167     <tr>
168       <th colspan="2">Ajouter</th>
169     </tr>
170     <tr class="pair">
171       <td class="titre">Liste</td>
172       <td>
173         <input type='text' size='40' name='add_member' />
174       </td>
175     </tr>
176     <tr class="pair">
177       <td class="titre">ou fichier(*)</td>
178       <td>
179         <input type="file" name="add_member_file" />*
180       </td>
181     </tr>
182     <tr class="pair">
183       <td colspan="2" class="center">
184         <input type='submit' value='ajouter' />
185       </td>
186     </tr>
187   </table>
188 </form>
189
190 <div class="smaller">
191  * Le fichier doit contenir une adresse e-mail par ligne. Les X doivent être identifiés par une adresse
192  @polytechnique.org, @m4x.org ou @melix.net/org.
193 </div>
194
195
196 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}