Code

Reimplemented Terminal-Template functionality
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 21 Nov 2006 12:00:29 +0000 (12:00 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 21 Nov 2006 12:00:29 +0000 (12:00 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@5176 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/class_terminalGeneric.inc
plugins/admin/systems/terminal.tpl

index 90337b89c1564afdbb8c317e890b4964c5a9a241..4fb90cd28898526e1cafb5e37e3ae51b52a43e95 100644 (file)
@@ -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);
     }
 
index 72e8cc5784434d0352d2b37c8d0dab4dda7a0643..282693b3bd809aa222fadd9c7df6dbfc15ca854b 100644 (file)
@@ -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"));
index 152c9dc19ccc922f74e61ea71d0784ddfda0a288..5913ba2b8ba799f224b90c69826108b0ddfb5948 100644 (file)
   </td>
  </tr>
 </table>
-<p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
 
+{if $cn neq 'default'}
+<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>