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) {
<a href="<?=$button['href'];?>" class="btn btn-primary"><span class="glyphicon glyphicon-plus-sign __iconspacer"></span><?=$button['label'];?></a>
<?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>
<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; ?>
......
......@@ -11,43 +11,36 @@
</main>
<?php
if (isset($widgetfiles)):
$widgetfiles_add = $widgetfiles;
sort($widgetfiles_add);
if (isset($widgetCollection)):
// sort by name
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-dialog">
<div class="modal-content">
<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>
</div>
<div class="modal-body">
<table class="table table-striped table-hover">
<?php
foreach($widgetfiles_add as $widget):
if(!stristr($widget, "widget.php"))
continue;
$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";
foreach($widgetCollection as $widgetItem):
$widgettitle = $widgetItem['name'] . "_title";
$widgettitlelink = $widgetItem['name'] . "_title_link";
if (isset($$widgettitle)):?>
<tr>
<td style="cursor: pointer;" onclick='return addWidget("<?=$widgetname; ?>")'><?=$$widgettitle; ?></td>
<td style="cursor: pointer;" onclick='return addWidget("<?=$widgetItem['name']; ?>")'><?=$$widgettitle; ?></td>
</tr>
<?php
elseif ($nicename != ""): ?>
elseif (!empty($widgetItem['display_name'])): ?>
<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>
<?php
endif;
......@@ -55,7 +48,7 @@
</table>
</div>
<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><!-- /modal-content -->
</div><!-- /modal-dialog -->
......
This diff is collapsed.
......@@ -34,6 +34,16 @@ require_once("pfsense-utils.inc");
require_once("system.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'])) {
$pkg_json = trim(configd_run('firmware check'));
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