From 331b53ece91518985f3f6885f0a00eb2e1fe337b Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 12 Jun 2007 12:39:33 +0000 Subject: [PATCH] Udpated Application copy & paste git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6571 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_applicationManagement.inc | 95 +++++++++++-------- .../applications/class_divListApplication.inc | 4 + 2 files changed, 62 insertions(+), 37 deletions(-) diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc index a340977ca..14c88b6e1 100644 --- a/plugins/admin/applications/class_applicationManagement.inc +++ b/plugins/admin/applications/class_applicationManagement.inc @@ -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(); diff --git a/plugins/admin/applications/class_divListApplication.inc b/plugins/admin/applications/class_divListApplication.inc index d667b7cac..e1e364362 100755 --- a/plugins/admin/applications/class_divListApplication.inc +++ b/plugins/admin/applications/class_divListApplication.inc @@ -179,6 +179,10 @@ class divListApplication extends MultiSelectWindow /* Multiple options */ $listhead .= "  "; + $listhead .= "  "; + $listhead .= "  "; $listhead .=""; -- 2.30.2