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