From 3d0ed18228038cbe885b8ee98d9bb9137dbb53ba Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Wed, 29 Oct 2008 19:40:40 +0000 Subject: [PATCH] * luci-0.8: backport admin shell fixes --- modules/admin-core/luasrc/view/about.htm | 1 + modules/admin-core/luasrc/view/header.htm | 2 +- modules/admin-core/luasrc/view/sysauth.htm | 4 ++-- modules/admin-core/root/sbin/luci-flash | 4 ---- .../luasrc/controller/admin/index.lua | 3 +++ .../luasrc/controller/admin/network.lua | 4 ++++ .../luasrc/controller/admin/services.lua | 1 + .../luasrc/controller/admin/status.lua | 2 +- .../luasrc/controller/admin/system.lua | 3 ++- .../admin-full/luasrc/controller/admin/uci.lua | 10 ++++++---- .../luasrc/model/cbi/admin_index/luci.lua | 13 ++++++++++--- .../luasrc/model/cbi/admin_network/network.lua | 17 +++++++++-------- .../luasrc/model/cbi/admin_network/wifi.lua | 6 +++--- .../admin-full/luasrc/view/admin_uci/apply.htm | 10 ++++++++++ .../luasrc/view/admin_uci/changes.htm | 10 ++++++++++ .../admin-full/luasrc/view/admin_uci/revert.htm | 10 ++++++++++ .../admin-mini/luasrc/controller/mini/index.lua | 6 ++++-- .../luasrc/controller/mini/network.lua | 2 +- .../luasrc/controller/mini/system.lua | 3 ++- 19 files changed, 80 insertions(+), 31 deletions(-) diff --git a/modules/admin-core/luasrc/view/about.htm b/modules/admin-core/luasrc/view/about.htm index ea20d1b11..529649cc2 100644 --- a/modules/admin-core/luasrc/view/about.htm +++ b/modules/admin-core/luasrc/view/about.htm @@ -32,6 +32,7 @@ $Id$
  • Anton "xyron" Popov
  • Florian Fainelli (OpenWrt)
  • Alina Friedrichsen
  • +
  • Yanira

  • diff --git a/modules/admin-core/luasrc/view/header.htm b/modules/admin-core/luasrc/view/header.htm index 07da7ef58..6625e46b0 100644 --- a/modules/admin-core/luasrc/view/header.htm +++ b/modules/admin-core/luasrc/view/header.htm @@ -12,4 +12,4 @@ You may obtain a copy of the License at $Id$ -%> -<% include("themes/" .. luci.fs.basename(media) .. "/header") %> \ No newline at end of file +<% include("themes/" .. theme .. "/header") %> \ No newline at end of file diff --git a/modules/admin-core/luasrc/view/sysauth.htm b/modules/admin-core/luasrc/view/sysauth.htm index 49652400f..a49d80786 100644 --- a/modules/admin-core/luasrc/view/sysauth.htm +++ b/modules/admin-core/luasrc/view/sysauth.htm @@ -15,7 +15,7 @@ $Id$ <%+header%> <% luci.i18n.loadc("sysauth") %> -
    +">

    <%:sysauth_head%>

    @@ -41,7 +41,7 @@ $Id$
    -
    +
    diff --git a/modules/admin-core/root/sbin/luci-flash b/modules/admin-core/root/sbin/luci-flash index 99d614dda..819be40b5 100755 --- a/modules/admin-core/root/sbin/luci-flash +++ b/modules/admin-core/root/sbin/luci-flash @@ -85,9 +85,5 @@ done [ -n "$sysupgrade_init_conffiles" ] && do_save_conffiles run_hooks "" $sysupgrade_pre_upgrade -ask_bool() { - false -} - v "Switching to ramdisk..." run_ramfs '. /etc/functions.sh; include /lib/upgrade; do_upgrade' diff --git a/modules/admin-full/luasrc/controller/admin/index.lua b/modules/admin-full/luasrc/controller/admin/index.lua index cab9441d0..071dd595d 100644 --- a/modules/admin-full/luasrc/controller/admin/index.lua +++ b/modules/admin-full/luasrc/controller/admin/index.lua @@ -20,6 +20,7 @@ function index() local root = node() if not root.target then root.target = alias("admin") + root.index = true end entry({"about"}, template("about")).i18n = "admin-core" @@ -32,11 +33,13 @@ function index() page.sysauth = "root" page.sysauth_authenticator = "htmlauth" page.ucidata = true + page.index = true local page = node("admin", "index") page.target = template("admin_index/index") page.title = i18n("overview", "Übersicht") page.order = 10 + page.index = true local page = node("admin", "index", "luci") page.target = cbi("admin_index/luci") diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua index e3f80a1b1..778a70fb9 100644 --- a/modules/admin-full/luasrc/controller/admin/network.lua +++ b/modules/admin-full/luasrc/controller/admin/network.lua @@ -22,6 +22,7 @@ function index() page.target = alias("admin", "network", "network") page.title = i18n("network") page.order = 50 + page.index = true local page = node("admin", "network", "vlan") page.target = cbi("admin_network/vlan") @@ -33,6 +34,7 @@ function index() page.title = i18n("wifi") page.i18n = "wifi" page.order = 15 + page.subindex = true uci:foreach("wireless", "wifi-device", function (section) local ifc = section[".name"] @@ -51,6 +53,7 @@ function index() page.target = cbi("admin_network/network") page.title = i18n("interfaces", "Schnittstellen") page.order = 10 + page.subindex = true uci:foreach("network", "interface", function (section) local ifc = section[".name"] @@ -70,6 +73,7 @@ function index() page.target = cbi("admin_network/dhcp") page.title = "DHCP" page.order = 30 + page.subindex = true entry( {"admin", "network", "dhcp", "leases"}, diff --git a/modules/admin-full/luasrc/controller/admin/services.lua b/modules/admin-full/luasrc/controller/admin/services.lua index ea8758544..f7bdb02d5 100644 --- a/modules/admin-full/luasrc/controller/admin/services.lua +++ b/modules/admin-full/luasrc/controller/admin/services.lua @@ -26,6 +26,7 @@ function index() page.target = template("admin_services/index") page.title = i18n("services", "Dienste") page.order = 40 + page.index = true local page = node("admin", "services", "httpd") page.target = cbi("admin_services/httpd") diff --git a/modules/admin-full/luasrc/controller/admin/status.lua b/modules/admin-full/luasrc/controller/admin/status.lua index 0eb3c1964..addc3ca74 100644 --- a/modules/admin-full/luasrc/controller/admin/status.lua +++ b/modules/admin-full/luasrc/controller/admin/status.lua @@ -17,7 +17,7 @@ function index() luci.i18n.loadc("admin-core") local i18n = luci.i18n.translate - entry({"admin", "status"}, template("admin_status/index"), i18n("status", "Status"), 20) + entry({"admin", "status"}, template("admin_status/index"), i18n("status", "Status"), 20).index = true entry({"admin", "status", "syslog"}, call("action_syslog"), i18n("syslog", "Systemprotokoll")) end diff --git a/modules/admin-full/luasrc/controller/admin/system.lua b/modules/admin-full/luasrc/controller/admin/system.lua index 415131c8d..1afdfc55e 100644 --- a/modules/admin-full/luasrc/controller/admin/system.lua +++ b/modules/admin-full/luasrc/controller/admin/system.lua @@ -17,7 +17,7 @@ function index() luci.i18n.loadc("admin-core") local i18n = luci.i18n.translate - entry({"admin", "system"}, alias("admin", "system", "system"), i18n("system"), 30) + entry({"admin", "system"}, alias("admin", "system", "system"), i18n("system"), 30).index = true entry({"admin", "system", "system"}, cbi("admin_system/system"), i18n("system"), 1) entry({"admin", "system", "packages"}, call("action_packages"), i18n("a_s_packages"), 10) entry({"admin", "system", "packages", "ipkg"}, form("admin_system/ipkg"), i18n("a_s_p_ipkg")) @@ -211,6 +211,7 @@ function action_upgrade() end end + luci.http.prepare_content("text/html") luci.template.render("admin_system/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail}) end diff --git a/modules/admin-full/luasrc/controller/admin/uci.lua b/modules/admin-full/luasrc/controller/admin/uci.lua index 53b3464f6..d313128ad 100644 --- a/modules/admin-full/luasrc/controller/admin/uci.lua +++ b/modules/admin-full/luasrc/controller/admin/uci.lua @@ -15,12 +15,14 @@ module("luci.controller.admin.uci", package.seeall) function index() local i18n = luci.i18n.translate + local redir = luci.http.formvalue("redir", true) or + luci.dispatcher.build_url(unpack(luci.dispatcher.context.request)) entry({"admin", "uci"}, nil, i18n("config")) - entry({"admin", "uci", "changes"}, call("action_changes"), i18n("changes"), 40) - entry({"admin", "uci", "revert"}, call("action_revert"), i18n("revert"), 30) - entry({"admin", "uci", "apply"}, call("action_apply"), i18n("apply"), 20) - entry({"admin", "uci", "saveapply"}, call("action_apply"), i18n("saveapply"), 10) + entry({"admin", "uci", "changes"}, call("action_changes"), i18n("changes"), 40).query = {redir=redir} + entry({"admin", "uci", "revert"}, call("action_revert"), i18n("revert"), 30).query = {redir=redir} + entry({"admin", "uci", "apply"}, call("action_apply"), i18n("apply"), 20).query = {redir=redir} + entry({"admin", "uci", "saveapply"}, call("action_apply"), i18n("saveapply"), 10).query = {redir=redir} end function convert_changes(changes) diff --git a/modules/admin-full/luasrc/model/cbi/admin_index/luci.lua b/modules/admin-full/luasrc/model/cbi/admin_index/luci.lua index 3fdccbf80..3de871044 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_index/luci.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_index/luci.lua @@ -12,16 +12,23 @@ You may obtain a copy of the License at $Id$ ]]-- require("luci.config") -m = Map("luci", translate("webui"), translate("a_i_luci1", +m = Map("luci", translate("webui"), translate("a_i_luci1", "Hier können Eigenschaften und die Funktionalität der Oberfläche angepasst werden.")) +-- force reload of global luci config namespace to reflect the changes +function m.commit_handler(self) + package.loaded["luci.config"] = nil + require("luci.config") +end + + c = m:section(NamedSection, "main", "core", translate("general")) l = c:option(ListValue, "lang", translate("language")) local i18ndir = luci.i18n.i18ndir .. "default." for k, v in pairs(luci.config.languages) do - if k:sub(1, 1) ~= "." and luci.fs.isfile(i18ndir .. k .. ".lua") then + if k:sub(1, 1) ~= "." and luci.fs.isfile(i18ndir .. k:gsub("_", "-") .. ".lua") then l:value(k, v) end end @@ -41,4 +48,4 @@ f = m:section(NamedSection, "flash_keep", "extern", translate("a_i_keepflash"), translate("a_i_keepflash1")) f.dynamic = true -return m \ No newline at end of file +return m diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/network.lua b/modules/admin-full/luasrc/model/cbi/admin_network/network.lua index dab4bb873..300535d6d 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/network.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/network.lua @@ -25,6 +25,7 @@ s = m:section(TypedSection, "interface", "") s.addremove = true s.extedit = luci.dispatcher.build_url("admin", "network", "network") .. "/%s" s.template = "cbi/tblsection" +s.override_scheme = true function s.filter(self, section) return section ~= "loopback" and section @@ -86,7 +87,7 @@ function hwaddr.cfgvalue(self, section) return luci.fs.readfile("/sys/class/net/" .. ix .. "/address") or luci.util.exec("ifconfig " .. ix):match(" ([A-F0-9:]+)%s*\n") or "n/a" - + end @@ -100,13 +101,13 @@ txrx = s:option(DummyValue, "_txrx") function txrx.cfgvalue(self, section) local ix = self.map:get(section, "ifname") - + local rx = netstat and netstat[ix] and netstat[ix][1] rx = rx and luci.tools.webadmin.byte_format(tonumber(rx)) or "-" - + local tx = netstat and netstat[ix] and netstat[ix][9] tx = tx and luci.tools.webadmin.byte_format(tonumber(tx)) or "-" - + return string.format("%s / %s", tx, rx) end @@ -114,14 +115,14 @@ errors = s:option(DummyValue, "_err") function errors.cfgvalue(self, section) local ix = self.map:get(section, "ifname") - + local rx = netstat and netstat[ix] and netstat[ix][3] local tx = netstat and netstat[ix] and netstat[ix][11] - + rx = rx and tostring(rx) or "-" tx = tx and tostring(tx) or "-" - + return string.format("%s / %s", tx, rx) end -return m \ No newline at end of file +return m diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua index f2454d9a3..c095cc529 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/wifi.lua @@ -126,7 +126,7 @@ function network.write(self, section, value) if not m.uci:get("network", value) then -- avoid "value not defined in enum" because network is not known yet s.override_scheme = true - + m:chain("network") m.uci:set("network", value, "interface") Value.write(self, section, value) @@ -315,11 +315,11 @@ if hwtype == "atheros" or hwtype == "mac80211" then eaptype:depends({mode="sta", encryption="wpa"}) eaptype:depends({mode="sta", encryption="wpa2i"}) - cacert = s:option(Value, "ca_cert", translate("a_w_cacert")) + cacert = s:option(FileUpload, "ca_cert", translate("a_w_cacert")) cacert:depends({mode="sta", encryption="wpa"}) cacert:depends({mode="sta", encryption="wpa2i"}) - privkey = s:option(Value, "priv_key", translate("a_w_tlsprivkey")) + privkey = s:option(FileUpload, "priv_key", translate("a_w_tlsprivkey")) privkey:depends({mode="sta", eap_type="TLS", encryption="wpa2i"}) privkey:depends({mode="sta", eap_type="TLS", encryption="wpa"}) diff --git a/modules/admin-full/luasrc/view/admin_uci/apply.htm b/modules/admin-full/luasrc/view/admin_uci/apply.htm index 8aa09c641..a908b6a8b 100644 --- a/modules/admin-full/luasrc/view/admin_uci/apply.htm +++ b/modules/admin-full/luasrc/view/admin_uci/apply.htm @@ -13,6 +13,11 @@ $Id$ -%> <%+header%> +
    +"><< <%:back%> +
    +
    +

    <%:config%>

    <%:uci_applied%>:

    <%=(changes or "-")%> @@ -26,4 +31,9 @@ while line do end fp:close() %> +
    +"><< <%:back%> +
    +
    +
    <%+footer%> \ No newline at end of file diff --git a/modules/admin-full/luasrc/view/admin_uci/changes.htm b/modules/admin-full/luasrc/view/admin_uci/changes.htm index da0d9f11c..6375aaf71 100644 --- a/modules/admin-full/luasrc/view/admin_uci/changes.htm +++ b/modules/admin-full/luasrc/view/admin_uci/changes.htm @@ -13,6 +13,11 @@ $Id$ -%> <%+header%> +
    +"><< <%:back%> +
    +
    +

    <%:config%>

    <%:changes%>

    <%=changes%> @@ -26,4 +31,9 @@ $Id$ + +
    +
    +"><< <%:back%> +
    <%+footer%> diff --git a/modules/admin-full/luasrc/view/admin_uci/revert.htm b/modules/admin-full/luasrc/view/admin_uci/revert.htm index 553ec7454..e8515dc41 100644 --- a/modules/admin-full/luasrc/view/admin_uci/revert.htm +++ b/modules/admin-full/luasrc/view/admin_uci/revert.htm @@ -13,7 +13,17 @@ $Id$ -%> <%+header%> +
    +"><< <%:back%> +
    +
    +

    <%:config%>

    <%:uci_reverted%>:

    <%=(changes or "-")%> +
    +"><< <%:back%> +
    +
    +
    <%+footer%> \ No newline at end of file diff --git a/modules/admin-mini/luasrc/controller/mini/index.lua b/modules/admin-mini/luasrc/controller/mini/index.lua index 77847dccc..4813b838e 100644 --- a/modules/admin-mini/luasrc/controller/mini/index.lua +++ b/modules/admin-mini/luasrc/controller/mini/index.lua @@ -22,6 +22,7 @@ function index() local root = node() if not root.lock then root.target = alias("mini") + root.index = true end entry({"about"}, template("about")).i18n = "admin-core" @@ -31,9 +32,10 @@ function index() page.sysauth = "root" page.sysauth_authenticator = "htmlauth" page.ucidata = true + page.index = true - entry({"mini", "index"}, alias("mini", "index", "index"), i18n("overview"), 10) - entry({"mini", "index", "index"}, form("mini/index"), i18n("general"), 1) + entry({"mini", "index"}, alias("mini", "index", "index"), i18n("overview"), 10).index = true + entry({"mini", "index", "index"}, form("mini/index"), i18n("general"), 1).ignoreindex = true entry({"mini", "index", "luci"}, cbi("mini/luci"), i18n("settings"), 10) entry({"mini", "index", "logout"}, call("action_logout"), i18n("logout")) end diff --git a/modules/admin-mini/luasrc/controller/mini/network.lua b/modules/admin-mini/luasrc/controller/mini/network.lua index e1a82e6c5..56ffc30f2 100644 --- a/modules/admin-mini/luasrc/controller/mini/network.lua +++ b/modules/admin-mini/luasrc/controller/mini/network.lua @@ -19,7 +19,7 @@ function index() luci.i18n.loadc("admin-core") local i18n = luci.i18n.translate - entry({"mini", "network"}, alias("mini", "network", "index"), i18n("network"), 20) + entry({"mini", "network"}, alias("mini", "network", "index"), i18n("network"), 20).index = true entry({"mini", "network", "index"}, cbi("mini/network"), i18n("general"), 1) entry({"mini", "network", "wifi"}, cbi("mini/wifi"), i18n("wifi"), 10).i18n="wifi" entry({"mini", "network", "dhcp"}, cbi("mini/dhcp"), "DHCP", 20) diff --git a/modules/admin-mini/luasrc/controller/mini/system.lua b/modules/admin-mini/luasrc/controller/mini/system.lua index e61d0a05c..9d0ef0c63 100644 --- a/modules/admin-mini/luasrc/controller/mini/system.lua +++ b/modules/admin-mini/luasrc/controller/mini/system.lua @@ -19,7 +19,7 @@ function index() luci.i18n.loadc("admin-core") local i18n = luci.i18n.translate - entry({"mini", "system"}, alias("mini", "system", "index"), i18n("system"), 40) + entry({"mini", "system"}, alias("mini", "system", "index"), i18n("system"), 40).index = true entry({"mini", "system", "index"}, cbi("mini/system"), i18n("general"), 1) entry({"mini", "system", "passwd"}, form("mini/passwd"), i18n("a_s_changepw"), 10) entry({"mini", "system", "backup"}, call("action_backup"), i18n("a_s_backup"), 80) @@ -108,6 +108,7 @@ function action_upgrade() end end + luci.http.prepare_content("text/html") luci.template.render("mini/upgrade", {sysupgrade=plat, ret=ret, keep_avail=keep_avail}) end -- 2.25.1