summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-radicale/luasrc/view/radicale
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-radicale/luasrc/view/radicale')
-rw-r--r--applications/luci-app-radicale/luasrc/view/radicale/btn_startstop.htm6
-rw-r--r--applications/luci-app-radicale/luasrc/view/radicale/ro_value.htm35
-rw-r--r--applications/luci-app-radicale/luasrc/view/radicale/tabmap_nsections.htm49
3 files changed, 52 insertions, 38 deletions
diff --git a/applications/luci-app-radicale/luasrc/view/radicale/btn_startstop.htm b/applications/luci-app-radicale/luasrc/view/radicale/btn_startstop.htm
index dbf4dddbca..d9ef82214f 100644
--- a/applications/luci-app-radicale/luasrc/view/radicale/btn_startstop.htm
+++ b/applications/luci-app-radicale/luasrc/view/radicale/btn_startstop.htm
@@ -4,7 +4,7 @@
// show XHR.poll/XHR.get response on button
function _data2elements(x) {
- var btn = document.getElementById("cbid.radicale._system._startstop");
+ var btn = document.getElementById("cbid.radicale.<%=section%>._startstop");
if ( ! btn ) { return; } // security check
if (x.responseText == "0") {
btn.value = "<%:Start%>";
@@ -21,12 +21,12 @@
function onclick_startstop(id) {
// do start/stop
var btnXHR = new XHR();
- btnXHR.post('<%=url('admin/services/radicale/startstop')%>', { token: '<%=token%>' },
+ btnXHR.post('<%=url([[admin/services/radicale/startstop]])%>', { token: '<%=token%>' },
function(x) { _data2elements(x); }
);
}
- XHR.poll(5, '<%=url('admin/services/radicale/status')%>', null,
+ XHR.poll(5, '<%=url([[admin/services/radicale/status]])%>', null,
function(x, data) { _data2elements(x); }
);
diff --git a/applications/luci-app-radicale/luasrc/view/radicale/ro_value.htm b/applications/luci-app-radicale/luasrc/view/radicale/ro_value.htm
deleted file mode 100644
index 6e05206aa1..0000000000
--- a/applications/luci-app-radicale/luasrc/view/radicale/ro_value.htm
+++ /dev/null
@@ -1,35 +0,0 @@
-<%+cbi/valueheader%>
- <input type="<%=self.password and 'password" class="cbi-input-password' or 'text" class="cbi-input-text' %>" onchange="cbi_d_update(this.id)"<%=
- attr("name", cbid) .. attr("id", cbid) .. attr("value", self:cfgvalue(section) or self.default) ..
- ifattr(self.size, "size") .. ifattr(self.placeholder, "placeholder") .. ifattr(self.readonly, "readonly")
- %> />
- <% if self.password then %><img src="<%=resource%>/cbi/reload.gif" style="vertical-align:middle" title="<%:Reveal/hide password%>" onclick="var e = document.getElementById('<%=cbid%>'); e.type = (e.type=='password') ? 'text' : 'password';" /><% end %>
- <% if #self.keylist > 0 or self.datatype then -%>
- <script type="text/javascript">//<![CDATA[
- <% if #self.keylist > 0 then -%>
- cbi_combobox_init('<%=cbid%>', {
- <%-
- for i, k in ipairs(self.keylist) do
- -%>
- <%-=string.format("%q", k) .. ":" .. string.format("%q", self.vallist[i])-%>
- <%-if i<#self.keylist then-%>,<%-end-%>
- <%-
- end
- -%>
- }, '<%- if not self.rmempty and not self.optional then -%>
- <%-: -- Please choose -- -%>
- <%- elseif self.placeholder then -%>
- <%-= pcdata(self.placeholder) -%>
- <%- end -%>', '
- <%- if self.combobox_manual then -%>
- <%-=self.combobox_manual-%>
- <%- else -%>
- <%-: -- custom -- -%>
- <%- end -%>');
- <%- end %>
- <% if self.datatype then -%>
- cbi_validate_field('<%=cbid%>', <%=tostring((self.optional or self.rmempty) == true)%>, '<%=self.datatype:gsub("'", "\\'")%>');
- <%- end %>
- //]]></script>
- <% end -%>
-<%+cbi/valuefooter%>
diff --git a/applications/luci-app-radicale/luasrc/view/radicale/tabmap_nsections.htm b/applications/luci-app-radicale/luasrc/view/radicale/tabmap_nsections.htm
new file mode 100644
index 0000000000..45fe60cc80
--- /dev/null
+++ b/applications/luci-app-radicale/luasrc/view/radicale/tabmap_nsections.htm
@@ -0,0 +1,49 @@
+<%- if firstmap and messages then local msg; for _, msg in ipairs(messages) do -%>
+ <div class="errorbox"><%=pcdata(msg)%></div>
+<%- end end -%>
+
+<%-+cbi/apply_xhr-%>
+
+<div class="cbi-map" id="cbi-<%=self.config%>">
+ <% if self.title and #self.title > 0 then %><h2 name="content"><%=self.title%></h2><% end %>
+ <% if self.description and #self.description > 0 then %><div class="cbi-map-descr"><%=self.description%></div><% end %>
+ <%- if firstmap and applymap then cbi_apply_xhr(self.config, parsechain, redirect) end -%>
+
+ <% if self.tabbed then %>
+ <ul class="cbi-tabmenu map">
+ <%- self.selected_tab = luci.http.formvalue("tab.m-" .. self.config) %>
+ <% for i, section in ipairs(self.children) do %>
+ <%- if not self.selected_tab then self.selected_tab = section.sectiontype end %>
+ <li id="tab.m-<%=self.config%>.<%=section.section or section.sectiontype%>" class="cbi-tab<%=(section.sectiontype == self.selected_tab) and '' or '-disabled'%>">
+ <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>
+ <% 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 %>
+ </li>
+ <% end %>
+ </ul>
+ <br />
+ <% for i, section in ipairs(self.children) do %>
+ <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 %>>
+ <% section:render() %>
+ </div>
+ <script type="text/javascript">cbi_t_add('m-<%=self.config%>', '<%=section.section or section.sectiontype%>')</script>
+ <% end %>
+
+ <% else %>
+ <%- self:render_children() %>
+ <% end %>
+
+ <% if not self.save then -%>
+ <div class="cbi-section-error">
+ <% for _, section in ipairs(self.children) do %>
+ <% if section.error and section.error[section.section] then -%>
+ <ul><li>
+ <%:One or more missing/invalid fields on tab%>:&nbsp;<%=section.title or section.section or section.sectiontype%>
+ </li></ul>
+ <%- end %>
+ <% end %>
+ </div>
+ <%- end %>
+
+ <br />
+
+</div>