Code

Updated proposal handling
[gosa.git] / gosa-core / plugins / admin / users / password.tpl
index 9f5cf7df76c43dff884895108e4351112d59c5ea..ecceb548576e08946567e8b242de7e627513803c 100644 (file)
   </table>
 
 {else}
-  <input type='hidden' name='passwordQueue' value='1'>
+
   <table summary="{t}Password input dialog{/t}" cellpadding=4 border=0>
     <tr>
       <td>
-        <input type='radio' value='1' name='proposalSelected' onChange='document.mainform.submit();'
+        <input type='radio' value='1' name='proposalSelected' id='proposalSelected' onClick='updateFields();'
             {if $proposalSelected} checked {/if}>&nbsp;<b>{t}Use proposal{/t}</b>
       </td>
       <td>
-        <div style='
-                {if !$proposalSelected}
-                  background-color:#F0F0F0;
-                  color:#666;
-                {/if}
+        <div id='proposalText' style='
                   width:180px;
                   border:1px solid #CCC;
                   padding:3px;
     </tr>
     <tr>
       <td>
-        <input type='radio' value='0' name='proposalSelected' onChange='document.mainform.submit();'
+        <input type='radio' value='0' name='proposalSelected' onClick='updateFields();'
             {if !$proposalSelected} checked {/if}>&nbsp;<b>{t}Manually specify a password{/t}</b>
       </td>
     </tr>
     <tr>
       <td style='padding-left:40px;'><b><LABEL for="new_password">{t}New password{/t}</LABEL></b></td>
       <td>
-          {if $proposalSelected}
-              {factory type='password' name='new_password' id='new_password' disabled
-                  onkeyup="testPasswordCss(\$('new_password').value)"  onfocus="nextfield= 'repeated_password';"}
-          {else}
-              {factory type='password' name='new_password' id='new_password'
-                  onkeyup="testPasswordCss(\$('new_password').value)"  onfocus="nextfield= 'repeated_password';"}
-          {/if}
+          {factory type='password' id='new_password' name='new_password' 
+              onfocus="nextfield='repeated_password';" onkeyup="testPasswordCss(\$('new_password').value);"}
       </td>
     </tr>
     <tr>
       <td style='padding-left:40px;'><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
       <td>
-          {if $proposalSelected}
-            {factory type='password' name='repeated_password' id='repeated_password' disabled
-                onfocus="nextfield= 'password_finish';"}
-          {else}
-            {factory type='password' name='repeated_password' id='repeated_password'
-                onfocus="nextfield= 'password_finish';"}
-          {/if}
+          {factory type='password' id='repeated_password' name='repeated_password'
+              onfocus="nextfield='password_finish';"}
       </td>
     </tr>
     <tr>
 
 <!-- Place cursor -->
 <script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
        nextfield= "new_password";
        focus_field('new_password');
-  -->
+
+    function updateFields()
+    {
+        if($('proposalSelected').checked){
+            $('new_password').disable();
+            $('repeated_password').disable();
+            $('proposalText').setStyle(
+                 'background-color:#FFF;' +
+                 'color:#000;' +
+                 'width:180px;' +
+                 'border:1px solid #CCC;' +
+                 'padding:3px;' +
+                 'padding-top:5px;' +
+                 'padding-bottom:4px;');
+        }else{
+            $('new_password').enable();
+            $('repeated_password').enable();
+            $('proposalText').setStyle(
+                 'background-color:#F0F0F0;' +
+                 'color:#666;' +
+                 'width:180px;' +
+                 'border:1px solid #CCC;' +
+                 'padding:3px;' +
+                 'padding-top:5px;' +
+                 'padding-bottom:4px;');
+        }
+    }
+    updateFields();
 </script>
+
+