X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-plugins%2Fgoto%2Fadmin%2Fgroups%2Fapps%2Fclass_groupApplication.inc;h=77743284e1dee3fe248b78fab1f74ad353b9c4d6;hb=38fa986fac140f784bcc40447888a40d56321786;hp=33231aacdd12d92e1137df72ea2db8c7fd3e5acf;hpb=1609447070529db729abb365e4b6fdcbfca74a5e;p=gosa.git diff --git a/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc b/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc index 33231aacd..77743284e 100644 --- a/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc +++ b/gosa-plugins/goto/admin/groups/apps/class_groupApplication.inc @@ -1,12 +1,6 @@ "Eins ist toll", "zwei" => "Zwei ist noch besser"); - - var $config; var $curbase; @@ -80,7 +74,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']]; } @@ -99,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'])){ @@ -173,18 +179,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]; @@ -359,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); @@ -374,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); @@ -408,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()); @@ -787,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); @@ -808,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; @@ -877,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){ @@ -909,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{ @@ -929,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']); } }