123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631 |
- <?php
- //-
- // Copyright (c) 2011-2017 Joe Clarke <jclarke@cisco.com>
- // All rights reserved.
- // Redistribution and use in source and binary forms, with or without
- // modification, are permitted provided that the following conditions
- // are met:
- // 1. Redistributions of source code must retain the above copyright
- // notice, this list of conditions and the following disclaimer.
- // 2. Redistributions in binary form must reproduce the above copyright
- // notice, this list of conditions and the following disclaimer in the
- // documentation and/or other materials provided with the distribution.
- // THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- // ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- // OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- // LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- // OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- // SUCH DAMAGE.
- include_once 'db.inc.php';
- include_once 'swreg/swreg.inc.php';
- require_once 'Log.php';
- require_once 'functions.php';
- $dsn = "$db_driver:host=$db_host;dbname=$db_name";
- $options = [
- PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
- PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
- PDO::ATTR_EMULATE_PREPARES => false,
- ];
- try {
- $dbh = new PDO($dsn, $db_user, $db_pass, $options);
- } catch (PDOException $e) {
- die($e->getMessage());
- }
- $logger = Log::singleton('file', LOGFILE, TOOL_NAME . ' : Physical Switches');
- if ($logger === false) {
- die("Failed to open logfile.\n");
- }
- $mask = Log::MAX(LOG_LEVEL);
- $logger->setMask($mask);
- $base = get_base($_SERVER['SCRIPT_NAME']);
- $ruser = '<AUTHENTICATION NOT ENABLED>';
- if (isset($_SERVER['REMOTE_USER'])) {
- $ruser = $_SERVER['REMOTE_USER'];
- }
- $errors = array();
- if (isset($_REQUEST['prev_checked'])) {
- $pc = $_REQUEST['prev_checked'];
- $pas = $_REQUEST['prev_assigned_switch'];
- $c = (isset($_REQUEST['checked'])) ? $_REQUEST['checked'] : array();
- $as = $_REQUEST['assigned_switch'];
- $d = (isset($_REQUEST['delete'])) ? $_REQUEST['delete'] : array();
- $rz = (isset($_REQUEST['reztp'])) ? $_REQUEST['reztp'] : array();
- foreach ($pc as $swsn => $value) {
- $curr_del = (isset($d[$swsn])) ? $d[$swsn] : 0;
- $curr_rz = (isset($rz[$swsn])) ? $rz[$swsn] : 0;
- if ($curr_del == 1) {
- $sql = "DELETE FROM DEVICE_MAP WHERE serial_number=:sn";
- try {
- $sth = $dbh->prepare($sql);
- $sth->execute(['sn' => $swsn]);
- $sth->closeCursor();
- $logger->info("User {$ruser} deleted physical switch {$swsn}");
- } catch (PDOException $e) {
- array_push($errors, "Failed to delete switch {$swsn}: {$e->getMessage()}");
- }
- continue;
- }
- if ($curr_rz == 1) {
- $sql = "UPDATE DEVICE_MAP SET should_re_ztp=:rz WHERE serial_number=:sn";
- try {
- $sth = $dbh->prepare($sql);
- $sth->execute(['sn' => $swsn, 'rz' => 2]);
- $sth->closeCursor();
- $logger->info("User {$ruser} set physical switch {$swsn} to re-ZTP");
- } catch (PDOException $e) {
- array_push($errors, "Failed to set switch {$swsn} to re-ZTP: {$e->getMessage()}");
- }
- }
- $curr_checked = (isset($c[$swsn])) ? $c[$swsn] : 0;
- if ($value != $curr_checked || $pas[$swsn] != $as[$swsn]) {
- $nc = $curr_checked;
- $additional = '';
- if ($nc == 1 && $as == '__BOGUS__') {
- array_push($errors, "You must select a logical switch assignment for $swsn");
- } else {
- if ($nc == 0 || $as == '__BOGUS__') {
- $nas = 'NULL';
- $additional = ", provisioned_status = '" . PROVISION_UNKNOWN . "', device_status = '" . REACHABILITY_NEVER_REACHABLE . "'";
- } else {
- $nas = "'{$as[$swsn]}'";
- }
- $sql = "UPDATE DEVICE_MAP SET checked_out='{$nc}', assigned_switch = {$nas} {$additional} WHERE serial_number='{$swsn}'";
- try {
- $dbh->query($sql);
- $logger->info("User {$ruser} updated physical switches, checked_out={$nc}, assigned_switch={$nas} for serial_number={$swsn}");
- } catch (PDOException $e) {
- array_push($errors, "Failed to update $swsn: '{$e->getMessage()}'");
- }
- }
- }
- }
- }
- $wc = '';
- if (isset($_REQUEST['filter'])) {
- switch ($_REQUEST['filter']) {
- case 'a':
- $wc = '';
- break;
- case 'p':
- $wc = 'WHERE assigned_switch IS NOT NULL';
- break;
- case 'up':
- $wc = 'WHERE assigned_switch IS NULL';
- break;
- case 'vu':
- $wc = 'WHERE provisioned_status=\'' . PROVISION_UNKNOWN . '\'';
- break;
- case 'vi':
- $wc = 'WHERE provisioned_status=\'' . PROVISION_IN_PROGRESS . '\'';
- break;
- case 'vf':
- $wc = 'WHERE provisioned_status=\'' . PROVISION_FAIL . '\'';
- break;
- case 'vs':
- $wc = 'WHERE provisioned_status=\'' . PROVISION_SUCCESS . '\'';
- break;
- case 'r':
- $wc = 'WHERE device_status=\'' . REACHABILITY_REACHABLE . '\'';
- break;
- case 'ur':
- $wc = 'WHERE provisioned_status=\'' . PROVISION_SUCCESS . '\' AND (device_status=\'' . REACHABILITY_NEVER_REACHABLE . '\' OR device_status=\'' . REACHABILITY_NOW_UNREACHABLE . '\')';
- break;
- default:
- if (preg_match("/^pid:([\w\d-]+)/", $_REQUEST['filter'], $match)) {
- $wc = "WHERE pid = '{$match[1]}'";
- } else {
- $wc = '';
- }
- break;
- }
- }
- $res = null;
- if (isset($_REQUEST['switch_name'])) {
- $sql = "SELECT * FROM DEVICE_MAP WHERE serial_number LIKE :swname1 OR assigned_switch LIKE :swname2 ORDER BY LPAD(lower(serial_number), 10, 0)";
- try {
- $res = $dbh->prepare($sql);
- $res->execute(['swname1' => "%{$_REQUEST['switch_name']}%", 'swname2' => "%{$_REQUEST['switch_name']}%"]);
- } catch (PDOException $e) {
- echo "<p><font color=\"red\">Error querying for physical switches: {$e->getMessage()}</font></p>\r\n";
- exit(1);
- }
- } else {
- $sql = 'SELECT * FROM DEVICE_MAP ' . $wc . ' ORDER BY LPAD(lower(serial_number), 10, 0)';
- try {
- $res = $dbh->query($sql);
- } catch (PDOException $e) {
- echo "<p><font color=\"red\">Error querying for physical switches: {$e->getMessage()}</font></p>\r\n";
- exit(1);
- }
- }
- $sql = 'SELECT name, pid FROM SWITCHES WHERE ip_address IS NOT NULL ORDER BY name';
- $ls_res = null;
- try {
- $ls_res = $dbh->query($sql);
- } catch (PDOException $e) {
- echo "<p><font color=\"red\">Error querying for logical switches: {$e->getMessage()}</font></p>\r\n";
- exit(1);
- }
- $lswitches = array();
- while ($row = $ls_res->fetch()) {
- if (!isset($lswitches[$row['pid']])) {
- $lswitches[$row['pid']] = array('__BOGUS__', $row['name']);
- } else {
- array_push($lswitches[$row['pid']], $row['name']);
- }
- }
- $switches = array();
- while ($row = $res->fetch()) {
- array_push($switches, $row);
- }
- $sql = 'SELECT DISTINCT(pid) AS pid FROM DEVICE_MAP';
- try {
- $res = $dbh->query($sql);
- } catch (PDOException $e) {
- echo "<p><font color=\"red\">Error querying for PIDs: {$e->getMessage()}</font></p>\r\n";
- exit(1);
- }
- $pids = array();
- while ($row = $res->fetch()) {
- $pids[$row['pid']] = true;
- }
- $sql = 'SELECT assigned_switch FROM DEVICE_MAP WHERE assigned_switch IS NOT NULL';
- try {
- $res = $dbh->query($sql);
- } catch (PDOException $e) {
- echo "<p><font color=\"red\">Error querying for assigned switches: {$e->getMessage()}</font></p>\r\n";
- exit(1);
- }
- $used = array();
- while ($row = $res->fetch()) {
- $used[$row['assigned_switch']] = true;
- }
- $filt = null;
- if (!isset($_REQUEST['filter'])) {
- $filt = '';
- } else {
- $filt = $_REQUEST['filter'];
- }
- print_header(TOOL_NAME . ': Physical Switches');
- ?>
- <body class="flex">
- <script language="javascript">
- var deletes = 0;
- var PROVISION_UNKNOWN = <?= PROVISION_UNKNOWN ?>;
- var PROVISION_IN_PROGRESS = <?= PROVISION_IN_PROGRESS ?>;
- var PROVISION_FAIL = <?= PROVISION_FAIL ?>;
- var PROVISION_SUCCESS = <?= PROVISION_SUCCESS ?>;
- var REACHABILITY_NEVER_REACHABLE = <?= REACHABILITY_NEVER_REACHABLE ?>;
- var REACHABILITY_NOW_UNREACHABLE = <?= REACHABILITY_NOW_UNREACHABLE ?>;
- var REACHABILITY_REACHABLE = <?= REACHABILITY_REACHABLE ?>;
- var row_intervals = {};
- function refresh() {
- $.ajax({
- url: '<?= $base ?>/get_dev_stats.php',
- dataType: 'json',
- success: function (data) {
- $.each(data.response, function (k, v) {
- var rtext = ' ';
- var color = '#FFFFFF';
- var rtitle = 'Not yet assigned';
- var prs = v.provisioned_status;
- var ds = v.device_status;
- if (prs == PROVISION_SUCCESS) {
- color = '#00FF00';
- rtitle = 'Bootstrap validated successfully';
- rtext += ' ';
- } else if (prs == PROVISION_UNKNOWN || prs == PROVISION_IN_PROGRESS) {
- color = '#919191';
- rtitle = 'Not yet bootstrapped';
- if (prs == PROVISION_IN_PROGRESS) {
- rtitle = 'Bootstrapping in progress';
- rtext += ' ';
- }
- } else {
- color = '#FF0000';
- rtitle = 'Bootstrap validation failed';
- rtext += ' ';
- }
- rtext += '<input type="hidden" id="pros' + k + '" value="' + prs + '">';
- if (prs != PROVISION_IN_PROGRESS) {
- if ('undefined' !== typeof row_intervals[k]) {
- $('#psr_' + k).stop(true, true);
- clearInterval(row_intervals[k]);
- $('#psr_' + k).stop(true, true);
- }
- }
- $('#psr_' + k).css('background', color);
- $('#psr_' + k).html('<span style="display: none">' + prs + '</span>' + rtext);
- $('#psr_' + k).attr('title', rtitle);
- if (prs == PROVISION_IN_PROGRESS) {
- if ('undefined' !== typeof row_intervals[k]) {
- clearInterval(row_intervals[k]);
- $('#psr_' + k).stop(true, true);
- }
- var pulseint = setInterval(function () {
- $('#psr_' + k).animate({
- backgroundColor: '#919191',
- }, 1000).animate({
- backgroundColor: '#f5f5f5',
- }, 1000);
- }, 1500);
- row_intervals[k] = pulseint;
- }
- color = '#FFFFFF';
- rtext = ' ';
- rtitle = 'Not yet assigned';
- if (ds == REACHABILITY_NEVER_REACHABLE && prs == PROVISION_SUCCESS) {
- color = '#FF0000';
- rtitle = 'Device was never reachable';
- } else if (ds == REACHABILITY_NEVER_REACHABLE) {
- color = '#919191';
- rtitle = 'Not yet bootstrapped';
- rtext += ' ';
- } else if (ds == REACHABILITY_NOW_UNREACHABLE) {
- color = '#FFFF00';
- rtitle = 'Device has been reachable, but is not reachable now';
- rtext += ' ';
- } else {
- color = '#00FF00';
- rtitle = 'Device is reachable';
- rtext += ' ';
- }
- $('#dsr_' + k).css('background', color);
- $('#dsr_' + k).html('<span style="display: none">' + ds + '</span>' + rtext);
- $('#dsr_' + k).attr('title', rtitle);
- });
- },
- complete: function (xhr, message) {
- setTimeout(refresh, 30000);
- }
- });
- }
- function reztp_all() {
- if ($('#reztp_all_box').is(':checked')) {
- $('.reztp').each(function () {
- $(this).prop('checked', true);
- });
- } else {
- $('.reztp').each(function () {
- $(this).prop('checked', false);
- });
- }
- return true;
- }
- function toggle_reztp_all(elem) {
- if (!$(elem).is(':checked')) {
- $('#reztp_all_box').prop('checked', false);
- }
- }
- function check_confirm() {
- var delete_conf = true;
- var reztp_conf = true;
- if (deletes > 0) {
- delete_conf = confirm("Are you sure you want to delete these " + deletes + " physical switch(es)?");
- }
- $('.reztp').each(function () {
- if ($(this).is(':checked')) {
- one_checked = true;
- return;
- }
- });
- if (one_checked) {
- reztp_conf = confirm("Are you sure you want to re-ZTP these switches?");
- }
- return reztp_conf && delete_conf;
- }
- if (window.history.replaceState) {
- window.history.replaceState(null, null, window.location.href);
- }
- $(document).ready(function () {
- $('#devtable').DataTable({
- "scrollY": "400px",
- "scrollCollapse": true,
- "paging": false
- });
- refresh();
- });
- </script>
- <div id="headswreg">
- <div class="apage">
- <div id="header">
- <h1>
- <?= TOOL_NAME ?>: Physical Switches
- </h1>
- </div>
- <br />
- </div>
- </div>
- <div class="apage">
- <form method="POST" name="search_form" action="<?= $_SERVER['PHP_SELF'] ?>">
- <table class="noborder" summary="Filter Table">
- <tr>
- <td class="left_act">Show Only:
- <select name="filter" onChange="MM_jumpMenu('parent', this, 0)">
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=a" <?= ($filt == 'a') ? 'selected' : '' ?>>All</option>
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=p" <?= ($filt == 'p') ? 'selected' : '' ?>>Assigned
- </option>
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=up" <?= ($filt == 'up') ? 'selected' : '' ?>>Unassigned
- </option>
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=vu" <?= ($filt == 'vu') ? 'selected' : '' ?>>Not Yet
- Bootstrapped</option>
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=vi" <?= ($filt == 'vi') ? 'selected' : '' ?>>Bootstrapping
- In
- Progress</option>
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=vf" <?= ($filt == 'vf') ? 'selected' : '' ?>>Verification
- Failed</option>
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=vs" <?= ($filt == 'vs') ? 'selected' : '' ?>>Verification
- Succeeded</option>
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=r" <?= ($filt == 'r') ? 'selected' : '' ?>>Reachable
- </option>
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=ur" <?= ($filt == 'ur') ? 'selected' : '' ?>>Unreachable
- </option>
- <?php
- foreach ($pids as $lsp => $value) {
- $selected = ($filt == "pid:$lsp") ? 'selected' : ''; ?>
- <option value="<?= $_SERVER['PHP_SELF'] ?>?filter=pid:<?= $lsp ?>" <?= $selected ?>>
- <?= $lsp ?>
- </option>
- <?php
- }
- ?>
- </select>
- </td>
- <td class="right">Switch Search:
- <input type="text" size="16" name="switch_name"
- value="<?= (isset($_REQUEST['switch_name'])) ? $_REQUEST['switch_name'] : '' ?>">
- <input type="image" value="Submit" name="search" src="/images/submit_button.png">
- </td>
- </tr>
- </table>
- </form>
- <br />
- <table class="noborder" summary="Control Table">
- <tr>
- <td class="left"><a href="<?= $base ?>/add_phys.php">Add Physical Switch</a> |
- <?php
- if (EXPORT_PRIME === true) {
- ?>
- <a href="#" onClick="window.open('<?= $base ?>/export.php')">Export to Prime / DNS</a> |
- <?php
- }
- if (EXPORT_DEADMAN === true) {
- ?>
- <a href="#" onClick="window.open('<?= $base ?>/export_deadman.php')">Export To Ansible</a> |
- <?php
- } ?>
- <a href="<?= $base ?>/logicsw.php">Logical Switches</a>
- </td>
- </tr>
- </table>
- <form name="mod_phys_switch_form" method="POST" action="<?= $_SERVER['PHP_SELF'] ?>"
- onSubmit='return check_confirm();'>
- <?php
- foreach (array_merge($_GET, $_POST) as $name => $value) {
- if (!is_array($value)) {
- ?>
- <input type="hidden" name="<?= $name ?>" value="<?= $value ?>">
- <?php
- }
- }
- ?>
- <div class="btable">
- <table summary="Button Table" width="100%" cellspacing="0">
- <tr>
- <td><input type="reset" value="Reset" name="reset">
- <input type="submit" value="Submit" name="submit">
- </td>
- </tr>
- </table>
- </div>
- <br />
- <div align="center">
- <?php
- foreach ($errors as $error) {
- ?>
- <p class="error">
- <?= $error ?>
- </p>
- <?php
- }
- ?>
- </div>
- <div class="maintable">
- <table id="devtable" class="cell-border compact" width="100%" cellspacing="0" summary="Physical Switch Table">
- <thead>
- <tr>
- <th class="headlink">Row No.</th>
- <th class="headlink">Delete?</th>
- <th class="headlink">Assigned?</th>
- <th class="headlink">Re-ZTP? <input type="checkbox" id="reztp_all_box" onchange="return reztp_all();">
- </th>
- <th class="headlink">Serial Number</th>
- <th class="headlink">Product ID</th>
- <th class="headlink">Max Ports</th>
- <th class="headlink">Assigned Logical<br />Switch</th>
- <th class="headlink">Provision<br />Status</th>
- <th class="headlink">Reachability</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $i = 0;
- foreach ($switches as $row) {
- $sn = $row['serial_number'];
- $checked = false;
- $will_rz = false;
- if ($row['checked_out'] == 1) {
- $checked = true;
- }
- if ($row['should_re_ztp'] > 0) {
- $will_rz = true;
- } ?>
- <tr>
- <td>
- <?= $i + 1 ?>.
- </td>
- <td><input type="checkbox" name="delete[<?= $sn ?>]" value="1"
- onClick="if (this.checked == true) { deletes++; } else { deletes--; }"></td>
- <td><input type="hidden" name="prev_checked[<?= $sn ?>]" value="<?= $row['checked_out'] ?>">
- <input id="checked_<?= $i ?>" type="checkbox" name="checked[<?= $sn ?>]" value="1" <?= ($checked) ? 'checked' : '' ?>>
- </td>
- <td><input id="reztp_<?= $i ?>" class="reztp" type="checkbox" name="reztp[<?= $sn ?>]" value="1"
- onchange="toggle_reztp_all(this);" <?= ($will_rz) ? 'disabled' : '' ?>></td>
- <td>
- <?= $row['serial_number'] ?>
- </td>
- <td>
- <?= $row['pid'] ?>
- </td>
- <td>
- <?= $row['max_ports'] ?>
- </td>
- <td><input type="hidden" name="prev_assigned_switch[<?= $sn ?>]" value="<?= $row['assigned_switch'] ?>">
- <select id="asw<?= $i ?>" name="assigned_switch[<?= $sn ?>]"
- onChange='var elem = document.getElementById("checked_<?= $i ?>"); if (this.value == "__BOGUS__") { elem.checked = false; } else { elem.checked = true; }'>
- <?php
- $has_avail = false;
- foreach ($lswitches[$row['pid']] as $lsw) {
- $selected = ($row['assigned_switch'] == $lsw) ? 'selected' : '';
- if ($selected == '' && isset($used[$lsw]) && $used[$lsw] === true) {
- continue;
- }
- if ($lsw == '__BOGUS__') {
- ?>
- <option value="__BOGUS__" <?= $selected ?>>--Please Select--</option>
- <?php
- } else {
- $has_avail = true; ?>
- <option value="<?= $lsw ?>" <?= $selected ?>>
- <?= $lsw ?>
- </option>
- <?php
- }
- }
- if (!$has_avail) {
- ?>
- <option value="__BOGUS__" <?= $selected ?>>--Please Select--</option>
- <?php
- } ?>
- </select>
- <a href="#"
- onClick='var lsw = document.getElementById("asw<?= $i ?>"); if (lsw.value == "__BOGUS__") { alert("There is no logical switch associated to this device."); return false; } else { window.open("<?= $base ?>/logicsw.php?switch_name=" + lsw.value, "Logical switch " + lsw.value, "height=480,width=1048"); return false; }'><img
- src="/images/switch.gif" border="0" title="View logical switch"></a> <a href="#"
- onClick='var pros = document.getElementById("pros<?= $row['serial_number'] ?>"); var lsw = document.getElementById("asw<?= $i ?>"); if (pros.value < PROVISION_FAIL) { alert("This switch config has not yet been generated."); return false; } else { window.open("<?= $base ?>/show_config.php?cfg=" + lsw.value + "-config.txt&dname=" + lsw.value, "Config for switch " + lsw.value, "height=650,width=980"); return false; }'><img
- src="/images/mag.gif" border="0" title="View switch config"></a>
- </td>
- <?php
- $color = '#FFFFFF';
- $rtext = 'N/A';
- $rtitle = 'Not yet assigned'; ?>
- <td id="psr_<?= $row['serial_number'] ?>" style="background: <?= $color ?>;" title="<?= $rtitle ?>"><input
- type="hidden" id="pros<?= $row['serial_number'] ?>" value="<?= $row['provisioned_status'] ?>"><span
- style="display: none">
- <?= $row['provisioned_status'] ?>
- </span>
- <?= $rtext ?>
- </td>
- <?php
- $color = '#FFFFFF';
- $rtext = 'N/A';
- $rtitle = 'Not yet assigned'; ?>
- <td id="dsr_<?= $row['serial_number'] ?>" style="background: <?= $color ?>;" title="<?= $rtitle ?>"><span
- style="display: none">
- <?= $row['device_status'] ?>
- </span>
- <?= $rtext ?>
- </td>
- </tr>
- <?php
- ++$i;
- }
- ?>
- </tbody>
- </table>
- </div>
- <br />
- <div class="btable">
- <table summary="Button Table" width="100%" cellspacing="0">
- <tr>
- <td><input type="reset" value="Reset" name="reset">
- <input type="submit" value="Submit" name="submit">
- </td>
- </tr>
- </table>
- </div>
- </form>
- </div>
- </body>
- </html>
- <?php
- cleanup();
- ?>
|