| 1 |
<? |
| 2 |
/* |
| 3 |
## ------------------------------------------------------------------------- |
| 4 |
## $Id: utils.php,v 1.2 2003/02/20 22:42:10 joko Exp $ |
| 5 |
## ------------------------------------------------------------------------- |
| 6 |
## $Log: utils.php,v $ |
| 7 |
## ------------------------------------------------------------------------- |
| 8 |
*/ |
| 9 |
|
| 10 |
|
| 11 |
// ---------------------------------------------------------- |
| 12 |
// View/Item: job detail area |
| 13 |
|
| 14 |
class YAA_JobDetails extends InfoTable { |
| 15 |
|
| 16 |
var $jobs; |
| 17 |
var $backend; |
| 18 |
var $lift; |
| 19 |
|
| 20 |
function YAA_JobDetails($jobname, $action = '') { |
| 21 |
$this->backend = new TsBackend(); |
| 22 |
//$this->lift = new Data_Lift( array( metatype => 'job' ) ); |
| 23 |
$this->lift = mkObject('Data::Lift', undef, array( metatype => 'job' ) ); |
| 24 |
|
| 25 |
// execute action |
| 26 |
if ($action == 'run') { |
| 27 |
$this->run($jobname); |
| 28 |
} |
| 29 |
|
| 30 |
return $this->_do($jobname, $action); |
| 31 |
} |
| 32 |
|
| 33 |
function run($jobname) { |
| 34 |
$this->backend->runTask($jobname); |
| 35 |
} |
| 36 |
|
| 37 |
function _do($taskname, $action) { |
| 38 |
|
| 39 |
// frontend |
| 40 |
$caption = "Job Status for: $taskname | Action: $action"; |
| 41 |
$this->set_title($caption); |
| 42 |
$this->set_cellpadding(10); |
| 43 |
|
| 44 |
|
| 45 |
// get status and prepare data |
| 46 |
$taskinfo = $this->backend->getTaskInfo($taskname); |
| 47 |
|
| 48 |
//print Dumper($taskinfo); |
| 49 |
|
| 50 |
// get and modify description |
| 51 |
//$description = $taskinfo[metadata][description]; |
| 52 |
//if (is_array($taskinfo)) { |
| 53 |
$this->lift->set($taskinfo); |
| 54 |
$this->lift->to('html'); |
| 55 |
$this->lift->add(array( name => $key ) ); |
| 56 |
$out = $this->lift->get(); |
| 57 |
//$description = $out[description]; |
| 58 |
//} |
| 59 |
|
| 60 |
if ($taskinfo[jobstatus][running]) { |
| 61 |
$status_text = "[running]"; |
| 62 |
$status_symbol = "<img src=\"img/cube.gif\" width=\"80\" />"; |
| 63 |
} else { |
| 64 |
$status_text = "[not running]"; |
| 65 |
$status_symbol = "xxx"; |
| 66 |
} |
| 67 |
|
| 68 |
// actions |
| 69 |
/* |
| 70 |
$prefix = " "; |
| 71 |
$actions = container( |
| 72 |
$prefix, rAction( 'run', array( job => $taskname )), html_br(), |
| 73 |
$prefix, rAction( 'show log', array( job => $taskname )), html_br() |
| 74 |
); |
| 75 |
*/ |
| 76 |
$controlbox = new VerticalCSSNavTable('Actions:'); |
| 77 |
$controlbox->add( httpQuery( array( action => 'status', job => $taskname )), 'status' ); |
| 78 |
$controlbox->add( httpQuery( array( action => 'run', job => $taskname )), 'run' ); |
| 79 |
|
| 80 |
// build box |
| 81 |
//$box .= "<br/><br/>"; |
| 82 |
//$jobtable->add_row( $description, container( html_b("actions: "), html_br(), $actions ), container($status, html_br(), $box) ); |
| 83 |
$this->add_row( $controlbox, container($out[description], html_br(), $out[steps]) ); |
| 84 |
$this->add_row( " ", container($status_text, html_br(), $status_symbol) ); |
| 85 |
//$jobtable->add_row(Dumper($taskinfo[jobstatus]), "-"); |
| 86 |
|
| 87 |
|
| 88 |
/* |
| 89 |
if (is_array($this->jobs[target])) { |
| 90 |
|
| 91 |
foreach($this->jobs[target] as $key => $job) { |
| 92 |
|
| 93 |
$this->lift->set($job); |
| 94 |
$this->lift->to('html'); |
| 95 |
$this->lift->add(array( name => $key ) ); |
| 96 |
|
| 97 |
$out = $this->lift->get(); |
| 98 |
|
| 99 |
$controlbox = new VerticalCSSNavTable('Actions:'); |
| 100 |
$controlbox->add( httpQuery( array( action => 'status', job => $out[name] )), 'status' ); |
| 101 |
$controlbox->add( httpQuery( array( action => 'run', job => $out[name] )), 'run' ); |
| 102 |
|
| 103 |
$this->add_row( |
| 104 |
$controlbox, |
| 105 |
container(html_b($out[name]), html_br(), html_br(), html_b('description:'), html_br(), $out[description], html_br(), $out[steps]) |
| 106 |
); |
| 107 |
} |
| 108 |
*/ |
| 109 |
|
| 110 |
/* |
| 111 |
} else { |
| 112 |
$this->add("Diese Anfrage führte zu keinem Ergebnis.<br/> Bitte wählen Sie in der Liste links eine andere Job-Kategorie aus.<br/>"); |
| 113 |
|
| 114 |
} |
| 115 |
*/ |
| 116 |
|
| 117 |
} |
| 118 |
|
| 119 |
} |
| 120 |
|
| 121 |
|
| 122 |
?> |