display change when ajax succeed
authorx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 2 Apr 2007 17:45:14 +0000 (17:45 +0000)
committerx2001corpet <x2001corpet@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 2 Apr 2007 17:45:14 +0000 (17:45 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/branches/platal-0.9.13@1657 839d8a87-29fc-0310-9880-83ba4fa771e5

modules/email.php
templates/emails/redirect.tpl

index 0641bf2..965481e 100644 (file)
@@ -205,15 +205,24 @@ class EmailModule extends PLModule
                
                if ($action == 'active' && $email) {
                        $redirect->modify_one_email($email, true);
+                       header('Content-Type: text/plain; charset=ISO-8859-15');
+                       echo 'L\'adresse '.$email.' a bien été activée.';
+                       exit();
                }
                
                if ($action == 'inactive' && $email) {
                        $redirect->modify_one_email($email, false);
+                       header('Content-Type: text/plain; charset=ISO-8859-15');
+                       echo 'L\'adresse '.$email.' a bien été desactivée.';
+                       exit();
                }
                
                if ($action == 'rewrite' && $email) {
                        $rewrite = @func_get_arg(3);
                        $redirect->modify_one_email_redirect($email, $rewrite);
+                       header('Content-Type: text/plain; charset=ISO-8859-15');
+                       echo 'L\'adresse '.$email.' est maintenant réécrite en '.$rewrite.'.';
+                       exit();
                }
                
         if (Env::has('emailop')) {
index da80ee6..63d06dd 100644 (file)
@@ -92,9 +92,9 @@
           </strong>
         </td>
         <td>
-          <input type="checkbox" value="{$e->email}" {if $e->active}checked="checked"{/if} onclick="Ajax.update_html(null,'{$globals->baseurl}/emails/redirect/'+(this.checked?'':'in')+'active/{$e->email}')"/></td>
+          <input type="checkbox" value="{$e->email}" {if $e->active}checked="checked"{/if} onclick="Ajax.update_html('changeResult','{$globals->baseurl}/emails/redirect/'+(this.checked?'':'in')+'active/{$e->email}')"/></td>
         <td>
-          <select onchange="Ajax.update_html(null,'{$globals->baseurl}/emails/redirect/rewrite/{$e->email}/'+this.value)">
+          <select onchange="Ajax.update_html('changeResult','{$globals->baseurl}/emails/redirect/rewrite/{$e->email}/'+this.value)">
             <option value=''>--- aucune ---</option>
             {foreach from=$alias item=a}
             <option {if $e->rewrite eq "`$a.alias`@polytechnique.org"}selected='selected'{/if}
       <tr class="{cycle values="pair,impair"}"><td colspan="4">
         <form action="emails/redirect" method="post">
         <div>
+            <div id="changeResult" class="error" style="position:absolute;color:green"></div>
                &nbsp;<br />
                Ajouter une adresse email :
             <input type="text" size="35" maxlength="60" name="email" value="" />