Code

Updated application modifikations
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Jan 2008 15:01:06 +0000 (15:01 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 31 Jan 2008 15:01:06 +0000 (15:01 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8705 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index becf7614d2f2d521984bce367b621084a1832348..0eb355b772e3d3ad1a52b82dbc4d852c1b99940b 100644 (file)
@@ -2,10 +2,10 @@
 {foreach from=$entries item=item key=key}
        {if $item.TYPE == "OPEN"}
                <tr>
-                       <td colspan=2 style="background-color: #BBBBBB;height:1px"></td>
+                       <td colspan=3 style="background-color: #BBBBBB;height:1px"></td>
                </tr>
                <tr>
-                       <td style='padding-left:20px;' colspan=2>
+                       <td style='padding-left:20px;' colspan=3>
                                <table style='width:100%;' cellpadding=0 cellspacing=0>
 
        {elseif $item.TYPE == "CLOSE"}
@@ -13,7 +13,7 @@
                        </td>
                </tr>
                <tr>
-                       <td colspan=2 style="background-color: #BBBBBB;height:1px"></td>
+                       <td colspan=3 style="background-color: #BBBBBB;height:1px"></td>
                </tr>
        {elseif $item.TYPE == "RELEASE"}
                <tr>
@@ -23,6 +23,8 @@
                        <td>
                                {$item.NAME}
                        </td>
+                       <td style='width:100px;text-align:right'>
+                       </td>
                </tr>
        {elseif $item.TYPE == "FOLDER"}
                <tr>
                        <td>
                                {$item.NAME}
                        </td>
+                       <td style='width:100px;text-align:right'>
+                               <input title="{t}Move up{/t}"   class="center" type='image' 
+                                       name='up_{$item.UNIQID}' src='images/move_object_up.png'>
+                               <input title="{t}Move down{/t}" class="center" type='image' 
+                                       name='down_{$item.UNIQID}' src='images/move_object_down.png'>
+                               <input title="{t}Remove{/t}"    class="center" type='image' 
+                                       name='del_{$item.UNIQID}' src='images/edittrash.png'>
+                               <input title="{t}Edit{/t}"              class="center" type='image' 
+                                       name='edit_{$item.UNIQID}' src='images/edit.png'>
+                       </td>
                </tr>
        {elseif $item.TYPE == "ENTRY"}
                <tr>
                        <td>
                                {$item.NAME}
                        </td>
+                       <td style='width:100px;text-align:right'>
+                               <input title="{t}Move up{/t}"   class="center" type='image' 
+                                       name='up_{$item.UNIQID}' src='images/move_object_up.png'>
+                               <input title="{t}Move down{/t}" class="center" type='image' 
+                                       name='down_{$item.UNIQID}' src='images/move_object_down.png'>
+                               <input title="{t}Remove{/t}"    class="center" type='image' 
+                                       name='del_{$item.UNIQID}' src='images/edittrash.png'>
+                               <input title="{t}Edit{/t}"              class="center" type='image' 
+                                       name='edit_{$item.UNIQID}' src='images/edit.png'>
+                       </td>
                </tr>
        {/if}
 {/foreach}
index b6a69a20b37f65dbeed9e9a6bbd07761896c513d..f64fcfc90f6a75ae327ad509b9338a060faef086 100644 (file)
@@ -16,7 +16,8 @@ class appgroup2 extends plugin
   var $a_Releases = array();
   var $a_Entries  = array();
   var $a_Folders  = array();
-  var $menu_pointer = NULL;
+
+
 
   public function __construct(&$config, $dn= NULL, $parent= NULL)
   {
@@ -33,8 +34,6 @@ class appgroup2 extends plugin
     $this->a_Entries    = array();
     $this->a_Folders    = array();
 
-    $this->menu_pointer = &$this->a_Structure;
-
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->dn);
     $ldap->search("(|(objectClass=gotoSubmenuEntry)(objectClass=FAIbranch)(objectClass=gotoMenuEntry))",array("*"));
@@ -68,7 +67,8 @@ class appgroup2 extends plugin
           $data['NAME']     = $name;
           $data['TYPE']     = $type;
           $data['PRIORITY'] = $priority;
-          $date['ENTRIES']  = array();
+          $data['ENTRIES']  = array();
+          $data['UNIQID']   = uniqid();
           $cur[$name]       = $data;
 
           switch($type){
@@ -87,7 +87,8 @@ class appgroup2 extends plugin
     /* Call parent execute */
     plugin::execute();
 
-    $this->__construct($this->config, $this->dn,NULL);
+
+#    $this->__construct($this->config, $this->dn,NULL);
     $smarty = get_smarty();
     $smarty->assign("entries",$this->_get_all_entries());
     $display= $smarty->fetch (get_template_path('app_list.tpl', TRUE, dirname(__FILE__)));
@@ -95,6 +96,74 @@ class appgroup2 extends plugin
   }
 
 
+  function _remove_entry_id($id,$start = NULL)
+  {
+    if($start == NULL){
+      $start = &$this->a_Structure;
+    }
+    foreach($start as $name => $entry){
+      if($entry['UNIQID'] == $id){
+        unset($start[$name]);
+        return(TRUE);
+      }
+      if(isset($entry['ENTRIES']) && count($start[$name]['ENTRIES'])){
+        if($this->_remove_entry_id($id,&$start[$name]['ENTRIES'])){
+          return(TRUE);
+        }
+      }
+    }
+    return(FALSE);
+  }
+
+
+  
+  function save_object()
+  {
+    foreach($_POST as $name => $value){
+      if(preg_match("/del_/",$name)){
+        $id = preg_replace("/^del_/","",$name);
+        $id = preg_replace("/_(x|y)$/","",$id);
+        $this->_remove_entry_id($id);
+        break;
+      }
+      if(preg_match("/edit_/",$name)){
+        $id = preg_replace("/^del_/","",$name);
+        $id = preg_replace("/_(x|y)$/","",$id);
+        $this->_edit_entry_edit($id);
+        break;
+      }
+      if(preg_match("/up_/",$name)){
+        $id = preg_replace("/^del_/","",$name);
+        $id = preg_replace("/_(x|y)$/","",$id);
+        $this->_move_entry_up($id);
+        break;
+      }
+      if(preg_match("/down_/",$name)){
+        $id = preg_replace("/^del_/","",$name);
+        $id = preg_replace("/_(x|y)$/","",$id);
+        $this->_move_entry_down($id);
+        break;
+      }
+    }
+  }
+
+  
+  function _edit_entry_edit($id)
+  {
+    echo "Editing: ".$id;
+  }
+
+  function _move_entry_up($id)
+  {
+    echo "Up: ".$id;
+  }
+
+  function _move_entry_down($id)
+  {
+    echo "Down: ".$id;
+  }
+
+
   function _get_all_entries($cur = NULL,$depth = 0)
   {
     $ret = array();
@@ -109,7 +178,7 @@ class appgroup2 extends plugin
         unset($tmp['ENTRIES']);
       }
       $ret[] = $tmp;
-      if(isset($entry['ENTRIES'])){
+      if(isset($entry['ENTRIES']) && count($entry['ENTRIES'])){
         $ret = array_merge($ret,$this->_get_all_entries(&$entry['ENTRIES'],$depth));
       }
     }