From be7deeb596c9a9f9f38ef8a7fd469dba3acfcd41 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 26 Oct 2009 10:39:03 +0000 Subject: [PATCH] Added copy & paste to management class. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14631 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_management.inc | 64 ++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/gosa-core/include/class_management.inc b/gosa-core/include/class_management.inc index a8e5813f2..2e8b2de89 100644 --- a/gosa-core/include/class_management.inc +++ b/gosa-core/include/class_management.inc @@ -40,6 +40,8 @@ class management protected $objectName = ""; protected $displayApplyBtn = ""; + protected $cpHandler = null; + protected $cpPastingStarted = FALSE; // Private private $plugname = ""; @@ -55,6 +57,8 @@ class management $this->ui = $ui; $this->config = $config; + if($this->cpHandler) $this->headpage->setCopyPasteHandler($this->cpHandler); + if(empty($this->plIcon)){ $this->plIcon = "plugins/".$plugname."/images/plugin.png"; } @@ -66,6 +70,14 @@ class management $vars = array('/^act$/','/^listing/','/^PID$/','/^FILTER_PID$/'); session::set('LOCK_VARS_TO_USE',$vars); + /* Display the copy & paste dialog, if it is currently open */ + $ret = $this->copyPasteHandler("",array()); + if($ret){ + return($this->getHeader().$ret); + } + + + // Handle actions (POSTs and GETs) $str = $this->detectPostActions(); if($str) return($this->getHeader().$str); @@ -341,6 +353,58 @@ class management } } + function copyPasteHandler($s_action,$s_entry) + { + + /* Check if Copy & Paste is disabled */ + if(!is_object($this->cpHandler)){ + return(""); + } + + $ui = get_userinfo(); + + /* Add entries to queue */ + if($s_action == "copy" || $s_action == "cut"){ + + /* Cleanup object queue */ + $this->cpHandler->cleanup_queue(); + + /* Add new entries to CP queue */ + foreach($s_entry as $dn){ + if($s_action == "copy" && $ui->is_copyable($dn,$this->aclCategory,$this->aclPlugin)){ + $this->cpHandler->add_to_queue($dn,"copy",$this->tabClass,$this->tabType,$this->aclCategory); + } + if($s_action == "cut" && $ui->is_cutable($dn,$this->aclCategory,$this->aclPlugin)){ + $this->cpHandler->add_to_queue($dn,"cut",$this->tabClass,$this->tabType,$this->aclCategory); + } + } + } + + /* Start pasting entries */ + if($s_action == "paste"){ + $this->cpPastingStarted = TRUE; + } + + /* Return C&P dialog */ + if($this->cpPastingStarted && $this->cpHandler->entries_queued()){ + + /* Get dialog */ + $this->cpHandler->SetVar("base",$this->headpage->getBase()); + $data = $this->cpHandler->execute(); + + /* Return dialog data */ + if(!empty($data)){ + return($data); + } + } + + /* Automatically disable status for pasting */ + if(!$this->cpHandler->entries_queued()){ + $this->cpPastingStarted = FALSE; + } + return(""); + } + function save_object(){} function setDescription($str) { -- 2.30.2