Code

Added on-the-fly state-changing of proxy checkboxes
authorjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 31 May 2005 10:51:47 +0000 (10:51 +0000)
committerjanw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 31 May 2005 10:51:47 +0000 (10:51 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@531 594d385d-05f5-0310-b6e9-bd551577e9d8

html/include/focus.js
plugins/personal/connectivity/class_proxyAccount.inc
plugins/personal/connectivity/proxy.tpl

index 48f7e738e4000ec31d06adec95e822ed4efcc60c..978939c84821d76c5864da41f57db266ec06e209 100644 (file)
@@ -39,6 +39,24 @@ function changeSelectState(triggerField, myField) {
   }
 }
 
+function changeSubselectState(triggerField, myField) {
+  if (document.getElementById(triggerField).checked == true){
+         document.getElementById(myField).disabled= false;
+  } else {
+         document.getElementById(myField).disabled= true;
+  }
+}
+
+function changeTripleSelectState(firstTriggerField, secondTriggerField, myField) {
+  if (
+       document.getElementById(firstTriggerField).checked == true &&
+       document.getElementById(secondTriggerField).checked == true){
+         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 acc6ebf9dec2e2a3803490f04be06d54eda42fbc..a097972ddc889696a482a309908a55e6cee6c384 100644 (file)
@@ -48,8 +48,15 @@ class proxyAccount extends plugin
     foreach (array("F", "T", "B", "N") as $val){
       if (is_integer(strpos($this->gosaProxyAcctFlags, "$val"))) {
         $smarty->assign("filter$val", "checked");
+
+        /* Add state variables for on-the-fly state-changing of checkboxes */
+        $smarty->assign($val."state", "");
+        
       } else {
         $smarty->assign("filter$val", "");
+
+        /* Same as above */
+        $smarty->assign($val."state", "disabled");
       }
     }
 
index 07f89580b27672efff7c8240f97a8714461538f6..8fed115640d1de7bfeb28cd8421655494557190c 100644 (file)
@@ -1,17 +1,17 @@
 <h2>
        {if $tabbed eq 1}
-               <input type="checkbox" name="proxy" value="B" {$proxyState} {$gosaProxyAcctFlagsACL} 
-                       onclick="
+               <input type="checkbox" id="proxy" name="proxy" value="B" {$proxyState} {$gosaProxyAcctFlagsACL} 
+                       onClick="
                                changeState('filterF'); 
                                changeState('filterT'); 
-                               changeState('startHour'); 
-                               changeState('startMinute'); 
-                               changeState('stopHour'); 
-                               changeState('stopMinute'); 
-                               changeState('filterB'); 
-                               changeState('quota_size'); 
-                               changeState('quota_unit'); 
-                               changeState('gosaProxyQuotaPeriod');
+                               changeState('filterB');
+                               changeTripleSelectState('proxy', 'filterT', 'startHour'); 
+                               changeTripleSelectState('proxy', 'filterT', 'startMinute'); 
+                               changeTripleSelectState('proxy', 'filterT', 'stopHour'); 
+                               changeTripleSelectState('proxy', 'filterT', 'stopMinute'); 
+                               changeTripleSelectState('proxy', 'filterB', 'quota_size'); 
+                               changeTripleSelectState('proxy', 'filterB', 'quota_unit'); 
+                               changeTripleSelectState('proxy', 'filterB', 'gosaProxyQuotaPeriod');
                        ">
        {/if}{t}Proxy account{/t}</h2>
 
     </td></tr>
      <tr>
       <td width="50%">
-    <input type="checkbox" name="filterT" id="filterT" value="T" {$filterT} {$gosaProxyAcctFlagsACL} {$pstate}>
+    <input type="checkbox" name="filterT" id="filterT" value="T" {$filterT} {$gosaProxyAcctFlagsACL} {$pstate}
+       onClick="
+               changeSubselectState('filterT', 'startHour');
+               changeSubselectState('filterT', 'startMinute');
+               changeSubselectState('filterT', 'stopHour');
+               changeSubselectState('filterT', 'stopMinute');
+       ">
     {t}Limit proxy access to working time{/t}
     <br>
     <table style="margin-left:20px;">
      <tr>
       <td>
-        <select size="1" id="startHour" name="startHour" {$gosaProxyWorkingStartACL} {$pstate}>
+        <select size="1" id="startHour" name="startHour" {$gosaProxyWorkingStartACL} {$Tstate}>
          {html_options values=$hours output=$hours selected=$starthour}
         </select>
         &nbsp;:&nbsp;
-        <select size="1" id="startMinute" name="startMinute" {$gosaProxyWorkingStartACL} {$pstate}>
+        <select size="1" id="startMinute" name="startMinute" {$gosaProxyWorkingStartACL} {$Tstate}>
          {html_options values=$minutes output=$minutes selected=$startminute}
         </select>
         &nbsp;-&nbsp;
-        <select size="1" id="stopHour" name="stopHour" {$gosaProxyWorkingStopACL} {$pstate}>
+        <select size="1" id="stopHour" name="stopHour" {$gosaProxyWorkingStopACL} {$Tstate}>
          {html_options values=$hours output=$hours selected=$stophour}
         </select>
         &nbsp;:&nbsp;
-        <select size="1" id="stopMinute" name="stopMinute" {$gosaProxyWorkingStopACL} {$pstate}>
+        <select size="1" id="stopMinute" name="stopMinute" {$gosaProxyWorkingStopACL} {$Tstate}>
          {html_options values=$minutes output=$minutes selected=$stopminute}
         </select>
       </td>
      &nbsp;
    </td>
       <td>
-    <input type="checkbox" id="filterB" name="filterB" value="B" {$filterB} {$pstate} {$gosaProxyAcctFlagsACL}>
+    <input type="checkbox" id="filterB" name="filterB" value="B" {$filterB} {$pstate} {$gosaProxyAcctFlagsACL}
+       onClick="
+               changeSubselectState('filterB', 'quota_size');
+               changeSubselectState('filterB', 'quota_unit');
+               changeSubselectState('filterB', 'gosaProxyQuotaPeriod');
+       ">
     {t}Restrict proxy usage by quota{/t}
     <br>
     <table style="margin-left:20px;">
      <tr>
       <td>
-       <input name="quota_size" id="quota_size" size=7 maxlength=10 {$pstate} {$gosaProxyQuotaACL} value="{$quota_size}">
+       <input name="quota_size" id="quota_size" size=7 maxlength=10 {$Bstate} {$gosaProxyQuotaACL} value="{$quota_size}">
        &nbsp;
-       <select size="1" name="quota_unit" id="quota_unit" {$pstate} {$gosaProxyQuotaACL}>
+       <select size="1" name="quota_unit" id="quota_unit" {$Bstate} {$gosaProxyQuotaACL}>
        {html_options options=$quota_unit selected=$quota_u}
        </select>
        {t}per{/t}
-       <select size="1" name="gosaProxyQuotaPeriod" id="gosaProxyQuotaPeriod" {$pstate} {$gosaProxyQuotaACL}>
+       <select size="1" name="gosaProxyQuotaPeriod" id="gosaProxyQuotaPeriod" {$Bstate} {$gosaProxyQuotaACL}>
         {html_options options=$quota_time selected=$gosaProxyQuotaPeriod}
        </select>
       </td>