* luci/statistics: moving the graph controller to admin caused the images to be gener...
[project/luci.git] / libs / web / luasrc / dispatcher.lua
index cd481622b8f4e0bb06450ee72a5889f344978e5c..ef6c6881b4fa2b32d0ba206549c6531996eec7f7 100644 (file)
@@ -24,6 +24,7 @@ limitations under the License.
 
 ]]--
 module("luci.dispatcher", package.seeall)
+require("luci.init")
 require("luci.http")
 require("luci.sys")
 require("luci.fs")
@@ -293,20 +294,29 @@ function createtree()
        built_tree = true
 end
 
--- Shortcut for creating a dispatching node
-function entry(path, target, title, order, add)
-       add = add or {}
+-- Reassigns a node to another position
+function assign(path, clone, title, order)
+       local obj  = node(path)
+       obj.nodes  = nil
+       obj.module = nil
+       
+       obj.title = title
+       obj.order = order
+       
+       setmetatable(obj, {__index = clone})
+       
+       return obj
+end
 
+-- Shortcut for creating a dispatching node
+function entry(path, target, title, order)
        local c = node(path)
+       
        c.target = target
        c.title  = title
        c.order  = order
        c.module = getfenv(2)._NAME
 
-       for k,v in pairs(add) do
-               c[k] = v
-       end
-
        return c
 end
 
@@ -326,6 +336,8 @@ function node(...)
                c = c.nodes[v]
        end
 
+       c.path = arg
+
        return c
 end