mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-04 20:40:14 +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._super.apply(this, arguments)
|
||||||
|
|
||||||
this.node = null;
|
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
|
// Set up the URL to have the request ID & the widget ID
|
||||||
var instance = this.getInstanceManager();
|
var instance = this.getInstanceManager();
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
this.asyncOptions = {
|
this.asyncOptions = {
|
||||||
// Callbacks
|
// 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);},
|
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);},
|
onError: function(event, name, error) { return self.onError(event,name,error);},
|
||||||
sendBoundary: window.FormData || jQuery.browser.mozilla,
|
sendBoundary: window.FormData || jQuery.browser.mozilla,
|
||||||
url: egw_json_request.prototype._assembleAjaxUrl("etemplate_widget_file::ajax_upload") +
|
beforeSend: function(form) { return self.beforeSend(form);},
|
||||||
"&request_id="+ instance.etemplate_exec_id
|
url: egw_json_request.prototype._assembleAjaxUrl("etemplate_widget_file::ajax_upload::etemplate")
|
||||||
};
|
};
|
||||||
this.asyncOptions.fieldName = this.options.id;
|
this.asyncOptions.fieldName = this.options.id;
|
||||||
this.createInputWidget();
|
this.createInputWidget();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
destroy: function() {
|
||||||
|
this.node = null;
|
||||||
|
this.input = null;
|
||||||
|
this.progress = null;
|
||||||
|
},
|
||||||
|
|
||||||
createInputWidget: function() {
|
createInputWidget: function() {
|
||||||
this.node = $j(document.createElement("div")).addClass("et2_file");
|
this.node = $j(document.createElement("div")).addClass("et2_file");
|
||||||
@ -110,6 +123,20 @@ var et2_file = et2_inputWidget.extend({
|
|||||||
return this.input[0];
|
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
|
* Disables submit buttons while uploading
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user