<!-- restorejob/run-restore.phtml -->

<h1><?php echo $this->escape($this->title . ' ' . $this->jobid); ?></h1>

<?php if ( $this->result_error ): ?>
    <div class="ui-widget" style="width: 50%;">
        <div class="ui-state-error ui-corner-all" style="padding: 0pt 0.7em;">
            <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: 0.3em;"></span>
            <strong>
    <?php
        switch ( $this->result_error )
        {
            case 'ERROR_BCONSOLE': // ошибка при запуске bconsole
                $msg = $this->translate->_('ERROR: There was a problem executing bconsole.');
                break;
            case 'NOFOUND_BCONSOLE': // bconsole не найден
                $msg = $this->translate->_('ERROR: bconsole not found.');
                break;
            default: $msg = '';
        }
        echo $msg;
        if ( $this->command_output )
        {
            foreach ($this->command_output as $line) {
             echo '<br>', $line, '<br>';
          }
        }
    ?>
            </strong></p>
        </div>
    </div>
<?php else: ?>

<!-- director output -->
<table id="table-dir-output">
<tr><td>
<b><?php print $this->translate->_("Director output:"); ?></b>
<?php
    if ( $this->command_output )
    {
        echo '<pre>';
        foreach ($this->command_output as $line) {
            if ( preg_match('/(ERR|not found|invalid|Expected)/i', $line) )   {
                    echo '<div style="color: white; background-color: red;">', $line, '</div><br>';
            } else {
                    echo $line, '<br>';
            }
        }
	echo '</pre>';
    }
    ?>

    <p>&nbsp;</p>
    <div align="center">
    <form action="<?php  echo $this->baseUrl.'/job/running';?>" method="post">
    <?php echo $this->formSubmit('ok1', $this->translate->_('View Running Jobs') ); ?>
    </form></div>
</td></tr>
</table>
<?php endif; ?>