#1606 - Check add folder & upload-functionality in tinymce

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@44594 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2007-11-11 22:30:01 +00:00
parent 1fdd1553fd
commit 0269aa224d
3 changed files with 17 additions and 30 deletions

View File

@ -12,7 +12,8 @@ CMSMain_upload.prototype = {
onLoad: function() { onLoad: function() {
this.upload = new Upload({ this.upload = new Upload({
fileUploadLimit : '6', fileUploadLimit : '6',
securityID : $('SecurityID').value,
beginUploadOnQueue : false, beginUploadOnQueue : false,
fileQueued : this.uploadFileQueuedCallback.bind(this), fileQueued : this.uploadFileQueuedCallback.bind(this),
fileProgress : this.uploadProgressCallback.bind(this), fileProgress : this.uploadProgressCallback.bind(this),
@ -170,4 +171,4 @@ CMSMain_upload.prototype = {
eval(this.upload.getUploadMessage().replace('1',this.upload.getFilesUploaded())); eval(this.upload.getUploadMessage().replace('1',this.upload.getFilesUploaded()));
} }
} }
window.top.document.CMSMain_upload = CMSMain_upload; window.top.document.CMSMain_upload = CMSMain_upload;

View File

@ -10,28 +10,12 @@ TinyMCEImageEnhancement.prototype = {
Event.observe(window,'load',this.onWindowLoad.bind(this)); Event.observe(window,'load',this.onWindowLoad.bind(this));
}, },
buildUI: function() { addListeners: function() {
$('Form_EditorToolbarImageForm_FolderID').value = ""; $('Form_EditorToolbarImageForm_FolderID').value = "";
divAddFolder = this.addElement('div','group',$('FolderID'),{'id': 'AddFolderGroup'}); Event.observe($('AddFolder'),'click',this.onAddFolder.bind(this));
addFolder = this.addElement('a','link',divAddFolder,{'id': 'AddFolder','href' : '#','innerHTML': 'add folder'}); Event.observe($('FolderOk'),'click',this.onFolderOk.bind(this));
newFolderName = this.addElement('input', 'addFolder',divAddFolder,{'id': 'NewFolderName','type' : 'text'}); Event.observe($('FolderCancel'),'click',this.onFolderCancel.bind(this));
Element.hide(newFolderName);
var folderOk = this.addElement('a','link',divAddFolder,{'id': 'FolderOk','href' : '#','innerHTML': 'ok'});
Element.hide(folderOk);
Element.addClassName(folderOk,'addFolder');
var folderCancel = this.addElement('a','link',divAddFolder,{'id': 'FolderCancel','href' : '#','innerHTML': 'cancel'});
Element.hide(folderCancel);
Element.addClassName(folderCancel,'addFolder');
var divUpload = this.addElement('div','group',$('FolderID'),{'id': 'UploadrGroup'});
var pipeSeparator = this.addElement('div','',divUpload,{'id' : 'PipeSeparator','innerHTML' : ' | '});
pipeSeparator.style.display = "inline";
var uploadFiles = this.addElement('a','link',divUpload,{'id' : 'UploadFiles','href' : '#','innerHTML' : 'upload'});
Event.observe(addFolder,'click',this.onAddFolder.bind(this));
Event.observe(folderOk,'click',this.onFolderOk.bind(this));
Event.observe(folderCancel,'click',this.onFolderCancel.bind(this));
Event.observe($('UploadFiles'),'click',this.onUpload.bind(this)); Event.observe($('UploadFiles'),'click',this.onUpload.bind(this));
}, },
@ -152,9 +136,10 @@ TinyMCEImageEnhancement.prototype = {
{ {
fileTypes : '*.jpeg;*.jpg;*.jpe;*.png;*.gif;', fileTypes : '*.jpeg;*.jpg;*.jpe;*.png;*.gif;',
fileTypesDescription : 'Image files', fileTypesDescription : 'Image files',
fileUploadLimit : '100', fileUploadLimit : '100',
securityID : $('SecurityID').value,
beginUploadOnQueue : true, beginUploadOnQueue : true,
buildUI : this.buildUI.bind(this), buildUI : this.addListeners.bind(this),
fileQueued : this.uploadFileQueuedCallback.bind(this), fileQueued : this.uploadFileQueuedCallback.bind(this),
fileComplete : this.uploadFileCompleteCallback.bind(this), fileComplete : this.uploadFileCompleteCallback.bind(this),
queueComplete : this.uploadQueueCompleteCallback.bind(this) queueComplete : this.uploadQueueCompleteCallback.bind(this)
@ -266,4 +251,4 @@ TinyMCEImageEnhancement.prototype = {
return $('Form_EditorToolbarImageForm_FolderID').value == '' ? 'root' : $('Form_EditorToolbarImageForm_FolderID').value; return $('Form_EditorToolbarImageForm_FolderID').value == '' ? 'root' : $('Form_EditorToolbarImageForm_FolderID').value;
} }
} }
tinyMCEImageEnhancement = new TinyMCEImageEnhancement(); tinyMCEImageEnhancement = new TinyMCEImageEnhancement();

View File

@ -29,7 +29,8 @@ Upload.prototype = {
if(typeof params.fileCancelled != 'undefined') this.fileCancelled = params.fileCancelled; if(typeof params.fileCancelled != 'undefined') this.fileCancelled = params.fileCancelled;
if(typeof params.fileComplete != 'undefined') this.fileComplete = params.fileComplete ; if(typeof params.fileComplete != 'undefined') this.fileComplete = params.fileComplete ;
if(typeof params.queueComplete != 'undefined') this.queueComplete = params.queueComplete; if(typeof params.queueComplete != 'undefined') this.queueComplete = params.queueComplete;
if(typeof params.buildUI != 'undefined') this.customBuildUI = params.buildUI; if(typeof params.buildUI != 'undefined') this.customBuildUI = params.buildUI;
if(typeof params.securityID != 'undefined') this.securityID = params.securityID;
this.onLoad(); this.onLoad();
}, },
@ -41,7 +42,7 @@ Upload.prototype = {
path = this.getBasePath(); path = this.getBasePath();
sessId = this.getSessionId();//Because flash doesn't send proper cookies, we need to set session id in URL. sessId = this.getSessionId();//Because flash doesn't send proper cookies, we need to set session id in URL.
this.swfu = new SWFUpload({ this.swfu = new SWFUpload({
upload_target_url: path + '/assets/index/root?executeForm=UploadForm&PHPSESSID=' + sessId, // Relative to the SWF file upload_target_url: path + '/assets/index/root?executeForm=UploadForm&SecurityID=' + this.securityID + '&PHPSESSID=' + sessId, // Relative to the SWF file
file_post_name: 'Files', file_post_name: 'Files',
file_size_limit : this.fileSizeLimit, file_size_limit : this.fileSizeLimit,
file_types : this.fileTypes, file_types : this.fileTypes,
@ -251,4 +252,4 @@ Upload.prototype = {
isUploadInProgress: function() { isUploadInProgress: function() {
return this.uploadInProgress; return this.uploadInProgress;
} }
} }