8fe658a4278f938bb47d3764472e6f3524f39b65
[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 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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 <%+header%>
16 <h1><%:system%></h1>
17 <h2><%:a_s_flash%></h2>
18 <p><%:a_s_flash_upgrade1%></p>
19 <br />
20 <% if next(blocks) and not next(flash) then %>
21 <form method="post" action="<%=REQUEST_URI%>" enctype="multipart/form-data">
22         <div class="left"><%:a_s_flash_fwimage%>:</div>
23         <div>
24                 <% for name, v in pairs(blocks) do %>
25                         <%=name%>: <input type="file" size="30" name="<%=name%>" /><br />
26                 <% end %>
27                 <br />
28                 <% if keep_avail then -%>
29                 <input type="checkbox" name="keepcfg" value="1" checked="checked" />
30                 <span class="bold"><%:a_s_flash_keepcfg%></span>
31                 <% end -%>
32         </div>
33         <div>
34                 <input type="submit" value="<%:a_s_flash_fwupgrade%>" />
35         </div>
36 </form>
37 <% elseif next(flash) then %>
38         <p><%:a_s_flash_received%></p>
39         
40         <% reboot.exec = false
41         for i, entry in ipairs(flash) do 
42                 local name, func = entry.name, entry.func %>
43                 <%:a_s_flash_inprogress%> <%=name%>...
44                 <%=string.rep(" ", 32*1024)%>
45                 <%
46                  local stat, code = func()
47                  reboot.exec = reboot.exec or stat 
48                 if stat and code then %>
49                         <%:ok%><br />
50                 <% else %>
51                         <%:a_s_flash_flasherr%>! (<%:code%> <%=code%>)<br />    
52                 <% end %>
53                 <% if reboot.exec then %>
54                         <br />
55                         <div><%:a_s_flash_flashed%></div>
56                 <% end %>
57         <% end %>
58 <% else %>
59 <div class="error"><%:a_s_flash_notimplemented%></div>
60 <% end %>
61 <%+footer%>