Index: typo3/classes/class.typo3_tcefile.php =================================================================== --- typo3/classes/class.typo3_tcefile.php (revision 10121) +++ typo3/classes/class.typo3_tcefile.php (revision ) @@ -171,26 +171,32 @@ $ajaxObj->setError(implode(',', $errors)); } else { if ($uploaderType === 'plupload') { + $uploadEngine = t3lib_div::_GP('runtimeEngine'); + if ($uploadEngine === 'html4') { + $ajaxObj->addContent('', '{success: true}'); + $ajaxObj->setContentFormat('plain'); + } else { - $ajaxObj->addContent('result', $this->fileData); - if (count($this->fileData)) { - $ajaxObj->addContent('success', TRUE); - } else { - $ajaxObj->addContent('success', FALSE); - } + $ajaxObj->addContent('result', $this->fileData); + if (count($this->fileData)) { + $ajaxObj->addContent('success', TRUE); + } else { + $ajaxObj->addContent('success', FALSE); + } + $ajaxObj->setContentFormat('json'); + } } else { $ajaxObj->addContent('result', $this->fileData); if ($this->redirect) { $ajaxObj->addContent('redirect', $this->redirect); } - } - - $ajaxObj->setContentFormat('json'); - } - } -} + $ajaxObj->setContentFormat('json'); + } + } + } +} if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/classes/class.typo3_tcefile.php'])) { include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/classes/class.typo3_tcefile.php']); } -?> \ No newline at end of file +?> Index: t3lib/class.t3lib_beuserauth.php =================================================================== --- t3lib/class.t3lib_beuserauth.php (revision 10121) +++ t3lib/class.t3lib_beuserauth.php (revision ) @@ -124,7 +124,7 @@ 'edit_showFieldHelp' => 'icon', 'edit_RTE' => '1', 'edit_docModuleUpload' => '1', - 'enableFlashUploader' => '1', + 'enableFlashUploader' => '2', 'disableCMlayers' => 0, 'navFrameWidth' => '', // Default is 245 pixels 'navFrameResizable' => 0, Index: typo3/js/extjs/ext.ux.plupload.js =================================================================== --- typo3/js/extjs/ext.ux.plupload.js (revision 10033) +++ typo3/js/extjs/ext.ux.plupload.js (revision ) @@ -16,7 +16,7 @@ '', '
', '
{name}
', - '
{size:fileSize}
', + '
{size:fileSize}
', '
{this.statusText}
', '
 
', '
', @@ -72,29 +72,44 @@ this.tbar = new Ext.Toolbar({ enableOverflow: true, items: [ - new Ext.Button({ + { + xtype: 'button', text: config.addButtonText || 'Add files', itemId: 'addButton', iconCls: config.addButtonCls, disabled: true - }), - new Ext.Button({ + }, + { + xtype: 'tbspacer', + cls: 'toolbar-spacer', + width: 20 + }, + { + xtype: 'checkbox', + boxLabel: config.allowOverwriteText || 'Allow Overwriting of files', + itemId: 'allowOverwrite', + cls: 'toolbar-checkbox' + }, + '->', + { + xtype: 'button', text: config.uploadButtonText || 'Upload', handler: this.onStart, scope: this, disabled: true, itemId: 'start', iconCls: config.uploadButtonCls - }), - '->', - new Ext.Button({ + }, + ' ', + { + xtype: 'button', text: config.cancelButtonText || 'Cancel', handler: this.onCancel, scope: this, disabled: true, itemId: 'cancel', iconCls: config.cancelButtonCls - }) + } ] }); @@ -273,7 +288,7 @@ var statusCmp = bbar.getComponent('status'); this.runtime = data.runtime; if (this.runtime_visible == true) { - statusCmp.setText(" Uploader runtime: " + this.runtime); + statusCmp.setText(this.runtime); } else { statusCmp.setText(''); Index: typo3/js/plupload.html4.js =================================================================== --- typo3/js/plupload.html4.js (revision ) +++ typo3/js/plupload.html4.js (revision ) @@ -0,0 +1,275 @@ +/** + * plupload.html4.js + * + * Copyright 2010, Ryan Demmer + * Copyright 2009, Moxiecode Systems AB + * Released under GPL License. + * + * License: http://www.plupload.com/license + * Contributing: http://www.plupload.com/contributing + * + * This includes a fix because file forms where removed two times. + */ + +// JSLint defined globals +/*global plupload:false, window:false */ + +(function(plupload) { + function getById(id) { + return document.getElementById(id); + } + + /** + * HTML4 implementation. This runtime has no special features it uses an form that posts files into an hidden iframe. + * + * @static + * @class plupload.runtimes.Html4 + * @extends plupload.Runtime + */ + plupload.runtimes.Html4 = plupload.addRuntime("html4", { + /** + * Returns a list of supported features for the runtime. + * + * @return {Object} Name/value object with supported features. + */ + getFeatures : function() { + // Only multipart feature + return { + multipart: true + }; + }, + + /** + * Initializes the upload runtime. + * + * @method init + * @param {plupload.Uploader} uploader Uploader instance that needs to be initialized. + * @param {function} callback Callback to execute when the runtime initializes or fails to initialize. If it succeeds an object with a parameter name success will be set to true. + */ + init : function(uploader, callback) { + uploader.bind("Init", function(up) { + var container = document.body, iframe, url = "javascript", currentFile, + input, currentFileId, IE = /MSIE/.test(navigator.userAgent), mimes = [], + filters = up.settings.filters, i, ext, type, y; + + // Convert extensions to mime types list + for (i = 0; i < filters.length; i++) { + ext = filters[i].extensions.split(/,/); + + for (y = 0; y < ext.length; y++) { + type = plupload.mimeTypes[ext[y]]; + + if (type) { + mimes.push(type); + } + } + } + + mimes = mimes.join(','); + + function createForm() { + var form, input, bgcolor; + + // Setup unique id for form + currentFileId = plupload.guid(); + + // Create form + form = document.createElement('form'); + form.setAttribute('id', 'form_' + currentFileId); + form.setAttribute('method', 'post'); + form.setAttribute('enctype', 'multipart/form-data'); + form.setAttribute('encoding', 'multipart/form-data'); + form.setAttribute("target", up.id + '_iframe'); + form.style.position = 'absolute'; + + // Create input and set attributes + input = document.createElement('input'); + input.setAttribute('id', 'input_' + currentFileId); + input.setAttribute('type', 'file'); + input.setAttribute('accept', mimes); + input.setAttribute('size', 1); + + // Set input styles + plupload.extend(input.style, { + width : '100%', + height : '100%', + opacity : 0 + }); + + // Show the container if shim_bgcolor is specified + bgcolor = up.settings.shim_bgcolor; + if (bgcolor) { + form.style.background = bgcolor; + } + + // no opacity in IE + if (IE) { + plupload.extend(input.style, { + filter : "alpha(opacity=0)" + }); + } + + // add change event + plupload.addEvent(input, 'change', function(e) { + var element = e.target, name, files = []; + + if (element.value) { + getById('form_' + currentFileId).style.top = -0xFFFFF + "px"; + + // Get file name + name = element.value.replace(/\\/g, '/'); + name = name.substring(name.length, name.lastIndexOf('/') + 1); + + // Push files + files.push(new plupload.File(currentFileId, name)); + + // Create and position next form + createForm(); + + // Fire FilesAdded event + if (files.length) { + uploader.trigger("FilesAdded", files); + } + } + }); + + // append to container + form.appendChild(input); + container.appendChild(form); + + up.refresh(); + } + + + function createIframe() { + // Create iframe and add it to the container + iframe = document.createElement('iframe'); + iframe.setAttribute('src', url + ':""'); // javascript:"" for HTTPS issue on IE6, uses a variable to make an ignore for jslint + iframe.setAttribute('id', up.id + '_iframe'); + iframe.setAttribute('name', up.id + '_iframe'); + iframe.style.display = 'none'; + + container.appendChild(iframe); + + // Add IFrame onload event + plupload.addEvent(iframe, 'load', function(e) { + var n = e.target, el, result; + + // Ignore load event if there is no file + if (!currentFile) { + return; + } + + try { + el = n.contentWindow.document || n.contentDocument || window.frames[n.id].document; + } catch (ex) { + // Probably a permission denied error + up.trigger('Error', { + code : plupload.SECURITY_ERROR, + message : 'Security error.', + file : currentFile + }); + + return; + } + + // Get result + result = el.documentElement.innerText || el.documentElement.textContent; + + // Assume no error + if (result) { + currentFile.status = plupload.DONE; + currentFile.loaded = 1025; + currentFile.percent = 100; + + up.trigger('UploadProgress', currentFile); + up.trigger('FileUploaded', currentFile, { + response : result + }); + } + }); + + // Upload file + up.bind("UploadFile", function(up, file) { + var form, input; + + // File upload finished + if (file.status == plupload.DONE || file.status == plupload.FAILED || up.state == plupload.STOPPED) { + return; + } + + // Get the form and input elements + form = getById('form_' + file.id); + input = getById('input_' + file.id); + + // Set input element name attribute which allows it to be submitted + input.setAttribute('name', up.settings.file_data_name); + + // Store action + form.setAttribute("action", up.settings.url); + + // Append multipart parameters + plupload.each(plupload.extend({name : file.target_name || file.name}, up.settings.multipart_params), function(value, name) { + var input = document.createElement('input'); + + plupload.extend(input, { + type : 'hidden', + name : name, + value : value + }); + + form.insertBefore(input, form.firstChild); + }); + + currentFile = file; + + // Hide the current form + getById('form_' + currentFileId).style.top = -0xFFFFF + "px"; + + form.submit(); + form.parentNode.removeChild(form); + createForm(); + }); + } + + if (up.settings.container) { + container = getById(up.settings.container); + container.style.position = 'relative'; + } + + up.bind('StateChanged', function(up) { + if (up.state == plupload.STARTED) { + createIframe(); + } + + if (up.state == plupload.STOPPED) { + window.setTimeout(function() { + iframe.parentNode.removeChild(iframe); + }, 0); + } + }); + + // Refresh button, will reposition the input form + up.bind("Refresh", function(up) { + var browseButton, browsePos, browseSize; + + browseButton = getById(up.settings.browse_button); + browsePos = plupload.getPos(browseButton, getById(up.settings.container)); + browseSize = plupload.getSize(browseButton); + + plupload.extend(getById('form_' + currentFileId).style, { + top : browsePos.y + 'px', + left : browsePos.x + 'px', + width : browseSize.w + 'px', + height : browseSize.h + 'px' + }); + }); + + // Create initial form + createForm(); + }); + + callback({success : true}); + } + }); +})(plupload); Index: typo3/js/extjs/PluploadWindow.js =================================================================== --- typo3/js/extjs/PluploadWindow.js (revision 10049) +++ typo3/js/extjs/PluploadWindow.js (revision ) @@ -54,7 +54,7 @@ file_data_name: 'upload_1', max_file_size: '1mb', flash_swf_url : top.TYPO3.configuration.PATH_typo3 + 'contrib/plupload/js/plupload.flash.swf', - runtime_visible: false, + runtime_visible: true, addButtonText: '' + top.TYPO3.LLL.fileUpload.buttonSelectFiles, uploadButtonText: '' + top.TYPO3.LLL.fileUpload.buttonStartUpload, cancelButtonText: '' + top.TYPO3.LLL.fileUpload.buttonCancelAll, @@ -64,6 +64,7 @@ statusUploadingText: top.TYPO3.LLL.fileUpload.infoFileUploading, statusFailedText: top.TYPO3.LLL.fileUpload.errorUploadFailed, statusDoneText: top.TYPO3.LLL.fileUpload.infoFileFinished, + allowOverwriteText: top.TYPO3.LLL.fileUpload.infoComponentOverrideFiles, listeners: { uploadfile: function(uploadpanel, uploader, file) { var parameters = { @@ -73,9 +74,11 @@ 'file[upload][1][charset]': 'utf-8', 'ajaxID': 'TYPO3_tcefile::process', 'uploaderType': 'plupload', - "vC": top.TYPO3.configuration.veriCode + 'runtimeEngine': this.runtime, + "vC": top.TYPO3.configuration.veriCode, + 'overwriteExistingFiles': top.Ext.getCmp('t3-plupload-panel').getTopToolbar().getComponent('allowOverwrite').getValue() ? 1 : 0 }; - uploader.settings.max_file_size = top.TYPO3.configuration.FileUpload.maxFileSize+'b'; + uploader.settings.max_file_size = top.TYPO3.configuration.FileUpload.maxFileSize + 'k'; uploader.settings.multipart_params = parameters; } } @@ -86,7 +89,7 @@ Ext.getCmp('t3-plupload-panel').onDeleteAll(); }, afterrender: function(uploadwindow) { - Ext.getCmp('t3-plupload-panel').uploader.settings.max_file_size = top.TYPO3.configuration.FileUpload.maxFileSize+'b'; + Ext.getCmp('t3-plupload-panel').uploader.settings.max_file_size = top.TYPO3.configuration.FileUpload.maxFileSize + 'k'; Ext.getCmp('t3-plupload-panel').on('uploadcomplete', this.onUploadComplete); } }, Index: typo3/sysext/t3skin/stylesheets/visual/module_file_upload.css =================================================================== --- typo3/sysext/t3skin/stylesheets/visual/module_file_upload.css (revision 10049) +++ typo3/sysext/t3skin/stylesheets/visual/module_file_upload.css (revision ) @@ -26,6 +26,14 @@ white-space: nowrap; } +.plupload { + cursor: pointer; +} + +.plupload input { + cursor: pointer; +} + .plupload_emptytext { font: 11px Arial,Helvetica,sans-serif; }