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
abdee6c4
Commit
abdee6c4
authored
Apr 28, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(dashboard) step by step cleanup, move changeTabDIV to ipsec.widget.php, remove unused widgetAjax
parent
9ff3fcc7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
79 deletions
+47
-79
index.php
src/www/index.php
+8
-78
ipsec.widget.php
src/www/widgets/widgets/ipsec.widget.php
+39
-1
No files found.
src/www/index.php
View file @
abdee6c4
...
...
@@ -72,7 +72,7 @@ sort($widgetfiles);
array_unshift
(
$widgetfiles
,
"system_information.widget.php"
);
##if no config entry found, initialize config entry
if
(
!
is_array
(
$config
[
'widgets'
]))
{
if
(
empty
(
$config
[
'widgets'
])
||
!
is_array
(
$config
[
'widgets'
]))
{
$config
[
'widgets'
]
=
array
();
}
...
...
@@ -160,38 +160,14 @@ foreach ($phpincludefiles as $includename) {
include
(
$directory
.
$includename
);
}
##begin AJAX
$jscriptstr
=
<<<EOD
<script type="text/javascript">
//<![CDATA[
include
(
"head.inc"
);
function widgetAjax(widget) {
uri = "widgets/widgets/" + widget + ".widget.php";
var opt = {
// Use GET
type: 'get',
async: true,
// Handle 404
statusCode: {
404: function(t) {
alert('Error 404: location "' + t.statusText + '" was not found.');
}
},
// Handle other errors
error: function(t) {
alert('Error ' + t.status + ' -- ' + t.statusText);
},
success: function(data) {
widget2 = '#' + widget + "-loader";
jQuery(widget2).fadeOut(1000,function(){
jQuery('#' + widget).show();
});
jQuery('#' + widget).html(data);
}
}
jQuery.ajax(uri, opt);
}
?>
<body>
<script
src=
'/javascript/index/ajax.js'
></script>
<script
type=
"text/javascript"
>
//
<!
[
CDATA
[
function
addWidget
(
selectedDiv
){
container
=
$
(
'
#
'
+
selectedDiv
);
...
...
@@ -281,57 +257,11 @@ function updatePref(){
return
false
;
}
function changeTabDIV(selectedDiv){
var dashpos = selectedDiv.indexOf("-");
var tabclass = selectedDiv.substring(0,dashpos);
d = document;
//get deactive tabs first
tabclass = tabclass + "-class-tabdeactive";
var tabs = document.getElementsByClassName(tabclass);
var incTabSelected = selectedDiv + "-deactive";
for (i=0; i<tabs.length; i++){
var tab = tabs[i].id;
dashpos = tab.lastIndexOf("-");
var tab2 = tab.substring(0,dashpos) + "-deactive";
if (tab2 == incTabSelected){
tablink = d.getElementById(tab2);
tablink.style.display = "none";
tab2 = tab.substring(0,dashpos) + "-active";
tablink = d.getElementById(tab2);
tablink.style.display = "table-cell";
//now show main div associated with link clicked
tabmain = d.getElementById(selectedDiv);
tabmain.style.display = "block";
}
else
{
tab2 = tab.substring(0,dashpos) + "-deactive";
tablink = d.getElementById(tab2);
tablink.style.display = "table-cell";
tab2 = tab.substring(0,dashpos) + "-active";
tablink = d.getElementById(tab2);
tablink.style.display = "none";
//hide sections we don't want to see
tab2 = tab.substring(0,dashpos);
tabmain = d.getElementById(tab2);
tabmain.style.display = "none";
}
}
}
//]]>
</script>
EOD;
include
(
"head.inc"
);
?>
<body>
<?php
include
(
"fbegin.inc"
);
echo
"
\n\t
<script type=
\"
text/javascript
\"
src=
\"
/javascript/index/ajax.js
\"
></script>
\n
"
;
echo
$jscriptstr
;
?>
<?php
...
...
src/www/widgets/widgets/ipsec.widget.php
View file @
abdee6c4
...
...
@@ -106,7 +106,45 @@ if (isset($config['ipsec']['phase1'])) {
if
(
isset
(
$config
[
'ipsec'
][
'phase2'
]))
{
?>
<script
type=
"text/javascript"
>
function
changeTabDIV
(
selectedDiv
){
var
dashpos
=
selectedDiv
.
indexOf
(
"
-
"
);
var
tabclass
=
selectedDiv
.
substring
(
0
,
dashpos
);
d
=
document
;
//get deactive tabs first
tabclass
=
tabclass
+
"
-class-tabdeactive
"
;
var
tabs
=
document
.
getElementsByClassName
(
tabclass
);
var
incTabSelected
=
selectedDiv
+
"
-deactive
"
;
for
(
i
=
0
;
i
<
tabs
.
length
;
i
++
){
var
tab
=
tabs
[
i
].
id
;
dashpos
=
tab
.
lastIndexOf
(
"
-
"
);
var
tab2
=
tab
.
substring
(
0
,
dashpos
)
+
"
-deactive
"
;
if
(
tab2
==
incTabSelected
){
tablink
=
d
.
getElementById
(
tab2
);
tablink
.
style
.
display
=
"
none
"
;
tab2
=
tab
.
substring
(
0
,
dashpos
)
+
"
-active
"
;
tablink
=
d
.
getElementById
(
tab2
);
tablink
.
style
.
display
=
"
table-cell
"
;
//now show main div associated with link clicked
tabmain
=
d
.
getElementById
(
selectedDiv
);
tabmain
.
style
.
display
=
"
block
"
;
}
else
{
tab2
=
tab
.
substring
(
0
,
dashpos
)
+
"
-deactive
"
;
tablink
=
d
.
getElementById
(
tab2
);
tablink
.
style
.
display
=
"
table-cell
"
;
tab2
=
tab
.
substring
(
0
,
dashpos
)
+
"
-active
"
;
tablink
=
d
.
getElementById
(
tab2
);
tablink
.
style
.
display
=
"
none
"
;
//hide sections we don't want to see
tab2
=
tab
.
substring
(
0
,
dashpos
);
tabmain
=
d
.
getElementById
(
tab2
);
tabmain
.
style
.
display
=
"
none
"
;
}
}
}
</script>
<div
id=
"ipsec-Overview"
style=
"display:block;background-color:#EEEEEE;"
>
<table
class=
"table table-striped"
>
<thead>
...
...
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