[TYPO3-formidable] rdt_swfupload multiple instances bug

Christian Kartnig office at hahnepeter.de
Thu Nov 11 11:10:57 CET 2010


Hi all!

I came across a bug in the swfupload renderlet. When using multiple 
instances of the renderlet, it doesn't work out anymore, because in  the 
eventhandlers, the code for all instances gets executed, not only the 
one for the instance (e.g. when i choose a file, the file is added in 
all listqueue elements, not only the current one).

As a workaround I restructured the changed aHandler array structure in 
rdt_swfupload.js to a multidimensional array, giving each instance its 
own array key.

Just in case anyone has the same problem...

// changed addHandler, injected the Html Id and make aHandlers array 
multidimensional so that handlers can called specifically from instances	
	addHandler: function(sHtmlId, sHandler, fFunction) {
		console.log("addHandler", sHandler);
		this.aHandlers[sHandler][sHtmlId] = $A();
		this.aHandlers[sHandler][sHtmlId].push(fFunction);
	},

of course, you need to adjust the addHandler call in rdt_swfupload.php

and the Eventlisteners get the following code:

	onQueueError_handler: function(file, error_code, message) {
		var pId = this.config.id;	//the html id of the instance
		if (this.aHandlers["onqueueerror"][pId]!=undefined) {			
			this.aHandlers["onqueueerror"][pId].each(function(fFunc, iKey) {
				fFunc(file, error_code, message);
			});


Maybe someone finds the time to fix this bug.

Best Regards,
Christian


More information about the TYPO3-project-formidable mailing list