From e68a5af4aee6d249f4d9511dc2d29a0f6e584cec Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 29 Jan 2008 14:40:35 +0000 Subject: [PATCH] Gotomasses update. -Removed list class. -Removed ID from list. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8636 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/gotomasses/class_divListMasses.inc | 151 ------------------ .../addons/gotomasses/class_gotomasses.inc | 75 ++++++++- 2 files changed, 70 insertions(+), 156 deletions(-) delete mode 100644 gosa-core/plugins/addons/gotomasses/class_divListMasses.inc diff --git a/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc b/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc deleted file mode 100644 index e94027f32..000000000 --- a/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc +++ /dev/null @@ -1,151 +0,0 @@ -parent = $parent; - $this->ui = get_userinfo(); - $this->SetSummary(_("List of queued deamon jobs.")); - $this->SetHeadpageMode(); - $this->EnableCloseButton(FALSE); - $this->EnableSaveButton(FALSE); - $this->SetInformation(_("This menu allows you to remove and change the properties of GOsa deamon tasks.")); - - $plug = $_GET['plug']; - - /* Toggle all selected / deselected */ - $chk = ""; - - /* set Page header */ - $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); - $this->AddHeader(array("string"=>""._("#")."", - "attach"=>"style='width:20px;'")); - $this->AddHeader(array("string"=>""._("Target")." / ". - ""._("Task")."")); - $this->AddHeader(array("string"=>""._("Schedule")."", - "attach"=>"style='width:100px;'")); - $this->AddHeader(array("string"=>""._("Status")."", - "attach"=>"style='width:80px;'")); - $this->AddHeader(array("string"=>_("Action"), - "attach"=>"style='border-right:0px;width:120px;'")); - } - - function GenHeader() - { - - /* Display add button if allowed */ - $header = "
"; -# if($this->parent->acl_is_createable()){ -# $header .= " "; -# } - - /* Display remove button if allowed */ - if($this->parent->acl_is_removeable()){ - $header .= " "; - } - - /* Add priority options */ - if(preg_match("/w/",$this->parent->getacl(""))){ - $header .= " "; - $header .= " "; - } - $header .= "
"; - - /* Create divlist */ - $this->SetListHeader($header); - } - - - function execute() - { - $this->ClearElementsList(); - $this->GenHeader(); - } - - - function setEntries($tasks) - { - /* Create edit link */ - $plug = $_GET['plug']; -# $edit_link = "
%str%
"; - $edit_link = "%str%"; - - $colors[0] = "#DDDDDD"; - $colors[1] = "#EEEEEE"; - $c_keys = array(); - $last_c = 0; - if($this->parent->sort_dir=="down"){ - $last_c = !$last_c; - } - - foreach($tasks as $key => $task){ - - $color = ""; - /* Skip unchecked actions */ -# if(!in_array($task['Action'],$allowed_action)){ -# continue; -# } - - /* Create actions */ - $id = $task['ID']; - $queue_pos = $id; - $prio_actions = " "; - $prio_actions.= " "; - $action = ""; - if($this->parent->acl_is_removeable()){ - $action.= ""; - } - - $display = preg_replace(array("/%id%/","/%str%/"),array($id,$task['MACADDRESS']),$edit_link); - $display2= $task['HEADERTAG']; - - /* Create each field */ - $field0 = array("string" => "" , - "attach" => "style='width:20px;".$color."'"); - $field0a= array("string" => $queue_pos ,"attach" => "style='width:20px;".$color."'"); - $field1 = array("string" => $display, - "attach" => "style='".$color."'"); - $field1a= array("string" => $display2, - "attach" => "style='".$color.";width:80px;'"); - $field2 = array("string" => $this->stamp_to_date($task['TIMESTAMP']),"attach" => "style='".$color.";width:100px;'"); - $field3 = array("string" => $task['STATUS'],"attach" => "style='".$color.";width:80px;'"); - $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'"); - $this->AddElement(array($field0,$field0a,$field1,$field1a,$field2,$field3,$field4)); - } - } - - - function stamp_to_date($stamp) - { - return(date("d.m.Y H:i:s",strtotime($stamp))); - } - - - function Save() - { - MultiSelectWindow :: Save(); - } - - - function save_object() - { - /* Save automatic created POSTs like regex, checkboxes */ - MultiSelectWindow :: save_object(); - } -} -// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: -?> diff --git a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc index 87753c53f..e5090c877 100644 --- a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc +++ b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc @@ -26,7 +26,6 @@ class gotomasses extends plugin { /* Include config object */ $this->config= &$config; - $this->divlist = new divListMasses($this->config,$this); $this->o_queue = new gosaSupportDaemon("10.3.67.111","20081","secret-gosa-password",TRUE,10); } @@ -198,9 +197,76 @@ class gotomasses extends plugin * Handle Divlist ************/ - $this->divlist->execute(); + $divlist = new MultiSelectWindow($this->config,"gotoMasses",array("gotomasses")); + $divlist->SetInformation(_("This menu allows you to remove and change the properties of GOsa deamon tasks.")); + $divlist->SetSummary(_("List of queued deamon jobs.")); + $divlist->EnableCloseButton(FALSE); + $divlist->EnableSaveButton(FALSE); + $divlist->SetHeadpageMode(); + + + + /* Display add button if allowed */ + $header = "
"; + if($this->acl_is_removeable()){ + $header .= " "; + } + if(preg_match("/w/",$this->getacl(""))){ + $header .= " "; + $header .= " "; + } + $header .= "
"; + + /* Create divlist */ + $divlist->SetListHeader($header); + + $plug = $_GET['plug']; + $chk = ""; + + /* set Page header */ + $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); + $divlist->AddHeader(array("string"=>"
"._("Target")." / ". + ""._("Task")."")); + $divlist->AddHeader(array("string"=>""._("Schedule")."", + "attach"=>"style='width:100px;'")); + $divlist->AddHeader(array("string"=>""._("Status")."", + "attach"=>"style='width:80px;'")); + $divlist->AddHeader(array("string"=>_("Action"), + "attach"=>"style='border-right:0px;width:120px;'")); + + $entries = $this->get_queued_entries(); - $this->divlist->SetEntries($entries); + + foreach($entries as $key => $task){ + + $prio_actions = " "; + $prio_actions.= " "; + + $action = ""; + + if($this->acl_is_removeable()){ + $action.= ""; + } + + $color = ""; + $display = $task['MACADDRESS']; + $display2= $task['HEADERTAG']; + + /* Create each field */ + $field0 = array("string" => "" , + "attach" => "style='width:20px;".$color."'"); + $field1 = array("string" => $display, + "attach" => "style='".$color."'"); + $field1a= array("string" => $display2, + "attach" => "style='".$color.";width:80px;'"); + $field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:100px;'"); + $field3 = array("string" => $task['STATUS'],"attach" => "style='".$color.";width:80px;'"); + $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'"); + $divlist->AddElement(array($field0,$field1,$field1a,$field2,$field3,$field4)); + } $smarty = get_smarty(); @@ -217,7 +283,7 @@ class gotomasses extends plugin $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()); + $smarty->assign("div",$divlist->Draw()); return($smarty->fetch (get_template_path('gotomasses.tpl', TRUE, dirname(__FILE__)))); } @@ -303,7 +369,6 @@ class gotomasses extends plugin */ 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']; -- 2.30.2