Code

Updated password proposal dialog
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Jul 2010 14:32:00 +0000 (14:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Jul 2010 14:32:00 +0000 (14:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6@19172 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index c8540ae224724397670994717c230bedcf5c5c3c..e21a07d8ef10d810401365940ffc6fff15c67959 100644 (file)
@@ -60,6 +60,7 @@ class password extends plugin
   {
     plugin::execute();
     $smarty = get_smarty();
+    $smarty->assign("usePrototype", "true");
     $ui = get_userinfo();
 
     /* Get acls */
@@ -80,15 +81,11 @@ class password extends plugin
 
     // Refresh proposal if requested
     if(isset($_POST['refreshProposal'])) $this->refreshProposal();
+    if(isset($_POST['proposalSelected'])) $this->proposalSelected = get_post('proposalSelected') == 1;
     $smarty->assign("proposal" , $this->proposal);
     $smarty->assign("proposalEnabled" , $this->proposalEnabled);
     $smarty->assign("proposalSelected" , $this->proposalSelected);
 
-    
-
-    if(isset($_POST['proposalSelected'])) $this->proposalSelected = get_post('proposalSelected') == 1;
-
-
     /* Pwd change requested */
     if (isset($_POST['password_finish'])){
 
index d3e1095ad958a90e1a6590503d05e3ddcb4ed69d..325d9f9fec60e97b072c7984e0b6efcfffa4fe81 100644 (file)
     </tr>
     <tr>
       <td>
-        <input type='radio' value='1' name='proposalSelected'
+        <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='
+        <div id='proposalText' style='
                   width:180px;
                   border:1px solid #BBB;
                   padding-top:3px;
@@ -70,7 +70,7 @@
     </tr>
     <tr>
       <td>
-        <input type='radio' value='0' name='proposalSelected'
+        <input type='radio' value='0' name='proposalSelected' onClick='updateFields();'
             {if !$proposalSelected} checked {/if}>&nbsp;<b>{t}Manually specify a password{/t}</b>
       </td>
     </tr>
 
 <input type="hidden" name="ignore">
 
-<!-- Place cursor -->
 <script language="JavaScript" type="text/javascript">
-  <!-- // First input field on page
-  nextfield= 'current_password';
-       focus_field('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;' );
+        }else{
+            $('new_password').enable();
+            $('repeated_password').enable();
+            $('proposalText').setStyle(
+                 'background-color:#DDD;' +
+                 'color:#888;' +
+                 'width:180px;' +
+                 'border:1px solid #CCC;' +
+                 'padding:3px;');
+        }
+    }
+    updateFields();
 </script>
 
+