Code

Fixed problem with not clickable buttons in fai package error msgs
[gosa.git] / plugins / admin / fai / class_faiManagement.inc
index a3b4d5f4e114574733b7a228e7795941b504bf84..1922b2aadf0e27d2ce4033b9dec16bf8a9eef020 100644 (file)
@@ -56,6 +56,8 @@ class faiManagement extends plugin
   var $dispNewFreeze= false;
 
   var $DivListFai;
+  var $start_pasting_copied_objects = FALSE;
+  var $CopyPasteHandler = FALSE;
 
        /* construction/reconstruction 
         */
@@ -100,7 +102,8 @@ class faiManagement extends plugin
                     "/create_variable/i"=>"new_variable",  "/create_template/i"=>"new_template",
                     "/create_package/i"=>"new_package",    "/create_profile/i"=>"new_profile",
                     "/edit_continue/"=>"select_class_name_finished",
-  
+                    "/^multiple_copy_fai/" => "copy_multiple", 
+                    "/^multiple_cut_fai/" => "cut_multiple", 
                     "/^remove_multiple_fai_objects/" => "del_multiple");
 
                foreach($_POST as $name => $value){
@@ -199,7 +202,11 @@ class faiManagement extends plugin
         $dns_names .="</pre>";
 
         /* Lock the current entry, so nobody will edit it during deletion */
-        $smarty->assign("warning",     sprintf(_("You're about to delete the following fai object(s) %s"), @LDAP::fix($dns_names)));
+        if (count($this->dns) == 1){
+          $smarty->assign("warning",     sprintf(_("You're about to delete the following entry %s"), @LDAP::fix($dns_names)));
+        } else {
+          $smarty->assign("warning",     sprintf(_("You're about to delete the following entries %s"), @LDAP::fix($dns_names)));
+        }
         $smarty->assign("multiple", true);
         return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
       }
@@ -230,14 +237,12 @@ class faiManagement extends plugin
           $this->dialog->set_acl_base($dn);
           $this->dialog->by_object[$type[1]]->remove_from_parent ();
           unset ($this->dialog);
-          gosa_log ("FAI class '".$dn."' has been tagged as removed");
           $this->dialog= NULL;
           $to_del = clean_up_releases($dn);
           save_release_changes_now();
 
           foreach($to_del as $dn){
             $ldap->rmdir_recursive($dn);
-            gosa_log(sprintf(_("Release cleanup : Removing object (tagged as remvoed) that is no longer in use '%s'."),$dn));
           }
 
         } else {
@@ -245,8 +250,7 @@ class faiManagement extends plugin
           /* Normally this shouldn't be reached, send some extra
              logs to notify the administrator */
           print_red (_("You are not allowed to delete this component!"));
-          gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
-              "deletion.");
+          new log("security","fai/".get_class($this),$dn,array(),"Tried to trick deletion.");
         }
 
         /* Remove lock file after successfull deletion */
@@ -284,44 +288,45 @@ class faiManagement extends plugin
      ****************/
 
                /* Deltetion was confirmed, so delete this entry
-                */
-               if (isset($_POST['delete_terminal_confirm'])){
+     */
+    if (isset($_POST['delete_terminal_confirm'])){
 
-                       /* Some nice guy may send this as POST, so we've to check
-                          for the permissions again. */
+      /* Some nice guy may send this as POST, so we've to check
+         for the permissions again. */
 
       /* Find out more about the object type */
       $ldap      = $this->config->get_ldap_link();
       $ldap->cat($this->dn, array('objectClass'));
-      $attrs   = $ldap->fetch();
-      $type      = $this->get_type($attrs);                    
+      if($ldap->count()){
+        $attrs = $ldap->fetch();
+        $type    = $this->get_type($attrs);                    
 
-      $acl  = $this->ui->get_permissions($this->dn,"fai/".$type[1]);
-      if(preg_match("/d/",$acl)){
+        $acl  = $this->ui->get_permissions($this->dn,"fai/".$type[1]);
+        if(preg_match("/d/",$acl)){
 
-        $this->dialog = new $type[0]($this->config,    $this->config->data['TABS'][$type[2]], $this->dn,"fai");
-        $this->dialog->set_acl_base($this->dn);
-        $this->dialog->by_object[$type[1]]->remove_from_parent ();
-        unset ($this->dialog);
-        gosa_log ("FAI class '".$this->dn."' has been tagged as removed");
-        $this->dialog= NULL;
-        $to_del = clean_up_releases($this->dn);
-        save_release_changes_now();
+          $this->dialog = new $type[0]($this->config,  $this->config->data['TABS'][$type[2]], $this->dn,"fai");
+          $this->dialog->set_acl_base($this->dn);
+          $this->dialog->by_object[$type[1]]->remove_from_parent ();
+          unset ($this->dialog);
+          $this->dialog= NULL;
+          $to_del = clean_up_releases($this->dn);
+          save_release_changes_now();
 
-        foreach($to_del as $dn){
-          $ldap->rmdir_recursive($dn);
-          gosa_log(sprintf(_("Release cleanup : Removing object (tagged as remvoed) that is no longer in use '%s'."),$dn));
-        }
+          foreach($to_del as $dn){
+            $ldap->rmdir_recursive($dn);
+          }
 
-      } else {
+        } else {
 
-        /* Normally this shouldn't be reached, send some extra
-           logs to notify the administrator */
-        print_red (_("You are not allowed to delete this component!"));
-        gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
-            "deletion.");
-      }
+          /* Normally this shouldn't be reached, send some extra
+             logs to notify the administrator */
+          print_red (_("You are not allowed to delete this component!"));
+          new log("security","fai/".get_class($this),$dn,array(),"Tried to trick deletion.");
+        }
 
+      }else{
+        print_red(sprintf(_("Object could not be deleted '%s', object does not exist."),$this->dn));
+      }
       /* Remove lock file after successfull deletion */
       del_lock ($this->dn);
     }
@@ -404,6 +409,8 @@ class faiManagement extends plugin
         $this->lock_name   = $name;
         $this->lock_dn     = $bb;
         $this->postremove();
+
+        new log("remove","fai/".get_class($this),$br[$bb],array(),"Release removed");
       }
     }
 
@@ -509,6 +516,7 @@ class faiManagement extends plugin
           <body style="background: none;margin:3px;color:black">
           ';
 
+        new log("create","fai/".get_class($this),$NewReleaseName,array(),"New $type created");
 
         /* Duplicate applications 
          */
@@ -524,7 +532,7 @@ class faiManagement extends plugin
          */
         $ldap->cat($mimesrc,array("dn")) ;
         if($ldap->count()){
-          $ldap->cd ($appdst);
+          $ldap->cd ($mimedst);
           $ldap->recursive_remove();
           $ldap->cd ($this->config->current['BASE']);
           $ldap->copy_FAI_resource_recursive($mimesrc,$mimedst,$NewReleaseName,$type,true);