Commit cb336a65 authored by Ad Schellevis's avatar Ad Schellevis

(dashboard) further cleanup... the same, but different

parent 4021045e
...@@ -194,7 +194,7 @@ if($need_alert_display == true) { ...@@ -194,7 +194,7 @@ if($need_alert_display == true) {
<a href="<?=$button['href'];?>" class="btn btn-primary"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span><?=$button['label'];?></a> <a href="<?=$button['href'];?>" class="btn btn-primary"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span><?=$button['label'];?></a>
<?php endforeach; endif; ?> <?php endforeach; endif; ?>
<?php if (isset($widgetfiles)): ?> <?php if (isset($widgetCollection)): ?>
<a href="#" id="updatepref" style="display:none" onclick="return updatePref();" class="btn btn-primary"><?=gettext("Save Settings");?></a> <a href="#" id="updatepref" style="display:none" onclick="return updatePref();" class="btn btn-primary"><?=gettext("Save Settings");?></a>
<button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal_widgets"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span><?= gettext('Add widget') ?></button> <button type="button" class="btn btn-default" data-toggle="modal" data-target="#modal_widgets"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span><?= gettext('Add widget') ?></button>
<?php endif; ?> <?php endif; ?>
......
...@@ -11,51 +11,44 @@ ...@@ -11,51 +11,44 @@
</main> </main>
<?php <?php
if (isset($widgetfiles)): if (isset($widgetCollection)):
$widgetfiles_add = $widgetfiles; // sort by name
sort($widgetfiles_add); usort($widgetCollection, function ($item1, $item2) {
return strcmp(strtolower($item1['name']), strtolower($item2['name']));
});
?> ?>
<div class="modal fade" id="modal_widgets" tabindex="-1" role="dialog" aria-labelledby="modal_widgets_label" aria-hidden="true"> <div class="modal fade" id="modal_widgets" tabindex="-1" role="dialog" aria-labelledby="modal_widgets_label" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> <button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only"><?=gettext("Close");?></span>
</button>
<h4 class="modal-title" id="modal_widgets_label"><?=gettext("Available Widgets"); ?></h4> <h4 class="modal-title" id="modal_widgets_label"><?=gettext("Available Widgets"); ?></h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<table class="table table-striped table-hover"> <table class="table table-striped table-hover">
<?php <?php
foreach($widgetfiles_add as $widget): foreach($widgetCollection as $widgetItem):
if(!stristr($widget, "widget.php")) $widgettitle = $widgetItem['name'] . "_title";
continue; $widgettitlelink = $widgetItem['name'] . "_title_link";
if (isset($$widgettitle)):?>
$periodpos = strpos($widget, ".");
$widgetname = substr($widget, 0, $periodpos);
$nicename = $widgetname;
$nicename = str_replace("_", " ", $nicename);
//make the title look nice
$nicename = ucwords($nicename);
$widgettitle = $widgetname . "_title";
$widgettitlelink = $widgetname . "_title_link";
if (isset($$widgettitle)):?>
<tr> <tr>
<td style="cursor: pointer;" onclick='return addWidget("<?=$widgetname; ?>")'><?=$$widgettitle; ?></td> <td style="cursor: pointer;" onclick='return addWidget("<?=$widgetItem['name']; ?>")'><?=$$widgettitle; ?></td>
</tr> </tr>
<?php <?php
elseif ($nicename != ""): ?> elseif (!empty($widgetItem['display_name'])): ?>
<tr> <tr>
<td style="cursor: pointer;" onclick='return addWidget("<?=$widgetname; ?>")'><?=$nicename; ?></td> <td style="cursor: pointer;" onclick='return addWidget("<?=$widgetItem['name']; ?>")'><?=$widgetItem['display_name']; ?></td>
</tr> </tr>
<?php <?php
endif; endif;
endforeach; ?> endforeach; ?>
</table> </table>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-default" data-dismiss="modal"><?=gettext("Close");?></button>
</div> </div>
</div><!-- /modal-content --> </div><!-- /modal-content -->
</div><!-- /modal-dialog --> </div><!-- /modal-dialog -->
......
This diff is collapsed.
...@@ -34,6 +34,16 @@ require_once("pfsense-utils.inc"); ...@@ -34,6 +34,16 @@ require_once("pfsense-utils.inc");
require_once("system.inc"); require_once("system.inc");
require_once("stats.inc"); require_once("stats.inc");
## Check to see if we have a swap space,
## if true, display, if false, hide it ...
$swapinfo = `/usr/sbin/swapinfo`;
if (stristr($swapinfo, '%')) {
$showswap = true;
} else {
$showswap = false;
}
if (isset($_REQUEST['getupdatestatus'])) { if (isset($_REQUEST['getupdatestatus'])) {
$pkg_json = trim(configd_run('firmware check')); $pkg_json = trim(configd_run('firmware check'));
if ($pkg_json != '') { if ($pkg_json != '') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment