本文整理汇总了PHP中addJS函数的典型用法代码示例。如果您正苦于以下问题:PHP addJS函数的具体用法?PHP addJS怎么用?PHP addJS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addJS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: allJS
function allJS()
{
$toret = "";
$conf = new Config();
if ($dh = opendir($conf->jsfolder)) {
while (($file = readdir($dh)) !== false) {
if (is_file($conf->jsfolder . '/' . $file) && $file != '.' && $file != '..') {
$toret .= addJS($file);
}
}
closedir($dh);
}
echo $toret;
}
示例2: renderSwitchReport
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>
//.........这里部分代码省略.........
示例3: getPopupSLBConfig
function getPopupSLBConfig($row)
{
$do_vs = isset($row) && isset($row['vsconfig']) && strlen($row['vsconfig']);
$do_rs = isset($row) && isset($row['rsconfig']) && strlen($row['rsconfig']);
if (!$do_vs && !$do_rs) {
return;
}
$ret = '';
$ret .= '<div class="slbconf-btn">…</div>';
$ret .= '<div class="slbconf popup-box">';
if ($do_vs) {
$ret .= '<h1>VS config:</h1>';
$ret .= $row['vsconfig'];
}
if ($do_rs) {
$ret .= '<h1>RS config:</h1>';
$ret .= $row['rsconfig'];
}
$ret .= '</div>';
static $js_added = FALSE;
if (!$js_added) {
addJS('js/jquery.thumbhover.js');
addJS(<<<END
\$(document).ready (function () {
\t\$('.slbconf-btn').each (function () {
\t\t\$(this).thumbPopup(\$(this).siblings('.slbconf.popup-box'), { showFreezeHint: false });
\t});
});
END
, TRUE);
}
return $ret;
}
示例4: FingTab
//.........这里部分代码省略.........
$cnt_mismatch++;
}
}
//IP
echo "><td class='tdleft";
if (isset($range['addrlist'][$ip_bin]['class']) and strlen($range['addrlist'][$ip_bin]['class'])) {
echo ' ' . $range['addrlist'][$ip_bin]['class'];
}
echo "'><a href='" . makeHref(array('page' => 'ipaddress', 'ip' => $straddr)) . "'>{$straddr}</a></td>";
//other columns
if ($skip_dns_check) {
echo "<td class='tdleft'> </td>";
} else {
if (!$ip_is_up) {
echo "<td class='tdleft'>" . $fing_state . "</td>";
} else {
echo "<td class='tdleft'><div class='strong'>" . $fing_state . "</div></td>";
}
}
echo "<td class=tdleft>{$addr['name']}</td>";
echo "<td class='tdleft'>" . $fing_hostname . "</td>";
echo "<td class='tdleft'>" . $fing_mac_vendor . "</td>";
//allocation
echo "<td>";
$delim = '';
if ($addr['reserved'] == 'yes') {
echo "<strong>RESERVED</strong> ";
$delim = '; ';
}
foreach ($addr['allocs'] as $ref) {
echo $delim . $aac_left[$ref['type']];
echo makeIPAllocLink($ip_bin, $ref, TRUE);
$delim = '; ';
}
if ($delim != '') {
$delim = '<br>';
}
foreach ($addr['vslist'] as $vs_id) {
$vs = spotEntity('ipv4vs', $vs_id);
echo $delim . mkA("{$vs['name']}:{$vs['vport']}/{$vs['proto']}", 'ipv4vs', $vs['id']) . '→';
$delim = '<br>';
}
foreach ($addr['vsglist'] as $vs_id) {
$vs = spotEntity('ipvs', $vs_id);
echo $delim . mkA($vs['name'], 'ipvs', $vs['id']) . '→';
$delim = '<br>';
}
foreach ($addr['rsplist'] as $rsp_id) {
$rsp = spotEntity('ipv4rspool', $rsp_id);
echo "{$delim}→" . mkA($rsp['name'], 'ipv4rspool', $rsp['id']);
$delim = '<br>';
}
echo "</td>";
// import column
if ($can_import) {
echo '<td>';
if ($print_cbox) {
echo "<input type=checkbox name=import_{$cnt_total} id=atom_1_" . $box_counter++ . "_1>";
} else {
echo ' ';
}
echo '</td>';
}
echo "</tr>";
}
if ($can_import && $box_counter > 1) {
echo '<tr><td colspan=4 align=center><input type=submit value="Import selected records"></td><td colspan=2 align=right>';
addJS('js/racktables.js');
echo --$box_counter ? "<a href='javascript:;' onclick=\"toggleColumnOfAtoms(1, 1, {$box_counter})\">(toggle selection)</a>" : ' ';
echo '</td></tr>';
}
echo "</table>";
if ($can_import) {
echo '</form>';
}
finishPortlet();
echo "</td><td class=pcright>";
//
// PING Statistics
//
startPortlet('ping stats');
$cnt_ping_up = get_fing_up_count($known_ips);
echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>";
echo "<tr class=trok><th class=tdright>Replied to Ping</th><td class=tdleft>{$cnt_ping_up}</td></tr>\n";
echo "<tr class=trwarning><th class=tdright>No Response</th><td class=tdleft>" . ($cnt_total - $cnt_ping_up) . "</td></tr>\n";
echo "</table>\n";
finishPortlet();
//
// DNS Statistics
//
startPortlet('dns stats');
echo "<table border=0 width='100%' cellspacing=0 cellpadding=2>";
echo "<tr class=trok><th class=tdright>Exact matches:</th><td class=tdleft>{$cnt_match}</td></tr>\n";
echo "<tr class=trwarning><th class=tdright>Missing from DB/DNS:</th><td class=tdleft>{$cnt_missing}</td></tr>\n";
if ($cnt_mismatch) {
echo "<tr class=trerror><th class=tdright>Mismatches:</th><td class=tdleft>{$cnt_mismatch}</td></tr>\n";
}
echo "</table>\n";
finishPortlet();
}
示例5: handlePopupPortLink
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) . ' ';
//.........这里部分代码省略.........
示例6: switchportInfoJS
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');
}
示例7: renderVMReport
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>
//.........这里部分代码省略.........
示例8: snmplive_tabhandler
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";
//.........这里部分代码省略.........
示例9: renderCustomReport
//.........这里部分代码省略.........
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 . '
示例10: addJS
?>
/assets/custom/img/me.jpg" alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>Lorem ipsum In in ullamco Duis.</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</body>
<?php
addJS("assets/admin/plugins/jQuery/jQuery-2.1.3.min.js");
addJS("assets/admin/plugins/slimScroll/jquery.slimscroll.min.js");
addJS("assets/admin/plugins/niceScroll/jquery.nicescroll.min.js");
addJS("assets/admin/js/bootstrap.min.js");
addJS("assets/global/plugins/onepage-scroll/jquery.onepage-scroll.js");
addJS("assets/global/plugins/slick/slick.js");
addJS("assets/global/plugins/lazy-line-painter-master/jquery.lazylinepainter-1.7.0.min.js");
addJS("assets/custom/js/custom.js");
?>
<?php
getJS();
?>
</html>
示例11: includeJQueryUI
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');
}
}
示例12: linkmgmt_tabhandler
function linkmgmt_tabhandler($object_id)
{
global $lm_cache;
$target = makeHrefProcess(portlist::urlparams('op', 'update'));
addJS('js/jquery.jeditable.mini.js');
/* TODO if (permitted (NULL, 'ports', 'set_reserve_comment')) */
/* TODO Link / unlink permissions */
$lm_cache['allowcomment'] = permitted(NULL, NULL, 'set_reserve_comment');
/* RackCode {$op_set_reserve_comment} */
$lm_cache['allowlink'] = permitted(NULL, NULL, 'set_link');
/* RackCode {$op_set_link} */
$lm_cache['allowbacklink'] = permitted(NULL, NULL, 'set_backlink');
/* RackCode {$op_set_backlink} */
//portlist::var_dump_html($lm_cache);
/* init jeditable fields/tags */
if ($lm_cache['allowcomment']) {
addJS('$(document).ready(function() { $(".editcmt").editable("' . $target . '",{placeholder : "add comment"}); });', TRUE);
}
if ($lm_cache['allowlink']) {
addJS('$(document).ready(function() { $(".editcable").editable("' . $target . '",{placeholder : "edit cableID"}); });', TRUE);
}
/* linkmgmt for current object */
linkmgmt_renderObjectLinks($object_id);
/* linkmgmt for every child */
//$parents = getEntityRelatives ('parents', 'object', $object_id);
$children = getEntityRelatives('children', 'object', $object_id);
//'entity_id'
foreach ($children as $child) {
$childobj = spotEntity($child['entity_type'], $child['entity_id']);
echo '<h1>Links for Child: ' . $childobj['name'] . '</h1>';
linkmgmt_renderObjectLinks($child['entity_id']);
unset($childobj);
}
return;
}
示例13: renderCopyEntityTags
function renderCopyEntityTags($entity_id)
{
global $tagtree, $taglist, $target_given_tags, $pageno, $etype_by_pageno;
echo '<table border=0 width="10%"><tr>';
if (count($taglist) > getConfigVar('TAGS_QUICKLIST_THRESHOLD')) {
$minilist = getTagChart(getConfigVar('TAGS_QUICKLIST_SIZE'), $etype_by_pageno[$pageno], $target_given_tags);
// It could happen, that none of existing tags have been used in the current realm.
if (count($minilist)) {
$js_code = "tag_cb.setTagShortList ({";
$is_first = TRUE;
foreach ($minilist as $tag) {
if (!$is_first) {
$js_code .= ",";
}
$is_first = FALSE;
$js_code .= "\n\t{$tag['id']} : 1";
}
$js_code .= "\n});\n\$(document).ready(tag_cb.compactTreeMode);";
addJS('js/tag-cb.js');
addJS($js_code, TRUE);
}
}
// do not do anything about empty tree, trigger function ought to work this out
echo '<td class=pcright>';
renderCopyEntityTagsPortlet('', $tagtree, $target_given_tags, $etype_by_pageno[$pageno]);
echo '</td>';
echo '</tr></table>';
}
示例14: renderTagTreeEditor
function renderTagTreeEditor()
{
addJS(<<<END
function tageditor_showselectbox(e) {
\t\$(this).load('index.php', {module: 'ajax', ac: 'get-tag-select', tagid: this.id});
\t\$(this).unbind('mousedown', tageditor_showselectbox);
}
\$(document).ready(function () {
\t\$('select.taglist-popup').bind('mousedown', tageditor_showselectbox);
});
END
, TRUE);
function printNewItemTR($options)
{
global $taglist;
printOpFormIntro('createTag');
echo '<tr>';
echo '<td align=left style="padding-left: 16px;">' . getImageHREF('create', 'Create tag', TRUE) . '</td>';
echo '<td><input type=text size=48 name=tag_name></td>';
echo '<td class=tdleft>' . getSelect(array('yes' => 'yes', 'no' => 'no'), array('name' => 'is_assignable'), 'yes') . '</td>';
echo '<td>' . getSelect($options, array('name' => 'parent_id')) . '</td>';
echo '<td>' . getImageHREF('create', 'Create tag', TRUE, 120) . '</td>';
echo '</tr></form>';
}
global $taglist;
$options = array(0 => '-- NONE --');
foreach ($taglist as $taginfo) {
$options[$taginfo['id']] = htmlspecialchars($taginfo['tag']);
}
$otags = getOrphanedTags();
if (count($otags)) {
startPortlet('fallen leaves');
echo "<table cellspacing=0 cellpadding=5 align=center class=widetable>\n";
echo '<tr class=trerror><th>tag name</th><th>parent tag</th><th> </th></tr>';
foreach ($otags as $taginfo) {
printOpFormIntro('updateTag', array('tag_id' => $taginfo['id'], 'tag_name' => $taginfo['tag']));
echo "<input type=hidden name=is_assignable value={$taginfo['is_assignable']}>";
echo '<tr>';
echo '<td>' . $taginfo['tag'] . '</td>';
echo '<td>' . getSelect($options, array('name' => 'parent_id'), $taglist[$taginfo['id']]['parent_id']) . '</td>';
echo '<td>' . getImageHREF('save', 'Save changes', TRUE) . '</td>';
echo '</tr></form>';
}
echo '</table>';
finishPortlet();
}
startPortlet('tag tree');
echo "<table cellspacing=0 cellpadding=5 align=center class=widetable>\n";
echo '<tr><th> </th><th>tag name</th><th>assignable</th><th>parent tag</th><th> </th></tr>';
if (getConfigVar('ADDNEW_AT_TOP') == 'yes') {
printNewItemTR($options);
}
foreach (getTagTree() as $taginfo) {
renderTagRowForEditor($taginfo);
}
if (getConfigVar('ADDNEW_AT_TOP') != 'yes') {
printNewItemTR($options);
}
echo '</table>';
finishPortlet();
}
示例15: snmpgeneric_list
function snmpgeneric_list($object_id)
{
global $sg_create_noconnector_ports, $sg_known_sysObjectIDs, $sg_portoifoptions, $sg_ifType_ignore;
if (isset($_POST['snmpconfig'])) {
$snmpconfig = $_POST;
} else {
showError("Missing SNMP Config");
return;
}
// sg_var_dump_html($snmpconfig);
echo '<body onload="document.getElementById(\'createbutton\').focus();">';
addJS('function setchecked(classname) { var boxes = document.getElementsByClassName(classname);
var value = document.getElementById(classname).checked;
for(i=0;i<boxes.length;i++) {
if(boxes[i].disabled == false)
boxes[i].checked=value;
}
};', TRUE);
$object = spotEntity('object', $object_id);
$object['attr'] = getAttrValues($object_id);
$snmpdev = new mySNMP($snmpconfig['version'], $snmpconfig['host'], $snmpconfig['community']);
if ($snmpconfig['version'] == "v3") {
$snmpdev->setSecurity($snmpconfig['sec_level'], $snmpconfig['auth_protocol'], $snmpconfig['auth_passphrase'], $snmpconfig['priv_protocol'], $snmpconfig['priv_passphrase']);
}
$snmpdev->init();
if ($snmpdev->getErrno()) {
showError($snmpdev->getError());
return;
}
/* SNMP connect successfull */
showSuccess("SNMP " . $snmpconfig['version'] . " connect to {$snmpconfig['host']} successfull");
echo '<form name=CreatePorts method=post action=' . $_SERVER['REQUEST_URI'] . '&module=redirect&op=create>';
echo "<strong>System Informations</strong>";
echo "<table>";
// echo "<tr><th>OID</th><th>Value</th></tr>";
$systemoids = array('sysDescr', 'sysObjectID', 'sysUpTime', 'sysContact', 'sysName', 'sysLocation');
foreach ($systemoids as $shortoid) {
$value = $snmpdev->{$shortoid};
if ($shortoid == 'sysUpTime') {
/* in hundredths of a second */
$secs = (int) ($value / 100);
$days = (int) ($secs / (60 * 60 * 24));
$secs -= $days * 60 * 60 * 24;
$hours = (int) ($secs / (60 * 60));
$secs -= $hours * 60 * 60;
$mins = (int) ($secs / 60);
$secs -= $mins * 60;
$value = "{$value} ({$days} {$hours}:{$mins}:{$secs})";
}
echo "<tr><td title=\"" . $snmpdev->lastgetoid . "\" align=\"right\">{$shortoid}: </td><td>{$value}</td></tr>";
}
unset($shortoid);
echo "</table>";
/* sysObjectID Attributes and Ports */
$sysObjectID['object'] =& $object;
/* get sysObjectID */
$sysObjectID['raw_value'] = $snmpdev->sysObjectID;
//$sysObjectID['raw_value'] = 'NET-SNMP-MIB::netSnmpAgentOIDs.10';
$sysObjectID['value'] = preg_replace('/^.*enterprises\\.([\\.[:digit:]]+)$/', '\\1', $sysObjectID['raw_value']);
/* try snmptranslate to numeric */
if (preg_match('/[^\\.0-9]+/', $sysObjectID['value'])) {
$numeric_value = $snmpdev->translatetonumeric($sysObjectID['value']);
if (!empty($numeric_value)) {
showSuccess("sysObjectID: " . $sysObjectID['value'] . " translated to {$numeric_value}");
$sysObjectID['value'] = preg_replace('/^.1.3.6.1.4.1.([\\.[:digit:]]+)$/', '\\1', $numeric_value);
}
}
/* array_merge doesn't work with numeric keys !! */
$sysObjectID['attr'] = array();
$sysObjectID['port'] = array();
$sysobjid = $sysObjectID['value'];
$count = 1;
while ($count) {
if (isset($sg_known_sysObjectIDs[$sysobjid])) {
$sysObjectID = $sysObjectID + $sg_known_sysObjectIDs[$sysobjid];
if (isset($sg_known_sysObjectIDs[$sysobjid]['attr'])) {
$sysObjectID['attr'] = $sysObjectID['attr'] + $sg_known_sysObjectIDs[$sysobjid]['attr'];
}
if (isset($sg_known_sysObjectIDs[$sysobjid]['port'])) {
$sysObjectID['port'] = $sysObjectID['port'] + $sg_known_sysObjectIDs[$sysobjid]['port'];
}
if (isset($sg_known_sysObjectIDs[$sysobjid]['text'])) {
showSuccess("found sysObjectID ({$sysobjid}) " . $sg_known_sysObjectIDs[$sysobjid]['text']);
}
}
$sysobjid = preg_replace('/\\.[[:digit:]]+$/', '', $sysobjid, 1, $count);
/* add default sysobjectid */
if ($count == 0 && $sysobjid != 'default') {
$sysobjid = 'default';
$count = 1;
}
}
$sysObjectID['vendor_number'] = $sysobjid;
/* device pf */
if (isset($sysObjectID['pf'])) {
foreach ($sysObjectID['pf'] as $function) {
if (function_exists($function)) {
/* call device pf */
$function($snmpdev, $sysObjectID, NULL);
} else {
//.........这里部分代码省略.........