Commit | Line | Data |
---|---|---|
8cebffb2 JP |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
3 | | CiviCRM version 4.7 | | |
4 | +--------------------------------------------------------------------+ | |
5 | | Copyright CiviCRM LLC (c) 2004-2017 | | |
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 JP |
30 | $("form#Preview").on('submit', function (e) { |
31 | verify(); | |
32 | }); | |
33 | function setIntermediate() { | |
34 | var dataUrl = "{/literal}{$statusUrl}{literal}"; | |
35 | $.getJSON(dataUrl, function(response) { | |
36 | var dataStr = response.toString(); | |
37 | var result = dataStr.split(","); | |
38 | $("#intermediate").html(result[1]); | |
39 | $("#importProgressBar .ui-progressbar-value").show(); | |
40 | if (result[0] < 100) { | |
41 | $("#importProgressBar .ui-progressbar-value").animate({width: result[0] + "%"}, 500); | |
42 | $("#status").text(result[0] + "% Completed"); | |
43 | } | |
44 | }); | |
45 | } | |
46 | ||
8cebffb2 JP |
47 | function verify() { |
48 | if (!confirm('Backing up your database before importing is recommended, as there is no Undo for this. {/literal}{ts escape='js'}Are you sure you want to Import now{/ts}{literal}?')) { | |
49 | return false; | |
50 | } | |
51 | $("#id-processing").show( ).dialog({ | |
52 | modal : true, | |
53 | width : 450, | |
54 | height : 200, | |
55 | resizable : false, | |
56 | draggable : true, | |
57 | closeOnEscape : false, | |
58 | open : function () { | |
59 | $("#id-processing").dialog().parents(".ui-dialog").find(".ui-dialog-titlebar").remove(); | |
60 | } | |
61 | }); | |
62 | $("#importProgressBar" ).progressbar({value:0}); | |
63 | $("#importProgressBar").show( ); | |
badf5061 | 64 | loop = window.setInterval(setIntermediate, 5) |
8cebffb2 JP |
65 | } |
66 | }); | |
67 | </script> | |
68 | {/literal} | |
69 | ||
70 | {* Import Progress Bar and Info *} | |
71 | <div id="id-processing" class="hiddenElement"> | |
72 | <h3>Importing records...</h3><br /> | |
73 | <div id="status" style="margin-left:6px;"></div> | |
74 | <div class="progressBar" id="importProgressBar" style="margin-left:6px;display:none;"></div> | |
75 | <div id="intermediate"></div> | |
76 | <div id="error_status"></div> | |
77 | </div> |