2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
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
10 http://www.apache.org/licenses/LICENSE-2.0
16 local bit = require "bit"
21 return (rowcnt % 2) + 1
24 function opkg_error(code)
25 code = bit.rshift(tonumber(code), 8)
27 'a_s_packages_code%i' % code,
28 '%s %i' % { translate('code'), code }
33 <h2><a id="content" name="content"><%:system%> - <%:a_s_packages%></a></h2>
35 <form method="post" action="<%=REQUEST_URI%>">
37 <fieldset class="cbi-section">
39 <li><a href="<%=REQUEST_URI%>/ipkg"><%:a_s_packages_ipkg%></a></li>
40 <li><a href="<%=REQUEST_URI%>?update=1"><%:a_s_packages_updatelist%></a></li>
43 <fieldset class="cbi-section-node">
44 <div class="cbi-value">
45 <label class="cbi-value-title"><%:a_s_packages_installurl%>:</label>
46 <div class="cbi-value-field">
47 <input type="text" name="url" size="30" value="" />
48 <input class="cbi-input-save" type="submit" name="submit" value="<%:ok%>" />
52 <div class="cbi-value">
53 <label class="cbi-value-title"><%:filter%>:</label>
54 <div class="cbi-value-field">
55 <input type="text" name="query" size="20" value="<%=query%>" />
56 <input type="submit" class="cbi-input-find" name="search" value="<%:a_s_packages_search%>" />
62 <% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %>
64 <fieldset class="cbi-section">
66 <%:a_s_packages_update%>: <% if update == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(update)%>)</span><% end %><br />
69 <%:a_s_packages_upgrade%>: <% if upgrade == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(upgrade)%>)</span><% end %><br />
71 <% if install then for k,v in pairs(install) do %>
72 <%:a_s_packages_install%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(v)%>)</span><% end %><br />
74 <% if remove then for k,v in pairs(remove) do %>
75 <%:a_s_packages_remove%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:ok%></span><% else %><span class="error"><%:error%> (<%=opkg_error(v)%>)</span><% end %><br />
81 <h2><%:a_s_packages_installed Installed packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %></h2>
83 <fieldset class="cbi-section">
84 <table class="cbi-section-table" style="width:100%">
85 <tr class="cbi-section-table-titles">
86 <th class="cbi-section-table-cell" style="text-align:left"> </th>
87 <th class="cbi-section-table-cell" style="text-align:left"><%:a_s_packages_name%></th>
88 <th class="cbi-section-table-cell" style="text-align:left"><%:version%></th>
90 <% local empty = true; luci.model.ipkg.list_installed(query, function(n, v, d) empty = false %>
91 <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
92 <td style="text-align:left; width:10%"><a href="<%=REQUEST_URI%>?submit=1&remove=<%=luci.util.pcdata(n)%>"><%:delete%></a></td>
93 <td style="text-align:left"><%=luci.util.pcdata(n)%></td>
94 <td style="text-align:left"><%=luci.util.pcdata(v)%></td>
98 <tr class="cbi-section-table-row">
99 <td style="text-align:left"> </td>
100 <td style="text-align:left"><em><%:none%></em></td>
101 <td style="text-align:left"><em><%:none%></em></td>
108 <h2><%:a_s_packages_available Available packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %></h2>
110 <fieldset class="cbi-section">
111 <table class="cbi-section-table" style="width:100%">
112 <tr class="cbi-section-table-titles">
113 <th class="cbi-section-table-cell" style="text-align:left"> </th>
114 <th class="cbi-section-table-cell" style="text-align:left"><%:a_s_packages_name%></th>
115 <th class="cbi-section-table-cell" style="text-align:left"><%:version%></th>
116 <th class="cbi-section-table-cell" style="text-align:left"><%:descr%></th>
118 <% local empty = true; luci.model.ipkg.list_all(query, function(n, v, d) empty = false %>
119 <tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
120 <td style="text-align:left; width:10%"><a href="<%=REQUEST_URI%>?submit=1&install=<%=luci.util.pcdata(n)%>"><%:install%></a></td>
121 <td style="text-align:left"><%=luci.util.pcdata(n)%></td>
122 <td style="text-align:left"><%=luci.util.pcdata(v)%></td>
123 <td style="text-align:left"><%=luci.util.pcdata(d)%></td>
127 <tr class="cbi-section-table-row">
128 <td style="text-align:left"> </td>
129 <td style="text-align:left"><em><%:none%></em></td>
130 <td style="text-align:left"><em><%:none%></em></td>
131 <td style="text-align:left"><em><%:none%></em></td>