Ejemplo n.º 1
0
            $h[$k][$index] = $v;
        }
        $index += 1;
    }
    $max = 0;
    $conf["global"]["maxperpage"] = $index;
    $disabled_columns = isExpertMode() ? array() : getInventoryEM($table);
    foreach ($h as $k => $v) {
        if ($k != 'id' && $k != 'timestamp' && !in_array($k, $disabled_columns)) {
            if ($n == null) {
                $n = new ListInfos($h[$k], $k);
            } else {
                $n->addExtraInfo($h[$k], $k);
            }
            if (count($h[$k]) > $max) {
                $max = count($h[$k]);
            }
        }
    }
    if ($max > 0 && $n != null) {
        echo "<h3>{$table} ({$max})</h3>";
        $n->drawTable(0);
        echo "<br/><br/>";
    }
    $conf["global"]["maxperpage"] = $max;
}
?>

</table>

Ejemplo n.º 2
0
 function display()
 {
     // display parameters
     if (!$this->db_cmd) {
         # use does not have the good permissions
         $widget = new RenderedMSCCommandDontExists();
         $widget->display();
         return;
     }
     if ($this->db_cmd['start_date']) {
         if ($this->db_cmd['end_date']) {
             $validity = sprintf(_T('<i>from</i> %s <i>to</i> %s', 'msc'), _toDate($this->db_cmd['start_date']), _toDate($this->db_cmd['end_date']));
         } else {
             $validity = sprintf(_T('<i>from</i> %s', 'msc'), _toDate($this->db_cmd['start_date']));
         }
     } else {
         if ($this->db_cmd['end_date']) {
             $validity = sprintf(_T('<i>to</i> %s', 'msc'), _toDate($this->db_cmd['end_date']));
         } else {
             $validity = _T('<i>forever</i>', 'msc');
         }
     }
     if ($this->db_cmd['deployment_intervals']) {
         $deploy_interv = str_replace(array('-', ','), array(' - ', ', '), $this->db_cmd['deployment_intervals']);
     } else {
         $deploy_interv = _T('<i>whole day</i>', 'msc');
     }
     if ($this->db_cmd['deployment_intervals']) {
         $deploy_interv = str_replace(array('-', ','), array(' - ', ', '), $this->db_cmd['deployment_intervals']);
     } else {
         $deploy_interv = _T('<i>whole day</i>', 'msc');
     }
     if ($this->db_coh['next_launch_date']) {
         $next_launch_date = _toDate($this->db_coh['next_launch_date']);
     } else {
         if ($this->db_cmd['start_date']) {
             $next_launch_date = _toDate($this->db_cmd['start_date']);
         } else {
             $next_launch_date = _T('<i>as soon as possible</i>', 'msc');
         }
     }
     if ($this->db_coh['start_date']) {
         $start_date = _toDate($this->db_coh['start_date']);
     } else {
         $start_date = _T('<i>not yet available</i>', 'msc');
     }
     if ($this->db_coh['end_date']) {
         $end_date = _toDate($this->db_coh['end_date']);
     } else {
         $end_date = _T('<i>not yet available</i>', 'msc');
     }
     if ($this->db_coh['last_wol_attempt']) {
         $last_wol_attempt = _toDate($this->db_coh['last_wol_attempt']);
     } else {
         $last_wol_attempt = _T('<i>not available</i>', 'msc');
     }
     if ($this->db_cmd['start_file']) {
         if ($this->db_cmd['parameters']) {
             $command_line = sprintf(_T('%s %s', 'msc'), $this->db_cmd['start_file'], $this->db_cmd['parameters']);
         } else {
             $command_line = sprintf(_T('%s <i>(no additional parameter given)</i>', 'msc'), $this->db_cmd['start_file']);
         }
     } else {
         $command_line = _T('<i>not set</i>', 'msc');
     }
     if ($this->db_coh['order_in_proxy'] == '') {
         $proxy_priority = _T('None (Local Proxy Client)', 'msc');
     } else {
         $proxy_priority = sprintf(_T('%s (Local Proxy Server)', 'msc'), $this->db_coh['order_in_proxy']);
     }
     if ($this->db_cmd['proxy_mode'] == 'split') {
         $proxy_mode = _T('Multiple', 'msc');
     } elseif ($this->db_cmd['proxy_mode'] == 'queue') {
         $proxy_mode = _T('Single with fallback', 'msc');
     } elseif ($this->db_cmd['proxy_mode'] == 'none') {
         $proxy_mode = _T('No proxy', 'msc');
         $proxy_priority = _T('None', 'msc');
     } else {
         $proxy_mode = _T('<i>not available</i>', 'msc');
         $proxy_priority = _T('<i>not available</i>', 'msc');
     }
     if ($this->db_lproxy) {
         $current_proxy = $this->db_lproxy['host'];
     } else {
         $current_proxy = _T('<i>not available</i>', 'msc');
     }
     // gettext obfucation
     _T('enable', 'msc');
     _T('disable', 'msc');
     _T('done', 'msc');
     _T('failed', 'msc');
     _T('over_time', 'msc');
     _T('out_of_interval', 'msc');
     // =====================================================================
     function formatLog($hist)
     {
         $i = 1;
         if ($hist['state'] == 'upload_in_progress' && $hist['error_code'] == '0' && array_key_exists('stderr', $hist) && $i != count($this->db_ch) && strpos($hist['stderr'], 'is available on mirror') !== False) {
             /*
              We are displaying which package server was used in push pull
              mode. We want to keep the led green instead of orange to
              tell the user that there was no problem.
             */
             $staticon = history_stat2icon("upload_done");
         } elseif ($hist['state'] == 'wol_failed' && $hist['error_code'] == '2001') {
             $staticon = history_stat2icon("stop");
         } else {
             $staticon = history_stat2icon($hist['state']);
         }
         $history = date("Y-m-d H:i:s", $hist['date']);
         /* Split lines in stdout and stderr */
         if (gettype($hist["stdout"]) != 'array') {
             $hist["stdout"] = split("\n", $hist["stdout"]);
         }
         if (gettype($hist["stderr"]) != 'array') {
             $hist["stderr"] = split("\n", $hist["stderr"]);
         }
         if (count($hist["stdout"]) > 0 && !(count($hist["stdout"]) == 1 && $hist["stdout"][0] == '')) {
             $hist["stderr"] = array_merge($hist["stderr"], $hist["stdout"]);
         }
         if (strpos($hist['state'], '_failed') !== False || $hist['error_code'] > 4501 && $hist['error_code'] < 5000) {
             $msgs = array(255 => _T("Error while connecting to secure agent on this host. Please check network connectivity, and that the secure agent is installed on this host.", 'msc'), 200 + 9 => _T("The script was killed by Pulse 2 (timeout ?).", 'msc'), 200 + 15 => _T("The script was terminated by Pulse 2.", 'msc'), 240 + 0 => _T("Something goes wrong while checking client identity.", 'msc'), 240 + 1 => _T("The current host name doesn't match the host name from the inventory database.", 'msc'), 240 + 2 => _T("The current host IP address doesn't match the IP address from the inventory database.", 'msc'), 240 + 3 => _T("The current host MAC address doesn't match the MAC address from the inventory database.", 'msc'), 4000 + 1 => sprintf(_T("The package '%s' is not available on any mirror.", "msc"), $hist['stderr'][0]), 4000 + 2 => sprintf(_T("Can't get files URI for package '%s' on mirror %s.\nPlease check that the package and its files have not been modified since the planning of the command.", "msc"), $hist['stderr'][0], $hist['stderr'][1]), 4000 + 3 => sprintf(_T("Can't get files URI for package '%s' on fallback mirror %s.\nPlease check that the package and its files have not been modified since the planning of the command.", "msc"), $hist['stderr'][0], $hist['stderr'][1]), 4000 + 4 => sprintf(_T("An error occurred when trying to contact the mirror '%s' : the connection was refused.", "msc"), $hist['stderr'][0]), 4000 + 5 => sprintf(_T("An error occurred when trying to contact the fallback mirror '%s' : the connection was refused.", "msc"), $hist['stderr'][0]), 4000 + 6 => sprintf(_T("An error occurred when trying to contact the mirror '%s' : the mountpoint doesn't exists.", "msc"), $hist['stderr'][0]), 4000 + 7 => sprintf(_T("An error occurred when trying to contact the fallback mirror '%s' : the mountpoint doesn't exists.", "msc"), $hist['stderr'][0]), 4500 + 8 => sprintf(_T("Package '%s' is NOT available on primary mirror %s\nPackage '%s' is available on fallback mirror %s", "msc"), $hist['stdout'][0], $hist['stdout'][1], $hist['stdout'][2], $hist['stdout'][3]), 4500 + 9 => sprintf(_T("Package '%s' is available on primary mirror %s", "msc"), $hist['stdout'][0], $hist['stdout'][1]));
             if ($hist['error_code'] >= 4001 && $hist['error_code'] < 5000) {
                 $hist["stderr"] = array('');
             }
             if (array_key_exists($hist['error_code'], $msgs)) {
                 $hist['stderr'][] = $msgs[$hist['error_code']];
             }
         }
         $raw_errors = array_map('_colorise', array_filter($hist["stderr"]));
         $purge_errors = array();
         foreach ($raw_errors as $error) {
             if (isset($error)) {
                 array_push($purge_errors, $error);
             }
         }
         return array($history, $purge_errors);
     }
     // =====================================================================
     ### Display command phases ###
     $phases = $this->db_coh['phases'];
     $phase_labels = getPhaseLabels();
     $hidden_phases = array('done');
     $phase_names = array();
     $phase_dates = array();
     $phase_states = array();
     $phase_logs = array();
     $btn_showfull_log = array();
     // Organize logs by phase
     $logs_by_phase = array();
     foreach ($this->db_ch as $entry) {
         // Decode base64 stdout and stderr before processing
         $entry['stdout'] = base64_decode($entry['stdout']);
         $entry['stderr'] = base64_decode($entry['stderr']);
         // if $logs_by_phase doesnt contain phase key we create it
         if (!isset($logs_by_phase[$entry['phase']])) {
             $logs_by_phase[$entry['phase']] = array();
         }
         $logs_by_phase[$entry['phase']][] = $entry;
     }
     $ts_next_launch_time = _toTimestamp($this->db_coh['next_launch_date']);
     foreach ($phases as $phase) {
         // Passing hidden phases
         if (in_array($phase['name'], $hidden_phases)) {
             continue;
         }
         $phase_names[] = $phase_labels[$phase['name']];
         $phase_states[] = _plusIcon($phase['state']);
         if (isset($logs_by_phase[$phase['name']]) && count($logs_by_phase[$phase['name']])) {
             $formatted_logs = array_map('formatLog', $logs_by_phase[$phase['name']]);
         } else {
             if ($ts_next_launch_time > mktime() && ($phase['state'] == 'failed' || $phase['state'] == 'ready')) {
                 $last_try_time = _toDate($this->db_coh['next_launch_date']) . sprintf(' (%s)', _T('next attempt', 'msc'));
                 $ts_next_launch_time = 0;
             } else {
                 $last_try_time = '';
             }
             $phase_dates[] = $last_try_time;
             $phase_logs[] = '';
             continue;
         }
         $log = '';
         foreach ($formatted_logs as $onetry_log) {
             // info: $onetry_log == array($history, $log_lines)
             $log .= implode('<br/>', $onetry_log[1]) . '<br/>';
         }
         $text = "<h1>" . _T('Step log', 'msc') . "</h1>";
         $text .= '<div style="height:400px;width:100%;overflow-y:scroll;">';
         $text .= nl2br($log);
         $text .= "</div>";
         $f = new NotifyWidget(FALSE);
         $f->add($text, FALSE);
         $divid = $phase['name'] . '_log';
         printf('<div id="%s" style="display:none">%s</div>', $divid, $f->begin() . $f->content() . $f->end());
         $btn_showfull_log[] = sprintf('<ul class="action"><li class="status"><a title="%s" href="#" onclick="PopupWindow(null, \'\', 300, _centerPlacement,jQuery(\'#%s\').html());return false;"></a></li></ul>', _T('Show log', 'msc'), $divid);
         $last_try = $formatted_logs[count($formatted_logs) - 1][1];
         // If next_launch_date is a later time and this step is failed
         if ($ts_next_launch_time > mktime() && ($phase['state'] == 'failed' || $phase['state'] == 'ready')) {
             $last_try_time = _toDate($this->db_coh['next_launch_date']) . sprintf(' (%s)', _T('next attempt', 'msc'));
             $ts_next_launch_time = 0;
         } else {
             $last_try_time = $formatted_logs[count($formatted_logs) - 1][0];
         }
         $phase_dates[] = $last_try_time;
         $log_last_lines = '...<br/>';
         $last_lines_number = 3;
         for ($i = $last_lines_number; $i > 0; $i--) {
             if (isset($last_try[count($last_try) - ($i + 1)])) {
                 $log_last_lines .= $last_try[count($last_try) - ($i + 1)];
             }
         }
         // if log_last_lines didnt change (no previous line),
         // we return exit code
         // else ''
         if ($log_last_lines == '...<br/>') {
             if (isset($last_try[count($last_try) - 1])) {
                 $log_last_lines = $last_try[count($last_try) - 1];
             } else {
                 $log_last_lines = '';
             }
         }
         $phase_logs[] = $log_last_lines;
     }
     //$n = new ListInfos(array_map("_names", $values), _T('<b>Command Overview</b>', 'msc'));
     $n = new ListInfos($phase_names, '<b>' . _T('Step', 'msc') . '</b>', '', '80px');
     //$n->addExtraInfo(array_map("_values", $values), '', '400px');
     $n->addExtraInfo($phase_states, 'State', '20px');
     $n->addExtraInfo($phase_dates, 'Execution time', '120px');
     $n->addExtraInfo($phase_logs, 'Details');
     $n->addExtraInfo($btn_showfull_log, '', '20px');
     $n->setTableHeaderPadding(0);
     $n->setRowsPerPage(20);
     $n->drawTable(0);
     print "<br/>";
     ### Display command environment ###
     $values = array(array(_T('Reserved bandwidth', 'msc'), $this->db_cmd['maxbw'] == '0' ? _T('<i>none</i>', 'msc') : prettyOctetDisplay($this->db_cmd['maxbw'], 1024, _T('bit/s', 'msc'))), array(_T('Proxy mode', 'msc'), $proxy_mode), array(_T('Proxy priority', 'msc'), $proxy_priority), array(_T('Scheduler', 'msc'), $this->db_coh['scheduler']), array(_T('Current launcher', 'msc'), !empty($this->db_coh['current_launcher']) ? $this->db_coh['current_launcher'] : _T('<i>not available</i>', 'msc')), array(_T('Current proxy', 'msc'), $current_proxy));
     $n = new ListInfos(array_map("_names", $values), _T('<b>Command Environment</b>', 'msc'));
     $n->addExtraInfo(array_map("_values", $values), '', '400px');
     $n->setTableHeaderPadding(0);
     $n->setRowsPerPage(count($values));
     $n->drawTable(0);
     print "<br/>";
     # display command history
     # display log files
     $statusTable = getStatusTable();
     $i = 1;
 }
Ejemplo n.º 3
0
function display_part($part, $get, $simpleTableParts, $displayNavBar = True, $partTitle = null)
{
    $uuid = '';
    if (isset($get['uuid'])) {
        $uuid = $get['uuid'];
    } elseif (isset($get['objectUUID'])) {
        $uuid = $get['objectUUID'];
    }
    $maxperpage = isset($get['maxperpage']) ? $get['maxperpage'] : 0;
    $filter = isset($get["filter"]) ? $get['filter'] : '';
    if (isset($get["start"])) {
        $start = $get["start"];
    } else {
        $start = 0;
    }
    $end = $start + $maxperpage;
    $hide_win_updates = isset($get['hide_win_updates']) ? $get['hide_win_updates'] : False;
    $hide_win_updates = strtolower($hide_win_updates) == 'true' ? True : False;
    $history_delta = isset($get['history_delta']) ? $get['history_delta'] : False;
    $options = array('hide_win_updates' => $hide_win_updates, 'history_delta' => $history_delta);
    // Get current part inventory
    $inv = getLastMachineGlpiPart($uuid, $part, $start, $end, $filter, $options);
    $itemCount = countLastMachineGlpiPart($uuid, $part, $filter, $options);
    if (!is_array($inv)) {
        $inv = array();
    }
    // this piece of code re-format inventory array
    // $all variable will contain part's inventory
    $all = array();
    $i = 0;
    foreach ($inv as $line) {
        foreach ($line as $vals) {
            /*
             * If $vals[1] is an empty string or an array, don't use the _T() function
             * Empty fields are replaced by a trademark text by transifex
             * if it's an array, it's an editable field
             */
            $vals[1] = str_replace('@@FALSE_POSITIVE@@', _T(' (Not an antivirus)', 'glpi'), $vals[1]);
            $all[$vals[0]][$i] = '';
            if (!is_array($vals[1]) && $vals[1] != '') {
                // translatable fields
                $all[$vals[0]][$i] = _T($vals[1]);
            } elseif (is_array($vals[1])) {
                // editable fields
                $all[$vals[0]][$i] = $vals[1];
            }
        }
        $i++;
    }
    /*
     * simpleTableParts are parts who are *not* displayed
     * in a multi-line table
     */
    // Simple table
    if (in_array($part, $simpleTableParts)) {
        $key = array();
        $val = array();
        foreach (array_keys($all) as $k) {
            $key[] = _T($k, 'glpi');
            if ($k == 'Serial Number') {
                $val[] = str_replace('@@WARRANTY_LINK_TEXT@@', _T('Click here to see this computer on manufacturer website', 'glpi'), $all[$k][0]);
            } else {
                /*
                 * if $all[$k][0] is an array, it's an editable value
                 * $editable = array(uniquename, type, value)
                 */
                if (is_array($all[$k][0])) {
                    $editable = $all[$k][0];
                    $val[] = sprintf('<label class="editableField" name="%s" data="%s" style="height:1em;">%s</label>', $editable[0], $editable[1], $editable[2]) . sprintf('<input type="text" class="editableField" name="%s" value="%s" style="display:none" />', $editable[0], $editable[2]);
                } else {
                    $val[] = $all[$k][0];
                }
            }
        }
        $n = new ListInfos($key, _T("Properties", "glpi"));
        $n->addExtraInfo($val, _T("Value", "glpi"));
        /*
         * $_GET['maxperpage'] is set to 10 by default
         * If there is more than 10 elements, they don't be displayed
         * So setRowsPerPage equal to number of elements to display
         */
        $n->setRowsPerPage(count($all));
        $n->drawTable(0);
    } else {
        $n = null;
        // If nothing found, display a "nothing found" message
        // except on Hardware tab (identified by $partTitle == null) => display nothing
        if (count($all) == 0 && $partTitle == null) {
            switch ($part) {
                case 'History':
                    printf('<p>%s</p>', _T('No record found for this period.', 'glpi'));
                    break;
                case 'Antivirus':
                    printf('<p>%s</p>', _T('Unable to detect any Antivirus software on this machine.', 'glpi'));
                    printf('<p>%s</p>', _T('Please ensure you are running GLPI with FusionInventory plugin and FusionInventory Agent on this client.', 'glpi'));
                    break;
                default:
                    printf('<p>%s</p>', _T('No record found.', 'glpi'));
            }
        }
        // Put datas in a ListInfos object
        foreach ($all as $k => $v) {
            if ($n == null) {
                $n = new OptimizedListInfos($v, _T($k, 'glpi'));
            } else {
                $n->addExtraInfo($v, _T($k, 'glpi'));
            }
        }
        // display table
        if ($n) {
            $n->setItemCount($itemCount);
            $n->setNavBar(new AjaxNavBar($itemCount, $filter));
            $n->disableFirstColumnActionLink();
            $n->setTableHeaderPadding(1);
            $n->start = 0;
            $n->end = $itemCount;
            // Display a title (it happens in Hardware tab)
            if ($partTitle) {
                printf("<h2>%s</h2>", $partTitle);
            }
            // Display table with (or not) NavBar
            $n->display($displayNavBar, $displayNavBar);
            if ($partTitle) {
                echo "<br />";
            }
        }
    }
}
Ejemplo n.º 4
0
 function display()
 {
     // display parameters
     if (!$this->db_cmd) {
         # use does not have the good permissions
         $widget = new RenderedMSCCommandDontExists();
         $widget->display();
         return;
     }
     if ($this->db_cmd['start_date']) {
         if ($this->db_cmd['end_date']) {
             $validity = sprintf(_T('<i>from</i> %s <i>to</i> %s', 'msc'), _toDate($this->db_cmd['start_date']), _toDate($this->db_cmd['end_date']));
         } else {
             $validity = sprintf(_T('<i>from</i> %s', 'msc'), _toDate($this->db_cmd['start_date']));
         }
     } else {
         if ($this->db_cmd['end_date']) {
             $validity = sprintf(_T('<i>to</i> %s', 'msc'), _toDate($this->db_cmd['end_date']));
         } else {
             $validity = _T('<i>forever</i>', 'msc');
         }
     }
     if ($this->db_cmd['deployment_intervals']) {
         $deploy_interv = str_replace(array('-', ','), array(' - ', ', '), $this->db_cmd['deployment_intervals']);
     } else {
         $deploy_interv = _T('<i>whole day</i>', 'msc');
     }
     if ($this->db_cmd['deployment_intervals']) {
         $deploy_interv = str_replace(array('-', ','), array(' - ', ', '), $this->db_cmd['deployment_intervals']);
     } else {
         $deploy_interv = _T('<i>whole day</i>', 'msc');
     }
     if ($this->db_coh['next_launch_date']) {
         $next_launch_date = _toDate($this->db_coh['next_launch_date']);
     } else {
         if ($this->db_cmd['start_date']) {
             $next_launch_date = _toDate($this->db_cmd['start_date']);
         } else {
             $next_launch_date = _T('<i>as soon as possible</i>', 'msc');
         }
     }
     if ($this->db_coh['start_date']) {
         $start_date = _toDate($this->db_coh['start_date']);
     } else {
         $start_date = _T('<i>not yet available</i>', 'msc');
     }
     if ($this->db_coh['end_date']) {
         $end_date = _toDate($this->db_coh['end_date']);
     } else {
         $end_date = _T('<i>not yet available</i>', 'msc');
     }
     if ($this->db_coh['last_wol_attempt']) {
         $last_wol_attempt = _toDate($this->db_coh['last_wol_attempt']);
     } else {
         $last_wol_attempt = _T('<i>not available</i>', 'msc');
     }
     if ($this->db_cmd['start_file']) {
         if ($this->db_cmd['parameters']) {
             $command_line = sprintf(_T('%s %s', 'msc'), $this->db_cmd['start_file'], $this->db_cmd['parameters']);
         } else {
             $command_line = sprintf(_T('%s <i>(no additional parameter given)</i>', 'msc'), $this->db_cmd['start_file']);
         }
     } else {
         $command_line = _T('<i>not set</i>', 'msc');
     }
     if ($this->db_coh['order_in_proxy'] == '') {
         $proxy_priority = _T('None (Local Proxy Client)', 'msc');
     } else {
         $proxy_priority = sprintf(_T('%s (Local Proxy Server)', 'msc'), $this->db_coh['order_in_proxy']);
     }
     if ($this->db_cmd['proxy_mode'] == 'split') {
         $proxy_mode = _T('Multiple', 'msc');
     } elseif ($this->db_cmd['proxy_mode'] == 'queue') {
         $proxy_mode = _T('Single with fallback', 'msc');
     } elseif ($this->db_cmd['proxy_mode'] == 'none') {
         $proxy_mode = _T('No proxy', 'msc');
         $proxy_priority = _T('None', 'msc');
     } else {
         $proxy_mode = _T('<i>not available</i>', 'msc');
         $proxy_priority = _T('<i>not available</i>', 'msc');
     }
     if ($this->db_lproxy) {
         $current_proxy = $this->db_lproxy['host'];
     } else {
         $current_proxy = _T('<i>not available</i>', 'msc');
     }
     // gettext obfucation
     _T('enable', 'msc');
     _T('disable', 'msc');
     _T('done', 'msc');
     _T('failed', 'msc');
     _T('over_time', 'msc');
     _T('out_of_interval', 'msc');
     ### Display command overview ###
     $values = array(array(_T('Command name', 'msc'), $this->db_cmd['title']), array(_T('Creation', 'msc'), sprintf(_T('<i>on</i> %s <i>by</i> %s', 'msc'), _toDate($this->db_cmd['creation_date']), $this->db_cmd['creator'])), array(_T('Validity period', 'msc'), $validity), array(_T('Deployment interval', 'msc'), $deploy_interv));
     $n = new ListInfos(array_map("_names", $values), _T('<b>Command Overview</b>', 'msc'));
     $n->addExtraInfo(array_map("_values", $values), '', '400px');
     $n->setTableHeaderPadding(0);
     $n->setRowsPerPage(count($values));
     $n->drawTable(0);
     print "<hr/><br/>";
     ### Display command stages ###
     $values = array(array(_T('Command line to run', 'msc'), $command_line), array(_T('Start "Wake On Lan" query if connection fails', 'msc'), $this->db_cmd['do_wol'] == 'enable' ? _T('yes', 'msc') : _T('no', 'msc')), array(_T('Execute command line ?', 'msc'), $this->db_cmd['start_script'] == 'enable' ? _T('yes', 'msc') : _T('no', 'msc')), array(_T('Delete files after a successful execution ?', 'msc'), $this->db_cmd['clean_on_success'] == 'enable' ? _T('yes', 'msc') : _T('no', 'msc')), array(_T('Do an inventory after a successful execution ?', 'msc'), $this->db_cmd['do_inventory'] == 'enable' ? _T('yes', 'msc') : _T('no', 'msc')), array(_T('Reboot client after a successful deletion ?', 'msc'), $this->db_cmd['do_reboot'] == 'enable' ? _T('yes', 'msc') : _T('no', 'msc')), array(_T('Halt client after :', 'msc'), i18nparts($this->db_cmd['do_halt'])));
     $n = new ListInfos(array_map("_names", $values), _T('<b>Command Stages</b>', 'msc'));
     $n->addExtraInfo(array_map("_values", $values), '', '400px');
     $n->setTableHeaderPadding(0);
     $n->setRowsPerPage(count($values));
     $n->drawTable(0);
     print "<hr/><br/>";
     ### Display command environment ###
     $values = array(array(_T('Reserved bandwidth', 'msc'), $this->db_cmd['maxbw'] == '0' ? _T('<i>none</i>', 'msc') : prettyOctetDisplay($this->db_cmd['maxbw'], 1024, _T('bit/s', 'msc'))), array(_T('Proxy mode', 'msc'), $proxy_mode), array(_T('Proxy priority', 'msc'), $proxy_priority), array(_T('Scheduler', 'msc'), $this->db_coh['scheduler']), array(_T('Current launcher', 'msc'), $this->db_coh['launcher'] == '' ? _T('<i>not available</i>', 'msc') : $this->db_coh['launcher']), array(_T('Current proxy', 'msc'), $current_proxy));
     $n = new ListInfos(array_map("_names", $values), _T('<b>Command Environment</b>', 'msc'));
     $n->addExtraInfo(array_map("_values", $values), '', '400px');
     $n->setTableHeaderPadding(0);
     $n->setRowsPerPage(count($values));
     $n->drawTable(0);
     print "<hr/><br/>";
     ### Display command life cycle ###
     $values = array(array(_T('First operation at', 'msc'), $start_date), array(_T('Remaining connection attempts', 'msc'), sprintf(_T('%s (on %s)', 'msc'), $this->db_coh['attempts_left'], $this->db_cmd['max_connection_attempt'])), array(_T('Delay between two attempts (minutes)', 'msc'), $this->db_cmd['next_connection_delay'] ? $this->db_cmd['next_connection_delay'] : _T('<i>not set</i>', 'msc')), array(_T('Last WOL attempt', 'msc'), $last_wol_attempt), array(_T('Next attempt', 'msc'), $next_launch_date), array(_T('Last operation at', 'msc'), $end_date));
     $n = new ListInfos(array_map("_names", $values), _T('<b>Command Life Cycle</b>', 'msc'));
     $n->addExtraInfo(array_map("_values", $values), '', '400px');
     $n->setTableHeaderPadding(0);
     $n->setRowsPerPage(count($values));
     $n->drawTable(0);
     print "<hr/><br/>";
     ### Display to be transfered files ###
     $files = array(_T('List of files to be transfered is empty.', 'msc'));
     if ($this->db_cmd["files"] != "" && $this->db_cmd["files"] != array()) {
         if (gettype($command["files"]) != 'array') {
             $files = explode("\n", $this->db_cmd["files"]);
         } else {
             $files = $this->db_cmd["files"];
         }
     }
     $n = new ListInfos($files, _T('<b>Files to be transfered</b>', 'msc'));
     $n->setTableHeaderPadding(0);
     $n->setRowsPerPage(count($values));
     $n->drawTable(0);
     print "<hr/><br/>";
     # display command history
     # display log files
     $statusTable = getStatusTable();
     $i = 1;
     foreach ($this->db_ch as $hist) {
         if ($hist['state'] == 'upload_in_progress' && $hist['error_code'] == '0' && array_key_exists('stderr', $hist) && $i != count($this->db_ch) && strpos($hist['stderr'], 'is available on mirror') !== False) {
             /*
               We are displaying which package server was used in push pull
               mode. We want to keep the led green instead of orange to
               tell the user that there was no problem.
             */
             $staticon = history_stat2icon("upload_done");
         } elseif ($hist['state'] == 'wol_failed' && $hist['error_code'] == '2001') {
             $staticon = history_stat2icon("stop");
         } else {
             $staticon = history_stat2icon($hist['state']);
         }
         $history = '<img style="vertical-align: middle;" alt="' . $hist['state'] . '" src="modules/msc/graph/images/status/' . $staticon . '"/> ' . date("Y-m-d H:i:s", $hist['date']) . ': <b>' . $statusTable[$hist['state']] . '</b>';
         /* Split lines in stdout and stderr */
         if (gettype($hist["stdout"]) != 'array') {
             $hist["stdout"] = split("\n", $hist["stdout"]);
         }
         if (gettype($hist["stderr"]) != 'array') {
             $hist["stderr"] = split("\n", $hist["stderr"]);
         }
         if (count($hist["stdout"]) > 0 && !(count($hist["stdout"]) == 1 && $hist["stdout"][0] == '')) {
             $hist["stderr"] = array_merge($hist["stderr"], $hist["stdout"]);
         }
         if (strpos($hist['state'], '_failed') !== False || $hist['error_code'] > 4501 && $hist['error_code'] < 5000) {
             $msgs = array(255 => _T("Error while connecting to secure agent on this host. Please check network connectivity, and that the secure agent is installed on this host.", 'msc'), 200 + 9 => _T("The script was killed by Pulse 2 (timeout ?).", 'msc'), 200 + 15 => _T("The script was terminated by Pulse 2.", 'msc'), 240 + 0 => _T("Something goes wrong while checking client identity.", 'msc'), 240 + 1 => _T("The current host name doesn't match the host name from the inventory database.", 'msc'), 240 + 2 => _T("The current host IP address doesn't match the IP address from the inventory database.", 'msc'), 240 + 3 => _T("The current host MAC address doesn't match the MAC address from the inventory database.", 'msc'), 4000 + 1 => sprintf(_T("The package '%s' is not available on any mirror.", "msc"), $hist['stderr'][0]), 4000 + 2 => sprintf(_T("Can't get files URI for package '%s' on mirror %s.\nPlease check that the package and its files have not been modified since the planning of the command.", "msc"), $hist['stderr'][0], $hist['stderr'][1]), 4000 + 3 => sprintf(_T("Can't get files URI for package '%s' on fallback mirror %s.\nPlease check that the package and its files have not been modified since the planning of the command.", "msc"), $hist['stderr'][0], $hist['stderr'][1]), 4000 + 4 => sprintf(_T("An error occurred when trying to contact the mirror '%s' : the connection was refused.", "msc"), $hist['stderr'][0]), 4000 + 5 => sprintf(_T("An error occurred when trying to contact the fallback mirror '%s' : the connection was refused.", "msc"), $hist['stderr'][0]), 4000 + 6 => sprintf(_T("An error occurred when trying to contact the mirror '%s' : the mountpoint doesn't exists.", "msc"), $hist['stderr'][0]), 4000 + 7 => sprintf(_T("An error occurred when trying to contact the fallback mirror '%s' : the mountpoint doesn't exists.", "msc"), $hist['stderr'][0]), 4500 + 8 => sprintf(_T("Package '%s' is NOT available on primary mirror %s\nPackage '%s' is available on fallback mirror %s", "msc"), $hist['stdout'][0], $hist['stdout'][1], $hist['stdout'][2], $hist['stdout'][3]), 4500 + 9 => sprintf(_T("Package '%s' is available on primary mirror %s", "msc"), $hist['stdout'][0], $hist['stdout'][1]));
             if ($hist['error_code'] >= 4001 && $hist['error_code'] < 5000) {
                 $hist["stderr"] = array('');
             }
             if (array_key_exists($hist['error_code'], $msgs)) {
                 $hist['stderr'][] = $msgs[$hist['error_code']];
             }
         }
         $raw_errors = array_map('_colorise', array_filter($hist["stderr"]));
         $purge_errors = array();
         foreach ($raw_errors as $error) {
             if (isset($error)) {
                 array_push($purge_errors, $error);
             }
         }
         $n = new ListInfos($purge_errors, $history);
         $n->setTableHeaderPadding(0);
         $n->setRowsPerPage(count($purge_errors) + 1);
         if (count($hist["stderr"]) > 0 && !(count($hist["stderr"]) == 1 && $hist["stderr"][0] == '')) {
             $n->drawTable(0);
         }
         $i++;
     }
 }