Commit d376cfdf authored by Franco Fichtner's avatar Franco Fichtner

dashboard: default to empty, allow empy save; closes #1048

We do have a config.xml default, and we don't need a second default
that pops up every time the old layout is cleared.  On top of that
the old layout could never be cleared again, so it only dealt with
an empty config.xml scenario which we don't have.
parent 40c8dc03
......@@ -44,11 +44,8 @@ if (empty($config['widgets']) || !is_array($config['widgets'])) {
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = $config['widgets'];
if (empty($pconfig['sequence'])) {
// set default dashboard view
$pconfig['sequence'] = 'system_information-container:col1:show,interface_list-container:col1:show,traffic_graphs-container:col1:show';
}
// default 2 column grid layout
// set default dashboard view
$pconfig['sequence'] = !empty($pconfig['sequence']) ? $pconfig['sequence'] : '';
$pconfig['column_count'] = !empty($pconfig['column_count']) ? $pconfig['column_count'] : 2;
// build list of widgets
$widgetCollection = array();
......@@ -77,12 +74,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
} elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!empty($_POST['sequence'])) {
$config['widgets']['sequence'] = $_POST['sequence'];
if (!empty($_POST['column_count'])) {
$config['widgets']['column_count'] = $_POST['column_count'];
}
write_config(gettext("Widget configuration has been changed."));
} else {
unset($config['widgets']['sequence']);
}
if (!empty($_POST['column_count'])) {
$config['widgets']['column_count'] = $_POST['column_count'];
} else {
unset($config['widgets']['column_count']);
}
header("Location: index.php");
write_config(gettext('Widget configuration has been changed.'));
header('Location: index.php');
exit;
}
......
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