diff options
author | Phil Davis <phil.davis@inf.org> | 2017-02-14 15:42:49 +0545 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-02-14 09:25:03 -0200 |
commit | d2e001aa1b66d9aa72e9ea0361bab29976e65a89 (patch) | |
tree | e8a014534503648d06387d37d015ef3fb3badde0 | |
parent | 5952db66888fbeb74a8180560001e128bf9d132f (diff) | |
download | pfsense-d2e001aa1b66d9aa72e9ea0361bab29976e65a89.zip pfsense-d2e001aa1b66d9aa72e9ea0361bab29976e65a89.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.
(cherry picked from commit 621dd53615f14f5732a347346b4b8444e81ea97f)
-rw-r--r-- | src/usr/local/www/index.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php index da80249..4d9535e 100644 --- a/src/usr/local/www/index.php +++ b/src/usr/local/www/index.php @@ -460,8 +460,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') + ','; + } }); }); |