function renderPortsForObject($object_id) { $prefs = getPortListPrefs(); function printNewItemTR($prefs) { printOpFormIntro('addPort'); echo "<tr><td>"; printImageHREF('add', 'add a port', TRUE); echo "</td><td class='tdleft'><input type=text size=8 name=port_name tabindex=100></td>\n"; echo "<td><input type=text name=port_label tabindex=101></td><td>"; printNiftySelect(getNewPortTypeOptions(), array('name' => 'port_type_id', 'tabindex' => 102), $prefs['selected']); echo "<td><input type=text name=port_l2address tabindex=103 size=18 maxlength=24></td>\n"; echo "<td colspan=4> </td><td>"; printImageHREF('add', 'add a port', TRUE, 104); echo "</td></tr></form>"; } if (getConfigVar('ENABLE_MULTIPORT_FORM') == 'yes' || getConfigVar('ENABLE_BULKPORT_FORM') == 'yes') { startPortlet('Ports and interfaces'); } else { echo '<br>'; } $object = spotEntity('object', $object_id); amplifyCell($object); if (getConfigVar('ADDNEW_AT_TOP') == 'yes' && getConfigVar('ENABLE_BULKPORT_FORM') == 'yes') { echo "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>\n"; echo "<tr><th> </th><th class=tdleft>Local name</th><th class=tdleft>Visible label</th><th class=tdleft>Interface</th><th class=tdleft>Start Number</th>"; echo "<th class=tdleft>Count</th><th> </th></tr>\n"; printOpFormIntro('addBulkPorts'); echo "<tr><td>"; printImageHREF('add', 'add ports', TRUE); echo "</td><td><input type=text size=8 name=port_name tabindex=105></td>\n"; echo "<td><input type=text name=port_label tabindex=106></td><td>"; printNiftySelect(getNewPortTypeOptions(), array('name' => 'port_type_id', 'tabindex' => 107), $prefs['selected']); echo "<td><input type=text name=port_numbering_start tabindex=108 size=3 maxlength=3></td>\n"; echo "<td><input type=text name=port_numbering_count tabindex=109 size=3 maxlength=3></td>\n"; echo "<td> </td><td>"; printImageHREF('add', 'add ports', TRUE, 110); echo "</td></tr></form>"; echo "</table><br>\n"; } echo "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>\n"; echo "<tr><th> </th><th class=tdleft>Local name</th><th class=tdleft>Visible label</th><th class=tdleft>Interface</th><th class=tdleft>L2 address</th>"; echo "<th class=tdcenter colspan=2>Remote object and port</th><th>Cable ID</th><th class=tdcenter>(Un)link or (un)reserve</th><th> </th></tr>\n"; if (getConfigVar('ADDNEW_AT_TOP') == 'yes') { printNewItemTR($prefs); } // clear ports link echo getOpLink(array('op' => 'deleteAll'), 'Clear port list', 'clear', '', 'need-confirmation'); // rename ports link $n_ports_to_rename = 0; foreach ($object['ports'] as $port) { if ($port['name'] != shortenPortName($port['name'], $object['id'])) { $n_ports_to_rename++; } } if ($n_ports_to_rename) { echo '<p>' . getOpLink(array('op' => 'renameAll'), "Auto-rename {$n_ports_to_rename} ports", 'recalc', 'Use RackTables naming convention for this device type') . '</p>'; } if (isset($_REQUEST['hl_port_id'])) { assertUIntArg('hl_port_id'); $hl_port_id = intval($_REQUEST['hl_port_id']); addAutoScrollScript("port-{$hl_port_id}"); } switchportInfoJS($object_id); // load JS code to make portnames interactive foreach ($object['ports'] as $port) { // highlight port name with yellow if it's name is not canonical $canon_pn = shortenPortName($port['name'], $port['object_id']); $name_class = $canon_pn == $port['name'] ? '' : 'trwarning'; $tr_class = isset($hl_port_id) && $hl_port_id == $port['id'] ? 'class="highlight"' : ''; printOpFormIntro('editPort', array('port_id' => $port['id'])); echo "<tr {$tr_class}><td><a name='port-{$port['id']}' href='" . makeHrefProcess(array('op' => 'delPort', 'port_id' => $port['id'])) . "'>"; printImageHREF('delete', 'Unlink and Delete this port'); echo "</a></td>\n"; $a_class = isEthernetPort($port) ? 'port-menu' : ''; echo "<td class='tdleft {$name_class}' NOWRAP><input type=text name=name class='interactive-portname {$a_class}' value='{$port['name']}' size=8></td>"; echo "<td><input type=text name=label value='{$port['label']}'></td>"; echo '<td>'; if ($port['iif_id'] != 1) { echo '<label>' . $port['iif_name'] . ' '; } printSelect(getExistingPortTypeOptions($port['id']), array('name' => 'port_type_id'), $port['oif_id']); if ($port['iif_id'] != 1) { echo '</label>'; } echo '</td>'; // 18 is enough to fit 6-byte MAC address in its longest form, // while 24 should be Ok for WWN echo "<td><input type=text name=l2address value='{$port['l2address']}' size=18 maxlength=24></td>\n"; if ($port['remote_object_id']) { echo "<td>" . formatLoggedSpan($port['last_log'], formatPortLink($port['remote_object_id'], $port['remote_object_name'], $port['remote_id'], NULL)) . "</td>"; echo "<td> " . formatLoggedSpan($port['last_log'], $port['remote_name'], 'underline') . "<input type=hidden name=reservation_comment value=''></td>"; echo "<td><input type=text name=cable value='{$port['cableid']}'></td>"; echo "<td class=tdcenter>"; echo getOpLink(array('op' => 'unlinkPort', 'port_id' => $port['id']), '', 'cut', 'Unlink this port'); echo "</td>"; } elseif (strlen($port['reservation_comment'])) { echo "<td>" . formatLoggedSpan($port['last_log'], 'Reserved:', 'strong underline') . "</td>"; echo "<td><input type=text name=reservation_comment value='{$port['reservation_comment']}'></td>"; echo "<td></td>"; echo "<td class=tdcenter>"; echo getOpLink(array('op' => 'useup', 'port_id' => $port['id']), '', 'clear', 'Use up this port'); echo "</td>"; } else { $in_rack = getConfigVar('NEAREST_RACKS_CHECKBOX'); echo "<td> </td><td> </td><td> </td><td class=tdcenter><span"; $helper_args = array('port' => $port['id'], 'in_rack' => $in_rack == "yes" ? "on" : ""); $popup_args = 'height=700, width=400, location=no, menubar=no, ' . 'resizable=yes, scrollbars=yes, status=no, titlebar=no, toolbar=no'; echo " ondblclick='window.open(\"" . makeHrefForHelper('portlist', $helper_args); echo "\",\"findlink\",\"{$popup_args}\");'"; // end of onclick= echo " onclick='window.open(\"" . makeHrefForHelper('portlist', $helper_args); echo "\",\"findlink\",\"{$popup_args}\");'"; // end of onclick= echo '>'; // end of <a> printImageHREF('plug', 'Link this port'); echo "</span>"; echo " <input type=text name=reservation_comment></td>\n"; } echo "<td>"; printImageHREF('save', 'Save changes', TRUE); echo "</td></form></tr>\n"; } if (getConfigVar('ADDNEW_AT_TOP') != 'yes') { printNewItemTR($prefs); } echo "</table><br>\n"; if (getConfigVar('ADDNEW_AT_TOP') != 'yes' && getConfigVar('ENABLE_BULKPORT_FORM') == 'yes') { echo "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>\n"; echo "<tr><th> </th><th class=tdleft>Local name</th><th class=tdleft>Visible label</th><th class=tdleft>Interface</th><th class=tdleft>Start Number</th>"; echo "<th class=tdleft>Count</th><th> </th></tr>\n"; printOpFormIntro('addBulkPorts'); echo "<tr><td>"; printImageHREF('add', 'add ports', TRUE); echo "</td><td><input type=text size=8 name=port_name tabindex=105></td>\n"; echo "<td><input type=text name=port_label tabindex=106></td><td>"; printNiftySelect(getNewPortTypeOptions(), array('name' => 'port_type_id', 'tabindex' => 107), $prefs['selected']); echo "<td><input type=text name=port_numbering_start tabindex=108 size=3 maxlength=3></td>\n"; echo "<td><input type=text name=port_numbering_count tabindex=109 size=3 maxlength=3></td>\n"; echo "<td> </td><td>"; printImageHREF('add', 'add ports', TRUE, 110); echo "</td></tr></form>"; echo "</table><br>\n"; } if (getConfigVar('ENABLE_MULTIPORT_FORM') == 'yes') { finishPortlet(); } if (getConfigVar('ENABLE_MULTIPORT_FORM') != 'yes') { return; } startPortlet('Add/update multiple ports'); printOpFormIntro('addMultiPorts'); echo 'Format: <select name=format tabindex=201>'; echo '<option value=c3600asy>Cisco 3600 async: sh line | inc TTY</option>'; echo '<option value=fiwg selected>Foundry ServerIron/FastIron WorkGroup/Edge: sh int br</option>'; echo '<option value=fisxii>Foundry FastIron SuperX/II4000: sh int br</option>'; echo '<option value=ssv1>SSV:<interface name> <MAC address></option>'; echo "</select>"; echo 'Default port type: '; printNiftySelect(getNewPortTypeOptions(), array('name' => 'port_type', 'tabindex' => 202), $prefs['selected']); echo "<input type=submit value='Parse output' tabindex=204><br>\n"; echo "<textarea name=input cols=100 rows=50 tabindex=203></textarea><br>\n"; echo '</form>'; finishPortlet(); }
function getOpLink($params, $title, $img_name = '', $comment = '', $class = '') { if (isset($params)) { $ret = '<a href="' . makeHrefProcess($params) . '"'; } else { $ret = '<a href="#" onclick="return false;"'; $class .= ' noclick'; } if (!empty($comment)) { $ret .= ' title="' . htmlspecialchars($comment, ENT_QUOTES) . '"'; } $class = trim($class); if (!empty($class)) { $ret .= ' class="' . htmlspecialchars($class, ENT_QUOTES) . '"'; } $ret .= '>'; if (!empty($img_name)) { $ret .= getImageHREF($img_name, $comment); if (!empty($title)) { $ret .= ' '; } } if (FALSE !== strpos($class, 'need-confirmation')) { addJS('js/racktables.js'); } $ret .= $title . '</a>'; return $ret; }
function renderEditUCSForm() { startPortlet('UCS Actions'); printOpFormIntro('autoPopulateUCS'); echo '<table cellspacing=0 cellpadding=5 align=center class=widetable>'; echo "<tr><th class=tdright><label for=ucs_login>Login:</label></th>"; echo "<td class=tdleft colspan=2><input type=text name=ucs_login id=ucs_login></td></tr>\n"; echo "<tr><th class=tdright><label for=ucs_password>Password:</label></th>"; echo "<td class=tdleft colspan=2><input type=password name=ucs_password id=ucs_password></td></tr>\n"; echo "<tr><th colspan=3><input type=checkbox name=use_terminal_settings id=use_terminal_settings>"; echo "<label for=use_terminal_settings>Use Credentials from terminal_settings()</label></th></tr>\n"; echo "<tr><th class=tdright>Actions:</th><td class=tdleft>"; printImageHREF('DQUEUE sync_ready', 'Auto-populate UCS', TRUE); echo '</td><td class=tdright>'; echo "<a href='" . makeHrefProcess(array('op' => 'cleanupUCS', 'object_id' => getBypassValue())) . "' onclick=\"javascript:return confirm('Are you sure you want to cleanup UCS Domain?')\">" . getImageHREF('CLEAR', 'Clean-up UCS domain') . "</a>"; echo "</td></tr></table></form>\n"; finishPortlet(); }
function localfunc_PortLinker() { global $localSplit, $remoteSplit; startPortlet("Port linker"); print "<center>"; $errorText = determine_PortLinker(); $object = spotEntity('object', $_REQUEST['object_id']); if (strlen($errorText) > 0) { print "Trying to link this object to : {$object['label']}<br><br>\n"; print $errorText; } else { echo "<a href='" . makeHrefProcess(array('op' => 'linknow', 'page' => 'object', 'tab' => 'default', 'object_id' => $_REQUEST['object_id'])) . "'>Connect the following ports now:</a><p>\n"; print "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>"; print "<tr><th>Object name</th><th>Port name</th><th> </th><th>Remote object name</th><th>Remote port name</th></tr>\n"; foreach ($localSplit as $aKey => $aValue) { $numAdd = $remoteSplit[$aKey][$object['name']]['start'] - $aValue['start']; foreach ($aValue['ports'] as $aPortNum => $aPort) { print "<tr><td>{$object['name']}</td><td>{$aPort['name']}</td><td> </td><td>{$aKey}</td><td>"; print $aValue['remote_ports'][$aPortNum + $numAdd]['name'] . "</td></tr>\n"; } } print "</table>"; } print "</center>"; finishPortlet(); }
function renderRSPoolServerForm($pool_id) { global $nextorder; $poolInfo = spotEntity('ipv4rspool', $pool_id); if ($poolInfo['rscount']) { startPortlet("Manage RS list ({$poolInfo['rscount']})"); echo "<table cellspacing=0 cellpadding=5 align=center class=cooltable>\n"; echo "<tr><th> </th><th>Address</th><th>Port</th><th>Comment</th><th>in service</th><th>configuration</th><th> </th></tr>\n"; // new RS form printOpFormIntro('addRS'); echo "<tr class=row_odd valign=top><td>"; printImageHREF('add', 'Add new real server'); echo "</td><td><input type=text name=rsip></td>"; $default_port = getConfigVar('DEFAULT_SLB_RS_PORT'); if ($default_port == 0) { $default_port = ''; } echo "<td><input type=text name=rsport size=5 value='{$default_port}'></td>"; echo "<td><input type=text name=comment size=15></td>"; $checked = getConfigVar('DEFAULT_IPV4_RS_INSERVICE') == 'yes' ? 'checked' : ''; echo "<td><input type=checkbox name=inservice {$checked}></td>"; echo "<td><textarea name=rsconfig></textarea></td><td>"; printImageHREF('ADD', 'Add new real server', TRUE); echo "</td></tr></form>\n"; $order = 'even'; foreach (getRSListInPool($pool_id) as $rsid => $rs) { printOpFormIntro('updRS', array('rs_id' => $rsid)); echo "<tr valign=top class=row_{$order}><td><a href='" . makeHrefProcess(array('op' => 'delRS', 'pool_id' => $pool_id, 'id' => $rsid)) . "'>"; printImageHREF('delete', 'Delete this real server'); echo "</td><td><input type=text name=rsip value='{$rs['rsip']}'></td>"; echo "<td><input type=text name=rsport size=5 value='{$rs['rsport']}'></td>"; echo "<td><input type=text name=comment size=15 value='{$rs['comment']}'></td>"; $checked = $rs['inservice'] == 'yes' ? 'checked' : ''; echo "<td><input type=checkbox name=inservice {$checked}></td>"; echo "<td><textarea name=rsconfig>{$rs['rsconfig']}</textarea></td><td>"; printImageHREF('SAVE', 'Save changes', TRUE); echo "</td></tr></form>\n"; $order = $nextorder[$order]; } echo "</table>\n"; finishPortlet(); } startPortlet('Add many'); printOpFormIntro('addMany'); echo "<table border=0 align=center>\n<tr><td>"; if (getConfigVar('DEFAULT_IPV4_RS_INSERVICE') == 'yes') { printImageHREF('inservice', 'in service'); } else { printImageHREF('notinservice', 'NOT in service'); } echo "</td><td>Format: "; $formats = callHook('getBulkRealsFormats'); printSelect($formats, array('name' => 'format')); echo "</td><td><input type=submit value=Parse></td></tr>\n"; echo "<tr><td colspan=3><textarea name=rawtext cols=100 rows=25></textarea></td></tr>\n"; echo "</table>\n"; finishPortlet(); }
function renderNetworkEditAttrs() { global $pageno, $netobject_type_id; $network = spotEntity($pageno === 'ipv4net' ? 'ipv4net' : 'ipv6net', getBypassValue()); $values = getAttrValuesForNetwork($network); echo '<p>'; startPortlet("Attributes"); printOpFormIntro('updateAttrs'); // optional attributes echo '<table border=0 cellspacing=0 cellpadding=3 align=center>'; $suggest_records = array(); if (count($values) > 0) { $i = 0; foreach ($values as $record) { if (!permitted(NULL, NULL, NULL, array(array('tag' => '$attr_' . $record['id']), array('tag' => '$any_op')))) { continue; } echo "<input type=hidden name={$i}_attr_id value={$record['id']}>"; echo '<tr><td>'; if (strlen($record['value'])) { echo "<a href='" . makeHrefProcess(array('op' => 'clearSticker', 'id' => $network['id'], 'attr_id' => $record['id'])) . "'>"; printImageHREF('clear', 'Clear value'); echo '</a>'; } else { echo ' '; } echo '</td>'; echo "<th class=sticker>{$record['name']}:</th><td class=tdleft>"; switch ($record['type']) { case 'uint': case 'float': case 'string': echo "<input type=text name={$i}_value value='{$record['value']}'>"; break; case 'dict': $suggest_records = array(); $chapter = readChapter($record['chapter_id'], 'o'); foreach ($chapter as $id => $value) { $suggest_records[$id] = array("id" => $id, "tag" => $value); } printSuggestedInput($i . "_value", $suggest_records, array("id" => $record['key']), "macros"); enableTagsPicker(); break; case 'date': $date_value = $record['value'] ? date(getConfigVar('DATETIME_FORMAT'), $record['value']) : ''; echo "<input type=text name={$i}_value value='{$date_value}'>"; break; } $i++; echo '<input type=hidden name=num_attrs value=' . $i . ">\n"; } } echo '</table>'; printImageHREF('SAVE', 'Save changes', TRUE); echo '</form>'; finishPortlet(); }
function _printUnLinkPort($src_port_id, &$dst_link, $linktype) { global $lm_cache; if ($linktype == 'front' && !$lm_cache['allowlink']) { return; } if ($linktype != 'front' && !$lm_cache['allowbacklink']) { return; } $src_port = $this->list[$src_port_id]; $dst_port = $this->list[$dst_link['id']]; /* use RT unlink for front link, linkmgmt unlink for back links */ if ($linktype == 'back') { $tab = 'linkmgmt'; } else { $tab = 'ports'; } return '<a href=' . makeHrefProcess(array('op' => 'unlinkPort', 'port_id' => $src_port_id, 'remote_id' => $dst_port['id'], 'object_id' => $this->object_id, 'tab' => $tab, 'linktype' => $linktype)) . ' onclick="return confirm(\'unlink ports ' . $src_port['name'] . ' -> ' . $dst_port['name'] . ' (' . $linktype . ') with cable ID: ' . $dst_link['cable'] . '?\');">' . getImageHREF('cut', $linktype . ' Unlink this port') . '</a>'; }
function renderNodePingChecks($object_id) { $accounts = getNodePingAccounts(); $account_options = array(); foreach ($accounts as $account) { $account_options[$account['id']] = $account['name']; } startPortlet('Add new check'); echo "<table cellspacing=0 cellpadding=5 align='center'>\n"; echo "<tr><th> </th><th>Account</th><th>Check ID</th><th></th><th> </th></tr>\n"; printOpFormIntro('add'); echo '<tr><td>'; printImageHREF('add', 'add check', TRUE); echo '</td><td>' . getSelect($account_options, array('name' => 'account_id')); echo '</td><td><input type=text size=25 name=np_check_id tabindex=101></td><td>'; printImageHREF('add', 'add check', TRUE); echo "</td></tr></form></table>\n"; finishPortlet(); $checks = getUnlinkedNodePingChecks($object_id); if (count($checks) > 0) { $check_options = array(); foreach ($checks as $check) { $check_options[$check['id']] = sprintf("%s - %s", $check['label'], $check['type']); } startPortlet('Link existing check (' . count($checks) . ')'); echo "<table cellspacing=0 cellpadding=5 align='center'>\n"; printOpFormIntro('link'); echo '<tr><td>' . getSelect($check_options, array('name' => 'check_id')); echo '</td><td class=tdleft>'; printImageHREF('ATTACH', 'Link check', TRUE); echo "</td></tr></form></table>\n"; finishPortlet(); } addJs(<<<END function toggleVisibility(tbodyId) { \t\$("#" + tbodyId).toggle(); } END , TRUE); $checks = getNodePingChecks($object_id); startPortlet('NodePing checks (' . count($checks) . ')'); if (count($checks)) { echo "<table cellspacing=0 cellpadding=5 align=center class=widetable>\n"; echo "<tr><th> </th><th>Type</th><th>Label</th><th>Interval</th><th>Reason</th><th>Result</th><th>Unlink</th><th> </th></tr>\n"; $token = ''; foreach ($checks as $check) { printOpFormIntro('upd', array('check_id' => $check['check_id'])); echo '<tr><td><a href="' . makeHrefProcess(array('op' => 'del', 'check_id' => $check['check_id'])) . '">'; echo getImageHREF('delete', 'Unlink and delete this check') . '</a></td>'; echo "<td><a href=\"#\" onclick=\"toggleVisibility('{$check['check_id']}');\">{$check['type']}</a></td>"; echo "<td>{$check['label']}</td>"; echo "<td>{$check['check_interval']}</td>"; // re-use a nodeping object if it already exists and is using the same token as this check if ($check['token'] != $token) { $nodeping = new NodePingClient(array('token' => $check['token'])); } $token = $check['token']; $np_result_raw = $nodeping->result->get(array('id' => $check['np_check_id'], 'limit' => 5, 'clean' => true)); if (isset($np_result_raw['error'])) { echo "<td colspan=5>Error: {$check_status_raw['error']}</td>"; } else { $np_result = $np_result_raw[0]; if ($np_result['su']) { $reason = ''; $result_str = 'PASS'; $result_class = 'msg_success'; } else { $reason = $np_result['sc']; $result_str = 'FAIL'; $result_class = 'msg_error'; } echo "<td>{$reason}</td>"; echo "<td><span class='{$result_class}'>{$result_str}</span></td>"; } echo '<td class=center><a href="' . makeHrefProcess(array('op' => 'unlink', 'link_id' => $check['link_id'])) . '">'; echo getImageHREF('cut', 'Unlink this check') . '</a></td>'; echo '<td class=tdleft>'; printImageHREF('save', 'Save changes', TRUE); echo "</td></tr>\n"; echo "<tbody id='{$check['check_id']}' style='display:none;'><tr><td colspan=8>"; echo '<table cellspacing=0 cellpadding=5 align=left>'; // override the td styling so it doesn't have a border echo '<tr><th>Account</th><td align=left style="border-top: 0px;">' . getSelect($account_options, array('name' => 'account_id'), $check['account_id']) . '</td></tr>'; echo '<tr><th>Check ID</th><td align=left style="border-top: 0px;"><input type=text size=25 name=np_check_id value="' . $check['np_check_id'] . '"></td></tr>'; echo "<tr><th>Target</th><td align=left style=\"border-top:0px; word-wrap:break-word; max-width:250px;\">{$check['target']}</td></tr>"; echo '</table></form>'; echo '<table cellspacing=0 cellpadding=5 align=right>'; echo '<tr><th colspan=5>Last 5 Results</th></tr>'; echo '<tr><th>Time</th><th>Loc</th><th>Run Time</th><th>Response</th><th>Result</th></tr>'; foreach ($np_result_raw as $np_row) { // time is reported in miliseconds, so trim off the last 3 digits printf('<tr><td>%s</td>', date('H:i:s A', substr($np_row['s'], 0, -3))); printf('<td>%s</td>', strtoupper($np_row['l'][$np_row['s']])); if ($np_row['su']) { $result_str = 'PASS'; $result_class = 'msg_success'; } else { $result_str = 'FAIL'; $result_class = 'msg_error'; } echo "<td>{$np_row['rt']}</td>"; echo "<td>{$np_row['sc']}</td>"; echo "<td><span class='{$result_class}'>{$result_str}</span></td></tr>"; } echo '</table>'; echo "</td></tr></tbody>\n"; } echo "</table>\n"; } finishPortlet(); }
function localfunc_PortGenerator() { global $errorText, $lookFor, $portList, $genText, $valueConfiguration, $searchIt; assertUIntArg('object_id', __FUNCTION__); $object = spotEntity('object', $_REQUEST['object_id']); startPortlet("Port generator"); print "<center><br>"; if (!localverify_PortGenerator($object)) { // // Autoport configuration did not work. Show this and show the error // print "{$lookFor} : Error\n"; if (isset($errorText)) { print $errorText; } } else { // // Show the list of ports that will be generated and provide a link to actually do so // print "<a href='" . makeHrefProcess(array('op' => 'addports', 'page' => 'object', 'object_id' => $object['id'], 'tab' => 'ports')) . "'>Generate the ports for <b>{$object['name']}</b> as listed below NOW</a><br>\n"; print $genText . "<p>"; print "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>"; print "<tr><th>Port name </th><th>Port label </th><th>Port type</th></tr>\n"; foreach ($portList as $aPort) { print "<tr><td>{$aPort['name']}</td><td>{$aPort['label']}</td><td>{$aPort['port_name']}</td></tr>\n"; } print "</table>"; } print "<br></center>"; finishPortlet(); // // Check whether the user is allowed to do an update of the port configurator // // if you do not want this, make sure you add a // deny {$op_updateportgenerator} // for the apprioriate groups (or any allow first and deny for the rest // if (permitted('object', 'portgenerator', null, array(array('tag' => '$op_updateportgenerator')))) { startPortlet("Update autoport configuration"); // // Description of the config rules // print "<center>"; print $genText . "<p>\n"; print "<b>USAGE</b><br><br>"; print "<list1>;<list2>;.... where <listx> is<br>"; print "<start port #>|<port count, use %n for number of ports>|"; print "<port name, use %u for number>|[<port innerinterface id>-]<port type id>[|<port label, use %u for number>]<br><br>"; print "<b>EXAMPLE (for Force10 S4810)</b><br><br>0|48|%u|9-1084|TenGigabitEthernet0/%u;48|4|%u|10-1588|FortyGigE0/48;52|4|%u|10-1588|FortyGigE0/52;56|4|%u|10-1588|FortyGigE0/56;60|4|%u|10-1588|FortyGigE0/60;1|1|RS-232|29|Serial port;1|1|Ethernet|24|ManagementEthernet0/%u;1|2|AC%u|16<br><br>"; print "<b>EXPLANATION (for AC-in ports)</b><br><br> <b>1</b> = starting number,\n <b>2</b> = number of generated ports, \n <b>AC%u</b> = will begin with <b>starting number</b> and create up to the <b>number of generated ports</b>, \n <b>16</b> = the value displayed on the chart below <b>in bold</b> (Notice: Default innerinterface ID is 1 /hardwired/, so the realy value is <b>1-16</b>)<br><br>"; //explains example print "<b>PLEASE NOTE</b><br><br> If you do not add the port that is selected <b>(dictionary value)</b> to the default list in the <b>Ports</b> Tab, \n you will get a <b>foriegn key violation</b> error. \n You must go to the <b>Configuration</b> area on the main page, go to <b>Enable port types</b>\n and hit the <b>Edit</b> tab to place the selected port in either <b>GBIC</b>, <b>hardwired</b>, or any other configuration \n on the page so that the error is not recieved.<br><br><br>"; //Very important to have a sucessful implementation of port generator // // The form that can update the configuration // On top of the table of ports avialabe instead of beneath it // printOpFormIntro('updateportgenerator', array('yId' => $searchIt)); print "<b>Autoport Configuration:</b><br><br><input type='text' style='width:100%; font-size: 16px' name='yConfig' value='"; if ($valueConfiguration) { print $valueConfiguration[0]; } print "'><br><br>\n"; print "<input type='submit' name='autoportconfig' value='"; if ($valueConfiguration) { print "Update"; } else { print "Create"; } print "'>\n"; print "</form>\n"; print "</center><br>"; print "<table border='2' rules=all>\n<tr class=row_odd>"; $isfirst = true; $i = 0; // // List all available port types with their dictionary key // $q = "SELECT IF(iif_id,CONCAT(i.id,'-',o.id),o.id) as ID , IF(iif_id,CONCAT(i.iif_name,' => ',o.oif_name),o.oif_name) as name FROM PortOuterInterface o left join PortInterfaceCompat c on o.id = c.oif_id left join PortInnerInterface i on c.iif_id = i.id order by i.id,o.id"; $result = usePreparedSelectBlade($q); //Changed for new configeration in versions after 0.17.x if ($result == NULL) { print_r($dbxlink->errorInfo()); die; } while ($row4 = $result->fetch(PDO::FETCH_NUM)) { if (!$isfirst && $i % 10 == 0) { print "</td></tr>\n<tr class=" . ($i % 4 == 0 ? "row_odd" : "row_even") . ">"; } else { $isfirst = false; } print "<td><b>{$row4[0]}</b><br>"; //seperated values to make them easier to read print "{$row4[1]}\n</td>"; $i++; } print "</td>\n"; print "</tr></table>\n"; finishPortlet(); } }
function serializeFileLinks($links, $scissors = FALSE) { $comma = ''; $ret = ''; foreach ($links as $link_id => $li) { switch ($li['entity_type']) { case 'ipv4net': $params = "page=ipv4net&id="; break; case 'ipv6net': $params = "page=ipv6net&id="; break; case 'ipv4rspool': $params = "page=ipv4rspool&pool_id="; break; case 'ipv4vs': $params = "page=ipv4vs&vs_id="; break; case 'object': $params = "page=object&object_id="; break; case 'rack': $params = "page=rack&rack_id="; break; case 'location': $params = "page=location&location_id="; break; case 'user': $params = "page=user&user_id="; break; } $ret .= $comma; if ($scissors) { $ret .= "<a href='" . makeHrefProcess(array('op' => 'unlinkFile', 'link_id' => $link_id)) . "'"; $ret .= getImageHREF('cut') . '</a> '; } $ret .= sprintf("<a href='index.php?%s%s'>%s</a>", $params, $li['entity_id'], $li['name']); $comma = '<br>'; } return $ret; }
function renderMuninServersEditor() { function printNewItemTR() { printOpFormIntro('add'); echo '<tr>'; echo '<td>' . getImageHREF('create', 'add a new server', TRUE, 112) . '</td>'; echo '<td><input type=text size=48 name=base_url tabindex=101></td>'; echo '<td> </td>'; echo '<td>' . getImageHREF('create', 'add a new server', TRUE, 111) . '</td>'; echo '</tr></form>'; } echo '<table cellspacing=0 cellpadding=5 align=center class=widetable>'; echo '<tr><th> </th><th>base URL</th><th>graph(s)</th><th> </th></tr>'; if (getConfigVar('ADDNEW_AT_TOP') == 'yes') { printNewItemTR(); } foreach (getMuninServers() as $server) { printOpFormIntro('upd', array('id' => $server['id'])); echo '<tr><td>'; if ($server['num_graphs']) { printImageHREF('nodestroy', 'cannot delete, graphs exist'); } else { echo '<a href="' . makeHrefProcess(array('op' => 'del', 'id' => $server['id'])) . '">'; echo getImageHREF('destroy', 'delete this server') . '</a>'; } echo '</td>'; echo '<td><input type=text size=48 name=base_url value="' . htmlspecialchars($server['base_url'], ENT_QUOTES, 'UTF-8') . '"></td>'; echo "<td class=tdright>{$server['num_graphs']}</td>"; echo '<td>' . getImageHREF('save', 'update this server', TRUE) . '</td>'; echo '</tr></form>'; } if (getConfigVar('ADDNEW_AT_TOP') != 'yes') { printNewItemTR(); } echo '</table>'; }