Code

Added inherit everything button to Terminal and Workstation generic
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 13 Jul 2007 07:33:44 +0000 (07:33 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 13 Jul 2007 07:33:44 +0000 (07:33 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6855 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 1526e213eb69a7f2ed2c5a44c4ef00b0a7c2b625..4337b6b7f8e5009c84fed1fc7d2d1d2d9f0b8a34 100644 (file)
@@ -58,6 +58,8 @@ class termgeneric extends plugin
   var $fai_activated = FALSE;
   var $view_logged = FALSE;
 
+  var $member_of_ogroup = FALSE;
+
   function termgeneric ($config, $dn= NULL, $parent= NULL)
   {
     /* Check if FAI is activated */
@@ -67,6 +69,14 @@ class termgeneric 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;
+    }
+
     $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
     /* Read arrays */
     foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
@@ -337,6 +347,8 @@ class termgeneric extends plugin
       $smarty->assign($val."_select", $this->$val);
     }
 
+    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
+
     /* Show main page */
     $smarty->assign("netconfig", $this->netConfigDNS->execute());
     return($smarty->fetch (get_template_path('terminal.tpl', TRUE)));
@@ -404,6 +416,11 @@ class termgeneric extends plugin
         $this->inheritTimeServer = false;
       }
     }  
+
+    if(isset($_POST["inheritAll"])){
+      $this->set_everything_to_inherited();
+    }
+
   }
 
 
@@ -619,6 +636,29 @@ class termgeneric extends plugin
             "FAIstate"            => _("Action flag"))
           ));
   }
+
+
+  function set_everything_to_inherited()
+  {
+    $this->gotoTerminalPath  = "default";
+    $this->gotoSwapServer    = "default" ;
+    $this->gotoSyslogServer  = "default";
+    $this->inheritTimeServer = TRUE;
+
+    /* Set workstation service attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['termservice'])){
+      foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
+            "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseType") as $name){
+        $this->parent->by_object['termservice']->$name = "default";
+      }
+    }
+
+    /* Set workstation startup attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['termstartup'])){
+      $this->parent->by_object['termstartup']->gotoBootKernel = "default-inherited";
+      $this->parent->by_object['termstartup']->gotoLdapServer = "default-inherited";
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 70d3dfce9d7e84239e9941a513f856b38de3edd5..294f8e537f1bea00d1bb16243e1732e0943ea818 100644 (file)
@@ -64,6 +64,8 @@ class workgeneric extends plugin
   
   var $fai_activated = FALSE;
 
+  var $member_of_ogroup = FALSE;
+
   function workgeneric ($config, $dn= NULL, $parent= NULL)
   {
     $tmp = search_config($config->data,"faiManagement","CLASS");
@@ -72,6 +74,14 @@ class workgeneric 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;
+    }
+
     $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
 
     /* Read arrays */
@@ -326,6 +336,7 @@ class workgeneric extends plugin
 
     /* tell smarty the inherit checkbox state */
     $smarty->assign("inheritTimeServer",$this->inheritTimeServer);
+    $smarty->assign("member_of_ogroup",$this->member_of_ogroup);
 
     /* Show main page */
     $smarty->assign("netconfig", $this->netConfigDNS->execute());
@@ -354,6 +365,10 @@ class workgeneric extends plugin
         $og->save ();
       }
     }
+
+    if(isset($_POST["inheritAll"])){
+      $this->set_everything_to_inherited();
+    }
   }
 
 
@@ -605,7 +620,26 @@ class workgeneric extends plugin
           ));
   }
 
-}
+  function set_everything_to_inherited()
+  {
+    $this->gotoSyslogServer  = "default";
+    $this->inheritTimeServer = TRUE;
+
+    /* Set workstation service attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['workservice'])){
+      foreach(array("gotoXKbLayout","gotoXKbModel","gotoXKbVariant",
+            "gotoXResolution","gotoXColordepth","gotoXMouseType","gotoXMouseType") as $name){
+        $this->parent->by_object['workservice']->$name = "default"; 
+      }
+    }
 
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+    /* Set workstation startup attributes to inherited */
+    if($this->member_of_ogroup && isset($this->parent->by_object['workstartup'])){
+      $this->parent->by_object['workstartup']->gotoBootKernel = "default-inherited";
+      $this->parent->by_object['workstartup']->gotoLdapServer = "default-inherited";
+      $this->parent->by_object['workstartup']->FAIdebianMirror= "inherited";
+    }
+  }
+}
+  // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index c8bc445e70d405f41617c1df638453a426b3669f..a943fc86c2b5ad0f7be5a182f3dfcdb4d405a7e6 100644 (file)
      </td>
     </tr>
    </table>
+{if $member_of_ogroup}
+   <br>
+   <br>
+   <br>
+   <input type='submit' name='inheritAll' value='{t}Inherit all{/t}'>
+{/if}
   </td>
   <td style="vertical-align:top;border-left:1px solid #A0A0A0;" >
    <table summary="">
index ed79e540718a73dbe4781137b9430496dad2a3a1..9caee6e777ee563c6d77a3b6b693f4f6379cea24 100644 (file)
      </td>
     </tr>
    </table>
+{if $member_of_ogroup}
+   <br>
+   <br>
+   <br>
+   <input type='submit' name='inheritAll' value='{t}Inherit all{/t}'>
+{/if}
   </td>
   <td  style="vertical-align:top;border-left:1px solid #A0A0A0;">
    <table summary="">