Code

Updated sieve filter styles.
[gosa.git] / include / class_CopyPasteHandler.inc
index 5336f57c7bde328bb71732b783851d99db38b0a7..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  */
@@ -124,9 +130,29 @@ class CopyPasteHandler {
     /* Cut & paste
      */
     if($this->cutCurrent){
-      $this->current->save();
-      $this->dialogOpen =false;
-      $this->Clear();
+
+      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");
+        $smarty->assign("Complete",false);
+        $smarty->assign("AttributesToFix"," ");
+        $smarty->assign("SubDialog",$this->current->SubDialog);
+        $smarty->assign("objectDN"     ,$this->objectdn);
+        $smarty->assign("message", sprintf(_("You are going to paste the cutted entry '%s'."), $this->objectdn));
+        return($smarty->fetch(get_template_path("copyPasteDialog.tpl",FALSE)));
+      }
 
       /* Copy & paste
        */
@@ -139,17 +165,19 @@ class CopyPasteHandler {
           }
         }else{
           $this->current->save();
+          $this->lastdn = $this->current->dn;
           $this->dialogOpen =false;
           $this->Clear();
         }
       }
       if($this->current){
         $smarty = get_smarty();        
+        $smarty->assign("type","copy");
         $smarty->assign("Complete",false);
         $smarty->assign("AttributesToFix",$this->generateAttributesToFix());   
         $smarty->assign("SubDialog",$this->current->SubDialog);
         $smarty->assign("objectDN"              ,$this->objectdn);     
-        $smarty->assign("message", sprintf(_("You are going to copy the entry '%s'."), $this->objectdn));      
+        $smarty->assign("message", sprintf(_("You are going to paste the copied entry '%s'."), $this->objectdn));      
         return($smarty->fetch(get_template_path("copyPasteDialog.tpl",FALSE)));
       }
     }