Code

Added a first set of reference changes - nearly untested
[gosa.git] / plugins / admin / systems / class_servGeneric.inc
index d44b6763b8cb800dce8859222f7f59bb71f3dfcb..116628786e14a2ee21968b3b5ab93cf7199d682c 100644 (file)
@@ -40,7 +40,7 @@ class servgeneric extends plugin
   var $fai_activated  =FALSE;
   var $view_logged = FALSE;
 
-  function servgeneric ($config, $dn= NULL, $parent= NULL)
+  function servgeneric (&$config, $dn= NULL, $parent= NULL)
   {
     /* Check if FAI is activated */
     $tmp = search_config($config->data,"faiManagement","CLASS");
@@ -297,7 +297,7 @@ class servgeneric extends plugin
       if ($ldap->count() != 0){
         while ($attrs= $ldap->fetch()){
           if ($attrs['dn'] != $this->orig_dn){
-            if(!preg_match("/,ou=incoming,/",$attrs['dn'])){
+            if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,ou=incoming,/",$attrs['dn']) && preg_match("/,ou=servers,ou=systems,/",$attrs['dn'])){
               $message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
               break;
             }
@@ -341,12 +341,12 @@ class servgeneric extends plugin
       /* cn is not case sensitive for ldap, but for php it is!! */ 
       if($this->config->current['DNMODE'] == "cn"){
         if (strtolower($this->orig_dn) != (strtolower($this->dn))){
-          $this->move($this->orig_dn, $this->dn);
+          $this->recursive_move($this->orig_dn, $this->dn);
           plugin::save();
         }
       }else{
         if ($this->orig_dn != $this->dn){
-          $this->move($this->orig_dn, $this->dn);
+          $this->recursive_move($this->orig_dn, $this->dn);
           plugin::save();
         }
       }
@@ -369,6 +369,44 @@ class servgeneric extends plugin
   }
 
 
+  /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","server");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+  
+  function PrepareForCopyPaste($source)  
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+
+  }
+  
+
+
   /* Return plugin informations for acl handling */ 
   function plInfo()
   {
@@ -380,7 +418,7 @@ class servgeneric extends plugin
           "plPriority"    => 1,
           "plSection"     => array("administration"),           
           "plCategory"    => array("server" => array("description"  => _("Server"),
-                                                     "objectClass"  => "gotoWorkstation")),
+                                                     "objectClass"  => "goServer")),
           "plProvidedAcls"=> array(
             "cn"           => _("Name"),
             "description"  => _("Description"),