Code

Updated group/apps
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 31 Mar 2008 12:54:30 +0000 (12:54 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 31 Mar 2008 12:54:30 +0000 (12:54 +0000)
-Added seperator

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10086 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index f66f5f233a91f28248ee2c9432f7e4feefdcd509..36cfe121a7b604190d885848961af40b8696cd56 100644 (file)
                                        name='app_entry_edit{$item.UNIQID}' src='images/edit.png'>
                        </td>
                </tr>
+       {elseif $item.TYPE == "SEPERATOR"}
+
+               { if $i++ % 2 == 0}
+                       <tr class="rowxp0">
+               {else}
+                       <tr class="rowxp1">
+               {/if}
+                       <td style='background-color: transparent;width:22px; padding-top:5px;padding-bottom:5px;' colspan="2">--</td>
+            <td style='width:100px;text-align:right; background-color: transparent;'>
+                <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'>
+            </td>
+               </tr>
        {elseif $item.TYPE == "ENTRY"}
 
                { if $i++ % 2 == 0}
                        {/foreach}
                        </select>
                        <input type="submit" name="add_menu_to_folder" value="{msgPool type=addButton}" title="{t}Add selected applications to this folder.{/t}">
+                       <input type="submit" name="add_seperator"          value="{t}Seperator{/t}" title="{t}Add a seperator to this folder.{/t}">
                </td>
                <td style="vertical-align:top">
                        {$app_list}     
index cd7b2e6a592aea13d9bd0c177a64b51a9e3a7fe9..d55a09f338b3a3221b0fd20b573b9b1aae0539c8 100644 (file)
@@ -216,13 +216,20 @@ class appgroup extends plugin
             }
 
           }elseif(in_array("gotoMenuEntry",$attrs['objectClass'])){
+
             $type = "ENTRY";
             $data['INFO'] = "";
             $data['PARAMETER'] = array();
             if(isset($attrs['gosaApplicationParameter'])){
               for($p = 0 ; $p < $attrs['gosaApplicationParameter']['count'] ; $p ++){
-                $tmp = split(":",$attrs['gosaApplicationParameter'][$p]);
-                $data['PARAMETER'][$tmp[0]] = $tmp[1];
+                if(preg_match("/:/",$attrs['gosaApplicationParameter'][$p])){
+                  $tmp = split(":",$attrs['gosaApplicationParameter'][$p]);
+                  $data['PARAMETER'][$tmp[0]] = $tmp[1];
+                }elseif($attrs['gosaApplicationParameter'][$p] == "*separator*"){
+                  $type = "SEPERATOR";
+                  $data['PARAMETER'] = array();
+                  break;
+                }
               }
             }
           }elseif(in_array("FAIbranch",$attrs['objectClass'])){
@@ -256,6 +263,8 @@ class appgroup extends plugin
     /* Call parent execute */
     plugin::execute();
 
+    if(isset($_GET['r'])) $this->__construct($this->config,$this->dn);
+
     if (isset($_POST['modify_state'])){
       $this->is_account = !$this->is_account;
     }
@@ -263,12 +272,13 @@ class appgroup extends plugin
     /* Do we represent a valid account? */
     if (!$this->is_account){
       $display= $this->show_enable_header(_("Add application extension"),
-          msgPool::featuresDisabled(_("application")));
+          _("Application extension disabled. You can enable it by clicking below."));
       return ($display);
     }
 
     $display =  $this->show_enable_header(_("Remove application extension"),
-          msgPool::featuresEnabled(_("application")));
+          _("Application extension enabled. You can disable it by clicking below."));
+
 
     if(isset($_GET['send'])){
       $id = $_GET['send'];
@@ -321,7 +331,7 @@ class appgroup extends plugin
       if($value["description"][0]!=".."){
         $departments[$value['dn']]= convert_department_dn($fdn)." - [".$value["description"][0]."]";
       }else{
-        $departments[$value['dn']]=convert_department_dn($fdn)." ["._("back")."]";
+        $departments[$value['dn']]=convert_department_dn($fdn)." ["._("Back")."]";
       }
     }
 
@@ -717,6 +727,13 @@ class appgroup extends plugin
         }
       }
     }
+
+    /* Add seperator */
+    if(isset($_POST['add_seperator']) && isset($_POST['menu_folder'])){
+      $folder = $_POST['menu_folder'];
+      $this->_add_seperator($folder);
+    }
+
     if(isset($_POST['add_menu_to_folder']) && isset($_POST['menu_folder'])){
       $folder = $_POST['menu_folder'];
       $name = $_POST['menu_folder_name'];
@@ -819,8 +836,8 @@ class appgroup extends plugin
 
   
   /* !\brief Remove the given id from the menu structure.
-     @param  String  ID to of the entry we want to remove.
-     @return Boolean TRUE on success
+      @param  String  ID to of the entry we want to remove.
+      @return Boolean TRUE on success
    */
   function _add_entry($folder_id,$entry,$pos = 0)
   {
@@ -845,29 +862,32 @@ class appgroup extends plugin
       $entry['PARENT'] = $folder_id;
       $entry['ENTRIES']= array();
       $entry['STATUS'] = "ADDED";
-
+      
       $cnt = 0; 
       $new = array();
       $added =FALSE;
-      if($obj['STATUS'] == "LOADED"){
-        $obj['STATUS'] = "EDITED";
+      foreach($folder['ENTRIES'] as $key => $obj){
+        if($obj['STATUS'] == "LOADED"){
+          $obj['STATUS'] = "EDITED";
+        }
+        if($pos == $cnt){
+          $new[] = $entry;
+          $added = TRUE;
+        }
+        $cnt ++;
+        $new[] = $obj;
       }
-      if($pos == $cnt){
+      if(!$added){
         $new[] = $entry;
-        $added = TRUE;
       }
-      $cnt ++;
-      $new[] = $obj;
-    }
-    if(!$added){
-      $new[] = $entry;
-    }
-
-    $all[$folder_id]['ENTRIES'] = $new;
-    foreach($entries as $sub){
-      $this->_add_entry($entry['UNIQID'],$sub,-1);
+  
+      $all[$folder_id]['ENTRIES'] = $new;
+      foreach($entries as $sub){
+        $this->_add_entry($entry['UNIQID'],$sub,-1);
+      }
+      return(TRUE);
     }
-    return(TRUE);
+    return(FALSE);
   }
 
  
@@ -900,6 +920,30 @@ class appgroup extends plugin
   }
 
 
+  /*! \brief Add the application identified by $app_id to folder $folder_id 
+      @param  String  folder_id The UNIQID of the folder where we want to add the new folder.
+      @param  Integer app_id    The ID of the application which should be added.
+   */ 
+  function _add_seperator($folder_id)
+  {
+    $all = $this->_get_all_entries();
+    if($folder_id == "BASE"){
+      $folder_id = $this->_get_release_key($this->FAIrelease);
+    }
+
+    if(isset($all[$folder_id])){
+      $new = array();
+      $new['TYPE']  = "SEPERATOR";
+      $new['NAME']  = "SEPERATOR";
+      $new['UNIQID']= uniqid(); 
+      $new['PARENT']= $folder_id;
+      $new['PARAMETER']= array();
+      $new['STATUS']= "ADDED";
+      $all[$folder_id]['ENTRIES'][] = $new;
+    }
+  }
+
+
   /*! \brief  Return all entries linear. 
       @param  Boolean   $add_tags  If TRUE, OPEN/CLOSE Tags will be appended.
       @param  &Array    Start here, Pointer to an array.
@@ -974,13 +1018,17 @@ class appgroup extends plugin
     $prio = 0;
     $Actions = array("Remove" => array(),"Edit" => array() , "Add" => array());
 
+    $sep_id = 0;
     foreach($all as $entry){
       $prio ++;
       $cur = $entry;
       $dn = "";
 
       do{  
-        if($cur['TYPE'] == "ENTRY"){
+        if($cur['TYPE'] == "SEPERATOR"){
+          $sep_id ++;
+          $dn.= "cn=seperator_".$sep_id.",";
+        }elseif($cur['TYPE'] == "ENTRY"){
           $dn.= "cn=".$cur['NAME'].",";
         }elseif($cur['TYPE'] == "FOLDER"){
           $dn.= "cn=".$cur['NAME'].",";
@@ -999,6 +1047,14 @@ class appgroup extends plugin
 
       $attrs = array();
       switch($entry['TYPE']){
+        case "SEPERATOR"    :
+        { 
+          $attrs['objectClass'] = "gotoMenuEntry";
+          $attrs['cn']          = "seperator_".$sep_id;
+          $attrs['gosaApplicationPriority'] = $prio;
+          $attrs['gosaApplicationParameter'] = "*separator*";
+        }
+        break;
         case "ENTRY"    :
         { 
           $attrs['objectClass'] = "gotoMenuEntry";
@@ -1047,7 +1103,7 @@ class appgroup extends plugin
         continue;
       }
       if($entry['STATUS'] == "REMOVED"){
-        $Actions['Remove'][$cur_dn] = $cur_dn;
+        $Actions['Remove'][$entry['DN']] = $entry['DN'];
       }
       if($entry['STATUS'] == "EDITED"){
         $Actions['Edit'][$cur_dn] = $attrs;
@@ -1089,6 +1145,7 @@ class appgroup extends plugin
         }
       }
     }
+
     $this->_load_menu_structure();
   }