5099d186fe650c2bb5c8a658f07924194d82235f
[project/luci.git] / themes / freifunk-bno / luasrc / view / themes / freifunk-bno / 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 local hostname = luci.sys.hostname()
24
25 local c = tree
26 for i,r in ipairs(request) do
27 if c.nodes and c.nodes[r] then
28 c = c.nodes[r]
29 c._menu_selected = true
30 end
31 end
32
33 require("luci.http").prepare_content("text/html")
34
35 -%>
36
37 <?xml version="1.0" encoding="utf-8"?>
38 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
39 <html xmlns="http://www.w3.org/1999/xhtml">
40 <head>
41 <link rel="stylesheet" type="text/css" href="<%=media%>/cascade.css" />
42 <% if node and node.css then %><link rel="stylesheet" type="text/css" href="<%=resource%>/<%=node.css%>" /><% end %>
43 <% if css then %><style title="text/css">
44 <%-= css %>
45 </style>
46 <% end -%>
47 <link rel="shortcut icon" href="<%=media%>/images/favicon.ico" />
48 <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
49 <meta http-equiv="content-script-type" content="text/javascript" />
50 <script type="text/javascript" src="<%=resource%>/xhr.js"></script>
51 <title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
52
53 <!--[if lt IE 7]>
54 <script type="text/javascript">
55 function setup_hover() {
56 function ie_hover(e) {
57 e.onmouseover = function() { this.className = "hover" }
58 e.onmouseout = function() { this.className = null }
59 }
60
61 var lis = document.getElementById("mainmenu").getElementsByTagName("LI");
62 var divs = document.getElementById("mainmenu").getElementsByTagName("DIV");
63
64 for( var i = 0; i < lis.length; i++ ) ie_hover( lis[i] );
65 for( var i = 0; i < divs.length; i++ ) ie_hover( divs[i] );
66 }
67 </script>
68 <![endif]-->
69 </head>
70 <body onload="window.setup_hover && setup_hover()">
71 <div id="all">
72 <center>
73
74 <div id="wrapper">
75 <%- if luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%>
76 <div class="warning">
77 <strong><%:No password set!%></strong><br />
78 <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%>
79 </div>
80 <%- end -%>
81 <div id="main">
82
83
84 <div id="header">
85 <div id="headerleft">
86 <div id="headerright">
87 <div id="headerback">
88 <div id="schriftzug"><img src="<%=media%>/images/schriftzug.gif" alt="Freifunk Nordost ueberschrift" name="Freifunk_nordost_ueberschrift" border="0"> </div>
89 <div id="logo"><img src="<%=media%>/images/logo.gif" alt="Freifunk Nordost logo" name="Freifunk_nordost" border="0"></a></div>
90 <div class="clear"></div>
91
92 </div>
93 </div>
94 </div>
95 </div>
96
97 <div class="pathbar separator black whitetext bold">
98 <%:Path%>: <%
99 local c = tree
100 local url = controller
101 for k,v in pairs(request) do
102 if c.nodes and c.nodes[v] then
103 c = c.nodes[v]
104 url = url .. "/" .. v
105 %><a href="<%=url%>"><%=pcdata(striptags(translate(c.title) or v))%></a> <% if k ~= #request then %>&#187; <% end
106 end
107 end
108 %>
109 </div>
110
111 <div class="menubar">
112 <div id="mainmenu" class="mainmenu">
113 <%-
114 local function submenu(prefix, node)
115 if not node.nodes or node.hidden then
116 return false
117 end
118 local index = {}
119 local count = 0
120 for k, n in pairs(node.nodes) do
121 if n.title and n.target then
122 table.insert(index, {name=k, order=n.order or 100})
123 count = count + 1
124 end
125 end
126
127 table.sort(index, function(a, b) return a.order < b.order end)
128
129 if count > 0 then
130 %>
131 <ul>
132 <%- for j, v in pairs(index) do
133 if not v.hidden and #v.name > 0 then
134 local nnode = node.nodes[v.name]
135 local href = controller .. prefix .. v.name
136 href = (nnode.query) and href .. luci.http.build_querystring(nnode.query) or href
137 %>
138 <li>
139 <span<% if nnode._menu_selected then %> class="active"<%end%>><a href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%></a></span>
140 <%- submenu(prefix .. v.name .. "/", nnode) %>
141 </li>
142 <%- end %>
143 <%- end %>
144 </ul>
145 <%-
146 end
147 end
148
149 if cattree and cattree.nodes then
150 local index = {}
151 for k, node in pairs(cattree.nodes) do
152 table.insert(index, {name=k, order=node.order or 100})
153 end
154
155 table.sort(index, function(a, b) return a.order < b.order end)
156
157 for i, k in ipairs(index) do
158 node = cattree.nodes[k.name]
159 if not node.hidden and node.title and node.target then
160 local href = controller.."/"..category.."/"..k.name
161 href = (k.query) and href .. luci.http.build_querystring(k.query) or href %>
162 <div<% if node._menu_selected then %> class="preactive"<%end%>><a href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(node.title)))%></a>
163 <%submenu("/" .. category .. "/" .. k.name .. "/", node)%>
164 </div>
165 <% end
166 end
167 end
168 %>
169 </div>
170 <div class="modemenu">
171 <ul><%
172 for k,node in pairs(tree.nodes) do
173 if node.title and not node.hidden then %>
174 <li<% if request[1] == k then %> class="active"<%end%>><a href="<%=controller%>/<%=k%>"><%=pcdata(striptags(translate(node.title)))%></a></li>
175 <% end
176 end%>
177 </ul>
178 </div>
179
180 <%
181 if tree.nodes[category] and tree.nodes[category].ucidata then
182 local ucic = 0
183
184 for i, j in pairs(require("luci.model.uci").cursor():changes()) do
185 for k, l in pairs(j) do
186 for m, n in pairs(l) do
187 ucic = ucic + 1;
188 end
189 end
190 end
191 %>
192 <div class="mainmenu" style="float:right; margin-right:2em">
193 <div>
194 <% if ucic > 0 then %>
195 <a class="warning" href="<%=controller%>/<%=category%>/uci/changes"><%:Unsaved Changes%>: <%=ucic%></a>
196 <% submenu("/" .. category .. "/uci/", tree.nodes[category].nodes["uci"]) -%>
197 <% else %>
198 <a href="#"><%:Changes%>: 0</a>
199 <% end %>
200 </div>
201 </div>
202 <% end %>
203
204 <br class="clear" />
205 </div>
206
207 <div id="maincontent">
208 <% if category ~= "freifunk" and category ~= "splash" then %>
209 <noscript>
210 <div class="errorbox">
211 <strong><%:Java Script required!%></strong><br />
212 <%:You must enable Java Script in your browser or LuCI will not work properly.%>
213 </div>
214 </noscript>
215 <% end %>