X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=themes%2Fluci-theme-openwrt%2Fluasrc%2Fview%2Fthemes%2Fopenwrt.org%2Fheader.htm;h=d6db8e885e717b00bb6282e9ff21787294bb55fb;hp=e9c85921c6077a340995f538ac941db0d916bbc3;hb=731ed77c0;hpb=7a3493b1f7d75a3945279115324cf2ff4da26b7b diff --git a/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm b/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm index e9c85921c..d6db8e885 100644 --- a/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm +++ b/themes/luci-theme-openwrt/luasrc/view/themes/openwrt.org/header.htm @@ -1,6 +1,6 @@ <%# Copyright 2008 Steven Barth - Copyright 2008-2010 Jo-Philipp Wich + Copyright 2008-2010 Jo-Philipp Wich Licensed to the public under the Apache License 2.0. -%> @@ -9,6 +9,7 @@ local util = require "luci.util" local http = require "luci.http" local disp = require "luci.dispatcher" + local ver = require "luci.version" local sysinfo = util.ubus("system", "info") or { } local loadinfo = sysinfo.load or { 0, 0, 0 } @@ -41,24 +42,24 @@ http.prepare_content("application/xhtml+xml") local function nodeurl(prefix, name, query) - local url = controller .. prefix .. name .. "/" + local u = url(prefix, name) if query then - url = url .. http.build_querystring(query) + u = u .. http.build_querystring(query) end - return pcdata(url) + return pcdata(u) end - local function subtree(prefix, node, level) + local function render_menu(prefix, node, level) if not level then level = 1 end local childs = disp.node_childs(node) if #childs > 0 then -%> -
-
    - <% + write('
      ' %{ + level, level + }) + local selected_node local selected_name local i, v @@ -69,22 +70,51 @@ selected_node = nnode selected_name = v end - %> -
    • - <%=striptags(translate(nnode.title))%> -
    • - <% + + write('
    • %s
    • ' %{ + v, (nnode._menu_selected or (node.leaf and v == leaf)) and 'active' or '', + nodeurl(prefix, v, nnode.query), + striptags(translate(nnode.title)) + }) end - %> -
    -
    -<% + + write('

') + if selected_node then - subtree(prefix .. selected_name .. "/", selected_node, level + 1) + render_menu(prefix .. "/" .. selected_name, selected_node, level + 1) end -%> -
-<% + + write('') + end + end + + local function render_changes() + if tree.nodes[category] and tree.nodes[category].ucidata then + local ucic = 0 + for i, j in pairs(require("luci.model.uci").cursor():changes()) do + for k, l in pairs(j) do + for m, n in pairs(l) do + ucic = ucic + 1; + end + end + end + + write('
') + + if ucic > 0 then + write('%s: %d' %{ + url(category, 'uci/changes'), + http.urlencode(http.formvalue('redir') or table.concat(disp.context.request, "/")), + translate('Unsaved Changes'), + ucic + }) + else + write('%s: 0' %{ + translate('Unsaved Changes') + }) + end + + write('
') end end -%> @@ -119,8 +149,8 @@
- <%=(boardinfo.hostname or "?")%> | <%=luci.version.distversion%> | - <%:Load%>: <%="%.2f" % loadinfo[1] / 65535.0%> <%="%.2f" % loadinfo[2] / 65535.0%> <%="%.2f" % loadinfo[3] / 65535.0%> + <%=(boardinfo.hostname or "?")%> | <%=ver.distversion%> | + <%:Load%>: <%="%.2f" % (loadinfo[1] / 65535.0)%> <%="%.2f" % (loadinfo[2] / 65535.0)%> <%="%.2f" % (loadinfo[3] / 65535.0)%>
- <% if category then subtree("/" .. category .. "/", cattree) end %> + <% if category then render_menu(category, cattree) end %>