From: hickert Date: Mon, 21 Nov 2005 09:03:18 +0000 (+0000) Subject: Added separators X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=535f37f8026c627a66b0c3ef2f7b8d538a9bcbfb;p=gosa.git Added separators git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1991 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/groups/application.tpl b/plugins/admin/groups/application.tpl index cc4efe3d8..65abe2702 100644 --- a/plugins/admin/groups/application.tpl +++ b/plugins/admin/groups/application.tpl @@ -3,6 +3,7 @@ {$UsedApps} +   diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index 93f72545d..f75d80d63 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -53,19 +53,45 @@ class appgroup extends plugin $tmp = array(); $tmp2 = array(); + + $prios = array(); + foreach($this->gosaMemberApplication as $memberApp){ if(preg_match("/\|/i",$memberApp)){ $tmp = split("\|",$memberApp); $tmp2[$tmp[0]."|".$tmp[1]]['App'] = $tmp[0]; $tmp2[$tmp[0]."|".$tmp[1]]['Cat'] = $tmp[1]; $tmp2[$tmp[0]."|".$tmp[1]]['Pri'] = $tmp[2]; + + $cats [$tmp[1]] = $tmp[1]; + $prios[$tmp[1]][$tmp[2]] = $tmp[2]; }else{ $tmp2[$memberApp."|"]['App'] = $memberApp; $tmp2[$memberApp."|"]['Cat'] = ""; - $tmp2[$memberApp."|"]['Pri'] = 100; + $tmp2[$memberApp."|"]['Pri'] = 1000; } } + $this->gosaMemberApplication = $tmp2; + foreach($cats as $cat ){ + $max = max($prios[$cat]); + $min = 1;//min($prios[$cat]); + for($i = $min ; $i < $max ; $i++){ + if(!isset($prios[$cat][$i])){ + $this->gosaMemberApplication["__SEPARATOR__".$i."|".$cat]['Pri'] = $i; + $this->gosaMemberApplication["__SEPARATOR__".$i."|".$cat]['Cat'] = $this->curCatDir; + $this->gosaMemberApplication["__SEPARATOR__".$i."|".$cat]['App'] = "__SEPARATOR__".$i; + } + } + } + + /* Append at last*/ + foreach($this->gosaMemberApplication as $key => $app){ + if($app['Pri'] == 1000){ + $this->gosaMemberApplication[$key]['Pri'] = $this->getNextFree(1,$app['Cat']); + } + } + $this->curbase = $this->config->current['BASE']; } @@ -111,11 +137,21 @@ class appgroup extends plugin return($ret); } + function AddSeperator() + { + $i = 1; + while(isset($this->gosaMemberApplication["__SEPARATOR__".$i."|".$this->curCatDir])){ + $i ++; + } + $this->gosaMemberApplication["__SEPARATOR__".$i."|".$this->curCatDir]['Pri'] = $this->getNextFree(1,$this->curCatDir); + $this->gosaMemberApplication["__SEPARATOR__".$i."|".$this->curCatDir]['Cat'] = $this->curCatDir; + $this->gosaMemberApplication["__SEPARATOR__".$i."|".$this->curCatDir]['App'] = "__SEPARATOR__".$i; + } function execute() { /* Call parent execute */ - plugin::execute(); + //plugin::execute(); if((isset($_GET['act']))&&($_GET['act']=="depopen")){ $dep = base64_decode($_GET['depid']); if(isset($this->config->idepartments[$dep])){ @@ -123,6 +159,9 @@ class appgroup extends plugin } } + if(isset($_POST['AddSeperator'])){ + $this->AddSeperator(); + } if((isset($_GET['act']))&&($_GET['act']=="open")){ $this->curCatDir = $_GET['id']; @@ -365,15 +404,24 @@ class appgroup extends plugin } /* Append entries */ - + + $separator ="
"; + $upudown = " ". "  ". - " ". - " "; + " "; + $edit= " "; foreach($menu["__ENTRY__"] as $path => $entry){ - $div2 ->AddEntry(array(array("string"=>sprintf($app,$entry['name'],$entry['prio'])), - array("string"=>sprintf($upudown,$entry['name'],$entry['name'],$entry['name'],$entry['name'],$entry['name'],$entry['name']),"attach"=>"style='border-right:0px;'"))); + + if(preg_match("/__SEPARATOR__/",$path)){ + $div2 ->AddEntry(array(array("string"=>$separator), + array("string"=>preg_replace("/\%s/",$entry['name'],$upudown),"attach"=>"style='border-right:0px;'"))); + + }else{ + $div2 ->AddEntry(array(array("string"=>sprintf($app,$entry['name'],$entry['prio'])), + array("string"=>preg_replace("/\%s/",$entry['name'],$upudown.$edit),"attach"=>"style='border-right:0px;'"))); + } } $smarty->assign("UsedApps", $div2->DrawList()); @@ -420,9 +468,13 @@ class appgroup extends plugin plugin::save(); /* Copy members */ + + print_a($this->attrs["gosaMemberApplication"]); $this->attrs["gosaMemberApplication"]= array(); foreach ($this->gosaMemberApplication as $val){ - $this->attrs["gosaMemberApplication"][]= $val['App']."|".$val['Cat']."|".$val['Pri']; + if(!preg_match("/__SEPARATOR__/i",$val['App'])){ + $this->attrs["gosaMemberApplication"][]= $val['App']."|".$val['Cat']."|".$val['Pri']; + } } /* Are there application parameters to be saved */