libs/web: convert cbi widgets to new network model
[project/luci.git] / libs / web / luasrc / view / cbi / simpleform.htm
1 <%#
2 LuCI - Lua Configuration Interface
3 Copyright 2008 Steven Barth <steven@midlink.org>
4 Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
5
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 $Id$
13
14 -%>
15 <% if not self.embedded then %>
16 <form method="post" action="<%=REQUEST_URI%>">
17 <div>
18 <script type="text/javascript" src="<%=resource%>/cbi.js"></script>
19 <input type="hidden" name="cbi.submit" value="1" />
20 </div>
21 <% end %>
22 <div class="cbi-map" id="cbi-<%=self.config%>">
23 <% if self.title and #self.title > 0 then %><h2><a id="content" name="content"><%=self.title%></a></h2><% end %>
24 <% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
25 <% self:render_children() %>
26 <br />
27 </div>
28 <%- if self.message then %>
29 <div><%=self.message%></div>
30 <%- end %>
31 <%- if self.errmessage then %>
32 <div class="error"><%=self.errmessage%></div>
33 <%- end %>
34 <% if not self.embedded then %>
35 <div>
36 <%-
37 if type(self.hidden) == "table" then
38 for k, v in pairs(self.hidden) do
39 -%>
40 <input type="hidden" id="<%=k%>" name="<%=k%>" value="<%=pcdata(v)%>" />
41 <%-
42 end
43 end
44 %>
45 <%- if self.flow and self.flow.skip then %>
46 <input class="cbi-button cbi-button-skip" type="submit" name="cbi.skip" value="<%:Skip%>" />
47 <% end %>
48 <%- if self.submit ~= false then %>
49 <input class="cbi-button-save" type="submit" value="
50 <%- if not self.submit then -%><%-:Submit-%><%-else-%><%=self.submit%><%end-%>
51 " />
52 <% end %>
53 <%- if self.reset ~= false then %>
54 <input class="cbi-button-reset" type="reset" value="
55 <%- if not self.reset then -%><%-:Reset-%><%-else-%><%=self.reset%><%end-%>
56 " />
57 <% end %>
58 <%- if self.cancel ~= false and self.on_cancel then %>
59 <input class="cbi-button-reset" type="submit" name="cbi.cancel" value="
60 <%- if not self.cancel then -%><%-:Cancel-%><%-else-%><%=self.cancel%><%end-%>
61 " />
62 <% end %>
63 <script type="text/javascript">cbi_d_update();</script>
64 </div>
65 </form>
66 <% end %>