OXYGEN #2: Reorganized theme selection, added indexing support
authorSteven Barth <steven@midlink.org>
Fri, 10 Oct 2008 14:37:53 +0000 (14:37 +0000)
committerSteven Barth <steven@midlink.org>
Fri, 10 Oct 2008 14:37:53 +0000 (14:37 +0000)
libs/web/luasrc/dispatcher.lua
modules/admin-core/luasrc/view/footer.htm
modules/admin-core/luasrc/view/header.htm
modules/admin-core/luasrc/view/indexer.htm [new file with mode: 0644]

index fc56896..d03b2ec 100644 (file)
@@ -161,7 +161,7 @@ function dispatch(request)
        end
 
        -- Init template engine
        end
 
        -- Init template engine
-       if not track.notemplate then
+       if (c and c.index) or not track.notemplate then
                local tpl = require("luci.template")
                local media = luci.config.main.mediaurlbase
                if not pcall(tpl.Template, "themes/%s/header" % fs.basename(media)) then
                local tpl = require("luci.template")
                local media = luci.config.main.mediaurlbase
                if not pcall(tpl.Template, "themes/%s/header" % fs.basename(media)) then
@@ -183,6 +183,7 @@ function dispatch(request)
                viewns.striptags   = util.striptags
                viewns.controller  = luci.http.getenv("SCRIPT_NAME")
                viewns.media       = media
                viewns.striptags   = util.striptags
                viewns.controller  = luci.http.getenv("SCRIPT_NAME")
                viewns.media       = media
+               viewns.theme       = fs.basename(media)
                viewns.resource    = luci.config.main.resourcebase
                viewns.REQUEST_URI = (luci.http.getenv("SCRIPT_NAME") or "") .. (luci.http.getenv("PATH_INFO") or "")
        end
                viewns.resource    = luci.config.main.resourcebase
                viewns.REQUEST_URI = (luci.http.getenv("SCRIPT_NAME") or "") .. (luci.http.getenv("PATH_INFO") or "")
        end
@@ -231,6 +232,13 @@ function dispatch(request)
                luci.sys.process.setuser(track.setuser)
        end
 
                luci.sys.process.setuser(track.setuser)
        end
 
+       if c and c.index then
+               local tpl = require "luci.template"
+               if util.copcall(tpl.render, "indexer") then
+                       return true
+               end
+       end
+
        if c and type(c.target) == "function" then
                context.dispatched = c
 
        if c and type(c.target) == "function" then
                context.dispatched = c
 
index 8428e89..6c6d214 100644 (file)
@@ -12,4 +12,4 @@ You may obtain a copy of the License at
 $Id$
 
 -%>
 $Id$
 
 -%>
-<% include("themes/" .. luci.fs.basename(media) .. "/footer") %>
\ No newline at end of file
+<% include("themes/" .. theme .. "/footer") %>
\ No newline at end of file
index 07da7ef..6625e46 100644 (file)
@@ -12,4 +12,4 @@ You may obtain a copy of the License at
 $Id$
 
 -%>
 $Id$
 
 -%>
-<% include("themes/" .. luci.fs.basename(media) .. "/header") %>
\ No newline at end of file
+<% include("themes/" .. theme .. "/header") %>
\ No newline at end of file
diff --git a/modules/admin-core/luasrc/view/indexer.htm b/modules/admin-core/luasrc/view/indexer.htm
new file mode 100644 (file)
index 0000000..c628289
--- /dev/null
@@ -0,0 +1,15 @@
+<%#
+LuCI - Lua Configuration Interface
+Copyright 2008 Steven Barth <steven@midlink.org>
+Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+$Id$
+
+-%>
+<% include("themes/" .. theme .. "/indexer") %>
\ No newline at end of file