From 1ea7fc6b8292ab24adc41e2a602c3a5c152afa14 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 22 Apr 2008 08:15:16 +0000 Subject: [PATCH] Added the ability to copy complete group/application menus git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10604 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/admin/groups/apps/app_list.tpl | 6 ++++ .../groups/apps/class_groupApplication.inc | 33 +++++++++++++++++-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/gosa-plugins/goto/admin/groups/apps/app_list.tpl b/gosa-plugins/goto/admin/groups/apps/app_list.tpl index ddac8b762..a21720b06 100644 --- a/gosa-plugins/goto/admin/groups/apps/app_list.tpl +++ b/gosa-plugins/goto/admin/groups/apps/app_list.tpl @@ -8,6 +8,12 @@ {/foreach} + + {if $copied} + + {else} + + {/if} {/if} diff --git a/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc b/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc index 22be10885..00f87bb52 100644 --- a/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc +++ b/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc @@ -16,7 +16,9 @@ class appgroup extends plugin var $app_parameter = array(); var $edit_entry = array(); var $enableReleaseManagement = FALSE; - + + var $copied_release = ""; + public function __construct(&$config, $dn= NULL, $parent= NULL) { @@ -473,7 +475,14 @@ class appgroup extends plugin )); } - + /* Assign copy / paste values + */ + if(!empty($this->copied_release)){ + $smarty->assign("copied", TRUE); + $smarty->assign("copy_source", $this->copied_release); + }else{ + $smarty->assign("copied", FALSE); + } $smarty->assign("enableReleaseManagement",$this->enableReleaseManagement); $smarty->assign("FAIrelease",$this->FAIrelease); $smarty->assign("app_list",$div->DrawList()); @@ -793,6 +802,26 @@ class appgroup extends plugin function save_object() { foreach($_POST as $name => $value){ + + if(preg_match("/^menu_copy_/",$name)){ + $this->copied_release = $this->FAIrelease; + break; + } + if(preg_match("/^menu_paste_/",$name)){ + $source_rel = $this->_get_release_key($this->copied_release); + $current_rel = $this->_get_release_key($this->FAIrelease); + + $all = $this->_get_all_entries(); + $menu = $all[$source_rel]['ENTRIES']; + + foreach($menu as $entry){ + if(in_array($entry['TYPE'],array("FOLDER","ENTRY","SEPERATOR"))){ + $this->_add_entry($current_rel,$entry,-1); + } + } + break; + } + if(preg_match("/del_/",$name)){ $id = preg_replace("/^del_/","",$name); $id = preg_replace("/_(x|y)$/","",$id); -- 2.30.2