3a20e9df9dd4811f346b9a417164cc9b9fa2556a
[platal.git] / templates / admin / user.tpl
1 {**************************************************************************}
2 {*                                                                        *}
3 {*  Copyright (C) 2003-2010 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 t($smarty.post.delete_account)}
25 <form method="post" action="admin/user/{$user->login()}">
26   {xsrf_token_field}
27   <fieldset>
28     <legend>Confirmer la suppression de l'utilisateur {$user->hruid}</legend>
29
30     {if $user->hasProfile()}
31     <p>
32       <input type="checkbox" name="clear_profile" /> Vider la fiche de
33       l'utilisateur.
34     </p>
35     {else}
36     <p>
37       <input type="checkbox" name="erase_account" {if $user->state eq 'pending'}checked="checked"{/if} /> Supprimer le compte définitivement.
38     </p>
39     {/if}
40     <p>
41       <input type="hidden" name="uid" value="{$user->uid}" />
42       <input type="submit" name="account_deletion_cancel" value="Annuler" />
43       <input type="submit" name="account_deletion_confirmation" value="Confirmer" />
44     </p>
45   </fieldset>
46 </form>
47 {elseif t($smarty.post.erase_account)}
48 <p>
49   <a href="admin/accounts">Retourner à la gestion des comptes</a>
50 </p>
51 {else}
52 {literal}
53
54 <script type="text/javascript">
55 //<![CDATA[
56 function del_alias(alias) {
57   document.forms.alias.del_alias.value = alias;
58   document.forms.alias.submit();
59 }
60
61 function del_profile(pid) {
62   document.forms.profiles.del_profile.value = pid;
63   document.forms.profiles.submit();
64 }
65
66 function del_fwd(fwd) {
67   document.forms.fwds.del_fwd.value = fwd;
68   document.forms.fwds.submit();
69 }
70
71 function del_openid(id) {
72   document.forms.openid.del_openid.value = id;
73   document.forms.openid.submit();
74 }
75
76 function act_fwd(fwd, activate) {
77   if (activate)
78     document.forms.fwds.activate_fwd.value = fwd;
79   else
80     document.forms.fwds.deactivate_fwd.value = fwd;
81   document.forms.fwds.submit();
82 }
83 function clean_fwd(fwd) {
84   document.forms.fwds.clean_fwd.value = fwd;
85   document.forms.fwds.submit();
86 }
87 function ban_write()
88 {
89     document.forms.bans.write_perm.value = "!xorg.*";
90 }
91 function ban_read()
92 {
93     document.forms.bans.read_perm.value = "!xorg.*";
94 }
95
96 $(document).ready(function() {
97   $('#tabs > ul').tabs();
98   $('.ui-tabs-nav li').width('24%')
99     .click(function() { $(this).children('a').click() });
100 });
101
102 // ]]>
103 </script>
104 {/literal}
105
106 <div id="tabs">
107   <ul style="margin-top: 0">
108     <li><a href="{$platal->pl_self()}#account"><span >Compte de {$user->login()}</span></a></li>
109     <li><a href="{$platal->pl_self()}#emails"><span>Emails</span></a></li>
110     <li><a href="{$platal->pl_self()}#authext"><span>OpenID</span></a></li>
111     <li><a href="{$platal->pl_self()}#forums"><span>Forums</span></a></li>
112   </ul>
113 </div>
114
115 <div id="account">
116 <form id="auth" method="post" action="admin/user/{$user->login()}#account">
117   {xsrf_token_field}
118   <h1>Informations sur le compte</h1>
119   <p class="smaller">
120     Dernière connexion le <strong>{$lastlogin|date_format:"%d %B %Y, %T"}</strong>
121     depuis <strong>{$host}</strong>.
122   </p>
123
124   <table class="bicol">
125     <tr>
126       <th colspan="2">
127         <div style="float: right; text-align: right">
128           {if $user->state eq 'pending'}
129           Non-inscrit
130           {else}
131           Inscrit le {$user->registration_date|date_format}
132           {/if}
133         </div>
134         <div style="float: left; text-align: left">
135           {icon name=user_gray} {$user->hruid} (uid {$user->id()})
136         </div>
137         <input type="hidden" name="uid" value="{$user->id()}" />
138       </th>
139     </tr>
140     <tr>
141       <td class="titre">Nom complet<br />
142         <span class="smaller">Prénom NOM</span>
143       </br></td>
144       <td>{if $hasProfile}{$user->fullName()}{else}<input type="text" name="full_name" maxlength="255" value="{$user->fullName()}" />{/if}</td>
145     </tr>
146     <tr>
147       <td class="titre">Nom annuaire<br />
148         <span class="smaller">NOM Prénom</span>
149       </td>
150       <td>{if $hasProfile}{$user->directoryName()}{else}<input type="text" name="directory_name" maxlength="255" value="{$user->directoryName()}" />{/if}</td>
151     </tr>
152     <tr>
153       <td class="titre">Nom affiché</td>
154       <td>{if $hasProfile}{$user->displayName()}{else}<input type="text" name="display_name" maxlength="255" value="{$user->displayName()}" />{/if}</td>
155     </tr>
156     <tr>
157       <td class="titre">Sexe</td>
158       <td>
159         <label>femme <input type="radio" name="sex" value="female" {if $user->isFemale()}checked="checked"{/if} /></label>
160         <label><input type="radio" name="sex" value="male" {if !$user->isFemale()}checked="checked"{/if} /> homme</label>
161       </td>
162     </tr>
163     <tr>
164       <td class="titre">Email</td>
165       <td>{if $user->checkPerms('mail')}{$user->forlifeEmail()}{else}<input type="text" name="email" size="40" maxlength="255" value="{$user->forlifeEmail()}" />{/if}</td>
166     </tr>
167     <tr class="impair">
168       <td class="titre">Mot de passe</td>
169       <td>
170         <div style="float: left">
171           <input type="text" name="new_plain_password" size="10" maxlength="256" value="********" />
172           <input type="hidden" name="pwhash" value="" />
173         </div>
174         <div style="float: left; margin-top: 5px;">
175           {checkpasswd prompt="new_plain_password" submit="dummy_none"}
176         </div>
177       </td>
178     </tr>
179     <tr class="impair">
180       <td class="titre">Mot de passe SMTP</td>
181       <td>
182         <div style="float: left">
183           <input type="password" name="weak_password" size="10" maxlength="256" value="" />
184           {if $user->weak_access}
185           <input type="submit" name="disable_weak_access" value="Supprimer" />
186           {/if}
187         </div>
188       </td>
189     </tr>
190     <tr class="impair">
191       <td class="titre">Accès RSS</td>
192       <td>
193         <label>
194           <input type="checkbox" name="token_access" {if $user->token_access}checked="checked"{/if} value="1" />
195           activer l'accès
196         </label>
197       </td>
198     </tr>
199     <tr class="impair">
200       <td class="titre">Skin</td>
201       <td>
202         <select name="skin">
203           <option value="" {if !$user->skin}selected="selected"{/if}>Aucune (défaut du système)</option>
204           {iterate from=$skins item=skin}
205           <option value="{$skin.id}" {if $user->skin eq $skin.id}selected="selected"{/if}>{$skin.name}</option>
206           {/iterate}
207         </select>
208       </td>
209     </tr>
210     <tr class="pair">
211       <td class="titre">Etat du compte</td>
212       <td>
213         <select name="state">
214           <option value="pending" {if $user->state eq 'pending'}selected="selected"{/if}>pending (Non-inscrit)</option>
215           <option value="active" {if $user->state eq 'active'}selected="selected"{/if}>active (Inscrit, peut se logguer)</option>
216           <option value="disabled" {if $user->state eq 'disabled'}selected="selected"{/if}>disabled (Inscrit, accès interdit)</option>
217         </select><br />
218         <label>
219           <input type="checkbox" name="is_admin" value="1" {if $user->is_admin}checked="checked"{/if} />
220           administrateur du site
221         </label>
222       </td>
223     </tr>
224     <tr class="pair">
225       <td class="titre">Type de compte</td>
226       <td>
227         <select name="type">
228           {iterate from=$account_types item=type}
229           <option value="{$type.type}" {if $user->type eq $type.type}selected="selected"{/if}>{$type.type} ({$type.perms})</option>
230           {/iterate}
231         </select>
232         <a href="admin/account/types">{icon name=wrench title=Gérer} gérer</a>
233       </td>
234     </tr>
235     <tr class="pair">
236       <td class="titre">
237         Surveillance
238       </td>
239       <td>
240         <label><input type="checkbox" name="watch" {if $user->watch}checked="checked"{/if} value="1" />
241         Surveiller l'activité de ce compte</label><br />
242         <span class="smaller">Cette option permet d'avoir des logs complets de l'activité
243         du compte via le logger, et d'être alerté lors des connexions de l'utilisateur.</span>
244       </td>
245     </tr>
246     <tr class="pair">
247       <td class="titre">
248         Commentaire
249       </td>
250       <td>
251         <input type="text" name="comment" size="40" maxlength="64" value="{$user->comment}" />
252       </td>
253     </tr>
254     <tr class="impair">
255       <td colspan="2" class="center">
256         <input type="submit" name="update_account" value="Mettre à jour" onclick="return hashResponse('new_plain_password', false, false);" />
257         <input type="submit" name="su_account" value="Prendre l'identité" />
258         <input type="submit" name="log_account" value="Consulter les logs" />
259         {if $user->state neq 'pending'}
260         <input type="submit" name="delete_account" value="Désinscrire" />
261         {elseif !$user->hasProfile()}
262         <input type="submit" name="delete_account" value="Supprimer le compte" />
263         {/if}
264       </td>
265     </tr>
266   </table>
267 </form>
268
269 <h1>Fiches associées au compte</h1>
270
271 <form id="profiles" method="post" action="admin/user/{$user->login()}#account">
272   {xsrf_token_field}
273   <table class="bicol">
274     <tr>
275       <th></th>
276       <th>Identifiant de la fiche</th>
277       <th></th>
278     </tr>
279     {iterate from=$profiles item=profile}
280     <tr>
281       <td><input type="radio" name="owner" value="{$profile.pid}" {if $profile.owner}checked="checked"{/if}
282                  onclick="this.form.submit()" /></td>
283       <td>{$profile.hrpid} (pid {$profile.pid})</td>
284       <td class="right">
285         <a href="profile/edit/{$profile.hrpid}">{icon name=user_edit}</a>
286         <a href="profile/{$profile.hrpid}" class="popup2">{icon name=user_suit}</a>
287         <a href="javascript:del_profile({$profile.pid})">{icon name=cross}</a>
288       </td>
289     </tr>
290     {/iterate}
291     {if $profiles->total() > 0}
292     <tr>
293       <td>
294         <input type="radio" name="owner" value="0" onclick="this.form.submit()" />
295       </td>
296       <td>None</td>
297       <td></td>
298     </tr>
299     {/if}
300     <tr class="pair">
301       <td colspan="3">
302         <input type="hidden" name="del_profile" value="" />
303         <input type="text" maxlength="64" name="new_profile" />
304         <input type="submit" name="add_profile" value="Ajouter" />
305       </td>
306     </tr>
307   </table>
308 </form>
309
310 <h1>Groupes dont l'utilisateur est membre</h1>
311
312 <table class="bicol">
313   <tr>
314     <th>Nom du groupe</th>
315     <th>Permissions</th>
316   </tr>
317   {foreach from=$user->groups() item=group}
318   <tr class="impair">
319     <td>{$group.nom}</td>
320     <td style="text-align: right">
321       {$group.perms}
322       <a href="http://www.polytechnique.net/{$group.diminutif}/member/{$user->hruid}">
323       {icon name="user_edit" title="Modifier l'inscription"}
324       </a>
325     </td>
326   </tr>
327   {/foreach}
328 </table>
329
330 </div>
331
332 <div id="emails">
333 <h1>Gestion de l'adresse X.org</h1>
334
335 <form id="alias" method="post" action="admin/user/{$user->login()}#emails">
336   {xsrf_token_field}
337   <table class="bicol" cellpadding="2" cellspacing="0">
338     <tr>
339       <th class="alias" colspan="3">
340         Alias email de l'utilisateur
341       </th>
342     </tr>
343     {iterate from=$aliases item=a}
344     <tr class="{cycle values="impair,pair"}">
345       <td>
346         <input type="radio" name='best' {if $a.best}checked="checked"{/if} value='{$a.alias}' onclick="this.form.submit()" />
347       </td>
348       <td>
349         {if $a.for_life}<strong>{$a.alias}</strong>{else}{$a.alias}{/if}
350         {if $a.expire}<span class='erreur'>(expire le {$a.expire|date_format})</span>{/if}
351       </td>
352       {if $a.for_life}
353       <td>garanti à vie*</td>
354       {else}
355       <td class="action">
356         <a href="javascript:del_alias('{$a.alias}')">{icon name=cross}</a>
357       </td>
358       {/if}
359     </tr>
360     {/iterate}
361     <tr class="{cycle values="impair,pair"}">
362       <td colspan="2" class="detail">
363         <input type="text" name="email" size="29" maxlength="60" value="" />
364       </td>
365       <td class="action">
366         <input type="hidden" name="uid" value="{$user->id()}" />
367         <input type="hidden" name="del_alias" value="" />
368         <input type="submit" name="add_alias" value="Ajouter" />
369       </td>
370     </tr>
371     <tr class="{cycle values="impair,pair"}">
372       <td colspan="3" class="desc">
373         <strong>* à ne modifier qu'avec l'accord express de l'utilisateur !!!</strong>
374       </td>
375     </tr>
376   </table>
377 </form>
378
379 <br />
380
381 <form id="fwds" method="post" action="admin/user/{$user->login()}#emails">
382   {xsrf_token_field}
383   <table class="bicol" cellpadding="2" cellspacing="0">
384     <tr>
385       <th colspan="4">
386         Redirections
387       </th>
388     </tr>
389     {assign var=actives value=false}
390     {assign var=disabled value=false}
391     {foreach item=mail from=$emails}
392     {cycle assign=class values="impair,pair"}
393     <tr class="{$class}">
394       {if $mail->active && $mail->has_disable()}
395         {assign var=actives value=true}
396       {elseif $mail->disabled && $mail->has_disable()}
397         {assign var=disabled value=true}
398       {/if}
399       <td class="titre">
400         {if $mail->active}active{elseif $mail->disabled}suspendue{/if}
401       </td>
402       <td>
403         <span class="smaller">
404           {if !$mail->disabled}
405           <a href="javascript:act_fwd('{$mail->email}',{if $mail->active}false{else}true{/if})">
406             {if $mail->active}des{elseif $mail->broken}ré{/if}activer
407           </a>
408           {/if}
409         </span>
410       </td>
411       <td>
412         {if $mail->broken}<span style="color: #f00">{/if}
413         {if $mail->email == 'googleapps'}<a href="admin/googleapps/user/{$user->login()}">{/if}
414         {$mail->display_email}
415         {if $mail->email == 'googleapps'}</a>{/if}
416         {if $mail->broken}<em> (en panne)</em></span>{/if}
417       </td>
418       <td class="action">
419         {if $mail->is_removable()}
420         <a href="javascript:del_fwd('{$mail->email}')">{icon name=cross}</a>
421         {/if}
422       </td>
423     </tr>
424     {if $mail->panne && $mail->panne neq "0000-00-00"}
425     <tr class="{$class}">
426       <td colspan="3" class="smaller" style="color: #f00">
427         {icon name=error title="Panne"}
428         Panne de {$mail->display_email} le {$mail->panne|date_format}
429         {if $mail->panne neq $mail->last}confirmée le {$mail->last|date_format}{/if}
430       </td>
431       <td class="action">
432         <a href="javascript:clean_fwd('{$mail->email}')">effacer les pannes</a>
433       </td>
434     </tr>
435     {/if}
436     {/foreach}
437     {cycle assign=class values="impair,pair"}
438     <tr class="{$class}">
439       <td class="titre" colspan="2">
440         Ajouter une adresse
441       </td>
442       <td>
443         <input type="text" name="email" size="29" maxlength="60" value="" />
444       </td>
445       <td class="action">
446         <input type="hidden" name="uid" value="{$user->id()}" />
447         <input type="hidden" name="del_fwd" value="" />
448         <input type="hidden" name="clean_fwd" value="" />
449         <input type="hidden" name="activate_fwd" value="" />
450         <input type="hidden" name="deactivate_fwd" value="" />
451         <input type="submit" name="add_fwd" value="Ajouter" />
452       </td>
453     </tr>
454     <tr class="{$class}">
455       <td colspan="4" class="center">
456         {if $actives}
457         <input type="submit" name="disable_fwd" value="Désactiver la redirection des emails" />
458         {/if}
459         {if $disabled}
460         <input type="submit" name="enable_fwd" value="Réactiver la redirection des emails" />
461         {/if}
462       </td>
463     </tr>
464   </table>
465 </form>
466
467 {javascript name="ajax"}
468 {test_email hruid=$user->login()}
469
470 <h1>Autres adresses de l'utilisateur</h1>
471
472 <table class="bicol">
473   <tr>
474     <th colspan="3">Mailing lists auquelles l'utilisateur appartient</th>
475   </tr>
476   {foreach from=$mlists item=mlist}
477   <tr>
478     <td>
479       <a href="http://listes.polytechnique.org/members/{$mlist.addr|replace:"@":"_"}">
480       {$mlist.addr}
481       </a>
482     </td>
483     <td>
484       <input type="checkbox" disabled="disabled" {if $mlist.sub}checked="checked"{/if} /> Membre
485     </td>
486     <td>
487       <input type="checkbox" disabled="disabled" {if $mlist.own}checked="checked"{/if} /> Modérateur
488     </td>
489   </tr>
490   {/foreach}
491 </table>
492
493 <br />
494 <table class="bicol">
495   <tr>
496     <th>Virtual aliases auquel l'utilisateur appartient</th>
497   </tr>
498   {foreach from=$virtuals item=virtual}
499   <tr class="{cycle values="impair,pair"}">
500     <td>{$virtual}</td>
501   </tr>
502   {/foreach}
503 </table>
504 </div>
505
506 <div id="authext">
507 <h1>Gestion des autorisations d'authentification externe</h1>
508
509 <form id="openid" method="post" action="admin/user/{$user->login()}#authext">
510   {xsrf_token_field}
511   <table class="bicol">
512     <tr>
513       <th colspan="2">Sites de confiance</th>
514     </tr>
515     {iterate from=$openid item=site}
516     <tr class="{cycle values="pair,impair"}">
517       <td><a href="{$site.url}">{$site.url}</a></td>
518       <td><a href="javascript:del_openid({$site.id})">{icon name=cross}</a></td>
519     </tr>
520     {/iterate}
521   </table>
522   <div><input type="hidden" name="del_openid"/></div>
523 </form>
524 </div>
525
526 <div id="forums">
527 <h1>Gestion de l'accès au forums</h1>
528
529 <form id="bans" method="post" action="admin/user/{$user->login()}#forums">
530   {xsrf_token_field}
531   <table class="bicol">
532     <tr>
533       <th colspan="4">
534         Permissions sur les forums
535       </th>
536     </tr>
537     <tr class="impair">
538       <td class="titre">
539         Poster
540       </td>
541       <td>
542         <input type="text" name="write_perm" size="32" maxlength="255" value="{$bans.write_perm}" />
543       </td>
544       <td class="action">
545         <a href="javascript:ban_write()">Bannir</a>
546       </td>
547     </tr>
548     <tr class="pair">
549       <td class="titre">
550         Lire
551       </td>
552       <td>
553         <input type="text" name="read_perm" size="32" maxlength="255" value="{$bans.read_perm}" />
554       </td>
555       <td class="action">
556         <a href="javascript:ban_read()">Bannir</a>
557       </td>
558     </tr>
559     <tr class="impair">
560       <td class="titre">
561         Commentaire
562       </td>
563       <td colspan="2">
564         <input type="text" name="comment" size="40" maxlength="255" value="{$bans.comment}" />
565       </td>
566     </tr>
567     <tr class="center">
568       <td colspan="3">
569         <input type="hidden" name="uid" value="{$user->id()}" />
570         <input type="submit" name="b_edit" value="Modifier" />
571       </td>
572     </tr>
573   </table>
574 </form>
575 </div>
576 {/if}
577
578 {* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}