1
0

overview.lp 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?lua
  2. -- Tries to load known libraries
  3. for _, t in ipairs { "lxp", "luasql.postgres", "luasql.mysql", "luasql.oci8", "luasql.sqlite", "luasql.odbc", "socket", "xmlrpc", "soap", "lualdap", "logging", "md5", "zip", "stable", "copas", } do
  4. pcall (require, t)
  5. end
  6. libraries = { "lxp", "luasql", "socket", "xmlrpc", "soap", "lualdap", "logging", "md5", "zip", "stable", "copas", }
  7. local colors = { "#999999", "#CCCCCC", "#FFFFFF", }
  8. local i = 0
  9. function color () i = math.mod (i + 1, 3) return colors[i + 1] end
  10. function pack_name (p) return string.gsub (p, "^([^.]+).-", "%1") end
  11. function idx (t, f) return _G[t][f] or _G[t]["_"..f] or "" end
  12. ?>
  13. <html>
  14. <head><title>CGILua installation overview</title></head>
  15. <body bgcolor="#FFFFFF">
  16. <h1>CGILua installation overview</h1>
  17. <table>
  18. <tr>
  19. <th bgcolor="#999999">Version
  20. <th bgcolor="#999999">Copyright
  21. <th bgcolor="#999999">Description
  22. </tr>
  23. <?lua
  24. local support = {
  25. { "Lua", "_VERSION" },
  26. { "compat-5.1", "_COMPAT51" },
  27. }
  28. for _, l in ipairs (support) do bg = color()
  29. ?>
  30. <tr>
  31. <td bgcolor = "<%= bg %>"><%= tostring(_G[l[2]]) %>
  32. <td bgcolor = "<%= bg %>">
  33. <td bgcolor = "<%= bg %>">
  34. </tr>
  35. <? end ?>
  36. <tr><td colspan="4"></tr>
  37. <?lua
  38. local pack = {}
  39. for i, p in ipairs (libraries) do
  40. local s = _G[p]
  41. local n = pack_name(p)
  42. if type(_G[n]) == "table" and _G[n]._VERSION then
  43. pack[n] = true
  44. table.insert (pack, n)
  45. end
  46. end
  47. table.sort (pack)
  48. for _, p in ipairs (pack) do bg = color() ?>
  49. <tr>
  50. <td bgcolor = "<%= bg %>"><%= idx(p,"VERSION") %>
  51. <td bgcolor = "<%= bg %>"><small><%= idx(p,"COPYRIGHT") %></small>
  52. <td bgcolor = "<%= bg %>"><small><%= idx(p,"DESCRIPTION") %></small>
  53. </tr>
  54. <?lua end ?>
  55. </table>
  56. </body>
  57. </html>