Use 'Animateur' instead of 'Administrateur' to describe the group-level administratio...
[platal.git] / templates / emails / redirect.tpl
index db74029..83cf386 100644 (file)
       var remove = $(".active_email:checked");
       if (remove.length <= 1) {
         remove.attr("disabled", "disabled");
+        remove.parent('td').parent('tr').children('td').children('.remove_email').hide();
       } else {
         remove.removeAttr("disabled");
+        $('.remove_email').show();
       }
     }
 
           $.get(link.href, {},function() {
             $('tr[@id=line_' + email.replace('@', '_at_') + ']').remove();
             showRemove();
+            activeEnable();
           });
         }
         return false;
         }
     }
 
+    function updateRedirect(checked, email)
+    {
+        activeEnable();
+        Ajax.update_html(null, 'emails/redirect/' + (checked ? '' : 'in') + 'active/' + email, redirectUpdate);
+    }
+
     {/literal}
   //]]></script>
   {javascript name="jquery"}
   <div class="center">
     <table class="bicol" summary="Adresses de redirection">
       <tr>
-        <th>Email</th>
+        <th>Redirection</th>
         <th>Actif</th>
         <th>Réécriture</th>
         <th>&nbsp;</th>
           <input type="checkbox" value="{$e->email}" {if $e->sufficient}class="active_email"{/if}
                  {if $e->active}checked="checked"{/if}
                  {if $smarty.foreach.redirect.total eq 1}disabled="disabled"{/if}
-                 onchange="Ajax.update_html(null,'{$globals->baseurl}/emails/redirect/'+(this.checked?'':'in')+'active/{$e->email}', redirectUpdate)" /></td>
+                 onchange="updateRedirect(this.checked, '{$e->email}')" /></td>
         <td>
           {if $e->has_rewrite()}
           <select onchange="Ajax.update_html(null,'emails/redirect/rewrite/{$e->email}/'+this.value, redirectUpdate)">
              onclick="return removeRedirect(this, &quot;{$e->email}&quot;);" >
             {icon name=cross title="Supprimer"}
           </a>
+          {else}
+          {if $e->sufficient}<span class="remove_email"></span>{/if}
+          <a href="emails/redirect#{$e->email}">{icon name=information title="Plus d'informations"}</a>
           {/if}
         </td>
       </tr>
       {/foreach}
-      {if $googleapps eq 'active'}
-      <tr class="{cycle values="pair,impair"}">
-        <td><strong>Compte GMail / Google Apps</strong></td>
-        <td>
-          <input type="checkbox" value="googleapps" disabled="disabled"
-                 {if in_array('googleapps', $storage)}checked="checked"{/if} />
-        </td>
-        <td>-</td>
-        <td>
-          <a href="emails/redirect#googleapps">{icon name=information title="Plus d'informations"}</a>
-        </td>
-      </tr>
-      {/if}
-      <script type="text/javascript">activeEnable(); showRemove();</script>
       <tr class="{cycle values="pair,impair"}"><td colspan="4">
         <form action="emails/redirect" method="post">
         <div>
           Ajouter une adresse email&nbsp;:
           <input type="text" size="35" maxlength="60" name="email" value="" />
           &nbsp;&nbsp;<input type="submit" value="ajouter" name="emailop" />
+          {xsrf_token_field}
         </div>
         </form>
       </td></tr>
     </table>
+    <script type="text/javascript">showRemove(); activeEnable();</script>
   </div>
 {if $panne}
 <p class="smaller">
 </fieldset>
 {/if}
 
-{* TODO(vincent.zanotti): remove the following block of code when both IMAP and GApps will be active. *}
-{if in_array('imap', $storage) neq 0 or #globals.mailstorage.imap_active# or hasPerm('admin')}
-  {assign var=has_imap value=true}
-{else}
-  {assign var=has_imap value=false}
-{/if}
-{if $googleapps or #globals.mailstorage.googleapps_active# or hasPerm('admin')}
-  {assign var=has_googleapps value=true}
-{else}
-  {assign var=has_googleapps value=false}
-{/if}
-
-{if $has_imap or $has_googleapps}
+{if #globals.mailstorage.googleapps_active# or #globals.mailstorage.imap_active# or hasPerm('admin') or $googleapps}
 <h1>Tes comptes de stockage de courrier</h1>
 {/if}
-{if $has_imap}
+{if #globals.mailstorage.imap_active# or hasPerm('admin')}
 <p>
   Polytechnique.org te propose de conserver les mails que tu reçois, pendant une durée limitée (environ 30 jours).
   Grâce à ce service, tu disposes d'une sauvegarde de tes mails en secours, au cas où, par exemple, tu effacerais
 </p>
 
 <table class="bicol" summary="Compte de stockage">
-  <col width="75%" />
-  <col width="25%" />
+  <col width="55%" />
+  <col width="45%" />
   <tr>
     <th colspan="2">Compte de stockage</th>
   </tr>
       </a><br />Hébergé par Polytechnique.org
     </td>
     <td style="text-align: center; vertical-align: middle">
-      <form action="emails/redirect/storage/imap/{if in_array('imap', $storage)}inactive{else}active{/if}" method="post">
-        {if in_array('imap', $storage)}
-        <input type="submit" value="Désactiver" />
-        {else}
-        <input type="submit" value="Activer" />
-        {/if}
-      </form>
+      <a href="emails/redirect#line_imap">Voir l'état de la redirection vers l'IMAP</a>
     </td>
   </tr>
 </table>
 {/if}
 
-{if $has_googleapps}
+{if #globals.mailstorage.googleapps_active# or hasPerm('admin') or $googleapps}
 <br />
 <p>
   Grâce à un partenariat avec Google, Polytechnique.org te propose également un compte
 </p>
 
 <table class="bicol" summary="Compte de stockage" id="googleapps">
-  <col width="75%" />
-  <col width="25%" />
+  <col width="55%" />
+  <col width="45%" />
   <tr>
     <th colspan="2">Compte de stockage</th>
   </tr>
     {if $googleapps eq 'active'}
     <td>
       <a href="googleapps">
-        <strong>Redirection des emails vers GMail / Google Apps</strong>
+        <strong>Compte Google Apps / Polytechnique.org</strong>
       </a><br />Hébergé par Google
     </td>
     <td style="text-align: center; vertical-align: middle">
-      <form action="emails/redirect/storage/googleapps/{if in_array('googleapps', $storage)}inactive{else}active{/if}" method="post">
-        {if in_array('googleapps', $storage)}
-        <input type="submit" value="Désactiver" />
-        {else}
-        <input type="submit" value="Activer" />
-        {/if}
-      </form>
+      Ton compte Google Apps est actif.<br />
+      <a href="emails/redirect#line_googleapps">Voir l'état de la redirection vers GMail</a>
     </td>
     {else}
     <td colspan="2">
       {if $googleapps eq 'disabled'}
       Ton compte Google Apps est actuellement inactif.<br />
       {else}
-      Tu n'as pas encore de compte Google Apps sur Polytechnique.org.<br />
+      Tu n'as pas encore de compte Google Apps pour Polytechnique.org.<br />
       {/if}
       <a href="googleapps">Plus d'informations &hellip;</a>
     </td>