NIU: Initial
[project/luci.git] / modules / niu / luasrc / controller / niu / dashboard.lua
diff --git a/modules/niu/luasrc/controller/niu/dashboard.lua b/modules/niu/luasrc/controller/niu/dashboard.lua
new file mode 100644 (file)
index 0000000..e3270e4
--- /dev/null
@@ -0,0 +1,44 @@
+--[[
+LuCI - Lua Development Framework
+
+Copyright 2009 Steven Barth <steven@midlink.org>
+
+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$
+]]--
+
+local req = require
+module "luci.controller.niu.dashboard"
+
+function index()
+       local translate = require "luci.i18n".translate
+       local uci = require "luci.model.uci"
+
+       local root = node()
+       if not root.lock then
+               root.target = alias("niu")
+               root.index = true
+       end
+
+       entry({"niu"}, alias("niu", "dashboard"), "NIU", 10)
+       entry({"niu", "dashboard"}, call("dashboard"), "Dashboard", 1)
+end
+
+local require = req
+
+function dashboard()
+       local dsp = require "luci.dispatcher"
+       local tpl = require "luci.template"
+       local utl = require "luci.util"
+       local uci = require "luci.model.uci"
+       local str = require "luci.store"
+       str.uci_state = str.uci_state or uci.cursor()
+
+       local nds = dsp.node("niu").nodes
+       tpl.render("niu/dashboard", {utl = utl, nodes = nds, dsp = dsp, tpl = tpl}) 
+end