mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
fix redirect loop initiated eg. by saving a mail, caused by document.location=url triggering etemplate unload handler and destroying et2 request, identical redirect url detected by jdots framework causes refresh via nextmatch --> next redirect
This commit is contained in:
parent
2ca305b5cc
commit
178bca7f7a
@ -177,6 +177,8 @@ class etemplate_request
|
|||||||
list($app) = explode('.', $_GET['menuaction']);
|
list($app) = explode('.', $_GET['menuaction']);
|
||||||
$index_url = isset($GLOBALS['egw_info']['apps'][$app]['index']) ?
|
$index_url = isset($GLOBALS['egw_info']['apps'][$app]['index']) ?
|
||||||
'/index.php?menuaction='.$GLOBALS['egw_info']['apps'][$app]['index'] : '/'.$app.'/index.php';
|
'/index.php?menuaction='.$GLOBALS['egw_info']['apps'][$app]['index'] : '/'.$app.'/index.php';
|
||||||
|
// add a unique token to redirect to avoid client-side framework tries refreshing via nextmatch
|
||||||
|
$index_url .= (strpos($index_url, '?') ? '&' : '?').'redirect='.microtime(true);
|
||||||
error_log(__METHOD__."('$id', ...) eT2 request not found / expired --> redirecting app $app to $index_url (_GET[menuaction]=$_GET[menuaction], isJSONRequest()=".array2string(egw_json_request::isJSONRequest()).')');
|
error_log(__METHOD__."('$id', ...) eT2 request not found / expired --> redirecting app $app to $index_url (_GET[menuaction]=$_GET[menuaction], isJSONRequest()=".array2string(egw_json_request::isJSONRequest()).')');
|
||||||
if (egw_json_request::isJSONRequest())
|
if (egw_json_request::isJSONRequest())
|
||||||
{
|
{
|
||||||
|
@ -303,10 +303,14 @@ var et2_nextmatch = et2_DOMWidget.extend([et2_IResizeable, et2_IInput],
|
|||||||
* Implements the et2_IResizeable interface - lets the dynheight manager
|
* Implements the et2_IResizeable interface - lets the dynheight manager
|
||||||
* update the width and height and then update the dataview container.
|
* update the width and height and then update the dataview container.
|
||||||
*/
|
*/
|
||||||
resize: function() {
|
resize: function()
|
||||||
|
{
|
||||||
|
if (this.dynheight)
|
||||||
|
{
|
||||||
this.dynheight.update(function(_w, _h) {
|
this.dynheight.update(function(_w, _h) {
|
||||||
this.dataview.resize(_w, _h);
|
this.dataview.resize(_w, _h);
|
||||||
}, this);
|
}, this);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -246,6 +246,22 @@ etemplate2.prototype.unbind_unload = function()
|
|||||||
delete this.destroy_session;
|
delete this.destroy_session;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download a URL not triggering our unload handler and therefore destroying our et2 request
|
||||||
|
*
|
||||||
|
* @param {string} _url
|
||||||
|
*/
|
||||||
|
etemplate2.prototype.download = function(_url)
|
||||||
|
{
|
||||||
|
// need to unbind unload handler to NOT destroy et2 session
|
||||||
|
this.unbind_unload();
|
||||||
|
|
||||||
|
document.location = _url;
|
||||||
|
|
||||||
|
// bind unload handler again (can NOT do it direct, as this would be quick enough to be still triggered!)
|
||||||
|
window.setTimeout(jQuery.proxy(this.bind_unload, this), 100);
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the template from the given URL and sets the data object
|
* Loads the template from the given URL and sets the data object
|
||||||
*
|
*
|
||||||
|
@ -2174,7 +2174,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
url += 'menuaction=mail.mail_ui.saveMessage'; // todo compose for Draft folder
|
url += 'menuaction=mail.mail_ui.saveMessage'; // todo compose for Draft folder
|
||||||
url += '&id='+_elems[0].id;
|
url += '&id='+_elems[0].id;
|
||||||
//window.open(url,'_blank','dependent=yes,width=100,height=100,scrollbars=yes,status=yes');
|
//window.open(url,'_blank','dependent=yes,width=100,height=100,scrollbars=yes,status=yes');
|
||||||
document.location = url;
|
this.et2._inst.download(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2310,8 +2310,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
windowName = windowName+'displayAttachment_'+mailid+'_'+attgrid.partID;
|
windowName = windowName+'displayAttachment_'+mailid+'_'+attgrid.partID;
|
||||||
width = 870;
|
width = 870;
|
||||||
height = 600;
|
height = 600;
|
||||||
//document.location = url;
|
break;
|
||||||
//return;
|
|
||||||
}
|
}
|
||||||
egw_openWindowCentered(url,windowName,width,height);
|
egw_openWindowCentered(url,windowName,width,height);
|
||||||
},
|
},
|
||||||
@ -2418,8 +2417,7 @@ app.classes.mail = AppJS.extend(
|
|||||||
windowName = windowName+'displayAttachment_'+attgrid.file.replace(/\//g,"_");
|
windowName = windowName+'displayAttachment_'+attgrid.file.replace(/\//g,"_");
|
||||||
width = 870;
|
width = 870;
|
||||||
height = 600;
|
height = 600;
|
||||||
//document.location = url;
|
break;
|
||||||
//return;
|
|
||||||
}
|
}
|
||||||
egw_openWindowCentered(url,windowName,width,height);
|
egw_openWindowCentered(url,windowName,width,height);
|
||||||
},
|
},
|
||||||
@ -2441,15 +2439,12 @@ app.classes.mail = AppJS.extend(
|
|||||||
attgrid = this.et2.getArrayMgr("content").getEntry('mail_displayattachments')[widget.id.replace(/\[save\]/,'')];
|
attgrid = this.et2.getArrayMgr("content").getEntry('mail_displayattachments')[widget.id.replace(/\[save\]/,'')];
|
||||||
}
|
}
|
||||||
var url = window.egw_webserverUrl+'/index.php?';
|
var url = window.egw_webserverUrl+'/index.php?';
|
||||||
var width;
|
|
||||||
var height;
|
|
||||||
var windowName ='mail';
|
|
||||||
url += 'menuaction=mail.mail_ui.getAttachment'; // todo compose for Draft folder
|
url += 'menuaction=mail.mail_ui.getAttachment'; // todo compose for Draft folder
|
||||||
url += '&mode=save';
|
url += '&mode=save';
|
||||||
url += '&id='+mailid;
|
url += '&id='+mailid;
|
||||||
url += '&part='+attgrid.partID;
|
url += '&part='+attgrid.partID;
|
||||||
url += '&is_winmail='+attgrid.winmailFlag;
|
url += '&is_winmail='+attgrid.winmailFlag;
|
||||||
document.location = url;
|
this.et2._inst.download(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
saveAllAttachmentsToZip: function(tag_info, widget)
|
saveAllAttachmentsToZip: function(tag_info, widget)
|
||||||
@ -2469,13 +2464,10 @@ app.classes.mail = AppJS.extend(
|
|||||||
attgrid = this.et2.getArrayMgr("content").getEntry('mail_displayattachments')[widget.id.replace(/\[save\]/,'')];
|
attgrid = this.et2.getArrayMgr("content").getEntry('mail_displayattachments')[widget.id.replace(/\[save\]/,'')];
|
||||||
}
|
}
|
||||||
var url = window.egw_webserverUrl+'/index.php?';
|
var url = window.egw_webserverUrl+'/index.php?';
|
||||||
var width;
|
|
||||||
var height;
|
|
||||||
var windowName ='mail';
|
|
||||||
url += 'menuaction=mail.mail_ui.download_zip'; // todo compose for Draft folder
|
url += 'menuaction=mail.mail_ui.download_zip'; // todo compose for Draft folder
|
||||||
url += '&mode=save';
|
url += '&mode=save';
|
||||||
url += '&id='+mailid;
|
url += '&id='+mailid;
|
||||||
document.location = url;
|
this.et2._inst.download(url);
|
||||||
},
|
},
|
||||||
|
|
||||||
saveAttachmentToVFS: function(tag_info, widget)
|
saveAttachmentToVFS: function(tag_info, widget)
|
||||||
@ -2573,8 +2565,6 @@ app.classes.mail = AppJS.extend(
|
|||||||
url += '&method=mail.mail_ui.vfsSaveMessage';
|
url += '&method=mail.mail_ui.vfsSaveMessage';
|
||||||
url += '&id='+_elems[0].id;
|
url += '&id='+_elems[0].id;
|
||||||
url += '&label=Save';
|
url += '&label=Save';
|
||||||
//window.open(url,'_blank','dependent=yes,width=100,height=100,scrollbars=yes,status=yes')
|
|
||||||
//document.location = url;
|
|
||||||
egw_openWindowCentered(url,'vfs_save_message_'+_elems[0].id,'640','570',window.outerWidth/2,window.outerHeight/2);
|
egw_openWindowCentered(url,'vfs_save_message_'+_elems[0].id,'640','570',window.outerWidth/2,window.outerHeight/2);
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user