summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-mod-admin-full')
-rw-r--r--modules/luci-mod-admin-full/luasrc/controller/admin/index.lua4
-rw-r--r--modules/luci-mod-admin-full/luasrc/controller/admin/network.lua57
-rw-r--r--modules/luci-mod-admin-full/luasrc/controller/admin/status.lua23
-rw-r--r--modules/luci-mod-admin-full/luasrc/controller/admin/system.lua359
-rw-r--r--modules/luci-mod-admin-full/luasrc/controller/admin/uci.lua8
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua9
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua3
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm6
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm24
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm12
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm33
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm6
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm149
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm6
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm36
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm194
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm68
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm9
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_uci/apply.htm2
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_uci/changes.htm13
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_uci/revert.htm2
35 files changed, 591 insertions, 460 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/index.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/index.lua
index d00d546b64..cc8c2e3ae6 100644
--- a/modules/luci-mod-admin-full/luasrc/controller/admin/index.lua
+++ b/modules/luci-mod-admin-full/luasrc/controller/admin/index.lua
@@ -33,12 +33,10 @@ function action_logout()
if sid then
utl.ubus("session", "destroy", { ubus_rpc_session = sid })
- dsp.context.urltoken.stok = nil
-
luci.http.header("Set-Cookie", "sysauth=%s; expires=%s; path=%s/" %{
sid, 'Thu, 01 Jan 1970 01:00:00 GMT', dsp.build_url()
})
end
- luci.http.redirect(luci.dispatcher.build_url())
+ luci.http.redirect(dsp.build_url())
end
diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua
index 6e578e013c..879e54b249 100644
--- a/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua
+++ b/modules/luci-mod-admin-full/luasrc/controller/admin/network.lua
@@ -1,5 +1,5 @@
-- Copyright 2008 Steven Barth <steven@midlink.org>
--- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org>
+-- Copyright 2011-2015 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.admin.network", package.seeall)
@@ -43,22 +43,22 @@ function index()
end)
if has_wifi then
- page = entry({"admin", "network", "wireless_join"}, call("wifi_join"), nil)
+ page = entry({"admin", "network", "wireless_join"}, post("wifi_join"), nil)
page.leaf = true
- page = entry({"admin", "network", "wireless_add"}, call("wifi_add"), nil)
+ page = entry({"admin", "network", "wireless_add"}, post("wifi_add"), nil)
page.leaf = true
- page = entry({"admin", "network", "wireless_delete"}, call("wifi_delete"), nil)
+ page = entry({"admin", "network", "wireless_delete"}, post("wifi_delete"), nil)
page.leaf = true
page = entry({"admin", "network", "wireless_status"}, call("wifi_status"), nil)
page.leaf = true
- page = entry({"admin", "network", "wireless_reconnect"}, call("wifi_reconnect"), nil)
+ page = entry({"admin", "network", "wireless_reconnect"}, post("wifi_reconnect"), nil)
page.leaf = true
- page = entry({"admin", "network", "wireless_shutdown"}, call("wifi_shutdown"), nil)
+ page = entry({"admin", "network", "wireless_shutdown"}, post("wifi_shutdown"), nil)
page.leaf = true
page = entry({"admin", "network", "wireless"}, arcombine(template("admin_network/wifi_overview"), cbi("admin_network/wifi")), _("Wifi"), 15)
@@ -85,16 +85,16 @@ function index()
page = entry({"admin", "network", "iface_add"}, cbi("admin_network/iface_add"), nil)
page.leaf = true
- page = entry({"admin", "network", "iface_delete"}, call("iface_delete"), nil)
+ page = entry({"admin", "network", "iface_delete"}, post("iface_delete"), nil)
page.leaf = true
page = entry({"admin", "network", "iface_status"}, call("iface_status"), nil)
page.leaf = true
- page = entry({"admin", "network", "iface_reconnect"}, call("iface_reconnect"), nil)
+ page = entry({"admin", "network", "iface_reconnect"}, post("iface_reconnect"), nil)
page.leaf = true
- page = entry({"admin", "network", "iface_shutdown"}, call("iface_shutdown"), nil)
+ page = entry({"admin", "network", "iface_shutdown"}, post("iface_shutdown"), nil)
page.leaf = true
page = entry({"admin", "network", "network"}, arcombine(cbi("admin_network/network"), cbi("admin_network/ifaces")), _("Interfaces"), 10)
@@ -138,44 +138,33 @@ function index()
page.title = _("Diagnostics")
page.order = 60
- page = entry({"admin", "network", "diag_ping"}, call("diag_ping"), nil)
+ page = entry({"admin", "network", "diag_ping"}, post("diag_ping"), nil)
page.leaf = true
- page = entry({"admin", "network", "diag_nslookup"}, call("diag_nslookup"), nil)
+ page = entry({"admin", "network", "diag_nslookup"}, post("diag_nslookup"), nil)
page.leaf = true
- page = entry({"admin", "network", "diag_traceroute"}, call("diag_traceroute"), nil)
+ page = entry({"admin", "network", "diag_traceroute"}, post("diag_traceroute"), nil)
page.leaf = true
- page = entry({"admin", "network", "diag_ping6"}, call("diag_ping6"), nil)
+ page = entry({"admin", "network", "diag_ping6"}, post("diag_ping6"), nil)
page.leaf = true
- page = entry({"admin", "network", "diag_traceroute6"}, call("diag_traceroute6"), nil)
+ page = entry({"admin", "network", "diag_traceroute6"}, post("diag_traceroute6"), nil)
page.leaf = true
-- end
end
function wifi_join()
- local function param(x)
- return luci.http.formvalue(x)
- end
-
- local function ptable(x)
- x = param(x)
- return x and (type(x) ~= "table" and { x } or x) or {}
- end
-
- local dev = param("device")
- local ssid = param("join")
+ local tpl = require "luci.template"
+ local http = require "luci.http"
+ local dev = http.formvalue("device")
+ local ssid = http.formvalue("join")
if dev and ssid then
- local cancel = (param("cancel") or param("cbi.cancel")) and true or false
-
- if cancel then
- luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless_join?device=" .. dev))
- else
+ local cancel = (http.formvalue("cancel") or http.formvalue("cbi.cancel"))
+ if not cancel then
local cbi = require "luci.cbi"
- local tpl = require "luci.template"
local map = luci.cbi.load("admin_network/wifi_add")[1]
if map:parse() ~= cbi.FORM_DONE then
@@ -183,10 +172,12 @@ function wifi_join()
map:render()
tpl.render("footer")
end
+
+ return
end
- else
- luci.template.render("admin_network/wifi_join")
end
+
+ tpl.render("admin_network/wifi_join")
end
function wifi_add()
diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua
index 1ceb24d16a..24db1e4ff5 100644
--- a/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua
+++ b/modules/luci-mod-admin-full/luasrc/controller/admin/status.lua
@@ -7,7 +7,10 @@ module("luci.controller.admin.status", package.seeall)
function index()
entry({"admin", "status"}, alias("admin", "status", "overview"), _("Status"), 20).index = true
entry({"admin", "status", "overview"}, template("admin_status/index"), _("Overview"), 1)
- entry({"admin", "status", "iptables"}, call("action_iptables"), _("Firewall"), 2).leaf = true
+
+ entry({"admin", "status", "iptables"}, template("admin_status/iptables"), _("Firewall"), 2).leaf = true
+ entry({"admin", "status", "iptables_action"}, post("action_iptables")).leaf = true
+
entry({"admin", "status", "routes"}, template("admin_status/routes"), _("Routes"), 3)
entry({"admin", "status", "syslog"}, call("action_syslog"), _("System Log"), 4)
entry({"admin", "status", "dmesg"}, call("action_dmesg"), _("Kernel Log"), 5)
@@ -42,22 +45,16 @@ end
function action_iptables()
if luci.http.formvalue("zero") then
- if luci.http.formvalue("zero") == "6" then
- luci.util.exec("ip6tables -Z")
+ if luci.http.formvalue("family") == "6" then
+ luci.util.exec("/usr/sbin/ip6tables -Z")
else
- luci.util.exec("iptables -Z")
+ luci.util.exec("/usr/sbin/iptables -Z")
end
- luci.http.redirect(
- luci.dispatcher.build_url("admin", "status", "iptables")
- )
- elseif luci.http.formvalue("restart") == "1" then
+ elseif luci.http.formvalue("restart") then
luci.util.exec("/etc/init.d/firewall restart")
- luci.http.redirect(
- luci.dispatcher.build_url("admin", "status", "iptables")
- )
- else
- luci.template.render("admin_status/iptables")
end
+
+ luci.http.redirect(luci.dispatcher.build_url("admin/status/iptables"))
end
function action_bandwidth(iface)
diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua
index 1b38c6783c..cbba48cc25 100644
--- a/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua
+++ b/modules/luci-mod-admin-full/luasrc/controller/admin/system.lua
@@ -9,12 +9,12 @@ function index()
entry({"admin", "system"}, alias("admin", "system", "system"), _("System"), 30).index = true
entry({"admin", "system", "system"}, cbi("admin_system/system"), _("System"), 1)
- entry({"admin", "system", "clock_status"}, call("action_clock_status"))
+ entry({"admin", "system", "clock_status"}, post_on({ set = true }, "action_clock_status"))
entry({"admin", "system", "admin"}, cbi("admin_system/admin"), _("Administration"), 2)
if fs.access("/bin/opkg") then
- entry({"admin", "system", "packages"}, call("action_packages"), _("Software"), 10)
+ entry({"admin", "system", "packages"}, post_on({ exec = "1" }, "action_packages"), _("Software"), 10)
entry({"admin", "system", "packages", "ipkg"}, form("admin_system/ipkg"))
end
@@ -32,9 +32,16 @@ function index()
end
entry({"admin", "system", "flashops"}, call("action_flashops"), _("Backup / Flash Firmware"), 70)
+ entry({"admin", "system", "flashops", "reset"}, post("action_reset"))
+ entry({"admin", "system", "flashops", "backup"}, post("action_backup"))
entry({"admin", "system", "flashops", "backupfiles"}, form("admin_system/backupfiles"))
- entry({"admin", "system", "reboot"}, call("action_reboot"), _("Reboot"), 90)
+ -- call() instead of post() due to upload handling!
+ entry({"admin", "system", "flashops", "restore"}, call("action_restore"))
+ entry({"admin", "system", "flashops", "sysupgrade"}, call("action_sysupgrade"))
+
+ entry({"admin", "system", "reboot"}, template("admin_system/reboot"), _("Reboot"), 90)
+ entry({"admin", "system", "reboot", "call"}, post("action_reboot"))
end
function action_clock_status()
@@ -55,7 +62,8 @@ end
function action_packages()
local fs = require "nixio.fs"
local ipkg = require "luci.model.ipkg"
- local submit = luci.http.formvalue("submit")
+ local submit = (luci.http.formvalue("exec") == "1")
+ local update, upgrade
local changes = false
local install = { }
local remove = { }
@@ -75,59 +83,62 @@ function action_packages()
query = (query ~= '') and query or nil
- -- Packets to be installed
- local ninst = submit and luci.http.formvalue("install")
- local uinst = nil
-
- -- Install from URL
- local url = luci.http.formvalue("url")
- if url and url ~= '' and submit then
- uinst = url
- end
+ -- Modifying actions
+ if submit then
+ -- Packets to be installed
+ local ninst = luci.http.formvalue("install")
+ local uinst = nil
- -- Do install
- if ninst then
- install[ninst], out, err = ipkg.install(ninst)
- stdout[#stdout+1] = out
- stderr[#stderr+1] = err
- changes = true
- end
+ -- Install from URL
+ local url = luci.http.formvalue("url")
+ if url and url ~= '' then
+ uinst = url
+ end
- if uinst then
- local pkg
- for pkg in luci.util.imatch(uinst) do
- install[uinst], out, err = ipkg.install(pkg)
+ -- Do install
+ if ninst then
+ install[ninst], out, err = ipkg.install(ninst)
stdout[#stdout+1] = out
stderr[#stderr+1] = err
changes = true
end
- end
- -- Remove packets
- local rem = submit and luci.http.formvalue("remove")
- if rem then
- remove[rem], out, err = ipkg.remove(rem)
- stdout[#stdout+1] = out
- stderr[#stderr+1] = err
- changes = true
- end
+ if uinst then
+ local pkg
+ for pkg in luci.util.imatch(uinst) do
+ install[uinst], out, err = ipkg.install(pkg)
+ stdout[#stdout+1] = out
+ stderr[#stderr+1] = err
+ changes = true
+ end
+ end
+ -- Remove packets
+ local rem = luci.http.formvalue("remove")
+ if rem then
+ remove[rem], out, err = ipkg.remove(rem)
+ stdout[#stdout+1] = out
+ stderr[#stderr+1] = err
+ changes = true
+ end
- -- Update all packets
- local update = luci.http.formvalue("update")
- if update then
- update, out, err = ipkg.update()
- stdout[#stdout+1] = out
- stderr[#stderr+1] = err
- end
+
+ -- Update all packets
+ update = luci.http.formvalue("update")
+ if update then
+ update, out, err = ipkg.update()
+ stdout[#stdout+1] = out
+ stderr[#stderr+1] = err
+ end
- -- Upgrade all packets
- local upgrade = luci.http.formvalue("upgrade")
- if upgrade then
- upgrade, out, err = ipkg.upgrade()
- stdout[#stdout+1] = out
- stderr[#stderr+1] = err
+ -- Upgrade all packets
+ upgrade = luci.http.formvalue("upgrade")
+ if upgrade then
+ upgrade, out, err = ipkg.upgrade()
+ stdout[#stdout+1] = out
+ stderr[#stderr+1] = err
+ end
end
@@ -166,137 +177,185 @@ function action_packages()
end
end
-function action_flashops()
- local sys = require "luci.sys"
- local fs = require "nixio.fs"
-
- local upgrade_avail = fs.access("/lib/upgrade/platform.sh")
- local reset_avail = os.execute([[grep '"rootfs_data"' /proc/mtd >/dev/null 2>&1]]) == 0
+local function image_supported(image)
+ return (os.execute("sysupgrade -T %q >/dev/null" % image) == 0)
+end
- local restore_cmd = "tar -xzC/ >/dev/null 2>&1"
- local backup_cmd = "sysupgrade --create-backup - 2>/dev/null"
- local image_tmp = "/tmp/firmware.img"
+local function image_checksum(image)
+ return (luci.sys.exec("md5sum %q" % image):match("^([^%s]+)"))
+end
- local function image_supported()
- return (os.execute("sysupgrade -T %q >/dev/null" % image_tmp) == 0)
- end
+local function supports_sysupgrade()
+ return nixio.fs.access("/lib/upgrade/platform.sh")
+end
- local function image_checksum()
- return (luci.sys.exec("md5sum %q" % image_tmp):match("^([^%s]+)"))
- end
+local function supports_reset()
+ return (os.execute([[grep -sq '"rootfs_data"' /proc/mtd]]) == 0)
+end
- local function storage_size()
- local size = 0
- if fs.access("/proc/mtd") then
- for l in io.lines("/proc/mtd") do
- local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"')
- if n == "linux" or n == "firmware" then
- size = tonumber(s, 16)
- break
- end
+local function storage_size()
+ local size = 0
+ if nixio.fs.access("/proc/mtd") then
+ for l in io.lines("/proc/mtd") do
+ local d, s, e, n = l:match('^([^%s]+)%s+([^%s]+)%s+([^%s]+)%s+"([^%s]+)"')
+ if n == "linux" or n == "firmware" then
+ size = tonumber(s, 16)
+ break
end
- elseif fs.access("/proc/partitions") then
- for l in io.lines("/proc/partitions") do
- local x, y, b, n = l:match('^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+)')
- if b and n and not n:match('[0-9]') then
- size = tonumber(b) * 1024
- break
- end
+ end
+ elseif nixio.fs.access("/proc/partitions") then
+ for l in io.lines("/proc/partitions") do
+ local x, y, b, n = l:match('^%s*(%d+)%s+(%d+)%s+([^%s]+)%s+([^%s]+)')
+ if b and n and not n:match('[0-9]') then
+ size = tonumber(b) * 1024
+ break
end
end
- return size
end
+ return size
+end
+
+
+function action_flashops()
+ --
+ -- Overview
+ --
+ luci.template.render("admin_system/flashops", {
+ reset_avail = supports_reset(),
+ upgrade_avail = supports_sysupgrade()
+ })
+end
+function action_sysupgrade()
+ local fs = require "nixio.fs"
+ local http = require "luci.http"
+ local image_tmp = "/tmp/firmware.img"
local fp
- luci.http.setfilehandler(
+ http.setfilehandler(
function(meta, chunk, eof)
- if not fp then
- if meta and meta.name == "image" then
- fp = io.open(image_tmp, "w")
- else
- fp = io.popen(restore_cmd, "w")
- end
+ if not fp and meta and meta.name == "image" then
+ fp = io.open(image_tmp, "w")
end
- if chunk then
+ if fp and chunk then
fp:write(chunk)
end
- if eof then
+ if fp and eof then
fp:close()
end
end
)
- if luci.http.formvalue("backup") then
- --
- -- Assemble file list, generate backup
- --
- local reader = ltn12_popen(backup_cmd)
- luci.http.header('Content-Disposition', 'attachment; filename="backup-%s-%s.tar.gz"' % {
- luci.sys.hostname(), os.date("%Y-%m-%d")})
- luci.http.prepare_content("application/x-targz")
- luci.ltn12.pump.all(reader, luci.http.write)
- elseif luci.http.formvalue("restore") then
- --
- -- Unpack received .tar.gz
- --
- local upload = luci.http.formvalue("archive")
- if upload and #upload > 0 then
- luci.template.render("admin_system/applyreboot")
- luci.sys.reboot()
+ if not luci.dispatcher.test_post_security() then
+ fs.unlink(image_tmp)
+ return
+ end
+
+ --
+ -- Cancel firmware flash
+ --
+ if http.formvalue("cancel") then
+ fs.unlink(image_tmp)
+ http.redirect(luci.dispatcher.build_url('admin/system/flashops'))
+ return
+ end
+
+ --
+ -- Initiate firmware flash
+ --
+ local step = tonumber(http.formvalue("step") or 1)
+ if step == 1 then
+ if image_supported(image_tmp) then
+ luci.template.render("admin_system/upgrade", {
+ checksum = image_checksum(image_tmp),
+ storage = storage_size(),
+ size = (fs.stat(image_tmp, "size") or 0),
+ keep = (not not http.formvalue("keep"))
+ })
+ else
+ fs.unlink(image_tmp)
+ luci.template.render("admin_system/flashops", {
+ reset_avail = supports_reset(),
+ upgrade_avail = supports_sysupgrade(),
+ image_invalid = true
+ })
end
- elseif luci.http.formvalue("image") or luci.http.formvalue("step") then
- --
- -- Initiate firmware flash
- --
- local step = tonumber(luci.http.formvalue("step") or 1)
- if step == 1 then
- if image_supported() then
- luci.template.render("admin_system/upgrade", {
- checksum = image_checksum(),
- storage = storage_size(),
- size = (fs.stat(image_tmp, "size") or 0),
- keep = (not not luci.http.formvalue("keep"))
- })
- else
- fs.unlink(image_tmp)
- luci.template.render("admin_system/flashops", {
- reset_avail = reset_avail,
- upgrade_avail = upgrade_avail,
- image_invalid = true
- })
+ --
+ -- Start sysupgrade flash
+ --
+ elseif step == 2 then
+ local keep = (http.formvalue("keep") == "1") and "" or "-n"
+ luci.template.render("admin_system/applyreboot", {
+ title = luci.i18n.translate("Flashing..."),
+ msg = luci.i18n.translate("The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings."),
+ addr = (#keep > 0) and "192.168.1.1" or nil
+ })
+ fork_exec("killall dropbear uhttpd; sleep 1; /sbin/sysupgrade %s %q" %{ keep, image_tmp })
+ end
+end
+
+function action_backup()
+ local reader = ltn12_popen("sysupgrade --create-backup - 2>/dev/null")
+
+ luci.http.header(
+ 'Content-Disposition', 'attachment; filename="backup-%s-%s.tar.gz"' %{
+ luci.sys.hostname(),
+ os.date("%Y-%m-%d")
+ })
+
+ luci.http.prepare_content("application/x-targz")
+ luci.ltn12.pump.all(reader, luci.http.write)
+end
+
+function action_restore()
+ local fs = require "nixio.fs"
+ local http = require "luci.http"
+ local archive_tmp = "/tmp/restore.tar.gz"
+
+ local fp
+ http.setfilehandler(
+ function(meta, chunk, eof)
+ if not fp and meta and meta.name == "archive" then
+ fp = io.open(archive_tmp, "w")
+ end
+ if fp and chunk then
+ fp:write(chunk)
+ end
+ if fp and eof then
+ fp:close()
end
- --
- -- Start sysupgrade flash
- --
- elseif step == 2 then
- local keep = (luci.http.formvalue("keep") == "1") and "" or "-n"
- luci.template.render("admin_system/applyreboot", {
- title = luci.i18n.translate("Flashing..."),
- msg = luci.i18n.translate("The system is flashing now.<br /> DO NOT POWER OFF THE DEVICE!<br /> Wait a few minutes before you try to reconnect. It might be necessary to renew the address of your computer to reach the device again, depending on your settings."),
- addr = (#keep > 0) and "192.168.1.1" or nil
- })
- fork_exec("killall dropbear uhttpd; sleep 1; /sbin/sysupgrade %s %q" %{ keep, image_tmp })
end
- elseif reset_avail and luci.http.formvalue("reset") then
- --
- -- Reset system
- --
+ )
+
+ if not luci.dispatcher.test_post_security() then
+ fs.unlink(archive_tmp)
+ return
+ end
+
+ local upload = http.formvalue("archive")
+ if upload and #upload > 0 then
+ luci.template.render("admin_system/applyreboot")
+ os.execute("tar -C / -xzf %q >/dev/null 2>&1" % archive_tmp)
+ luci.sys.reboot()
+ return
+ end
+
+ http.redirect(luci.dispatcher.build_url('admin/system/flashops'))
+end
+
+function action_reset()
+ if supports_reset() then
luci.template.render("admin_system/applyreboot", {
title = luci.i18n.translate("Erasing..."),
msg = luci.i18n.translate("The system is erasing the configuration partition now and will reboot itself when finished."),
addr = "192.168.1.1"
})
+
fork_exec("killall dropbear uhttpd; sleep 1; mtd -r erase rootfs_data")
- else
- --
- -- Overview
- --
- luci.template.render("admin_system/flashops", {
- reset_avail = reset_avail,
- upgrade_avail = upgrade_avail
- })
+ return
end
+
+ http.redirect(luci.dispatcher.build_url('admin/system/flashops'))
end
function action_passwd()
@@ -316,11 +375,7 @@ function action_passwd()
end
function action_reboot()
- local reboot = luci.http.formvalue("reboot")
- luci.template.render("admin_system/reboot", {reboot=reboot})
- if reboot then
- luci.sys.reboot()
- end
+ luci.sys.reboot()
end
function fork_exec(command)
diff --git a/modules/luci-mod-admin-full/luasrc/controller/admin/uci.lua b/modules/luci-mod-admin-full/luasrc/controller/admin/uci.lua
index 6de3c73a3c..9c33d9c18b 100644
--- a/modules/luci-mod-admin-full/luasrc/controller/admin/uci.lua
+++ b/modules/luci-mod-admin-full/luasrc/controller/admin/uci.lua
@@ -1,5 +1,5 @@
-- Copyright 2008 Steven Barth <steven@midlink.org>
--- Copyright 2010 Jo-Philipp Wich <jow@openwrt.org>
+-- Copyright 2010-2015 Jo-Philipp Wich <jow@openwrt.org>
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.admin.uci", package.seeall)
@@ -10,9 +10,9 @@ function index()
entry({"admin", "uci"}, nil, _("Configuration"))
entry({"admin", "uci", "changes"}, call("action_changes"), _("Changes"), 40).query = {redir=redir}
- entry({"admin", "uci", "revert"}, call("action_revert"), _("Revert"), 30).query = {redir=redir}
- entry({"admin", "uci", "apply"}, call("action_apply"), _("Apply"), 20).query = {redir=redir}
- entry({"admin", "uci", "saveapply"}, call("action_apply"), _("Save &#38; Apply"), 10).query = {redir=redir}
+ entry({"admin", "uci", "revert"}, post("action_revert"), _("Revert"), 30).query = {redir=redir}
+ entry({"admin", "uci", "apply"}, post("action_apply"), _("Apply"), 20).query = {redir=redir}
+ entry({"admin", "uci", "saveapply"}, post("action_apply"), _("Save &#38; Apply"), 10).query = {redir=redir}
end
function action_changes()
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
index 49103a8113..4dc52ada06 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_network/dhcp.lua
@@ -51,13 +51,10 @@ rf.optional = true
s:taboption("files", Flag, "nohosts",
- translate("Ignore Hosts files")).optional = true
+ translate("Ignore <code>/etc/hosts</code>")).optional = true
-hf = s:taboption("files", DynamicList, "addnhosts",
- translate("Additional Hosts files"))
-
-hf:depends("nohosts", "")
-hf.optional = true
+s:taboption("files", DynamicList, "addnhosts",
+ translate("Additional Hosts files")).optional = true
s:taboption("advanced", Flag, "boguspriv",
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua
index b01b5dbb3e..7c6d7e1c66 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua
@@ -11,6 +11,7 @@ f = SimpleForm("ipkgconf", translate("OPKG-Configuration"), translate("General o
f:append(Template("admin_system/ipkg"))
t = f:field(TextValue, "lines")
+t.wrap = "off"
t.rows = 10
function t.cfgvalue()
return nixio.fs.readfile(ipkgfile) or ""
@@ -28,6 +29,7 @@ g = SimpleForm("distfeedconf", translate("Distribution feeds"),
translate("Build/distribution specific feed definitions. This file will NOT be preserved in any sysupgrade."))
d = g:field(TextValue, "lines2")
+d.wrap = "off"
d.rows = 10
function d.cfgvalue()
return nixio.fs.readfile(distfeeds) or ""
@@ -45,6 +47,7 @@ h = SimpleForm("customfeedconf", translate("Custom feeds"),
translate("Custom feed definitions, e.g. private feeds. This file can be preserved in a sysupgrade."))
c = h:field(TextValue, "lines3")
+c.wrap = "off"
c.rows = 10
function c.cfgvalue()
return nixio.fs.readfile(customfeeds) or ""
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm
index 05c866128d..685082a335 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/diagnostics.htm
@@ -34,7 +34,7 @@ local has_traceroute6 = fs.access("/usr/bin/traceroute6")
legend.parentNode.style.display = 'block';
legend.style.display = 'inline';
- stxhr.get('<%=luci.dispatcher.build_url("admin", "network")%>/diag_' + tool + protocol + '/' + addr, null,
+ stxhr.post('<%=url('admin/network')%>/diag_' + tool + protocol + '/' + addr, { token: '<%=token%>' },
function(x)
{
if (x.responseText)
@@ -53,9 +53,9 @@ local has_traceroute6 = fs.access("/usr/bin/traceroute6")
}
//]]></script>
-<form method="post" action="<%=pcdata(luci.http.getenv("REQUEST_URI"))%>">
+<form method="post" action="<%=url('admin/network/diagnostics')%>">
<div class="cbi-map">
- <h2><a id="content" name="content"><%:Diagnostics%></a></h2>
+ <h2 name="content"><%:Diagnostics%></h2>
<fieldset class="cbi-section">
<legend><%:Network Utilities%></legend>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm
index 1de349856e..9a77f89106 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_overview.htm
@@ -49,7 +49,7 @@
s.innerHTML = '<%:Waiting for changes to be applied...%>';
}
- XHR.get('<%=luci.dispatcher.build_url("admin", "network")%>/iface_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, null,
+ (new XHR()).post('<%=url('admin/network')%>/iface_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, { token: '<%=token%>' },
function(x)
{
if (s)
@@ -66,12 +66,22 @@
);
}
+ function iface_delete(id) {
+ if (!confirm('<%:Really delete this interface? The deletion cannot be undone!\nYou might lose access to this device if you are connected via this interface.%>'))
+ return;
+
+ (new XHR()).post('<%=url('admin/network/iface_delete')%>/' + id, { token: '<%=token%>' },
+ function(x) {
+ location.href = '<%=url('admin/network/network')%>';
+ }
+ );
+ }
var iwxhr = new XHR();
var wifidevs = <%=luci.http.write_json(netdevs)%>;
var arptable = <%=luci.http.write_json(arpcache)%>;
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "iface_status", table.concat(ifaces, ","))%>', null,
+ XHR.poll(5, '<%=url('admin/network/iface_status', table.concat(ifaces, ","))%>', null,
function(x, ifcs)
{
if (ifcs)
@@ -178,14 +188,14 @@
d.innerHTML = String.format(
'<em><%:Unsupported protocol type.%></em><br />' +
'<a href="%h"><%:Install protocol extensions...%></a>',
- '<%=luci.dispatcher.build_url("admin/system/packages")%>?query=luci-proto&display=available'
+ '<%=url("admin/system/packages")%>?query=luci-proto&display=available'
);
}
else if (d && !ifc.ifname)
{
d.innerHTML = String.format(
'<em><%:Network without interfaces.%></em><br />' +
- '<a href="<%=luci.dispatcher.build_url("admin/network/network/%s")%>?tab.network.%s=physical"><%:Assign interfaces...%></a>',
+ '<a href="<%=url("admin/network/network/%s")%>?tab.network.%s=physical"><%:Assign interfaces...%></a>',
ifc.name, ifc.name
);
}
@@ -239,13 +249,13 @@
<td style="width:420px">
<input type="button" class="cbi-button cbi-button-reload" style="width:100px" onclick="iface_shutdown('<%=net[1]%>', true)" title="<%:Reconnect this interface%>" value="<%:Connect%>" />
<input type="button" class="cbi-button cbi-button-reset" style="width:100px" onclick="iface_shutdown('<%=net[1]%>', false)" title="<%:Shutdown this interface%>" value="<%:Stop%>" />
- <input type="button" class="cbi-button cbi-button-edit" style="width:100px" onclick="location.href='<%=luci.dispatcher.build_url("admin/network/network", net[1])%>'" title="<%:Edit this interface%>" value="<%:Edit%>" id="<%=net[1]%>-ifc-edit" />
- <input type="button" class="cbi-button cbi-button-remove" style="width:100px" onclick="if (confirm('<%:Really delete this interface? The deletion cannot be undone!\nYou might lose access to this device if you are connected via this interface.%>')) location.href='<%=luci.dispatcher.build_url("admin/network/iface_delete", net[1])%>'" title="<%:Delete this interface%>" value="<%:Delete%>" />
+ <input type="button" class="cbi-button cbi-button-edit" style="width:100px" onclick="location.href='<%=url("admin/network/network", net[1])%>'" title="<%:Edit this interface%>" value="<%:Edit%>" id="<%=net[1]%>-ifc-edit" />
+ <input type="submit" class="cbi-button cbi-button-remove" style="width:100px" onclick="iface_delete('<%=net[1]%>')" value="<%:Delete%>" />
</td>
</tr>
<% end %>
</table>
- <input type="button" class="cbi-button cbi-button-add" value="<%:Add new interface...%>" onclick="location.href='<%=luci.dispatcher.build_url("admin/network/iface_add")%>'" />
+ <input type="button" class="cbi-button cbi-button-add" value="<%:Add new interface...%>" onclick="location.href='<%=url("admin/network/iface_add")%>'" />
</fieldset>
</div>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm
index 8136383969..1ebdbfcfb4 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/iface_status.htm
@@ -1,7 +1,7 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "iface_status", self.network)%>', null,
+ XHR.poll(5, '<%=url('admin/network/iface_status', self.network)%>', null,
function(x, ifc)
{
if (ifc && (ifc = ifc[0]))
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm
index 0ba334ee9d..ab8e732573 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/lease_status.htm
@@ -1,5 +1,5 @@
<script type="text/javascript">//<![CDATA[
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "dhcplease_status")%>', null,
+ XHR.poll(5, '<%=url('admin/network/dhcplease_status')%>', null,
function(x, st)
{
var tb = document.getElementById('lease_status_table');
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm
index b299575e2f..53c35ae59c 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/switch_status.htm
@@ -1,6 +1,6 @@
<script type="text/javascript">//<![CDATA[
var switches = [ '<%=table.concat(self.switches, "', '")%>' ];
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "switch_status")%>/' + switches.join(','), null,
+ XHR.poll(5, '<%=url('admin/network/switch_status')%>/' + switches.join(','), null,
function(x, st)
{
for (var i = 0; i < switches.length; i++)
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm
index 90cc4c03e1..3533c6fa4d 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_join.htm
@@ -1,5 +1,5 @@
<%#
- Copyright 2009 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2009-2015 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
@@ -87,7 +87,7 @@
<%+header%>
-<h2><a id="content" name="content"><%:Join Network: Wireless Scan%></a></h2>
+<h2 name="content"><%:Join Network: Wireless Scan%></h2>
<div class="cbi-map">
<fieldset class="cbi-section">
@@ -109,7 +109,8 @@
<strong>Encryption:</strong> <%=format_wifi_encryption(net.encryption)%>
</td>
<td class="cbi-value-field" style="width:40px">
- <form action="<%=REQUEST_URI%>" method="post">
+ <form action="<%=url('admin/network/wireless_join')%>" method="post">
+ <input type="hidden" name="token" value="<%=token%>" />
<input type="hidden" name="device" value="<%=utl.pcdata(dev)%>" />
<input type="hidden" name="join" value="<%=utl.pcdata(net.ssid)%>" />
<input type="hidden" name="mode" value="<%=net.mode%>" />
@@ -135,10 +136,11 @@
</fieldset>
</div>
<div class="cbi-page-actions right">
- <form class="inline" action="<%=luci.dispatcher.build_url("admin/network/wireless")%>" method="get">
+ <form class="inline" action="<%=url("admin/network/wireless")%>" method="get">
<input class="cbi-button cbi-button-reset" type="submit" value="<%:Back to overview%>" />
</form>
- <form class="inline" action="<%=REQUEST_URI%>" method="get">
+ <form class="inline" action="<%=url('admin/network/wireless_join')%>" method="post">
+ <input type="hidden" name="token" value="<%=token%>" />
<input type="hidden" name="device" value="<%=utl.pcdata(dev)%>" />
<input class="cbi-button cbi-input-find" type="submit" value="<%:Repeat scan%>" />
</form>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm
index 4fc268e66c..f82d06dcdc 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm
@@ -149,7 +149,7 @@
st.innerHTML = '<em><%:Wireless is restarting...%></em>';
}
- XHR.get('<%=luci.dispatcher.build_url("admin", "network")%>/wireless_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, null,
+ (new XHR()).post('<%=url('admin/network')%>/wireless_' + (reconnect ? 'reconnect' : 'shutdown') + '/' + id, { token: '<%=token%>' },
function(x)
{
if (s)
@@ -167,7 +167,18 @@
);
}
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "wireless_status", table.concat(netlist, ","))%>', null,
+ function wifi_delete(id) {
+ if (!confirm('<%:Really delete this wireless network? The deletion cannot be undone!\nYou might lose access to this device if you are connected via this network.%>'))
+ return;
+
+ (new XHR()).post('<%=url('admin/network/wireless_delete')%>/' + id, { token: '<%=token%>' },
+ function(x) {
+ location.href = '<%=url('admin/network/wireless')%>';
+ }
+ );
+ }
+
+ XHR.poll(5, '<%=url('admin/network/wireless_status', table.concat(netlist, ","))%>', null,
function(x, st)
{
if (st)
@@ -348,7 +359,7 @@
);
//]]></script>
-<h2><a id="content" name="content"><%:Wireless Overview%></a></h2>
+<h2 name="content"><%:Wireless Overview%></h2>
<fieldset class="cbi-section" style="display:none">
<legend><%:Reconnecting interface%></legend>
@@ -370,8 +381,16 @@
<span id="<%=dev:name()%>-iw-devinfo"></span>
</td>
<td style="width:310px;text-align:right">
- <input type="button" class="cbi-button cbi-button-find" style="width:100px" onclick="location.href='<%=luci.dispatcher.build_url("admin/network/wireless_join")%>?device=<%=dev:name()%>'" title="<%:Find and join network%>" value="<%:Scan%>" />
- <input type="button" class="cbi-button cbi-button-add" style="width:100px" onclick="location.href='<%=luci.dispatcher.build_url("admin/network/wireless_add")%>?device=<%=dev:name()%>'" title="<%:Provide new network%>" value="<%:Add%>" />
+ <form action="<%=url('admin/network/wireless_join')%>" method="post" class="inline">
+ <input type="hidden" name="device" value="<%=dev:name()%>" />
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input type="submit" class="cbi-button cbi-button-find" style="width:100px" title="<%:Find and join network%>" value="<%:Scan%>" />
+ </form>
+ <form action="<%=url('admin/network/wireless_add')%>" method="post" class="inline">
+ <input type="hidden" name="device" value="<%=dev:name()%>" />
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input type="submit" class="cbi-button cbi-button-add" style="width:100px" title="<%:Provide new network%>" value="<%:Add%>" />
+ </form>
</td>
</tr>
<!-- /physical device -->
@@ -391,7 +410,7 @@
<td class="cbi-value-field" style="width:310px;text-align:right">
<input id="<%=net:id()%>-iw-toggle" type="button" class="cbi-button cbi-button-reload" style="width:100px" onclick="wifi_shutdown('<%=net:id()%>', this)" title="<%:Delete this network%>" value="<%:Enable%>" />
<input type="button" class="cbi-button cbi-button-edit" style="width:100px" onclick="location.href='<%=net:adminlink()%>'" title="<%:Edit this network%>" value="<%:Edit%>" />
- <input type="button" class="cbi-button cbi-button-remove" style="width:100px" onclick="if (confirm('<%:Really delete this wireless network? The deletion cannot be undone!\nYou might lose access to this device if you are connected via this network.%>')) location.href='<%=luci.dispatcher.build_url("admin/network/wireless_delete", net:ifname())%>'" title="<%:Delete this network%>" value="<%:Remove%>" />
+ <input type="button" class="cbi-button cbi-button-remove" style="width:100px" onclick="wifi_delete('<%=net:ifname()%>')" title="<%:Delete this network%>" value="<%:Remove%>" />
</td>
</tr>
<% end %>
@@ -410,7 +429,7 @@
<% end %>
- <h2><a id="content" name="content"><%:Associated Stations%></a></h2>
+ <h2><%:Associated Stations%></h2>
<fieldset class="cbi-section">
<table class="cbi-section-table" style="margin:10px" id="iw-assoclist">
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm
index fa0a97b707..04687f38e7 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_status.htm
@@ -1,7 +1,7 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "network", "wireless_status", self.ifname)%>', null,
+ XHR.poll(5, '<%=url('admin/network/wireless_status', self.ifname)%>', null,
function(x, iw)
{
if (iw && (iw = iw[0]))
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm
index dbcf06beef..04da3c1239 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/bandwidth.htm
@@ -264,7 +264,7 @@
);
//]]></script>
-<h2><a id="content" name="content"><%:Realtime Traffic%></a></h2>
+<h2 name="content"><%:Realtime Traffic%></h2>
<ul class="cbi-tabmenu">
<% for _, dev in ipairs(devices) do %>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm
index 64b950e24b..0b2e52e059 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/connections.htm
@@ -312,7 +312,7 @@
);
//]]></script>
-<h2><a id="content" name="content"><%:Realtime Connections%></a></h2>
+<h2 name="content"><%:Realtime Connections%></h2>
<div class="cbi-map-descr"><%:This page gives an overview over currently active network connections.%></div>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm
index a63bb71128..c119b57296 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/dmesg.htm
@@ -5,7 +5,7 @@
-%>
<%+header%>
-<h2><a id="content" name="content"><%:Kernel Log%></a></h2>
+<h2 name="content"><%:Kernel Log%></h2>
<div id="content_syslog">
<textarea readonly="readonly" wrap="off" rows="<%=dmesg:cmatch("\n")+2%>" id="syslog"><%=dmesg:pcdata()%></textarea>
</div>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm
index 07a96b2bf0..62188e45e2 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm
@@ -88,7 +88,9 @@
if has_dsl then
local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control lucistat")
local dsl_func = loadstring(dsl_stat)
- rv.dsl = dsl_func()
+ if dsl_func then
+ rv.dsl = dsl_func()
+ end
end
luci.http.prepare_content("application/json")
@@ -550,7 +552,7 @@
);
//]]></script>
-<h2><a id="content" name="content"><%:Status%></a></h2>
+<h2 name="content"><%:Status%></h2>
<fieldset class="cbi-section">
<legend><%:System%></legend>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm
index ba2933adef..f49469a599 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm
@@ -1,6 +1,6 @@
<%#
Copyright 2008-2009 Steven Barth <steven@midlink.org>
- Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
@@ -37,7 +37,7 @@
local net = wba.iface_get_network(i)
if net and i ~= "lo" then
return '<a href="%s">%s</a>' %{
- luci.dispatcher.build_url("admin", "network", "network", net), i
+ url("admin/network/network", net), i
}
end
@@ -59,91 +59,88 @@
}
</style>
-<h2><a id="content" name="content"><%:Firewall Status%></a></h2>
+<h2 name="content"><%:Firewall Status%></h2>
+<br />
<% if has_ip6tables then %>
<ul class="cbi-tabmenu">
- <li class="cbi-tab<%= mode ~= 4 and "-disabled" %>"><a href="<%=luci.dispatcher.build_url("admin/status/iptables/4")%>"><%:IPv4 Firewall%></a></li>
- <li class="cbi-tab<%= mode ~= 6 and "-disabled" %>"><a href="<%=luci.dispatcher.build_url("admin/status/iptables/6")%>"><%:IPv6 Firewall%></a></li>
+ <li class="cbi-tab<%= mode ~= 4 and "-disabled" %>"><a href="<%=url("admin/status/iptables/4")%>"><%:IPv4 Firewall%></a></li>
+ <li class="cbi-tab<%= mode ~= 6 and "-disabled" %>"><a href="<%=url("admin/status/iptables/6")%>"><%:IPv6 Firewall%></a></li>
</ul>
<% end %>
-<form method="post" action="<%=REQUEST_URI%>">
- <div class="cbi-map">
- <fieldset class="cbi-section">
- <h3><%:Actions%></h3>
- <ul>
- <li><a href="<%=REQUEST_URI%>?zero=<%=mode%>"><%:Reset Counters%></a></li>
- <li><a href="<%=REQUEST_URI%>?restart=1"><%:Restart Firewall%></a></li>
- </ul>
- <br /><br />
-
- <% for _, tbl in ipairs(tables) do chaincnt = 0 %>
- <h3><%:Table%>: <%=tbl%></h3>
- <table class="cbi-section-table" style="font-size:90%">
- <% for _, chain in ipairs(ipt:chains(tbl)) do
- rowcnt = 0
- chaincnt = chaincnt + 1
- chaininfo = ipt:chain(tbl, chain)
- %>
- <tr class="cbi-section-table-titles cbi-rowstyle-<%=rowstyle()%>">
- <th class="cbi-section-table-cell" style="text-align:left" colspan="11">
- <br /><span id="rule_<%=tbl:lower()%>_<%=chain%>">
- <%:Chain%> <em><%=chain%></em>
- (<%- if chaininfo.policy then -%>
- <%:Policy%>: <em><%=chaininfo.policy%></em>, <%:Packets%>: <%=chaininfo.packets%>, <%:Traffic%>: <%=wba.byte_format(chaininfo.bytes)-%>
- <%- else -%>
- <%:References%>: <%=chaininfo.references-%>
- <%- end -%>)</span>
- </th>
+<div class="cbi-map" style="position: relative">
+
+ <form method="post" action="<%=url("admin/status/iptables_action")%>" style="position: absolute; right: 0">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input type="hidden" name="family" value="<%=mode%>" />
+ <input type="submit" class="cbi-button" name="zero" value="<%:Reset Counters%>" />
+ <input type="submit" class="cbi-button" name="restart" value="<%:Restart Firewall%>" />
+ </form>
+
+ <fieldset class="cbi-section">
+
+ <% for _, tbl in ipairs(tables) do chaincnt = 0 %>
+ <h3><%:Table%>: <%=tbl%></h3>
+ <table class="cbi-section-table" style="font-size:90%">
+ <% for _, chain in ipairs(ipt:chains(tbl)) do
+ rowcnt = 0
+ chaincnt = chaincnt + 1
+ chaininfo = ipt:chain(tbl, chain)
+ %>
+ <tr class="cbi-section-table-titles cbi-rowstyle-<%=rowstyle()%>">
+ <th class="cbi-section-table-cell" style="text-align:left" colspan="11">
+ <br /><span id="rule_<%=tbl:lower()%>_<%=chain%>">
+ <%:Chain%> <em><%=chain%></em>
+ (<%- if chaininfo.policy then -%>
+ <%:Policy%>: <em><%=chaininfo.policy%></em>, <%:Packets%>: <%=chaininfo.packets%>, <%:Traffic%>: <%=wba.byte_format(chaininfo.bytes)-%>
+ <%- else -%>
+ <%:References%>: <%=chaininfo.references-%>
+ <%- end -%>)</span>
+ </th>
+ </tr>
+ <tr class="cbi-section-table-descr">
+ <th class="cbi-section-table-cell"><%:Pkts.%></th>
+ <th class="cbi-section-table-cell"><%:Traffic%></th>
+ <th class="cbi-section-table-cell"><%:Target%></th>
+ <th class="cbi-section-table-cell"><%:Prot.%></th>
+ <th class="cbi-section-table-cell"><%:In%></th>
+ <th class="cbi-section-table-cell"><%:Out%></th>
+ <th class="cbi-section-table-cell"><%:Source%></th>
+ <th class="cbi-section-table-cell"><%:Destination%></th>
+ <th class="cbi-section-table-cell" style="width:30%"><%:Options%></th>
+ </tr>
+
+ <% for _, rule in ipairs(ipt:find({table=tbl, chain=chain})) do %>
+ <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
+ <td><%=rule.packets%></td>
+ <td style="white-space: nowrap"><%=wba.byte_format(rule.bytes)%></td>
+ <td><%=rule.target and link_target(tbl, rule.target) or "-"%></td>
+ <td><%=rule.protocol%></td>
+ <td><%=link_iface(rule.inputif)%></td>
+ <td><%=link_iface(rule.outputif)%></td>
+ <td><%=rule.source%></td>
+ <td><%=rule.destination%></td>
+ <td style="width:30%"><small><%=#rule.options > 0 and luci.util.pcdata(table.concat(rule.options, " ")) or "-"%></small></td>
</tr>
- <tr class="cbi-section-table-descr">
- <th class="cbi-section-table-cell"><%:Rule #%></th>
- <th class="cbi-section-table-cell"><%:Pkts.%></th>
- <th class="cbi-section-table-cell"><%:Traffic%></th>
- <th class="cbi-section-table-cell"><%:Target%></th>
- <th class="cbi-section-table-cell"><%:Prot.%></th>
- <th class="cbi-section-table-cell"><%:Flags%></th>
- <th class="cbi-section-table-cell"><%:In%></th>
- <th class="cbi-section-table-cell"><%:Out%></th>
- <th class="cbi-section-table-cell"><%:Source%></th>
- <th class="cbi-section-table-cell"><%:Destination%></th>
- <th class="cbi-section-table-cell" style="width:30%"><%:Options%></th>
- </tr>
-
- <% for _, rule in ipairs(ipt:find({table=tbl, chain=chain})) do %>
- <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
- <td><%=rule.index%></td>
- <td><%=rule.packets%></td>
- <td><%=wba.byte_format(rule.bytes)%></td>
- <td><%=rule.target and link_target(tbl, rule.target) or "-"%></td>
- <td><%=rule.protocol%></td>
- <td><%=rule.flags%></td>
- <td><%=link_iface(rule.inputif)%></td>
- <td><%=link_iface(rule.outputif)%></td>
- <td><%=rule.source%></td>
- <td><%=rule.destination%></td>
- <td style="width:30%"><small><%=#rule.options > 0 and luci.util.pcdata(table.concat(rule.options, " ")) or "-"%></small></td>
- </tr>
- <% end %>
-
- <% if rowcnt == 1 then %>
- <tr class="cbi-section-table-titles cbi-rowstyle-<%=rowstyle()%>">
- <td colspan="11"><em><%:No rules in this chain%></em></td>
- </tr>
- <% end %>
<% end %>
- <% if chaincnt == 0 then %>
+ <% if rowcnt == 1 then %>
<tr class="cbi-section-table-titles cbi-rowstyle-<%=rowstyle()%>">
- <td colspan="11"><em><%:No chains in this table%></em></td>
+ <td colspan="9"><em><%:No rules in this chain%></em></td>
</tr>
<% end %>
- </table>
- <br /><br />
- <% end %>
- </fieldset>
- </div>
-</form>
+ <% end %>
+
+ <% if chaincnt == 0 then %>
+ <tr class="cbi-section-table-titles cbi-rowstyle-<%=rowstyle()%>">
+ <td colspan="9"><em><%:No chains in this table%></em></td>
+ </tr>
+ <% end %>
+ </table>
+ <br /><br />
+ <% end %>
+ </fieldset>
+</div>
<%+footer%>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm
index d095948e50..97a2f5ed59 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/load.htm
@@ -242,7 +242,7 @@
);
//]]></script>
-<h2><a id="content" name="content"><%:Realtime Load%></a></h2>
+<h2 name="content"><%:Realtime Load%></h2>
<embed id="bwsvg" style="width:100%; height:300px; border:1px solid #000000; background-color:#FFFFFF" src="<%=resource%>/load.svg" />
<div style="text-align:right"><small id="scale">-</small></div>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm
index 82dd3a7dfe..5f2c074939 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/routes.htm
@@ -33,7 +33,7 @@
<%+header%>
<div class="cbi-map" id="cbi-network">
- <h2><a id="content" name="content"><%:Routes%></a></h2>
+ <h2 name="content"><%:Routes%></h2>
<div class="cbi-map-descr"><%:The following rules are currently active on this system.%></div>
<fieldset class="cbi-section">
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm
index 40032a1426..b87f21d08d 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/syslog.htm
@@ -5,7 +5,7 @@
-%>
<%+header%>
-<h2><a id="content" name="content"><%:System Log%></a></h2>
+<h2 name="content"><%:System Log%></h2>
<div id="content_syslog">
<textarea readonly="readonly" wrap="off" rows="<%=syslog:cmatch("\n")+2%>" id="syslog"><%=syslog:pcdata()%></textarea>
</div>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm
index 025fece90b..f185926104 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/wireless.htm
@@ -314,7 +314,7 @@
);
//]]></script>
-<h2><a id="content" name="content"><%:Realtime Wireless%></a></h2>
+<h2 name="content"><%:Realtime Wireless%></h2>
<ul class="cbi-tabmenu">
<% for _, dev in ipairs(devices) do %>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm
index 15c96e34df..e722a48096 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/applyreboot.htm
@@ -25,7 +25,7 @@
<body>
<div id="maincontainer">
<div id="maincontent">
- <h2><a id="content" name="content"><%:System%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %></a></h2>
+ <h2 name="content"><%:System%> - <% if title then %><%=title%><% else %><%:Rebooting...%><% end %></h2>
<fieldset class="cbi-section">
<p>
<% if msg then %><%=msg%><% else %><%:Changes applied.%><% end %>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm
index 0a6df109df..c1f3361ae2 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/backupfiles.htm
@@ -5,6 +5,6 @@
-%>
<ul class="cbi-tabmenu">
- <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/system/flashops")%>"><%:Actions%></a></li>
+ <li class="cbi-tab-disabled"><a href="<%=url("admin/system/flashops")%>"><%:Actions%></a></li>
<li class="cbi-tab"><a href="#"><%:Configuration%></a></li>
</ul>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm
index 84e151075f..37d8ae0e85 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/clock_status.htm
@@ -1,7 +1,7 @@
<%+cbi/valueheader%>
<script type="text/javascript">//<![CDATA[
- XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "system", "clock_status")%>', null,
+ XHR.poll(5, '<%=url('admin/system/clock_status')%>', null,
function(x, rv)
{
var s = document.getElementById('<%=self.option%>-clock-status');
@@ -17,8 +17,8 @@
btn.disabled = true;
btn.value = '<%:Synchronizing...%>';
- XHR.get('<%=luci.dispatcher.build_url("admin", "system", "clock_status")%>',
- { set: Math.floor((new Date()).getTime() / 1000) },
+ (new XHR()).post('<%=url('admin/system/clock_status')%>',
+ { token: '<%=token%>', set: Math.floor((new Date()).getTime() / 1000) },
function()
{
btn.disabled = false;
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm
index bea565aa05..82a1fdbc9c 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/flashops.htm
@@ -1,12 +1,12 @@
<%#
Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
<%+header%>
-<h2><a id="content" name="content"><%:Flash operations%></a></h2>
+<h2 name="content"><%:Flash operations%></h2>
<ul class="cbi-tabmenu">
<li class="cbi-tab"><a href="#"><%:Actions%></a></li>
@@ -17,36 +17,43 @@
<fieldset class="cbi-section">
<legend><%:Backup / Restore%></legend>
- <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
- <div class="cbi-section-descr"><%:Click "Generate archive" to download a tar archive of the current configuration files. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%></div>
- <div class="cbi-section-node">
+ <div class="cbi-section-descr"><%:Click "Generate archive" to download a tar archive of the current configuration files. To reset the firmware to its initial state, click "Perform reset" (only possible with squashfs images).%></div>
+ <div class="cbi-section-node">
+ <form class="inline" method="post" action="<%=url('admin/system/flashops/backup')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
<div class="cbi-value<% if not reset_avail then %> cbi-value-last<% end %>">
<label class="cbi-value-title" for="image"><%:Download backup%>:</label>
<div class="cbi-value-field">
<input class="cbi-button cbi-button-apply" type="submit" name="backup" value="<%:Generate archive%>" />
</div>
</div>
- <% if reset_avail then %>
+ </form>
+ <% if reset_avail then %>
+ <form class="inline" method="post" action="<%=url('admin/system/flashops/reset')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
<div class="cbi-value cbi-value-last">
<label class="cbi-value-title"><%:Reset to defaults%>:</label>
<div class="cbi-value-field">
<input onclick="return confirm('<%:Really reset all changes?%>')" class="cbi-button cbi-button-reset" type="submit" name="reset" value="<%:Perform reset%>" />
</div>
</div>
- <% end %>
- </div>
- <br />
- <div class="cbi-section-descr"><%:To restore configuration files, you can upload a previously generated backup archive here.%></div>
- <div class="cbi-section-node">
+ </form>
+ <% end %>
+ </div>
+ <br />
+ <div class="cbi-section-descr"><%:To restore configuration files, you can upload a previously generated backup archive here.%></div>
+ <div class="cbi-section-node">
+ <form class="inline" method="post" action="<%=url('admin/system/flashops/restore')%>" enctype="multipart/form-data">
<div class="cbi-value cbi-value-last">
<label class="cbi-value-title" for="archive"><%:Restore backup%>:</label>
<div class="cbi-value-field">
+ <input type="hidden" name="token" value="<%=token%>" />
<input type="file" name="archive" id="archive" />
<input type="submit" class="cbi-button cbi-input-apply" name="restore" value="<%:Upload archive...%>" />
</div>
</div>
- </div>
- </form>
+ </form>
+ </div>
</fieldset>
<br />
@@ -54,7 +61,8 @@
<fieldset class="cbi-section">
<legend><%:Flash new firmware image%></legend>
<% if upgrade_avail then %>
- <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
+ <form method="post" action="<%=url('admin/system/flashops/sysupgrade')%>" enctype="multipart/form-data">
+ <input type="hidden" name="token" value="<%=token%>" />
<div class="cbi-section-descr"><%:Upload a sysupgrade-compatible image here to replace the running firmware. Check "Keep settings" to retain the current configuration (requires an OpenWrt compatible firmware image).%></div>
<div class="cbi-section-node">
<div class="cbi-value">
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm
index 6b812e837e..a7ff4e50bd 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/ipkg.htm
@@ -5,6 +5,6 @@
-%>
<ul class="cbi-tabmenu">
- <li class="cbi-tab-disabled"><a href="<%=luci.dispatcher.build_url("admin/system/packages")%>"><%:Actions%></a></li>
+ <li class="cbi-tab-disabled"><a href="<%=url("admin/system/packages")%>"><%:Actions%></a></li>
<li class="cbi-tab"><a href="#"><%:Configuration%></a></li>
</ul>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm
index fe2fe04366..1bc9caceda 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm
@@ -44,19 +44,20 @@ end
<%+header%>
-<h2><a id="content" name="content"><%:Software%></a></h2>
+<h2 name="content"><%:Software%></h2>
-<form method="post" action="<%=REQUEST_URI%>">
- <div class="cbi-map">
+<div class="cbi-map">
- <ul class="cbi-tabmenu">
- <li class="cbi-tab"><a href="#"><%:Actions%></a></li>
- <li class="cbi-tab-disabled"><a href="<%=REQUEST_URI%>/ipkg"><%:Configuration%></a></li>
- </ul>
-
- <fieldset class="cbi-section">
+ <ul class="cbi-tabmenu">
+ <li class="cbi-tab"><a href="#"><%:Actions%></a></li>
+ <li class="cbi-tab-disabled"><a href="<%=REQUEST_URI%>/ipkg"><%:Configuration%></a></li>
+ </ul>
+ <form method="post" action="<%=REQUEST_URI%>">
+ <input type="hidden" name="exec" value="1" />
+ <input type="hidden" name="token" value="<%=token%>" />
+ <fieldset class="cbi-section">
<fieldset class="cbi-section-node">
<% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %>
<div class="cbi-value">
@@ -80,7 +81,7 @@ end
<% else %>
<%:No package lists available%>
<% end %>
- <input type="button" onclick="location.href='?update=1'" href="#" class="cbi-button cbi-button-apply" style="margin-left:3em" value="<%:Update lists%>" />
+ <input type="submit" name="update" href="#" class="cbi-button cbi-button-apply" style="margin-left:3em" value="<%:Update lists%>" />
</div>
<% end %>
@@ -101,7 +102,7 @@ end
<label class="cbi-value-title"><%:Download and install package%>:</label>
<div class="cbi-value-field">
<input type="text" name="url" size="30" value="" />
- <input class="cbi-button cbi-input-save" type="submit" name="submit" value="<%:OK%>" />
+ <input class="cbi-button cbi-input-save" type="submit" name="exec" value="<%:OK%>" />
</div>
</div>
@@ -114,83 +115,98 @@ end
</div>
</fieldset>
</fieldset>
- <br />
-
- <h3><%:Status%></h3>
-
-
- <ul class="cbi-tabmenu">
- <li class="cbi-tab<% if display ~= "installed" then %>-disabled<% end %>"><a href="?display=installed&amp;query=<%=pcdata(query)%>"><%:Installed packages%><% if query then %> (<%=pcdata(query)%>)<% end %></a></li>
- <li class="cbi-tab<% if display ~= "available" then %>-disabled<% end %>"><a href="?display=available&amp;query=<%=pcdata(query)%>"><%:Available packages%><% if query then %> (<%=pcdata(query)%>)<% end %></a></li>
- </ul>
-
- <% if display ~= "available" then %>
- <fieldset class="cbi-section">
- <table class="cbi-section-table" style="width:100%">
- <tr class="cbi-section-table-titles">
- <th class="cbi-section-table-cell" style="text-align:left">&#160;</th>
- <th class="cbi-section-table-cell" style="text-align:left"><%:Package name%></th>
- <th class="cbi-section-table-cell" style="text-align:left"><%:Version%></th>
- </tr>
- <% local empty = true; luci.model.ipkg.list_installed(querypat, function(n, v, s, d) empty = false; filter[n] = true %>
- <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
- <td style="text-align:left; width:10%"><a onclick="return window.confirm('<%:Remove%> &quot;<%=luci.util.pcdata(n)%>&quot; ?')" href="<%=REQUEST_URI%>?submit=1&amp;remove=<%=luci.util.pcdata(n)%>"><%:Remove%></a></td>
- <td style="text-align:left"><%=luci.util.pcdata(n)%></td>
- <td style="text-align:left"><%=luci.util.pcdata(v)%></td>
- </tr>
- <% end) %>
- <% if empty then %>
- <tr class="cbi-section-table-row">
- <td style="text-align:left">&#160;</td>
- <td style="text-align:left"><em><%:none%></em></td>
- <td style="text-align:left"><em><%:none%></em></td>
- </tr>
- <% end %>
- </table>
- </fieldset>
- <% else %>
- <fieldset class="cbi-section">
- <% if not querypat then %>
- <ul class="cbi-tabmenu">
- <% local i; for i = 65, 90 do %>
- <li class="cbi-tab<% if letter ~= i then %>-disabled<% end %>"><a href="?display=available&amp;letter=<%=string.char(i)%>"><%=string.char(i)%></a></li>
- <% end %>
- <li class="cbi-tab<% if letter ~= 35 then %>-disabled<% end %>"><a href="?display=available&amp;letter=%23">#</a></li>
- </ul>
- <div class="cbi-section-node">
- <% end %>
- <table class="cbi-section-table" style="width:100%">
- <tr class="cbi-section-table-titles">
- <th class="cbi-section-table-cell" style="text-align:left">&#160;</th>
- <th class="cbi-section-table-cell" style="text-align:left"><%:Package name%></th>
- <th class="cbi-section-table-cell" style="text-align:left"><%:Version%></th>
- <th class="cbi-section-table-cell" style="text-align:right"><%:Size (.ipk)%></th>
- <th class="cbi-section-table-cell" style="text-align:left"><%:Description%></th>
- </tr>
- <% local empty = true; opkg_list(querypat or letterpat, function(n, v, s, d) if filter[n] then return end; empty = false %>
- <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
- <td style="text-align:left; width:10%"><a onclick="return window.confirm('<%:Install%> &quot;<%=luci.util.pcdata(n)%>&quot; ?')" href="<%=REQUEST_URI%>?submit=1&amp;install=<%=luci.util.pcdata(n)%>"><%:Install%></a></td>
- <td style="text-align:left"><%=luci.util.pcdata(n)%></td>
- <td style="text-align:left"><%=luci.util.pcdata(v)%></td>
- <td style="text-align:right"><%=luci.util.pcdata(s)%></td>
- <td style="text-align:left"><%=luci.util.pcdata(d)%></td>
- </tr>
- <% end) %>
- <% if empty then %>
- <tr class="cbi-section-table-row">
- <td style="text-align:left">&#160;</td>
- <td style="text-align:left"><em><%:none%></em></td>
- <td style="text-align:left"><em><%:none%></em></td>
- <td style="text-align:right"><em><%:none%></em></td>
- <td style="text-align:left"><em><%:none%></em></td>
- </tr>
- <% end %>
- </table>
- <% if not querypat then %>
- </div>
- <% end %>
- </fieldset>
+ </form>
+
+
+ <h3><%:Status%></h3>
+
+
+ <ul class="cbi-tabmenu">
+ <li class="cbi-tab<% if display ~= "installed" then %>-disabled<% end %>"><a href="?display=installed&amp;query=<%=pcdata(query)%>"><%:Installed packages%><% if query then %> (<%=pcdata(query)%>)<% end %></a></li>
+ <li class="cbi-tab<% if display ~= "available" then %>-disabled<% end %>"><a href="?display=available&amp;query=<%=pcdata(query)%>"><%:Available packages%><% if query then %> (<%=pcdata(query)%>)<% end %></a></li>
+ </ul>
+
+ <% if display ~= "available" then %>
+ <fieldset class="cbi-section">
+ <table class="cbi-section-table" style="width:100%">
+ <tr class="cbi-section-table-titles">
+ <th class="cbi-section-table-cell" style="text-align:left">&#160;</th>
+ <th class="cbi-section-table-cell" style="text-align:left"><%:Package name%></th>
+ <th class="cbi-section-table-cell" style="text-align:left"><%:Version%></th>
+ </tr>
+ <% local empty = true; luci.model.ipkg.list_installed(querypat, function(n, v, s, d) empty = false; filter[n] = true %>
+ <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
+ <td style="text-align:left; width:10%">
+ <form method="post" class="inline" action="<%=REQUEST_URI%>">
+ <input type="hidden" name="exec" value="1" />
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input type="hidden" name="remove" value="<%=pcdata(n)%>" />
+ <a onclick="window.confirm('<%:Remove%> &quot;<%=luci.util.pcdata(n)%>&quot; ?') &#38;&#38; this.parentNode.submit(); return false" href="#"><%:Remove%></a>
+ </form>
+ </td>
+ <td style="text-align:left"><%=luci.util.pcdata(n)%></td>
+ <td style="text-align:left"><%=luci.util.pcdata(v)%></td>
+ </tr>
+ <% end) %>
+ <% if empty then %>
+ <tr class="cbi-section-table-row">
+ <td style="text-align:left">&#160;</td>
+ <td style="text-align:left"><em><%:none%></em></td>
+ <td style="text-align:left"><em><%:none%></em></td>
+ </tr>
+ <% end %>
+ </table>
+ </fieldset>
+ <% else %>
+ <fieldset class="cbi-section">
+ <% if not querypat then %>
+ <ul class="cbi-tabmenu">
+ <% local i; for i = 65, 90 do %>
+ <li class="cbi-tab<% if letter ~= i then %>-disabled<% end %>"><a href="?display=available&amp;letter=<%=string.char(i)%>"><%=string.char(i)%></a></li>
+ <% end %>
+ <li class="cbi-tab<% if letter ~= 35 then %>-disabled<% end %>"><a href="?display=available&amp;letter=%23">#</a></li>
+ </ul>
+ <div class="cbi-section-node">
+ <% end %>
+ <table class="cbi-section-table" style="width:100%">
+ <tr class="cbi-section-table-titles">
+ <th class="cbi-section-table-cell" style="text-align:left">&#160;</th>
+ <th class="cbi-section-table-cell" style="text-align:left"><%:Package name%></th>
+ <th class="cbi-section-table-cell" style="text-align:left"><%:Version%></th>
+ <th class="cbi-section-table-cell" style="text-align:right"><%:Size (.ipk)%></th>
+ <th class="cbi-section-table-cell" style="text-align:left"><%:Description%></th>
+ </tr>
+ <% local empty = true; opkg_list(querypat or letterpat, function(n, v, s, d) if filter[n] then return end; empty = false %>
+ <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
+ <td style="text-align:left; width:10%">
+ <form method="post" class="inline" action="<%=REQUEST_URI%>">
+ <input type="hidden" name="exec" value="1" />
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input type="hidden" name="install" value="<%=pcdata(n)%>" />
+ <a onclick="window.confirm('<%:Install%> &quot;<%=luci.util.pcdata(n)%>&quot; ?') &#38;&#38; this.parentNode.submit(); return false" href="#"><%:Install%></a>
+ </form>
+ </td>
+ <td style="text-align:left"><%=luci.util.pcdata(n)%></td>
+ <td style="text-align:left"><%=luci.util.pcdata(v)%></td>
+ <td style="text-align:right"><%=luci.util.pcdata(s)%></td>
+ <td style="text-align:left"><%=luci.util.pcdata(d)%></td>
+ </tr>
+ <% end) %>
+ <% if empty then %>
+ <tr class="cbi-section-table-row">
+ <td style="text-align:left">&#160;</td>
+ <td style="text-align:left"><em><%:none%></em></td>
+ <td style="text-align:left"><em><%:none%></em></td>
+ <td style="text-align:right"><em><%:none%></em></td>
+ <td style="text-align:left"><em><%:none%></em></td>
+ </tr>
+ <% end %>
+ </table>
+ <% if not querypat then %>
+ </div>
<% end %>
- </div>
-</form>
+ </fieldset>
+ <% end %>
+</div>
+
<%+footer%>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm
index 80768119fe..c9551804d2 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/reboot.htm
@@ -1,25 +1,59 @@
<%#
Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
<%+header%>
-<h2><a id="content" name="content"><%:System%></a></h2>
-<h3><%:Reboot%></h3>
+
+<h2 name="content"><%:Reboot%></h2>
+<br />
+
<p><%:Reboots the operating system of your device%></p>
-<%-
-local c = require("luci.model.uci").cursor():changes()
-if c and next(c) then
--%>
- <p class="warning"><%:Warning: There are unsaved changes that will be lost while rebooting!%></p>
-<%-
-end
-if not reboot then
--%>
-<p><a href="<%=controller%>/admin/system/reboot?reboot=1"><%:Perform reboot%></a></p>
-<%- else -%>
-<p><%:Please wait: Device rebooting...%></p>
-<script type="text/javascript">setTimeout("location='<%=controller%>/admin'", 60000)</script>
+
+<%- local c = require("luci.model.uci").cursor():changes(); if c and next(c) then -%>
+ <p class="alert-message warning"><%:Warning: There are unsaved changes that will get lost on reboot!%></p>
<%- end -%>
-<%+footer%> \ No newline at end of file
+
+<hr />
+
+<script type="text/javascript">//<![CDATA[
+ var tries = 0;
+
+ function ok() {
+ window.location = '<%=controller%>/admin';
+ }
+
+ function check() {
+ if (tries++ < 12)
+ window.setTimeout(ping, 5000);
+ else
+ alert('<%:Device unreachable%>');
+ }
+
+ function ping() {
+ var img = document.createElement('img');
+
+ img.onload = ok;
+ img.onerror = check;
+ img.src = '<%=resource%>/icons/loading.gif?' + Math.random();
+
+ document.getElementById('reboot-message').innerHTML = '<%:Waiting for device...%>';
+ }
+
+ function reboot(button) {
+ button.style.display = 'none';
+ document.getElementById('reboot-message').parentNode.style.display = '';
+
+ (new XHR()).post('<%=controller%>/admin/system/reboot/call', { token: '<%=token%>' }, check);
+ }
+//]]></script>
+
+<input class="cbi-button cbi-button-apply" type="button" value="<%:Perform reboot%>" onclick="reboot(this)" />
+
+<p class="alert-message" style="display:none">
+ <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
+ <span id="reboot-message"><%:Device is rebooting...%></span>
+</p>
+
+<%+footer%>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm
index b9d42357bb..5ca0398e13 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/upgrade.htm
@@ -6,7 +6,7 @@
<%+header%>
-<h2><a id="content" name="content"><%:Flash Firmware%> - <%:Verify%></a></h2>
+<h2 name="content"><%:Flash Firmware%> - <%:Verify%></h2>
<p>
<%_ The flash image was uploaded.
Below is the checksum and file size listed,
@@ -45,12 +45,11 @@
</fieldset>
<div class="cbi-page-actions right">
- <form style="display:inline" action="<%=REQUEST_URI%>" method="post">
- <input class="cbi-button cbi-button-reset" type="submit" value="<%:Cancel%>" />
- </form>
- <form style="display:inline" action="<%=REQUEST_URI%>" method="post">
+ <form class="inline" action="<%=REQUEST_URI%>" method="post">
+ <input type="hidden" name="token" value="<%=token%>" />
<input type="hidden" name="step" value="2" />
<input type="hidden" name="keep" value="<%=keep and "1" or ""%>" />
+ <input class="cbi-button cbi-button-reset" name="cancel" type="submit" value="<%:Cancel%>" />
<input class="cbi-button cbi-button-apply" type="submit" value="<%:Proceed%>" />
</form>
</div>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_uci/apply.htm b/modules/luci-mod-admin-full/luasrc/view/admin_uci/apply.htm
index 4284b44d38..370027e510 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_uci/apply.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_uci/apply.htm
@@ -6,7 +6,7 @@
<%+header%>
-<h2><a id="content" name="content"><%:Configuration%> / <%:Apply%></a></h2>
+<h2 name="content"><%:Configuration%> / <%:Apply%></h2>
<% if changes then %>
<%+cbi/apply_xhr%>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_uci/changes.htm b/modules/luci-mod-admin-full/luasrc/view/admin_uci/changes.htm
index 84e22879e0..c3373604f3 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_uci/changes.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_uci/changes.htm
@@ -1,12 +1,12 @@
<%#
Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
Licensed to the public under the Apache License 2.0.
-%>
<%+header%>
-<h2><a id="content" name="content"><%:Configuration%> / <%:Changes%></a></h2>
+<h2 name="content"><%:Configuration%> / <%:Changes%></h2>
<% if changes then %>
<%+admin_uci/changelog%>
@@ -25,15 +25,18 @@
<% end %>
<div style="text-align:right">
- <form class="inline" method="get" action="<%=controller%>/admin/uci/apply">
+ <form class="inline" method="post" action="<%=controller%>/admin/uci/apply">
+ <input type="hidden" name="token" value="<%=token%>" />
<input type="hidden" name="redir" value="<%=pcdata(luci.http.formvalue("redir"))%>" />
<input class="cbi-button cbi-button-apply" type="submit" value="<%:Apply%>" />
</form>
- <form class="inline" method="get" action="<%=controller%>/admin/uci/saveapply">
+ <form class="inline" method="post" action="<%=controller%>/admin/uci/saveapply">
+ <input type="hidden" name="token" value="<%=token%>" />
<input type="hidden" name="redir" value="<%=pcdata(luci.http.formvalue("redir"))%>" />
<input class="cbi-button cbi-button-save" type="submit" value="<%:Save & Apply%>" />
</form>
- <form class="inline" method="get" action="<%=controller%>/admin/uci/revert">
+ <form class="inline" method="post" action="<%=controller%>/admin/uci/revert">
+ <input type="hidden" name="token" value="<%=token%>" />
<input type="hidden" name="redir" value="<%=pcdata(luci.http.formvalue("redir"))%>" />
<input class="cbi-button cbi-button-reset" type="submit" value="<%:Revert%>" />
</form>
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_uci/revert.htm b/modules/luci-mod-admin-full/luasrc/view/admin_uci/revert.htm
index d2bdc7a971..5da7281a80 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_uci/revert.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_uci/revert.htm
@@ -6,7 +6,7 @@
<%+header%>
-<h2><a id="content" name="content"><%:Configuration%> / <%:Revert%></a></h2>
+<h2 name="content"><%:Configuration%> / <%:Revert%></h2>
<% if changes then %>
<%+cbi/apply_xhr%>