From 9a7f2e66b886489c9842f66000298394262ebd0b Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 13 Jun 2007 09:44:32 +0000 Subject: [PATCH] Updated mimetype copy & paste git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6575 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_divListFai.inc | 9 ++ plugins/admin/fai/class_faiManagement.inc | 5 +- .../mimetypes/class_divListMimeTypes.inc | 8 ++ .../admin/mimetypes/class_mimetypeGeneric.inc | 11 ++- .../mimetypes/class_mimetypeManagement.inc | 99 ++++++++++++------- 5 files changed, 91 insertions(+), 41 deletions(-) diff --git a/plugins/admin/fai/class_divListFai.inc b/plugins/admin/fai/class_divListFai.inc index 6bbc8b9c4..7be1906db 100644 --- a/plugins/admin/fai/class_divListFai.inc +++ b/plugins/admin/fai/class_divListFai.inc @@ -211,6 +211,15 @@ class divListFai extends MultiSelectWindow $listhead .= "  "; + /* Add multiple copy & cut icons */ + if(is_object($this->parent->CopyPasteHandler)){ + $listhead .= "  "; + $listhead .= "  "; + $listhead .= ""; + } + $listhead .="";; diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 52a9bbd12..e95dc01c3 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -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){ diff --git a/plugins/admin/mimetypes/class_divListMimeTypes.inc b/plugins/admin/mimetypes/class_divListMimeTypes.inc index 6ee3469ae..87b7bbaa4 100755 --- a/plugins/admin/mimetypes/class_divListMimeTypes.inc +++ b/plugins/admin/mimetypes/class_divListMimeTypes.inc @@ -190,6 +190,14 @@ class divListMimeTypes extends MultiSelectWindow $listhead .= "  "; + /* Add multiple copy & cut icons */ + if(is_object($this->parent->CopyPasteHandler)){ + $listhead .= "  "; + $listhead .= "  "; + } + $listhead .="";; $this->SetListHeader($listhead); diff --git a/plugins/admin/mimetypes/class_mimetypeGeneric.inc b/plugins/admin/mimetypes/class_mimetypeGeneric.inc index 22b56bc94..df8c0d839 100644 --- a/plugins/admin/mimetypes/class_mimetypeGeneric.inc +++ b/plugins/admin/mimetypes/class_mimetypeGeneric.inc @@ -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: diff --git a/plugins/admin/mimetypes/class_mimetypeManagement.inc b/plugins/admin/mimetypes/class_mimetypeManagement.inc index 4955d2fe7..793d76961 100755 --- a/plugins/admin/mimetypes/class_mimetypeManagement.inc +++ b/plugins/admin/mimetypes/class_mimetypeManagement.inc @@ -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() { -- 2.30.2