Revision f69aa687
Added by Scott Dale about 18 years ago
usr/local/www/index.php | ||
---|---|---|
139 | 139 |
while (false !== ($filename = readdir($dirhandle))) { |
140 | 140 |
$periodpos = strpos($filename, "."); |
141 | 141 |
$widgetname = substr($filename, 0, $periodpos); |
142 |
if ($widgetname != "system information")
|
|
142 |
if ($widgetname != "system_information")
|
|
143 | 143 |
$widgetfiles[] = $filename; |
144 | 144 |
} |
145 | 145 |
sort($widgetfiles); |
146 |
array_unshift($widgetfiles, "system information.widget.php");
|
|
146 |
array_unshift($widgetfiles, "system_information.widget.php");
|
|
147 | 147 |
} |
148 | 148 |
|
149 | 149 |
|
... | ... | |
274 | 274 |
$periodpos = strpos($widget, "."); |
275 | 275 |
$widgetname = substr($widget, 0, $periodpos); |
276 | 276 |
$nicename = $widgetname; |
277 |
$widgetname = str_replace(" ", "", $widgetname);
|
|
277 |
$nicename = str_replace("_", " ", $nicename);
|
|
278 | 278 |
//make the title look nice |
279 | 279 |
$nicename = ucwords($nicename);?> |
280 | 280 |
<span style="cursor: pointer;" onclick='return showDiv("<?php echo $widgetname; ?>div",false)'><u><?php echo $nicename; ?></u></span><br><?php |
... | ... | |
288 | 288 |
<p class="pgtitle">System Overview |
289 | 289 |
<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" alt="Click here to add widgets" style="cursor: help;" onmouseup="domTT_activate(this, event, 'content', document.getElementById('content1'), 'type', 'velcro', 'delay', 0, 'fade', 'both', 'fadeMax', 100, 'styleClass', 'niceTitle');" /> |
290 | 290 |
|
291 |
|
|
292 |
|
|
293 |
|
|
294 | 291 |
<div style="clear:both;"></div> |
295 | 292 |
|
296 | 293 |
<div id="submitpref" align="center" style="display:none;width:17%;margin:5px;padding: 5px;background:#CCCCCC"> |
... | ... | |
324 | 321 |
$periodpos = strpos($widget, "."); |
325 | 322 |
$widgetname = substr($widget, 0, $periodpos); |
326 | 323 |
$nicename = $widgetname; |
327 |
$widgetname = str_replace(" ", "", $widgetname);
|
|
324 |
$nicename = str_replace("_", " ", $nicename);
|
|
328 | 325 |
|
329 | 326 |
//make the title look nice |
330 | 327 |
$nicename = ucwords($nicename); |
usr/local/www/widgets/widgets/system_information.widget.php | ||
---|---|---|
1 |
<table width="100%" border="0" cellspacing="0" cellpadding="0"> |
|
2 |
<tbody> |
|
3 |
<tr> |
|
4 |
<td width="25%" class="vncellt">Name</td> |
|
5 |
<td width="75%" class="listr"><?php echo $config['system']['hostname'] . "." . $config['system']['domain']; ?></td> |
|
6 |
</tr> |
|
7 |
<tr> |
|
8 |
<td width="25%" valign="top" class="vncellt">Version</td> |
|
9 |
<td width="75%" class="listr"> |
|
10 |
<strong><?php readfile("/etc/version"); ?></strong> |
|
11 |
<br /> |
|
12 |
built on <?php readfile("/etc/version.buildtime"); ?> |
|
13 |
</td> |
|
14 |
</tr> |
|
15 |
<tr> |
|
16 |
<td width="25%" class="vncellt">Platform</td> |
|
17 |
<td width="75%" class="listr"><?=htmlspecialchars($g['platform']);?></td> |
|
18 |
</tr> |
|
19 |
<tr> |
|
20 |
<td width="25%" class="vncellt">CPU Type</td> |
|
21 |
<td width="75%" class="listr"> |
|
22 |
<?php |
|
23 |
$cpumodel = ""; |
|
24 |
exec("/sbin/sysctl -n hw.model", $cpumodel); |
|
25 |
$cpumodel = implode(" ", $cpumodel); |
|
26 |
echo (htmlspecialchars($cpumodel)); ?> |
|
27 |
</td> |
|
28 |
</tr> |
|
29 |
<?php if ($hwcrypto): ?> |
|
30 |
<tr> |
|
31 |
<td width="25%" class="vncellt">Hardware crypto</td> |
|
32 |
<td width="75%" class="listr"><?=htmlspecialchars($hwcrypto);?></td> |
|
33 |
</tr> |
|
34 |
<?php endif; ?> |
|
35 |
<tr> |
|
36 |
<td width="25%" class="vncellt">Uptime</td> |
|
37 |
<td width="75%" class="listr"><input style="border: 0px solid white;" size="30" name="uptime" id="uptime" value="<?= htmlspecialchars(get_uptime()); ?>" /></td> |
|
38 |
</tr> |
|
39 |
<tr> |
|
40 |
<td width="30%" class="vncellt">DNS server(s)</td> |
|
41 |
<td width="70%" class="listr"> |
|
42 |
<?php |
|
43 |
$dns_servers = get_dns_servers(); |
|
44 |
foreach($dns_servers as $dns) { |
|
45 |
echo "{$dns}<br>"; |
|
46 |
} |
|
47 |
?> |
|
48 |
</td> |
|
49 |
</tr> |
|
50 |
<?php if ($config['revision']): ?> |
|
51 |
<tr> |
|
52 |
<td width="25%" class="vncellt">Last config change</td> |
|
53 |
<td width="75%" class="listr"><?= htmlspecialchars(date("D M j G:i:s T Y", $config['revision']['time']));?></td> |
|
54 |
</tr> |
|
55 |
<?php endif; ?> |
|
56 |
<tr> |
|
57 |
<td width="25%" class="vncellt">State table size</td> |
|
58 |
<td width="75%" class="listr"> |
|
59 |
<input style="border: 0px solid white;" size="30" name="pfstate" id="pfstate" value="<?= htmlspecialchars(get_pfstate()); ?>" /> |
|
60 |
<br /> |
|
61 |
<a href="diag_dump_states.php">Show states</a> |
|
62 |
</td> |
|
63 |
</tr> |
|
64 |
<tr> |
|
65 |
<td width="25%" class="vncellt">CPU usage</td> |
|
66 |
<td width="75%" class="listr"> |
|
67 |
<?php $cpuUsage = "0"; ?> |
|
68 |
<img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" name="cpuwidtha" id="cpuwidtha" width="<?= $cpuUsage; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" name="cpuwidthb" id="cpuwidthb" width="<?= (100 - $cpuUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> |
|
69 |
|
|
70 |
<input style="border: 0px solid white;" size="30" name="cpumeter" id="cpumeter" value="(Updating in 5 seconds)" /> |
|
71 |
</td> |
|
72 |
</tr> |
|
73 |
<tr> |
|
74 |
<td width="25%" class="vncellt">Memory usage</td> |
|
75 |
<td width="75%" class="listr"> |
|
76 |
<?php $memUsage = mem_usage(); ?> |
|
77 |
<img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" name="memwidtha" id="memwidtha" width="<?= $memUsage; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" name="memwidthb" id="memwidthb" width="<?= (100 - $memUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> |
|
78 |
|
|
79 |
<input style="border: 0px solid white;" size="30" name="memusagemeter" id="memusagemeter" value="<?= $memUsage.'%'; ?>" /> |
|
80 |
</td> |
|
81 |
</tr> |
|
82 |
<?php if($showswap == true): ?> |
|
83 |
<tr> |
|
84 |
<td width="25%" class="vncellt">SWAP usage</td> |
|
85 |
<td width="75%" class="listr"> |
|
86 |
<?php $swapusage = swap_usage(); ?> |
|
87 |
<img src="./themes/<?= $g['theme']; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_blue.gif" height="15" width="<?= $swapUsage; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_gray.gif" height="15" width="<?= (100 - $swapUsage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g['theme']; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> |
|
88 |
|
|
89 |
<input style="border: 0px solid white;" size="30" name="swapusagemeter" id="swapusagemeter" value="<?= $swapusage.'%'; ?>" /> |
|
90 |
</td> |
|
91 |
</tr> |
|
92 |
<?php endif; ?> |
|
93 |
<?php |
|
94 |
if(has_temp()): |
|
95 |
?> |
|
96 |
<tr> |
|
97 |
<td width='25%' class='vncellt'>Temperature</td> |
|
98 |
<td width='75%' class='listr'> |
|
99 |
<?php $temp = get_temp(); ?> |
|
100 |
<img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_blue.gif" height="15" name="tempwidtha" id="tempwidtha" width="<?= $temp; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_gray.gif" height="15" name="tempwidthb" id="tempwidthb" width="<?= (100 - $temp); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> |
|
101 |
|
|
102 |
<input style="border: 0px solid white;" size="30" name="tempmeter" id="tempmeter" value="<?= $temp."C"; ?>" /> |
|
103 |
</td> |
|
104 |
</tr> |
|
105 |
<?php endif; ?> |
|
106 |
<tr> |
|
107 |
<td width="25%" class="vncellt">Disk usage</td> |
|
108 |
<td width="75%" class="listr"> |
|
109 |
<?php $diskusage = disk_usage(); ?> |
|
110 |
<img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_left.gif" height="15" width="4" border="0" align="middle" alt="left bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_blue.gif" height="15" width="<?= $diskusage; ?>" border="0" align="middle" alt="red bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_gray.gif" height="15" width="<?= (100 - $diskusage); ?>" border="0" align="middle" alt="gray bar" /><img src="./themes/<?= $g["theme"]; ?>/images/misc/bar_right.gif" height="15" width="5" border="0" align="middle" alt="right bar" /> |
|
111 |
|
|
112 |
<input style="border: 0px solid white;" size="30" name="diskusagemeter" id="diskusagemeter" value="<?= $diskusage.'%'; ?>" /> |
|
113 |
</td> |
|
114 |
</tr> |
|
115 |
</tbody> |
|
116 |
</table> |
usr/local/www/widgets/widgets/traffic_graphs.widget.php | ||
---|---|---|
1 |
<?php $i = 0; $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN'); |
|
2 |
for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) { |
|
3 |
$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr']; |
|
4 |
}?> |
|
5 |
|
|
6 |
<?php |
|
7 |
//set variables for traffic graph |
|
8 |
$width = "347"; |
|
9 |
$height = "150"; |
|
10 |
|
|
11 |
if (get_cpu_speed() >= 500) |
|
12 |
$firstgraphshown = false; |
|
13 |
else |
|
14 |
$firstgraphshown = true; |
|
15 |
foreach ($ifdescrs as $ifdescr => $ifname){ |
|
16 |
$ifinfo = get_interface_info($ifdescr); |
|
17 |
$ifnum = convert_friendly_interface_to_real_interface_name($ifname); |
|
18 |
|
|
19 |
if ($ifinfo['status'] != "down"){ |
|
20 |
?> |
|
21 |
<div id="<?=$ifname;?>trafficdiv" style="padding: 5px"> |
|
22 |
<div id="<?=$ifname;?>topic" class="widgetsubheader"> |
|
23 |
<div style="float:left;width:49%"> |
|
24 |
<a href="/status_graph.php?if=<?=$ifdescr;?>"><span style="color:#000000">Current <?=$ifname;?> Traffic</span></a> |
|
25 |
</div> |
|
26 |
<div align="right" style="float:right;width:49%"> |
|
27 |
<?php |
|
28 |
if(!$firstgraphshown){?> |
|
29 |
<div id="<?=$ifname;?>graphdiv-min" onclick='return minimizeDiv("<?php echo $ifname;?>graphdiv",true)' style="display:inline; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_minus.gif" alt="Minimize <?=$ifname;?> traffic graph" /></div> |
|
30 |
<?php $firstgraphshown = true;?> |
|
31 |
<div id="<?=$ifname;?>graphdiv-open" onclick='return showDiv("<?php echo $ifname;?>graphdiv",true)' style="display:none; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_open.gif" alt="Show <?=$ifname;?> traffic graph" /></div> |
|
32 |
</div><div style="clear:both;"></div> |
|
33 |
</div> |
|
34 |
|
|
35 |
<div id="<?=$ifname;?>graphdiv"> |
|
36 |
<embed id="graph" src="graph.php?ifnum=<?=$ifnum;?>&ifname=<?=rawurlencode($ifname);?>" type="image/svg+xml" width="<? echo $width; ?>" height="<? echo $height; ?>" pluginspage="http://www.adobe.com/svg/viewer/install/auto" /> |
|
37 |
</div> |
|
38 |
<? } else { ?> |
|
39 |
<div id="<?=$ifname;?>graphdiv-open" onclick='return showDiv("<?php echo $ifname;?>graphdiv",true)' style="display:inline; cursor:pointer" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_open.gif" alt="Show <?=$ifname;?> traffic graph" /></div> |
|
40 |
<div id="<?=$ifname;?>graphdiv-min" onclick='return minimizeDiv("<?php echo $ifname;?>graphdiv",true)' style="display:none; cursor:pointer"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_minus.gif" alt="Minimize <?=$ifname;?> traffic graph" /></div> |
|
41 |
</div><div style="clear:both;"></div> |
|
42 |
</div> |
|
43 |
<div id="<?=$ifname;?>graphdiv" style="display: none"> |
|
44 |
<embed id="graph" src="graph.php?ifnum=<?=$ifnum;?>&ifname=<?=rawurlencode($ifname);?>" type="image/svg+xml" width="<? echo $width; ?>" height="<? echo $height; ?>" pluginspage="http://www.adobe.com/svg/viewer/install/auto" /> |
|
45 |
</div> |
|
46 |
<? } ?> |
|
47 |
</div> |
|
48 |
<? } |
|
49 |
} ?> |
Also available in: Unified diff
Widget base. Note: changes to widgets are not saved yet.