modules/admin-full: rewrite firmware upgrade pages
[project/luci.git] / modules / admin-full / luasrc / view / admin_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><%:a_s_flash%></h3>
20
21 <% if step == 1 then %>
22         <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
23         <p>
24                 <%:admin_upgrade Upload an OpenWrt image file to reflash the device.%>
25                 <% if bad_image then %>
26                         <br /><br />
27                         <div class="error"><%:admin_upgrade_badimage The uploaded image file does not
28                                 contain a supported format. Make sure that you choose the generic
29                                 image format for your platform. %></div>
30                 <% end %>
31         </p>
32         <div>
33                 <%:admin_upgrade_fwimage Firmware image%>:<br />
34                 <input type="hidden" name="step" value="2" />
35                 <input type="file" size="30" name="image" />
36                 <br />
37                 <br />
38                 <% if keepavail then -%>
39                 <input type="checkbox" name="keepcfg" value="1" checked="checked" />
40                 <span class="bold"><%:a_s_flash_keepcfg%></span>
41                 <% end -%>
42
43                 <br />
44                 <input class="cbi-button cbi-button-apply" type="submit" value="<%:admin_upgrade_upload Upload image%>" />
45         </div>
46         </form>
47 <% elseif step == 2 then %>
48         <p>
49                 <%:admin_upgrade_uploaded The flash image was uploaded.
50                         Below is the checksum and file size listed,
51                         compare them with the original file to ensure data integrity.<br />
52                         Click "Proceed" below to start the flash procedure. %>
53
54                 <% if filesize > flashsize then %>
55                         <br /><br />
56                         <div class="error"><%:admin_upgrade_toolarge It appears that you try to
57                                 flash an image that does not fit in the flash memory, please verify
58                                 the image file! %></div>
59                 <% end %>
60
61                 <br />
62                 <ul>
63                         <li><%:admin_upgrade_checksum Checksum%>: <code><%=checksum%></code></li>
64                         <li><%:admin_upgrade_filesize Size%>: <%
65                                 local w = require "luci.tools.webadmin"
66                                 write(w.byte_format(filesize))
67         
68                                 if flashsize > 0 then
69                                         write(luci.i18n.translatef(
70                                                 "admin_upgrade_spaceavil",
71                                                 " (%s available)",
72                                                 w.byte_format(flashsize)
73                                         ))
74                                 end
75                         %></li>
76                 </ul>
77         </p>
78         <div class="cbi-page-actions right">
79                 <form style="display:inline">
80                         <input type="hidden" name="step" value="3" />
81                         <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
82                         <input class="cbi-button cbi-button-apply" type="submit" value="<%:proceed Proceed%>" />        
83                 </form>
84                 <form style="display:inline">
85                         <input type="hidden" name="step" value="1" />
86                         <input type="hidden" name="keepcfg" value="<%=keepconfig and "1" or "0"%>" />
87                         <input class="cbi-button cbi-button-reset" type="submit" value="<%:cancel Cancel%>" />
88                 </form>
89         </div>
90 <% elseif step == 3 then %>
91         <p><%:admin_upgrade_running The system is flashing now.<br />
92                 DO NOT POWER OFF THE DEVICE!<br />
93                 Wait a few minutes until you try to reconnect.
94                 It might be necessary to renew the address of your computer to reach the device
95                 again, depending on your settings. %></p>
96                 
97         <iframe src="<%=REQUEST_URI%>?step=4&#38;keepcfg=<%=keepconfig and "1" or "0"%>" style="border:1px solid black; width:100%; height:150px"></iframe>
98 <% end %>
99 <%+footer%>
100