summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 21d1a94)
raw | patch | inline | side by side (parent: 21d1a94)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 25 Oct 2007 08:24:40 +0000 (08:24 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 25 Oct 2007 08:24:40 +0000 (08:24 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7650 594d385d-05f5-0310-b6e9-bd551577e9d8
html/images/prio_bottom.png | [new file with mode: 0644] | patch | blob |
html/images/prio_decrease.png | [new file with mode: 0644] | patch | blob |
html/images/prio_increase.png | [new file with mode: 0644] | patch | blob |
html/images/prio_top.png | [new file with mode: 0644] | patch | blob |
include/class_hostActionQueue.inc | patch | blob | history | |
plugins/addons/gotomasses/class_divListMasses.inc | patch | blob | history | |
plugins/addons/gotomasses/class_gotomasses.inc | patch | blob | history |
diff --git a/html/images/prio_bottom.png b/html/images/prio_bottom.png
new file mode 100644 (file)
index 0000000..8392002
Binary files /dev/null and b/html/images/prio_bottom.png differ
index 0000000..8392002
Binary files /dev/null and b/html/images/prio_bottom.png differ
diff --git a/html/images/prio_decrease.png b/html/images/prio_decrease.png
new file mode 100644 (file)
index 0000000..3773874
Binary files /dev/null and b/html/images/prio_decrease.png differ
index 0000000..3773874
Binary files /dev/null and b/html/images/prio_decrease.png differ
diff --git a/html/images/prio_increase.png b/html/images/prio_increase.png
new file mode 100644 (file)
index 0000000..d9d2de4
Binary files /dev/null and b/html/images/prio_increase.png differ
index 0000000..d9d2de4
Binary files /dev/null and b/html/images/prio_increase.png differ
diff --git a/html/images/prio_top.png b/html/images/prio_top.png
new file mode 100644 (file)
index 0000000..93e74ff
Binary files /dev/null and b/html/images/prio_top.png differ
index 0000000..93e74ff
Binary files /dev/null and b/html/images/prio_top.png differ
index fd1c0fade39dc08fe010305d770d161b810a03e9..8f925f6732a60c73dae43b1d438fbd0e476eeb34 100644 (file)
return($this->s_error);
}
+ public function max_entry_priority($id)
+ {
+ if(!$this->id_exists($id)){
+ $this->set_error(sprintf(_("Can't set priority for ID '%s'. ID does not exist."),$id));
+ }
+ $tmp = array();
+ $tmp[]= $this->get_entry($id);
+ foreach($this->a_queue as $key => $entry){
+ if($id != $entry['ID']){
+ $tmp[] = $entry;
+ }
+ }
+ $this->a_queue=$tmp;
+ return($this->_save_data());
+ }
+
+ public function increase_entry_priority($id)
+ {
+ if(!$this->id_exists($id)){
+ $this->set_error(sprintf(_("Can't set priority for ID '%s'. ID does not exist."),$id));
+ }
+ $tmp = array();
+ $skip = NULL;
+ $next = NULL;
+ foreach($this->a_queue as $key => $entry){
+ if($next != NULL){
+ if($id == $entry['ID']){
+ $tmp[] = $entry;
+ $tmp[] = $next;
+ $next = NULL;
+ }else{
+ $tmp[] = $next;
+ $next = $entry;
+ }
+ }else{
+ $next = $entry;
+ }
+ }
+ if($next != NULL){
+ $tmp[] = $next;
+ }
+ $this->a_queue=$tmp;
+ return($this->_save_data());
+ }
+
+ public function decrease_entry_priority($id)
+ {
+ if(!$this->id_exists($id)){
+ $this->set_error(sprintf(_("Can't set priority for ID '%s'. ID does not exist."),$id));
+ }
+ $tmp = array();
+ $skip = NULL;
+ foreach($this->a_queue as $key => $entry){
+ if($id != $entry['ID']){
+ $tmp[] = $entry;
+ if($skip != NULL){
+ $tmp[] = $skip;
+ $skip = NULL;
+ }
+ }else{
+ $skip = $entry;
+ }
+ }
+ if($skip != NULL){
+ $tmp[] = $skip;
+ }
+ $this->a_queue=$tmp;
+ return($this->_save_data());
+ }
+
+ public function min_entry_priority($id)
+ {
+ if(!$this->id_exists($id)){
+ $this->set_error(sprintf(_("Can't set priority for ID '%s'. ID does not exist."),$id));
+ }
+ $tmp = array();
+ foreach($this->a_queue as $key => $entry){
+ if($id != $entry['ID']){
+ $tmp[] = $entry;
+ }
+ }
+ $tmp[]= $this->get_entry($id);
+ $this->a_queue=$tmp;
+ return($this->_save_data());
+ }
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
diff --git a/plugins/addons/gotomasses/class_divListMasses.inc b/plugins/addons/gotomasses/class_divListMasses.inc
index ea4794b685f46e67a673187e335d1aae5d952c3a..186f5c8b3df4fe703b7505cb27c346c56ce70076 100644 (file)
/* set Page header */
$this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
-
- $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=object'>"._("Target")."</a>"));
- $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=schedule'>"._("Schedule")."</a>",
+ $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=QueuePosition'>"._("#")."</a>",
+ "attach"=>"style='width:20px;'"));
+ $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TargetName'>"._("Target")."</a> / ".
+ "<a href='?plug=".$plug."&sort=TaskID'>"._("Task")."</a>"));
+ $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Schedule'>"._("Schedule")."</a>",
"attach"=>"style='width:100px;'"));
- $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=action'>"._("Type")."</a>",
+ $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Action'>"._("Type")."</a>",
"attach"=>"style='width:80px;'"));
$this->AddHeader(array("string"=>_("Action"),
- "attach"=>"style='border-right:0px;width:40px;'"));
+ "attach"=>"style='border-right:0px;width:120px;'"));
}
function GenHeader()
continue;
}
- $id = $task['ID'];
+ $id = $task['ID'];
+ $queue_pos = $task['Queue_Position'];
$color= "background-color: #".$task['color'];
+
+ $prio_actions = "<input class='center' type='image' src='images/prio_top.png' name='prio_top_".$id."'> ";
+ $prio_actions.= "<input class='center' type='image' src='images/prio_increase.png' name='prio_increase_".$id."'> ";
+ $prio_actions.= "<input class='center' type='image' src='images/prio_decrease.png' name='prio_decrease_".$id."'> ";
+ $prio_actions.= "<input class='center' type='image' src='images/prio_bottom.png' name='prio_bottom_".$id."'> ";
$action = "<input type='image' src='images/edit.png' name='edit_task_".$id."' class='center' alt='"._("Edit")."'>";
if($this->parent->acl_is_removeable()){
$field0 = array("string" => "<input type='checkbox' id='item_selected_".$id."' name='item_selected_".$id."'>" ,
"attach" => "style='width:20px;'");
+ /* Create each field */
+ $field0a = array("string" => $queue_pos ,"attach" => "style='width:20px;'");
$field1 = array("string" => preg_replace(array("/%id%/","/%str%/"),array($id,$this->parent->target_to_string($task)),$edit_link),
"attach" => "style='".$color."'");
$field2 = array("string" => $this->parent->time_to_string($task),"attach" => "style='".$color.";width:100px;'");
$field3 = array("string" => $this->parent->action_to_string($task),"attach" => "style='".$color.";width:80px;'");
- $field4 = array("string" => $action,"attach" => "style='".$color.";text-align:right;width:40px;border-right:0px;'");
- $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
+ $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'");
+ $this->AddElement(array($field0,$field0a,$field1,$field2,$field3,$field4));
}
}
diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc
index ab5f436a2ab54092880adf89e2ddfd3663676cf6..74e81cb375658a617d2229af1f5d3f061be18fc8 100644 (file)
var $ids_to_remove = array();
var $divlist = NULL;
+ var $sort_by = "QueuePosition";
+ var $sort_dir= "up";
+
function gotomasses(&$config, $dn= NULL)
{
/* Include config object */
************/
$s_entry = $s_action = "";
- $arr = array( "/^edit_task_/"=>"edit","/^remove_task_/"=>"remove",
+ $arr = array(
+ "/^prio_top_/" => "prio_top",
+ "/^prio_increase_/" => "prio_increase",
+ "/^prio_decrease_/" => "prio_decrease",
+ "/^prio_bottom_/" => "prio_bottom",
+
+ "/^edit_task_/"=>"edit","/^remove_task_/"=>"remove",
"/^new_task_/"=>"new_task","/^remove_multiple_task_/" => "remove_multiple");
foreach($arr as $regex => $action){
foreach($_POST as $name => $value){
$s_entry = $_GET['id'];
}
+ /************
+ * REMOVE
+ ************/
+
+ if(preg_match("/^prio_/",$s_action)){
+
+ switch($s_action){
+ case 'prio_top' : $this->o_queue->max_entry_priority($s_entry);break;
+ case 'prio_increase' : $this->o_queue->increase_entry_priority($s_entry);break;
+ case 'prio_decrease' : $this->o_queue->decrease_entry_priority($s_entry);break;
+ case 'prio_bottom' : $this->o_queue->min_entry_priority($s_entry);break;
+ default : trigger_error("Undefined priority setting used.");
+ }
+ }
+
/************
* REMOVE
************/
return(FALSE);
}
+ $queue_pos = 1;
$tasks = array();
$ret = array();
while($entry = $this->o_queue->fetch()){
if(!isset($tasks[$task])){
$tasks[$task] = dechex(rand(100,240)).dechex(rand(100,240)).dechex(rand(100,240));
}
-
+ $entry['Queue_Position'] = $queue_pos;
$entry['color'] = $tasks[$task];
$ret[]= $entry;
+ $queue_pos ++;
+ }
+
+ /* Sort entries */
+ $simple_map = array("QueuePosition" => "Queue_Position",
+ "Action" => "Action",
+ "TaskID" => "TASK_ID");
+ $sort_arr = array();
+ if(isset($simple_map[$this->sort_by])){
+ foreach($ret as $id => $entry){
+ $sort_arr[$entry[$simple_map[$this->sort_by]]][] = $id;
+ }
}
- return($ret);
+ if($this->sort_by == "TargetName"){
+ foreach($ret as $id => $entry){
+ $name = $this->target_to_string($entry);
+ $sort_arr[$name][] = $id;
+ }
+ }
+ if($this->sort_by == "Schedule"){
+ foreach($ret as $id => $entry){
+ $name = $entry['Minute'].$entry['Hour'].$entry['Day'].$entry['Month'].$entry['Weekday'];
+ $sort_arr[$name][] = $id;
+ }
+ }
+ if($this->sort_dir == "up"){
+ ksort($sort_arr);
+ }else{
+ krsort($sort_arr);
+ }
+ $ret2 = array();
+ foreach($sort_arr as $key => $entries){
+ foreach($entries as $entry_id){
+ $ret2[] = $ret[$entry_id];
+ }
+ }
+ return($ret2);
}
function save_object()
{
$this->divlist->save_object();
+ $sort_vals = array("Action","QueuePosition","TargetName","Schedule","TaskID");
+ if(isset($_GET['sort']) && in_array($_GET['sort'],$sort_vals)){
+ $sort = $_GET['sort'];
+ if($this->sort_by == $sort){
+ if($this->sort_dir == "up"){
+ $this->sort_dir = "down";
+ }else{
+ $this->sort_dir = "up";
+ }
+ }
+ $this->sort_by = $sort;
+ }
}