Code

Updated mimetype copy & paste
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 13 Jun 2007 09:44:32 +0000 (09:44 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 13 Jun 2007 09:44:32 +0000 (09:44 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6575 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_divListFai.inc
plugins/admin/fai/class_faiManagement.inc
plugins/admin/mimetypes/class_divListMimeTypes.inc
plugins/admin/mimetypes/class_mimetypeGeneric.inc
plugins/admin/mimetypes/class_mimetypeManagement.inc

index 6bbc8b9c45e1433dcd0f9461b248272d0c072c94..7be1906dbf7d85e237d638f2122096d5b699bf3f 100644 (file)
@@ -211,6 +211,15 @@ class divListFai extends MultiSelectWindow
     $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/edittrash.png'
         title='"._("Remove selected fai objects")."' alt='"._("Remove fai objects")."' name='remove_multiple_fai_objects'>&nbsp;";
 
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler)){
+      $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcopy.png'
+        title='"._("Copy selected objects")."' alt='"._("Copy fai objects")."' name='multiple_copy_fai'>&nbsp;";
+      $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcut.png'
+        title='"._("cut selected objects")."' alt='"._("Cut fai objects")."' name='multiple_cut_fai'>&nbsp;";
+      $listhead .= "</div>";
+    }
+
     $listhead .="</div>";;
 
 
index 52a9bbd122956820a166ad816599cef522a552b6..e95dc01c3ce685d2866f443ac2aa41faccffb344 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){
index 6ee3469aef97d478c14906eb33a75a1ad365378f..87b7bbaa4524b4e7c499c026164720767303b1b7 100755 (executable)
@@ -190,6 +190,14 @@ class divListMimeTypes extends MultiSelectWindow
     $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/edittrash.png'
         title='"._("Remove selected mimetype")."' alt='"._("Remove mimetype")."' name='remove_multiple_mimetypes'>&nbsp;";
 
+    /* Add multiple copy & cut icons */
+    if(is_object($this->parent->CopyPasteHandler)){
+      $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcopy.png'
+        title='"._("Copy selected object")."' alt='"._("Copy object")."' name='multiple_copy_mimetypes'>&nbsp;";
+      $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcut.png'
+        title='"._("cut selected object")."' alt='"._("Cut object")."' name='multiple_cut_mimetypes'>&nbsp;";
+    }
+
     $listhead .="</div>";;
 
     $this->SetListHeader($listhead);
index 22b56bc94b123a13911905379c68c889bb7e0e83..df8c0d839f35ac9e679658e3b905c57cad787197 100644 (file)
@@ -704,8 +704,15 @@ class mimetype extends plugin
   function PrepareForCopyPaste($source)
   {
     plugin::PrepareForCopyPaste($source);
-    $this->gotoMimeIcon       = $this->iconData;
-    $this->use_gotoMimeIcon   = $source->use_gotoMimeIcon;
+
+    $source_o = new mimetype($this->config,$source['dn'],$this->parent);
+
+    foreach(array("gotoMimeEmbeddedApplication","gotoMimeApplication","gotoMimeFilePattern","use_gotoMimeFilePattern") as $name){
+      $this->$name = $source_o->$name;
+    } 
+    foreach($this->attributes as $name){
+      $this->$name = $source_o->$name;
+    } 
   }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 4955d2fe7677f72c5a0fa187469c9730ee5161f0..793d7696155693870df2fd4d76fb20da8c7d3b6f 100755 (executable)
@@ -33,6 +33,8 @@ class mimetypeManagement extends plugin
   var $mimetabs                       = NULL;
   var $snapDialog                     = NULL;
   var $CopyPasteHandler               = NULL;
+  var $start_pasting_copied_objects = FALSE;
+
 
   function mimetypeManagement ($config, $ui)
   {
@@ -131,6 +133,10 @@ class mimetypeManagement extends plugin
         $s_action="del_multiple";
       }elseif(preg_match("/^editPaste.*/i",$key)){
         $s_action="editPaste";
+      }elseif(preg_match("/^multiple_copy_mimetypes/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_mimetypes/",$key)){
+        $s_action = "cut_multiple";
       }
     }
 
@@ -146,12 +152,10 @@ class mimetypeManagement extends plugin
       Copy & Paste handling  
      ****************/
 
-    /* Only perform copy / paste if it is enabled 
-     */
-    if($this->CopyPasteHandler){
-      if($str = $this->copyPasteHandling($s_action,$s_entry)){
-       return($str);
-      };
+    /* Display the copy & paste dialog, if it is currently open */
+    $ret = $this->copyPasteHandling_from_queue($s_action,$s_entry);
+    if($ret){
+      return($ret);
     }
 
 
@@ -518,51 +522,70 @@ class mimetypeManagement extends plugin
   }
 
 
-  function copyPasteHandling($s_action,$s_entry)
+  function copyPasteHandling_from_queue($s_action,$s_entry)
   {
-    /* Paste copied/cutted object in here
-     */
-    if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
-      $this->CopyPasteHandler->save_object();
-      $this->CopyPasteHandler->SetVar("base", $this->DivListMimeTypes->selectedBase);
-
-      if($str = $this->CopyPasteHandler->execute()) {
-        return($str);
-      }
+    /* Check if Copy & Paste is disabled */
+    if(!is_object($this->CopyPasteHandler)){
+      return("");
     }
 
-    /* Copy current object to CopyHandler
-     */
-    if($s_action == "copy"){
-      $this->CopyPasteHandler->Clear();
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
+
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->mimetypes[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"mimetabs","MIMETABS","mimetypes");
+    }
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
 
-      /* Check acls */
-      $acl_all= $this->ui->has_complete_category_acls($dn,"mimetypes");
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $obj    = new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn,"mimetypes");
-        $obj->set_acl_base($this->dn);
-        $objNew = new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], "new","mimetypes");
-        $objNew->set_acl_base($this->dn);
-        $this->CopyPasteHandler->Copy($obj,$objNew);
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
+
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->mimetypes[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","mimetabs","MIMETABS","mimetypes");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","mimetabs","MIMETABS","mimetypes");
+        }
       }
     }
 
-    /* Copy current object to CopyHandler
-     */
-    if($s_action == "cut"){
-      $this->CopyPasteHandler->Clear();
-      $dn = $this->mimetypes[$s_entry]['dn'];
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
+
+    /* Return C&P dialog */
+    if($this->start_pasting_copied_objects && $this->CopyPasteHandler->entries_queued()){
+
+      /* Load entry from queue and set base */
+      $this->CopyPasteHandler->load_entry_from_queue();
+      $this->CopyPasteHandler->SetVar("base",$this->DivListMimeTypes->selectedBase);
 
-      /* Check acls */
-      $acl_all= $this->ui->has_complete_category_acls($dn,"mimetypes");
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $obj = new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn);
-        $this->CopyPasteHandler->Cut($obj);
+      /* Get dialog */
+      $data = $this->CopyPasteHandler->execute();
+
+      /* Return dialog data */
+      if(!empty($data)){
+        return($data);
       }
     }
+
+    /* Automatically disable status for pasting */
+    if(!$this->CopyPasteHandler->entries_queued()){
+      $this->start_pasting_copied_objects = FALSE;
+    }
+    return("");
   }
 
+
   /* Check if the release management is activated. */
   function IsReleaseManagementActivated()
   {