Code

Added new group C&P
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jun 2007 07:29:08 +0000 (07:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jun 2007 07:29:08 +0000 (07:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6567 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/class_divListGroup.inc
plugins/admin/groups/class_groupApplication.inc
plugins/admin/groups/class_groupManagement.inc

index c578000169845f00249a249bb405d52529b35531..53e38f59eeeade32529650fe3cf389cf11186d0e 100644 (file)
@@ -185,7 +185,10 @@ class divListGroup extends MultiSelectWindow
     /* Multiple options */
     $listhead .= "&nbsp;<input class='center' type='image' align='middle' src='images/edittrash.png'
         title='"._("Remove selected groups")."' alt='"._("Remove groups")."' name='remove_multiple_groups'>&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>";
     $this->SetListHeader($listhead);
   }
index cee95e213e33d6a900f9ac05d993e986a68150d1..7bbb1b803f311653bf913525160801e556aedd96 100644 (file)
@@ -1179,10 +1179,11 @@ class appgroup extends plugin
 
   function PrepareForCopyPaste($source)
   {
-    $this->FAIrelease = $this->InitialFAIrelease = $source->FAIrelease;
-    $this->gosaMemberApplication = $source->gosaMemberApplication;
-    $this->appoption = $source->appoption;
-    $this->Categories = $source->Categories;
+    $s = new appgroup($this->config,$source['dn']);
+    $this->FAIrelease = $this->InitialFAIrelease = $s->FAIrelease;
+    $this->gosaMemberApplication = $s->gosaMemberApplication;
+    $this->appoption = $s->appoption;
+    $this->Categories = $s->Categories;
   }
 
 
index de6a7fb56ad7de77806e33a394595e63ac1bc955..2e5aaa0cd45716e3dc3b4de42ac7353288a62b7b 100644 (file)
@@ -32,6 +32,7 @@ class groupManagement extends plugin
   var $CopyPasteHandler   = NULL;
   var $DivListGroup       = NULL;
   var $ShowPrimaryCheckBox= false; 
+  var $start_pasting_copied_objects = FALSE;
 
   function groupManagement ($config, $ui)
   {
@@ -108,6 +109,10 @@ class groupManagement extends plugin
         $s_entry  = preg_replace("/^cut_/i","",$key);
       }elseif(preg_match("/^remove_multiple_groups/",$key)){
         $s_action="del_multiple";
+      }elseif(preg_match("/^multiple_copy_groups/",$key)){
+        $s_action = "copy_multiple";
+      }elseif(preg_match("/^multiple_cut_groups/",$key)){
+        $s_action = "cut_multiple";
       }
     }
     $s_entry  = preg_replace("/_.$/","",$s_entry); 
@@ -124,12 +129,10 @@ class groupManagement extends plugin
       Copy & Paste Handling  ...
      ********************/
 
-    /* Only perform copy&paste requests 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);
+    if($ret){
+      return($ret);
     }
 
 
@@ -592,65 +595,59 @@ class groupManagement extends plugin
   }
 
 
-
-  /* Perform copy & paste requests
-     If copy&paste is in progress this returns a dialog to fix required attributes 
-   */ 
-  function copyPasteHandling($s_action,$s_entry)
+  function copyPasteHandling_from_queue($s_action)
   {
-    /* Paste copied/cutted object in here
-     */
-    if(($s_action == "editPaste") || ($this->CopyPasteHandler->stillOpen())){
-      $this->CopyPasteHandler->save_object();
-      $this->CopyPasteHandler->SetVar("base",$this->DivListGroup->selectedBase);
-      if($str = $this->CopyPasteHandler->execute()){
-        return( $str);
-      };
-      /* Ensure that the new object is shown in the list now */
-      $this->reload();
-    }
-
 
-    /* Copy current object to CopyHandler
-     */
-    if($s_action == "copy"){
+    /* Add entries to queue */
+    if($s_action == "copy_multiple" || $s_action == "cut_multiple"){
 
-      $dn  = $this->grouplist[trim($s_entry)]['dn'];
-      $ui = get_userinfo();
-      $acl_all  = $ui->has_complete_category_acls($this->DivListGroup->selectedBase,"groups") ;
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
+      /* Cleanup object queue */
+      $this->CopyPasteHandler->cleanup_queue();
 
-        $this->CopyPasteHandler->Clear();
-        $obj    = new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn);
-        $obj->set_acl_base($dn);
-        $objNew = new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], "new");
-        $objNew->set_acl_base($dn);
+      /* Add new entries to CP queue */
+      foreach($this->list_get_selected_items() as $id){
+        $dn = $this->grouplist[$id]['dn'];
 
-        $this->CopyPasteHandler->Copy($obj,$objNew);
-      }else{
-        print_red("You are not allowed to copy this entry.");
+        if($s_action == "copy_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"copy","grouptabs","GROUPTABS","groups");
+        }
+        if($s_action == "cut_multiple"){
+          $this->CopyPasteHandler->add_to_queue($dn,"cut","grouptabs","GROUPTABS","groups");
+        }
       }
     }
 
+    /* Start pasting entries */
+    if($s_action == "editPaste"){
+      $this->start_pasting_copied_objects = TRUE;
+    }
 
-    /* Copy current object to CopyHandler
-     */
-    if($s_action == "cut"){
-      
-      $dn = $this->grouplist[trim($s_entry)]['dn'];
-      $acl_all  = $ui->has_complete_category_acls($this->selectedBase,"groups") ;
-      if(preg_match("/(c.*w|w.*c)/",$acl_all)){
-
-        $this->CopyPasteHandler->Clear();
-        $obj= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $dn);
-        $obj->set_acl_base($dn);
-        $this->CopyPasteHandler->Cut($obj);
-      }else{
-        print_red("You are not allowed to cut this entry.");
+    /* 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->DivListGroup->selectedBase);
+
+      /* 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("");
   }
 
+
+
+
   /* Save data to object */
   function save_object()
   {