Project

General

Profile

« Previous | Next » 

Revision ad51eb90

Added by Phil Davis over 9 years ago

Limit widget column to dashboardcolumns

Stops widgets from "going missing" when the user reduces the dashboard columns in System, General Setup.
If the user just lowers dashboard columns to see what happens, then increases it again, the actual column settings are preserved in the config, so the widgets go back where they were. That seems a good thing.
If the user lowers dashboard columns and then also saves the dashboard, the newly-limited column settings will be saved.

Forum: https://forum.pfsense.org/index.php?topic=107865.0

View differences:

src/usr/local/www/index.php
252 252

  
253 253
##build widget saved list information
254 254
if ($config['widgets'] && $config['widgets']['sequence'] != "") {
255
	$dashboardcolumns = isset($config['system']['webgui']['dashboardcolumns']) ? $config['system']['webgui']['dashboardcolumns'] : 2;
255 256
	$pconfig['sequence'] = $config['widgets']['sequence'];
256 257
	$widgetsfromconfig = array();
257 258

  
......
269 270
			}
270 271
		}
271 272

  
273
		// Limit the column to the current dashboard columns.
274
		if (substr($col, 3) > $dashboardcolumns) {
275
			$col = "col" . $dashboardcolumns;
276
		}
277

  
272 278
		$offset = strpos($file, '-container');
273 279
		if (false !== $offset) {
274 280
			$file = substr($file, 0, $offset);

Also available in: Unified diff