/
displayComfortStep.js
75 lines (53 loc) · 2.06 KB
/
displayComfortStep.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
$.fn.displayComfortStep = function(options)
{
// Will be used later for animation params
var defauts={};
var params=$.extend(defauts, options);
$ajaxLoader = $("#ajaxContainerLoading");
$ajaxLoader.show();
$("#preUpdaterContainer").empty();
$("#updaterLayout").show();
$("#updaterContainer").show();
// We need to know the destination build to resume any step
$destinationBuild = $('#destinationBuildForAjax').val();
$access_token = $('#access_tokenForAjax').val();
$url = "";
$("#step0Updt").removeClass("on").addClass("off");
switch(params.step) {
case "newKey":
$url = $("#newkeyurl").attr('data-url');
$("#welcome").hide();
$("#newKey").show();
break;
case "checkFiles":
$url = $("#filesystemurl").attr('data-url');
break;
case "checkLocalErrors":
$url = $("#checklocalerrorsurl").attr('data-url');
break;
case "welcome":
$url = $("#welcomeurl").attr('data-url');
break;
}
$url += '?destinationBuild=' + $destinationBuild + '&access_token=' + $access_token;
// Those datas are defined in _ajaxVariables view
datas = 'destinationBuild=' + $destinationBuild + '&access_token=' + $access_token + '&'+csrf_token_name+'='+csrf_token;
$.ajax({
type: "POST",
data: datas,
url: $url,
success: function(html) {
// We hide the loader, and we append the submit new key content
$ajaxLoader.hide();
$("#updaterContainer").empty().append(html);
// Menus
},
error : function(html, statut){
$("#preUpdaterContainer").empty();
$("#updaterLayout").show();
$("#updaterContainer").show();
$("#updaterContainer").empty().append("<span class='error'>you have an error, or a notice, inside your local installation of limesurvey. See : <br/></span>");
$("#updaterContainer").append(html.responseText);
}
});
};