main.htm 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <%
  2. --[[
  3. LuCI - Lua Configuration Interface
  4. Copyright 2012 Manuel Munz <freifunk at somakoma dot de>
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. ]]--
  10. local utl = require "luci.util"
  11. local title = luci.i18n.translate(data.title or "Search")
  12. local name = data['.name']
  13. local width = data.width or "100%"
  14. if type(width) == "number" then
  15. width = width .. "px"
  16. end
  17. local engines = {}
  18. if type(data.engine) == "table" then
  19. engines = data.engine
  20. else
  21. for k, v in ipairs(string.split(data.engine, " ")) do
  22. table.insert(engines, v)
  23. end
  24. end
  25. %>
  26. <div id="<%=name%>" style="width:<%=width%>;float:left">
  27. <h2><%=title%></h2>
  28. <div id="form_<%=name%>">
  29. <form name="searchform" id="search_<%=name%>" action="<%=url('freifunk/search_redirect')%>">
  30. <input type="text" name="searchterms" style="margin-bottom:15px; width: 90%"><br />
  31. <%
  32. local checked = " checked"
  33. for k, v in ipairs(engines) do
  34. local e = utl.split(v, "|")
  35. local name = e[1]
  36. local url = e[2]
  37. if name and url then
  38. %>
  39. <input name="engine" type="radio" value="<%=url%>"<%=checked%>> <%=name%><br />
  40. <% end
  41. checked = ""
  42. end
  43. %>
  44. <input type="submit" name="SearchSubmit" value="Search" style="margin-top: 15px">
  45. </form>
  46. </div>
  47. </div>