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
17dad5a7
Commit
17dad5a7
authored
May 26, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(menu, cleanup) move interface items to model, remove duplicate code
parent
3c854168
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
55 deletions
+19
-55
ControllerBase.php
...ense/mvc/app/controllers/OPNsense/Base/ControllerBase.php
+0
-17
MenuController.php
.../mvc/app/controllers/OPNsense/Core/Api/MenuController.php
+0
-20
MenuSystem.php
...opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php
+19
-0
head.inc
src/www/head.inc
+0
-18
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Base/ControllerBase.php
View file @
17dad5a7
...
@@ -203,23 +203,6 @@ class ControllerBase extends ControllerRoot
...
@@ -203,23 +203,6 @@ class ControllerBase extends ControllerRoot
// set translator
// set translator
$this
->
view
->
setVar
(
'lang'
,
$this
->
getTranslator
(
$cnf
));
$this
->
view
->
setVar
(
'lang'
,
$this
->
getTranslator
(
$cnf
));
$ifarr
=
array
();
foreach
(
$cnf
->
object
()
->
interfaces
->
children
()
as
$key
=>
$node
)
{
$ifarr
[
$key
]
=
!
empty
(
$node
->
descr
)
?
$node
->
descr
->
__toString
()
:
strtoupper
(
$key
);
}
natcasesort
(
$ifarr
);
$ordid
=
0
;
foreach
(
$ifarr
as
$key
=>
$descr
)
{
$menu
->
appendItem
(
'Interfaces'
,
$key
,
array
(
'url'
=>
'/interfaces.php?if='
.
$key
,
'visiblename'
=>
'['
.
$descr
.
']'
,
'cssclass'
=>
'fa fa-sitemap'
,
'order'
=>
$ordid
++
,
));
}
unset
(
$ifarr
);
$this
->
view
->
menuSystem
=
$menu
->
getItems
(
"/ui"
.
$this
->
router
->
getRewriteUri
());
$this
->
view
->
menuSystem
=
$menu
->
getItems
(
"/ui"
.
$this
->
router
->
getRewriteUri
());
// set theme in ui_theme template var, let template handle its defaults (if there is no theme).
// set theme in ui_theme template var, let template handle its defaults (if there is no theme).
...
...
src/opnsense/mvc/app/controllers/OPNsense/Core/Api/MenuController.php
View file @
17dad5a7
...
@@ -33,7 +33,6 @@ namespace OPNsense\Core\Api;
...
@@ -33,7 +33,6 @@ namespace OPNsense\Core\Api;
use
OPNsense\Base\ApiControllerBase
;
use
OPNsense\Base\ApiControllerBase
;
use
OPNsense\Base\Menu
;
use
OPNsense\Base\Menu
;
use
OPNsense\Core\ACL
;
use
OPNsense\Core\ACL
;
use
OPNsense\Core\Config
;
/**
/**
* Class MenuController
* Class MenuController
...
@@ -125,25 +124,6 @@ class MenuController extends ApiControllerBase
...
@@ -125,25 +124,6 @@ class MenuController extends ApiControllerBase
$this
->
username
=
$this
->
session
->
get
(
"Username"
);
$this
->
username
=
$this
->
session
->
get
(
"Username"
);
}
}
// add interfaces to "Interfaces" menu tab... kind of a hack, may need some improvement.
$cnf
=
Config
::
getInstance
();
$ifarr
=
array
();
foreach
(
$cnf
->
object
()
->
interfaces
->
children
()
as
$key
=>
$node
)
{
$ifarr
[
$key
]
=
!
empty
(
$node
->
descr
)
?
$node
->
descr
->
__toString
()
:
strtoupper
(
$key
);
}
natcasesort
(
$ifarr
);
$ordid
=
0
;
foreach
(
$ifarr
as
$key
=>
$descr
)
{
$menu
->
appendItem
(
'Interfaces'
,
$key
,
array
(
'url'
=>
'/interfaces.php?if='
.
$key
,
'visiblename'
=>
'['
.
$descr
.
']'
,
'cssclass'
=>
'fa fa-sitemap'
,
'order'
=>
$ordid
++
,
));
}
unset
(
$ifarr
);
// fetch menu items and apply acl
// fetch menu items and apply acl
$menu_items
=
$menu
->
getItems
(
$selected_uri
);
$menu_items
=
$menu
->
getItems
(
$selected_uri
);
$this
->
applyACL
(
$menu_items
,
$acl
);
$this
->
applyACL
(
$menu_items
,
$acl
);
...
...
src/opnsense/mvc/app/models/OPNsense/Base/Menu/MenuSystem.php
View file @
17dad5a7
...
@@ -29,6 +29,8 @@
...
@@ -29,6 +29,8 @@
*/
*/
namespace
OPNsense\Base\Menu
;
namespace
OPNsense\Base\Menu
;
use
OPNsense\Core\Config
;
/**
/**
* Class MenuSystem
* Class MenuSystem
* @package OPNsense\Base\Menu
* @package OPNsense\Base\Menu
...
@@ -101,6 +103,23 @@ class MenuSystem
...
@@ -101,6 +103,23 @@ class MenuSystem
}
}
}
}
}
}
// add interfaces to "Interfaces" menu tab... kind of a hack, may need some improvement.
$ifarr
=
array
();
foreach
(
Config
::
getInstance
()
->
object
()
->
interfaces
->
children
()
as
$key
=>
$node
)
{
$ifarr
[
$key
]
=
!
empty
(
$node
->
descr
)
?
$node
->
descr
->
__toString
()
:
strtoupper
(
$key
);
}
natcasesort
(
$ifarr
);
$ordid
=
0
;
foreach
(
$ifarr
as
$key
=>
$descr
)
{
$this
->
appendItem
(
'Interfaces'
,
$key
,
array
(
'url'
=>
'/interfaces.php?if='
.
$key
,
'visiblename'
=>
'['
.
$descr
.
']'
,
'cssclass'
=>
'fa fa-sitemap'
,
'order'
=>
$ordid
++
,
));
}
unset
(
$ifarr
);
}
}
/**
/**
...
...
src/www/head.inc
View file @
17dad5a7
...
@@ -15,24 +15,6 @@ function system_get_language_code() {
...
@@ -15,24 +15,6 @@ function system_get_language_code() {
// link menu system
// link menu system
$menu
=
new
OPNsense\Base\Menu\MenuSystem
();
$menu
=
new
OPNsense\Base\Menu\MenuSystem
();
// add interfaces to "Interfaces" menu tab... kind of a hack, may need some improvement.
$cnf
=
OPNsense\Core\Config
::
getInstance
();
$ifarr
=
array
();
foreach
(
$cnf
->
object
()
->
interfaces
->
children
()
as
$key
=>
$node
)
{
$ifarr
[
$key
]
=
!
empty
(
$node
->
descr
)
?
$node
->
descr
->
__toString
()
:
strtoupper
(
$key
);
}
natcasesort
(
$ifarr
);
$ordid
=
0
;
foreach
(
$ifarr
as
$key
=>
$descr
)
{
$menu
->
appendItem
(
'Interfaces'
,
$key
,
array
(
'url'
=>
'/interfaces.php?if='
.
$key
,
'visiblename'
=>
'['
.
$descr
.
']'
,
'cssclass'
=>
'fa fa-sitemap'
,
'order'
=>
$ordid
++
,
));
}
unset
(
$ifarr
);
$menuSystem
=
$menu
->
getItems
(
$_SERVER
[
'REQUEST_URI'
]);
$menuSystem
=
$menu
->
getItems
(
$_SERVER
[
'REQUEST_URI'
]);
/* XXX workaround for dashboard */
/* XXX workaround for dashboard */
...
...
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