Code

Fixed Workstation template creation
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 21 Nov 2006 12:27:12 +0000 (12:27 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 21 Nov 2006 12:27:12 +0000 (12:27 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5178 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_workstationGeneric.inc
plugins/admin/systems/workstation.tpl

index 507fbb4523fa7b89a1673a4fcf42ee06785778b3..93d9fb55dbb86e3adc81f3751803d12b3d33fe7e 100644 (file)
@@ -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"));
index b48817dd7945960698d5a5aa4b9f5bdbf8125d15..9d7786509d4d4b22593cdf8a97686e4d9b731b36 100644 (file)
   </td>
  </tr>
 </table>
+
+{if $cn neq 'wdefault'}
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 
 {$netconfig}
-
+{/if}
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 <h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
 <table summary="">