summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.net>2017-07-12 22:51:41 -0700
committerStan Grishin <stangri@melmac.net>2017-07-12 23:21:36 -0700
commitf6505fc01c8aee4d2f9f7bc7537c3a93cfd5dab1 (patch)
tree11c110dc7651267458dcd9d83adeada28b8fff6b /applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot
parent00ae50134bba7df05e1c6743d250f0137261fdb7 (diff)
luci-app-advanced-reboot: initial commit
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot')
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm92
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/alternative_reboot.htm29
-rw-r--r--applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/power_off.htm25
3 files changed, 146 insertions, 0 deletions
diff --git a/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm
new file mode 100644
index 000000000..206d25054
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/advanced_reboot.htm
@@ -0,0 +1,92 @@
+<%#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008-2015 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2017 Stan Grishin <stangri@melmac.net>
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<%+header%>
+
+<h2 name="content"><%:Advanced Reboot%></h2>
+<br />
+
+<%- 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 -%>
+
+<%- if device_name then -%>
+<fieldset class="cbi-section">
+ <legend><%=device_name%><%: Partitions%></legend>
+ <table class="cbi-section-table" id="partitions">
+ <tr class="cbi-section-table-titles">
+ <th class="cbi-section-table-cell"><%:Partition%></th>
+ <th class="cbi-section-table-cell"><%:Status%></th>
+ <th class="cbi-section-table-cell"><%:Firmware/OS (Kernel)%></th>
+ <th class="cbi-section-table-cell"><%:Action%></th>
+ </tr>
+ <tr class="cbi-section-table-row">
+ <td>
+ <%=boot_envvar1_partition_one%>
+ </td>
+ <td>
+ <%- if boot_envvar1_partition_one == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
+ </td>
+ <td>
+ <%=partition_one_os%>
+ </td>
+ <td>
+ <%- if boot_envvar1_partition_one == current_partition then -%>
+ <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
+ </form>
+ <%- else -%>
+ <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
+ </form>
+ <%- end -%>
+ </td>
+ </tr>
+ <tr class="cbi-section-table-row">
+ <td>
+ <%=boot_envvar1_partition_two%>
+ </td>
+ <td>
+ <%- if boot_envvar1_partition_two == current_partition then -%><%:Current%><%- else -%><%:Alternative%><%- end -%>
+ </td>
+ <td>
+ <%=partition_two_os%>
+ </td>
+ <td>
+ <%- if boot_envvar1_partition_two == current_partition then -%>
+ <form method="post" action="<%=url('admin/system/advanced_reboot/reboot')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="reboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to current partition%>" />
+ </form>
+ <%- else -%>
+ <form method="post" action="<%=url('admin/system/advanced_reboot/alternative_reboot')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="altreboot-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Reboot to alternative partition...%>" />
+ </form>
+ <%- end -%>
+ </td>
+ </tr>
+ </table>
+</fieldset>
+<%- else -%>
+ <p class="alert-message warning"><%:Warning: This system does not have two partitions!%></p>
+<%- end -%>
+
+<hr />
+
+<%- if nixio.fs.access("/sbin/poweroff") then -%>
+<form method="post" action="<%=url('admin/system/advanced_reboot/power_off')%>">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input id="poweroff-button" type="submit" class="cbi-button cbi-button-apply" value="<%:Perform power off...%>" />
+</form>
+<%- else -%>
+ <p class="alert-message warning"><%:Warning: This system does not support powering off!%></p>
+<%- end -%>
+
+<%+footer%>
diff --git a/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/alternative_reboot.htm b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/alternative_reboot.htm
new file mode 100644
index 000000000..632593409
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/alternative_reboot.htm
@@ -0,0 +1,29 @@
+<%#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008-2009 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2017 Stan Grishin <stangri@melmac.net>
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<%+header%>
+
+<h2 name="content"><%:Reboot Device to an Alternative Partition%> - <%:Confirm%></h2>
+<p>
+ <%_ WARNING: An alternative partition might have its own settings and completely different firmware.<br /><br />
+ As your network configuration and WiFi SSID/password on alternative partition might be different,
+ you might have to adjust your computer settings to be able to access your device once it reboots.<br /><br />
+ Please also be aware that alternative partition firmware might not provide an easy way to switch active partition
+ and boot back to the currently active partition.<br /><br />
+ Click "Proceed" below to reboot device to an alternative partition. %>
+</p>
+
+<div class="cbi-page-actions right">
+ <form class="inline" action="<%=REQUEST_URI%>" method="post">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input type="hidden" name="step" value="2" />
+ <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>
+
+<%+footer%>
diff --git a/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/power_off.htm b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/power_off.htm
new file mode 100644
index 000000000..0ddea11e6
--- /dev/null
+++ b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/power_off.htm
@@ -0,0 +1,25 @@
+<%#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008-2009 Jo-Philipp Wich <jow@openwrt.org>
+ Copyright 2017 Stan Grishin <stangri@melmac.net>
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<%+header%>
+
+<h2 name="content"><%:Power Off Device%> - <%:Confirm%></h2>
+<p>
+ <%_ WARNING: Power off might result in a reboot on a device which doesn't support power off.<br /><br />
+ Click "Proceed" below to power off your device. %>
+</p>
+
+<div class="cbi-page-actions right">
+ <form class="inline" action="<%=REQUEST_URI%>" method="post">
+ <input type="hidden" name="token" value="<%=token%>" />
+ <input type="hidden" name="step" value="2" />
+ <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>
+
+<%+footer%>