Merge pull request #16715 from mattwire/cancelsubscriptiongeneratetext
[civicrm-core.git] / templates / CRM / common / importProgress.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
4 | |
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
8 +--------------------------------------------------------------------+
9 *}
10 {literal}
11 <script type="text/javascript">
12 CRM.$(function($) {
13 var loop;
14 $("form#Preview").on('submit', function (e) {
15 if (!confirm("{/literal}{ts escape='js'}Backing up your database before importing is recommended, as there is no Undo for this. Are you sure you want to import now?{/ts}{literal}")) {
16 e.preventDefault();
17 }
18 else {
19 showProgressBar();
20 }
21 });
22 function setIntermediate() {
23 var dataUrl = {/literal}{$statusUrl|@json_encode}{literal};
24 $.getJSON(dataUrl, function(response) {
25 var dataStr = response.toString();
26 var result = dataStr.split(",");
27 $("#intermediate").html(result[1]);
28 $("#importProgressBar .ui-progressbar-value").show();
29 if (result[0] < 100) {
30 $("#importProgressBar .ui-progressbar-value").animate({width: result[0] + "%"}, 500);
31 $("#status").text(result[0] + "% Completed");
32 }
33 else {
34 window.clearInterval(loop);
35 }
36 });
37 }
38
39 function showProgressBar() {
40 $("#id-processing").show( ).dialog({
41 modal : true,
42 width : 450,
43 height : 200,
44 resizable : false,
45 draggable : true,
46 closeOnEscape : false,
47 open : function () {
48 $("#id-processing").dialog().parents(".ui-dialog").find(".ui-dialog-titlebar").remove();
49 }
50 });
51 $("#importProgressBar" ).progressbar({value:0});
52 $("#importProgressBar").show( );
53 loop = window.setInterval(setIntermediate, 5000)
54 }
55 });
56 </script>
57 {/literal}
58
59 {* Import Progress Bar and Info *}
60 <div id="id-processing" class="hiddenElement">
61 <h3>Importing records...</h3><br />
62 <div id="status" style="margin-left:6px;"></div>
63 <div class="progressBar" id="importProgressBar" style="margin-left:6px;display:none;"></div>
64 <div id="intermediate"></div>
65 <div id="error_status"></div>
66 </div>