Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
720bcff5
Commit
720bcff5
authored
May 02, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(dashboard) switchable column layout
parent
67a3a7e8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
fbegin.inc
src/www/fbegin.inc
+6
-0
index.php
src/www/index.php
+22
-0
No files found.
src/www/fbegin.inc
View file @
720bcff5
...
...
@@ -197,6 +197,12 @@ if($need_alert_display == true) {
<?php
if
(
isset
(
$widgetCollection
))
:
?>
<a
href=
"#"
id=
"updatepref"
style=
"display:none"
onclick=
"return updatePref();"
class=
"btn btn-primary"
>
<?=
gettext
(
"Save Settings"
);
?>
</a>
<button
type=
"button"
class=
"btn btn-default"
data-toggle=
"modal"
data-target=
"#modal_widgets"
><span
class=
"glyphicon glyphicon-plus-sign __iconspacer"
></span>
<?=
gettext
(
'Add widget'
)
?>
</button>
<select
class=
"selectpicker"
data-width=
"120px"
id=
"column_count"
>
<option
value=
"1"
<?=
$pconfig
[
'column_count'
]
==
"1"
?
'selected="selected"'
:
""
;
?>
>
<?=
gettext
(
"1 column"
);
?>
</option>
<option
value=
"2"
<?=
$pconfig
[
'column_count'
]
==
"2"
?
'selected="selected"'
:
""
;
?>
>
<?=
gettext
(
"2 columns"
);
?>
</option>
<option
value=
"3"
<?=
$pconfig
[
'column_count'
]
==
"3"
?
'selected="selected"'
:
""
;
?>
>
<?=
gettext
(
"3 columns"
);
?>
</option>
<option
value=
"4"
<?=
$pconfig
[
'column_count'
]
==
"4"
?
'selected="selected"'
:
""
;
?>
>
<?=
gettext
(
"4 columns"
);
?>
</option>
</select>
<?php
endif
;
?>
</li>
</ul>
...
...
src/www/index.php
View file @
720bcff5
...
...
@@ -55,6 +55,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// 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
$pconfig
[
'column_count'
]
=
!
empty
(
$pconfig
[
'column_count'
])
?
$pconfig
[
'column_count'
]
:
2
;
// build list of widgets
$widgetCollection
=
array
();
$widgetSeqParts
=
explode
(
","
,
$pconfig
[
'sequence'
]);
...
...
@@ -84,6 +86,9 @@ 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."
));
}
header
(
"Location: index.php"
);
...
...
@@ -216,12 +221,29 @@ include("fbegin.inc");?>
showSave
();
}
});
$
(
"#column_count"
)
.
change
(
function
(){
if
(
$
(
"#column_count_input"
)
.
val
()
!=
$
(
"#column_count"
)
.
val
())
{
showSave
();
}
$
(
"#column_count_input"
)
.
val
(
$
(
"#column_count"
)
.
val
());
$
(
".widgetdiv"
)
.
each
(
function
(){
var
widget
=
$
(
this
);
$
.
each
(
widget
.
attr
(
"class"
)
.
split
(
' '
),
function
(
index
,
classname
)
{
if
(
classname
.
indexOf
(
'col-md'
)
>
-
1
)
{
widget
.
removeClass
(
classname
);
}
});;
widget
.
addClass
(
'col-md-'
+
(
12
/
$
(
"#column_count_input"
)
.
val
()));
});
});
$
(
"#column_count"
)
.
change
();
});
</
script
>
<
section
class
="
page
-
content
-
main
">
<form method="
post
" id="
iform
">
<input type="
hidden
" value="" name="
sequence
" id="
sequence
" />
<input type="
hidden
" value="
<?=
$pconfig
[
'column_count'
];
?>
" name="column_count" id="column_count_input" />
<div
class=
"container-fluid"
>
<div
class=
"row sortable"
>
<?php
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment