summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/view/cbi/tsection.htm
blob: 549934303d054a0c2a9b54185242b63499e6668b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<%#
LuCI - Lua Configuration Interface
Copyright 2008 Steven Barth <steven@midlink.org>
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

$Id$

-%>

<fieldset class="cbi-section" id="cbi-<%=self.config%>-<%=self.sectiontype%>">
	<% if self.title and #self.title > 0 then -%>
		<legend><%=self.title%></legend>
	<%- end %>
	<div class="cbi-section-descr"><%=self.description%></div>
	<% local isempty = true for i, k in ipairs(self:cfgsections()) do -%>
		<% if self.addremove then -%>
			<div class="cbi-section-remove right">
				<input type="submit" name="cbi.rts.<%=self.config%>.<%=k%>" onclick="this.form.cbi_state='del-section'; return true" value="<%:Delete%>" />
			</div>
		<%- end %>

		<%- section = k; isempty = false -%>

		<% if not self.anonymous then -%>
			<h3><%=section:upper()%></h3>
		<%- end %>

		<%+cbi/tabmenu%>

		<fieldset class="cbi-section-node" id="cbi-<%=self.config%>-<%=section%>">
			<%+cbi/ucisection%>
		</fieldset>
		<br />
	<%- end %>

	<% if isempty then -%>
		<em><%:This section contains no values yet%><br /><br /></em>
	<%- end %>

	<% if self.addremove then -%>
		<% if self.template_addremove then include(self.template_addremove) else -%>
		<div class="cbi-section-create">
			<% if self.anonymous then -%>
				<input type="submit" class="cbi-button cbi-button-add" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" value="<%:Add%>" />
			<%- else -%>
				<% if self.invalid_cts then -%><div class="cbi-section-error"><% end %>
				<input type="text" class="cbi-section-create-name" id="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" name="cbi.cts.<%=self.config%>.<%=self.sectiontype%>" />
				<script type="text/javascript">cbi_validate_field('cbi.cts.<%=self.config%>.<%=self.sectiontype%>', true, 'uciname');</script>
				<input type="submit" class="cbi-button cbi-button-add" onclick="this.form.cbi_state='add-section'; return true" value="<%:Add%>" />
				<% if self.invalid_cts then -%>
					<br /><%:Invalid%></div>
				<%- end %>
			<%- end %>
		</div>
		<%- end %>
	<%- end %>
</fieldset>