Code

Added remove and activate script button
[gosa.git] / include / class_CopyPasteHandler.inc
index 446c7f244a0633b70108b4b235ec0ad7aff49183..afb2a117ec147840cf00c55b04a2e4a639b476e8 100644 (file)
@@ -55,6 +55,12 @@ class CopyPasteHandler {
     $this->copyCurrent = true;
     $this->objectdn    = $obj->dn;
     $this->current = $emptyObj;
+
+    if(!isset($obj->by_object)){
+      trigger_error("No valid tab object specified for copy & paste.");
+      return;
+    }
+    
     foreach($obj->by_object as $name => $obj){
     
       /* Prepare every single class, to be copied  */
@@ -125,6 +131,18 @@ class CopyPasteHandler {
      */
     if($this->cutCurrent){
 
+      if(isset($_POST['PerformCopyPaste'])){
+        $msgs = $this->check();        
+        if(count ($msgs) ){
+          foreach( $msgs as $msg){
+            print_red($msg);
+          }
+        }else{
+          $this->current->save();
+          $this->dialogOpen =false;
+          $this->Clear();
+        }
+      }
       if($this->current){
         $smarty = get_smarty();
         $smarty->assign("type","cut");
@@ -136,11 +154,6 @@ class CopyPasteHandler {
         return($smarty->fetch(get_template_path("copyPasteDialog.tpl",FALSE)));
       }
 
-      if(isset($_POST['PerformCopyPaste'])){
-        $this->current->save();
-        $this->dialogOpen =false;
-        $this->Clear();
-      }
       /* Copy & paste
        */
     }else{