summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMika Havela <mika.havela@gmail.com>2008-04-03 10:05:50 +0000
committerMika Havela <mika.havela@gmail.com>2008-04-03 10:05:50 +0000
commit8aca10a4efa86f69c37c295442e061685246f1b7 (patch)
tree2c87ef95d10e526ffdec656fdae4a78d139f7472 /app
parent82ee54ce32b64376e3d6c65594901907578cd523 (diff)
downloadacf-core-8aca10a4efa86f69c37c295442e061685246f1b7.tar.bz2
acf-core-8aca10a4efa86f69c37c295442e061685246f1b7.tar.xz
Updated the menubuilder so that submenus show.
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@904 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'app')
-rw-r--r--app/acf_www-controller.lua40
1 files changed, 13 insertions, 27 deletions
diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua
index 3b7d628..b9eea3e 100644
--- a/app/acf_www-controller.lua
+++ b/app/acf_www-controller.lua
@@ -24,12 +24,18 @@ function build_menus(self)
sessiondata.menu.mainmenu = m.get_menuitems(self.conf.appdir)
sessiondata.menu.submenu = m.get_submenuitems(self.conf.appdir)
+local temp
if sessiondata.userinfo == nil then
--we are dealing with an unknown user
p = {"ALL"}
--this will be whatever the "UNKNOWN" role is ... right now it is ALL
--temp should be the
-local temp = format.string_to_table(roll.get_roles_perm(self,p),",")
+temp = format.string_to_table(roll.get_roles_perm(self,p),",")
+else
+ --we don't need to figure out what permission have it is in sessiondata
+temp = format.string_to_table(sessiondata.userinfo.perm,",")
+end
+
--lets apply permissions
for a,b in pairs(sessiondata.menu.mainmenu) do
for k,v in pairs(temp) do
@@ -55,43 +61,23 @@ local temp = format.string_to_table(roll.get_roles_perm(self,p),",")
for c,d in pairs(sessiondata.menu.submenu[a]) do
for k,v in pairs(temp) do
local control,acti = string.match(v,"(%a+):(%a+)")
+ if (a == control) then
if sessiondata.menu.submenu[a][c].action == acti then
sessiondata.menu.submenu[a][c].match = "yes"
break
else
sessiondata.menu.submenu[a][c].match = "no"
end
- end
- end
- end
-else
- --we don't need to figure out what permission have it is in sessiondata
- local temp = format.string_to_table(sessiondata.userinfo.perm,",")
- for a,b in pairs(sessiondata.menu.mainmenu) do
- for e,f in pairs(temp) do
- local control,acti = string.match(f,"(%a+):(%a+)")
- if sessiondata.menu.mainmenu[a].controller == control then
- if sessiondata.menu.mainmenu[a].action == acti then
- sessiondata.menu.mainmenu[a].match = "yes"
- break
- else
- sessiondata.menu.mainmenu[a].match = "no"
- end
- else
- sessiondata.menu.mainmenu[a].match = "no"
- end
- if sessiondata.menu.mainmenu[a].controller == "menuhints" then
- sessiondata.menu.mainmenu[a].match = "yes"
end
- end
+ end
+ end
end
-end
local temptab = {}
for a,b in pairs(sessiondata.menu.mainmenu) do
if sessiondata.menu.mainmenu[a].match ~= "no" then
temptab[#temptab +1 ] = sessiondata.menu.mainmenu[a]
- end
+ end
end
sessiondata.menu.mainmenu = temptab
@@ -99,8 +85,8 @@ end
for c,d in pairs(sessiondata.menu.submenu) do
for e,f in pairs(sessiondata.menu.submenu[c]) do
if sessiondata.menu.submenu[c][e].match ~= "no" then
- tempsub[#tempsub +1] = sessiondata.menu.submenu[c][e]
- --may need this to be c
+ if not (tempsub[c]) then tempsub[c] = {} end
+ tempsub[c][#tempsub[c] +1] = sessiondata.menu.submenu[c][e]
end
end
end