luci-app-advanced-reboot: import applyreboot template from luci-mod-system
authorJo-Philipp Wich <jo@mein.io>
Mon, 7 Oct 2019 09:41:42 +0000 (11:41 +0200)
committerJo-Philipp Wich <jo@mein.io>
Mon, 7 Oct 2019 09:53:39 +0000 (11:53 +0200)
Since the advanced-reboot app is the sole remaining user of the applyreboot
template, import it into this package to avoid the need for shipping it
with the default installation.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
applications/luci-app-advanced-reboot/luasrc/controller/advanced_reboot.lua
applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/applyreboot.htm [new file with mode: 0644]
modules/luci-mod-system/luasrc/view/admin_system/applyreboot.htm [deleted file]

index 733242486692ba44740884c97bb916e129acae75..6b8cba4c4096f66de0ca987853c909b40335688e 100644 (file)
@@ -89,7 +89,7 @@ end
 function action_reboot()
   local uci = require "luci.model.uci".cursor()
   local ip  = uci:get("network", "lan", "ipaddr")
-  luci.template.render("admin_system/applyreboot", {
+  luci.template.render("advanced_reboot/applyreboot", {
         title = luci.i18n.translate("Rebooting..."),
         msg   = luci.i18n.translate("The system is rebooting 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  = luci.ip.new(type(ip) == "string" and ip or "192.168.1.1") or "192.168.1.1"
@@ -161,7 +161,7 @@ function action_altreboot()
       end
     end
     if not errorMessage then
-      luci.template.render("admin_system/applyreboot", {
+      luci.template.render("advanced_reboot/applyreboot", {
             title = luci.i18n.translate("Rebooting..."),
             msg   = luci.i18n.translate("The system is rebooting to an alternative partition 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  = luci.ip.new(uci:get("network", "lan", "ipaddr")) or "192.168.1.1"
@@ -195,7 +195,7 @@ function action_poweroff()
       luci.template.render("advanced_reboot/advanced_reboot",{})
     end
   elseif step == 2 then
-    luci.template.render("admin_system/applyreboot", {
+    luci.template.render("advanced_reboot/applyreboot", {
           title = luci.i18n.translate("Shutting down..."),
           msg   = luci.i18n.translate("The system is shutting down now.<br /> DO NOT POWER OFF THE DEVICE!<br /> It might be necessary to renew the address of your computer to reach the device again, depending on your settings."),
           addr  = luci.ip.new(uci:get("network", "lan", "ipaddr")) or "192.168.1.1"
diff --git a/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/applyreboot.htm b/applications/luci-app-advanced-reboot/luasrc/view/advanced_reboot/applyreboot.htm
new file mode 100644 (file)
index 0000000..e235bd4
--- /dev/null
@@ -0,0 +1,53 @@
+<%#
+ Copyright 2008 Steven Barth <steven@midlink.org>
+ Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
+ Licensed to the public under the Apache License 2.0.
+-%>
+
+<html>
+       <head>
+               <title><%=luci.sys.hostname()%> - <%= title or translate("Rebooting...") %></title>
+               <link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
+               <script type="text/javascript" src="<%=resource%>/xhr.js"></script>
+               <script type="text/javascript">//<![CDATA[
+                       var interval = window.setInterval(function() {
+                               var img = new Image();
+                               var target = ('https:' == document.location.protocol ? 'https://' : 'http://') + <%=addr and "'%s'" % addr or "window.location.host"%>;
+               
+                               img.onload = function() {
+                                       window.clearInterval(interval);
+                                       window.location.replace(target);
+                               };
+                               
+                               img.src = target + '<%=resource%>/icons/loading.gif?' + Math.random();
+                               
+                       }, 5000);
+               //]]></script>
+       </head>
+       <body>
+               <header>
+                       <div class="fill">
+                               <div class="container">
+                                       <p class="brand"><%=luci.sys.hostname() or "?"%></p>
+                               </div>
+                       </div>
+               </header>
+               &#160;
+               <div class="main">
+                       <div id="maincontainer">
+                               <div id="maincontent" class="container">
+                                       <h2 name="content" id="applyreboot-container" ><%:System%> - <%= title or translate("Rebooting...") %></h2>
+                                       <div class="cbi-section" id="applyreboot-section">
+                                               <div>
+                                                       <%= msg or translate("Changes applied.") %>
+                                               </div>
+                                               <div>
+                                                       <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
+                                                       <%:Waiting for changes to be applied...%>
+                                               </div>
+                                       </div>
+                               </div>
+                       </div>
+               </div>
+       </body>
+</html>
\ No newline at end of file
diff --git a/modules/luci-mod-system/luasrc/view/admin_system/applyreboot.htm b/modules/luci-mod-system/luasrc/view/admin_system/applyreboot.htm
deleted file mode 100644 (file)
index e235bd4..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-<%#
- Copyright 2008 Steven Barth <steven@midlink.org>
- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
- Licensed to the public under the Apache License 2.0.
--%>
-
-<html>
-       <head>
-               <title><%=luci.sys.hostname()%> - <%= title or translate("Rebooting...") %></title>
-               <link rel="stylesheet" type="text/css" media="screen" href="<%=media%>/cascade.css" />
-               <script type="text/javascript" src="<%=resource%>/xhr.js"></script>
-               <script type="text/javascript">//<![CDATA[
-                       var interval = window.setInterval(function() {
-                               var img = new Image();
-                               var target = ('https:' == document.location.protocol ? 'https://' : 'http://') + <%=addr and "'%s'" % addr or "window.location.host"%>;
-               
-                               img.onload = function() {
-                                       window.clearInterval(interval);
-                                       window.location.replace(target);
-                               };
-                               
-                               img.src = target + '<%=resource%>/icons/loading.gif?' + Math.random();
-                               
-                       }, 5000);
-               //]]></script>
-       </head>
-       <body>
-               <header>
-                       <div class="fill">
-                               <div class="container">
-                                       <p class="brand"><%=luci.sys.hostname() or "?"%></p>
-                               </div>
-                       </div>
-               </header>
-               &#160;
-               <div class="main">
-                       <div id="maincontainer">
-                               <div id="maincontent" class="container">
-                                       <h2 name="content" id="applyreboot-container" ><%:System%> - <%= title or translate("Rebooting...") %></h2>
-                                       <div class="cbi-section" id="applyreboot-section">
-                                               <div>
-                                                       <%= msg or translate("Changes applied.") %>
-                                               </div>
-                                               <div>
-                                                       <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
-                                                       <%:Waiting for changes to be applied...%>
-                                               </div>
-                                       </div>
-                               </div>
-                       </div>
-               </div>
-       </body>
-</html>
\ No newline at end of file