function renderEditVService($vsid) { $vsinfo = spotEntity('ipv4vs', $vsid); printOpFormIntro('updIPv4VS'); echo '<table border=0 align=center>'; echo "<tr><th class=tdright>VIP:</th><td class=tdleft><input type=text name=vip value='{$vsinfo['vip']}'></td></tr>\n"; echo "<tr><th class=tdright>Port:</th><td class=tdleft><input type=text name=vport value='{$vsinfo['vport']}'></td></tr>\n"; echo "<tr><th class=tdright>Proto:</th><td class=tdleft>"; global $vs_proto; printSelect($vs_proto, array('name' => 'proto'), $vsinfo['proto']); echo "</td></tr>\n"; echo "<tr><th class=tdright>Name:</th><td class=tdleft><input type=text name=name value='{$vsinfo['name']}'></td></tr>\n"; echo "<tr><th class=tdright>Tags:</th><td class=tdleft>"; printTagsPicker(); echo "</td></tr>\n"; echo "<tr><th class=tdright>VS config:</th><td class=tdleft><textarea name=vsconfig rows=20 cols=80>{$vsinfo['vsconfig']}</textarea></td></tr>\n"; echo "<tr><th class=tdright>RS config:</th><td class=tdleft><textarea name=rsconfig rows=20 cols=80>{$vsinfo['rsconfig']}</textarea></td></tr>\n"; echo "<tr><th class=submit colspan=2>"; printImageHREF('SAVE', 'Save changes', TRUE); echo "</td></tr>\n"; echo "</table></form>\n"; // delete link echo '<p class="centered">'; if ($vsinfo['refcnt'] > 0) { echo getOpLink(NULL, 'Delete virtual service', 'nodestroy', "Could not delete: there are {$vsinfo['refcnt']} LB links"); } else { echo getOpLink(array('op' => 'del', 'id' => $vsinfo['id']), 'Delete virtual service', 'destroy'); } }
function serializeFileLinks($links, $scissors = FALSE) { $comma = ''; $ret = ''; foreach ($links as $link_id => $li) { $cell = spotEntity($li['entity_type'], $li['entity_id']); $ret .= $comma; if ($scissors) { $ret .= getOpLink(array('op' => 'unlinkFile', 'link_id' => $link_id), '', 'cut', 'Unlink file') . ' '; } $ret .= mkCellA($cell); $comma = '<br>'; } return $ret; }
function renderEditVS($vs_id) { global $vs_proto; $vsinfo = spotEntity('ipvs', $vs_id); amplifyCell($vsinfo); $triplets = getTriplets($vsinfo); // first form - common VS settings printOpFormIntro('updVS'); echo '<table border=0 align=center>'; echo '<tr><th class=tdright>Name:</th><td class=tdleft><input type=text name=name value="' . htmlspecialchars($vsinfo['name'], ENT_QUOTES) . '"></td></tr>'; echo "<tr><th class=tdright>Tags:</th><td class=tdleft>"; printTagsPicker(); echo "</td></tr>\n"; echo '<tr><th class=tdright>VS config:</th><td class=tdleft><textarea name=vsconfig rows=3 cols=80>' . stringForTextarea($vsinfo['vsconfig']) . '</textarea></td></tr>'; echo '<tr><th class=tdright>RS config:</th><td class=tdleft><textarea name=rsconfig rows=3 cols=80>' . stringForTextarea($vsinfo['rsconfig']) . '</textarea></td></tr>'; echo '<tr><th></th><th>'; printImageHREF('SAVE', 'Save changes', TRUE); // delete link $triplets = getTriplets($vsinfo); echo '<span style="margin-left: 2em"></span>'; if (count($triplets) > 0) { echo getOpLink(NULL, '', 'NODESTROY', "Could not delete: there are " . count($triplets) . " LB links"); } else { echo getOpLink(array('op' => 'del', 'id' => $vsinfo['id']), '', 'DESTROY', 'Delete', 'need-confirmation'); } echo '</th></tr>'; echo '</table></form>'; addJS('js/jquery.thumbhover.js'); addJS('js/slb_editor.js'); // second form - ports and IPs settings echo '<p>'; // vertical indentation echo '<table width=50% border=0 align=center>'; echo '<tr><th style="white-space:nowrap">'; printOpFormIntro('addPort'); echo 'Add new port:<br>'; echo getSelect($vs_proto, array('name' => 'proto')); echo ' <input name=port size=5> '; echo getImageHREF('add', 'Add port', TRUE); echo '</form></th>'; echo '<td width=99%></td>'; echo '<th style="white-space:nowrap">'; printOpFormIntro('addIP'); echo 'Add new IP:<br>'; echo '<input name=ip size=14> '; echo getImageHREF('add', 'Add IP', TRUE); echo '</form></th></tr>'; echo '<tr><td valign=top class=tdleft><ul class="slb-checks editable">'; foreach ($vsinfo['ports'] as $port) { $used = 0; foreach ($triplets as $triplet) { if (isPortEnabled($port, $triplet['ports'])) { $used++; } } echo '<li class="enabled">'; echo formatVSPort($port) . getPopupSLBConfig($port); renderPopupVSPortForm($port, $used); echo '</li>'; } echo '</ul></td>'; echo '<td width=99%></td>'; echo '<td valign=top class=tdleft><ul class="slb-checks editable">'; foreach ($vsinfo['vips'] as $vip) { $used = 0; foreach ($triplets as $triplet) { if (isVIPEnabled($vip, $triplet['vips'])) { $used++; } } echo '<li class="enabled">'; echo formatVSIP($vip) . getPopupSLBConfig($vip); renderPopupVSVIPForm($vip, $used); echo '</li>'; } echo '</ul></td>'; echo '</tr></table>'; }
function renderSimpleTableWithOriginEditor($rows, $column) { function printNewitemTR($column) { printOpFormIntro('add'); echo '<tr>'; echo '<td> </td>'; echo '<td class=tdleft>' . getImageHREF('create', 'create new', TRUE, 200) . '</td>'; echo "<td><input type=text size={$column['width']} name={$column['value']} tabindex=100></td>"; echo '<td class=tdleft>' . getImageHREF('create', 'create new', TRUE, 200) . '</td>'; echo '</tr></form>'; } echo '<table class=widetable border=0 cellpadding=5 cellspacing=0 align=center>'; echo "<tr><th>Origin</th><th> </th><th>{$column['header']}</th><th> </th></tr>"; if (getConfigVar('ADDNEW_AT_TOP') == 'yes') { printNewitemTR($column); } foreach ($rows as $row) { echo '<tr>'; if ($row['origin'] == 'default') { echo '<td>' . getImageHREF('computer', 'default') . '</td>'; echo '<td> </td>'; echo '<td>' . niftyString($row[$column['value']], $column['width']) . '</td>'; echo '<td> </td>'; } else { printOpFormIntro('upd', array($column['key'] => $row[$column['key']])); echo '<td>' . getImageHREF('favorite', 'custom') . '</td>'; echo '<td>' . getOpLink(array('op' => 'del', $column['key'] => $row[$column['key']]), '', 'destroy', 'remove') . '</td>'; echo "<td><input type=text size={$column['width']} name={$column['value']} value='" . niftyString($row[$column['value']], $column['width']) . "'></td>"; echo '<td>' . getImageHREF('save', 'Save changes', TRUE) . '</td>'; echo '</form>'; } echo '</tr>'; } if (getConfigVar('ADDNEW_AT_TOP') != 'yes') { printNewitemTR($column); } echo '</table>'; }
function renderEditVlan($vlan_ck) { global $vtoptions; $vlan = getVLANInfo($vlan_ck); startPortlet('Modify'); printOpFormIntro('upd'); // static attributes echo '<table border=0 cellspacing=0 cellpadding=2 align=center>'; echo '<tr><th class=tdright>Name:</th><td class=tdleft>' . "<input type=text size=40 name=vlan_descr value='{$vlan['vlan_descr']}'>" . '</td></tr>'; echo '<tr><th class=tdright>Type:</th><td class=tdleft>' . getSelect($vtoptions, array('name' => 'vlan_type', 'tabindex' => 102), $vlan['vlan_prop']) . '</td></tr>'; echo '</table>'; echo '<p>'; echo '<input type="hidden" name="vdom_id" value="' . htmlspecialchars($vlan['domain_id'], ENT_QUOTES) . '">'; echo '<input type="hidden" name="vlan_id" value="' . htmlspecialchars($vlan['vlan_id'], ENT_QUOTES) . '">'; printImageHREF('SAVE', 'Update VLAN', TRUE); echo '</form><p>'; // get configured ports count $portc = 0; foreach (getVLANConfiguredPorts($vlan_ck) as $subarray) { $portc += count($subarray); } $clear_line = ''; $delete_line = ''; if ($portc) { $clear_line .= '<p>'; $clear_line .= '<a href="' . makeHrefProcess(array('op' => 'clear', 'vlan_ck' => $vlan_ck)) . '">'; $clear_line .= getImageHREF('clear', "remove this vlan from {$portc} ports") . ' remove</a>' . ' this VLAN from ' . '<a href="' . makeHref(array('page' => 'vlan', 'tab' => 'default', 'vlan_ck' => $vlan_ck)) . '">' . "{$portc} ports</a>"; } $reason = ''; if ($vlan['vlan_id'] == VLAN_DFL_ID) { $reason = "You can not delete default VLAN"; } elseif ($portc) { $reason = "Can not delete: {$portc} ports configured"; } if (!empty($reason)) { echo getOpLink(NULL, 'delete VLAN', 'nodestroy', $reason); } else { echo getOpLink(array('op' => 'del', 'vlan_ck' => $vlan_ck), 'delete VLAN', 'destroy'); } echo $clear_line; finishPortlet(); }
function renderPatchCableHeapAmount() { echo '<table class=widetable border=0 cellpadding=5 cellspacing=0 align=center>'; echo '<tr><th colspan=3>Amount</th><th>End 1</th><th>Cable type</th><th>End 2</th><th>Length</th><th>Description</th><th> </th></tr>'; foreach (getPatchCableHeapSummary() as $heap) { printOpFormIntro('set', array('id' => $heap['id'])); echo '<tr>'; echo '<td>'; if ($heap['amount'] > 0) { echo getOpLink(array('op' => 'dec', 'id' => $heap['id']), '', 'delete', 'consume'); } else { echo getImageHREF('nodelete'); } echo '</td>'; echo "<td><input type=text size=7 name=amount value='{$heap['amount']}'></td>"; echo '<td>' . getOpLink(array('op' => 'inc', 'id' => $heap['id']), '', 'add', 'replenish') . '</td>'; echo '<td>' . stringForTD($heap['end1_connector'], 32) . '</td>'; echo '<td>' . stringForTD($heap['pctype'], 255) . '</td>'; echo '<td>' . stringForTD($heap['end2_connector'], 32) . '</td>'; echo "<td class=tdright>{$heap['length']}</td>"; echo '<td>' . stringForTD($heap['description'], 255) . '</td>'; echo '<td>' . getImageHREF('save', 'Save changes', TRUE) . '</td>'; echo '</tr></form>'; } echo '</table>'; }
function renderMuninServersEditor() { function printNewItemTR() { printOpFormIntro('add'); echo '<tr>'; echo '<td>' . getImageHREF('create', 'add a new server', TRUE) . '</td>'; echo '<td><input type=text size=48 name=base_url></td>'; echo '<td> </td>'; echo '<td>' . getImageHREF('create', 'add a new server', TRUE) . '</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 getOpLink(array('op' => 'del', 'id' => $server['id']), '', 'destroy', 'delete this server'); } 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>'; }