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
8591636a
Commit
8591636a
authored
Jun 29, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup js in widgets/ipsec.widget.php for
https://github.com/opnsense/core/issues/1005
parent
8fd415a9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
78 deletions
+28
-78
ipsec.widget.php
src/www/widgets/widgets/ipsec.widget.php
+28
-78
No files found.
src/www/widgets/widgets/ipsec.widget.php
View file @
8591636a
...
@@ -34,42 +34,9 @@ require_once("guiconfig.inc");
...
@@ -34,42 +34,9 @@ require_once("guiconfig.inc");
$ipsec_detail_array
=
array
();
$ipsec_detail_array
=
array
();
$ipsec_tunnels
=
array
();
$ipsec_tunnels
=
array
();
$ipsec_leases
=
array
();
$ipsec_leases
=
array
();
$activetunnels
=
0
;
if
(
isset
(
$config
[
'ipsec'
][
'phase1'
]))
{
if
(
isset
(
$config
[
'ipsec'
][
'phase1'
]))
{
echo
"<div> </div>
\n
"
;
$tab_array
=
array
();
$tab_array
[]
=
array
(
gettext
(
"Overview"
),
true
,
"ipsec-Overview"
);
$tab_array
[]
=
array
(
gettext
(
"Tunnels"
),
false
,
"ipsec-tunnel"
);
$tab_array
[]
=
array
(
gettext
(
"Mobile"
),
false
,
"ipsec-mobile"
);
echo
"<div id=
\"
tabs
\"
>"
;
$tabscounter
=
0
;
foreach
(
$tab_array
as
$ta
)
{
$dashpos
=
strpos
(
$ta
[
2
],
'-'
);
$tabname
=
$ta
[
2
]
.
"-tab"
;
$tabclass
=
substr
(
$ta
[
2
],
0
,
$dashpos
);
$tabclass
=
$tabclass
.
"-class"
;
if
(
$ta
[
1
]
==
true
)
{
$tabActive
=
"table-cell"
;
$tabNonActive
=
"none"
;
}
else
{
$tabActive
=
"none"
;
$tabNonActive
=
"table-cell"
;
}
echo
"<div id=
\"
{
$ta
[
2
]
}
-active
\"
class=
\"
{
$tabclass
}
-tabactive
\"
style=
\"
display:
{
$tabActive
}
; background-color:#EEEEEE; color:black;
\"
>"
;
echo
"<b>
{
$ta
[
0
]
}
"
;
echo
" </b>"
;
echo
"</div>"
;
echo
"<div id=
\"
{
$ta
[
2
]
}
-deactive
\"
class=
\"
{
$tabclass
}
-tabdeactive
\"
style=
\"
display:
{
$tabNonActive
}
; background-color:#777777; color:white; cursor: pointer;
\"
onclick=
\"
return changeTabDIV('
{
$ta
[
2
]
}
')
\"
>"
;
echo
"<b>
{
$ta
[
0
]
}
"
;
echo
" </b>"
;
echo
"</div>"
;
}
echo
"</div>"
;
$ipsec_leases
=
json_decode
(
configd_run
(
"ipsec list leases"
),
true
);
$ipsec_leases
=
json_decode
(
configd_run
(
"ipsec list leases"
),
true
);
if
(
$ipsec_leases
==
null
)
{
if
(
$ipsec_leases
==
null
)
{
$ipsec_leases
=
array
();
$ipsec_leases
=
array
();
...
@@ -81,8 +48,6 @@ if (isset($config['ipsec']['phase1'])) {
...
@@ -81,8 +48,6 @@ if (isset($config['ipsec']['phase1'])) {
}
}
// parse configured tunnels
// parse configured tunnels
$activetunnels
=
0
;
foreach
(
$ipsec_status
as
$status_key
=>
$status_value
)
{
foreach
(
$ipsec_status
as
$status_key
=>
$status_value
)
{
if
(
isset
(
$status_value
[
'children'
]))
{
if
(
isset
(
$status_value
[
'children'
]))
{
foreach
(
$status_value
[
'children'
]
as
$child_status_key
=>
$child_status_value
)
{
foreach
(
$status_value
[
'children'
]
as
$child_status_key
=>
$child_status_value
)
{
...
@@ -90,8 +55,8 @@ if (isset($config['ipsec']['phase1'])) {
...
@@ -90,8 +55,8 @@ if (isset($config['ipsec']['phase1'])) {
'local-addrs'
=>
$status_value
[
'local-addrs'
],
'local-addrs'
=>
$status_value
[
'local-addrs'
],
'remote-addrs'
=>
$status_value
[
'remote-addrs'
],
'remote-addrs'
=>
$status_value
[
'remote-addrs'
],
);
);
$ipsec_tunnels
[
$child_status_key
][
'local-ts'
]
=
implode
(
','
,
$child_status_value
[
'local-ts'
]);
$ipsec_tunnels
[
$child_status_key
][
'local-ts'
]
=
implode
(
',
'
,
$child_status_value
[
'local-ts'
]);
$ipsec_tunnels
[
$child_status_key
][
'remote-ts'
]
=
implode
(
','
,
$child_status_value
[
'remote-ts'
]);
$ipsec_tunnels
[
$child_status_key
][
'remote-ts'
]
=
implode
(
',
'
,
$child_status_value
[
'remote-ts'
]);
}
}
}
}
foreach
(
$status_value
[
'sas'
]
as
$sas_key
=>
$sas_value
)
{
foreach
(
$status_value
[
'sas'
]
as
$sas_key
=>
$sas_value
)
{
...
@@ -106,45 +71,30 @@ if (isset($config['ipsec']['phase1'])) {
...
@@ -106,45 +71,30 @@ if (isset($config['ipsec']['phase1'])) {
if
(
isset
(
$config
[
'ipsec'
][
'phase2'
]))
{
if
(
isset
(
$config
[
'ipsec'
][
'phase2'
]))
{
?>
?>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
function
changeTabDIV
(
selectedDiv
){
$
(
document
).
ready
(
function
()
{
var
dashpos
=
selectedDiv
.
indexOf
(
"
-
"
);
$
(
"
.ipsec-tab
"
).
click
(
function
(){
var
tabclass
=
selectedDiv
.
substring
(
0
,
dashpos
);
$
(
"
.ipsec-tab
"
).
css
(
'
background-color
'
,
'
#777777
'
);
d
=
document
;
$
(
"
.ipsec-tab
"
).
css
(
'
color
'
,
'
white
'
);
//get deactive tabs first
$
(
this
).
css
(
'
background-color
'
,
'
#EEEEEE
'
);
tabclass
=
tabclass
+
"
-class-tabdeactive
"
;
$
(
this
).
css
(
'
color
'
,
'
black
'
);
var
tabs
=
document
.
getElementsByClassName
(
tabclass
);
$
(
"
.ipsec-tab-content
"
).
hide
();
var
incTabSelected
=
selectedDiv
+
"
-deactive
"
;
$
(
"
#
"
+
$
(
this
).
attr
(
'
for
'
)).
show
();
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>
</script>
<div
id=
"ipsec-Overview"
style=
"display:block;background-color:#EEEEEE;"
>
<div
id=
"tabs"
>
<div
for=
"ipsec-Overview"
class=
"ipsec-tab table-cell"
style=
"background-color:#EEEEEE; color:black; cursor: pointer; display:table-cell"
>
<strong>
<?=
gettext
(
"Overview"
);
?>
</strong>
</div>
<div
for=
"ipsec-tunnel"
class=
"ipsec-tab table-cell"
style=
"background-color:#777777; color:white; cursor: pointer; display:table-cell"
>
<strong>
<?=
gettext
(
"Tunnels"
);
?>
</strong>
</div>
<div
for=
"ipsec-mobile"
class=
"ipsec-tab table-cell"
style=
"background-color:#777777; color:white; cursor: pointer; display:table-cell"
>
<strong>
<?=
gettext
(
"Mobile"
);
?>
</strong>
</div>
</div>
<div
id=
"ipsec-Overview"
class=
"ipsec-tab-content"
style=
"display:block;background-color:#EEEEEE;"
>
<table
class=
"table table-striped"
>
<table
class=
"table table-striped"
>
<thead>
<thead>
<tr>
<tr>
...
@@ -176,7 +126,7 @@ if (isset($config['ipsec']['phase2'])) {
...
@@ -176,7 +126,7 @@ if (isset($config['ipsec']['phase2'])) {
</table>
</table>
</div>
</div>
<div
id=
"ipsec-tunnel"
style=
"display:none;background-color:#EEEEEE;"
>
<div
id=
"ipsec-tunnel"
class=
"ipsec-tab-content"
style=
"display:none;background-color:#EEEEEE;"
>
<table
class=
"table table-striped"
>
<table
class=
"table table-striped"
>
<thead>
<thead>
<tr>
<tr>
...
@@ -212,7 +162,7 @@ if (isset($config['ipsec']['phase2'])) {
...
@@ -212,7 +162,7 @@ if (isset($config['ipsec']['phase2'])) {
</tbody>
</tbody>
</table>
</table>
</div>
</div>
<div
id=
"ipsec-mobile"
style=
"display:none;background-color:#EEEEEE;"
>
<div
id=
"ipsec-mobile"
class=
"ipsec-tab-content"
style=
"display:none;background-color:#EEEEEE;"
>
<table
class=
"table table-striped"
>
<table
class=
"table table-striped"
>
<thead>
<thead>
<tr>
<tr>
...
...
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