Code

Hide inherit options, if we are not part in an object group.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jul 2007 09:25:37 +0000 (09:25 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 18 Jul 2007 09:25:37 +0000 (09:25 +0000)
NTP service / FAI startup settings / Root server / Ldap Base

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

plugins/admin/systems/class_terminalGeneric.inc
plugins/admin/systems/class_workstationGeneric.inc
plugins/admin/systems/class_workstationStartup.inc
plugins/admin/systems/terminal.tpl
plugins/admin/systems/workstation.tpl

index 598e4fbd458661620d032c2ceb3cde3c37e12922..8f5b2fde36ddd6d039ea9d91067b3dbbf20ec047 100644 (file)
@@ -98,6 +98,11 @@ class termgeneric extends plugin
       $this->gotoNtpServer=array();
     }
 
+    /* You can't inherit the NTP service, if we are not member in an object group */
+    if(!$this->member_of_ogroup){
+      $this->inheritTimeServer = FALSE;
+    }
+
     /* Create available ntp options */
     $this->gotoNtpServers = $this->config->data['SERVERS']['NTP'];
     foreach($this->gotoNtpServers as $key => $server){
@@ -122,7 +127,7 @@ class termgeneric extends plugin
     $tmp = $this->config->data['SERVERS']['SYSLOG'];
     foreach($tmp as $server){
       $visible = $server;
-      if($server == "default") {
+      if($server == "default" && $this->member_of_ogroup) {
         $visible = "["._("inherited")."]";
       }
       $this->gotoSyslogServers[$server] = $visible;
@@ -294,7 +299,9 @@ class termgeneric extends plugin
       if($server != "default"){
         $tmp2[$server]= $server;
       }else{
-        $tmp2[$server]="["._("inherited")."]";
+        if($this->member_of_ogroup){
+          $tmp2[$server]="["._("inherited")."]";
+        }
       }
     }
   
@@ -369,7 +376,7 @@ class termgeneric extends plugin
     }
   
     if(isset($_POST['termgeneric_posted']) && chkacl($this->acl,"gotoNtpServer") == ""){
-      if(isset($_POST["inheritTimeServer"])){
+      if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
         $this->inheritTimeServer = true;
       }else{
         $this->inheritTimeServer = false;
index 5863ed5f41c22654c80f5294cffe02b261b3c7f6..78f22f96954febdee43737a22c54c84268fd92c6 100644 (file)
@@ -106,6 +106,11 @@ class workgeneric extends plugin
       $this->gotoNtpServer=array();
     }
 
+    /* You can't inherit the NTP service, if we are not member in an object group */
+    if(!$this->member_of_ogroup){
+      $this->inheritTimeServer = FALSE;
+    }
+
     /* Create available ntp options */
     $tmp = $this->config->data['SERVERS']['NTP'];
     $this->gotoNtpServers = array();
@@ -129,7 +134,7 @@ class workgeneric extends plugin
     $tmp = $this->config->data['SERVERS']['SYSLOG'];
     foreach($tmp as $server){
       $visible = $server;
-      if($server == "default") {
+      if($server == "default" && $this->member_of_ogroup) {
         $visible = "["._("inherited")."]";
       }
       $this->gotoSyslogServers[$server] = $visible;
@@ -336,7 +341,7 @@ class workgeneric extends plugin
 
     /* Set inherit mode */
     if(isset($_POST['workgeneric_posted']) && chkacl($this->acl,"gotoNtpServer") == ""){
-      if(isset($_POST["inheritTimeServer"])){
+      if(isset($_POST["inheritTimeServer"]) && $this->member_of_ogroup){
         $this->inheritTimeServer = true;
       }else{
         $this->inheritTimeServer = false;
index be645996ff75d16e02a3f86fc9d94eb84cca98f3..02e5b7ea0c81668b990c35aacdbff524795c686c 100644 (file)
@@ -51,6 +51,7 @@ class workstartup extends plugin
   var $FAIServRepConfig   = array();
 
   var $fai_activated      = FALSE;
+  var $member_of_ogroup   = FALSE;
 
   function workstartup ($config, $dn= NULL, $parent= NULL)
   {
@@ -65,6 +66,13 @@ class workstartup extends plugin
 
     plugin::plugin ($config, $dn, $parent);
 
+    if(!isset($this->parent->by_object['ogroup'])){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd ($this->config->current['BASE']);
+      $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))",array("cn"));
+      $this->member_of_ogroup = $ldap->count() >= 1;
+    }
+
     /* Creating a list of valid Mirrors 
      * none will not be saved to ldap.
      */
@@ -296,11 +304,11 @@ class workstartup extends plugin
 
 
     /* Load hardware list */
-    $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
-    $ldap->search("(&(objectClass=gotoWorkstationTemplate)(member=".$this->dn."))");
-    if ($ldap->count() == 1){
+    if ($this->member_of_ogroup){
 
+      if(count($this->FAIclass)==0 && $this->FAIrelease == ""){
+        $this->FAIdebianMirror = "inherited";
+      }
 
       if($this->fai_activated){
         $map= array("gotoLdapServer","FAIclass","FAIdebianMirror","gotoBootKernel");
@@ -376,9 +384,6 @@ class workstartup extends plugin
       $this->gotoBootKernel= "default";
     }
 
-    if(count($this->FAIclass)==0 && $this->FAIrelease == ""){
-      $this->FAIdebianMirror = "inherited";
-    }
   }
 
   
@@ -825,7 +830,13 @@ class workstartup extends plugin
   function getFAIdebianMirrors()
   {
     $ret = array();
-    $ret['inherited']="["._("inherited")."]";
+
+    /* Only add inherit option, if we are part in an object group 
+     */
+    if($this->member_of_ogroup)    {
+      $ret['inherited']="["._("inherited")."]";
+    }
+
     $ret['auto']=_("automatic");
     $secs  = array();
 
index 76a7471a379bc104386b3e9f68f13a7fb156573e..684fdbe6fc2eade03d25eafdd944ffbeea7c398a 100644 (file)
@@ -83,6 +83,7 @@
        <table width="100%">
     <tr>
         <td colspan="2">
+{if $member_of_ogroup}
                <input type="checkbox" value="1" name="inheritTimeServer" {$gotoNtpServerACL}
                        {if $inheritTimeServer } checked {/if} 
                        onClick="javascript:
@@ -90,6 +91,9 @@
                                        changeState('gotoNtpServers');
                                        changeState('addNtpServer');
                                        changeState('delNtpServer');">{t}Inherit time server attributes{/t}
+{else}
+       <input disabled type='checkbox' name='option_disabled'>{t}Inherit time server attributes{/t}
+{/if}
         </td>
        </tr>
        <tr>
index cb84f1a1fdbafd64ebd6f0920167f11c9bab9ca7..653cb724bbd1fbb49bf962f11d9ace118b949303 100644 (file)
@@ -62,6 +62,9 @@
    <table width="100%">
     <tr>
      <td colspan="2">
+
+{if $member_of_ogroup}
+
         <input type="checkbox" value="1" name="inheritTimeServer"  {$gotoNtpServerACL}
             {if $inheritTimeServer } checked {/if}
             onClick="javascript:
@@ -69,6 +72,9 @@
                     changeState('gotoNtpServers');
                     changeState('addNtpServer');
                     changeState('delNtpServer');">{t}Inherit time server attributes{/t}
+{else}
+               <input disabled type='checkbox' name='option_disabled'>{t}Inherit time server attributes{/t}
+{/if}
      </td>
     </tr>
     <tr>