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
686378d9
Commit
686378d9
authored
May 04, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(dashboard, widgets) small style cleanups for legacy traffic graph
parent
e8600035
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
122 deletions
+107
-122
traffic_graphs.widget.php
src/www/widgets/widgets/traffic_graphs.widget.php
+107
-122
No files found.
src/www/widgets/widgets/traffic_graphs.widget.php
View file @
686378d9
<?php
/*
Copyright (C) 2014
Deciso B.V.
Copyright (C) 2014-2016
Deciso B.V.
Copyright 2007 Scott Dale
Copyright (C) 2004-2005 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net>
and Jonathan Watt <jwatt@jwatt.org>.
...
...
@@ -29,16 +29,12 @@
POSSIBILITY OF SUCH DAMAGE.
*/
$nocsrf
=
true
;
require_once
(
"guiconfig.inc"
);
require_once
(
"pfsense-utils.inc"
);
require_once
(
"interfaces.inc"
);
$first_time
=
false
;
if
(
!
is_array
(
$config
[
"widgets"
][
"trafficgraphs"
]))
{
$first_time
=
true
;
$config
[
"widgets"
][
"trafficgraphs"
]
=
array
();
}
$a_config
=
&
$config
[
"widgets"
][
"trafficgraphs"
];
...
...
@@ -78,7 +74,7 @@ $shown = array();
foreach
(
$a_config
[
"shown"
][
"item"
]
as
$if
)
{
$shown
[
$if
]
=
true
;
}
if
(
$first_time
)
{
if
(
count
(
$config
[
"widgets"
][
"trafficgraphs"
])
)
{
$keys
=
array_keys
(
$ifdescrs
);
$shown
[
$keys
[
0
]]
=
true
;
}
...
...
@@ -96,25 +92,21 @@ if (isset($a_config["scale_type"])) {
}
?>
<input
type=
"hidden"
id=
"traffic_graphs-config"
name=
"traffic_graphs-config"
value=
""
/>
<div
id=
"traffic_graphs-settings"
class=
"widgetconfigdiv"
style=
"display:none;"
>
<form
action=
"/widgets/widgets/traffic_graphs.widget.php"
method=
"post"
name=
"iform"
id=
"iform"
>
<?php
foreach
(
$ifdescrs
as
$ifname
=>
$ifdescr
)
{
?>
<?php
foreach
(
$ifdescrs
as
$ifname
=>
$ifdescr
)
:
?>
<
input
type
=
"hidden"
name
=
"shown[<?=
$ifname
?>]"
value
=
"<?=
$shown[$ifname]
? "
show
" : "
hide
" ?>"
/>
<?php
}
?>
<?
php
endforeach
;
?>
<table
class=
"table table-striped"
>
<tbody>
<tr>
<td>
<?=
gettext
(
'Default AutoScale:'
)
?>
</td>
</tr>
<?php
<?php
$scale_type_up
=
'checked="checked"'
;
$scale_type_follow
=
""
;
if
(
isset
(
$config
[
"widgets"
][
"trafficgraphs"
][
"scale_type"
]))
{
...
...
@@ -138,12 +130,13 @@ if (isset($a_config["scale_type"])) {
<input
name=
"scale_type"
type=
"radio"
id=
"scale_type_follow"
value=
"follow"
<?=
$scale_type_follow
;
?>
/>
<?=
gettext
(
'Scale follow'
)
?>
<br
/><br
/>
<?=
gettext
(
'Refresh Interval:'
)
?>
<select
name=
"refreshinterval"
class=
"formfld"
id=
"refreshinterval"
>
<?php
for
(
$i
=
1
;
$i
<=
10
;
$i
+=
1
)
{
<?php
for
(
$i
=
1
;
$i
<=
10
;
$i
+=
1
)
{
?>
<option
value=
"
<?=
$i
?>
"
<?php
if
(
$refreshinterval
==
$i
)
{
echo
'selected="selected"'
;
}
?>
>
<?=
$i
?>
</option>
<?php
<?php
}
?>
</select>
<?=
gettext
(
'Seconds'
)
?>
<br
/>
<b>
<?=
gettext
(
'Note:'
)
?>
</b>
<?=
gettext
(
'changing this setting will increase CPU utilization'
)
?>
<br
/><br
/>
</td>
...
...
@@ -168,7 +161,7 @@ if (isset($a_config["scale_type"])) {
</script>
<?php
foreach
(
$ifdescrs
as
$ifname
=>
$ifdescr
)
{
foreach
(
$ifdescrs
as
$ifname
=>
$ifdescr
)
:
$ifinfo
=
get_interface_info
(
$ifname
);
if
(
$shown
[
$ifname
])
{
$mingraphbutton
=
"inline"
;
...
...
@@ -181,35 +174,27 @@ foreach ($ifdescrs as $ifname => $ifdescr) {
$graphdisplay
=
"none"
;
$interfacevalue
=
"hide"
;
}
if
(
$ifinfo
[
'status'
]
!=
"down"
)
{
if
(
$ifinfo
[
'status'
]
!=
"down"
)
:
?>
<div
id=
"
<?=
$ifname
;
?>
trafficdiv"
style=
"padding: 5px"
>
<div
id=
"
<?=
$ifname
;
?>
topic"
class=
"widgetsubheader"
>
<div
style=
"float:left;width:49%"
>
<span
onclick=
"location.href='/status_graph.php?if=
<?=
$ifname
;
?>
'"
style=
"cursor:pointer"
>
<?=
sprintf
(
gettext
(
'Current %s Traffic'
),
$ifdescr
)
?>
</span>
<span
onclick=
"location.href='/status_graph.php?if=
<?=
$ifname
;
?>
'"
style=
"cursor:pointer"
>
<?=
sprintf
(
gettext
(
'Current %s Traffic'
),
$ifdescr
)
?>
</span>
</div>
<div
align=
"right"
style=
"float:right;width:49%"
>
<div
id=
"
<?=
$ifname
;
?>
graphdiv-min"
onclick=
'return trafficminimizeDiv("
<?=
$ifname
?>
", true);'
style=
"display:
<?php
echo
$mingraphbutton
;
?>
; cursor:pointer"
><span
class=
"glyphicon glyphicon-minus"
alt=
"Minimize
<?=
$ifname
;
?>
traffic graph"
/></span></div>
<div
id=
"
<?=
$ifname
;
?>
graphdiv-open"
onclick=
'return trafficshowDiv("
<?=
$ifname
?>
", true);'
style=
"display:
<?php
echo
$showgraphbutton
;
?>
; cursor:pointer"
><span
class=
"glyphicon glyphicon-plus"
alt=
"Show
<?=
$ifname
;
?>
traffic graph"
/></span></div>
<div
id=
"
<?=
$ifname
;
?>
graphdiv-min"
onclick=
'return trafficminimizeDiv("
<?=
$ifname
?>
", true);'
style=
"display:
<?=
$mingraphbutton
;
?>
; cursor:pointer"
><span
class=
"glyphicon glyphicon-minus"
alt=
"Minimize
<?=
$ifname
;
?>
traffic graph"
/></span></div>
<div
id=
"
<?=
$ifname
;
?>
graphdiv-open"
onclick=
'return trafficshowDiv("
<?=
$ifname
?>
", true);'
style=
"display:
<?=
$showgraphbutton
;
?>
; cursor:pointer"
><span
class=
"glyphicon glyphicon-plus"
alt=
"Show
<?=
$ifname
;
?>
traffic graph"
/></span></div>
</div>
<div
style=
"clear:both;"
></div>
</div>
<div
id=
"
<?=
$ifname
;
?>
graphdiv"
style=
"display:
<?=
$graphdisplay
;
?>
"
>
<object
data=
"graph.php?ifnum=
<?=
$ifname
;
?>
&ifname=
<?=
rawurlencode
(
$ifdescr
);
?>
&timeint=
<?=
$refreshinterval
;
?>
&initdelay=
<?=
(
$graphcounter
+
1
)
*
2
;
?>
"
height=
"100%"
width=
"100%"
>
<object
data=
"graph.php?ifnum=
<?=
$ifname
;
?>
&ifname=
<?=
rawurlencode
(
$ifdescr
);
?>
&timeint=
<?=
$refreshinterval
;
?>
&initdelay=
<?=
(
$graphcounter
+
1
)
*
2
;
?>
"
height=
"100%"
width=
"100%"
>
<param
name=
"id"
value=
"graph"
/>
<param
name=
"type"
value=
"image/svg+xml"
/>
<param
name=
"pluginspage"
value=
"http://www.adobe.com/svg/viewer/install/auto"
/>
</object>
</div>
</div>
<?php
}
}
<?php
endif
;
endforeach
;
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