summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2017-02-14 15:42:49 +0545
committerGitHub <noreply@github.com>2017-02-14 15:42:49 +0545
commit621dd53615f14f5732a347346b4b8444e81ea97f (patch)
tree4b314fcd3cdd3dd7282a4223e23e6b2951722509 /src/usr
parent6a951c867546c9f63e6f211b5f4b0e44990eccbc (diff)
downloadpfsense-621dd53615f14f5732a347346b4b8444e81ea97f.zip
pfsense-621dd53615f14f5732a347346b4b8444e81ea97f.tar.gz
Only save valid widget locations in config
Some widgets create extra panels, e.g. the widgets that now have the filter functionality. Those panels are processed in the ".each" at line 424. They do not have an id in the form "widget-*" and when the old code tries to find the "*" part it gets "undefined". This results in the layout being saved like: ``` <sequence>interface_statistics:col1:open,undefined:col1:close,system_information:col2:open,undefined:col2:close,picture:col3:open,rss:col3:open,ntp_status:col2:open</sequence> ``` This PR puts extra checks in place so that the "undefined" stuff does not get written into the widget sequence string.
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/local/www/index.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php
index ab41a4b..4d22d23 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -423,8 +423,13 @@ function updateWidgets(newWidget) {
$('.container .col-md-<?=$columnWidth?>').each(function(idx, col) {
$('.panel', col).each(function(idx, widget) {
var isOpen = $('.panel-body', widget).hasClass('in');
+ var widget_basename = widget.id.split('-')[1];
- sequence += widget.id.split('-')[1] + ':' + col.id.split('-')[1] + ':' + (isOpen ? 'open' : 'close') + ',';
+ // Only save details for panels that have id's like'widget-*'
+ // Some widgets create other panels, so ignore any of those.
+ if ((widget.id.split('-')[0] == 'widget') && (typeof widget_basename !== 'undefined')) {
+ sequence += widget_basename + ':' + col.id.split('-')[1] + ':' + (isOpen ? 'open' : 'close') + ',';
+ }
});
});
OpenPOWER on IntegriCloud