0f2f2e2ab7f09f7df9fe1e0a25f0eb042f7d6645
[project/luci.git] / modules / admin-full / luasrc / view / admin_system / packages.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 <%-
16 local bit = require "bit"
17 local rowcnt = 1
18
19 function rowstyle()
20         rowcnt = rowcnt + 1
21         return (rowcnt % 2) + 1
22 end
23
24 function opkg_error(code)
25         code = bit.rshift(tonumber(code), 8)
26         return translate("OPKG error code %i" % code)
27 end
28 -%>
29 <%+header%>
30 <h2><a id="content" name="content"><%:System%></a></h2>
31 <h3><%:Software%></h3>
32
33 <br />
34
35 <% if install or remove or update or upgrade then %>
36 <div class="code"><strong><%:Status%>:</strong><br />
37 <% if update then %>
38         <%:Package lists updated%>: <% if update == 0 then %><span class="ok"><%:OK%></span><% else %><span class="error"><%:Error%> (<%=opkg_error(update)%>)</span><% end %><br />
39 <% end %>
40 <% if upgrade then%>
41         <%:Upgrade installed packages%>: <% if upgrade == 0 then %><span class="ok"><%:OK%></span><% else %><span class="error"><%:Error%> (<%=opkg_error(upgrade)%>)</span><% end %><br />
42 <% end %>
43 <% if install then for k,v in pairs(install) do %>
44         <%:Install%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:OK%></span><% else %><span class="error"><%:Error%> (<%=opkg_error(v)%>)</span><% end %><br />
45 <% end end %>
46 <% if remove then for k,v in pairs(remove) do %>
47         <%:Remove%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:OK%></span><% else %><span class="error"><%:Error%> (<%=opkg_error(v)%>)</span><% end %><br />
48 <% end end %>
49 </div>
50 <br />
51 <% end %>
52
53 <form method="post" action="<%=REQUEST_URI%>">
54         <div class="cbi-map">
55                 <fieldset class="cbi-section">
56                         <ul>
57                                 <li><a href="<%=REQUEST_URI%>/ipkg"><%:Edit package lists and installation targets%></a></li>
58                                 <li><a href="<%=REQUEST_URI%>?update=1"><%:Update package lists%></a></li>
59                         </ul>
60                         <br />
61                         <fieldset class="cbi-section-node">
62                         <div class="cbi-value">
63                                 <label class="cbi-value-title"><%:Download and install package%>:</label>
64                                 <div class="cbi-value-field">
65                                         <input type="text" name="url" size="30" value="" />
66                                         <input class="cbi-input-save" type="submit" name="submit" value="<%:OK%>" />
67                                 </div>
68                         </div>
69
70                         <div class="cbi-value">
71                                 <label class="cbi-value-title"><%:Filter%>:</label>
72                                 <div class="cbi-value-field">
73                                         <input type="text" name="query" size="20" value="<%=query%>" />
74                                         <input type="submit" class="cbi-input-find" name="search" value="<%:Find package%>" />
75                                 </div>
76                         </div>
77
78                         <table class="cbi-section-table">
79                                 <tr class="cbi-section-table-titles">
80                                         <th class="cbi-section-table-cell"><%:Package name%></th>
81                                         <th class="cbi-section-table-cell"><%:Version%></th>
82                                         <th class="cbi-section-table-cell"><%:Install%></th>
83                                         <th class="cbi-section-table-cell"><%:Delete%></th>
84                                         <th class="cbi-section-table-cell"><%:Description%></th>
85                                 </tr>
86                                 <% for k, pkg in pairs(pkgs) do %>
87                                 <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
88                                         <td><%=luci.util.pcdata(pkg.Package)%></td>
89                                         <td><%=luci.util.pcdata(pkg.Version)%></td>
90                                         <td><% if not pkg.Status or not pkg.Status.installed then %><input type="checkbox" name="install.<%=pkg.Package%>" value="1" /><% else %><%:installed%><% end %></td>
91                                         <td><% if pkg.Status and pkg.Status.installed then %><input type="checkbox" name="remove.<%=pkg.Package%>" value="1" /><% else %><%:not installed%><% end %></td>
92                                         <td><%=luci.util.pcdata(pkg.Description)%></td>
93                                 </tr>
94                                 <% end %>
95                         </table>
96
97                         <br />
98
99                         <div style="text-align: right">
100                                 <input type="submit" class="cbi-input-apply" name="submit" value="<%:Perform Actions%>" />
101                         </div>
102                 </fieldset></fieldset>
103         </div>
104 </form>
105 <%+footer%>