$bk_time = $response['data'][4]; $ages = $response['data'][6]; $times = array(); $count = count($backups); $params = array(); for ($i = 0; $i < $count; $i++) { $params[] = array('host' => $_GET['host'], 'backupnum' => $backups[$i]); preg_match("#.+ (.+)#", $bk_time[$i], $result); $time = time() - floatval($ages[$i]) * 24 * 60 * 60; $times[] = strftime(_T("%A, %B %e %Y", 'backuppc'), $time) . ' - ' . $result[1]; } $n = new OptimizedListInfos($times, _T("Backup#", "backuppc")); //$n->addExtraInfo($types, _T("Type", "backuppc")); $n->setCssClass("file"); // CSS for icons $n->setItemCount($count); $n->setNavBar(new AjaxNavBar($count, $filter1)); $n->start = 0; $n->end = 50; $n->setParamInfo($params); // Setting url params $n->addActionItem(new ActionItem(_T("View", "backuppc"), "BrowseShareNames", "display", "host", "backuppc", "backuppc")); print "<br/><br/>"; // to go below the location bar : FIXME, really ugly as line height dependent $n->display(); } // Downloaded files table include "modules/backuppc/backuppc/ajaxDownloadsTable.php"; ?> <style>
$name = sprintf('<a href="#">%s</a>', $name); } } $names[] = $name; } $n = new OptimizedListInfos($names, _T("Destination", "backuppc")); $n->addExtraInfo($times, _T("Restore time", "backuppc")); $n->addExtraInfo($status, _T("Status", "backuppc")); $n->setCssClass("file"); $filter1 = ''; $n->setNavBar(new AjaxNavBar(0, $filter1)); $n->setParamInfo($params); $n->addActionItemArray($actions); $n->start = 0; $n->end = 50; $n->setItemCount(count($names)); $n->display(); } print '</div>'; ?> <script type="text/javascript"> function refresh() { jQuery('div#downloadTable').load("<?php echo 'main.php?module=backuppc&submod=backuppc&action=ajaxDownloadsTable&host=' . $host; ?> "); } <?php
$hosts[] = $r["hostname"]; //rtrim($r[1],"."); $types[] = $r["type"]; $values[] = getRecordValueDescription($zone, $r["type"], $r["value"]); $params[] = array("zone" => $zone, "reverse" => $reverse, "id" => $r["id"], "serial" => $serial); $actionsMod[] = $editAction; if ($r["hostname"] === $curzone . "." && $r["type"] === "TXT" || $r["type"] == "SOA") { $actionsDel[] = $emptyAction; } else { $actionsDel[] = $delAction; } } //print_r($values); $typeAsc = $sortby == "type" ? intval(!$asc) : "1"; $hostnameAsc = $sortby == "hostname" ? intval(!$asc) : "1"; $typeUrl = urlStr("network/network/zonerecords", array("zone" => $zone, "reverse" => $reverse, "sortby" => "type", "asc" => $typeAsc)); $hostnameUrl = urlStr("network/network/zonerecords", array("zone" => $zone, "reverse" => $reverse, "sortby" => "hostname", "asc" => $hostnameAsc)); $n = new OptimizedListInfos($hosts, "<a href='" . $hostnameUrl . "'>" . _T("Host name", "network") . "</a>"); $n->setTableHeaderPadding(1); $n->setNavBar(new AjaxNavBar(count($records), $filter)); $n->setItemCount(count($records)); $n->start = 0; $n->end = count($recordsatpage) - 1; $n->addExtraInfo($types, "<a href='" . $typeUrl . "'>" . _T("Record type", "network")) . "</a>"; $n->addExtraInfo($values, _T("Record parameters", "network")); $n->setName(_T("Host", "network")); $n->setParamInfo($params); $n->disableFirstColumnActionLink(); $n->addActionItemArray($actionsMod); $n->addActionItemArray($actionsDel); $n->display();
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 />"; } } } }
/** * (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(); }
* 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 */ print "<h1>" . _T('Available updates', 'update') . "</h1>"; require_once "includes/xmlrpc.inc.php"; require_once "modules/update/includes/xmlrpc.inc.php"; $updates = getProductUpdates(); $update_titles = array(); foreach ($updates as $update) { $update_titles[] = $update['title']; } $n = new OptimizedListInfos($update_titles, _T("Update", "update")); $n->setItemCount(count($updates)); $n->setNavBar(new AjaxNavBar($count, $filter1)); $n->start = 0; $n->end = 50; ob_start(); $n->display(); $list = ob_get_clean(); //print "<pre>"; //print ; $text = "<h1>" . _T('Available updates', 'backuppc') . "</h1>"; $text .= '<div style="height:400px;width:100%;overflow-y:scroll;">'; $text .= $list; $text .= "</div>"; $f = new NotifyWidget(); $f->add($text);
* * 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 */ print "<center><h1>" . _T('Appstream updates', 'update') . "</h1>"; require_once "includes/xmlrpc.inc.php"; require_once "modules/pkgs/includes/xmlrpc.php"; $notifications = getAppstreamNotifications(); $update_titles = array(); foreach ($notifications as $update) { $update_titles[] = $update['title']; } $n = new OptimizedListInfos($update_titles, _T("Appstream update", "pkgs")); $n->setItemCount(count($notifications)); $n->setNavBar(new AjaxNavBar(count($notifications), '')); $n->start = 0; $n->end = 50; //ob_start(); $n->display(); print '</center>';