Code

Removed CLI
[gosa.git] / gosa-plugins / goto / admin / groups / apps / class_groupApplication.inc
index 1185c5a84d45aa12e73d836a4598c1be328aec8b..77743284e1dee3fe248b78fab1f74ad353b9c4d6 100644 (file)
@@ -1,12 +1,6 @@
 <?php
 class appgroup extends plugin
 {
-  /* CLI vars */
-  var $cli_summary= "Manage application groups";
-  var $cli_description= "Some longer text\nfor help";
-  var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
-
   var $config;
   var $curbase;
 
@@ -110,7 +104,8 @@ class appgroup extends plugin
       /* Only display those releases that we are able to read */
       $dn     = $this->config->current['BASE'];
       $filter = "(&(objectClass=organizationalUnit)(objectClass=FAIbranch))";
-      $res    = get_list($filter,"application", $dn, array("ou","FAIstate"), GL_SUBSEARCH);
+      $res    = get_sub_list($filter,array("application","fai"), array(get_ou("applicationou"),get_ou("faiou")),$dn, array("ou","FAIstate"), GL_SUBSEARCH);
+
 
       foreach($res as $attrs){
         if(preg_match("/".get_ou('applicationou')."/",$attrs['dn'])){
@@ -377,6 +372,7 @@ class appgroup extends plugin
     $smarty->assign("enableReleaseManagement",$this->enableReleaseManagement);
     $smarty->assign("FAIrelease",$this->FAIrelease);
     $smarty->assign("app_list",$div->DrawList());
+    $smarty->assign("i",0);
     $smarty->assign("releases",$this->Releases);
     $smarty->assign("folders" , $this->_get_folder_names());
     $entries = $this->_get_entries_for_release($this->FAIrelease);
@@ -392,10 +388,21 @@ class appgroup extends plugin
   function _get_folder_names()
   {
     $data = $this->_get_entries_for_release($this->FAIrelease);
+    $all    = $this->_get_all_entries();
     $ret = array("BASE" => ".");
     foreach($data as $entry){
+
       if($entry['TYPE'] == "FOLDER"){
-        $ret[$entry['UNIQID']] = $entry['NAME'];
+        $str = $entry['NAME'];
+        $parent = $entry['PARENT'];
+        $i = 10;
+        while(isset($all[$parent]) && $i){  
+          $i --;
+          $parent_o = $all[$parent];
+          $str      = $parent_o['NAME']."/".$str;
+          $parent   = $all[$parent_o['UNIQID']]['PARENT'];
+        }        
+        $ret[$entry['UNIQID']] = $str;
       }
     }
     return($ret);
@@ -426,7 +433,7 @@ class appgroup extends plugin
     $all = $this->_get_all_entries();
     $key = $this->_get_release_key($release);
     if(isset($all[$key]) && count($all[$key]['ENTRIES'])){
-      $res = $this->_get_all_entries(TRUE,TRUE,&$all[$key]['ENTRIES']);
+      $res = $this->_get_all_entries(TRUE,TRUE,$all[$key]['ENTRIES']);
       return($res);
     } 
     return(array());
@@ -805,6 +812,7 @@ class appgroup extends plugin
     $all = $this->_get_all_entries();
     if(isset($all[$id])){
       $all[$id]['STATUS'] = "REMOVED";
+      $all[$id]['ENTRIES'] = array();
       return(TRUE);
     }
     return(FALSE);
@@ -826,8 +834,13 @@ class appgroup extends plugin
 
     if(isset($all[$folder_id])){
 
+      if(!isset($entry['ENTRIES'])){
+        $entries = array();
+      }else{
+        $entries = $entry['ENTRIES'];
+      }
+
       $folder  = &$all[$folder_id];
-      $entries = $entry['ENTRIES'];
 
       $entry['UNIQID'] = uniqid();     
       $entry['PARENT'] = $folder_id;
@@ -895,7 +908,7 @@ class appgroup extends plugin
       @param  Boolean   $add_tags  If TRUE, OPEN/CLOSE Tags will be appended.
       @param  &Array    Start here, Pointer to an array.
    */ 
-  function _get_all_entries($add_tags = FALSE, $skip_release = FALSE, $cur = NULL)
+  function _get_all_entries($add_tags = FALSE, $skip_release = FALSE, &$cur = NULL)
   {
     $ret = array();
     if($cur == NULL){
@@ -927,7 +940,7 @@ class appgroup extends plugin
       if(!$add_tags){
         $ret[$tmp['UNIQID']] = &$cur[$key];
         if(isset($entry['ENTRIES']) && count($entry['ENTRIES'])){
-          $ret = array_merge($ret,$this->_get_all_entries($add_tags,$skip_release,&$cur[$key]['ENTRIES']));
+          $ret = array_merge($ret,$this->_get_all_entries($add_tags,$skip_release,$cur[$key]['ENTRIES']));
         }
       }else{
       
@@ -947,7 +960,7 @@ class appgroup extends plugin
 
             if($add){
               $ret[] = array("TYPE" => "OPEN", "PARENT" => $entry['PARENT']);
-              $ret = array_merge($ret,$this->_get_all_entries($add_tags,$skip_release,&$cur[$key]['ENTRIES']));
+              $ret = array_merge($ret,$this->_get_all_entries($add_tags,$skip_release,$cur[$key]['ENTRIES']));
               $ret[] = array("TYPE" => "CLOSE" , "PARENT" => $entry['PARENT']);
             }
           }