X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_terminalGeneric.inc;h=282693b3bd809aa222fadd9c7df6dbfc15ca854b;hb=b8358a5412b082ef08c36c441a85a4a651d84f7a;hp=3872b38242e3a26077814f9b704a4a571581c661;hpb=cae74ff85ac6cac888579a1a9de4ed9f3e961b7d;p=gosa.git diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 3872b3824..282693b3b 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -56,9 +56,9 @@ class termgeneric extends plugin "sysinfo" => "sysinfo"); - function termgeneric ($config, $dn= NULL) + function termgeneric ($config, $dn= NULL, $parent= NULL) { - plugin::plugin ($config, $dn); + plugin::plugin ($config, $dn, $parent); $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses); /* Read arrays */ foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){ @@ -275,18 +275,7 @@ class termgeneric extends plugin $tmp2 = array(); foreach($this->config->data['SERVERS']['NFS'] as $server){ if($server != "default"){ - $tmp = split("\|",$server); - $tmp3= split(":",$tmp[0]); - - $servername = $tmp3[0]; - $nfsname = $tmp3[1]; - - $path =""; - if(isset($tmp[4])){ - $path = $tmp[4]; - } - - $tmp2[$servername.":".$path]= $servername.":".$path; + $tmp2[$server]= $server; }else{ $tmp2[$server]="["._("inherited")."]"; } @@ -350,8 +339,10 @@ class termgeneric extends plugin } /* Save terminal path to parent since it is used by termstartup, too */ + if(isset($this->parent->by_object['termstartup'])){ $this->parent->by_object['termstartup']->gotoTerminalPath= $this->gotoTerminalPath; + } if(isset($_POST['termgeneric_posted'])){ if(isset($_POST["inheritTimeServer"])){ @@ -368,10 +359,13 @@ class termgeneric extends plugin { /* Call common method to give check the hook */ $message= plugin::check(); - $message= array_merge($message, $this->netConfigDNS->check()); + + if($this->cn != "default"){ + $message= array_merge($message, $this->netConfigDNS->check()); + } /* Permissions for that base? */ - $this->dn= "cn=".$this->cn."ou=terminals,ou=systems,".$this->base; + $this->dn= "cn=".$this->cn.",ou=terminals,ou=systems,".$this->base; $ui= get_userinfo(); $acl= get_permissions ($this->dn, $ui->subtreeACL); @@ -386,8 +380,16 @@ class termgeneric extends plugin if ($this->orig_dn == 'new'){ $ldap= $this->config->get_ldap_link(); - $ldap->cd ($this->base); - $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn")); + $ldap->cd ($this->config->current['BASE']); + + /* It is possible to have a 'default' terminal on every base */ + if($this->cn == "default"){ + $ldap->cat($this->dn); + }else{ + $ldap->search ("(&(objectClass=gotoTerminal)(cn=".$this->cn."))", array("cn")); + } + + /* Check if there are some other terminals found */ if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ if (preg_match ("/,ou=incoming,/", $ldap->getDN())){ @@ -414,12 +416,18 @@ class termgeneric extends plugin /* Save to LDAP */ function save() { + + /* Move object if requested */ + if( $this->orig_dn != 'new' && $this->dn != $this->orig_dn){ + $this->move($this->orig_dn, $this->dn); + } + plugin::save(); /* Strip out 'default' values */ foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){ - if ($this->attrs[$val] == "default"){ + if (!isset($this->attrs[$val]) || $this->attrs[$val] == "default"){ $this->attrs[$val]= array(); } } @@ -443,11 +451,9 @@ class termgeneric extends plugin $this->attrs= $attrs; } - if($this->inheritTimeServer){ - $this->attrs['gotoNtpServer'] = array(); - }else{ - /* Set ntpServers */ - $this->attrs['gotoNtpServer'] = array(); + /* Set ntpServers */ + $this->attrs['gotoNtpServer'] = array(); + if(!$this->inheritTimeServer){ foreach($this->gotoNtpServer as $server){ $this->attrs['gotoNtpServer'][] = $server; } @@ -464,18 +470,23 @@ class termgeneric extends plugin $ldap->cd($this->config->current['BASE']); $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn)); $ldap->cd($this->dn); + if (!count($this->attrs['gotoNtpServer'])){ + unset($this->attrs['gotoNtpServer']); + } $ldap->add($this->attrs); $this->handle_post_events("add"); } else { - if ($this->orig_dn != $this->dn){ - $this->move($this->orig_dn, $this->dn); - } $ldap->cd($this->dn); $this->cleanup(); $ldap->modify ($this->attrs); - $this->handle_post_events("modify"); } + + /* cn=default and macAddress=- indicates that this is a template */ + if($this->cn == "default"){ + $this->netConfigDNS->macAddress = "-"; + } + $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); show_ldap_error($ldap->get_error(), _("Saving terminal failed"));