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