Added copyright-tags to templates
[project/luci.git] / themes / fledermaus / luasrc / view / themes / fledermaus / header.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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 <%
16 require("luci.sys")
17 local load1, load5, load15 = luci.sys.loadavg()
18 local request  = require("luci.dispatcher").context.path
19 local category = request[1]
20 local tree     = luci.dispatcher.node()
21 local cattree  = category and luci.dispatcher.node(category)
22 local node     = luci.dispatcher.context.dispatched 
23
24 local c = tree
25 for i,r in ipairs(request) do
26         if c.nodes and c.nodes[r] then 
27                 c = c.nodes[r]
28                 c._menu_selected = true
29         end
30 end
31
32 require("luci.i18n").loadc("default")
33
34 require("luci.http").prepare_content("text/html")
35 %><?xml version="1.0" encoding="utf-8"?>
36 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
37 <html xmlns="http://www.w3.org/1999/xhtml">
38 <head>
39         <link rel="stylesheet" type="text/css" href="<%=media%>/cascade.css" />
40         <% if node and node.css then %><link rel="stylesheet" type="text/css" href="<%=resource%>/<%=node.css%>" /><% end %>
41         <meta http-equiv="content-type" content="text/xhtml+xml; charset=utf-8" />
42         <meta http-equiv="content-script-type" content="text/javascript" />
43         <title>LuCI - Lua Configuration Interface - <%=(node and node.title)%></title>
44 </head>
45 <body>
46 <div id="header">
47         <div class="headerlogo left"><img src="<%=media%>/logo.png" alt="<%=luci.config.brand.title%>" /></div>
48         <div class="whitetext smalltext right">
49         <%=luci.config.brand.firmware%><br />
50         <%=luci.config.brand.distro%><br />
51         <%:load%>: <%=load1%> <%=load5%> <%=load15%><br />
52         <%:hostname%>: <%=luci.sys.hostname()%> 
53         </div>
54         <div>
55                 <span class="headertitle"><%=luci.config.brand.title%></span><br />
56                 <span class="whitetext bold"><%=luci.config.brand.subtitle%></span>
57         </div>
58 </div>
59
60 <div class="separator yellow bold">
61 <%:path%>: <% 
62 local c = tree
63 local url = controller
64 for k,v in pairs(request) do
65         if c.nodes and c.nodes[v] then
66                 c = c.nodes[v]
67                 url = url .. "/" .. v
68         %><a href="<%=url%>"><%=c.title or v%></a> <% if k ~= #request then %>&#187; <% end
69         end
70 end
71 %>
72 </div>
73
74 <div id="columns"><div id="columnswrapper">
75         <div class="sidebar left">
76 <%
77 local function submenu(prefix, node)
78         if not node._menu_selected or not node.nodes then
79                 return false
80         end
81         local index = {}        
82         for k, n in pairs(node.nodes) do
83                 if n.title and n.target then
84                         table.insert(index, {name=k, order=n.order or 100})
85                 end
86         end
87                 
88         table.sort(index, function(a, b) return a.order < b.order end)
89 %>
90         <ul>
91         <% for j, v in pairs(index) do 
92                 local nnode = node.nodes[v.name]
93                 local href = controller .. prefix .. v.name
94                 href = (nnode.query) and href .. luci.http.build_querystring(nnode.query) or href
95                 %>
96                 <li>
97                         <span<% if nnode._menu_selected then %> class="yellowtext"<%end%>><a href="<%=href%>"><%=nnode.title%></a></span>
98                         <% submenu(prefix .. v.name .. "/", nnode) %>
99                 </li>
100         <% end %>
101                 </ul> 
102 <%       
103 end
104
105 if cattree and cattree.nodes then
106         local index = {}        
107         for k, node in pairs(cattree.nodes) do
108                 table.insert(index, {name=k, order=node.order or 100})
109         end
110         
111         table.sort(index, function(a, b) return a.order < b.order end)
112
113         for i, k in ipairs(index) do
114                 node = cattree.nodes[k.name]
115                 if node.title and node.target then
116                         local href = controller.."/"..category.."/"..k.name
117                         href = (k.query) and href .. luci.http.build_querystring(k.query) or href %>
118                         <div<% if node._menu_selected then %> class="yellowtext"<%end%>><a href="<%=controller%>/<%=category%>/<%=k.name%>"><%=node.title%></a>                 
119                                 <%submenu("/" .. category .. "/" .. k.name .. "/", node)%>
120                         </div>
121 <%              end
122         end
123 end
124 %>              
125         </div>
126         <div class="sidebar right">
127                 <div><%:webui%>
128                         <ul><%
129                                 for k,node in pairs(tree.nodes) do
130                                         if node.title then %>
131                                                 <li<% if request[1] == k then %> class="yellowtext"<%end%>><a href="<%=controller%>/<%=k%>"><%=node.title%></a></li>
132 <%                                      end
133                                 end%>
134                         </ul>
135                 </div>
136                 <%
137                         if "admin" == request[1] then
138                                 local ucic = 0
139                                 for i, j in pairs(require("luci.model.uci").changes()) do
140                                         for k, l in pairs(j) do
141                                                 for m, n in pairs(l) do
142                                                         ucic = ucic + 1;
143                                                 end
144                                         end
145                                 end
146                 %>
147                 <div><%:config%>
148                         <ul>
149                         <% if ucic > 0 then %>
150                                 <li><a href="<%=controller%>/admin/uci/changes"><%:changes%>: <%=ucic%></a></li>
151                                 <li><a href="<%=controller%>/admin/uci/apply"><%:apply%></a></li>
152                                 <li><a href="<%=controller%>/admin/uci/revert"><%:revert%></a></li>
153                         <% else %>
154                                 <li><%:changes%>: 0</li>
155                         <% end %>
156                         </ul>
157                 </div>
158                 <% end %>
159         </div>
160         <div id="content">