#788 Whenever a timeout is detected by an ajax request, a popup dialog warns the user to log-in again.

SVN:trunk[3613]
This commit is contained in:
Denis Flaven
2015-06-25 15:32:30 +00:00
parent 6e92438282
commit 9f92e5e0be
6 changed files with 72 additions and 0 deletions

View File

@@ -117,7 +117,13 @@ EOF
myLayout.addPinBtn( "#tPinMenu", "west" );
EOF;
}
$sJSDisconnectedMessage = json_encode(Dict::S('UI:DisconnectedDlgMessage'));
$sJSTitle = json_encode(Dict::S('UI:DisconnectedDlgTitle'));
$sJSLoginAgain = json_encode(Dict::S('UI:LoginAgain'));
$sJSStayOnThePage = json_encode(Dict::S('UI:StayOnThePage'));
$this->m_sInitScript =
<<< EOF
try
@@ -391,6 +397,26 @@ EOF
$('#logOffBtn>ul').popupmenu();
$('.caselog_header').click( function () { $(this).toggleClass('open').next('.caselog_entry').toggle(); });
$(document).ajaxSend(function(event, jqxhr, options) {
jqxhr.setRequestHeader('X-Combodo-Ajax', 'true');
});
$(document).ajaxError(function(event, jqxhr, options) {
if (jqxhr.status == 401)
{
$('<div>'+$sJSDisconnectedMessage+'</div>').dialog({
modal:true,
title: $sJSTitle,
close: function() { $(this).remove(); },
minWidth: 400,
buttons: [
{ text: $sJSLoginAgain, click: function() { window.location.href= GetAbsoluteUrlAppRoot()+'pages/UI.php' } },
{ text: $sJSStayOnThePage, click: function() { $(this).dialog('close'); } }
]
});
}
});
EOF
);
$sUserPrefs = appUserPreferences::GetAsJSON();