Project

General

Profile

Bug #24706 » 17193_v3.diff

Administrator Admin, 2011-01-21 20:38

View differences:

typo3/backend.php (working copy)
'swfupload.swfobject' => 'contrib/swfupload/plugins/swfupload.swfobject.js',
'swfupload.cookies' => 'contrib/swfupload/plugins/swfupload.cookies.js',
'swfupload.queue' => 'contrib/swfupload/plugins/swfupload.queue.js',
'plupload' => 'contrib/plupload/js/plupload.full.min.js',
'plupload' => 'contrib/plupload/js/plupload.min.js',
'plupload_html5' => 'contrib/plupload/js/plupload.html5.min.js',
'plupload_flash' => 'contrib/plupload/js/plupload.flash.min.js',
'plupload_gears' => 'contrib/plupload/js/plupload.gears.min.js',
'plupload_browserplus' => 'contrib/plupload/js/plupload.browserplus.min.js',
'plupload_html4' => 'js/plupload.html4.js',
'md5' => 'md5.js',
'toolbarmanager' => 'js/toolbarmanager.js',
'modulemenu' => 'js/modulemenu.js',
typo3/classes/class.typo3_tcefile.php (working copy)
$ajaxObj->setError(implode(',', $errors));
} else {
if ($uploaderType === 'plupload') {
$ajaxObj->addContent('result', $this->fileData);
if (count($this->fileData)) {
$ajaxObj->addContent('success', TRUE);
$uploadEngine = t3lib_div::_GP('runtimeEngine');
if ($uploadEngine === 'html4') {
$ajaxObj->addContent('', '{success: true}');
$ajaxObj->setContentFormat('plain');
} 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');
}
}
}
typo3/js/extjs/ext.ux.plupload.js (working copy)
'<tpl for=".">',
'<dl id="{id}">',
'<dt style="width: 50%">{name}</dt>',
'<dt style="width: 15%">{size:fileSize}</dt>',
'<dt style="width: 15%"><tpl if="parseInt(size)">{size:fileSize}</tpl></dt>',
'<tpl exec="this.statusValue(status, percent, msg)"></tpl><dt style="width: 30%">{this.statusText}</dt>',
'<dt style="width: 5%" class="t3-plupload-remove"><span class="t3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-delete">&nbsp;</span></dt>',
'<div class="x-clear"></div>',
......
itemId: 'start',
iconCls: config.uploadButtonCls
}),
' ',
new Ext.form.Checkbox({
boxLabel: config.allowOverwriteText || 'Allow Overwriting of files',
itemId: 'allowOverwrite'
}),
'->',
new Ext.Button({
text: config.cancelButtonText || 'Cancel',
......
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('');
typo3/js/extjs/PluploadWindow.js (working copy)
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: '<span class="t3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-add"></span>' + top.TYPO3.LLL.fileUpload.buttonSelectFiles,
uploadButtonText: '<span class="t3-icon t3-icon-actions t3-icon-actions-edit t3-icon-edit-upload"></span>' + top.TYPO3.LLL.fileUpload.buttonStartUpload,
cancelButtonText: '<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-permission-denied"></span>' + top.TYPO3.LLL.fileUpload.buttonCancelAll,
......
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 = {
......
'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.multipart_params = parameters;
typo3/js/plupload.html4.js (revision 0)
/**
* 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);
typo3/sysext/t3skin/stylesheets/visual/module_file_upload.css (working copy)
white-space: nowrap;
}
.plupload {
cursor: pointer;
}
.plupload input {
cursor: pointer;
}
.plupload_emptytext {
font: 11px Arial,Helvetica,sans-serif;
}
(3-3/3)