X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_terminalGeneric.inc;h=66500df3464b8721d69cf4b2b7e56a95d7551b39;hb=c30fdf675865a86365275ed6fb9f8a0cc06e41af;hp=205415f09d0ef7232f518fb2b70bf593b8b4f8fb;hpb=0db1c9fefb0384c02ee6b650e681f012d9d574fe;p=gosa.git diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 205415f09..66500df34 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -2,11 +2,6 @@ class termgeneric extends plugin { - /* CLI vars */ - var $cli_summary= "Manage terminal base objects"; - var $cli_description= "Some longer text\nfor help"; - var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser"); - /* Generic terminal attributes */ var $gotoMode= "disabled"; var $gotoTerminalPath= ""; @@ -57,6 +52,8 @@ class termgeneric extends plugin var $fai_activated = FALSE; + var $member_of_ogroup = FALSE; + function termgeneric ($config, $dn= NULL, $parent= NULL) { /* Check if FAI is activated */ @@ -66,6 +63,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){ @@ -93,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){ @@ -117,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; @@ -289,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")."]"; + } } } @@ -313,6 +325,9 @@ class termgeneric extends plugin $smarty->assign("netconfig", $this->netConfigDNS->execute()); $smarty->assign("fai_activated",$this->fai_activated); $smarty->assign("actionACL", chkacl($this->acl, 'action')); + + $smarty->assign("member_of_ogroup",$this->member_of_ogroup); + return($smarty->fetch (get_template_path('terminal.tpl', TRUE))); } @@ -329,7 +344,7 @@ class termgeneric extends plugin show_ldap_error($ldap->get_error(), _("Removing terminal failed")); /* Optionally execute a command after we're done */ - $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress)); + $this->handle_post_events("remove",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); /* Delete references to object groups */ $ldap->cd ($this->config->current['BASE']); @@ -348,6 +363,7 @@ class termgeneric extends plugin { plugin::save_object(); $this->netConfigDNS->save_object(); + /* Save base, since this is no LDAP attribute */ if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){ $this->base= $_POST['base']; @@ -360,12 +376,17 @@ 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; } } + + if(isset($_POST["inheritAll"])){ + $this->set_everything_to_inherited(); + } + } @@ -490,12 +511,12 @@ class termgeneric extends plugin unset($this->attrs['gotoNtpServer']); } $ldap->add($this->attrs); - $this->handle_post_events("add"); + $this->handle_post_events("add",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); } else { $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); - $this->handle_post_events("modify"); + $this->handle_post_events("modify",array("macAddress" => $this->netConfigDNS->macAddress,"ipHostNumber" => $this->netConfigDNS->ipHostNumber)); } /* cn=default and macAddress=- indicates that this is a template */ @@ -506,9 +527,29 @@ class termgeneric extends plugin $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); show_ldap_error($ldap->get_error(), _("Saving terminal failed")); + } + - /* Optionally execute a command after we're done */ - $this->postcreate(); + 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","gotoXMouseport") 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"; + } } }