2b526a31d7e93d2725b76ef2b23b35b2baf8f4c4
[project/luci.git] / applications / luci-app-radicale / luasrc / view / radicale / tabmap_nsections.htm
1 <%- if firstmap and messages then local msg; for _, msg in ipairs(messages) do -%>
2         <div class="errorbox"><%=pcdata(msg)%></div>
3 <%- end end -%>
4
5 <div class="cbi-map" id="cbi-<%=self.config%>">
6         <% if self.title and #self.title > 0 then %><h2 name="content"><%=self.title%></h2><% end %>
7         <% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
8         <%- if firstmap and (applymap or confirmmap) then -%>
9                 <%+cbi/apply_widget%>
10                 <% cbi_apply_widget() %>
11                 <div class="alert-message" id="cbi_apply_status" style="display:none"></div>
12                 <script type="text/javascript">
13                         document.addEventListener("DOMContentLoaded", function() {
14                                 <% if confirmmap then -%>
15                                         uci_confirm(true, Date.now() + <%=confirmmap%> * 1000);
16                                 <%- else -%>
17                                         uci_apply(true);
18                                 <%- end %>
19                         });
20                 </script>
21         <%- end -%>
22
23         <% if self.tabbed then %>
24                 <ul class="cbi-tabmenu map">
25                         <%- self.selected_tab = luci.http.formvalue("tab.m-" .. self.config) %>
26                         <% for i, section in ipairs(self.children) do %>
27                                 <%- if not self.selected_tab then self.selected_tab = section.sectiontype end %>
28                                 <li id="tab.m-<%=self.config%>.<%=section.section or section.sectiontype%>" class="cbi-tab<%=(section.sectiontype == self.selected_tab) and '' or '-disabled'%>">
29                                         <a onclick="this.blur(); return cbi_t_switch('m-<%=self.config%>', '<%=section.section or section.sectiontype%>')" href="<%=REQUEST_URI%>?tab.m-<%=self.config%>=<%=section.section or section.sectiontype%>"><%=section.title or section.section or section.sectiontype %></a>
30                                         <% if section.sectiontype == self.selected_tab then %><input type="hidden" id="tab.m-<%=self.config%>" name="tab.m-<%=self.config%>" value="<%=section.section or section.sectiontype%>" /><% end %>
31                                 </li>
32                         <% end %>
33                 </ul>
34                 <br />
35                 <% for i, section in ipairs(self.children) do %>
36                         <div class="cbi-tabcontainer" id="container.m-<%=self.config%>.<%=section.section or section.sectiontype%>"<% if section.sectiontype ~= self.selected_tab then %> style="display:none"<% end %>>
37                                 <% section:render() %>
38                         </div>
39                         <script type="text/javascript">cbi_t_add('m-<%=self.config%>', '<%=section.section or section.sectiontype%>')</script>
40                 <% end %>
41
42         <% else %>
43                 <%- self:render_children() %>
44         <% end %>
45
46         <% if not self.save then -%>
47                 <div class="cbi-section-error">
48                         <% for _, section in ipairs(self.children) do %>
49                                 <% if section.error and section.error[section.section] then -%>
50                                         <ul><li>
51                                                 <%:One or more missing/invalid fields on tab%>:&nbsp;<%=section.title or section.section or section.sectiontype%>
52                                         </li></ul>
53                                 <%- end %>
54                         <% end %>
55                 </div>
56         <%- end %>
57
58         <br />
59
60 </div>