diff options
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/view')
28 files changed, 349 insertions, 270 deletions
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..646d931f37 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) @@ -125,7 +135,7 @@ html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime); } - if (ifc.type != 'tunnel') + if (ifc.macaddr) { html += String.format('<strong><%:MAC-Address%>:</strong> %s<br />', ifc.macaddr); } @@ -139,32 +149,20 @@ if (ifc.ipaddrs && ifc.ipaddrs.length) { - html += '<strong><%:IPv4%>: </strong>'; - for (var i = 0; i < ifc.ipaddrs.length; i++) html += String.format( - '%s%s/%d', - i ? ', ' : '', - ifc.ipaddrs[i].addr, - ifc.ipaddrs[i].prefix + '<strong><%:IPv4%>:</strong> %s<br />', + ifc.ipaddrs[i] ); - - html += '<br />'; } if (ifc.ip6addrs && ifc.ip6addrs.length) { - html += '<strong><%:IPv6%>: </strong>'; - for (var i = 0; i < ifc.ip6addrs.length; i++) html += String.format( - '%s%s/%d', - i ? ', ' : '', - ifc.ip6addrs[i].addr.toUpperCase(), - ifc.ip6addrs[i].prefix + '<strong><%:IPv6%>:</strong> %s<br />', + ifc.ip6addrs[i] ); - - html += '<br />'; } d.innerHTML = html; @@ -178,14 +176,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 +237,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="button" 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..94d9e88117 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])) @@ -25,7 +25,7 @@ html += String.format('<strong><%:Uptime%>:</strong> %t<br />', ifc.uptime); } - if (ifc.type != 'tunnel') + if (ifc.macaddr) { html += String.format('<strong><%:MAC-Address%>:</strong> %s<br />', ifc.macaddr); } @@ -43,10 +43,9 @@ for (var i = 0; i < ifc.ipaddrs.length; i++) html += String.format( - '%s%s/%d', + '%s%s', i ? ', ' : '', - ifc.ipaddrs[i].addr, - ifc.ipaddrs[i].prefix + ifc.ipaddrs[i] ); html += '<br />'; @@ -58,10 +57,9 @@ for (var i = 0; i < ifc.ip6addrs.length; i++) html += String.format( - '%s%s/%d', + '%s%s', i ? ', ' : '', - ifc.ip6addrs[i].addr.toUpperCase(), - ifc.ip6addrs[i].prefix + ifc.ip6addrs[i].toUpperCase() ); html += '<br />'; 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 1ceda47852..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,80 +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&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&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"> </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, 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%> "<%=luci.util.pcdata(n)%>" ?')" href="<%=REQUEST_URI%>?submit=1&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"> </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&letter=<%=string.char(i)%>"><%=string.char(i)%></a></li> - <% end %> - <li class="cbi-tab<% if letter ~= 35 then %>-disabled<% end %>"><a href="?display=available&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"> </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:left"><%:Description%></th> - </tr> - <% local empty = true; opkg_list(querypat or letterpat, function(n, v, 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%> "<%=luci.util.pcdata(n)%>" ?')" href="<%=REQUEST_URI%>?submit=1&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:left"><%=luci.util.pcdata(d)%></td> - </tr> - <% end) %> - <% if empty then %> - <tr class="cbi-section-table-row"> - <td style="text-align:left"> </td> - <td style="text-align:left"><em><%:none%></em></td> - <td style="text-align:left"><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&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&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"> </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%> "<%=luci.util.pcdata(n)%>" ?') && 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"> </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&letter=<%=string.char(i)%>"><%=string.char(i)%></a></li> + <% end %> + <li class="cbi-tab<% if letter ~= 35 then %>-disabled<% end %>"><a href="?display=available&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"> </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%> "<%=luci.util.pcdata(n)%>" ?') && 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"> </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%> |