mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
#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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user