summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/acf_www-controller.lua18
-rw-r--r--app/template-html.lsp13
2 files changed, 13 insertions, 18 deletions
diff --git a/app/acf_www-controller.lua b/app/acf_www-controller.lua
index 12a7a43..ee7f344 100644
--- a/app/acf_www-controller.lua
+++ b/app/acf_www-controller.lua
@@ -34,19 +34,15 @@ local function build_menus(self)
local cat = cats[x]
for y = #cat.groups,1,-1 do
local group = cat.groups[y]
- if nil == permissions[group.prefix] or nil == permissions[group.prefix][group.controller] then
- table.remove(cat.groups, y)
- else
- for z = #group.tabs,1,-1 do
- local tab = group.tabs[z]
- if nil == permissions[group.prefix][group.controller][tab.action] then
- table.remove(group.tabs, z)
- end
- end
- if 0 == #group.tabs then
- table.remove(cat.groups, y)
+ for z = #group.tabs,1,-1 do
+ local tab = group.tabs[z]
+ if nil == permissions[tab.prefix] or nil == permissions[tab.prefix][tab.controller] or nil == permissions[tab.prefix][tab.controller][tab.action] then
+ table.remove(group.tabs, z)
end
end
+ if 0 == #group.tabs then
+ table.remove(cat.groups, y)
+ end
end
if 0 == #cat.groups then
table.remove(cats, x)
diff --git a/app/template-html.lsp b/app/template-html.lsp
index c1aeafd..2b0d58c 100644
--- a/app/template-html.lsp
+++ b/app/template-html.lsp
@@ -74,14 +74,13 @@ end
for x,cat in ipairs(session.menu.cats) do
io.write (string.format("\n\t\t\t\t<li>%s\n\t\t\t\t\t<ul>\n", html.html_escape(cat.name))) --start row
for y,group in ipairs(cat.groups) do
- if pageinfo.prefix == group.prefix and pageinfo.controller == group.controller then
+ class=""
+ if not tabs and group.controllers[pageinfo.prefix .. pageinfo.controller] then
class="class='selected'"
tabs = group.tabs
- else
- class=""
end
io.write (string.format("\t\t\t\t\t\t<li %s><a href=\"%s%s%s/%s\">%s</a></li>\n",
- class,html.html_escape(pageinfo.script),html.html_escape(group.prefix), html.html_escape(group.controller), html.html_escape(group.tabs[1].action), html.html_escape(group.name) ))
+ class,html.html_escape(pageinfo.script),html.html_escape(group.tabs[1].prefix), html.html_escape(group.tabs[1].controller), html.html_escape(group.tabs[1].action), html.html_escape(group.name) ))
end
io.write ( "\t\t\t\t\t</ul>" )
end
@@ -113,13 +112,13 @@ end
<ul>
<% local class="" %>
<% for x,tab in pairs(tabs or {}) do
- if tab.action == pageinfo.action then
+ if tab.prefix == pageinfo.prefix and tab.controller == pageinfo.controller and tab.action == pageinfo.action then
class="class='selected'"
else
class=""
end
- io.write (string.format('<li %s><a %s href="%s">%s</a></li>\n',
- class,class,html.html_escape(tab.action),html.html_escape(tab.name) ))
+ io.write (string.format('<li %s><a %s href="%s%s%s/%s">%s</a></li>\n',
+ class,class,html.html_escape(pageinfo.script),html.html_escape(tab.prefix),html.html_escape(tab.controller),html.html_escape(tab.action),html.html_escape(tab.name) ))
end
%>
</ul>