-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathintstatuslist.php
127 lines (104 loc) · 4.26 KB
/
intstatuslist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
require_once('php/session.php');
session_write_close();
require_once('php/functions.php');
require_once('config.php');
require_once('php/switchoperations.php');
require_once('lang.php');
$cSwitch = null;
if(isset($_GET['switch']) && $_GET['switch'] != "") {
$cSwitch = getSwitchByAddr($_GET['switch']);
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?php translate('Interface Status List'); ?> - <?php translate('Switchconfig'); ?></title>
<?php require('head.inc.php'); ?>
<link rel='stylesheet' type='text/css' href='css/intstatuslist.css'>
</head>
<body>
<script>
function beginFadeOutAnimation() {
document.getElementById('imgSwitch').style.opacity = 0;
document.getElementById('imgLoading').style.opacity = 1;
}
</script>
<div id='container'>
<h1 id='title'><div id='logo'></div></h1>
<div id='splash' class='big'>
<?php if($cSwitch != null) { ?>
<h2><?php echo $cSwitch['name']; ?></h2>
<?php } else { ?>
<div class='infobox warn'><?php translate('No switch selected'); ?></div>
<?php } ?>
<hr/>
<div id='subtitle'>
<div id='imgContainer'>
<img id='imgLoading' src='img/loading.svg'></img>
<img id='imgSwitch' src='img/switch.png'></img>
</div>
<?php translate('This page provides a table overview for all ports with their settings.'); ?>
</div>
<table width='100%' id='logintable'>
<tr><td>
<?php
if($cSwitch != null) {
if(isset($_GET['view']) && $_GET['view'] == "raw") {
$result = executeRawCommand($cSwitch['addr'], 'show int status');
echo "<textarea id='intstatustext' wrap='off' readonly='true'>" .htmlspecialchars($result) . "</textarea>";
} else {
echo "<div id='intstatuslistcontainer'><table id='intstatuslist'>\n";
echo "<thead>\n";
echo "\t<tr>\n";
echo "\t\t<th>".translate('Port',false)."</th>\n";
echo "\t\t<th>".translate('Description',false)."</th>\n";
echo "\t\t<th>".translate('Status',false)."</th>\n";
echo "\t\t<th>".translate('VLAN',false)."</th>\n";
echo "\t\t<th>".translate('Duplex',false)."</th>\n";
echo "\t\t<th>".translate('Speed',false)."</th>\n";
echo "\t\t<th>".translate('Type',false)."</th>\n";
echo "\t</tr>\n";
echo "</thead>\n";
$interfaces = getAllPortsOnSwitch($cSwitch['addr']);
if($interfaces === "ERR:AUTH" || $interfaces === "ERR:CONN") {
echo $interfaces;
} else {
echo "<tbody>\n";
foreach($interfaces as $interface) {
$link_href = "index.php?switch=".urlencode($cSwitch['addr'])."&port=".urlencode($interface['port']);
$link = "<a href='$link_href' onclick='beginFadeOutAnimation();'>";
$link_end = "</a>";
echo "\t<tr onclick='beginFadeOutAnimation(); window.location.href = \"$link_href\"'>\n";
echo "\t\t<td>$link" . htmlspecialchars($interface['port']) . "$link_end</td>\n";
echo "\t\t<td>$link" . htmlspecialchars($interface['desc']) . "$link_end</td>\n";
echo "\t\t<td>$link<img src='" . getStatusImgPath($interface['stat']) . "'>$link_end</td>\n";
echo "\t\t<td>$link" . htmlspecialchars($interface['vlan']) . "$link_end</td>\n";
echo "\t\t<td class='small'>$link" . htmlspecialchars($interface['dupl']) . "$link_end</td>\n";
echo "\t\t<td class='small'>$link" . htmlspecialchars($interface['spee']) . "$link_end</td>\n";
echo "\t\t<td class='small'>$link" . htmlspecialchars($interface['type']) . "$link_end</td>\n";
echo "\t</tr>\n";
}
echo "</tbody>\n";
}
echo "</table></div>\n";
}
}
?>
</td></tr>
<tr>
<td>
<div class='spread-toolbar toolbar-margin-top'>
<a href='index.php?switch=<?php echo urlencode($cSwitch['addr']); ?>' onclick='beginFadeOutAnimation();'>><?php translate('Back'); ?></a>
<span><a href='intstatuslist.php?switch=<?php echo urlencode($cSwitch['addr']); ?>&view=raw' onclick='beginFadeOutAnimation();'><?php translate('Text'); ?></a> <span style='color:gray;'>|</span> <a href='intstatuslist.php?switch=<?php echo urlencode($cSwitch['addr']); ?>' onclick='beginFadeOutAnimation();'><?php translate('Table'); ?></a></span>
<a href='#' onclick='beginFadeOutAnimation(); window.location.reload(true);'>><?php translate('Refresh'); ?></a>
</div>
</td>
</tr>
</table>
</div>
<?php require('foot.inc.php'); ?>
</div>
<?php require('menu.inc.php'); ?>
</body>
</html>