simpleform.htm 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <%
  2. if not self.embedded then
  3. %><form method="post" enctype="multipart/form-data" action="<%=REQUEST_URI%>">
  4. <input type="hidden" name="token" value="<%=token%>" />
  5. <input type="hidden" name="cbi.submit" value="1" /><%
  6. end
  7. %><div class="cbi-map" id="cbi-<%=self.config%>"><%
  8. if self.title and #self.title > 0 then
  9. %><h2 name="content"><%=self.title%></h2><%
  10. end
  11. if self.description and #self.description > 0 then
  12. %><div class="cbi-map-descr"><%=self.description%></div><%
  13. end
  14. self:render_children()
  15. %></div><%
  16. if self.message then
  17. %><div class="alert-message notice"><%=self.message%></div><%
  18. end
  19. if self.errmessage then
  20. %><div class="alert-message warning"><%=self.errmessage%></div><%
  21. end
  22. if not self.embedded then
  23. if type(self.hidden) == "table" then
  24. local k, v
  25. for k, v in pairs(self.hidden) do
  26. %><input type="hidden" id="<%=k%>" name="<%=k%>" value="<%=pcdata(v)%>" /><%
  27. end
  28. end
  29. local display_back = (redirect)
  30. local display_cancel = (self.cancel ~= false and self.on_cancel)
  31. local display_skip = (self.flow and self.flow.skip)
  32. local display_submit = (self.submit ~= false)
  33. local display_reset = (self.reset ~= false)
  34. if display_back or display_cancel or display_skip or display_submit or display_reset then
  35. %><div class="cbi-page-actions"><%
  36. if display_back then
  37. %><input class="btn cbi-button cbi-button-link" type="button" value="<%:Back to Overview%>" onclick="location.href='<%=pcdata(redirect)%>'" /> <%
  38. end
  39. if display_cancel then
  40. local label = pcdata(self.cancel or translate("Cancel"))
  41. %><input class="btn cbi-button cbi-button-link" type="button" value="<%=label%>" onclick="cbi_submit(this, 'cbi.cancel')" /> <%
  42. end
  43. if display_skip then
  44. %><input class="btn cbi-button cbi-button-neutral" type="button" value="<%:Skip%>" onclick="cbi_submit(this, 'cbi.skip')" /> <%
  45. end
  46. if display_submit then
  47. local label = pcdata(self.submit or translate("Submit"))
  48. %><input class="btn cbi-button cbi-button-save" type="submit" value="<%=label%>" /> <%
  49. end
  50. if display_reset then
  51. local label = pcdata(self.reset or translate("Reset"))
  52. %><input class="btn cbi-button cbi-button-reset" type="reset" value="<%=label%>" /> <%
  53. end
  54. %></div><%
  55. end
  56. %></form><%
  57. end
  58. %>
  59. <script type="text/javascript">cbi_init();</script>