build: split into luci and luci-addons packages
[project/luci.git] / modules / niu / luasrc / view / niu / system / upgrade.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008-2009 Jo-Philipp Wich <xm@subsignal.org>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10         http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15
16 <%+header%>
17
18 <h2><a id="content" name="content"><%:System%></a></h2>
19 <h3><%:Flash Firmware%></h3>
20
21 <% if step == 1 then %>
22         <% if supported then %>
23         <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
24         <p>
25                 <%:Upload an OpenWrt image file to reflash the device.%>
26                 <% if bad_image then %>
27                         <br /><br />
28                         <div class="error"><%:The uploaded image file does not
29                                 contain a supported format. Make sure that you choose the generic
30                                 image format for your platform. %></div>
31                 <% end %>
32         </p>
33         <div>
34                 <%:Firmware image%>:<br />
35                 <input type="hidden" name="step" value="2" />
36                 <input type="file" size="30" name="image" />
37                 <br />
38                 <br />
39                 <% if keepavail then -%>
40                 <input type="checkbox" name="keepcfg" value="1" checked="checked" />
41                 <span class="bold"><%:Keep configuration files%></span>
42                 <% end -%>
43
44                 <br />
45                 <input class="cbi-button cbi-button-apply" type="submit" value="<%:Upload image%>" />
46         </div>
47         </form>
48         <% else %>
49                 <div class="error"><%_ Sorry.
50                         OpenWrt does not support a system upgrade on this platform.<br />
51                         You need to manually flash your device. %></div>
52         <% end %>
53 <% elseif step == 2 then %>
54         <p>
55                 <%_ The flash image was uploaded.
56                         Below is the checksum and file size listed,
57                         compare them with the original file to ensure data integrity.<br />
58                         Click "Proceed" below to start the flash procedure. %>
59
60                 <% if flashsize > 0 and filesize > flashsize then %>
61                         <br /><br />
62                         <div class="error"><%:It appears that you try to
63                                 flash an image that does not fit into the flash memory, please verify
64                                 the image file! %></div>
65                 <% end %>
66
67                 <br />
68                 <ul>
69                         <li><%:Checksum%>: <code><%=checksum%></code></li>
70                         <li><%:Size%>: <%
71                                 local w = require "luci.tools.webadmin"
72                                 write(w.byte_format(filesize))
73         
74                                 if flashsize > 0 then
75                                         write(luci.i18n.translatef(
76                                                 " (%s available)",
77                                                 w.byte_format(flashsize)
78                                         ))
79                                 end
80                         %></li>
81                 </ul>
82         </p>
83         <div class="cbi-page-actions right">
84                 <form style="display:inline">
85                         <input type="hidden" name="step" value="3" />
86                         <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
87                         <input class="cbi-button cbi-button-apply" type="submit" value="<%:Proceed%>" />        
88                 </form>
89                 <form style="display:inline">
90                         <input type="hidden" name="step" value="1" />
91                         <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
92                         <input class="cbi-button cbi-button-reset" type="submit" value="<%:Cancel%>" />
93                 </form>
94         </div>
95 <% elseif step == 3 then %>
96         <p><%_ The system is flashing now.<br />
97                 DO NOT POWER OFF THE DEVICE!<br />
98                 Wait a few minutes until you try to reconnect.
99                 It might be necessary to renew the address of your computer to reach the device
100                 again, depending on your settings. %></p>
101                 
102         <iframe src="<%=REQUEST_URI%>?step=4&#38;keepcfg=<%=keepconfig and "1" or "0"%>" style="border:1px solid black; width:100%; height:150px"></iframe>
103 <% end %>
104 <%+footer%>
105