From c5798052929b7b7dc2081e318ab2b3e4a3af5a9b Mon Sep 17 00:00:00 2001 From: laf Date: Mon, 20 Jul 2015 13:55:35 +0100 Subject: [PATCH] Updated edit ports page to use bootstrap --- .../update-ports.inc.php} | 20 +- html/includes/table/edit-ports.inc.php | 74 ++++++ html/pages/device/edit/ports.inc.php | 243 ++++++++---------- 3 files changed, 194 insertions(+), 143 deletions(-) rename html/{includes/port-edit.inc.php => forms/update-ports.inc.php} (79%) create mode 100644 html/includes/table/edit-ports.inc.php diff --git a/html/includes/port-edit.inc.php b/html/forms/update-ports.inc.php similarity index 79% rename from html/includes/port-edit.inc.php rename to html/forms/update-ports.inc.php index abfba60539..24754e2462 100644 --- a/html/includes/port-edit.inc.php +++ b/html/forms/update-ports.inc.php @@ -1,5 +1,8 @@ $val) { }//end foreach if ($rows_updated > 0) { - $update_message = $rows_updated.' Device record updated.'; - $updated = 1; + $message = $rows_updated.' Device record updated.'; + $status = 'ok'; } else if ($rows_updated = '-1') { - $update_message = 'Device record unchanged. No update necessary.'; - $updated = -1; + $message = 'Device record unchanged. No update necessary.'; + $status = 'ok'; } else { - $update_message = 'Device record update error.'; - $updated = 0; + $message = 'Device record update error.'; } + +$response = array( + 'status' => $status, + 'message' => $message, +); +echo _json_encode($response); diff --git a/html/includes/table/edit-ports.inc.php b/html/includes/table/edit-ports.inc.php new file mode 100644 index 0000000000..5a935b2bff --- /dev/null +++ b/html/includes/table/edit-ports.inc.php @@ -0,0 +1,74 @@ + "", + 'label' => '', + 'ifAdminStatus' => '', + 'ifOperStatus' => "", + 'disabled' => "", + 'ignore' => "", + 'ifAlias' => '' +); + +foreach (dbFetchRows($sql, $param) as $port) { + $port = ifLabel($port); + + // Mark interfaces which are OperDown (but not AdminDown) yet not ignored or disabled, or up yet ignored or disabled + // - as to draw the attention to a possible problem. + + + $isportbad = ($port['ifOperStatus'] == 'down' && $port['ifAdminStatus'] != 'down') ? 1 : 0; + $dowecare = ($port['ignore'] == 0 && $port['disabled'] == 0) ? $isportbad : !$isportbad; + $outofsync = $dowecare ? " class='red'" : ''; + + $response[] = array( + 'ifIndex' => $port['ifIndex'], + 'label' => $port['label'], + 'ifAdminStatus' => $port['ifAdminStatus'], + 'ifOperStatus' => ''.$port['ifOperStatus'].'', + 'disabled' => ' + ', + 'ignore' => ' + ', + 'ifAlias' => $port['ifAlias'] + ); + +}//end foreach + +$output = array( + 'current' => $current, + 'rowCount' => $rowCount, + 'rows' => $response, + 'total' => $total, +); +echo _json_encode($output); \ No newline at end of file diff --git a/html/pages/device/edit/ports.inc.php b/html/pages/device/edit/ports.inc.php index d8dc562e43..00a2d52c45 100644 --- a/html/pages/device/edit/ports.inc.php +++ b/html/pages/device/edit/ports.inc.php @@ -1,144 +1,113 @@ - -echo '
'; - -if ($_POST['ignoreport']) { - if ($_SESSION['userlevel'] == '10') { - include 'includes/port-edit.inc.php'; - } -} - -if ($updated && $update_message) { - print_message($update_message); -} -else if ($update_message) { - print_error($update_message); -} - -echo "
- - "; - -echo " - - - - - - - - - - - - - - - - - - -"; -?> - + + + '> +
IndexNameAdminOperDisableIgnoreDescription
+ + + + + + + + + + + +
IndexNameAdminOperDisableIgnoreDescription
+
- -'; - echo ''.$port['ifIndex'].''; - echo ''.$port['label'].''; - echo ''.$port['ifAdminStatus'].''; - - // Mark interfaces which are OperDown (but not AdminDown) yet not ignored or disabled, or up yet ignored or disabled - // - as to draw the attention to a possible problem. - $isportbad = ($port['ifOperStatus'] == 'down' && $port['ifAdminStatus'] != 'down') ? 1 : 0; - $dowecare = ($port['ignore'] == 0 && $port['disabled'] == 0) ? $isportbad : !$isportbad; - $outofsync = $dowecare ? " class='red'" : ''; - - echo "'.$port['ifOperStatus'].''; - - echo ''; - echo "'; - echo "'; - echo "\n"; - - $row++; -}//end foreach - -echo ''; -echo ''; -echo '
';