-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs_logout.js
More file actions
68 lines (63 loc) · 1.74 KB
/
js_logout.js
File metadata and controls
68 lines (63 loc) · 1.74 KB
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
// $Id:
Drupal.behaviors.js_logout = function (context) {
var t = setTimeout(init, Drupal.settings.js_logout.timeout);
var paddingTimer;
function init() {
if (Drupal.settings.js_logout.jquery_ui) {
dialog();
paddingTimer = setTimeout(logout, Drupal.settings.js_logout.timeout_padding);
} else {
if (confirm(Drupal.settings.js_logout.message) ) {
refresh();
} else {
logout();
}
}
}
function dialog() {
$('<div> ' + Drupal.settings.js_logout.message + '</div>').dialog({
modal: true,
closeOnEscape: false,
width: 'auto',
buttons: {
Reset: function() {
$(this).dialog("destroy");
clearTimeout(paddingTimer);
refresh();
},
Logout: function() {
$(this).dialog("destroy");
logout();
}
},
title: Drupal.settings.js_logout.title,
close: function(event, ui) {
logout();
}
});
}
function refresh() {
$.ajax({
url: Drupal.settings.basePath + 'js_logout_ahah_set_last',
type: "POST",
success: function() {
t = setTimeout(init, Drupal.settings.js_logout.timeout);
},
error: function(XMLHttpRequest, textStatus) {
alert('There has been an error resetting your last access time: ' + textStatus + '.')
},
});
}
function logout() {
$.ajax({
url: Drupal.settings.basePath + 'js_logout_ahah_logout',
type: "POST",
success: function() {
document.location.href = Drupal.settings.js_logout.redirect_url;
},
error: function(XMLHttpRequest, textStatus) {
alert('There has been an error attempting to logout: ' + textStatus + '.')
},
});
}
};