widgets.lua 922 B

1234567891011121314151617181920212223242526272829303132333435
  1. -- Copyright 2012 Manuel Munz <freifunk at somakoma de>
  2. -- Licensed to the public under the Apache License 2.0.
  3. local require = require
  4. module "luci.controller.freifunk.widgets"
  5. function index()
  6. local page = node("admin", "freifunk", "widgets")
  7. page.target = cbi("freifunk/widgets/widgets_overview")
  8. page.title = _("Widgets")
  9. page.i18n = "widgets"
  10. page.order = 30
  11. local page = node("admin", "freifunk", "widgets", "widget")
  12. page.target = cbi("freifunk/widgets/widget")
  13. page.leaf = true
  14. local page = node("freifunk", "search_redirect")
  15. page.target = call("search_redirect")
  16. page.leaf = true
  17. end
  18. function search_redirect()
  19. local dsp = require "luci.dispatcher"
  20. local http = require "luci.http"
  21. local engine = http.formvalue("engine")
  22. local searchterms = http.formvalue("searchterms") or ""
  23. if engine then
  24. http.redirect(engine .. searchterms)
  25. else
  26. http.redirect(dsp.build_url())
  27. end
  28. end