Code

updated queue handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 Jan 2008 13:38:13 +0000 (13:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 24 Jan 2008 13:38:13 +0000 (13:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8587 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/addons/gotomasses/class_divListMasses.inc
gosa-core/plugins/addons/gotomasses/class_gotomasses.inc
gosa-core/plugins/addons/gotomasses/gotomasses.tpl

index 42d08b005ddc8918e845667ced52c850e5dbbc65..e94027f32000266e12837261d673c66652af023f 100644 (file)
@@ -9,7 +9,7 @@ class divListMasses extends MultiSelectWindow
 
   var $parent             ;
   var $ui                 ;
-
+  var $Regex  = "*";
   var $wake = TRUE;  
   
   function divListMasses (&$config,$parent)
@@ -24,11 +24,6 @@ class divListMasses extends MultiSelectWindow
     $this->EnableSaveButton(FALSE);
     $this->SetInformation(_("This menu allows you to remove and change the properties of GOsa deamon tasks."));
 
-    foreach($this->parent->get_actions() as $name => $desc){
-      $this->$name = TRUE;
-      $this->AddCheckBox($name,sprintf(_("Display entries with action %s."),$desc),
-                               sprintf(_("Display entries with action %s."),$desc),TRUE);
-    }
     $plug  = $_GET['plug'];
 
     /* Toggle all selected / deselected */
@@ -89,14 +84,6 @@ class divListMasses extends MultiSelectWindow
 #    $edit_link = "<div style='width:100%;overflow:hidden;'><nobr><a href='?plug=".$_GET['plug']."&act=edit&id=%id%'>%str%</nobr></div>";
     $edit_link = "%str%";
 
-    /* Create action filter array, to sort out those actions we do not want to see */
-    $allowed_action = array();
-    foreach($this->parent->get_actions() as $name => $desc){
-      if($this->$name){
-        $allowed_action[] = $name;
-      }
-    }
-
     $colors[0] = "#DDDDDD";
     $colors[1] = "#EEEEEE";
     $c_keys = array();
index b0a6c44691f1ce1e39a9d6ecb0bef96ef65e7e38..3ca4a496168c463dcee0f2a87a1caae21202a757 100644 (file)
@@ -38,7 +38,7 @@ class gotomasses extends plugin
     /************
      * Handle posts 
      ************/
-
+    
     $s_entry = $s_action = "";
     $arr = array( 
         "/^stop_/"      => "stop",
@@ -104,18 +104,17 @@ class gotomasses extends plugin
         }
 
         $this->ids_to_remove = $ids;
-        $tmp = "";
-
         $ret = $this->o_queue->ids_exist($this->ids_to_remove);
         $ret = $this->o_queue->get_entries_by_id($ret);
 
+        $tmp = "";
         foreach($ret as $task){
-           $tmp.= "\n".$task['HEADERTAG']."&nbsp;".$task['MACADDRESS'];
-       }
-       $smarty->assign("multiple", TRUE); 
-       $smarty->assign("info",sprintf(_("Your are about to delete the following tasks: %s"),"<pre>".$tmp."</pre>"));
-       $this->current = $s_entry;
-       return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+          $tmp.= "\n".$task['ID']." - ".$task['HEADERTAG']."&nbsp;".$task['MACADDRESS'];
+        }
+        $smarty->assign("multiple", TRUE); 
+        $smarty->assign("info",sprintf(_("Your are about to delete the following tasks: %s"),"<pre>".$tmp."</pre>"));
+        $this->current = $s_entry;
+        return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
       }
     }
 
@@ -213,6 +212,9 @@ class gotomasses extends plugin
                                     "100"=> "100",
                                     "200"=> "200",
                                     "9999" => "*"));
+
+    $count = $this->o_queue->number_of_queued_entries();
+    $smarty->assign("range_selector", range_selector($count, $this->start, $this->range,"range"));
     $smarty->assign("range",$this->range);
     $smarty->assign("div",$this->divlist->Draw());
     return($smarty->fetch (get_template_path('gotomasses.tpl', TRUE, dirname(__FILE__))));
@@ -309,13 +311,10 @@ class gotomasses extends plugin
     if(isset($_POST['range']) && is_numeric($_POST['range'])){
       $this->range = $_POST['range'];
     }
-    if(isset($_POST['next_page'])){
-      $this->start ++;
-    }
-    if(isset($_POST['last_page'])){
-      $this->start --;
-      if($this->start < 0 ){
-        $this->start = 0;
+    if(isset($_GET['start'])){
+      $start = $_GET['start'];
+      if(is_numeric($start) && $start > 0){
+        $this->start = $start;
       }
     }
   }
index c4437b0d430121233651528a638c874678289ff6..844cdebf61164328a88715cc6ac4e80782f5899f 100644 (file)
@@ -1,17 +1,4 @@
 {$div}
 <div style="width:65%; text-align: center; float:left;" >
-{if $start == 0 }
-       <input type="button" name="dummy" value="&lt;&nbsp;{t}Back{/t}" disabled>&nbsp;
-       {$start+1}&nbsp;
-       <input type="submit" name="next_page" value="{t}Next{/t}&nbsp;&gt;">&nbsp;
-{else}
-       <input type="submit" name="last_page" value="&lt;&nbsp;{t}Back{/t}">&nbsp;
-       {$start_real}&nbsp;
-       <input type="submit" name="next_page" value="{t}Next{/t}&nbsp;&gt;">&nbsp;
-{/if}
-</div>
-<div >
-<select name="range" onChange="document.mainform.submit();">
-        {html_options values=$ranges options=$ranges selected=$range}
-</select>
+{$range_selector}
 </div>