Code

Added another changestate-method...
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Sep 2005 10:39:42 +0000 (10:39 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 2 Sep 2005 10:39:42 +0000 (10:39 +0000)
TS-Fields are now disabled on-the-fly if TS-Login is disabled.
Added two state variables.

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

html/include/focus.js
plugins/personal/samba/class_sambaAccount.inc
plugins/personal/samba/samba3.tpl

index 74ac8ceac371e8b565b074bf8d3c1eb3bd27ca8c..9eac9f83a848dff5fe611c11000a42a3f629baf1 100644 (file)
@@ -57,6 +57,17 @@ function changeTripleSelectState(firstTriggerField, secondTriggerField, myField)
   }
 }
 
+<!-- Second field must be non-checked -->
+function changeTripleSelectState_2nd_neg(firstTriggerField, secondTriggerField, myField) {
+  if (
+       document.getElementById(firstTriggerField).checked == true &&
+       document.getElementById(secondTriggerField).checked == false){
+         document.getElementById(myField).disabled= false;
+  } else {
+         document.getElementById(myField).disabled= true;
+  }
+}
+
 document.onkeydown= keyDown; // work together to analyze keystrokes
 if (netscape){
   document.captureEvents(Event.KEYDOWN|Event.KEYUP);
index 257a4e703163c062ea96419f608cc07e373c2a9c..dee273c53a0362bcfa26810c57539085b5880bbb 100644 (file)
@@ -472,6 +472,10 @@ class sambaAccount extends plugin
       $smarty->assign("reconnmode", $this->mungedObject->getReConn());
       $smarty->assign("reconnACL", chkacl($this->acl,"reconn"));
 
+      /* Set form elements to disabled/enable state */
+      $smarty->assign("tsloginstate", $this->mungedObject->getTsLogin()?"":"disabled");
+      $smarty->assign("inheritstate", $this->mungedObject->getInheritMode()?"disabled":"");
+      
       /* Set checkboxes to checked or unchecked state */
       $smarty->assign("tslogin", $this->mungedObject->getTsLogin()?"checked":"");
       $smarty->assign("tsloginACL", chkacl($this->acl,"tslogin"));
@@ -762,10 +766,15 @@ class sambaAccount extends plugin
         /* Save checkbox states. */
         $this->mungedObject->setTsLogin(!isset($_POST['tslogin'])
                         && chkacl($this->acl, "tslogin") == "");
-        $this->mungedObject->setBrokenConn($_POST['brokenconn'] == '1'
-                        && chkacl($this->acl, "brokenconn") == "");
-        $this->mungedObject->setReConn($_POST['reconn'] == '1'
-                        && chkacl($this->acl, "reconn") == "");
+        // Need to do some index checking to avoid messages like "index ... not found"
+        if(isset($_POST['brokenconn'])) {
+          $this->mungedObject->setBrokenConn($_POST['brokenconn'] == '1'
+                          && chkacl($this->acl, "brokenconn") == "");
+        }
+        if(isset($_POST['reconn'])) {
+          $this->mungedObject->setReConn($_POST['reconn'] == '1'
+                          && chkacl($this->acl, "reconn") == "");
+        }
         $this->mungedObject->setInheritMode(isset($_POST['inherit'])
                         && chkacl($this->acl, "inherit") == "");
         $this->mungedObject->setCtxMaxConnectionTimeF(!isset($_POST['CtxMaxConnectionTimeF'])
@@ -783,8 +792,10 @@ class sambaAccount extends plugin
                         && chkacl($this->acl, "defaultprinter") == "");
 
         /* Save combo boxes. Takes two values */
-        $this->mungedObject->setShadow((isset($_POST['shadow'])
-                        && chkacl($this->acl, "shadow") == ""), $_POST['shadow']);
+        if(isset($_POST['reconn'])) {
+          $this->mungedObject->setShadow((isset($_POST['shadow'])
+                          && chkacl($this->acl, "shadow") == ""), $_POST['shadow']);
+        }
 
         /* Check for changes */
         if ($this->sambaMungedDial != $this->mungedObject->getMunged()){
index 23833ac2e9c4c77ff0eee04cb11b0ff247e01c51..6495ae53fb9f9b0bd98ba87b31d095d87dea7b86 100644 (file)
 <table summary="" style="width:100%; vertical-align:top; text-align:left;" cellpadding=0 border=0>
  <tr>
   <td style="vertical-align:top;width:50%">
-   <input type=checkbox name="tslogin" value="1" {$tslogin} {$tsloginACL}>
+   <input type=checkbox name="tslogin" id="tslogin" value="1" {$tslogin} {$tsloginACL}
+       onclick="
+               changeState('CtxWFHomeDir');
+               changeState('CtxWFHomeDirDrive');
+               changeState('CtxWFProfilePath');
+               changeState('inherit');
+               changeTripleSelectState_2nd_neg('tslogin','inherit','CtxInitialProgram');
+               changeTripleSelectState_2nd_neg('tslogin','inherit','CtxWorkDirectory');
+               changeState('CtxMaxConnectionTimeF');
+               changeState('CtxMaxDisconnectionTimeF');
+               changeState('CtxMaxIdleTimeF');
+               changeTripleSelectState('tslogin','CtxMaxConnectionTimeF','CtxMaxConnectionTime');
+               changeTripleSelectState('tslogin','CtxMaxDisconnectionTimeF','CtxMaxDisconnectionTime');
+               changeTripleSelectState('tslogin','CtxMaxIdleTimeF','CtxMaxIdleTime');
+               changeState('connectclientdrives');
+               changeState('connectclientprinters');
+               changeState('defaultprinter');
+               changeState('shadow');
+               changeState('brokenconn');
+               changeState('reconn');
+       ">
    <i>{t}Allow login on terminal server{/t}</i>
    <table summary="">
     <tr>
      <td><LABEL for="CtxWFHomeDir">{t}Home directory{/t}</LABEL></td>
      <td>
-      <input id="CtxWFHomeDir" name="CtxWFHomeDir" size=30 maxlength=60 {$CtxWFHomeDirACL} value="{$CtxWFHomeDir}">
-      <select size="1" name="CtxWFHomeDirDrive" {$CtxWFHomeDirDriveACL}>
+      <input id="CtxWFHomeDir" name="CtxWFHomeDir" size=30 maxlength=60 {$CtxWFHomeDirACL} value="{$CtxWFHomeDir}" {$tsloginstate}>
+      <select size="1" id="CtxWFHomeDirDrive" name="CtxWFHomeDirDrive" {$CtxWFHomeDirDriveACL} {$tsloginstate}>
        <option disabled>&nbsp;</option>
        {html_options values=$drives output=$drives selected=$CtxWFHomeDirDrive}
       </select>
@@ -74,7 +94,7 @@
     <tr>
      <td><LABEL for="CtxWFProfilePath">{t}Profile path{/t}</LABEL></td>
      <td>
-      <input id="CtxWFProfilePath" name="CtxWFProfilePath" size=35 maxlength=60 {$CtxWFProfilePathACL} value="{$CtxWFProfilePath}">
+      <input id="CtxWFProfilePath" name="CtxWFProfilePath" size=35 maxlength=60 {$CtxWFProfilePathACL} value="{$CtxWFProfilePath}" {$tsloginstate}>
      </td>
     </tr>
    </table>
    &nbsp;
   </td>
   <td style="vertical-align:top;">
-   <input type=checkbox name="inherit" value="1" {$inherit} {$inheritACL} onclick="changeState('CtxInitialProgram'); changeState('CtxWorkDirectory')">
+   <input type=checkbox id="inherit" name="inherit" {$inherit} {$inheritACL} onclick="changeState('CtxInitialProgram'); changeState('CtxWorkDirectory')" {$tsloginstate}>
    <i>{t}Inherit client config{/t}</i>
    <table summary="">
     <tr>
      <td><LABEL for="CtxInitialProgram">{t}Initial program{/t}</LABEL></td>
      <td>
-      <input id="CtxInitialProgram" name="CtxInitialProgram" size=35 maxlength=60 {if $CtxInitialProgramACL==""}{$CtxInitialProgramMode}{/if} value="{$CtxInitialProgram}" {$CtxInitialProgramACL}>
+      <input id="CtxInitialProgram" name="CtxInitialProgram" size=35 maxlength=60 {if $CtxInitialProgramACL==""}{$CtxInitialProgramMode}{/if} value="{$CtxInitialProgram}" {$CtxInitialProgramACL} {$tsloginstate} {$inheritstate}>
      </td>
     </tr>
     <tr>
      <td><LABEL for="CtxWorkDirectory">{t}Working directory{/t}</LABEL></td>
      <td>
-      <input id="CtxWorkDirectory" name="CtxWorkDirectory" size=35 maxlength=60 {if $CtxWorkDirectoryACL==""}{$CtxInitialProgramMode}{/if} value="{$CtxWorkDirectory}" {$CtxInitialProgramACL}>
+      <input id="CtxWorkDirectory" name="CtxWorkDirectory" size=35 maxlength=60 {if $CtxWorkDirectoryACL==""}{$CtxInitialProgramMode}{/if} value="{$CtxWorkDirectory}" {$CtxInitialProgramACL} {$tsloginstate} {$inheritstate}>
      </td>
     </tr>
    </table>
    <table summary="">
     <tr>
      <td>
-      <input id="CtxMaxConnectionTimeF" type=checkbox name="CtxMaxConnectionTimeF" value="1" {$CtxMaxConnectionTimeF} {$CtxMaxConnectionTimeACL} onclick="changeState('CtxMaxConnectionTime')">
+      <input id="CtxMaxConnectionTimeF" type=checkbox name="CtxMaxConnectionTimeF" value="1" {$CtxMaxConnectionTimeF} {$CtxMaxConnectionTimeACL} onclick="changeSubselectState('CtxMaxConnectionTimeF','CtxMaxConnectionTime')" {$tsloginstate}>
       <LABEL for="CtxMaxConnectionTimeF">{t}Connection{/t}</LABEL>
      </td>
      <td>
-      <input name="CtxMaxConnectionTime" id="CtxMaxConnectionTime" size=5 maxlength=5 {if $CtxMaxConnectionTimeACL==""}{$CtxMaxConnectionTimeMode}{/if} value="{$CtxMaxConnectionTime}" {$CtxMaxConnectionTimeACL}>
+      <input name="CtxMaxConnectionTime" id="CtxMaxConnectionTime" size=5 maxlength=5 {if $CtxMaxConnectionTimeACL==""}{$CtxMaxConnectionTimeMode}{/if} value="{$CtxMaxConnectionTime}" {$CtxMaxConnectionTimeACL} {$tsloginstate}>
      </td>
     </tr>
     <tr>
      <td>
-      <input id="CtxMaxDisconnectionTimeF" type=checkbox name="CtxMaxDisconnectionTimeF" value="1" {$CtxMaxDisconnectionTimeF} {$CtxMaxDisconnectionTimeACL} onclick="changeState('CtxMaxDisconnectionTime')">
+      <input id="CtxMaxDisconnectionTimeF" type=checkbox name="CtxMaxDisconnectionTimeF" value="1" {$CtxMaxDisconnectionTimeF} {$CtxMaxDisconnectionTimeACL} onclick="changeState('CtxMaxDisconnectionTime')" {$tsloginstate}>
       <LABEL for="CtxMaxDisconnectionTimeF">{t}Disconnection{/t}</LABEL>
      </td>
      <td>
-      <input name="CtxMaxDisconnectionTime" id="CtxMaxDisconnectionTime" size=5 maxlength=5 {if $CtxMaxDisconnectionTimeACL ==""}{$CtxMaxDisconnectionTimeMode}{/if} value="{$CtxMaxDisconnectionTime}" {$CtxMaxDisconnectionTimeACL}>
+      <input name="CtxMaxDisconnectionTime" id="CtxMaxDisconnectionTime" size=5 maxlength=5 {if $CtxMaxDisconnectionTimeACL ==""}{$CtxMaxDisconnectionTimeMode}{/if} value="{$CtxMaxDisconnectionTime}" {$CtxMaxDisconnectionTimeACL} {$tsloginstate}>
      </td>
     </tr>
     <tr>
      <td>
-      <input id="CtxMaxIdleTimeF" type=checkbox name="CtxMaxIdleTimeF" value="1" {$CtxMaxIdleTimeF} {$CtxMaxIdleTimeACL} onclick="changeState('CtxMaxIdleTime')">
+      <input id="CtxMaxIdleTimeF" type=checkbox name="CtxMaxIdleTimeF" value="1" {$CtxMaxIdleTimeF} {$CtxMaxIdleTimeACL} onclick="changeState('CtxMaxIdleTime')" {$tsloginstate}>
       <LABEL for="CtxMaxIdleTimeF">{t}IDLE{/t}</LABEL>
      </td>
      <td>
-      <input name="CtxMaxIdleTime" id="CtxMaxIdleTime" size=5 maxlength=5 {if $CtxMaxIdleTimeACL==""}{$CtxMaxIdleTimeMode}{/if} value="{$CtxMaxIdleTime}" {$CtxMaxIdleTimeACL}>
+      <input name="CtxMaxIdleTime" id="CtxMaxIdleTime" size=5 maxlength=5 {if $CtxMaxIdleTimeACL==""}{$CtxMaxIdleTimeMode}{/if} value="{$CtxMaxIdleTime}" {$CtxMaxIdleTimeACL} {$tsloginstate}>
      </td>
     </tr>
    </table>
    <table summary="">
     <tr>
      <td>
-      <input id="connectclientdrives" type=checkbox name="connectclientdrives" value="1" {$connectclientdrives} {$connectclientdrivesACL}>
+      <input id="connectclientdrives" type=checkbox name="connectclientdrives" value="1" {$connectclientdrives} {$connectclientdrivesACL} {$tsloginstate}>
       <LABEL for="connectclientdrives">{t}Connect client drives at logon{/t}</LABEL>
      </td>
     </tr>
     <tr>
      <td>
-      <input id="connectclientprinters" type=checkbox name="connectclientprinters" value="1" {$connectclientprinters} {$connectclientprintersACL}>
+      <input id="connectclientprinters" type=checkbox name="connectclientprinters" value="1" {$connectclientprinters} {$connectclientprintersACL} {$tsloginstate}>
       <LABEL for="connectclientprinters">{t}Connect client printers at logon{/t}</LABEL>
      </td>
     </tr>
     <tr>
      <td>
-      <input id="defaultprinter" type=checkbox name="defaultprinter" value="1" {$defaultprinter} {$defaultprinterACL}>
+      <input id="defaultprinter" type=checkbox name="defaultprinter" value="1" {$defaultprinter} {$defaultprinterACL} {$tsloginstate}>
       <LABEL for="defaultprinter">{t}Default to main client printer{/t}</LABEL>
      </td>
     </tr>
       <LABEL for="shadow">{t}Shadowing{/t}</LABEL>
      </td>
      <td>
-      <select id="shadow" size="1" name="shadow" {$shadowACL}>
+      <select id="shadow" size="1" name="shadow" {$shadowACL} {$tsloginstate}>
        {html_options options=$shadow selected=$shadowmode}
       </select>
      </td>
     <tr>
      <td><LABEL for="brokenconn">{t}On broken or timed out{/t}</LABEL></td>
      <td>
-      <select id="brokenconn" size="1" name="brokenconn" {$brokenconnACL}>
+      <select id="brokenconn" size="1" name="brokenconn" {$brokenconnACL} {$tsloginstate}>
        {html_options options=$brokenconn selected=$brokenconnmode}
       </select>
      </td>
     <tr>
      <td><LABEL for="reconn">{t}Reconnect if disconnected{/t}</LABEL></td>
      <td>
-      <select id="reconn" size="1" name="reconn" {$reconnACL}>
+      <select id="reconn" size="1" name="reconn" {$reconnACL} {$tsloginstate}>
        {html_options options=$reconn selected=$reconnmode}
       </select>
      </td>