$dbSql = new Bweb();
// Jobs list
- $query = "";
- $last_jobs = array();
+ $query = "";
+ $last_jobs = array();
// Job Status list
- $job_status = array( 'Any', 'Waiting', 'Running', 'Completed', 'Failed', 'Canceled' );
+ define( 'STATUS_ALL', 0 );
+ define( 'STATUS_RUNNING', 1 );
+ define( 'STATUS_WAITING', 2 );
+ define( 'STATUS_COMPLETED', 3 );
+ define( 'STATUS_FAILED', 4 );
+ define( 'STATUS_CANCELED', 5 );
+
+ $job_status = array( STATUS_ALL => 'All',
+ STATUS_RUNNING => 'Running',
+ STATUS_WAITING => 'Waiting',
+ STATUS_COMPLETED => 'Completed',
+ STATUS_FAILED => 'Failed',
+ STATUS_CANCELED => 'Canceled' );
+
$dbSql->tpl->assign( 'job_status', $job_status );
// Jobs per page
// Filter by status
if( isset( $_POST['status'] ) ) {
- switch( strtolower( $_POST['status'] ) )
+ switch( $_POST['status'] )
{
- case 'running':
+ case STATUS_RUNNING:
$query .= "WHERE Job.JobStatus = 'R' ";
break;
- case 'waiting':
+ case STATUS_WAITING:
$query .= "WHERE Job.JobStatus IN ('F','S','M','m','s','j','c','d','t','p','C') ";
break;
- case 'completed':
+ case STATUS_COMPLETED:
$query .= "WHERE Job.JobStatus IN ('T', 'E') ";
break;
- case 'failed':
+ case STATUS_FAILED:
$query .= "WHERE Job.JobStatus = 'f' ";
break;
- case 'canceled':
+ case STATUS_CANCELED:
$query .= "WHERE Job.JobStatus = 'A' ";
break;
}
+ $dbSql->tpl->assign('job_status_filter', $_POST['status'] );
}
// order by
<td class="info" width="200">
{$total_jobs} jobs found
</td>
- <td class="info" colspan="5" style="text-align: right;">
+ <td class="info" colspan="5">
Jobs / Page
<select name="jobs_per_page">
{foreach from=$jobs_per_page item=nb_jobs}
{/foreach}
</select>
</td>
- <td class="info" width="200">
- Job Status
- <select name="status">
- {foreach from=$job_status item=status_label}
- <option value="{$status_label}" {if $smarty.post.status == $status_label}Selected{/if} >{$status_label}
- {/foreach}
- </select>
+ <td class="info" width="160">
+ Job status
+ {html_options name=status values=$job_status options=$job_status selected=$job_status_filter onChange="submit();"}
</td>
+ <!--
<td class="info" width="120">
<input type="submit" value="Update" />
</td>
+ -->
</tr>
<tr>
<td colspan="8"> </td>