From c4f4d2ed95c205ed36bb420ed9b1a32b8e82d580 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 18 Nov 2005 11:15:20 +0000 Subject: [PATCH] Added category selection and prio settings git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1974 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/groups/class_groupApplication.inc | 50 +++++++++++++++---- .../admin/groups/class_groupManagement.inc | 2 +- 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index 5131abcd5..93f72545d 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -70,17 +70,47 @@ class appgroup extends plugin $this->curbase = $this->config->current['BASE']; } - function getOneUp($prio) + function getOneUp($appl) { - - - } - - function getOneDown(){ + $prio = $this->gosaMemberApplication[$appl]['Pri']; + $prios = array(); + $next = 0; + $key_use = false; + foreach($this->gosaMemberApplication as $key => $app){ + if($app['Cat'] != $this->gosaMemberApplication[$appl]['Cat']) continue; + if($app['Pri']< $prio){ + if($app['Pri'] > $next){ + $next = $app['Pri']; + $key_use = $key; + } + } + } + if($next != 0){ + $this->gosaMemberApplication[$appl]['Pri']= $next; + $this->gosaMemberApplication[$key_use]['Pri']= $prio; + } + } + function getOneDown($prio){ + return($prio); } + function getNextFree($prio,$cat) + { + $ret = $prio; + $prios =array(); + foreach($this->gosaMemberApplication as $app){ + if($cat == $app['Cat']){ + $prios[$app['Pri']]=$app['Pri']; + } + } + while(isset($prios[$ret])){ + $ret ++; + } + return($ret); + } + function execute() { @@ -306,9 +336,9 @@ class appgroup extends plugin if($found != false){ if($act == "one_up"){ - $this->gosaMemberApplication[$found]['Pri'] = $this->gosaMemberApplication[$found]['Pri'] -1; + $this->getOneUp($found); }elseif($act == "one_down") { - $this->gosaMemberApplication[$found]['Pri'] = $this->gosaMemberApplication[$found]['Pri'] +1; + $this->getOneDown($found); } } } @@ -318,7 +348,7 @@ class appgroup extends plugin $div2->SetHeight(300); $menu = $this->CreateCatMenu(); - $str_noprio = "  [ "._("Priority: %s")." ] "; + $str_noprio = " %s "; $linkopen = "  %s"; $app = " %s".$str_noprio; @@ -560,7 +590,7 @@ class appgroup extends plugin function addApp($cn) { - $this->gosaMemberApplication[$cn."|".$this->curCatDir]= array("App"=>$cn,"Cat"=>$this->curCatDir,"Pri"=>"100"); + $this->gosaMemberApplication[$cn."|".$this->curCatDir]= array("App"=>$cn,"Cat"=>$this->curCatDir,"Pri"=>$this->getNextFree(1,$this->curCatDir)); $this->used_apps[$cn]=$cn; $this->is_modified= TRUE; } diff --git a/plugins/admin/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc index 4e21b8bdf..2f444c58e 100644 --- a/plugins/admin/groups/class_groupManagement.inc +++ b/plugins/admin/groups/class_groupManagement.inc @@ -57,7 +57,7 @@ class groupManagement extends plugin function execute() { /* Call parent execute */ - plugin::execute(); +// plugin::execute(); /* Save data */ $groupfilter= get_global("groupfilter"); -- 2.30.2