From 8ec98080d0342565adc6385f8211ddd2aa961500 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 13 Jul 2007 07:33:44 +0000 Subject: [PATCH] Added inherit everything button to Terminal and Workstation generic git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6855 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_terminalGeneric.inc | 40 +++++++++++++++++++ .../systems/class_workstationGeneric.inc | 38 +++++++++++++++++- plugins/admin/systems/terminal.tpl | 6 +++ plugins/admin/systems/workstation.tpl | 6 +++ 4 files changed, 88 insertions(+), 2 deletions(-) diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 1526e213e..4337b6b7f 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -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: diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 70d3dfce9..294f8e537 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -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: ?> diff --git a/plugins/admin/systems/terminal.tpl b/plugins/admin/systems/terminal.tpl index c8bc445e7..a943fc86c 100644 --- a/plugins/admin/systems/terminal.tpl +++ b/plugins/admin/systems/terminal.tpl @@ -30,6 +30,12 @@ +{if $member_of_ogroup} +
+
+
+ +{/if} diff --git a/plugins/admin/systems/workstation.tpl b/plugins/admin/systems/workstation.tpl index ed79e5407..9caee6e77 100644 --- a/plugins/admin/systems/workstation.tpl +++ b/plugins/admin/systems/workstation.tpl @@ -37,6 +37,12 @@
+{if $member_of_ogroup} +
+
+
+ +{/if} -- 2.30.2