mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-26 01:43:47 +01:00
Pass etemplate_exec_id in POST instead of GET to avoid potential issues with long ids
This commit is contained in:
parent
6585ff14e6
commit
e7af7de431
@ -55,10 +55,17 @@ var et2_file = et2_inputWidget.extend({
|
||||
this._super.apply(this, arguments)
|
||||
|
||||
this.node = null;
|
||||
this.input = null;
|
||||
this.progress = null;
|
||||
|
||||
if(!this.options.id) {
|
||||
console.warn("File widget needs an ID. Used 'file_widget'.");
|
||||
this.options.id = "file_widget";
|
||||
}
|
||||
|
||||
// Set up the URL to have the request ID & the widget ID
|
||||
var instance = this.getInstanceManager();
|
||||
|
||||
|
||||
var self = this;
|
||||
this.asyncOptions = {
|
||||
// Callbacks
|
||||
@ -69,12 +76,18 @@ var et2_file = et2_inputWidget.extend({
|
||||
onProgress: function(event, progress, name, number, total) { return self.onProgress(event,progress,name,number,total);},
|
||||
onError: function(event, name, error) { return self.onError(event,name,error);},
|
||||
sendBoundary: window.FormData || jQuery.browser.mozilla,
|
||||
url: egw_json_request.prototype._assembleAjaxUrl("etemplate_widget_file::ajax_upload") +
|
||||
"&request_id="+ instance.etemplate_exec_id
|
||||
beforeSend: function(form) { return self.beforeSend(form);},
|
||||
url: egw_json_request.prototype._assembleAjaxUrl("etemplate_widget_file::ajax_upload::etemplate")
|
||||
};
|
||||
this.asyncOptions.fieldName = this.options.id;
|
||||
this.createInputWidget();
|
||||
},
|
||||
|
||||
destroy: function() {
|
||||
this.node = null;
|
||||
this.input = null;
|
||||
this.progress = null;
|
||||
},
|
||||
|
||||
createInputWidget: function() {
|
||||
this.node = $j(document.createElement("div")).addClass("et2_file");
|
||||
@ -110,6 +123,20 @@ var et2_file = et2_inputWidget.extend({
|
||||
return this.input[0];
|
||||
},
|
||||
|
||||
/**
|
||||
* Add in the request id
|
||||
*/
|
||||
beforeSend: function(form) {
|
||||
var instance = this.getInstanceManager();
|
||||
// Form object available, mess with it directly
|
||||
if(form) {
|
||||
return form.append("request_id", instance.etemplate_exec_id);
|
||||
}
|
||||
|
||||
// No Form object, add in as string
|
||||
return 'Content-Disposition: form-data; name="request_id"\r\n\r\n'+instance.etemplate_exec_id+'\r\n';
|
||||
},
|
||||
|
||||
/**
|
||||
* Disables submit buttons while uploading
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user