Code

Added category selection and prio settings
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 18 Nov 2005 11:15:20 +0000 (11:15 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 18 Nov 2005 11:15:20 +0000 (11:15 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1974 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/groups/class_groupApplication.inc
plugins/admin/groups/class_groupManagement.inc

index 5131abcd5b337da0aaedb7dca53a6b8766390333..93f72545d04c504096ad7d943aa42297c23cfd31 100644 (file)
@@ -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     = "&nbsp; [ "._("Priority: %s")." ] ";
+    $str_noprio     = " %s ";
     $linkopen       = "<img src='images/folder.png'>            &nbsp;<a href='?plug=".$_GET['plug']."&amp;act=open&amp;id=%s'>%s</a>";
     $app   = "<img src='images/select_application.png'>&nbsp;%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;
   }
index 4e21b8bdff40fa088b9b921763681680ef0fbd2e..2f444c58e6f436b43c6216ba6cca1ffe8bdc82c6 100644 (file)
@@ -57,7 +57,7 @@ class groupManagement extends plugin
   function execute()
   {
        /* Call parent execute */
-       plugin::execute();
+//     plugin::execute();
 
     /* Save data */
     $groupfilter= get_global("groupfilter");