mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 01:54:49 +00:00
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.
This commit is contained in:
parent
40c8dc03e7
commit
d376cfdf5c
@ -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']);
|
||||
}
|
||||
header("Location: index.php");
|
||||
if (!empty($_POST['column_count'])) {
|
||||
$config['widgets']['column_count'] = $_POST['column_count'];
|
||||
} else {
|
||||
unset($config['widgets']['column_count']);
|
||||
}
|
||||
write_config(gettext('Widget configuration has been changed.'));
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user