Code

Updated password proposal handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Jul 2010 13:12:53 +0000 (13:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 27 Jul 2010 13:12:53 +0000 (13:12 +0000)
-Gray out inactive options

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

gosa-core/plugins/admin/users/class_userManagement.inc
gosa-core/plugins/admin/users/password.tpl
gosa-core/plugins/personal/password/class_password.inc
gosa-core/plugins/personal/password/password.tpl

index c3a6a6e10bce793b4de623f67d35d5d8a9c7483b..45a9a4a88ff05f8a1b5aaedfe29be8f398b807b6 100644 (file)
@@ -125,6 +125,7 @@ class userManagement extends management
         }elseif((count($this->pwd_change_queue) || isset($_POST['password_finish']) || isset($_POST['refreshProposal']))){
             $action['action'] = "passwordQueue";
         }
+        if(isset($_POST['passwordQueue'])) $action['action'] = "passwordQueue";
         return($action);
     }
 
@@ -289,7 +290,7 @@ class userManagement extends management
         }
 
         // If we've just refreshed the proposal then do not check the password for validity.
-        if(isset($_POST['refreshProposal'])){
+        if(!isset($_POST['password_finish']) && (isset($_POST['refreshProposal']) || isset($_POST['passwordQueue']))){
             return ($smarty->fetch(get_template_path('password.tpl', TRUE)));
         }
 
index e83900590d815819af47c24529098e59169f6ba3..9f5cf7df76c43dff884895108e4351112d59c5ea 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'
+        <input type='radio' value='1' name='proposalSelected' onChange='document.mainform.submit();'
             {if $proposalSelected} checked {/if}>&nbsp;<b>{t}Use proposal{/t}</b>
       </td>
       <td>
         <div style='
+                {if !$proposalSelected}
+                  background-color:#F0F0F0;
+                  color:#666;
+                {/if}
                   width:180px;
                   border:1px solid #CCC;
                   padding:3px;
     </tr>
     <tr>
       <td>
-        <input type='radio' value='0' name='proposalSelected'
+        <input type='radio' value='0' name='proposalSelected' onChange='document.mainform.submit();'
             {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>
-          {factory type='password' id='new_password' name='new_password' 
-              onfocus="nextfield='repeated_password';" onkeyup="testPasswordCss(\$('new_password').value);"}
+          {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}
       </td>
     </tr>
     <tr>
       <td style='padding-left:40px;'><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
       <td>
-          {factory type='password' id='repeated_password' name='repeated_password'
-              onfocus="nextfield='password_finish';"}
+          {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}
       </td>
     </tr>
     <tr>
index d6588243e1070bd6b984b3ad9a5286013630ddf4..ccd30a18fc62054c4b6b097d8db51a1b0849655f 100644 (file)
@@ -81,12 +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" , set_post($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 556173fec7b8b8e1288eabdbe9c50febafaa08cc..4658bd445aad9782e74fa5c509213a692a4fd1c7 100644 (file)
     </tr>
     <tr>
       <td>
-        <input type='radio' value='1' name='proposalSelected'
+        <input type='radio' value='1' name='proposalSelected' onClick='document.mainform.submit();'
             {if $proposalSelected} checked {/if}>&nbsp;<b>{t}Use proposal{/t}</b>
       </td>
       <td>
         <div style='
+                {if !$proposalSelected} 
+                  background-color:#F0F0F0; 
+                  color:#666;
+                {/if}
                   width:180px;
                   border:1px solid #CCC;
                   padding:3px;
     </tr>
     <tr>
       <td>
-        <input type='radio' value='0' name='proposalSelected'
+        <input type='radio' value='0' name='proposalSelected'  onChange='document.mainform.submit();'
             {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>
-          {factory type='password' name='new_password' id='new_password' 
-              onkeyup="testPasswordCss(\$('new_password').value)"  onfocus="nextfield= 'repeated_password';"}
+          {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}
       </td>
     </tr>
     <tr>
       <td style='padding-left:40px;'><b><LABEL for="repeated_password">{t}Repeat new password{/t}</LABEL></b></td>
       <td>
-          {factory type='password' name='repeated_password' id='repeated_password' onfocus="nextfield= 'password_finish';"}
+          {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}
       </td>
     </tr>
     <tr>