index.htm 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <%#
  2. Copyright 2008 Steven Barth <steven@midlink.org>
  3. Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
  4. Licensed to the public under the Apache License 2.0.
  5. -%>
  6. <%+header%>
  7. <%
  8. local uci = require "luci.model.uci".cursor()
  9. local tpl = require "luci.template"
  10. local fs = require "nixio.fs"
  11. local ff = {}
  12. local ff = uci:get_all("freifunk")
  13. if not ff or not ff.community.name then
  14. community = "Freifunk"
  15. DefaultText = ""
  16. nickname = "No Nickname set"
  17. else
  18. community = ff.community.name
  19. DefaultText = ff.community.DefaultText
  20. nickname = ff.contact.nickname
  21. end
  22. local co = "profile_" .. community
  23. --local community = uci:get_first(co, "community", "name") or "Freifunk"
  24. local url = uci:get_first(co, "community", "homepage") or "http://www.freifunk.net"
  25. local usertext = fs.readfile("/www/luci-static/index_user.html")
  26. if DefaultText ~= "disabled" then
  27. defaulttext = '<h2><a id="content" name="content">'..
  28. (translate("Hello and welcome in the network of"))..
  29. ' '..
  30. (community or "Freifunk Deutschland")..
  31. '!</a></h2><p>'..
  32. translate("We are an initiative to establish a free, independent and open wireless mesh network.")..
  33. '<br />'..
  34. translate("This is the access point")..
  35. ' '..
  36. luci.sys.hostname()..
  37. '. '..
  38. translate("It is operated by")..
  39. ' <a href="'..
  40. luci.dispatcher.build_url("freifunk", "contact")..
  41. '">'..
  42. (nickname or translate("Please set your contact information"))..
  43. '</a>.</p><p>'..
  44. translate("You can find further information about the global Freifunk initiative at")..
  45. ' <a href="http://freifunk.net">Freifunk.net</a>.<br />'..
  46. translate("If you are interested in our project then contact the local community")..
  47. ' <a href="'..url..'">'..community..'</a>.</p><p><strong>'..
  48. translate("Notice")..
  49. '</strong>: '..
  50. translate("Internet access depends on technical and organisational conditions and may or may not work for you.")..
  51. '</p>'
  52. end
  53. %>
  54. <%=defaulttext%>
  55. <%=usertext%>
  56. <%
  57. -- add custom widgets from view/freifunk/widgets
  58. local widgets = {}
  59. local dir = "/usr/lib/lua/luci/view/freifunk/widgets"
  60. uci:foreach("freifunk-widgets", "widget",
  61. function(s)
  62. if s.enabled == "1" then
  63. table.insert(widgets, s)
  64. end
  65. end)
  66. for k, v in ipairs(widgets) do
  67. if v['template'] and fs.access(dir .. "/" .. v['template'] .. "/main.htm") then
  68. tpl.render("freifunk/widgets/" .. v['template'] .. "/main", { data = v })
  69. end
  70. end
  71. %>
  72. <%+footer%>