From: hickert Date: Tue, 15 Nov 2005 08:04:24 +0000 (+0000) Subject: Added divSelectBox to Groups->Application X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=11e8f13483f5f613168e921438be65eb3cae7068;p=gosa.git Added divSelectBox to Groups->Application git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1948 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/groups/application.tpl b/plugins/admin/groups/application.tpl index 98f09af89..7d122c172 100644 --- a/plugins/admin/groups/application.tpl +++ b/plugins/admin/groups/application.tpl @@ -20,10 +20,7 @@
- + {$List} diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index 92e7b2c61..4e35980d2 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -18,6 +18,8 @@ class appgroup extends plugin var $option_value= array(); var $appoption= array(); var $table= ""; + + var $curbase = ""; /* attribute list for save action */ var $attributes= array(); @@ -45,13 +47,19 @@ class appgroup extends plugin $this->appoption[$name]= $option; } } - + $this->curbase = $this->config->current['BASE']; } function execute() { - /* Call parent execute */ - plugin::execute(); + /* Call parent execute */ + plugin::execute(); + if((isset($_GET['act']))&&($_GET['act']=="depopen")){ + $dep = base64_decode($_GET['depid']); + if(isset($this->config->idepartments[$dep])){ + $this->curbase = $dep; + } + } /* Do we need to flip is_account state? */ if (isset($_POST['modify_state'])){ @@ -98,6 +106,13 @@ class appgroup extends plugin } } + /* Add group with post */ + if((isset($_GET['act']))&&($_GET['act']=="add")){ + $this->used_apps[$_GET['id']]= $_GET['id']; + asort($this->used_apps); + $this->addApp($_GET['id']); + } + /* Edit application options? */ if (isset($_POST['edit_options']) && isset($_POST['used_apps'])){ $appname= $_POST['used_apps'][0]; @@ -174,6 +189,59 @@ class appgroup extends plugin $apps["$key"]= "$value"; } } + + $div = new DivSelectBox("appgroup"); + + /* NEW LIST MANAGMENT + * We also need to search for the departments + * So we are able to navigate like in konquerer + */ + + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->curbase) ; + $ldap->ls("(objectClass=gosaDepartment)"); + $departments= array(); + $tmp = array(); + while ($value = $ldap->fetch()){ + $tmp[strtolower($value['dn']).$value['dn']]=$value; + } + ksort($tmp); + foreach($tmp as $value){ + if($value["description"][0]!=".."){ + $departments[$value['dn']]=convert_department_dn($value['dn'])." - [".$value["description"][0]."]"; + }else{ + $departments[$value['dn']]=convert_department_dn($value['dn']); + } + } + + /* END NEW LIST MANAGMENT + */ + + $linkopen = "%s"; + $linkadd = "%s"; + + $base_back = preg_replace("/^[^,]+,/","",$this->curbase); + if((strlen($base_back)>= strlen($this->config->current['BASE']))&&($this->curbase!=$this->config->current['BASE'])){ + $div->AddEntry(array( + array("string"=>sprintf($linkopen,base64_encode($base_back),".. ["._("back")."]"), + "attach"=>"style='border:0px;'") + )); + } + foreach($departments as $key => $app){ + $div->AddEntry(array( + array("string"=>""._("department")." ".sprintf($linkopen,base64_encode($key),$app), + "attach"=>"style='border:0px;'") + )); + } + + foreach($apps as $key => $app){ + $div->AddEntry(array( + array("string"=>""._("application")." ".sprintf($linkadd,$key,$app), + "attach"=>"style='border:0px;'") + )); + } + + $smarty->assign("List", $div->DrawList()); $smarty->assign("apps", $apps); /* Show main page */ @@ -259,10 +327,11 @@ class appgroup extends plugin /* Generate applist */ $this->apps= array(); $ldap= $this->config->get_ldap_link(); - $ldap->cd ($this->config->current['BASE']); - $ldap->search ("(objectClass=gosaApplication)"); + $ldap->cd ("ou=apps,".$this->curbase); + + $ldap->ls ("(objectClass=gosaApplication)","ou=apps,".$this->curbase); while ($attrs= $ldap->fetch()){ - if (isset($attrs["description"][0])){ + if (isset($attrs["description"][0])){ $this->apps[$attrs["cn"][0]]= $attrs["cn"][0]." (". $attrs["description"][0].")"; @@ -274,18 +343,8 @@ class appgroup extends plugin natcasesort ($this->apps); reset ($this->apps); - $this->used_apps= array(); - foreach ($this->gosaMemberApplication as $value){ - if(!isset($this->apps[$value])){ - print_red(sprintf(_("The application named %s is no longer available and has been removed."),$value)); - $test = $this->gosaMemberApplication; - $test = array_flip($test); - unset($test[$value]); - $this->gosaMemberApplication = array_flip($test); - }else{ - $this->used_apps[$value]= $this->apps[$value]; - } + $this->used_apps[$value]= $value; } }