From: hickert Date: Thu, 28 Feb 2008 10:45:11 +0000 (+0000) Subject: Updated gotmasses. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=760d74506ee6af3e2a9d05898f78602174d74b67;p=gosa.git Updated gotmasses. -Added 'pause' 'resume' 'abort' 'execute' git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9183 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc index 1cc10293c..6a32d5ec7 100644 --- a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc +++ b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc @@ -43,8 +43,9 @@ class gotomasses extends plugin $s_entry = $s_action = ""; $arr = array( - "/^stop_/" => "stop", - "/^start_/" => "start", + "/^pause_/" => "pause", + "/^resume_/" => "resume", + "/^execute_process_/" => "execute_process", "/^prio_up_/" => "prio_up", "/^prio_down_/" => "prio_down", @@ -90,16 +91,17 @@ class gotomasses extends plugin } /************ - * Handle start/stop modifications + * Handle pause/resume/execute modifications ************/ - if(preg_match("/^start/",$s_action) || preg_match("/^stop/",$s_action)){ + if(preg_match("/^resume/",$s_action) || + preg_match("/^pause/",$s_action) || + preg_match("/^execute_process/",$s_action)){ switch($s_action){ - case 'start_all' : $this->start_queue_entries($this->list_get_selected_items());break; - case 'start' : $this->start_queue_entries(array($s_entry));break; - case 'stop_all' : $this->stop_queue_entries ($this->list_get_selected_items());break; - case 'stop' : $this->stop_queue_entries (array($s_entry));break; + case 'resume' : $this->resume_queue_entries(array($s_entry));break; + case 'pause' : $this->pause_queue_entries (array($s_entry));break; + case 'execute_process': $this->execute_queue_entries (array($s_entry));break; default : trigger_error("Undefined priority setting used."); } if($this->o_queue->is_error()){ @@ -257,8 +259,8 @@ class gotomasses extends plugin } if(preg_match("/w/",$this->getacl(""))){ $s.= "..|---|\n"; - $s.= "..| "._("Start all")."|start_all\n"; - $s.= "..| "._("Stop all")."|stop_all\n"; + $s.= "..| "._("Resume all")."|resume_all_\n"; + $s.= "..| "._("Pause all")."|pause_all_\n"; } $divlist->SetDropDownHeaderMenu($s); @@ -299,10 +301,33 @@ class gotomasses extends plugin foreach($this->entries as $key => $task){ - $prio_actions = " "; - $prio_actions.= " "; - $prio_actions.= " "; - $prio_actions.= " "; + $prio_actions=""; + if(isset($task['STATUS']) && preg_match("/waiting/",$task['STATUS'])){ + $prio_actions.= " "; + $prio_actions.= " "; + } + + if(isset($task['STATUS']) && preg_match("/waiting/",$task['STATUS'])){ + $prio_actions.= " "; + } + if(isset($task['STATUS']) && preg_match("/paused/",$task['STATUS'])){ + $prio_actions.= " "; + } + + if(isset($task['STATUS']) && preg_match("/processing/",$task['STATUS'])){ + $prio_actions.= " "; + } + + if(isset($task['STATUS']) && + (preg_match("/paused/",$task['STATUS']) || preg_match("/waiting/",$task['STATUS']))){ + $prio_actions.= " "; + } $action = ""; @@ -405,17 +430,35 @@ class gotomasses extends plugin } - /*! \brief Force queue job to be done as far as possible. + /*! \brief Resumes to status 'waiting'. * @return Boolean TRUE in case of success, else FALSE. */ - private function start_queue_entries($ids) + private function resume_queue_entries($ids) { if(!count($ids)){ return; } - $data = array("timestamp" => date("YmdHis"), - "status" => "-"); + $data = array("status" => "waiting"); + if(!$this->o_queue->update_entries($ids,$data)){ + msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG); + return(FALSE); + } + return(TRUE); + } + + + /*! \brief Force queue job to be done as far as possible. + * @return Boolean TRUE in case of success, else FALSE. + */ + private function execute_queue_entries($ids) + { + if(!count($ids)){ + return; + } + + $data = array( "timestamp" => date("YmdHis",time()), + "status" => "waiting"); if(!$this->o_queue->update_entries($ids,$data)){ msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG); return(FALSE); @@ -424,16 +467,15 @@ class gotomasses extends plugin } - /*! \brief Stops the specified queue entry from execution. + /*! \brief Pauses the specified queue entry from execution. * @return Boolean TRUE in case of success, else FALSE. */ - private function stop_queue_entries($ids) + private function pause_queue_entries($ids) { if(!count($ids)){ return; } - $data = array("timestamp" => date("YmdHis",(time() + (60*60*24*365))), - "status" => _("Stoppped")); + $data = array("status" => "paused"); if(!$this->o_queue->update_entries($ids,$data)){ msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG); return(FALSE);