From e4a3fd177c9ff4dc9113af22a72e930f257514ea Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 28 Mar 2009 20:15:53 +0000 Subject: modules/admin-full: improve opkg error reporting --- .../luasrc/view/admin_system/packages.htm | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'modules/admin-full') diff --git a/modules/admin-full/luasrc/view/admin_system/packages.htm b/modules/admin-full/luasrc/view/admin_system/packages.htm index 084dab2fed..b52529ea89 100644 --- a/modules/admin-full/luasrc/view/admin_system/packages.htm +++ b/modules/admin-full/luasrc/view/admin_system/packages.htm @@ -13,11 +13,24 @@ $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, + translate( + 'a_s_packages_code%i' % code, + '%s %i' % { translate('code'), code } + ) + ) +end -%> <%+header%>

<%:system%>

@@ -28,16 +41,16 @@ end <% if install or remove or update or upgrade then %>
<%:status%>:
<% if update then %> - <%:a_s_packages_update%>: <% if update == 0 then %><%:ok%><% else %><%:error%> (<%:code%> <%=update%>)<% end %>
+ <%: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%> (<%:code%> <%=upgrade%>)<% end %>
+ <%: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%> (<%:code%> <%=v%>)<% end %>
+ <%: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%> (<%:code%> <%=v%>)<% end %>
+ <%:a_s_packages_remove%> '<%=k%>': <% if v == 0 then %><%:ok%><% else %><%:error%> (<%=opkg_error(v)%>)<% end %>
<% end end %>

-- cgit v1.2.3