2 LuCI - Lua Configuration Interface
3 Copyright 2010 Jo-Philipp Wich <xm@subsignal.org>
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
15 <% export("cbi_apply_xhr", function(id, configs, redirect) -%>
16 <fieldset class="cbi-section" id="cbi-apply-<%=id%>">
17 <legend><%:Applying changes%></legend>
18 <script type="text/javascript">//<![CDATA[
19 var apply_xhr = new XHR();
21 apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "restart", table.concat(configs, ","))%>', null,
23 var checkfinish = function() {
24 apply_xhr.get('<%=luci.dispatcher.build_url("servicectl", "status")%>', null,
26 if( x.responseText == 'finish' )
28 var e = document.getElementById('cbi-apply-<%=id%>-status');
31 e.innerHTML = '<%:Configuration applied.%>';
32 window.setTimeout(function() {
33 e.parentNode.style.display = 'none';
34 <% if redirect then %>location.href='<%=redirect%>';<% end %>
40 var e = document.getElementById('cbi-apply-<%=id%>-status');
41 if( e && x.responseText ) e.innerHTML = x.responseText;
43 window.setTimeout(checkfinish, 1000);
49 window.setTimeout(checkfinish, 1000);
54 <img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" style="vertical-align:middle" />
55 <span id="cbi-apply-<%=id%>-status"><%:Waiting for router...%></span>