Code

Updated group / apps
[gosa.git] / gosa-plugins / goto / admin / groups / apps / class_groupApplication.inc
index 0877b855fb5dfb6b1851057bc14c5e3080792bd3..1185c5a84d45aa12e73d836a4598c1be328aec8b 100644 (file)
@@ -80,7 +80,18 @@ class appgroup extends plugin
           $ret = array_merge($ret,get_list("(objectClass=gosaApplication)","application",$dep,array("*"),GL_NONE));
         }
       }
-      $this->_cache['ReleaseApps'][$release_info['suffix']] = $ret;
+
+      $tmp = array();
+      foreach($ret as $key => $app){
+        $tmp[$key] = $app['cn'][0];
+      }
+      natcasesort($tmp);
+      $res = array();
+      foreach($tmp as $key => $app){
+        $res[] = $ret[$key];
+      }
+
+      $this->_cache['ReleaseApps'][$release_info['suffix']] = $res;
     } 
     $this->apps = $this->_cache['ReleaseApps'][$release_info['suffix']];
   }
@@ -93,7 +104,7 @@ class appgroup extends plugin
     */
   function getReleases()
   {
-    $ret =array("/" => array("name" => "/" , "parts" => array(),"suffix" => get_ou('applicationou')));
+    $ret =array("/" => array("name" => "/", "found" => TRUE , "parts" => array(),"suffix" => get_ou('applicationou')));
     if($this->enableReleaseManagement){
 
       /* Only display those releases that we are able to read */
@@ -125,7 +136,18 @@ class appgroup extends plugin
             $FAIstate = $attrs['FAIstate'][0];
           }
 
+          $all = $this->_get_all_entries();
+          $found = FALSE;
+          foreach($all as $entry){
+            if(isset($entry['DN']) && preg_match("/^".normalizePreg($bb)."/",$entry['DN'])){
+              $found =TRUE;
+              break;
+            }
+          }
+
+          $cnt = 0;
           $ret[$name] = array("name"     => $name, 
+              "found"    => $found,
               "FAIstate" => $FAIstate,
               "dn"       => $attrs['dn'], 
               "parts"    => $parts,"suffix" => $bb.get_ou('applicationou'));
@@ -162,18 +184,25 @@ class appgroup extends plugin
       $sub_dn       = preg_replace("/,".normalizePreg($this->dn)."$/","",$attrs['dn']);
       $sub_dn_array = split("\,",$sub_dn);
 
-
+      $found = true;
       for($i = (count($sub_dn_array)-1) ; $i >= 0 ; $i--){
         $name = preg_replace("/^[^=]*+=/","",$sub_dn_array[$i]);
+        
         if($i > 0){
+          $found =FALSE;
           foreach($cur as $key => $entry){
             if($entry['NAME'] == $name){
               $cur = &$cur[$key]['ENTRIES'];
               $parent_id = $entry['UNIQID'];
+              $found =true;
+              break;
             }
           }
         }else{
-
+          
+          if(!$found){
+            break;
+          }
           $priority = 1;
           if(isset($attrs['gosaApplicationPriority'])){
             $priority= $attrs['gosaApplicationPriority'][0];