Code

Fixed proxy greyout and acls handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Aug 2006 07:42:54 +0000 (07:42 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 8 Aug 2006 07:42:54 +0000 (07:42 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4422 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/connectivity/class_proxyAccount.inc
plugins/personal/connectivity/proxy.tpl

index 1280d3b9f268c6f840281d872e107ef3906bdd0c..98294c273b1451b6ccc26397ca35923d92a5f99e 100644 (file)
@@ -34,11 +34,10 @@ class proxyAccount extends plugin
     /* Prepare templating */
     $smarty= get_smarty();
 
+    $smarty->assign('proxyAccountACL', " disabled ");
     
-    if((!$this->ReadOnly)&& ($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable())) {
+    if((!$this->ReadOnly)&& (($this->is_account && $this->acl_is_removeable()) || (!$this->is_account && $this->acl_is_createable()))){
       $smarty->assign('proxyAccountACL', "");
-    }else{
-      $smarty->assign('proxyAccountACL', " disabled ");
     }
 
     /* Assign radio boxes */
@@ -101,24 +100,24 @@ class proxyAccount extends plugin
 
     $changeA = "";
   
-    if($this->acl_is_writeable("gosaProxyFlag_F")){
-      $changeA .="changeState('filterF');\n";
-    }
     $ProxyWorkingStateChange ="\n";
-    if($this->acl_is_writeable("gosaProxyWorkingTime")){
+    if($this->acl_is_writeable("gosaProxyFlagT")){
       $changeA .= "changeState('filterT');\n";
+
       $ProxyWorkingStateChange.=  "changeState('startHour'); \n";
       $ProxyWorkingStateChange.=  "changeState('startMinute'); \n";
       $ProxyWorkingStateChange.=  "changeState('stopHour'); \n";
       $ProxyWorkingStateChange.=  "changeState('stopMinute'); \n";
     }
 
-    $changeA .= $ProxyWorkingStateChange;
+    if(preg_match("/F/",$this->gosaProxyAcctFlags)){
+      $changeA .= $ProxyWorkingStateChange;
+    }
   
     $smarty->assign("ProxyWorkingStateChange",$ProxyWorkingStateChange);
 
     $changeB = "";
-    if($this->acl_is_writeable("gosaProxyQuota")){
+    if($this->acl_is_writeable("gosaProxyFlagB")){
       $changeA .= "changeState('filterB');";
       $changeB = 
         "changeSubselectState('filterB', 'quota_size');
@@ -180,26 +179,23 @@ class proxyAccount extends plugin
   function save_object()
   {
     /* Do we need to flip is_account state? */
-    if ($this->parent != NULL){
-      if (isset($_POST['connectivityTab'])){
-        if (isset($_POST['proxy'])){
-          if (!$this->is_account && $_POST['proxy'] == "B"){
-            if($this->acl_is_createable()){
-              $this->is_account= TRUE;
-            }
-          }
-        } else {
-          if($this->acl_is_removeable()){
-            $this->is_account= FALSE;
+    if (isset($_POST['connectivityTab'])){
+      if (isset($_POST['proxy'])){
+        if (!$this->is_account && $_POST['proxy'] == "B"){
+          if($this->acl_is_createable()){
+            $this->is_account= TRUE;
           }
         }
+      } else {
+        if($this->acl_is_removeable()){
+          $this->is_account= FALSE;
+        }
       }
     }
 
     /* Save flag value */
     if ($this->is_account){
 
-
       $flags= "";
       $acl= "";
       foreach(array("F", "T", "B") as $key){
@@ -223,7 +219,7 @@ class proxyAccount extends plugin
       $this->gosaProxyAcctFlags= "[$flags]";
 
       /* Save time values */
-      if ($this->acl_is_writeable("gosaProxyWorkingTime")){
+      if ($this->acl_is_writeable("gosaProxyFlagT")){
         if(isset($_POST['startMinute'])){
           $old= $this->gosaProxyWorkingStart;
           $this->gosaProxyWorkingStart= $_POST["startHour"] * 60 + $_POST["startMinute"];
@@ -238,14 +234,14 @@ class proxyAccount extends plugin
       }
 
       /* Save quota values */
-      if ($this->acl_is_writeable("gosaProxyQuota")){
+      if ($this->acl_is_writeable("gosaProxyFlagB")){
         if(isset($_POST["quota_size"]) && isset($_POST["quota_unit"])){
           $this->gosaProxyQuota= $_POST["quota_size"].$_POST["quota_unit"];
         }
       }
   
       /*Save quota period */
-      if($this->acl_is_writeable("gosaProxyQuotaPeriod")){
+      if($this->acl_is_writeable("gosaProxyFlagB")){
         if(isset($_POST["gosaProxyQuotaPeriod"])){
           $this->gosaProxyQuotaPeriod = $_POST["gosaProxyQuotaPeriod"];
         }
@@ -293,15 +289,9 @@ class proxyAccount extends plugin
           "plOptions"       => array(),
 
           "plProvidedAcls"  => array(
-            "gosaProxyID"           => _("gosaProxyID"),
-
             "gosaProxyFlagF"       => _("Filter unwanted content"), 
             "gosaProxyFlagT"       => _("Limit proxy access"),
-            "gosaProxyFlagB"       => _("Restrict proxy usage by quota"),
-
-            "gosaProxyWorkingTime"  => _("Limit proxy access"),
-            "gosaProxyQuota"        => _("Limit quota"),
-            "gosaProxyQuotaPeriod"  => _("Quota limit period"))
+            "gosaProxyFlagB"       => _("Restrict proxy usage by quota"))
           ));
   }
 }
index c4851114a1d9a69148195f9dc53a05bbd99f828a..b05f2ed579c61c252e6872fb26f6d63be86a363e 100644 (file)
@@ -1,17 +1,23 @@
 <h2>
  <input type="checkbox" id="proxy" name="proxy" value="B" {$proxyState} {$proxyAccountACL} 
    onClick="
-    {$changeA}
 
 {if $gosaProxyFlagF_W}
-       changeState('filterF');
+    changeState('filterF');
 {/if}
-{if $gosaProxyFlagB_W} 
-    changeTripleSelectState('proxy', 'filterB', 'quota_size'); 
+
+{if $gosaProxyFlagT_W}
+       changeState('filterT'); 
+       changeTripleSelectState('proxy', 'filterT', 'startHour'); 
+       changeTripleSelectState('proxy', 'filterT', 'startMinute'); 
+       changeTripleSelectState('proxy', 'filterT', 'stopMinute'); 
+       changeTripleSelectState('proxy', 'filterT', 'stopHour'); 
 {/if}
-{if $gosaProxyQuotaPeriod_W} 
-    changeTripleSelectState('proxy', 'filterB', 'quota_unit'); 
-    changeTripleSelectState('proxy', 'filterB', 'gosaProxyQuotaPeriod');
+{if $gosaProxyFlagB_W}
+       changeState('filterB'); 
+       changeTripleSelectState('proxy', 'filterB', 'quota_unit'); 
+       changeTripleSelectState('proxy', 'filterB', 'quota_size');
+       changeTripleSelectState('proxy', 'filterB', 'gosaProxyQuotaPeriod');
 {/if}
    ">
  {t}Proxy account{/t}</h2>
      <tr>
       <td>
 
-{render acl=$gosaProxyWorkingTimeACL}
+{render acl=$gosaProxyFlagTACL}
         <select size="1" id="startHour" name="startHour" {if $Tstate!=""} disabled {/if} {$pstate}>
          {html_options values=$hours output=$hours selected=$starthour}
         </select>
 {/render}
         &nbsp;:&nbsp;
-{render acl=$gosaProxyWorkingTimeACL}
+{render acl=$gosaProxyFlagTACL}
         <select size="1" id="startMinute" name="startMinute" {if  $Tstate!=""} disabled {/if} {$pstate}>
          {html_options values=$minutes output=$minutes selected=$startminute}
         </select>
 {/render}
         &nbsp;-&nbsp;
-{render acl=$gosaProxyWorkingTimeACL}
+{render acl=$gosaProxyFlagTACL}
         <select size="1" id="stopHour" name="stopHour" {if $Tstate!=""}disabled {/if} {$pstate}>
    {html_options values=$hours output=$hours selected=$stophour}
         </select>
 {/render}
         &nbsp;:&nbsp;
-{render acl=$gosaProxyWorkingTimeACL}
+{render acl=$gosaProxyFlagTACL}
         <select size="1" id="stopMinute" name="stopMinute" {if $Tstate!=""} disabled {/if} {$pstate} >
          {html_options values=$minutes output=$minutes selected=$stopminute}
         </select>
        <input name="quota_size" id="quota_size" size=7 maxlength=10 value="{$quota_size}" {if $Bstate=="disabled"} disabled {/if} {$pstate}>
 {/render}
        &nbsp;
-{render acl=$gosaProxyQuotaPeriodACL}
+{render acl=$gosaProxyFlagBACL}
        <select size="1" name="quota_unit" id="quota_unit" {if $Bstate=="disabled" } disabled {/if} {$pstate}>
        {html_options options=$quota_unit selected=$quota_u}
        </select>
 {/render}
     
        <LABEL for="gosaProxyQuotaPeriod">{t}per{/t}</LABEL>
-{render acl=$gosaProxyQuotaPeriodACL}
+{render acl=$gosaProxyFlagBACL}
        <select size="1" name="gosaProxyQuotaPeriod" id="gosaProxyQuotaPeriod" {if $Bstate=="disabled"} disabled {/if} {$pstate}>
         {html_options options=$quota_time selected=$gosaProxyQuotaPeriod}
        </select>