<%# LuCI - Lua Configuration Interface Copyright 2008 Steven Barth Copyright 2008 Jo-Philipp Wich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ -%> <%- local bit = require "bit" local rowcnt = 1 function rowstyle() rowcnt = rowcnt + 1 return (rowcnt % 2) + 1 end function opkg_error(code) code = bit.rshift(tonumber(code), 8) return translate( 'a_s_packages_code%i' % code, '%s %i' % { translate('code'), code } ) end -%> <%+header%>

<%:system%> - <%:a_s_packages%>


<% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %>

<%:status%>

<% if update then %> <%:a_s_packages_update%>: <% if update == 0 then %><%:ok%><% else %><%:error%> (<%=opkg_error(update)%>)<% end %>
<% end %> <% if upgrade then%> <%:a_s_packages_upgrade%>: <% if upgrade == 0 then %><%:ok%><% else %><%:error%> (<%=opkg_error(upgrade)%>)<% end %>
<% end %> <% if install then for k,v in pairs(install) do %> <%:a_s_packages_install%> '<%=k%>': <% if v == 0 then %><%:ok%><% else %><%:error%> (<%=opkg_error(v)%>)<% end %>
<% end end %> <% if remove then for k,v in pairs(remove) do %> <%:a_s_packages_remove%> '<%=k%>': <% if v == 0 then %><%:ok%><% else %><%:error%> (<%=opkg_error(v)%>)<% end %>
<% end end %>

<% end %>

<%:a_s_packages_installed Installed packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %>

<% local empty = true; luci.model.ipkg.list_installed(query, function(n, v, d) empty = false %> <% end) %> <% if empty then %> <% end %>
  <%:a_s_packages_name%> <%:version%>
<%:delete%> <%=luci.util.pcdata(n)%> <%=luci.util.pcdata(v)%>
  <%:none%> <%:none%>

<%:a_s_packages_available Available packages%><% if query then %> (<%=luci.util.pcdata(query)%>)<% end %>

<% local empty = true; luci.model.ipkg.list_all(query, function(n, v, d) empty = false %> <% end) %> <% if empty then %> <% end %>
  <%:a_s_packages_name%> <%:version%> <%:descr%>
<%:install%> <%=luci.util.pcdata(n)%> <%=luci.util.pcdata(v)%> <%=luci.util.pcdata(d)%>
  <%:none%> <%:none%> <%:none%>
<%+footer%>