Code

Udpated Application copy & paste
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jun 2007 12:39:33 +0000 (12:39 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jun 2007 12:39:33 +0000 (12:39 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6571 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/applications/class_applicationManagement.inc
plugins/admin/applications/class_divListApplication.inc

index a340977ca8e09cb7542f9346828f1f9444a856b1..14c88b6e16d490106e7d22eb97f8c429c8adccb2 100644 (file)
@@ -32,6 +32,7 @@ class applicationManagement extends plugin
   var $DivListApplication       = NULL;
   var $applications             = array();
   var $enableReleaseManagement  = false;
+  var $start_pasting_copied_objects = FALSE;
 
   function IsReleaseManagementActivated()
   {
@@ -136,6 +137,10 @@ class applicationManagement extends plugin
         $s_action="del_multiple";
       }elseif(preg_match("/^editPaste.*/i",$key)){
         $s_action="editPaste";
+      }elseif(preg_match("/^multiple_copy_groups/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_groups/",$key)){
+        $s_action = "cut_multiple";
       }
     }
 
@@ -151,12 +156,10 @@ class applicationManagement 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,49 +521,67 @@ class applicationManagement 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->DivListApplication->selectedBase);
-
-      if($str = $this->CopyPasteHandler->execute()) {
-        return($str);
-      }
-    }
+    /* Add a single entry to queue */
+    if($s_action == "cut" || $s_action == "copy"){
 
-    /* Copy current object to CopyHandler
-     */
-    if($s_action == "copy"){
-      $this->CopyPasteHandler->Clear();
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
       $dn = $this->applications[$s_entry]['dn'];
+      $this->CopyPasteHandler->add_to_queue($dn,$s_action,"apptabs","APPSTABS","application");
+    }
+
+
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
 
-      /* Check Acls */
-      $acl_all= $this->ui->has_complete_category_acls($dn,"application");  
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $obj    = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn,  "application");
-        $objNew = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], "new","application");
-        $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->applications[$id]['dn'];
+
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","apptabs","APPSTABS","application");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","apptabs","APPSTABS","application");
+        }
       }
     }
 
-    /* Copy current object to CopyHandler
-     */
-    if($s_action == "cut"){
-      $this->CopyPasteHandler->Clear();
-      $dn = $this->applications[$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->DivListApplication->selectedBase);
 
-      /* Check Acls */
-      $acl_all= $this->ui->has_complete_category_acls($dn,"application");  
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-        $obj = new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn, "application");
-        $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("");
   }
 
+
   function list_get_selected_items()
   {
     $ids = array();
index d667b7cac9e41a9a753e9ae4ba6c92142bcac3c1..e1e364362b5c0ce186b077bd183795d96ed6d160 100755 (executable)
@@ -179,6 +179,10 @@ class divListApplication extends MultiSelectWindow
         /* Multiple options */
     $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/edittrash.png'
         title='"._("Remove selected applications")."' alt='"._("Remove applications")."' name='remove_multiple_applications'>&nbsp;";
+    $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcopy.png'
+        title='"._("Copy selected group")."' alt='"._("Copy groups")."' name='multiple_copy_groups'>&nbsp;";
+    $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/editcut.png'
+        title='"._("cut selected group")."' alt='"._("Cut groups")."' name='multiple_cut_groups'>&nbsp;";
 
     $listhead .="</div>";