Do allow to have all redirection disable on the web interface
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 10 Oct 2007 20:16:27 +0000 (22:16 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Wed, 10 Oct 2007 20:17:36 +0000 (22:17 +0200)
templates/emails/redirect.tpl

index 11367a5..e642d44 100644 (file)
   {javascript name=ajax}
   <script type="text/javascript">//<![CDATA[
     {literal}
+    function activeEnable()
+    {
+      var remove = $(".active_email:checked");
+      if (remove.length <= 1) {
+        remove.attr("disabled", "disabled");
+      } else {
+        remove.removeAttr("disabled");
+      }
+    }
+
     function redirectUpdate()
     {
         showTempMessage('redirect-msg', "Tes redirections ont été mises à jour.", true);
+        activeEnable();
     }
 
     function removeRedirect(link, email)
             removeLinks.show();
         }
     }
+
     {/literal}
   //]]></script>
   {javascript name="jquery"}
           </strong>
         </td>
         <td>
-          <input type="checkbox" value="{$e->email}"
+          <input type="checkbox" value="{$e->email}" class="active_email"
                  {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>
         </td>
       </tr>
       {/foreach}
-      <script type="text/javascript">showRemove();</script>
+      <script type="text/javascript">activeEnable(); showRemove();</script>
       <tr class="{cycle values="pair,impair"}"><td colspan="4">
         <form action="emails/redirect" method="post">
         <div>