2 <!-- ++ BEGIN ++ Radicale ++ btn_startstop.htm ++ -->
3 <script type="text/javascript">//<![CDATA[
5 // show XHR.poll/XHR.get response on button
6 function _data2elements(x) {
7 var btn = document.getElementById("cbid.radicale._system._startstop");
8 if ( ! btn ) { return; } // security check
9 if (x.responseText == "0") {
10 btn.value = "<%:Start%>";
11 btn.className = "cbi-button cbi-button-apply";
14 btn.value = "PID: " + x.responseText;
15 btn.className = "cbi-button cbi-button-reset";
20 // event handler for start/stop button
21 function onclick_startstop(id) {
23 var btnXHR = new XHR();
24 btnXHR.get('<%=luci.dispatcher.build_url("admin", "services", "radicale", "startstop")%>', null,
25 function(x) { _data2elements(x); }
29 XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "radicale", "status")%>', null,
30 function(x, data) { _data2elements(x); }
37 <% if self:cfgvalue(section) ~= false then
38 -- We need to garantie that function cfgvalue run first to set missing parameters
40 <!-- style="font-size: 100%;" needed for openwrt theme to fix font size -->
41 <!-- type="button" onclick="..." enable standard onclick functionalty -->
42 <input class="cbi-button cbi-input-<%=self.inputstyle or "button" %>" style="font-size: 100%;" type="button" onclick="onclick_startstop(this.id)"
44 attr("name", section) .. attr("id", cbid) .. attr("value", self.inputtitle) .. ifattr(self.disabled, "disabled")
49 <!-- ++ END ++ Radicale ++ btn_startstop.htm ++ -->