luci-theme-freifunk-generic: fix JavaScript naming
[project/luci.git] / themes / luci-theme-freifunk-generic / luasrc / view / themes / freifunk-generic / header.htm
index e8b1c06..b453409 100644 (file)
@@ -1,23 +1,20 @@
 <%#
-LuCI - Lua Configuration Interface
-Copyright 2008 Steven Barth <steven@midlink.org>
-Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org>
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
+ Licensed to the public under the Apache License 2.0.
 -%>
 
 <%
-       local fs   = require "luci.fs"
+       local fs   = require "nixio.fs"
        local sys  = require "luci.sys"
+       local util = require "luci.util"
        local http = require "luci.http"
        local disp = require "luci.dispatcher"
+       local version = require "luci.version"
 
-       local hostname = sys.hostname()
-       local load1, load5, load15 = sys.loadavg()
+       local sysinfo = util.ubus("system", "info") or { }
+       local loadinfo = sysinfo.load or { 0, 0, 0 }
+       local boardinfo = util.ubus("system", "board") or { }
 
        local request  = disp.context.path
        local category = request[1]
@@ -48,20 +45,20 @@ You may obtain a copy of the License at
        local banner = false
        local show_comm = true
 
-       local lo = fs.glob("/www/luci-static/resources/custom_logo.*")
-       if lo[1] then
-               logo = string.gsub(lo[1], "/www", "")
+       local file
+       for file in fs.glob("/www/luci-static/resources/custom_logo.*") do
+               logo = string.gsub(file, "/www", "")
+               break
        end
 
-       local lon = fs.glob("/www/luci-static/resources/custom_logo_only.*")
-       if lon[1] then
-               logo = string.gsub(lon[1], "/www", "")
+       for file in fs.glob("/www/luci-static/resources/custom_logo_only.*") do
+               logo = string.gsub(file, "/www", "")
                show_comm = false
+               break
        end
 
-       local hea = fs.glob("/www/luci-static/resources/custom_header.*")
-       if hea[1] then
-               logo = string.gsub(hea[1], "/www", "")
+       for file in fs.glob("/www/luci-static/resources/custom_header.*") do
+               logo = string.gsub(file, "/www", "")
                show_comm = false
                banner = true
        end
@@ -87,7 +84,7 @@ You may obtain a copy of the License at
 <meta name="viewport" content="initial-scale=1.0" />
 <script type="text/javascript" src="<%=resource%>/xhr.js"></script>
 
-<title><%=striptags( hostname .. ( (node and node.title) and ' - ' .. translate(tostring(node.title)) or '')) %> - LuCI</title>
+<title><%=striptags( (boardinfo.hostname or "?") .. ( (node and node.title) and ' - ' .. translate(tostring(node.title)) or '')) %> - LuCI</title>
 </head>
 
 <body class="lang_<%=luci.i18n.context.lang%>">
@@ -126,9 +123,9 @@ You may obtain a copy of the License at
                        <%end%>
                </div>
                <div class="header_right">
-                       <%=luci.version.distversion%><br />
-                       <%:Load%>: <%="%.2f" % load1%> <%="%.2f" % load5%> <%="%.2f" % load15%><br />
-                       <%:Hostname%>: <%=hostname%><br />
+                       <%=version.distversion%><br />
+                       <%:Load%>: <%="%.2f" % (loadinfo[1] / 65535.0)%> <%="%.2f" % (loadinfo[2] / 65535.0)%> <%="%.2f" % (loadinfo[3] / 65535.0)%><br />
+                       <%:Hostname%>: <%=boardinfo.hostname or "?"%><br />
                        <span id="xhr_poll_status" style="display:none" onclick="XHR.running() ? XHR.halt() : XHR.run()">
                                <%:Auto Refresh%>:
                                <span id="xhr_poll_status_on"><%:on%></span>
@@ -219,8 +216,8 @@ if tree.nodes[category] and tree.nodes[category].ucidata then
 <% 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.%>
+               <strong><%:JavaScript required!%></strong><br />
+               <%:You must enable JavaScript in your browser or LuCI will not work properly.%>
        </div>
 </noscript>
 <% end %>