$replace = $attr['replacement']; } else { $replace = '\\1'; } $value = preg_replace($regex, $replace, $raw_value); /* return array of attr_id => attr_value) */ $attr['value'] = $value; } // else Warning ?? } /* snmpgeneric_pf_regex */ /* -------------------------------------------------- */ $sg_portiifoptions = getPortIIFOptions(); $sg_portiifoptions[-1] = 'sfp'; /* generic sfp */ $sg_portoifoptions = getPortOIFOptions(); /* -------------------------------------------------- */ /* -------------------------------------------------- */ function snmpgeneric_tabhandler($object_id) { // sg_var_dump_html($_POST); if (isset($_POST['asnewobject']) && $_POST['asnewobject'] == "1") { $newobject_name = $_POST['object_name']; $newobject_label = $_POST['object_label']; $newobject_type_id = $_POST['object_type_id']; $newobject_asset_no = $_POST['object_asset_no']; if (sg_checkObjectNameUniqueness($newobject_name, $newobject_type_id)) { $object_id = commitAddObject($newobject_name, $newobject_label, $newobject_type_id, $newobject_asset_no); $_POST['asnewobject'] = "0"; parse_str($_SERVER['QUERY_STRING'], $query_string); $query_string['object_id'] = $object_id;
function renderAutoPortsForm($object_id) { $info = spotEntity('object', $object_id); $ptlist = getPortOIFOptions(); echo "<table class='widetable' border=0 cellspacing=0 cellpadding=5 align='center'>\n"; echo "<caption>The following ports can be quickly added:</caption>"; echo "<tr><th>type</th><th>name</th></tr>"; foreach (getAutoPorts($info) as $autoport) { echo "<tr><td>" . $ptlist[$autoport['type']] . "</td><td>{$autoport['name']}</td></tr>"; } printOpFormIntro('generate'); echo "<tr><td colspan=2 align=center>"; echo "<input type=submit value='Generate'>"; echo "</td></tr>"; echo "</table></form>"; }
function renderPatchCableOIFCompatEditor() { echo '<br>'; renderTwoColumnCompatTableEditor(getPatchCableOIFCompat(), array('header' => 'Cable type', 'key' => 'pctype_id', 'value' => 'pctype', 'width' => 64, 'options' => getPatchCableTypeOptions()), array('header' => 'Outer interface', 'key' => 'oif_id', 'value' => 'oif_name', 'width' => 48, 'options' => getPortOIFOptions())); echo '<br>'; }
function renderPortOIFEditor() { function printNewitemTR() { printOpFormIntro('add'); echo '<tr>'; echo '<td> </td>'; echo '<td> </td>'; echo '<td> </td>'; echo '<td class=tdleft>' . getImageHREF('create', 'create new', TRUE) . '</td>'; echo '<td class=tdleft><input type=text size=48 name=oif_name></td>'; echo '<td class=tdleft>' . getImageHREF('create', 'create new', TRUE) . '</td>'; echo '</tr></form>'; } echo '<table class=widetable border=0 cellpadding=5 cellspacing=0 align=center>'; echo '<tr><th class=tdleft>Origin</th><th>Key</th><th>Refcnt</th><th> </th><th>Outer Interface</th><th> </th></tr>'; if (getConfigVar('ADDNEW_AT_TOP') == 'yes') { printNewitemTR(); } $refcnt = getPortOIFRefc(); foreach (getPortOIFOptions() as $oif_id => $oif_name) { echo '<tr>'; if ($oif_id < 2000) { echo '<td class=tdleft>' . getImageHREF('computer') . '</td>'; echo "<td class=tdleft>{$oif_id}</td>"; echo '<td class=tdright>' . ($refcnt[$oif_id] ? $refcnt[$oif_id] : ' ') . '</td>'; echo '<td> </td>'; echo '<td class=tdleft>' . stringForTD($oif_name, 48) . '</td>'; echo '<td> </td>'; } else { printOpFormIntro('upd', array('id' => $oif_id)); echo '<td class=tdleft>' . getImageHREF('favorite') . '</td>'; echo "<td class=tdleft>{$oif_id}</td>"; if ($refcnt[$oif_id]) { echo "<td class=tdright>{$refcnt[$oif_id]}</td>"; echo '<td class=tdleft>' . getImageHREF('nodestroy', 'cannot remove') . '</td>'; } else { echo '<td> </td>'; echo '<td class=tdleft>'; echo getOpLink(array('op' => 'del', 'id' => $oif_id), '', 'destroy', 'remove'); echo '</td>'; } echo '<td class=tdleft><input type=text size=48 name=oif_name value="' . stringForTextInputValue($oif_name, 48) . '"></td>'; echo '<td>' . getImageHREF('save', 'Save changes', TRUE) . '</td>'; echo '</form>'; } echo '</tr>'; } if (getConfigVar('ADDNEW_AT_TOP') != 'yes') { printNewitemTR(); } echo '</table>'; }