Code

Updated user password dialog proposal gray-out
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Jul 2010 14:03:54 +0000 (14:03 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Jul 2010 14:03:54 +0000 (14:03 +0000)
-Used prototype instead of page reload

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19169 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/personal/password/password.tpl

index 4658bd445aad9782e74fa5c509213a692a4fd1c7..7c04acfa25cef008d14add8ec163710f88ce5c57 100644 (file)
     </tr>
     <tr>
       <td>
-        <input type='radio' value='1' name='proposalSelected' onClick='document.mainform.submit();'
+        <input type='radio' value='1' id='proposalSelected' name='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' name='new_password' id='new_password' 
+              onkeyup="testPasswordCss(\$('new_password').value)"  onfocus="nextfield= 'repeated_password';"}
       </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' name='repeated_password' id='repeated_password' onfocus="nextfield= 'password_finish';"}
       </td>
     </tr>
     <tr>
 
 <!-- Place cursor -->
 <script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  nextfield= 'current_password';
+    nextfield= 'current_password';
        focus_field('current_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>