summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 712dbeb)
raw | patch | inline | side by side (parent: 712dbeb)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 8 Feb 2008 14:20:51 +0000 (14:20 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 8 Feb 2008 14:20:51 +0000 (14:20 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8782 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 d1822939b4093ec8a7f368230168669815335401..97732898ebc2b3ae53cf0d33f0856b0ef6102bab 100644 (file)
$ret = array();
$release_info = $this->Releases[$this->FAIrelease];
- if(1 | !isset($this->_cache['ReleaseApps'][$release_info['suffix']])){
+ if(!isset($this->_cache['ReleaseApps'][$release_info['suffix']])){
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->config->current['BASE']);
/* 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"), GL_SUBSEARCH);
+ $res = get_list($filter,"application", $dn, array("ou","FAIstate"), GL_SUBSEARCH);
$ret =array(array("name" => "/" , "parts" => array(),"suffix" => get_ou('applicationou')));
foreach($res as $attrs){
if(empty($name)) {
$name ="/";
}
- $ret[] = array("name" => $name , "dn" => $attrs['dn'], "parts" => $parts,"suffix" => $bb.get_ou('applicationou'));
+ $FAIstate = "";
+ if(isset($attrs['FAIstate'])){
+ $FAIstate = $attrs['FAIstate'][0];
+ }
+
+ $ret[] = array("name" => $name,
+ "FAIstate" => $FAIstate,
+ "dn" => $attrs['dn'],
+ "parts" => $parts,"suffix" => $bb.get_ou('applicationou'));
}
}
return($ret);
$ldap = $this->config->get_ldap_link();
$ldap->cd($this->dn);
$ldap->search("(|(objectClass=gotoSubmenuEntry)(objectClass=FAIbranch)(objectClass=gotoMenuEntry))",array("*"));
- $parent_id = 0;
+
+ $base = array();
+ $base['UNIQID'] = uniqid();
+ $base['PARENT'] = 0;
+ $base['NAME'] = "";
+ $base['TYPE'] = "BASE";
+ $base['ENTRIES']= array();
+ $base['STATUS'] = "LOADED";
+
+ $this->a_Structure[0] = $base;
+
while($attrs = $ldap->fetch()){
- $cur = &$this->a_Structure;
+ $cur = &$this->a_Structure[0]['ENTRIES'];
+ $parent_id = $base['UNIQID'];
$sub_dn = preg_replace("/,".normalizePreg($this->dn)."$/","",$attrs['dn']);
$sub_dn_array = split("\,",$sub_dn);
+
+
for($i = (count($sub_dn_array)-1) ; $i >= 0 ; $i--){
$name = preg_replace("/^[^=]*+=/","",$sub_dn_array[$i]);
- if($i != 0){
+ if($i > 0){
foreach($cur as $key => $entry){
if($entry['NAME'] == $name){
$cur = &$cur[$key]['ENTRIES'];
$type = "ENTRY";
}elseif(in_array("FAIbranch",$attrs['objectClass'])){
$type = "RELEASE";
- $data['FAIstate'] = $attrs['FAIstate'][0];
+ if(isset($attrs['FAIstate'][0])){
+ $data['FAIstate'] = $attrs['FAIstate'][0];
+ }else{
+ $data['FAIstate'] = "";
+ }
}
$data['DN'] = $attrs['dn'];
}
}
- /* Create 'open' and 'add' links */
-# if($this->acl_is_writeable("gosaMemberApplication",$this->no_release_acls)){
- $linkadd = "<a href='?plug=".$_GET['plug']."&act=add&id=%s'>%s</a>";
- # }else{
- # $linkadd = "%s";
- # }
$linkopen = "<a href='?plug=".$_GET['plug']."&act=depopen&depid=%s'>%s</a>";
/* Create base back entry */
}
$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,$name),
+ "<img class='center' src='images/select_application.png' alt='"._("application")."'> ".$name,
"attach"=>"style='border:0px;'")
));
}
{
$all = $this->_get_all_entries();
$key = $this->_get_release_key($release);
- if(isset($all[$key])){
- return($this->_get_all_entries(TRUE,TRUE,&$all[$key]['ENTRIES']));
+ if(isset($all[$key]) && count($all[$key]['ENTRIES'])){
+ $res = $this->_get_all_entries(TRUE,TRUE,&$all[$key]['ENTRIES']);
+ return($res);
}
return(array());
}
}
- function save()
+
+ function check()
{
- $ldap = $this->config->get_ldap_link();
- $all = $this->_get_all_entries();
- $prio = 0;
- $Actions = array("Remove" => array(),"Edit" => array() , "Add" => array());
- foreach($all as $entry){
- $prio ++;
- $cur = $entry;
- $dn = "";
+ }
- do{
- if($cur['TYPE'] == "ENTRY"){
- $dn.= "cn=".$cur['NAME'].",";
- }elseif($cur['TYPE'] == "FOLDER"){
- $dn.= "cn=".$cur['NAME'].",";
- }elseif($cur['TYPE'] == "RELEASE"){
- $dn.= "ou=".$cur['NAME'].",";
- }
- $cur = $all[$cur['PARENT']];
- if(!isset($cur['PARENT'])){
- $cur = NULL;
- }
- }while(is_array($cur));
- $cur_dn = $dn.$this->dn;
- $attrs = array();
- switch($entry['TYPE']){
- case "ENTRY" :
- {
- $attrs['objectClass'] = "gotoMenuEntry";
- $attrs['cn'] = $entry['NAME'];
- $attrs['gosaApplicationPriority'] = $prio;
- }
- break;
- case "FOLDER" :
- {
- $attrs['objectClass'] = "gotoSubmenuEntry";
- $attrs['cn'] = $entry['NAME'];
- $attrs['gosaApplicationPriority'] = $prio;
- }
- break;
- case "RELEASE" :
- {
- $attrs['ou'] = $entry['NAME'];
- $attrs['objectClass'] = array();
- $attrs['objectClass'][] = "top";
- $attrs['objectClass'][] = "organizationalUnit";
- $attrs['objectClass'][] = "FAIbranch";
- $attrs['FAIstate'] = $entry['FAIstate'];
- }
- break;
- }
-
- if($entry['STATUS'] == "LOADED"){
- continue;
- }
- if($entry['STATUS'] == "REMOVED"){
- $Actions['Remove'][$cur_dn] = $cur_dn;
- }
- if($entry['STATUS'] == "EDITED"){
- $Actions['Edit'][$cur_dn] = $attrs;
- }
- if($entry['STATUS'] == "ADDED"){
- $Actions['Add'][$cur_dn] = $attrs;
- }
- }
+ function _check_missing_release($release)
+ {
+ $release_info = $this->Releases[$release];
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- foreach($Actions['Remove'] as $dn){
- $ldap->cd($dn);
- $ldap->cat($dn);
- if($ldap->count()){
- $ldap->rmdir_recursive($dn);
- }
- }
- foreach($Actions['Add'] as $dn => $data){
- $ldap->cd($dn);
- $ldap->cat($dn);
- if(!$ldap->count()){
- $ldap->add($data);
+ $parent_id = $this->a_Structure[0]['UNIQID'];
+ $cur = &$this->a_Structure[0]['ENTRIES'];
+ for($i = 0 ; $i < count($release_info['parts']) ; $i ++){
+ $part = $release_info['parts'][$i];
+ $found = FALSE;
+ foreach($cur as $key => $name){
+ if($name['NAME'] == $part){
+ $parent_id = $cur[$key]['UNIQID'];
+ $cur = &$cur[$key]['ENTRIES'];
+
+ $found =TRUE;
+ break;
+ }
}
- }
- foreach($Actions['Edit'] as $dn => $data){
- $ldap->cd($dn);
- $ldap->cat($dn);
- if($ldap->count()){
- $ldap->modify($data);
+ if(!$found){
+ $release = array();
+ $release['UNIQID'] = uniqid();
+ $release['PARENT'] = $parent_id;
+ $release['NAME'] = $part;
+ $release['TYPE'] = "RELEASE";
+ $release['ENTRIES']= array();
+ $release['STATUS'] = "ADDED";
+ $release['FAIstate'] = $release_info['FAIstate'];
+ $cur[] = $release;
+ print_a($release);
+ $i --;
}
}
}
- function check()
- {
- }
-
-
-
/* !\brief Handle ui POSTS, like sort up/down/delete
*/
function save_object()
}
if(isset($_POST['FAIrelease'])){
$this->FAIrelease = $_POST['FAIrelease'];
+ $this->_check_missing_release($this->FAIrelease);
}
if(isset($_GET['act']) && $_GET['act'] == 'depopen'){
$this->curbase = base64_decode($_GET['depid']);
}
- function _get_release_key($release)
+ function _get_release_key($release,$add_if_missing = FALSE)
{
$release_info = $this->Releases[$release];
- $cur = &$this->a_Structure;
+
+ if($release_info['name'] == "/"){
+ return($this->a_Structure['0']['UNIQID']);
+ }
+
+ $cur = &$this->a_Structure[0]['ENTRIES'];
$s_key = "";
$found = FALSE;
foreach($release_info['parts'] as $name){
{
$all = $this->_get_all_entries();
if($folder == "BASE"){
- $folder = $this->_get_release_key($this->FAIrelease);
+ $folder = $this->_get_release_key($this->FAIrelease,TRUE);
}
if(isset($all[$folder])){
}
+ function save()
+ {
+ $ldap = $this->config->get_ldap_link();
+ $all = $this->_get_all_entries();
+ $prio = 0;
+ $Actions = array("Remove" => array(),"Edit" => array() , "Add" => array());
+
+ foreach($all as $entry){
+ $prio ++;
+ $cur = $entry;
+ $dn = "";
+
+ do{
+ if($cur['TYPE'] == "ENTRY"){
+ $dn.= "cn=".$cur['NAME'].",";
+ }elseif($cur['TYPE'] == "FOLDER"){
+ $dn.= "cn=".$cur['NAME'].",";
+ }elseif($cur['TYPE'] == "RELEASE"){
+ $dn.= "ou=".$cur['NAME'].",";
+ }elseif($cur['TYPE'] == "BASE"){
+ }
+ if(!isset($all[$cur['PARENT']])){
+ $cur = NULL;
+ }else{
+ $cur = $all[$cur['PARENT']];
+ }
+ }while(is_array($cur));
+
+ $cur_dn = $dn.$this->dn;
+
+ $attrs = array();
+ switch($entry['TYPE']){
+ case "ENTRY" :
+ {
+ $attrs['objectClass'] = "gotoMenuEntry";
+ $attrs['cn'] = $entry['NAME'];
+ $attrs['gosaApplicationPriority'] = $prio;
+ }
+ break;
+ case "FOLDER" :
+ {
+ $attrs['objectClass'] = "gotoSubmenuEntry";
+ $attrs['cn'] = $entry['NAME'];
+ $attrs['gosaApplicationPriority'] = $prio;
+ }
+ break;
+ case "RELEASE" :
+ {
+ $attrs['ou'] = $entry['NAME'];
+ $attrs['objectClass'] = array();
+ $attrs['objectClass'][] = "top";
+ $attrs['objectClass'][] = "organizationalUnit";
+ $attrs['objectClass'][] = "FAIbranch";
+ if(!empty($entry['FAIstate'])){
+ $attrs['FAIstate'] = $entry['FAIstate'];
+ }
+ }
+ break;
+ }
+
+ if($entry['STATUS'] == "LOADED"){
+ continue;
+ }
+ if($entry['STATUS'] == "REMOVED"){
+ $Actions['Remove'][$cur_dn] = $cur_dn;
+ }
+ if($entry['STATUS'] == "EDITED"){
+ $Actions['Edit'][$cur_dn] = $attrs;
+ }
+ if($entry['STATUS'] == "ADDED"){
+ $Actions['Add'][$cur_dn] = $attrs;
+ }
+ }
+
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ foreach($Actions['Remove'] as $dn){
+ $ldap->cd($dn);
+ $ldap->cat($dn);
+ if($ldap->count()){
+ $ldap->rmdir_recursive($dn);
+ }
+ }
+ foreach($Actions['Add'] as $dn => $data){
+ $ldap->cd($dn);
+ $ldap->cat($dn);
+ if(!$ldap->count()){
+ $ldap->add($data);
+ }
+ }
+ foreach($Actions['Edit'] as $dn => $data){
+ $ldap->cd($dn);
+ $ldap->cat($dn);
+ if($ldap->count()){
+ $ldap->modify($data);
+ }
+ }
+ }
+
+
/* Return plugin informations for acl handling */
static function plInfo()
{