function add($file) { global $scripts, $base; $f = "{$base}/{$file}.vo..out.js"; if (file_exists($f)) { $scripts[] = "<script src='{$f}'></script>"; } addCSS($file); }
function addTips() { global $added_tips; if ($added_tips == false) { $added_tips = true; $t = TipsJS(); addScript($t); $tcss = TipsCSS(); addCSS($tcss); } }
function allCSS() { $toret = ""; $conf = new Config(); if ($dh = opendir($conf->cssfolder)) { while (($file = readdir($dh)) !== false) { if (is_file($conf->cssfolder . '/' . $file) && $file != '.' && $file != '..') { echo $toret .= addCSS($file); } } closedir($dh); } return $toret; }
function renderInterfacesStats($object_id) { global $nextorder; global $port_use_age; addCSS("/* Live Interfaces */\n\t\t.text_green { color: #00cc00; }\n\t\t.text_yellow { color: #ff9900; }\n\t\t.text_red { color: #ff0000; }", TRUE); startPortlet('Interfaces statistics'); //get data: show version try { $uptime = queryDevice($object_id, 'getuptime'); } catch (RackTablesError $e) { } echo "<table width='100%'><tr>"; if (permitted(NULL, NULL, 'get_link_status')) { //get data: show interfaces try { $interfaces = queryDevice($object_id, 'getinterfaces'); } catch (RackTablesError $e) { } if (!empty($interfaces)) { $last_reboot = time_convert($uptime); echo "<td"; echo $last_reboot < $port_use_age ? " class='text_red'>" : $last_reboot > 262080 ? " class='text_green'>" : ">"; echo $uptime . "</tr>"; echo "<table width='80%' class='widetable' cellspacing=0 cellpadding='5px' align='center'><tr><th>Port<th>Link status<th>Last input<th>Last clear<th>Input packets<th>Output packets<th>Description</tr>"; $order = 'even'; foreach ($interfaces as $pn => $int) { echo "<tr class='row_{$order}'>"; $order = $nextorder[$order]; echo '<td>' . $pn . '<td'; echo $int['status'] == "connected" ? " class='text_green'>" : ">"; echo $int['status'] . '<td'; echo time_convert($int['last']) > $port_use_age ? " class='text_yellow'>" : ">"; echo $int['last'] . '<td'; echo time_convert($int['clear']) > 0 ? time_convert($int['clear']) < $port_use_age ? " class='text_red'>" : ">" : ">"; echo $int['clear']; echo '<td>' . $int['in_pkts']; echo '<td>' . $int['out_pkts']; echo '<td>' . $int['desc']; echo '</tr>'; } echo "</table></td>"; } } echo "</td></tr></table>"; finishPortlet(); }
function switchportInfoJS($object_id) { $available_ops = array('link' => array('op' => 'get_link_status', 'gw' => 'getportstatus'), 'conf' => array('op' => 'get_port_conf', 'gw' => 'get8021q'), 'mac' => array('op' => 'get_mac_list', 'gw' => 'getmaclist'), 'portmac' => array('op' => 'get_port_mac_list', 'gw' => 'getportmaclist')); $breed = detectDeviceBreed($object_id); $allowed_ops = array(); foreach ($available_ops as $prefix => $data) { if (permitted('object', 'liveports', $data['op']) and validBreedFunction($breed, $data['gw'])) { $allowed_ops[] = $prefix; } } addJS('js/jquery.thumbhover.js'); addCSS('css/jquery.contextmenu.css'); addJS('js/jquery.contextmenu.js'); addJS("enabled_elements = " . json_encode($allowed_ops), TRUE); addJS('js/portinfo.js'); }
function renderCustomReport() { # Get object list $phys_typelist = readChapter(CHAP_OBJTYPE, 'o'); $attibutes = getAttrMap(); $aTagList = getTagList(); if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['csv'])) { header('Content-type: text/csv'); header('Content-Disposition: attachment; filename=export_' . date("Ymdhis") . '.csv'); header('Pragma: no-cache'); header('Expires: 0'); $outstream = fopen("php://output", "w"); $aResult = getResult($_POST); // Get Result $_POST['name'] = validateColums($_POST); // Fix empty colums $csvDelimiter = isset($_POST['csvDelimiter']) ? $_POST['csvDelimiter'] : ','; /* Create Header */ $aCSVRow = array(); if (isset($_POST['sName']) && $_POST['sName']) { array_push($aCSVRow, "Name"); } if (isset($_POST['label'])) { array_push($aCSVRow, "Label"); } if (isset($_POST['type'])) { array_push($aCSVRow, "Type"); } if (isset($_POST['asset_no'])) { array_push($aCSVRow, "Asset Tag"); } if (isset($_POST['has_problems'])) { array_push($aCSVRow, "Has Problems"); } if (isset($_POST['comment'])) { array_push($aCSVRow, "Comment"); } if (isset($_POST['runs8021Q'])) { array_push($aCSVRow, "Runs 8021Q"); } if (isset($_POST['location'])) { array_push($aCSVRow, "Location"); } if (isset($_POST['MACs'])) { array_push($aCSVRow, "MACs"); } if (isset($_POST['IPs'])) { array_push($aCSVRow, "IPs"); } if (isset($_POST['attributeIDs'])) { foreach ($_POST['attributeIDs'] as $attributeID) { array_push($aCSVRow, $attibutes[$attributeID]['name']); } } if (isset($_POST['Tags'])) { array_push($aCSVRow, "Tags"); } if (isset($_POST['Ports'])) { array_push($aCSVRow, "Ports"); } if (isset($_POST['Containers'])) { array_push($aCSVRow, "Containers"); } if (isset($_POST['Childs'])) { array_push($aCSVRow, "Child objects"); } fputcsv($outstream, $aCSVRow, $csvDelimiter); /* Create data rows */ foreach ($aResult as $Result) { $aCSVRow = array(); if (isset($_POST['sName'])) { array_push($aCSVRow, $Result['name']); } if (isset($_POST['label'])) { array_push($aCSVRow, $Result['label']); } if (isset($_POST['type'])) { array_push($aCSVRow, $phys_typelist[$Result['objtype_id']]); } if (isset($_POST['asset_no'])) { array_push($aCSVRow, $Result['asset_no']); } if (isset($_POST['has_problems'])) { array_push($aCSVRow, $Result['has_problems']); } if (isset($_POST['comment'])) { array_push($aCSVRow, str_replace('"', "'", $Result['comment'])); } if (isset($_POST['runs8021Q'])) { array_push($aCSVRow, $Result['runs8021Q']); } if (isset($_POST['location'])) { array_push($aCSVRow, preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '$1', getLocation($Result))); } if (isset($_POST['MACs'])) { $sTemp = ''; foreach (getObjectPortsAndLinks($Result['id']) as $portNumber => $aPortDetails) { if (trim($aPortDetails['l2address']) != '') { $sTemp .= $aPortDetails['l2address'] . ' '; } } array_push($aCSVRow, $sTemp); } if (isset($_POST['IPs'])) { $sTemp = ''; foreach (getObjectIPv4AllocationList($Result['id']) as $key => $aDetails) { if (function_exists('ip4_format')) { $key = ip4_format($key); } if (trim($key) != '') { $sTemp .= $key . ' '; } } foreach (getObjectIPv6AllocationList($Result['id']) as $key => $aDetails) { if (function_exists('ip6_format')) { $key = ip6_format($key); } else { $key = new IPv6Address($key); } if (trim($key) != '') { $sTemp .= $key . ' '; } } array_push($aCSVRow, $sTemp); } if (isset($_POST['attributeIDs'])) { $attributes = getAttrValues($Result['id']); foreach ($_POST['attributeIDs'] as $attributeID) { if (isset($attributes[$attributeID]['a_value'])) { array_push($aCSVRow, $attributes[$attributeID]['a_value']); } elseif ($attributes[$attributeID]['value'] != '' && $attributes[$attributeID]['type'] == 'date') { array_push($aCSVRow, date("Y-m-d", $attributes[$attributeID]['value'])); } else { array_push($aCSVRow, ''); } } } if (isset($_POST['Tags'])) { $sTemp = ''; foreach ($Result['tags'] as $aTag) { $sTemp .= $aTag['tag'] . ' '; } if (count($Result['itags']) > 0) { $sTemp .= '('; foreach ($Result['itags'] as $aTag) { $sTemp .= $aTag['tag'] . ' '; } $sTemp .= ')'; } array_push($aCSVRow, $sTemp); } if (isset($_POST['Ports'])) { $sTemp = ''; foreach ($Result['portsLinks'] as $port) { $sTemp .= $port['name'] . ': ' . $port['remote_object_name']; if (trim($port['cableid']) != '') { $sTemp .= ' Cable ID: ' . $port['cableid']; } $sTemp .= ' '; } $sTemp = trim($sTemp); array_push($aCSVRow, $sTemp); } if (isset($_POST['Containers'])) { $sTemp = ''; foreach (getObjectContainerList($Result['id']) as $key => $aDetails) { $sTemp .= trim($aDetails['container_name']) . ' '; } $sTemp = trim($sTemp); array_push($aCSVRow, $sTemp); } if (isset($_POST['Childs'])) { $sTemp = ''; foreach (getObjectChildObjectList($Result['id']) as $key => $aDetails) { $sTemp .= trim($aDetails['object_name']) . ' '; } $sTemp = trim($sTemp); array_push($aCSVRow, $sTemp); } fputcsv($outstream, $aCSVRow, $csvDelimiter); } fclose($outstream); exit(0); # Exit normally after send CSV to browser } echo '<h2>Custom report</h2><ul>'; // Load stylesheet and jquery scripts addCSS('css/extensions/style.css'); addJS('js/extensions/saveFormValues.js'); addJS('js/extensions/jquery-latest.js'); addJS('js/extensions/jquery.tablesorter.js'); addJS('js/extensions/picnet.table.filter.min.js'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { echo '<a href="#" class="show_hide">Show/hide search form</a><br/><br/>'; } echo '<div class="searchForm">'; echo '<form method="post" name="searchForm">'; echo '<table class="searchTable"> <tr> <th>Object Type</th> <th>Common Values</th> <th>Attributes</th> <th>Tags</th> <th>Misc</th> </tr> <tr>'; echo '<td valign="top"> <table class="searchTable">'; $i = 0; foreach ($phys_typelist as $objectTypeID => $sName) { if ($i % 2) { echo '<tr class="odd">'; } else { echo '<tr>'; } echo ' <td> <input type="checkbox" name="objectIDs[]" value="' . $objectTypeID . '"'; if (isset($_POST['objectIDs']) && in_array($objectTypeID, $_POST['objectIDs'])) { echo ' checked="checked"'; } echo ' > ' . $sName . ' </td> </tr>'; $i++; } echo ' </table> </td>'; echo '<td valign="top"> <table class="searchTable"> <tr><td><input type="checkbox" name="sName" value="1" '; if (isset($_POST['sName'])) { echo ' checked="checked"'; } echo '> Name</td></tr> <tr class="odd"><td><input type="checkbox" name="label" value="1" '; if (isset($_POST['label'])) { echo ' checked="checked"'; } echo '> Label</td></tr> <tr><td><input type="checkbox" name="type" value="1" '; if (isset($_POST['type'])) { echo ' checked="checked"'; } echo '> Type</td></tr> <tr class="odd"><td><input type="checkbox" name="asset_no" value="1" '; if (isset($_POST['asset_no'])) { echo ' checked="checked"'; } echo '> Asset Tag</td></tr> <tr><td><input type="checkbox" name="location" value="1" '; if (isset($_POST['location'])) { echo ' checked="checked"'; } echo '> Location</td></tr> <tr class="odd"><td><input type="checkbox" name="has_problems" value="1" '; if (isset($_POST['has_problems'])) { echo ' checked="checked"'; } echo '> Has Problems</td></tr> <tr><td><input type="checkbox" name="comment" value="1" '; if (isset($_POST['comment'])) { echo ' checked="checked"'; } echo '> Comment</td></tr> <tr class="odd"><td><input type="checkbox" name="runs8021Q" value="1" '; if (isset($_POST['runs8021Q'])) { echo ' checked="checked"'; } echo '> Runs 8021Q</td></tr> <tr><td><input type="checkbox" name="MACs" value="1" '; if (isset($_POST['MACs'])) { echo ' checked="checked"'; } echo '> MACs</td></tr> <tr class="odd"><td><input type="checkbox" name="IPs" value="1" '; if (isset($_POST['IPs'])) { echo ' checked="checked"'; } echo '> IPs</td></tr> <tr><td><input type="checkbox" name="Tags" value="1" '; if (isset($_POST['Tags'])) { echo ' checked="checked"'; } echo '> Tags</td></tr> <tr class="odd"><td><input type="checkbox" name="Ports" value="1" '; if (isset($_POST['Ports'])) { echo ' checked="checked"'; } echo '> Ports</td></tr> <tr><td><input type="checkbox" name="Containers" value="1" '; if (isset($_POST['Containers'])) { echo ' checked="checked"'; } echo '> Containers</td></tr> <tr class="odd"><td><input type="checkbox" name="Childs" value="1" '; if (isset($_POST['Childs'])) { echo ' checked="checked"'; } echo '> Child objects</td></tr> </table> </td>'; echo '<td valign="top"> <table class="searchTable">'; $i = 0; foreach ($attibutes as $attributeID => $aRow) { if ($i % 2) { echo '<tr class="odd">'; } else { echo '<tr>'; } echo ' <td> <input type="checkbox" name="attributeIDs[]" value="' . $attributeID . '"'; if (isset($_POST['attributeIDs']) && in_array($attributeID, $_POST['attributeIDs'])) { echo ' checked="checked"'; } echo '> ' . $aRow['name'] . ' </td> </tr>'; $i++; } echo ' </table> </td>'; echo '<td valign="top"> <table class="searchTable">'; $i = 0; foreach ($aTagList as $aTag) { echo '<tr ' . ($i % 2 ? 'class="odd"' : '') . '> <td> <input type="checkbox" name="tag[' . $aTag['id'] . ']" value="1" ' . (isset($_POST['tag'][$aTag['id']]) ? 'checked="checked" ' : '') . '> ' . $aTag['tag'] . ' </td> </tr>'; $i++; } if (count($aTagList) < 1) { echo '<tr><td><i>No Tags available</i></td></tr>'; } echo ' </table> </td>'; echo '<td valign="top"> <table class="searchTable"> <tr><td><input type="checkbox" name="csv" value="1"> CSV Export</td></tr> <tr><td><input type="text" name="csvDelimiter" value="," size="1"> CSV Delimiter</td></tr> <tr class="odd"><td>Name Filter: <i>(Regular Expression)</i></td></tr> <tr><td><input type="text" name="name_preg" value="'; if (isset($_POST['name_preg'])) { echo $_POST['name_preg']; } echo '" style="height: 11pt;"></td></tr> <tr class="odd"><td>Asset Tag Filter: <i>(Regular Expression)</i></td></tr> <tr><td><input type="text" name="tag_preg" value="'; if (isset($_POST['tag_preg'])) { echo $_POST['tag_preg']; } echo '" style="height: 11pt;"></td></tr> <tr class="odd"><td>Comment Filter: <i>(Regular Expression)</i></td></tr> <tr><td><input type="text" name="comment_preg" value="'; if (isset($_POST['comment_preg'])) { echo $_POST['comment_preg']; } echo '" style="height: 11pt;"></td></tr> <tr class="odd"><td> </td></tr> <tr> <td> Save: <input id="nameQuery" type="text" name="nameQuery" value="" style="height: 11pt; width:155px"/> <input type="button" value=" Ok " onclick="saveQuery();"> <br/> Load:<br/> <span id="loadButtons"></span> <script type="text/javascript"> loadButtons(); </script> </td> </tr> <tr class="odd"><td> </td></tr> <tr><td align="right"><input type="submit" value=" Search "></td></tr> </table> </td> </tr> </table>'; echo '</form>'; echo '</div>'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $aResult = getResult($_POST); // Get Result $_POST['sName'] = validateColums($_POST); // Fix empty colums if (count($aResult) > 0) { echo '<table id="customTable" class="tablesorter"> <thead> <tr>'; if (isset($_POST['sName']) && $_POST['sName']) { echo '<th>Name</th>'; } if (isset($_POST['label'])) { echo '<th>Label</th>'; } if (isset($_POST['type'])) { echo '<th>Type</th>'; } if (isset($_POST['asset_no'])) { echo '<th>Asset Tag</th>'; } if (isset($_POST['has_problems'])) { echo '<th>Has Problems</th>'; } if (isset($_POST['comment'])) { echo '<th>Comment</th>'; } if (isset($_POST['runs8021Q'])) { echo '<th>Runs 8021Q</th>'; } if (isset($_POST['location'])) { echo '<th>Location</th>'; } if (isset($_POST['MACs'])) { echo '<th>MACs</th>'; } if (isset($_POST['IPs'])) { echo '<th>IPs</th>'; } if (isset($_POST['attributeIDs'])) { foreach ($_POST['attributeIDs'] as $attributeID) { echo '<th>' . $attibutes[$attributeID]['name'] . '</th>'; } } if (isset($_POST['Tags'])) { echo '<th>Tags</th>'; } if (isset($_POST['Ports'])) { echo '<th>Ports</th>'; } if (isset($_POST['Containers'])) { echo '<th>Containers</th>'; } if (isset($_POST['Childs'])) { echo '<th>Child objects</th>'; } echo ' </tr> </thead> <tbody>'; foreach ($aResult as $Result) { echo '<tr>'; if (isset($_POST['sName'])) { echo '<td> <span class="object_' . str_replace('$', '', $Result['atags'][1]['tag']) . '">'; if (isset($Result['name'])) { echo '<a href="' . makeHref(array('page' => 'object', 'object_id' => $Result['id'])) . '">' . $Result['name'] . '</a>'; } else { echo ' '; } echo ' </span> </td>'; } if (isset($_POST['label'])) { echo '<td>'; if (isset($Result['label'])) { echo $Result['label']; } else { echo ' '; } echo '</td>'; } if (isset($_POST['type'])) { echo '<td>'; if (isset($Result['objtype_id'])) { echo $phys_typelist[$Result['objtype_id']]; } else { echo ' '; } echo '</td>'; } if (isset($_POST['asset_no'])) { echo '<td>'; if (isset($Result['asset_no'])) { echo $Result['asset_no']; } else { echo ' '; } echo '</td>'; } if (isset($_POST['has_problems'])) { echo '<td>'; if (isset($Result['has_problems'])) { echo $Result['has_problems']; } else { echo ' '; } echo '</td>'; } if (isset($_POST['comment'])) { echo '<td>'; if (isset($Result['comment'])) { echo makeLinksInText($Result['comment']); } else { echo ' '; } echo '</td>'; } if (isset($_POST['runs8021Q'])) { echo '<td>'; if (isset($Result['runs8021Q'])) { echo $Result['runs8021Q']; } else { echo ' '; } echo '</td>'; } if (isset($_POST['location'])) { echo '<td>'; echo getLocation($Result); echo '</td>'; } if (isset($_POST['MACs'])) { echo '<td>'; foreach (getObjectPortsAndLinks($Result['id']) as $portNumber => $aPortDetails) { if (trim($aPortDetails['l2address']) != '') { echo $aPortDetails['l2address'] . '<br/>'; } } echo '</td>'; } if (isset($_POST['IPs'])) { echo '<td>'; foreach (getObjectIPv4AllocationList($Result['id']) as $key => $aDetails) { if (function_exists('ip4_format')) { $key = ip4_format($key); } if (trim($key) != '') { echo $key . '<br/>'; } } foreach (getObjectIPv6AllocationList($Result['id']) as $key => $aDetails) { if (function_exists('ip6_format')) { $key = ip6_format($key); } else { $key = new IPv6Address($key); } if (trim($key) != '') { echo $key . '<br/>'; } } echo '</td>'; } if (isset($_POST['attributeIDs'])) { $attributes = getAttrValues($Result['id']); foreach ($_POST['attributeIDs'] as $attributeID) { echo '<td>'; if (isset($attributes[$attributeID]['a_value']) && $attributes[$attributeID]['a_value'] != '') { echo $attributes[$attributeID]['a_value']; } elseif ($attributes[$attributeID]['value'] != '' && $attributes[$attributeID]['type'] == 'date') { echo date("Y-m-d", $attributes[$attributeID]['value']); } else { echo ' '; } } } if (isset($_POST['Tags'])) { echo '<td>'; foreach ($Result['tags'] as $aTag) { echo '<a href="' . makeHref(array('page' => 'depot', 'tab' => 'default', 'andor' => 'and', 'cft[]' => $aTag['id'])) . '">' . $aTag['tag'] . '</a> '; } if (count($Result['itags']) > 0) { echo '('; foreach ($Result['itags'] as $aTag) { echo '<a href="' . makeHref(array('page' => 'depot', 'tab' => 'default', 'andor' => 'and', 'cft[]' => $aTag['id'])) . '">' . $aTag['tag'] . '</a> '; } echo ')'; } echo '</td>'; } if (isset($_POST['Ports'])) { echo '<td>'; foreach ($Result['portsLinks'] as $port) { echo $port['name'] . ': '; if ($port['remote_object_name'] != 'unknown') { echo formatPortLink($port['remote_object_id'], $port['remote_object_name'], $port['remote_id'], NULL); } else { echo $port['remote_object_name']; } if (trim($port['cableid']) != '') { echo ' Cable ID: ' . $port['cableid']; } echo '<br/>'; } echo '</td>'; } if (isset($_POST['Containers'])) { echo '<td>'; foreach (getObjectContainerList($Result['id']) as $key => $aDetails) { echo '<a href="' . makeHref(array('page' => 'object', 'object_id' => $key)) . '">' . $aDetails['container_name'] . '</a><br/>'; } echo '</td>'; } if (isset($_POST['Childs'])) { echo '<td>'; foreach (getObjectChildObjectList($Result['id']) as $key => $aDetails) { echo '<a href="' . makeHref(array('page' => 'object', 'object_id' => $key)) . '">' . $aDetails['object_name'] . '</a><br/>'; } echo '</td>'; } echo '</tr>'; } echo ' </tbody> </table> <script type="text/javascript">$(".searchForm").hide();</script>'; } else { echo '<br/><br/><div align="center" style="font-size:10pt;"><i>No items found !!!</i></div><br/>'; } echo '<script type="text/javascript"> $(document).ready(function() { $.tablesorter.defaults.widgets = ["zebra"]; $("#customTable").tablesorter( { headers: { }, sortList: [[0,0]] } ); $("#customTable").tableFilter(); $(".show_hide").show(); $(".show_hide").click(function(){ $(".searchForm").slideToggle(\'slow\'); }); } ); </script>'; } }
function renderSearchNewIP4Range() { global $pTable; // prepare $cellfilter $cellfilter = getCellFilter(); if ($cellfilter['is_empty'] || !isset($_REQUEST['cfp'])) { if (defined('SPARE_SEARCH_PREDICATE') && isset($pTable[SPARE_SEARCH_PREDICATE])) { $_REQUEST['cfp'] = array(SPARE_SEARCH_PREDICATE); $cellfilter = getCellFilter(); } } $mask = NULL; if (!empty($_REQUEST['pref_len'])) { $mask = intval($_REQUEST['pref_len']); } $nets = array(); foreach (filterCellList(listCells('ipv4net'), $cellfilter['expression']) as $net) { if (!isset($mask)) { $nets[] = $net; } elseif ($net['mask'] <= $mask) { $is_aggregate = FALSE; foreach ($net['atags'] as $atag) { if ($atag['tag'] == '$aggregate') { $is_aggregate = TRUE; } elseif (preg_match('/^\\$spare_(\\d+)$/', $atag['tag'], $m) && $mask >= $m[1]) { $nets[] = $net; continue 2; } } if (!$is_aggregate) { $nets[] = $net; } } } $filter = getOutputOf('renderCellFilterPortlet', $cellfilter, 'ipv4net', $nets); echo '<table width="100%"><tr valign=top>'; echo '<td>'; startPortlet("Results (" . count($nets) . ")"); echo '<ul class="spare-nets">'; foreach ($nets as $net) { echo '<li>'; renderNetCellForAlloc($net, $mask); echo '</li>'; } echo '</ul>'; finishPortlet(); echo '</td>'; echo '<td width="33%">'; echo preg_replace_callback('/(<form[^<>]*>)/', 'generatePrefixLengthInput', $filter); echo '</td>'; echo '</tr></table>'; addCSS(<<<END ul.spare-nets { \tlist-style: none; \tpadding: 0px; } ul.spare-nets li { \tmargin: 5px 0px; } END , TRUE); }
function snmplive_tabhandler($object_id) { addCSS(<<<ENDCSS .ifoperstatus-default { background-color:#ddd; } .ifoperstatus-1, .ifoperstatus-up { background-color:#00ff00; } .ifoperstatus-2, .ifoperstatus-down { background-color:#ff0000; } .ifoperstatus-3, .ifoperstatus-testing { background-color:#ffff66; } .ifoperstatus-4, .ifoperstatus-unknown { background-color:#ffffff; } .ifoperstatus-5, .ifoperstatus-dormant { background-color:#90bcf5; } .ifoperstatus-6, .ifoperstatus-notPresent { } .ifoperstatus-7, .ifoperstatus-lowerLayerDown { } .port-groups { border-spacing:1px;display:table; } .port-group { display:table-cell;border:3px solid #000;background-color:#c0c0c0; } .port-column { display:table-cell;position:relative; } .port { position:relative;width:42px;height:100px;border:2px solid #000;overflow:hidden; } .port-pos-1 { margin-bottom:1px; } .port-pos-2 { } .port-pos-0 { margin-top:1px; } .port-header { position:absolute } .port-header-pos-1 { top:0px; } .port-header-pos-0 { bottom:0px; } .port-status { position:absolute;min-width:42px;text-align:center;font-size:10pt; } .port-status-pos-1 { top:35px; } .port-status-pos-0 { bottom:35px; } .port-info { position:absolute;width:90%;background-color:#ddd;overflow:hidden; } .port-info-pos-1 { top: 80px; } .port-info-pos-0 { bottom: 80px;} .port-name { font-size:10pt;margin:0px auto;width:40px;text-align:center; } .port-number { font-size:8pt;color:#eee; } .port-detail { position:fixed;z-index:1000;top:0px;right:0px;border:3px solid #000;background-color:#fff } .port-detail-links { background-color:#ccc } .hidden { visibility:hidden; } .info-footer { } ENDCSS , TRUE); echo "<div id=\"info\"></div>"; if (isset($_GET['debug'])) { $debug = $_GET['debug']; } else { $debug = 0; } $object = spotEntity('object', $object_id); amplifyCell($object); if (isset($_GET['modules'])) { $modules = $_GET['modules']; } else { $modules = false; } if ($modules) { unset($_GET['modules']); } else { $_GET['modules'] = 1; } echo "<a href=" . makeHref($_GET) . ">" . ($modules ? "Hide" : "Show") . " Modules</a>"; pl_layout_default($object, 0, false, $modules); addJS(<<<ENDJS function togglevisibility(elem, hide) { if(hide) elem.css('visibility', 'hidden'); else elem.css('visibility', 'visible'); //a.show(); //a.hide(); } function setdetail(elem, hide) { var a = \$( "#port" + elem.id + "-detail"); togglevisibility(a, hide); } function setports( data, textStatus, jqHXR ) { if(data.debug) \$( "#info" ).html(\$( "#info" ).html() + "DEBUG: " + data.name + ": " + data.debug); for(var index in data.ports) { setport(data, data.ports[index]); } } function setportstatus( obj, port , id , detail) { tagidsuffix = ""; if(detail) tagidsuffix = tagidsuffix + "-detail"; if(!detail) { \$( "#port" + id + "-status" + tagidsuffix ).html("<table class=\\"ifoperstatus-" + port.snmpinfos. operstatus + "\\"><tr><td>" + port.snmpinfos.operstatus + "<br>" + port.snmpinfos.speed \t\t\t\t\t+ ( port.snmpinfos.vlan ? "<br>" + port.snmpinfos.vlan : "" ) + "</td></tr></table>"); return; } \$( "#port" + id + "-status" + tagidsuffix ).html(port.snmpinfos.alias + "<table class=\\"ifoperstatus-" + port.snmpinfos.operstatus + "\\"><tr><td>" + (port.snmpinfos.ipv4 ? port.snmpinfos.ipv4 : "") \t\t\t\t\t+ "<br>" + port.snmpinfos.operstatus \t\t\t\t\t+ ( port.snmpinfos.vlan ? "<br>" + port.snmpinfos.vlan_name + " (" + port.snmpinfos.vlan + ")" : "" ) + "</td></tr></table>"); } function setport( obj, port ) { if(port.debug) \$( "#info" ).html(\$( "#info" ).html() + port.name + " " + port.debug); if(port.snmpinfos) { setportstatus(obj, port, port.id, false); setportstatus(obj, port, port.id, true); } } function ajaxerror(jqHXR, textStatus, qXHR, errorThrown) { \$( "#info" ).html(\$( "#info" ).html() + "<br>" + textStatus + " " + qXHR + " " + errorThrown); } \t\$.ajax({ \t\tdataType: "json", \t\turl: "index.php", \t\tdata: { \t\t\tpage: "object", \t\t\ttab: "snmplive", \t\t\tmodule: "redirect", \t\t\top: "ajax", \t\t\tjson: "get", \t\t\tobject_id: "{$object_id}", \t\t\tdebug: {$debug} \t\t}, \t\terror: ajaxerror, \t\tsuccess: setports \t}); ENDJS , TRUE); }
// used by getExplicitTagsOnly() $tagRelCache = array(); $taglist = getTagList(); $tagtree = treeFromList($taglist); $auto_tags = array(); if (!isCLIMode() && isset($_SERVER['REMOTE_ADDR'])) { $auto_tags[] = array('tag' => '$client_' . $_SERVER['REMOTE_ADDR']); } // Initial chain for the current user. $user_given_tags = array(); // list of regexps used in findAutoTagWarnings to check RackCode. // add your regexps here to suppress 'Martian autotag' warnings $user_defined_atags = array(); // This also can be modified in local.php. $pageheaders = array(100 => "<link rel='ICON' type='image/x-icon' href='?module=chrome&uri=pix/favicon.ico' />"); addCSS('css/pi.css'); if (!isset($script_mode) or $script_mode !== TRUE) { // A successful call to authenticate() always generates autotags and somethimes // even given/implicit tags. It also sets remote_username and remote_displayname. authenticate(); // Authentication passed. // Note that we don't perform autorization here, so each 1st level page // has to do it in its way, e.g. by calling authorize() after fixContext(). } elseif (!isset($remote_username)) { // Some functions require remote_username to be set to something to act correctly, // even though they don't use the value itself. $admin_account = spotEntity('user', 1); if (isCLIMode() && FALSE !== ($env_user = getenv('USER'))) { // use USER env var if we are in CLI mode $remote_username = $env_user; } else {
function handlePopupPortLink() { assertPermission('depot', 'default'); assertUIntArg('port'); assertUIntArg('remote_port'); assertStringArg('cable', TRUE); $port_info = getPortInfo($_REQUEST['port']); $remote_port_info = getPortInfo($_REQUEST['remote_port']); $POIFC = getPortOIFCompat(); if (isset($_REQUEST['port_type']) and isset($_REQUEST['remote_port_type'])) { $type_local = $_REQUEST['port_type']; $type_remote = $_REQUEST['remote_port_type']; } else { $type_local = $port_info['oif_id']; $type_remote = $remote_port_info['oif_id']; } $matches = FALSE; $js_table = ''; foreach ($POIFC as $pair) { if ($pair['type1'] == $type_local && $pair['type2'] == $type_remote) { $matches = TRUE; break; } else { $js_table .= "POIFC['{$pair['type1']}-{$pair['type2']}'] = 1;\n"; } } if ($matches) { if ($port_info['oif_id'] != $type_local) { commitUpdatePortOIF($port_info['id'], $type_local); } if ($remote_port_info['oif_id'] != $type_remote) { commitUpdatePortOIF($remote_port_info['id'], $type_remote); } linkPorts($port_info['id'], $remote_port_info['id'], $_REQUEST['cable']); // patch cable? if (array_key_exists('heap_id', $_REQUEST)) { // Leave the compatibility constraints check up to the foreign keys. if (0 != ($heap_id = genericAssertion('heap_id', 'uint0'))) { $heaps = getPatchCableHeapSummary(); if (commitModifyPatchCableAmount($heap_id, -1)) { showSuccess('consumed a patch cable from ' . formatPatchCableHeapAsPlainText($heaps[$heap_id])); } else { showError('failed to consume a patch cable'); } } } showOneLiner(8, array(formatPortLink($port_info['object_id'], NULL, $port_info['id'], $port_info['name']), formatPort($remote_port_info))); addJS(<<<END window.opener.location.reload(true); window.close(); END , TRUE); backupLogMessages(); } else { // JS code to display port compatibility hint addJS(<<<END POIFC = {}; {$js_table} \$(document).ready(function () { \t\$('select.porttype').change(onPortTypeChange);\t \tonPortTypeChange(); }); function onPortTypeChange() { \tvar key = \$('*[name=port_type]')[0].value + '-' + \$('*[name=remote_port_type]')[0].value; \tif (POIFC[key] == 1) \t{ \t\t\$('#hint-not-compat').hide(); \t\t\$('#hint-compat').show(); \t} \telse \t{ \t\t\$('#hint-compat').hide(); \t\t\$('#hint-not-compat').show(); \t} } END , TRUE); addCSS(<<<END .compat-hint { \tdisplay: none; \tfont-size: 125%; } .compat-hint#hint-compat { \tcolor: green; } .compat-hint#hint-not-compat { \tcolor: #804040; } END , TRUE); // render port type editor form echo '<form method=GET>'; echo '<input type=hidden name="module" value="popup">'; echo '<input type=hidden name="helper" value="portlist">'; echo '<input type=hidden name="port" value="' . $port_info['id'] . '">'; echo '<input type=hidden name="remote_port" value="' . $remote_port_info['id'] . '">'; echo '<input type=hidden name="cable" value="' . htmlspecialchars($_REQUEST['cable'], ENT_QUOTES) . '">'; echo '<p>The ports you have selected are not compatible. Please select a compatible transceiver pair.'; echo '<p>'; echo formatPort($port_info) . ' '; if ($port_info['iif_id'] == 1) { echo formatPortIIFOIF($port_info); echo '<input type=hidden name="port_type" value="' . $port_info['oif_id'] . '">'; } else { echo '<label>' . $port_info['iif_name'] . ' '; printSelect(getExistingPortTypeOptions($port_info), array('class' => 'porttype', 'name' => 'port_type'), $type_local); echo '</label>'; } echo ' — '; if ($remote_port_info['iif_id'] == 1) { echo formatPortIIFOIF($remote_port_info); echo '<input type=hidden name="remote_port_type" value="' . $remote_port_info['oif_id'] . '">'; } else { echo '<label>' . $remote_port_info['iif_name'] . ' '; printSelect(getExistingPortTypeOptions($remote_port_info), array('class' => 'porttype', 'name' => 'remote_port_type'), $type_remote); echo '</label>'; } echo ' ' . formatPort($remote_port_info); echo '<p class="compat-hint" id="hint-not-compat">✕ Not compatible port types</p>'; echo '<p class="compat-hint" id="hint-compat">✔ Compatible port types</p>'; echo '<p><input type=submit name="do_link" value="Link">'; } }
/** ----------------------------- * load CSS libaray ----------------------------*/ function initCSS() { addCSS('css/reset.css'); addCSS('css/common.css'); }
* */ defined('_JEXEC') or die; // Always load JBSM API if it exists. $api = JPATH_ADMINISTRATOR . '/components/com_churchdirectory/api.php'; if (file_exists($api)) { require_once $api; } // Include the Birthday/Anniversary functions only once require_once dirname(__FILE__) . '/helper.php'; /* Set some global property */ addCSS(); /* Get the RenderHelper Class for the Module to us */ $render = new ChurchDirectoryRenderHelper; /* Return members that have Birthdays of this month. */ $birthdays = $render->getBirthdays($params); /* Return members that have Anniversary of this month. */ $anniversary = $render->getAnniversary($params); // Get Groups for checking permissions $user = JFactory::getUser(); $groups = $user->getAuthorisedViewLevels(); // Check permissions for Birthdays by running through the records and removing those the user doesn't have permission to see
<?php addCSS('tesing.css');
function renderRackCodeEditor() { addJS('js/codemirror/codemirror.js'); addJS('js/codemirror/rackcode.js'); addCSS('js/codemirror/codemirror.css'); addJS(<<<ENDJAVASCRIPT function verify() { \t\$.ajax({ \t\ttype: "POST", \t\turl: "index.php", \t\tdata: {'module': 'ajax', 'ac': 'verifyCode', 'code': \$("#RCTA").text()}, \t\tsuccess: function (data) \t\t{ \t\t\tarr = data.split("\\n"); \t\t\tif (arr[0] == "ACK") \t\t\t{ \t\t\t\t\$("#SaveChanges")[0].disabled = ""; \t\t\t\t\$("#ShowMessage")[0].innerHTML = "Code verification OK, don't forget to save the code"; \t\t\t\t\$("#ShowMessage")[0].className = "msg_success"; \t\t\t} \t\t\telse \t\t\t{ \t\t\t\t\$("#SaveChanges")[0].disabled = "disabled"; \t\t\t\t\$("#ShowMessage")[0].innerHTML = arr[1]; \t\t\t\t\$("#ShowMessage")[0].className = "msg_warning"; \t\t\t} \t\t} \t}); } \$(document).ready(function() { \t\$("#SaveChanges")[0].disabled = "disabled"; \t\$("#ShowMessage")[0].innerHTML = ""; \t\$("#ShowMessage")[0].className = ""; \tvar rackCodeMirror = CodeMirror.fromTextArea(document.getElementById("RCTA"),{ \t\tmode:'rackcode', \t\tlineNumbers:true }); \trackCodeMirror.on("change",function(cm,cmChangeObject){ \t\t\$("#RCTA").text(cm.getValue()); }); }); ENDJAVASCRIPT , TRUE); $text = loadScript('RackCode'); printOpFormIntro('saveRackCode'); echo '<table style="width:100%;border:1px;" border=0 align=center>'; echo "<tr><td><textarea rows=40 cols=100 name=rackcode id=RCTA class='codepress rackcode'>"; echo $text . "</textarea></td></tr>\n"; echo "<tr><td align=center>"; echo '<div id="ShowMessage"></div>'; echo "<input type='button' value='Verify' onclick='verify();'>"; echo "<input type='submit' value='Save' disabled='disabled' id='SaveChanges' onclick='\$(RCTA).toggleEditor();'>"; // printImageHREF ('SAVE', 'Save changes', TRUE); echo "</td></tr>"; echo '</table>'; echo "</form>"; }
}] }]'; } else { if ($modify_json != 'false') { $style = urldecode(base64_decode($map_json)); } } // style //////////////////////////////////////////////////////////////// // // HTML Output // //////////////////////////////////////////////////////////////// $output .= '<div id="' . $id . '" class="mk-advanced-gmaps ' . $map_height_class . '" data-options=\'' . $options . '\' data-places=\'' . $places . '\' data-style=\'' . $style . '\' data-icon=\'' . $pin_icon . '\' ></div>'; $output .= '<script src="http' . (is_ssl() ? 's' : '') . '://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script>'; echo $output; //////////////////////////////////////////////////////////////// // // Custom CSS Output // //////////////////////////////////////////////////////////////// if ($map_height == 'custom') { addCSS(' #' . $id . ' { height: ' . $height . 'px; } '); }
function renderVMReport() { $aResult = array(); $iTotal = 0; $sFilter = '{$typeid_1504}'; # typeid_1504 = Virtual machines foreach (scanRealmByText('object', $sFilter) as $Result) { $aResult[$Result['id']] = array(); $aResult[$Result['id']]['sName'] = $Result['name']; // Create active links in comment $aResult[$Result['id']]['sComment'] = makeLinksInText($Result['comment']); // Load additional attributes: $attributes = getAttrValues($Result['id']); $aResult[$Result['id']]['sContact'] = ''; if (isset($attributes['14']['a_value'])) { $aResult[$Result['id']]['sContact'] = $attributes['14']['a_value']; } $aResult[$Result['id']]['OEMSN'] = ''; if (isset($attributes['1']['a_value'])) { $aResult[$Result['id']]['OEMSN'] = $attributes['1']['a_value']; } $aResult[$Result['id']]['sOS'] = ''; if (isset($attributes['4']['a_value'])) { $aResult[$Result['id']]['sOS'] = $attributes['4']['a_value']; } // IP Informations $aResult[$Result['id']]['ipV4List'] = getObjectIPv4AllocationList($Result['id']); $aResult[$Result['id']]['ipV6List'] = getObjectIPv6AllocationList($Result['id']); // Port (MAC) Informations $aResult[$Result['id']]['ports'] = getObjectPortsAndLinks($Result['id']); // Container $aResult[$Result['id']]['container'] = getObjectContainerList($Result['id']); $iTotal++; } if (isset($_GET['csv'])) { header('Content-type: text/csv'); header('Content-Disposition: attachment; filename=export_' . date("Ymdhis") . '.csv'); header('Pragma: no-cache'); header('Expires: 0'); $outstream = fopen("php://output", "w"); $aCSVRow = array('Name', 'MAC', 'IP(s)', 'Comment', 'Contact', 'OS', 'Hypervisor'); fputcsv($outstream, $aCSVRow); foreach ($aResult as $id => $aRow) { $aCSVRow = array(); $aCSVRow[0] = $aRow['sName']; $aCSVRow[1] = ''; foreach ($aRow['ports'] as $portNumber => $aPortDetails) { if (trim($aPortDetails['l2address']) != '') { $aCSVRow[1] .= $aPortDetails['l2address'] . ' '; } } $aCSVRow[1] = trim($aCSVRow[1]); $aCSVRow[2] = ''; foreach ($aRow['ipV4List'] as $key => $aDetails) { if (function_exists('ip4_format')) { $key = ip4_format($key); } if (trim($key) != '') { $aCSVRow[2] .= $key . ' '; } } foreach ($aRow['ipV6List'] as $key => $aDetails) { if (function_exists('ip6_format')) { $key = ip6_format($key); } if (trim($key) != '') { $aCSVRow[2] .= $key . ' '; } } $aCSVRow[2] = trim($aCSVRow[2]); $aCSVRow[3] = str_replace('"', "'", $aRow['sComment']); $aCSVRow[4] = $aRow['sContact']; $aCSVRow[5] = $aRow['sOS']; $aCSVRow[6] = ''; foreach ($aRow['container'] as $key => $aDetails) { $aCSVRow[6] .= trim($aDetails['container_name']) . ' '; } $aCSVRow[6] = trim($aCSVRow[6]); fputcsv($outstream, $aCSVRow); } fclose($outstream); exit(0); # Exit normally after send CSV to browser } // Load stylesheet and jquery scripts addCSS('css/extensions/style.css'); addJS('js/extensions/jquery-latest.js'); addJS('js/extensions/jquery.tablesorter.js'); addJS('js/extensions/picnet.table.filter.min.js'); // Display the stat array echo "<h2>Virtual machines report ({$iTotal})</h2><ul>"; echo '<a href="index.php?page=reports&tab=vm&csv">CSV Export</a>'; echo '<table id="reportTable" class="tablesorter"> <thead> <tr> <th>Name</th> <th>MAC</th> <th>IP(s)</th> <th>Comment</th> <th>Contact</th> <th>OS</th> <th>Hypervisor</th> </tr> </thead> <tbody>'; foreach ($aResult as $id => $aRow) { echo '<tr> <td><a href="' . makeHref(array('page' => 'object', 'object_id' => $id)) . '">' . $aRow['sName'] . '</a></td> <td>'; foreach ($aRow['ports'] as $portNumber => $aPortDetails) { if (trim($aPortDetails['l2address']) != '') { echo $aPortDetails['l2address'] . '<br/>'; } } echo ' </td>' . ' <td>'; foreach ($aRow['ipV4List'] as $key => $aDetails) { if (function_exists('ip4_format')) { $key = ip4_format($key); } if (trim($key) != '') { echo $key . '<br/>'; } } foreach ($aRow['ipV6List'] as $key => $aDetails) { if (function_exists('ip6_format')) { $key = ip6_format($key); } else { $key = new IPv6Address($key); } if (trim($key) != '') { echo $key . '<br/>'; } } echo ' </td> <td>' . $aRow['sComment'] . '</td> <td>' . $aRow['sContact'] . '</td> <td>' . $aRow['sOS'] . '</td> <td>'; foreach ($aRow['container'] as $key => $aDetails) { echo '<a href="' . makeHref(array('page' => 'object', 'object_id' => $key)) . '">' . $aDetails['container_name'] . '</a><br/>'; } echo '</td> </tr>'; } echo ' </tbody> </table>'; echo '<script type="text/javascript"> $(document).ready(function() { $.tablesorter.defaults.widgets = ["zebra"]; $("#reportTable").tablesorter( { headers: { 2: { sorter: "ipAddress" } }, sortList: [[0,0]] } ); $("#reportTable").tableFilter(); } ); </script>'; }
function switchportInfoJS($object_id) { $available_ops = array('link' => array('op' => 'get_link_status', 'gw' => 'getportstatus'), 'conf' => array('op' => 'get_port_conf', 'gw' => 'get8021q'), 'mac' => array('op' => 'get_mac_list', 'gw' => 'getmaclist'), 'portmac' => array('op' => 'get_port_mac_list', 'gw' => 'getportmaclist')); $breed = detectDeviceBreed($object_id); $allowed_ops = array(); foreach ($available_ops as $prefix => $data) { if (permitted('object', 'liveports', $data['op']) and validBreedFunction($breed, $data['gw'])) { $allowed_ops[] = $prefix; } } // make JS array with allowed items $list = ''; foreach ($allowed_ops as $item) { $list .= "'" . addslashes($item) . "', "; } $list = trim($list, ", "); addJS('js/jquery.thumbhover.js'); addCSS('css/jquery.contextmenu.css'); addJS('js/jquery.contextmenu.js'); addJS("enabled_elements = [ {$list} ];", TRUE); addJS('js/portinfo.js'); }
function includeJQueryUI($do_css = TRUE) { addJS('js/jquery-ui-1.8.21.min.js'); if ($do_css) { addCSS('css/jquery-ui-1.8.22.redmond.css'); } }
// Currently five racks will be grouped in a row. // // History // Version 0.1: Initial release (Tested on 0.20.4) // 0.2: Removed call of markupObjectProblems(), function was removed in 0.20.5 // 0.3: Add patch for interface for rotated labels in layout style V (for bladecenters) // 0.4: Display rack row from left to right, no wrapping // 0.5: Rearrange files for simpler installation. // 0.6: Do not call deprecated functions. $tab['row']['full_row_view'] = 'Full Row View'; $tabhandler['row']['full_row_view'] = 'FullRowView'; $ophandler['row']['full_row_view']['preparePrint'] = 'preparePrint'; // Set variables $frvVersion = "0.6"; // load a customized stylesheet addCSS('css/full_row_view.css'); function preparePrint() { return showSuccess("Created <a href=\"rowprint.php\">Print preview</a>!"); } // display the import page. function FullRowView() { if (isset($_REQUEST['row_id'])) { $row_id = $_REQUEST['row_id']; } else { $rack_id = 1; } global $frvVersion; $rowData = getRowInfo($row_id); $cellfilter = getCellFilter();
function startElement($parser, $name, $attrs) { setCurrentTag(strtolower($name)); setEmpty(true); // // If we are currently processing a list (<ol> or <ul>), check if the next element is a // block-level element (P, etc.). If so, then we must break out of the list by closing it (</ul> or </ol>) // and start rendering the new element. // if (isInsideList() && $name == "P") { if (isOrderedList()) add2Doc("\n</ol>\n"); // check for ordered lists and preserve if present. else add2Doc("</ul>\n"); setInsideList(false); setDepth(getDepth()-1); } switch($name) { //////////////////////// TEXTFORMAT (some attrs add to <p>) case "TEXTFORMAT": foreach ($attrs as $aname => $avalue) { switch($aname) { case "INDENT": addCSS("margin-left:".strtolower($avalue)."px;"); break; } } break; //////////////////////// PARAGRAPH case "P": add2Doc("\n<p style=\"margin:0;".getCSS()); setDepth(getDepth()+1); foreach ($attrs as $aname => $avalue) { switch($aname) { case "ALIGN": add2Doc("text-align:".strtolower($avalue).";"); break; } } add2Doc("\">"); break; //////////////////////// ANCHORS (LINKS) case "A": add2Doc("<a "); foreach ($attrs as $aname => $avalue) { switch($aname) { case "HREF": add2Doc("href=\"$avalue\" "); break; case "TARGET": add2Doc("target=\"$avalue\" "); break; } } add2Doc(">"); //////////////////////// FONT (converts to <span>) case "FONT": $stylevalue = ""; foreach ($attrs as $aname => $avalue) { switch($aname) { case "FACE": if (getLastFont() != $avalue) $stylevalue .= "font-family:".filterFontNames($avalue).";"; setLastFont($avalue); break; case "SIZE": $avalue = fontSizeToPx($avalue); if (getLastSize() != $avalue) $stylevalue .= "font-size:".$avalue."px;"; setLastSize($avalue); break; case "COLOR": if (getLastColor() != $avalue) $stylevalue .= "color:".strtolower($avalue).";"; setLastColor($avalue); break; } } if ($stylevalue != "") { add2Doc("<span style=\"$stylevalue\">"); setDepth(getDepth()+1); } break; //////////////////////// Bold case "B": add2Doc("<strong>"); setDepth(getDepth()+1); break; //////////////////////// Italic case "I": add2Doc("<em>"); setDepth(getDepth()+1); break; //////////////////////// Italic case "U": add2Doc("<span style=\"text-decoration:underline;\">"); setDepth(getDepth()+1); break; //////////////////////// List Items case "LI": if (!isInsideList()) // check for unwrapped lists from obedit. { add2Doc("\n<ul style=\"margin-top:0;margin-bottom:0;\">\n"); setDepth(getDepth()+1); setInsideList(true); setOrderedList(false); } add2Doc("\t<li>"); setDepth(getDepth()+1); break; case "PARSERDOCUMENT": break; /////////////////////// Abort filtering on unsupported tags default: abortFiltering(); //echo "Aborted filtering on <$name><br />"; break; } }
function renderSwitchReport() { $aResult = array(); $iTotal = 0; $sFilter = '{$typeid_8}'; # typeid_8 = Switches foreach (scanRealmByText('object', $sFilter) as $Result) { $aResult[$Result['id']] = array(); $aResult[$Result['id']]['sName'] = $Result['name']; // Create active links in comment $aResult[$Result['id']]['sComment'] = makeLinksInText($Result['comment']); // Load additional attributes: $attributes = getAttrValues($Result['id']); $aResult[$Result['id']]['sContact'] = ''; if (isset($attributes['14']['a_value'])) { $aResult[$Result['id']]['sContact'] = $attributes['14']['a_value']; } $aResult[$Result['id']]['HWtype'] = ''; if (isset($attributes['2']['a_value'])) { $aResult[$Result['id']]['HWtype'] = $attributes['2']['a_value']; } $aResult[$Result['id']]['OEMSN'] = ''; if (isset($attributes['1']['a_value'])) { $aResult[$Result['id']]['OEMSN'] = $attributes['1']['a_value']; } $aResult[$Result['id']]['HWExpDate'] = ''; if (isset($attributes['22']['value'])) { $aResult[$Result['id']]['HWExpDate'] = date("Y-m-d", $attributes['22']['value']); } $aResult[$Result['id']]['sOSVersion'] = ''; if (isset($attributes['5']['a_value'])) { $aResult[$Result['id']]['sOSVersion'] = $attributes['5']['a_value']; } $aResult[$Result['id']]['sSlotNumber'] = 'unknown'; if (isset($attributes['28']['a_value']) && $attributes['28']['a_value'] != '') { $aResult[$Result['id']]['sSlotNumber'] = $attributes['28']['a_value']; } // Location $aResult[$Result['id']]['sLocation'] = getLocation($Result); $iTotal++; } if (isset($_GET['csv'])) { header('Content-type: text/csv'); header('Content-Disposition: attachment; filename=export_' . date("Ymdhis") . '.csv'); header('Pragma: no-cache'); header('Expires: 0'); $outstream = fopen("php://output", "w"); $aCSVRow = array('Name', 'Comment', 'Contact', 'Type', 'OEM', 'HW Expire Date', 'OS Version', 'Location'); fputcsv($outstream, $aCSVRow); foreach ($aResult as $id => $aRow) { $aCSVRow = array(); $aCSVRow[0] = $aRow['sName']; $aCSVRow[1] = str_replace('"', "'", $aRow['sComment']); $aCSVRow[2] = $aRow['sContact']; $aCSVRow[3] = $aRow['HWtype']; $aCSVRow[4] = $aRow['OEMSN']; $aCSVRow[5] = $aRow['HWExpDate']; $aCSVRow[6] = $aRow['sOSVersion']; $aCSVRow[7] = preg_replace('/<a[^>]*>(.*)<\\/a>/iU', '$1', $aRow['sLocation']); fputcsv($outstream, $aCSVRow); } fclose($outstream); exit(0); # Exit normally after send CSV to browser } // Load stylesheet and jquery scripts addCSS('css/extensions/style.css'); addJS('js/extensions/jquery-latest.js'); addJS('js/extensions/jquery.tablesorter.js'); addJS('js/extensions/picnet.table.filter.min.js'); // Display the stat array echo "<h2>Switch report ({$iTotal})</h2><ul>"; echo '<a href="index.php?page=reports&tab=switches&csv">CSV Export</a>'; echo '<table id="reportTable" class="tablesorter"> <thead> <tr> <th>Name</th> <th>Comment</th> <th>Contact</th> <th>Type</th> <th>OEM S/N</th> <th>HW Expire Date</th> <th>OS Version</th> <th>Location</th> </tr> </thead> <tbody>'; foreach ($aResult as $id => $aRow) { echo '<tr> <td><a href="' . makeHref(array('page' => 'object', 'object_id' => $id)) . '">' . $aRow['sName'] . '</a></td> <td>' . $aRow['sComment'] . '</td> <td>' . $aRow['sContact'] . '</td> <td>' . $aRow['HWtype'] . '</td> <td>' . $aRow['OEMSN'] . '</td> <td>' . $aRow['HWExpDate'] . '</td> <td>' . $aRow['sOSVersion'] . '</td> <td>' . $aRow['sLocation'] . '</td> </tr>'; } echo ' </tbody> </table>'; echo '<script type="text/javascript"> $(document).ready(function() { $.tablesorter.defaults.widgets = ["zebra"]; $("#reportTable").tablesorter( { headers: { }, sortList: [[0,0]] } ); $("#reportTable").tableFilter(); } ); </script>'; }
assets/custom/img/MyLogo.png' sizes="16x16" type="image/png"> <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> <link href='http://fonts.googleapis.com/css?family=Lato:400,100,300,700,900' rel='stylesheet' type='text/css'> <link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,100,300,700' rel='stylesheet' type='text/css'> <?php addCSS("assets/admin/css/bootstrap.min.css"); ?> <?php addCSS("assets/global/plugins/slick/slick.css"); ?> <?php addCSS("assets/global/plugins/slick/slick-theme.css"); ?> <?php addCSS("assets/custom/css/custom.css"); ?> <?php getCSS(); ?> </head> <body> <?php echo $menu; ?> <button class="icon-menu-top-open menu fa fa-bars fa-3"></button> <div id="page-container" > <section class="container-fluid header-container"> <div id="header" class="row"> <div id="img-back-header" class="col-md-12">
function enableTagsPicker() { global $taglist; static $taglist_inserted; includeJQueryUI(); addCSS('css/tagit.css'); addJS('js/tag-it.js'); addJS('js/tag-it-local.js'); if (!$taglist_inserted) { $taglist_filtered = array(); foreach ($taglist as $key => $taginfo) { # remove unused fields $taglist_filtered[$key] = array_sub($taginfo, array("tag", "is_assignable", "trace")); } addJS('var taglist = ' . json_encode($taglist_filtered) . ';', TRUE); $taglist_inserted = TRUE; } }
<?php use Widgets\Hello\Helper; addCSS($widgetBaseURL . '/css/default.css'); addJS($widgetBaseURL . '/js/custom.js'); ?> <div id="Hello"> <?php echo Helper::welcome(); ?> </div>