More NIU
[project/luci.git] / modules / niu / luasrc / controller / niu / dashboard.lua
1 --[[
2 LuCI - Lua Development Framework
3
4 Copyright 2009 Steven Barth <steven@midlink.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13 ]]--
14
15 local req = require
16 module "luci.controller.niu.dashboard"
17
18 function index()
19         local translate = require "luci.i18n".translate
20         local uci = require "luci.model.uci"
21
22         local root = node()
23         if not root.lock then
24                 root.target = alias("niu")
25                 root.index = true
26         end
27
28         entry({"niu"}, alias("niu", "dashboard"), "NIU", 10)
29         entry({"niu", "dashboard"}, call("dashboard"), "Dashboard", 1)
30 end
31
32 local require = req
33
34 function dashboard()
35         local dsp = require "luci.dispatcher"
36         local tpl = require "luci.template"
37         local utl = require "luci.util"
38         local uci = require "luci.model.uci"
39         local str = require "luci.store"
40         str.uci_state = str.uci_state or uci.cursor()
41
42         local nds = dsp.node("niu").nodes
43         tpl.render("niu/dashboard", {utl = utl, nodes = nds, dsp = dsp, tpl = tpl}) 
44 end