Commit | Line | Data |
---|---|---|
8cebffb2 JP |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
fee14197 | 3 | | CiviCRM version 5 | |
8cebffb2 | 4 | +--------------------------------------------------------------------+ |
6b83d5bd | 5 | | Copyright CiviCRM LLC (c) 2004-2019 | |
8cebffb2 JP |
6 | +--------------------------------------------------------------------+ |
7 | | This file is a part of CiviCRM. | | |
8 | | | | |
9 | | CiviCRM is free software; you can copy, modify, and distribute it | | |
10 | | under the terms of the GNU Affero General Public License | | |
11 | | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. | | |
12 | | | | |
13 | | CiviCRM is distributed in the hope that it will be useful, but | | |
14 | | WITHOUT ANY WARRANTY; without even the implied warranty of | | |
15 | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | | |
16 | | See the GNU Affero General Public License for more details. | | |
17 | | | | |
18 | | You should have received a copy of the GNU Affero General Public | | |
19 | | License and the CiviCRM Licensing Exception along | | |
20 | | with this program; if not, contact CiviCRM LLC | | |
21 | | at info[AT]civicrm[DOT]org. If you have questions about the | | |
22 | | GNU Affero General Public License or the licensing of CiviCRM, | | |
23 | | see the CiviCRM license FAQ at http://civicrm.org/licensing | | |
24 | +--------------------------------------------------------------------+ | |
25 | *} | |
26 | {literal} | |
27 | <script type="text/javascript"> | |
28 | CRM.$(function($) { | |
badf5061 | 29 | var loop; |
8cebffb2 | 30 | $("form#Preview").on('submit', function (e) { |
90aa3a9a JP |
31 | 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}")) { |
32 | e.preventDefault(); | |
33 | } | |
34 | else { | |
35 | showProgressBar(); | |
36 | } | |
8cebffb2 JP |
37 | }); |
38 | function setIntermediate() { | |
8838f818 | 39 | var dataUrl = {/literal}{$statusUrl|@json_encode}{literal}; |
8cebffb2 JP |
40 | $.getJSON(dataUrl, function(response) { |
41 | var dataStr = response.toString(); | |
42 | var result = dataStr.split(","); | |
43 | $("#intermediate").html(result[1]); | |
44 | $("#importProgressBar .ui-progressbar-value").show(); | |
45 | if (result[0] < 100) { | |
46 | $("#importProgressBar .ui-progressbar-value").animate({width: result[0] + "%"}, 500); | |
47 | $("#status").text(result[0] + "% Completed"); | |
48 | } | |
90aa3a9a JP |
49 | else { |
50 | window.clearInterval(loop); | |
51 | } | |
8cebffb2 JP |
52 | }); |
53 | } | |
54 | ||
90aa3a9a | 55 | function showProgressBar() { |
8cebffb2 JP |
56 | $("#id-processing").show( ).dialog({ |
57 | modal : true, | |
58 | width : 450, | |
59 | height : 200, | |
60 | resizable : false, | |
61 | draggable : true, | |
62 | closeOnEscape : false, | |
63 | open : function () { | |
64 | $("#id-processing").dialog().parents(".ui-dialog").find(".ui-dialog-titlebar").remove(); | |
65 | } | |
66 | }); | |
67 | $("#importProgressBar" ).progressbar({value:0}); | |
68 | $("#importProgressBar").show( ); | |
8a0852e2 | 69 | loop = window.setInterval(setIntermediate, 5000) |
8cebffb2 JP |
70 | } |
71 | }); | |
72 | </script> | |
73 | {/literal} | |
74 | ||
75 | {* Import Progress Bar and Info *} | |
76 | <div id="id-processing" class="hiddenElement"> | |
77 | <h3>Importing records...</h3><br /> | |
78 | <div id="status" style="margin-left:6px;"></div> | |
79 | <div class="progressBar" id="importProgressBar" style="margin-left:6px;display:none;"></div> | |
80 | <div id="intermediate"></div> | |
81 | <div id="error_status"></div> | |
82 | </div> |