Code

Added the ability to copy complete group/application menus
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Apr 2008 08:15:16 +0000 (08:15 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 22 Apr 2008 08:15:16 +0000 (08:15 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10604 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/groups/apps/app_list.tpl
gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc

index ddac8b762c07356f0da763fd71b7d69992efb9df..a21720b06993bc0a6f2a6337ac4450849861a96e 100644 (file)
@@ -8,6 +8,12 @@
                                <option value="{$key}" {if $key == $FAIrelease} selected {/if}>{$item.name} </option>
                        {/foreach}
                        </select>
+                       <input type='image' src='images/lists/copy.png' class='center' name='menu_copy'>
+                       {if $copied}
+                               <input type='image' src='images/lists/paste.png' title='{t}Paste menu structure{/t}&nbsp;- {$copy_source}' class='center' name='menu_paste'>
+                       {else}
+                               <input type='image' src='images/lists/paste-grey.png' class='center'>
+                       {/if}
                </td>
        </tr>
        {/if}
index 22be108856108ee24632c6153ea6f055ba38d1ad..00f87bb5287539e360fb5c4c2979eb89c31834fb 100644 (file)
@@ -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);