From: hickert Date: Mon, 21 Jan 2008 15:01:09 +0000 (+0000) Subject: Added queue entry start / stop X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f997864db5d2598dc10d2c54fdaebfb789462f2c;p=gosa.git Added queue entry start / stop git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8523 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_gosaSupportDaemon.inc b/gosa-core/include/class_gosaSupportDaemon.inc index 14f84f7c8..6d29cc6d1 100644 --- a/gosa-core/include/class_gosaSupportDaemon.inc +++ b/gosa-core/include/class_gosaSupportDaemon.inc @@ -259,6 +259,8 @@ class gosaSupportDaemon */ public function update_entry($id,$entry) { + $this->b_error = FALSE; + $this->s_error = ""; if(!is_numeric($id)){ trigger_error("Requires an integer value as ID parameter."); return; @@ -274,9 +276,6 @@ class gosaSupportDaemon $attr.="<".strtolower($name).">".$entry."\n"; } - $this->b_error = FALSE; - $this->s_error = ""; - $xml_msg = "
gosa_update_status_jobdb_entry
@@ -288,7 +287,6 @@ class gosaSupportDaemon
"; $this->connect(); if($this->is_connected){ - echo $xml_msg; $this->o_sock->write($xml_msg); $str = trim($this->o_sock->read()); $entries = $this->xml_to_array($str); diff --git a/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc b/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc index cc1dc8865..42d08b005 100644 --- a/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc +++ b/gosa-core/plugins/addons/gotomasses/class_divListMasses.inc @@ -65,10 +65,8 @@ class divListMasses extends MultiSelectWindow /* Add priority options */ if(preg_match("/w/",$this->parent->getacl(""))){ - $header .= " "; - $header .= " "; - $header .= " "; - $header .= " "; + $header .= " "; + $header .= " "; } $header .= ""; @@ -118,10 +116,8 @@ class divListMasses extends MultiSelectWindow /* Create actions */ $id = $task['ID']; $queue_pos = $id; - $prio_actions = " "; - $prio_actions.= " "; - $prio_actions.= " "; - $prio_actions.= " "; + $prio_actions = " "; + $prio_actions.= " "; $action = ""; if($this->parent->acl_is_removeable()){ $action.= ""; diff --git a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc index 9d08ad8fb..2df2bd6b1 100644 --- a/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc +++ b/gosa-core/plugins/addons/gotomasses/class_gotomasses.inc @@ -38,15 +38,10 @@ class gotomasses extends plugin $s_entry = $s_action = ""; $arr = array( - "/^prio_top_/" => "prio_top", - "/^prio_increase_/" => "prio_increase", - "/^prio_decrease_/" => "prio_decrease", - "/^prio_bottom_/" => "prio_bottom", - - "/^multiple_prio_top_/" => "mprio_top", - "/^multiple_prio_increase_/" => "mprio_increase", - "/^multiple_prio_decrease_/" => "mprio_decrease", - "/^multiple_prio_bottom_/" => "mprio_bottom", + "/^stop_/" => "stop", + "/^stop_all/" => "stop_all", + "/^start/" => "start", + "/^start_all/" => "start_all", "/^edit_task_/" => "edit", "/^remove_task_/" => "remove", @@ -74,29 +69,19 @@ class gotomasses extends plugin * Handle Priority modifications ************/ - if(preg_match("/^mprio_/",$s_action) || preg_match("/^prio_/",$s_action)){ + if(preg_match("/^start_/",$s_action) || preg_match("/^stop_/",$s_action)){ switch($s_action){ - case 'mprio_top' : foreach($this->list_get_selected_items() as $id ){ - $this->o_queue->max_entry_priority($id); - } - break; - case 'mprio_increase' : foreach($this->list_get_selected_items() as $id ){ - $this->o_queue->increase_entry_priority($id); - } - break; - case 'mprio_decrease' : foreach($this->list_get_selected_items() as $id ){ - $this->o_queue->decrease_entry_priority($id); - } - break; - case 'mprio_bottom' : foreach($this->list_get_selected_items() as $id ){ - $this->o_queue->min_entry_priority($id); - } - break; - 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; + case 'start_all' :foreach($this->list_get_selected_items() as $id){ + $this->start_queue_entry($id); + } + break; + case 'start' :$this->start_queue_entry($s_entry);break; + case 'stop_all' :foreach($this->list_get_selected_items() as $id){ + $this->stop_queue_entry($id); + } + break; + case 'stop' : $this->stop_queue_entry($s_entry);break; default : trigger_error("Undefined priority setting used."); } if($this->o_queue->is_error()){ @@ -226,6 +211,46 @@ class gotomasses extends plugin } + /*! \brief Force queue job to be done as far as possible. + * @return Boolean TRUE in case of success, else FALSE. + */ + private function start_queue_entry($id) + { + $attr = $this->o_queue->get_entry($id); + if(is_array($attr)){ + $data = array("timestamp" => date("YmdHis"), + "status" => "-"); + if(!$this->o_queue->update_entry($id,$data)){ + msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG); + return(FALSE); + }else{ + return(FALSE); + } + } + return(FALSE); + } + + + /*! \brief Stops the specified queue entry from execution. + * @return Boolean TRUE in case of success, else FALSE. + */ + private function stop_queue_entry($id) + { + $attr = $this->o_queue->get_entry($id); + if(is_array($attr)){ + $data = array("timestamp" => "20370101010000", + "status" => "stopped"); + if(!$this->o_queue->update_entry($id,$data)){ + msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG); + return(FALSE); + }else{ + return(FALSE); + } + } + return(FALSE); + } + + /*! \brief Request list of queued jobs. * @return Returns an array of all queued jobs. */