From 8e84f30814593846e71119eab763f2e5cfaf7a65 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 21 Nov 2006 12:27:12 +0000 Subject: [PATCH] Fixed Workstation template creation git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5178 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../systems/class_workstationGeneric.inc | 36 +++++++++++++------ plugins/admin/systems/workstation.tpl | 4 ++- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 507fbb452..93d9fb55d 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -320,7 +320,10 @@ class workgeneric extends plugin { /* Call common method to give check the hook */ $message= plugin::check(); - $message= array_merge($message, $this->netConfigDNS->check()); + + if($this->cn != "wdefault"){ + $message= array_merge($message, $this->netConfigDNS->check()); + } $ui= get_userinfo(); $this->dn= "cn=".$this->cn.",ou=workstations,ou=systems,".$this->base; @@ -337,21 +340,26 @@ class workgeneric extends plugin if ($this->orig_dn != $this->dn){ $ldap= $this->config->get_ldap_link(); $ldap->cd ($this->base); - $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn")); - if ($ldap->count() != 0){ - while ($attrs= $ldap->fetch()){ - if (preg_match ("/,ou=incoming,/", $ldap->getDN())){ - continue; - } else { - if ($attrs['dn'] != $this->orig_dn){ - $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); - break; + + if($this->cn == "wdefault"){ + $ldap->cat($this->dn); + }else{ + $ldap->search ("(&(cn=".$this->cn.")(objectClass=gotoWorkstation))", array("cn")); + if ($ldap->count() != 0){ + while ($attrs= $ldap->fetch()){ + if (preg_match ("/,ou=incoming,/", $ldap->getDN())){ + continue; + } else { + if ($attrs['dn'] != $this->orig_dn){ + $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn); + break; + } } } } } } - + /* Check for valid ntpServer selection */ if((!$this->inheritTimeServer) && (!count($this->gotoNtpServer))){ $message[]= _("There must be at least one NTP server selected, or the inherit mode activated."); @@ -436,6 +444,12 @@ class workgeneric extends plugin $this->handle_post_events("modify"); } } + + /* Set macAddress to '-' this indicates that this is a Workstation Template */ + if($this->cn == "wdefault"){ + $this->netConfigDNS->macAddress = "-"; + } + $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); show_ldap_error($ldap->get_error(), _("Saving workstation failed")); diff --git a/plugins/admin/systems/workstation.tpl b/plugins/admin/systems/workstation.tpl index b48817dd7..9d7786509 100644 --- a/plugins/admin/systems/workstation.tpl +++ b/plugins/admin/systems/workstation.tpl @@ -85,10 +85,12 @@ + +{if $cn neq 'wdefault'}

 

{$netconfig} - +{/if}

 

{t}Action{/t}

-- 2.30.2