themes: add facility to include custom css
[project/luci.git] / themes / freifunk-bno / luasrc / view / themes / freifunk-bno / header.htm
index 94d7f0e..be03d87 100644 (file)
@@ -30,7 +30,7 @@ for i,r in ipairs(request) do
        end
 end
 
-require("luci.i18n").loadc("default")
+require("luci.i18n").loadc("base")
 require("luci.http").prepare_content("text/html")
 
 -%>
@@ -41,10 +41,15 @@ require("luci.http").prepare_content("text/html")
 <head>
        <link rel="stylesheet" type="text/css" href="<%=media%>/cascade.css" />
        <% if node and node.css then %><link rel="stylesheet" type="text/css" href="<%=resource%>/<%=node.css%>" /><% end %>
+       <% if css then %><style title="text/css">
+       <%-= css %>
+       </style>
+       <% end -%>
        <link rel="shortcut icon" href="<%=media%>/images/favicon.ico" />
        <meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
        <meta http-equiv="content-script-type" content="text/javascript" />
-       <title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. node.title or '')) %> - LuCI</title>
+       <script type="text/javascript" src="<%=resource%>/xhr.js"></script>
+       <title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(node.title) or '')) %> - LuCI</title>
 
        <!--[if lt IE 7]>
                <script type="text/javascript">
@@ -68,6 +73,12 @@ require("luci.http").prepare_content("text/html")
 <center>
 
 <div id="wrapper">
+<%- if luci.sys.user.getuser("root") and not luci.sys.user.getpasswd("root") then -%>
+       <div class="warning">
+               <strong><%:No password set!%></strong><br />
+               <%:There is no password set on this router. Please configure a root password to protect the web interface and enable SSH.%>
+       </div>
+<%- end -%>
 <div id="main">
 
 
@@ -92,7 +103,7 @@ for k,v in pairs(request) do
        if c.nodes and c.nodes[v] then
                c = c.nodes[v]
                url = url .. "/" .. v
-       %><a href="<%=url%>"><%=c.title or v%></a> <% if k ~= #request then %>&#187; <% end
+       %><a href="<%=url%>"><%=pcdata(striptags(translate(c.title) or v))%></a> <% if k ~= #request then %>&#187; <% end
        end
 end
 %>
@@ -126,7 +137,7 @@ local function submenu(prefix, node)
                        href = (nnode.query) and href .. luci.http.build_querystring(nnode.query) or href
                %>
                <li>
-                       <span<% if nnode._menu_selected then %> class="active"<%end%>><a href="<%=luci.util.pcdata(href)%>"><%=nnode.title%></a></span>
+                       <span<% if nnode._menu_selected then %> class="active"<%end%>><a href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(nnode.title)))%></a></span>
                        <%- submenu(prefix .. v.name .. "/", nnode) %>
                </li>
                <%- end %>
@@ -149,7 +160,7 @@ if cattree and cattree.nodes then
                if not node.hidden and node.title and node.target then
                        local href = controller.."/"..category.."/"..k.name
                        href = (k.query) and href .. luci.http.build_querystring(k.query) or href %>
-                       <div<% if node._menu_selected then %> class="preactive"<%end%>><a href="<%=href%>"><%=node.title%></a>
+                       <div<% if node._menu_selected then %> class="preactive"<%end%>><a href="<%=pcdata(href)%>"><%=pcdata(striptags(translate(node.title)))%></a>
                                <%submenu("/" .. category .. "/" .. k.name .. "/", node)%>
                        </div>
 <%             end
@@ -161,7 +172,7 @@ end
                <ul><%
                        for k,node in pairs(tree.nodes) do
                                if node.title and not node.hidden then %>
-                                       <li<% if request[1] == k then %> class="active"<%end%>><a href="<%=controller%>/<%=k%>"><%=node.title%></a></li>
+                                       <li<% if request[1] == k then %> class="active"<%end%>><a href="<%=controller%>/<%=k%>"><%=pcdata(striptags(translate(node.title)))%></a></li>
 <%                             end
                        end%>
                </ul>
@@ -193,4 +204,13 @@ end
 
        <br class="clear" />
 </div>
+
 <div id="maincontent">
+<% if category ~= "freifunk" and category ~= "splash" then %>
+<noscript>
+       <div class="errorbox">
+               <strong><%:Java Script required!%></strong><br />
+               <%:You must enable Java Script in your browser or LuCI will not work properly.%>
+       </div>
+</noscript>
+<% end %>