echo '<link rel="stylesheet" href="modules/imaging/graph/css/default.min.css">'; echo '<script src="modules/imaging/graph/highlight/highlight.min.js"></script>'; echo '<script>hljs.initHighlightingOnLoad();</script>'; //$file must be existing if (!($file = xmlrpc_selectWindowsAnswerFile($_GET['display']))) { $file = array(); } echo '<pre>'; foreach ($file as $line) { echo htmlentities($line); } echo '</pre>'; } else { //Get the list of answer files $list = xmlrpc_Windows_Answer_list_File(0, -1); //Display sidemenu $page = new PageGenerator(_T("All Windows Answer Files", 'imaging')); $page->setSideMenu($sidemenu); $page->display(); //Create list of sysprep answer file $table = new ListInfos($list['file'], _T("File name", "imaging")); //Add informations on each row $table->addExtraInfo($list['os'], _T("OS", "imaging")); $table->addExtraInfo($list['description'], _T("Description", "imaging")); //Add actions on each row $table->addActionItem(new ActionItem(_T("Display sysprep file", "imaging"), "sysprepView", "display", "display", "imaging", "manage")); $table->addActionItem(new ActionItem(_T("Edit sysprep file", "imaging"), "unattended", "edit", "edit", "imaging", "manage")); $table->addActionItem(new ActionConfirmItem(_T("Delete sysprep file", 'imaging'), "sysprepList", "delete", "deleteFile", "imaging", "manage", _T('Are you sure you want to unset this sysrep answer file?', 'imaging'))); // Display the list $table->display(); }
$display = True; if ($filter) { /* Don't display a host if filtered */ if (strpos($host, $filter) === False && strpos($ipstr, $filter) === False) { $display = False; } } if ($display) { $ips[] = $ipstr; $params[] = array("host" => $host, "zone" => $zone); if (in_array($host, array_keys($cnames))) { $host = "{$host} " . sprintf(_T("(alias of %s)", "network"), $cnames[$host]); $actionsMod[] = $emptyAction; $actionsDel[] = $delAliasAction; } else { $actionsMod[] = $editAction; $actionsDel[] = $delHostAction; } $hosts[] = $host; } } $n = new ListInfos($ips, _T("IP address", "network")); $n->setTableHeaderPadding(1); $n->setNavBar(new AjaxNavBar(count($ips), $filter)); $n->addExtraInfo($hosts, _T("Host name", "network")); $n->setName(_T("Host", "network")); $n->setParamInfo($params); $n->disableFirstColumnActionLink(); $n->addActionItemArray($actionsMod); $n->addActionItemArray($actionsDel); $n->display();
$editAction = new ActionItem(_T("edit static host", "network"), "subnetedithost", "edit", "ipaddress", "network", "network"); $emptyAction = new EmptyActionItem(); foreach ($lines as $ipaddress => $infos) { $hosts[] = $infos["hostname"]; $ipaddresses[] = long2ip($ipaddress); $macaddresses[] = $infos["macaddress"]; $types[] = $infos["type"]; $params[] = array("host" => $infos["hostname"], "macaddress" => $infos["macaddress"], "subnet" => $subnet); if ($infos["type"] == _T("Static", "network")) { $actionsAdd[] = $emptyAction; $actionsDel[] = $deleteAction; $actionsEdit[] = $editAction; } else { $actionsAdd[] = $addAction; $actionsDel[] = $emptyAction; $actionsEdit[] = $emptyAction; } } $n = new ListInfos($ipaddresses, _T("IP address", "network")); $n->setNavBar(new AjaxNavBar(count($ipaddresses), $filter)); $n->disableFirstColumnActionLink(); $n->setTableHeaderPadding(1); $n->addExtraInfo($hosts, _T("Host name", "network")); $n->addExtraInfo($macaddresses, _T("MAC address", "network")); $n->addExtraInfo($types, _T("Type", "network")); $n->setName(_T("Host", "network")); $n->setParamInfo($params); $n->addActionItemArray($actionsAdd); $n->addActionItemArray($actionsEdit); $n->addActionItemArray($actionsDel); $n->display();
$states[] = _T('Downloading', 'msc'); $flengths[] = ''; $actionsdl[] = new EmptyActionItem(); $actionsrm[] = new EmptyActionItem(); } else { if ($file[0] == '' && $file[3] == -1) { $states[] = _T('Error', 'msc'); $flengths[] = ''; $actionsdl[] = new EmptyActionItem(); $actionsrm[] = $actionRemove; } else { $states[] = _T('Ready', 'msc'); $flengths[] = $file[3]; $actionsdl[] = $actionDownload; $actionsrm[] = $actionRemove; } } } } $l = new ListInfos($ftimestamps, _T('Timestamp', 'msc')); $l->addExtraInfo($fcomputers, _T('From computer', 'msc')); $l->addExtraInfo($fnames, _T('File name', 'msc')); $l->addExtraInfo($flengths, _T('Length', 'msc')); $l->addExtraInfo($states, _T('Status', 'msc')); $l->addActionItemArray($actionsdl); $l->addActionItemArray($actionsrm); $l->setTableHeaderPadding(1); $l->disableFirstColumnActionLink(); $l->setParamInfo($finodes); $l->setNavBar(new AjaxNavBar(count($fnames), $filter)); $l->display();
function display() { $lines = array(); $errlines = array(); foreach ($this->logs as $line => $msg) { if (strpos($msg, "===") === 0) { $msg = "<b>" . "{$msg}" . "</b>"; } else { if (strpos($msg, $this->errstr) === 0) { $msg = "<span id=\"err{$line}\" class=\"LOG_ERR\">" . "{$msg}" . "</span>"; $errlines[] = $line; } } foreach ($this->colors as $pattern => $color) { if (strpos($msg, $pattern) > 0) { $msg = "<span id=\"err{$line}\" class=\"{$color}\">" . "{$msg}" . "</span>"; continue; } } $lines[] = sprintf("<span class=\"linenumber\">%04d:</span>", $line) . " " . $msg; } foreach ($errlines as $line) { print "<p class =\"LOG_ERR\" onClick=\"javascript:new Element.scrollTo('err{$line}');\">Click here to scroll to error on line {$line}.</p>"; } $l = new ListInfos($lines, _T("Backup log messages", "imaging")); $l->setCssClass("imagelogs"); $l->setRowsPerPage(count($lines)); $l->setNavBar(False); $l->display(0, 1); }
* * MMC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require "modules/base/includes/groups.inc.php"; $filter = $_GET["filter"]; $groups = search_groups($filter); $groupcount = count($groups); $arrGroup = array(); $arrComment = array(); for ($idx = 0; $idx < count($groups); $idx++) { $arrGroup[] = $groups[$idx][0]; $arrComment[] = $groups[$idx][1]; $arrNb[] = '<span style="font-weight: normal;">(' . $groups[$idx][2] . ')</span>'; } $n = new ListInfos($arrGroup, _("Groups")); $n->setCssClass("groupName"); $n->addExtraInfo($arrComment, _("Comments")); $n->setAdditionalInfo($arrNb); $n->setNavBar(new AjaxNavBar($groupcount, $filter)); $n->addActionItem(new ActionItem(_("Edit members"), "members", "display", "group")); $n->addActionItem(new ActionItem(_("Edit group"), "edit", "edit", "group")); $n->addActionItem(new ActionPopupItem(_("Delete"), "delete", "delete", "group")); $n->setName(_("Groups management")); $n->display();
<?php $domain = $_GET["domain"]; if (isset($_GET["filter"])) { $filter = $_GET["filter"]; } else { $filter = ""; } $uids = array(); foreach (getVDomainUsers($domain, $filter) as $dn => $entries) { $mail = htmlentities($entries[1]["mail"][0]); $uids[$entries[1]["uid"][0]] = array($entries[1]["givenName"][0] . " " . $entries[1]["sn"][0], '<a href="' . "mailto:" . $mail . '">' . $mail . "</a>"); } ksort($uids); $names = array(); $mails = array(); foreach ($uids as $uid) { $names[] = $uid[0]; $mails[] = $uid[1]; } $n = new ListInfos(array_keys($uids), _("Login"), "&mail={$domain}"); $n->setNavBar(new AjaxNavBar(count($uids), $filter)); $n->setCssClass("userName"); $n->addExtraInfo($names, _("Name")); $n->addExtraInfo($mails, _("Mail address")); $n->addActionItem(new ActionItem(_("Edit"), "edit", "edit", "user", "base", "users")); $n->display();
$shareDescription = "(" . _T("Hidden", "samba4") . ") "; } $shareDescription = isset($share[$shareComponent["description"]]) ? $shareDescription . $share[$shareComponent["description"]] : ""; $sharesDescription[] = $shareDescription; $sharesGuestAccess[] = isset($share[$shareComponent["guest_access"]]) ? $share[$shareComponent["guest_access"]] : ""; if (isset($protectedShares) and !in_array($share[$shareComponent["name"]], $protectedShares)) { $editActions[] = new ActionItem(_T("Edit", "samba4"), "edit", "edit", "share"); $delActions[] = new ActionPopupItem(_T("Delete", "samba4"), "delete", "delete", "share"); } else { $editActions[] = new EmptyActionItem(); $delActions[] = new EmptyActionItem(); } } $page = new PageGenerator(_T("Current list of shares", "samba4")); $page->setSideMenu($sidemenu); $page->display(); $list = new ListInfos($sharesName, _T("Share", "samba4")); $list->setCssClass("shareName"); $list->setCssClasses($sharesEnabled); $list->addExtraInfo($sharesPath, _T("Path", "samba4")); $list->addExtraInfo($sharesDescription, _T("Description", "samba4")); $list->addActionItemArray($editActions); $list->addActionItemArray($delActions); $list->addActionItem(new ActionPopupItem(_T("Archive", "samba4"), "backup", "backup", "share")); $list->disableFirstColumnActionLink(); $list->display(); /* Private functions */ function _shareIsEnabled($share) { return isset($share[2]) and $share[2]; }
$inventoriesDates = array(); $inventoriesId = array(); $detailsParams = array(); $detailsButtons = array(); $i = 0; // Call the methods to get the inventory history $count = countMachineInventoryHistory($params); $inventory_history = getMachineInventoryHistory($params); // Loop through the inventory history to extract infos foreach ($inventory_history as $inventory) { $inventoriesDates[] = _toDate($inventory[1]); // Add the details link (unless we are on the last line) if ($i < count($inventory_history) - 1) { $detailsButtons[] = new ActionItem(_T("View differences since previous inventory", "inventory"), "invdiff", "display"); } else { $detailsButtons[] = new EmptyActionItem(); } $detailsParams[$i]['inventoryId'] = $inventory[0]; $detailsParams[$i++]['uuid'] = $params['uuid']; } // Create a ListInfos that will display the inventories dates $list = new ListInfos($inventoriesDates, _T("Inventory Date", "inventory")); // Add extra params in the "details" link $list->setParamInfo($detailsParams); $list->disableFirstColumnActionLink(); $list->setName(_T("Inventory", "inventory")); $list->addActionItemArray($detailsButtons); $list->setTableHeaderPadding(0); $list->start = 0; $list->end = count($inventoriesDates); $list->display();
/** * (c) 2004-2007 Linbox / Free&ALter Soft, http://linbox.com * (c) 2007-2008 Mandriva, http://www.mandriva.com/ * * $Id$ * * This file is part of Mandriva Management Console (MMC). * * MMC is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * MMC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ function list_computers($names, $filter, $count = 0, $delete_computer = false, $remove_from_result = false, $is_group = false, $msc_can_download_file = false, $msc_vnc_show_icon = false) { /* $pull_list is an array with UUIDs of pull machines */ $pull_list = in_array("pulse2", $_SESSION["modulesList"]) ? get_pull_targets() : array(); $emptyAction = new EmptyActionItem(); $inventAction = new ActionItem(_("Inventory"), "invtabs", "inventory", "inventory", "base", "computers"); $glpiAction = new ActionItem(_("GLPI Inventory"), "glpitabs", "inventory", "inventory", "base", "computers"); $logAction = new ActionItem(_("Read log"), "msctabs", "logfile", "computer", "base", "computers", "tablogs"); $mscAction = new ActionItem(_("Software deployment"), "msctabs", "install", "computer", "base", "computers"); $imgAction = new ActionItem(_("Imaging management"), "imgtabs", "imaging", "computer", "base", "computers"); $downloadFileAction = new ActionItem(_("Download file"), "download_file", "download", "computer", "base", "computers"); $vncClientAction = new ActionPopupItem(_("Remote control"), "vnc_client", "vncclient", "computer", "base", "computers"); $profileAction = new ActionItem(_("Show Profile"), "computersgroupedit", "logfile", "computer", "base", "computers"); $actionInventory = array(); $actionLogs = array(); $actionMsc = array(); $actionImaging = array(); $actionDownload = array(); $actionVncClient = array(); $actionProfile = array(); $params = array(); $cssClasses = array(); $headers = getComputersListHeaders(); $columns = array(); foreach ($headers as $header) { $columns[$header[0]] = array(); } function getUUID($machine) { return $machine['objectUUID']; } $uuids = array_map("getUUID", $names); /*if (in_array("dyngroup", $_SESSION["modulesList"])) { $profiles = xmlrpc_getmachinesprofiles($uuids); $h_profiles = array(); $i = 0; foreach ($uuids as $uuid) { $h_profiles[$uuid] = $profiles[$i++]; } }*/ foreach ($names as $value) { $cssClasses[] = in_array($value['objectUUID'], $pull_list) ? 'machinePull' : 'machineName'; foreach ($headers as $header) { if (!empty($value[$header[0]])) { $v = $value[$header[0]]; } else { $v = ''; } $columns[$header[0]][] = $v; } if (isset($filter['gid'])) { $value['gid'] = $filter['gid']; } if (in_array("inventory", $_SESSION["supportModList"])) { $actionInventory[] = $inventAction; } else { $actionInventory[] = $glpiAction; } if (in_array("msc", $_SESSION["supportModList"])) { $actionMsc[] = $mscAction; $actionLogs[] = $logAction; } if (in_array("imaging", $_SESSION["supportModList"])) { $actionImaging[] = $imgAction; } /* if (in_array("dyngroup", $_SESSION["modulesList"])) { $profile = $h_profiles[$value['objectUUID']]; if ($profile) { $actionProfile[] = $profileAction; $value['id'] = $profile; } else { $actionProfile[] = $emptyAction; } } */ if ($msc_can_download_file) { $actionDownload[] = $downloadFileAction; } if ($msc_vnc_show_icon) { $actionVncClient[] = $vncClientAction; } $params[] = $value; } if (isset($filter['location'])) { $filter = $filter['hostname'] . '##' . $filter['location']; } else { $filter = $filter['hostname'] . '##'; } $n = null; if ($count) { foreach ($headers as $header) { if ($n == null) { if (in_array("glpi", $_SESSION["modulesList"])) { $n = new OptimizedListInfos($columns[$header[0]], _T($header[1], 'glpi')); } else { $n = new OptimizedListInfos($columns[$header[0]], _($header[1])); } } else { if (in_array("glpi", $_SESSION["modulesList"])) { $n->addExtraInfo($columns[$header[0]], _T($header[1], 'glpi')); } else { $n->addExtraInfo($columns[$header[0]], _($header[1])); } } } $n->setItemCount($count); $n->setNavBar(new AjaxNavBar($count, $filter)); $n->start = 0; $n->end = $count - 1; } else { foreach ($headers as $header) { if ($n == null) { $n = new ListInfos($columns[$header[0]], _($header[1])); } else { $n->addExtraInfo($columns[$header[0]], _($header[1])); } } $n->setNavBar(new AjaxNavBar(count($columns[$headers[0][0]]), $filter)); } $n->setName(_("Computers list")); $n->setParamInfo($params); //$n->setCssClass("machineName"); $n->setMainActionClasses($cssClasses); $n->addActionItemArray($actionInventory); if ($msc_can_download_file) { $n->addActionItemArray($actionDownload); } if (in_array("backuppc", $_SESSION["supportModList"])) { $n->addActionItem(new ActionItem(_("Backup status"), "hostStatus", "backuppc", "backuppc", "backuppc", "backuppc")); } if ($msc_vnc_show_icon) { $n->addActionItemArray($actionVncClient); } /*if (in_array("dyngroup", $_SESSION["modulesList"])) { $n->addActionItemArray($actionProfile); }*/ if (in_array("msc", $_SESSION["supportModList"])) { $n->addActionItemArray($actionLogs); $n->addActionItemArray($actionMsc); } if (in_array("imaging", $_SESSION["supportModList"])) { $n->addActionItemArray($actionImaging); } if ($delete_computer && canDelComputer()) { // set popup window to 400px width $n->addActionItem(new ActionPopupItem(_("Delete computer"), "delete", "delete", "computer", "base", "computers", null, 400)); } if ($remove_from_result) { $n->addActionItem(new ActionPopupItem(_("Remove machine from group"), "remove_machine", "remove_machine", "name", "base", "computers")); } $n->display(); }
$a_desc[] = $entry['image']['desc']; $default_name = $entry['image']['name']; $kind = 'IM'; } else { $a_desc[] = $entry['boot_service']['default_desc']; $default_name = $entry['boot_service']['default_name']; $kind = 'BS'; } $list_params[$i]["itemlabel"] = urlencode($default_name); $a_label[] = sprintf("%s%s", $kind == 'IM' ? '<img src="modules/imaging/graph/images/imaging-action.png" style="vertical-align: middle" /> ' : '<img src="modules/imaging/graph/images/service-action.png" style="vertical-align: middle" /> ', $default_name); $a_default[] = $entry['default']; $a_display[] = $entry['hidden'] ? False : True; $a_defaultWOL[] = $entry['default_WOL']; $a_displayWOL[] = $entry['hidden_WOL'] ? False : True; } $t = new TitleElement(_T("Default boot menu configuration", "imaging"), 3); $t->display(); $l = new ListInfos($a_label, _T("Label", "imaging")); $l->setParamInfo($list_params); $l->addExtraInfo($a_desc, _T("Description", "imaging")); $l->addExtraInfo($a_default, _T("Default", "imaging")); $l->addExtraInfo($a_display, _T("Displayed", "imaging")); $l->addExtraInfo($a_defaultWOL, _T("Default on WOL", "imaging")); $l->addExtraInfo($a_displayWOL, _T("Displayed on WOL", "imaging")); $l->addActionItemArray($actionsUp); $l->addActionItemArray($actionsDown); $l->addActionItem(new ActionItem(_T("Edit"), "bootmenu_edit", "edit", "item", "imaging", "manage")); $l->setTableHeaderPadding(19); $l->disableFirstColumnActionLink(); $l->display(); require "../includes/ajaxcommon_bottom.inc.php";
$a_in_boot_menu = array(); $i = -1; foreach ($imaging_server as $entry) { $i = $i+1; $list_params[$i] = $params; $list_params[$i]["itemlabel"] = $entry['name']; $list_params[$i]["itemid"] = $entry['imaging_uuid']; // don't show action if service is in bootmenu $addActions[] = $addAction; $a_label[]= $entry['name']; $a_desc[]= $entry['url']; $a_uuid[]= $entry['packageserver_uuid']; } $t = new TitleElement(_T("Associate an entity to an imaging server", "imaging"), 3); $t->display(); // show images list $l = new ListInfos($a_label, _T("Name", "imaging")); $l->setParamInfo($list_params); $l->addExtraInfo($a_desc, _T("Description", "imaging")); $l->addExtraInfo($a_uuid, _T("Identifier", "imaging")); $l->addActionItemArray($addActions); $l->disableFirstColumnActionLink(); $l->setTableHeaderPadding(1); $l->display(); ?>
$shares = get_shares_detailed(); $sharesName = array(); $sharesComment = array(); $editActions = array(); $delActions = array(); //$backupActions = array(); foreach ($shares as $share) { $sharesName[] = $share[0]; if (isset($share[1])) { $sharesComment[] = $share[1]; } else { $sharesComment[] = ""; } if (!in_array($share[0], $protectedShare)) { $editActions[] = new ActionItem(_T("Edit"), "details", "edit", "share"); $delActions[] = new ActionPopupItem(_T("Delete"), "delete", "delete", "share"); } else { $editActions[] = new EmptyActionItem(); $delActions[] = new EmptyActionItem(); } } $p = new PageGenerator(_T("Shares")); $p->setSideMenu($sidemenu); $p->display(); $l = new ListInfos($sharesName, _T("Shares")); $l->first_elt_padding = 1; $l->addExtraInfo($sharesComment, _T("Description")); $l->addActionItemArray($editActions); $l->addActionItemArray($delActions); $l->addActionItem(new ActionPopupItem(_T("Archive"), "backup", "backup", "share")); $l->display();
*/ require "modules/samba4/includes/machines-xmlrpc.inc.php"; $filter = $_GET['filter']; $domainMembers = listDomainMembers(); if (!isset($domainMembers) or !$domainMembers) { $domainMembers = array(); } $names = array(); $descriptions = array(); $computersEnabled = array(); foreach ($domainMembers as $computer) { $name = $computer["name"]; if (!$computer["enabled"]) { $computersEnabled[] = "disabledRow"; $name .= " (" . _T("Disabled") . ") "; } else { $computersEnabled[] = "enabledRow"; } $names[] = $name; $descriptions[] = $computer["description"]; } $list = new ListInfos($names, _T("Computer name", "samba4")); $list->disableFirstColumnActionLink(); $list->setCssClass("machineName"); $list->setCssClasses($computersEnabled); $list->setNavBar(new AjaxNavBar(count($domainMembers), $filter)); $list->addExtraInfo($descriptions, _T("Description", "samba4")); $list->addActionItem(new ActionItem(_T("Edit"), "edit", "edit", "machine")); //$list->addActionItem(new ActionPopupItem(_T("Delete"),"delete","delete","machine")); $list->setName(_("Computers")); $list->display();
$zones[$zonename]["description"] .= $value . " "; } } } ksort($zones); $descriptions = array(); $reverses = array(); $count = array(); foreach ($zones as $zone => $infos) { $count[] = '<span style="font-weight: normal;">(' . getZoneObjectsCount($zone) . ')</span>'; $descriptions[] = $infos["description"]; $reverse = getZoneNetworkAddress($zone); if (!$reverse) { $reverses[] = "None"; } else { $reverses[] = $reverse[0] . "."; } } $n = new ListInfos(array_keys($zones), _T("DNS zones", "network")); $n->setNavBar(new AjaxNavBar(count($zones), $filter)); $n->setAdditionalInfo($count); $n->first_elt_padding = 1; $n->addExtraInfo($reverses, _T("Network prefix", "network")); $n->addExtraInfo($descriptions, _T("Description", "network")); $n->setName(_T("DNS zones", "network")); $n->addActionItem(new ActionItem(_T("View zone members", "network"), "zonemembers", "zonemembers", "zone", "network", "network")); $n->addActionItem(new ActionItem(_T("View zone records", "network"), "zonerecords", "display", "zone", "network", "network")); $n->addActionItem(new ActionItem(_T("Edit zone", "network"), "edit", "edit", "zone", "network", "network")); $n->addActionItem(new ActionItem(_T("Add host", "network"), "addhost", "addhost", "zone", "network", "network")); $n->addActionItem(new ActionPopupItem(_T("Delete zone", "network"), "delete", "delete", "zone", "network", "network")); $n->display();
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, * MA 02110-1301, USA */ require "graph/navbar.inc.php"; require "localSidebar.php"; require "modules/msc/includes/package_api.php"; $p = new PageGenerator(_T("Packages", 'msc')); $p->setSideMenu($sidemenu); $p->display(); $a_packages = array(); $a_pversions = array(); foreach (getAllPackages() as $package) { $a_packages[] = $package->label; $a_pversions[] = $package->version; } $n = new ListInfos($a_packages, _T("Package", 'msc')); $n->addExtraInfo($a_pversions, _T("Version", 'msc')); $n->addActionItem(new ActionItem(_T("Launch", "msc"), "start_command", "start", "msc", "base", "computers")); $n->addActionItem(new ActionItem(_T("Details", "msc"), "package_detail", "detail", "msc", "base", "computers")); $n->drawTable(0); ?> <style> li.detail a { padding: 3px 0px 5px 20px; margin: 0 0px 0 0px; background-image: url("modules/msc/graph/images/actions/info.png"); background-repeat: no-repeat; background-position: left top; line-height: 18px; text-decoration: none; color: #FFF;
for ($i = 0; $i < count($dates); $i++) { $table->addExtraInfo($values[$i], $dates[$i]); } $table->end = count($titles); } else { if (in_array('headers', array_keys($content['data']))) { // key_value table $headers = $content['data']['headers']; $values = $content['data']['values']; for ($i = 0; $i < count($headers); $i++) { $tab_values = array(); foreach ($values as $value) { $tab_values[] = $value[$i]; } if (!$table) { $table = new ListInfos($tab_values, $headers[$i]); } else { $table->addExtraInfo($tab_values, $headers[$i]); } } } } } else { if ($content['type'] == 'chart') { $filename = $content['svg_path']; $handle = fopen($filename, 'r'); $svg_content = fread($handle, filesize($filename)); fclose($handle); $svg = new SpanElement(sprintf('<div align="center">%s<br /><a align="center" class="btn" href="%s">%s</a></div>', $svg_content, urlStrRedirect("report/report/get_file", array('path' => $content['png_path'])), _T('Download image', 'report'))); } }
} } } // Loop through the added elements parts to display it foreach ($removed_elems as $part => $removed_part) { if (!empty($removed_part)) { // Loop through each element of the part foreach ($removed_part as $elem) { // Loop through elems to change arrays into dates foreach ($elem as $k => $v) { if (is_array($v)) { $elem[$k] = _toDate($v); } } // Create a ListInfos to display the infos of the element in a list $list = new ListInfos(array_keys($elem), _T("Element", "inventory")); $list->addExtraInfo(array_values($elem), _T("Value", "inventory")); $list->setName(_T($part)); $list->setTableHeaderPadding(0); // Append the ListInfo in an array, to display all ListInfos together at the end of the page loading $removed_part_lists[] = $list; } } } // Display the page $p->display(); // Display the added elements (without navbar) print "<h3>" . _T("Added elements", "inventory") . "</h3>"; foreach ($added_part_lists as $list) { print '<h4>' . $list->name . '</h4>'; $list->display($navbar = 0, $header = 0);
require "graph/navbar.inc.php"; ?> <h2><?php echo _T("Blacklist management"); ?> </h2> <div class="fixheight"></div> <?php $arrB = get_nonIndexBlackList(); $p = new PageGenerator(); $p->setSideMenu($sidemenu); $p->displaySideMenu(); $n = new ListInfos($arrB); $n->addActionItem(new ActionPopupItem(_("Delete"), "delete", "delete", "blacklist")); $n->setName(_T("Blacklist entries")); $n->display(); ?> </form> </form> <form method="post" action="main.php?module=proxy&submod=blacklist&action=restart"> <input name="goto" type="hidden" value="<?php echo $root; ?> main.php" /> <input name="brestart" type="submit" class="btnPrimary" value="<?php echo _T("Restart service");
// If the services module is not enabled, fallback // to the old ServiceManager if (!servicesModuleEnabled()) { // restart service button if (isset($_POST["btApply"])) { include 'restart.php'; } } // Get keywords and Domain list from /etc/squid/rules/group_internet/normal_blacklist.txt $arrB = get_list($list); //New page with side menu, create and show $p = new PageGenerator($main_title); $p->setSideMenu($sidemenu); $p->display(); //Create a list of informations $n = new ListInfos($arrB, $title_datagrid); $n->first_elt_padding = 1; $n->disableFirstColumnActionLink(); $n->setName(_T("List")); //Add action on list and show list $n->addActionItem(new ActionPopupItem(_T("Delete"), $del_page, "delete", "eltdata")); $n->display(); //Create Title and show $t = new TitleElement($sub_title, 2); $t->display(); //Create Form to get informations $f = new ValidatingForm(); //Create table inside Form $f->push(new Table()); //Add element input in table $f->add(new TrFormElement($elt_label, new InputTpl("eltdata"), array("tooltip" => $elt_help)), array("value" => "", "required" => true));
$list = getRules("", $src, $dst, $filter); $src_zones = getZonesInterfaces($src); $dst_zones = getZonesInterfaces($dst); $deleteAction = new ActionPopupItem(_T("Delete rule"), "delete_" . $page . "_rule", "delete", ""); $ids = array(); $decision = array(); $service = array(); $source = array(); $destination = array(); $proto = array(); $port = array(); $actionsDelete = array(); foreach ($list as $index => $rule) { include 'rule_list.inc.php'; } $n = new ListInfos($decision, _T("Decision")); $n->first_elt_padding = 1; $n->disableFirstColumnActionLink(); $n->addExtraInfo($service, _T("Service")); if (count($src_zones) > 1) { $n->addExtraInfo($source, _T("Source")); } if (count($dst_zones) > 1) { $n->addExtraInfo($destination, _T("Destination")); } $n->addExtraInfo($proto, _T("Protocol")); $n->addExtraInfo($port, _T("Port(s)")); $n->setParamInfo($ids); $n->addActionItemArray($actionsDelete); $n->setNavBar(new AjaxNavBar(count($ids), $filter)); $n->display();
$sharesName = array(); $sharesComment = array(); $editActions = array(); $delActions = array(); //$backupActions = array(); foreach ($shares as $share) { $sharesName[] = $share[0]; if (isset($share[1])) { $sharesComment[] = $share[1]; } else { $sharesComment[] = ""; } if (!in_array($share[0], $protectedShare)) { $editActions[] = new ActionItem(_T("Edit"), "details", "edit", "share"); $delActions[] = new ActionPopupItem(_T("Delete"), "delete", "delete", "share"); } else { $editActions[] = new EmptyActionItem(); $delActions[] = new EmptyActionItem(); } } $p = new PageGenerator(_T("Shares")); $p->setSideMenu($sidemenu); $p->display(); $l = new ListInfos($sharesName, _T("Shares")); $l->setCssClass("shareName"); $l->addExtraInfo($sharesComment, _T("Description")); $l->addActionItemArray($editActions); $l->addActionItemArray($delActions); $l->addActionItem(new ActionPopupItem(_T("Archive"), "backup", "backup", "share")); $l->disableFirstColumnActionLink(); $l->display();
$n = null; $h = array(); $index = 0; foreach ($inv[$table] as $def) { foreach ($def as $k => $v) { $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; }
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 />"; } } } }
* MMC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require "modules/samba/includes/machines.inc.php"; $filter = $_GET['filter']; $computers = search_machines($filter); //print_r($computers); $names = array(); $desc = array(); $active = array(); foreach ($computers as $computer) { $names[] = $computer[0]; $desc[] = $computer[1]; $active[] = $computer[2]; } $l = new ListInfos($names, _T("Computer name", "samba")); $l->disableFirstColumnActionLink(); $l->setCssClass("machineName"); $l->setNavBar(new AjaxNavBar(count($computers), $filter)); $l->addExtraInfo($desc, _T("Description", "samba")); $l->addExtraInfo($active, _T("Active", "samba")); $l->addActionItem(new ActionItem(_T("Edit"), "edit", "edit", "machine")); $l->addActionItem(new ActionPopupItem(_T("Delete"), "delete", "delete", "machine")); $l->setName(_("Computers")); $l->display();
} ksort($connections); $user = array(); $machine = array(); $ip = array(); $timestamp = array(); foreach ($connections as $uid => $infos) { foreach ($infos as $info) { $user[] = $uid; $machine[] = $info[0]; $ip[] = $info[1]; $timestamp[] = $info[2]; } } /** * Creation de la liste */ $n = new ListInfos($user, _T("User", "samba")); $n->addExtraInfo($machine, _T("Computers", "samba"), "25%"); $n->addExtraInfo($ip, _T("IP", "samba"), "25%"); $n->addExtraInfo($timestamp, _T("Connected at", "samba"), "25%"); $n->end = 1000; $n->display(0, 0); } } else { print '<p>' . _T('No connections', 'samba') . '</p>'; } ?>
} else { $status[] = _T("Stopped"); $actionsStart[] = $startAction; $actionsStop[] = $emptyAction; $actionsRestart[] = $emptyAction; } $actionsLog[] = $logAction; $actionsReload[] = $reloadAction; if (dnsService("status")) { $status[] = _T("Started"); $actionsStart[] = $emptyAction; $actionsStop[] = $stopAction; $actionsRestart[] = $restartAction; } else { $status[] = _T("Stopped"); $actionsStart[] = $startAction; $actionsStop[] = $emptyAction; $actionsRestart[] = $emptyAction; } $l = new ListInfos(array("DHCP", "DNS"), _T("Services")); $l->setName(_T("Network services status")); $l->addExtraInfo($status, _T("Status")); $l->setParamInfo(array(array("service" => "DHCP"), array("service" => "DNS"))); $l->setTableHeaderPadding(1); $l->disableFirstColumnActionLink(); $l->addActionItemArray($actionsStart); $l->addActionItemArray($actionsStop); $l->addActionItemArray($actionsRestart); $l->addActionItemArray($actionsReload); $l->addActionItemArray($actionsLog); $l->display(0);
$errStrings = array("no free leases", "Error", "error", "Not configured to listen on any interfaces!", "Can't"); foreach (xmlCall("network.getDhcpLog",array($_SESSION['ajax']['filter'])) as $line) { if (is_array($line)) { $found = False; foreach($errStrings as $err) { if (strpos($line["extra"], $err) !== False) { $extra[] = '<div class="error">' . $line["extra"] . "</div>"; $found = True; break; } } if (!$found) $extra[] = $line["extra"]; $op[] = '<a href="#" onClick="$(\'param\').value=\''.$line["op"].'\'; pushSearch(); return false">'.$line["op"].'</a>'; $dateparsed = strftime('%b %d %H:%M:%S',$line["time"]); $date[] = str_replace(" ", " ", $dateparsed); } else { $date[] = ""; $extra[] = $line; } } $n = new ListInfos($date, _T("Date", "network"),"1px"); $n->addExtraInfo($op, _T("Operations", "network")); $n->addExtraInfo($extra, _T("Informations", "network")); $n->end = 200; $n->setTableHeaderPadding(1); $n->display(0,0); ?> </div>
<div class="fixheight"></div> <? $arrayTMP = getStatutProxy(); foreach($arrayTMP as $key => $value) { $info[]=$key; if ($value) $extraInfo[]=_T("enabled"); else $extraInfo[]=_T("disabled"); } $p = new PageGenerator(); $p->setSideMenu($sidemenu); $p->displaySideMenu(); $n = new ListInfos($info,_T("Services")); $n->setName(_T("Proxy status")); $n->addExtraInfo($extraInfo,_T("Status")); $n->display(0); ?> <form method="post" action="main.php?module=proxy&submod=blacklist&action=restart"> <input name="goto" type="hidden" value="<?php echo $root; ?> main.php" /> <input name="brestart" type="submit" class="btnPrimary" value="<?php echo _T('Restart service'); ?> " />
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; }