summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 54fa890)
raw | patch | inline | side by side (parent: 54fa890)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 8 Feb 2008 07:29:52 +0000 (07:29 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 8 Feb 2008 07:29:52 +0000 (07:29 +0000) |
-display Releases
-display Applications
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8774 594d385d-05f5-0310-b6e9-bd551577e9d8
-display Applications
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8774 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/groups/apps/class_groupApplication2.inc | patch | blob | history |
diff --git a/gosa-plugins/goto/admin/groups/apps/class_groupApplication2.inc b/gosa-plugins/goto/admin/groups/apps/class_groupApplication2.inc
index 6a4e6c8969f0846bbdba8b968ccdcbc6f71a0187..d2f0a3f10742132a3f690f171861c8cd0f54ce6a 100644 (file)
var $Releases;
var $FAIrelease = 0;
var $apps = array();
+ var $_cache = array();
public function __construct(&$config, $dn= NULL, $parent= NULL)
{
function reload()
{
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->curbase);
- $ldap->search("ou=apps",array("dn"));
- $app_deps = array();
- while($attrs = $ldap->fetch()){
- $app_deps[] = $attrs['dn'];
- }
+ $ret = array();
+ $release_info = $this->Releases[$this->FAIrelease];
- foreach($app_deps as $dep){
- # $list = get_list("(objectClass=gosaApplication)","application",$dep,array("*"));
- }
+ if(!isset($this->_cache['ReleaseApps'][$release_info['suffix']])){
+
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->curbase);
+ $ldap->search("ou=apps",array("dn"));
+ $app_deps = array();
+ while($attrs = $ldap->fetch()){
+ $app_deps[] = $attrs['dn'];
+ }
+ foreach($app_deps as $dep){
+ $ldap->cd($dep);
+ $ldap->search("objectClass=FAIbranch",array("dn"));
+ while($attrs = $ldap->fetch()){
+ $app_deps[] = $attrs['dn'];
+ }
+ }
+
+ foreach($app_deps as $dep){
+ if(preg_match("/^".normalizePreg($release_info['suffix'])."/",$dep)){
+ $ret = array_merge($ret,get_list("(objectClass=gosaApplication)","application",$dep,array("*"),GL_NONE));
+ }
+ }
+ $this->_cache['ReleaseApps'][$release_info['suffix']] = $ret;
+ }
+ $this->apps = $this->_cache['ReleaseApps'][$release_info['suffix']];
}
$filter = "(&(objectClass=organizationalUnit)(objectClass=FAIbranch))";
$res = get_list($filter,"application", $dn, array("ou"), GL_SUBSEARCH);
- $ret =array(array("name" => "/" , "parts" => array()));
+ $ret =array(array("name" => "/" , "parts" => array(),"suffix" => get_ou('applicationou')));
foreach($res as $attrs){
if(preg_match("/".get_ou('applicationou')."/",$attrs['dn'])){
$bb = preg_replace("/".get_ou('applicationou').".*/","",$attrs['dn']);
if(empty($name)) {
$name ="/";
}
- $ret[] = array("name" => $name , "dn" => $attrs['dn'], "parts" => $parts);
+ $ret[] = array("name" => $name , "dn" => $attrs['dn'], "parts" => $parts,"suffix" => $bb.get_ou('applicationou'));
}
}
return($ret);
));
}
+
/* Add applications found on this base */
- $apps = array();
- foreach($apps as $key => $app){
+ $used_apps = $this->_get_used_entry_name();
+ foreach($this->apps as $key => $app){
+ if(in_array($app['cn'][0],$used_apps)){
+ continue;
+ }
+ if(!preg_match("/".get_ou('applicationou').normalizePreg($this->curbase)."$/",$app['dn'])){
+ continue;
+ }
+
+ $name = $app['cn'][0];
+ if(isset($app['description'])){
+ $name .= " [".$app['description'][0]."]";
+ }
$div->AddEntry(array(
array("string"=>sprintf("<input class='center' type='checkbox' value='1' name='AddApp_%s'>",$key).
- "<img class='center' src='images/select_application.png' alt='"._("application")."'> ".sprintf($linkadd,$key,$app),
+ "<img class='center' src='images/select_application.png' alt='"._("application")."'> ".sprintf($linkadd,$key,$name),
"attach"=>"style='border:0px;'")
));
}
return($display);
}
-
+
+ function _get_used_entry_name()
+ {
+ $data = $this->_get_entries_for_release($this->FAIrelease);
+ $ret = array();
+ foreach($data as $entry){
+ if($entry['TYPE'] == "ENTRY"){
+ $ret[] = $entry['NAME'];
+ }
+ }
+ return($ret);
+ }
+
function _get_entries_for_release($release,$cur = NULL)
{
$release_info = $this->Releases[$release];