From 1c251597bd621f9fa01029ca62ae968a754a4a34 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 21 Nov 2006 12:00:29 +0000 Subject: [PATCH] Reimplemented Terminal-Template functionality git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5176 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_printGeneric.inc | 2 +- .../admin/systems/class_terminalGeneric.inc | 27 +++++++++++++++---- plugins/admin/systems/terminal.tpl | 4 ++- 3 files changed, 26 insertions(+), 7 deletions(-) diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 90337b89c..4fb90cd28 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -64,7 +64,7 @@ class printgeneric extends plugin } /* Update dn, to ensure storing as printer instead of WS / terminal */ - if($this->BelongsTo == "Terminal"){ + if($this->BelongsTo == "Terminal" || $this->BelongsTo == "TerminalTemplate"){ $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn); } diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 72e8cc578..282693b3b 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -359,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); @@ -377,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())){ @@ -410,7 +421,7 @@ class termgeneric extends plugin if( $this->orig_dn != 'new' && $this->dn != $this->orig_dn){ $this->move($this->orig_dn, $this->dn); } - + plugin::save(); /* Strip out 'default' values */ @@ -470,6 +481,12 @@ class termgeneric extends plugin $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")); diff --git a/plugins/admin/systems/terminal.tpl b/plugins/admin/systems/terminal.tpl index 152c9dc19..5913ba2b8 100644 --- a/plugins/admin/systems/terminal.tpl +++ b/plugins/admin/systems/terminal.tpl @@ -107,9 +107,11 @@ -

 

+{if $cn neq 'default'} +

 

{$netconfig} +{/if}

 

{t}Action{/t}

-- 2.30.2