Merged from trunk

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@72452 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Andrew O'Neil 2009-03-04 03:35:29 +00:00
parent 75b1484fca
commit fa76e64d48
7 changed files with 417 additions and 404 deletions

View File

@ -31,7 +31,13 @@ class MemberTableField extends ComplexTableField {
public $popupClass = 'MemberTableField_Popup';
static $data_class = 'Member';
/**
* Set the page size for this table.
* @var int
*/
public static $page_size = 20;
/**
* @deprecated 2.4. See {@link MemberTableField->addPermissions()}
*/
@ -128,7 +134,7 @@ class MemberTableField extends ComplexTableField {
$this->sourceJoin = " INNER JOIN \"Group_Members\" ON \"MemberID\"=\"Member\".\"ID\"";
$this->setFieldListCsv($csvFieldList);
$this->setPageSize(100);
$this->setPageSize($this->stat('page_size'));
}
function sourceID() {
@ -408,4 +414,4 @@ class MemberTableField_ItemRequest extends ComplexTableField_ItemRequest {
}
?>
?>

View File

@ -297,12 +297,16 @@ body.stillLoading select {
#bottom #switchView {
float: left;
}
#bottom #switchView a {
#bottom #switchView a, #bottom #switchView span {
background: none;
margin-left: 8px;
border-left: 1px solid;
padding-left: 8px;
padding-right: 8px;
display: inline-block;
border-left: 1px solid #AAA;
}
#bottom #switchView span {
border-left: none;
}
#bottom .bottomTabs a {
color: #fff;
}

View File

@ -5,173 +5,173 @@
*/
CMSMain_upload = Class.create();
CMSMain_upload.prototype = {
initialize: function() {
initialize: function() {
// This is disabled until we get it working reliably
return;
// We require flash 9
pv = getFlashPlayerVersion();
pv = getFlashPlayerVersion();
if(pv.major < 9) return;
// Due to a bug in the flash plugin on Linux and Mac, we need at least version 9.0.64 to use SWFUpload
if(navigator.appVersion.indexOf("Mac") != -1 || navigator.appVersion.indexOf("X11") != -1 || navigator.appVersion.indexOf("Linux") != -1) {
if(pv.major == 9 && pv.minor == 0 && pv.rev < 64) return;
}
// Due to a bug in the flash plugin on Linux and Mac, we need at least version 9.0.64 to use SWFUpload
if(navigator.appVersion.indexOf("Mac") != -1 || navigator.appVersion.indexOf("X11") != -1 || navigator.appVersion.indexOf("Linux") != -1) {
if(pv.major == 9 && pv.minor == 0 && pv.rev < 64) return;
}
// If those 2 checks pass, we can provide upload capabilities to the user
this.iframe = window.top.document.getElementById('AssetAdmin_upload');
this.onLoad();
},
this.iframe = window.top.document.getElementById('AssetAdmin_upload');
this.onLoad();
},
onLoad: function() {
this.upload = new Upload({
fileUploadLimit : '6',
securityID : $('SecurityID').value,
beginUploadOnQueue : false,
fileQueued : this.uploadFileQueuedCallback.bind(this),
fileProgress : this.uploadProgressCallback.bind(this),
fileCancelled : this.uploadFileCancelCallback.bind(this),
fileComplete : this.uploadFileCompleteCallback.bind(this),
queueComplete : this.uploadQueueCompleteCallback.bind(this),
buildUI : this.extendForm.bind(this)
});
},
/**
* Builds UI, called only when Upload object will be able to create flash uploader.
*/
extendForm: function() {
if(this.iframe.contentDocument == undefined) this.iframe.contentDocument = document.frames[0].document;//IE HACK
element = this.iframe.contentDocument.getElementById('Form_UploadForm');
inputFile = this.iframe.contentDocument.getElementById('Form_UploadForm_Files-0');
inputFileParent = inputFile.parentNode;
inputFileParent.removeChild(inputFile);
inputFile = this.iframe.contentDocument.createElement('input');
inputFile.type = 'text';
inputFile.id = 'Form_UploadForm_Files-0';
inputFileParent.appendChild(inputFile);
inputButton = this.iframe.contentDocument.getElementById('Form_UploadForm_Files-1');
if(inputButton != null) inputButton.parentNode.removeChild(inputButton);
inputButton = this.iframe.contentDocument.createElement('input');
inputButton.type = 'button';
inputButton.id = 'Form_UploadForm_Files-1';
inputButton.value = ' Browse...';
inputButton.style.width = '66px';
inputButton.style.height = '19px';
inputButton.style.position = 'relative';
inputButton.style.top = '1px';
inputButton.style.fontFamily = 'Arial';
inputButton.style.fontSize = '1.06em';
inputFileParent.appendChild(inputButton);
Event.observe(inputButton,'click',this.onBrowseClick.bind(this));
Event.observe(this.iframe.contentDocument.getElementById('Form_UploadForm_action_upload'),'click',this.onUploadClick.bind(this));
},
onBrowseClick: function(event) {
this.upload.browse();
},
onUploadClick: function(event) {
Event.stop(event);
this.upload.startUpload();
},
uploadFileQueuedCallback: function(file,queueLength) {
this.upload.setFolderID(this.iframe.contentDocument.getElementById('Form_UploadForm_ID').value);
this.iframe.contentDocument.getElementById('Form_UploadForm_action_upload').disabled = false;
var fileContainer = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList');
if(fileContainer == null) {
fileContainer = this.iframe.contentDocument.createElement('div');
fileContainer.id = 'Form_UploadForm_FilesList';
this.iframe.contentDocument.getElementById('Form_UploadForm').appendChild(fileContainer);
}
var fileToUpload = this.iframe.contentDocument.createElement('div');
fileToUpload.id = 'Form_UploadForm_FilesList_' + file.id;
fileToUpload.style.marginBottom = '3px';
fileContainer.appendChild(fileToUpload);
var fileName = this.iframe.contentDocument.createElement('div');
fileName.id = 'Form_UploadForm_FilesList_Name_' + file.id;
fileName.style.position = 'relative';
fileName.style.top = '-4px';
fileName.style.display = 'inline';
fileName.style.padding = '2px';
fileName.innerHTML = file.name;
fileName.style.height = Element.getDimensions(fileName).height + 1 + 'px';//IE hack
fileToUpload.appendChild(fileName);
var fileProgress = this.iframe.contentDocument.createElement('div');
fileProgress.id = 'Form_UploadForm_FilesList_Progress_' + file.id;
Position.clone(fileName,fileProgress);
fileProgress.style.backgroundColor = 'black';
fileProgress.style.display = 'inline';
fileProgress.style.position = 'absolute';
fileProgress.style.left = '5px';
fileProgress.style.width = '0px';
fileProgress.finished = false;
fileProgress.style.top = parseInt(fileProgress.style.top) + 6 + 'px';
fileProgress.style.height = Element.getDimensions(fileName).height + 1 + 'px';
fileToUpload.appendChild(fileProgress);
var fileDelete = this.iframe.contentDocument.createElement('input');
fileDelete.id = file.id;
fileDelete.type = 'button';
fileDelete.value = 'Delete';
Element.addClassName(fileDelete,'delete');
fileToUpload.appendChild(fileDelete);
Event.observe(fileDelete,'click',this.uploadFileCancelCallback.bind(this));
},
uploadProgressCallback: function(file,bytesLoaded) {
fileName = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList_Name_' + file.id);
fileName.style.border = 'solid 1px black';
fileProgress = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList_Progress_' + file.id);
fileProgress.style.opacity = 0.3;fileProgress.style.filter = 'alpha(opacity=30)';
if(!fileProgress.cloned) {
Position.clone(fileName,fileProgress);
fileProgress.style.width = '0px';
fileProgress.cloned = true;
}
fileProgress.style.width = (bytesLoaded / file.size) * Element.getDimensions(fileName).width - 1 + 'px';
},
uploadFileCompleteCallback: function(file,serverData) {
this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList_Progress_' + file.id).finished = true;
},
uploadFileCancelCallback: function(event) {
element = Event.element(event);
fileId = element.id;
fileContainer = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList');
elementToDelete = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList_' + fileId);
elementToDelete.parentNode.removeChild(elementToDelete);
filesToUpload = fileContainer.childNodes.length;
if(filesToUpload > 0) {
this.iframe.contentDocument.getElementById('Form_UploadForm_action_upload').disabled = false;
} else {
this.iframe.contentDocument.getElementById('Form_UploadForm_action_upload').disabled = true;
}
$A(fileContainer.childNodes).each(
function(item) {
$A(item.childNodes).each(
function(item) {
if(item.id.indexOf('Name') != -1) {
fileName = item;
}
if(item.id.indexOf('Progress') != -1) {
fileProgress = item;
}
});
Position.clone(fileName,fileProgress);
if(fileProgress.finished == false) fileProgress.style.width = '0px';
}
);
},
uploadQueueCompleteCallback: function() {
eval(this.upload.getUploadMessage().replace(/Uploaded 1 files/g,'Uploaded ' + this.upload.getFilesUploaded() + ' files'));
}
onLoad: function() {
this.upload = new Upload({
fileUploadLimit : '6',
securityID : $('SecurityID').value,
beginUploadOnQueue : false,
fileQueued : this.uploadFileQueuedCallback.bind(this),
fileProgress : this.uploadProgressCallback.bind(this),
fileCancelled : this.uploadFileCancelCallback.bind(this),
fileComplete : this.uploadFileCompleteCallback.bind(this),
queueComplete : this.uploadQueueCompleteCallback.bind(this),
buildUI : this.extendForm.bind(this)
});
},
/**
* Builds UI, called only when Upload object will be able to create flash uploader.
*/
extendForm: function() {
if(this.iframe.contentDocument == undefined) this.iframe.contentDocument = document.frames[0].document;//IE HACK
element = this.iframe.contentDocument.getElementById('Form_UploadForm');
inputFile = this.iframe.contentDocument.getElementById('Form_UploadForm_Files-0');
inputFileParent = inputFile.parentNode;
inputFileParent.removeChild(inputFile);
inputFile = this.iframe.contentDocument.createElement('input');
inputFile.type = 'text';
inputFile.id = 'Form_UploadForm_Files-0';
inputFileParent.appendChild(inputFile);
inputButton = this.iframe.contentDocument.getElementById('Form_UploadForm_Files-1');
if(inputButton != null) inputButton.parentNode.removeChild(inputButton);
inputButton = this.iframe.contentDocument.createElement('input');
inputButton.type = 'button';
inputButton.id = 'Form_UploadForm_Files-1';
inputButton.value = ' Browse...';
inputButton.style.width = '66px';
inputButton.style.height = '19px';
inputButton.style.position = 'relative';
inputButton.style.top = '1px';
inputButton.style.fontFamily = 'Arial';
inputButton.style.fontSize = '1.06em';
inputFileParent.appendChild(inputButton);
Event.observe(inputButton,'click',this.onBrowseClick.bind(this));
Event.observe(this.iframe.contentDocument.getElementById('Form_UploadForm_action_upload'),'click',this.onUploadClick.bind(this));
},
onBrowseClick: function(event) {
this.upload.browse();
},
onUploadClick: function(event) {
Event.stop(event);
this.upload.startUpload();
},
uploadFileQueuedCallback: function(file,queueLength) {
this.upload.setFolderID(this.iframe.contentDocument.getElementById('Form_UploadForm_ID').value);
this.iframe.contentDocument.getElementById('Form_UploadForm_action_upload').disabled = false;
var fileContainer = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList');
if(fileContainer == null) {
fileContainer = this.iframe.contentDocument.createElement('div');
fileContainer.id = 'Form_UploadForm_FilesList';
this.iframe.contentDocument.getElementById('Form_UploadForm').appendChild(fileContainer);
}
var fileToUpload = this.iframe.contentDocument.createElement('div');
fileToUpload.id = 'Form_UploadForm_FilesList_' + file.id;
fileToUpload.style.marginBottom = '3px';
fileContainer.appendChild(fileToUpload);
var fileName = this.iframe.contentDocument.createElement('div');
fileName.id = 'Form_UploadForm_FilesList_Name_' + file.id;
fileName.style.position = 'relative';
fileName.style.top = '-4px';
fileName.style.display = 'inline';
fileName.style.padding = '2px';
fileName.innerHTML = file.name;
fileName.style.height = Element.getDimensions(fileName).height + 1 + 'px';//IE hack
fileToUpload.appendChild(fileName);
var fileProgress = this.iframe.contentDocument.createElement('div');
fileProgress.id = 'Form_UploadForm_FilesList_Progress_' + file.id;
Position.clone(fileName,fileProgress);
fileProgress.style.backgroundColor = 'black';
fileProgress.style.display = 'inline';
fileProgress.style.position = 'absolute';
fileProgress.style.left = '5px';
fileProgress.style.width = '0px';
fileProgress.finished = false;
fileProgress.style.top = parseInt(fileProgress.style.top) + 6 + 'px';
fileProgress.style.height = Element.getDimensions(fileName).height + 1 + 'px';
fileToUpload.appendChild(fileProgress);
var fileDelete = this.iframe.contentDocument.createElement('input');
fileDelete.id = file.id;
fileDelete.type = 'button';
fileDelete.value = 'Delete';
Element.addClassName(fileDelete,'delete');
fileToUpload.appendChild(fileDelete);
Event.observe(fileDelete,'click',this.uploadFileCancelCallback.bind(this));
},
uploadProgressCallback: function(file,bytesLoaded) {
fileName = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList_Name_' + file.id);
fileName.style.border = 'solid 1px black';
fileProgress = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList_Progress_' + file.id);
fileProgress.style.opacity = 0.3;fileProgress.style.filter = 'alpha(opacity=30)';
if(!fileProgress.cloned) {
Position.clone(fileName,fileProgress);
fileProgress.style.width = '0px';
fileProgress.cloned = true;
}
fileProgress.style.width = (bytesLoaded / file.size) * Element.getDimensions(fileName).width - 1 + 'px';
},
uploadFileCompleteCallback: function(file,serverData) {
this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList_Progress_' + file.id).finished = true;
},
uploadFileCancelCallback: function(event) {
element = Event.element(event);
fileId = element.id;
fileContainer = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList');
elementToDelete = this.iframe.contentDocument.getElementById('Form_UploadForm_FilesList_' + fileId);
elementToDelete.parentNode.removeChild(elementToDelete);
filesToUpload = fileContainer.childNodes.length;
if(filesToUpload > 0) {
this.iframe.contentDocument.getElementById('Form_UploadForm_action_upload').disabled = false;
} else {
this.iframe.contentDocument.getElementById('Form_UploadForm_action_upload').disabled = true;
}
$A(fileContainer.childNodes).each(
function(item) {
$A(item.childNodes).each(
function(item) {
if(item.id.indexOf('Name') != -1) {
fileName = item;
}
if(item.id.indexOf('Progress') != -1) {
fileProgress = item;
}
});
Position.clone(fileName,fileProgress);
if(fileProgress.finished == false) fileProgress.style.width = '0px';
}
);
},
uploadQueueCompleteCallback: function() {
eval(this.upload.getUploadMessage().replace(/Uploaded 1 files/g,'Uploaded ' + this.upload.getFilesUploaded() + ' files'));
}
}
window.top.document.CMSMain_upload = CMSMain_upload;

View File

@ -125,13 +125,13 @@ $(document).ready(function() {
});
$('a.form_frontend_function.tick_all_result_assembly').click(function(){
var resultAssembly = $('div#ResultAssembly ul li input');
var resultAssembly = $(this).prevAll('div#ResultAssembly').find('ul li input');
resultAssembly.attr('checked', 'checked');
return false;
});
$('a.form_frontend_function.untick_all_result_assembly').click(function(){
var resultAssembly = $('div#ResultAssembly ul li input');
var resultAssembly = $(this).prevAll('div#ResultAssembly').find('ul li input');
resultAssembly.removeAttr('checked');
return false;
});
@ -209,7 +209,10 @@ $(document).ready(function() {
*/
$('#right #form_actions_right input[name=action_doDelete]').livequery('click', function(){
var confirmed = confirm(ss.i18n._t('ModelAdmin.REALLYDELETE'));
if(!confirmed) return false;
if(!confirmed) {
$(this).removeClass('loading')
return false;
}
var form = $('#right form');
var formAction = form.attr('action') + '?' + $(this).fieldSerialize();

View File

@ -1,129 +1,129 @@
/*
This class is wrapper for SWFUpload class.
If you want use SWFUpload, please use this class becuase it will take care of configuration
error handling and other things.
This class is wrapper for SWFUpload class.
If you want use SWFUpload, please use this class becuase it will take care of configuration
error handling and other things.
*/
Upload = Class.create();
Upload.prototype = {
/**
* Sets configuration data provided from user if smth is missing sets default value.
*
* @param params object contains all configuration data for upload.
*/
initialize: function(params) {
this.filesUploaded = 0;
this.filesToUpload = 0;
this.folderID = 'root';
this.uploadInProgress = false;
this.uploadMessage = '';
if(typeof params.fileSizeLimit != 'undefined') this.setFileSizeLimit = params.fileSizeLimit; else this.fileSizeLimit = '30720';
if(typeof params.fileTypes != 'undefined') this.fileTypes = params.fileTypes; else this.fileTypes = '*.*';
if(typeof params.fileTypesDescription != 'undefined') this.fileTypesDescription = params.fileTypesDescription; else this.fileTypesDescription = 'All Files';
if(typeof params.fileUploadLimit != 'undefined') this.fileUploadLimit = params.fileUploadLimit; else this.fileUploadLimit = '6';
if(typeof params.beginUploadOnQueue != 'undefined') this.beginUploadOnQueue = params.beginUploadOnQueue; else this.beginUploadOnQueue = false;
if(typeof params.fileQueued != 'undefined') this.fileQueued = params.fileQueued;
if(typeof params.fileProgress != 'undefined') this.fileProgress = params.fileProgress; else this.fileProgress = Prototype.emptyFunction;
if(typeof params.fileCancelled != 'undefined') this.fileCancelled = params.fileCancelled;
if(typeof params.fileComplete != 'undefined') this.fileComplete = params.fileComplete ;
if(typeof params.queueComplete != 'undefined') this.queueComplete = params.queueComplete;
if(typeof params.buildUI != 'undefined') this.customBuildUI = params.buildUI;
if(typeof params.securityID != 'undefined') this.securityID = params.securityID;
this.onLoad();
},
/**
* Creates SWFUpload object for uploading files.
*
*/
onLoad: function() {
path = this.getBasePath();
sessId = this.getSessionId();//Because flash doesn't send proper cookies, we need to set session id in URL.
this.swfu = new SWFUpload({
upload_url: path + 'admin/assets/UploadForm?SecurityID=' + this.securityID + '&PHPSESSID=' + sessId, // Relative to the SWF file
file_post_name: 'Files',
file_size_limit : this.fileSizeLimit,
file_types : this.fileTypes,
file_types_description : this.fileTypesDescription,
file_upload_limit : this.fileUploadLimit,
begin_upload_on_queue : this.beginUploadOnQueue,
use_server_data_event : true,
validate_files: false,
/**
* Sets configuration data provided from user if smth is missing sets default value.
*
* @param params object contains all configuration data for upload.
*/
initialize: function(params) {
this.filesUploaded = 0;
this.filesToUpload = 0;
this.folderID = 'root';
this.uploadInProgress = false;
this.uploadMessage = '';
if(typeof params.fileSizeLimit != 'undefined') this.setFileSizeLimit = params.fileSizeLimit; else this.fileSizeLimit = '30720';
if(typeof params.fileTypes != 'undefined') this.fileTypes = params.fileTypes; else this.fileTypes = '*.*';
if(typeof params.fileTypesDescription != 'undefined') this.fileTypesDescription = params.fileTypesDescription; else this.fileTypesDescription = 'All Files';
if(typeof params.fileUploadLimit != 'undefined') this.fileUploadLimit = params.fileUploadLimit; else this.fileUploadLimit = '6';
if(typeof params.beginUploadOnQueue != 'undefined') this.beginUploadOnQueue = params.beginUploadOnQueue; else this.beginUploadOnQueue = false;
if(typeof params.fileQueued != 'undefined') this.fileQueued = params.fileQueued;
if(typeof params.fileProgress != 'undefined') this.fileProgress = params.fileProgress; else this.fileProgress = Prototype.emptyFunction;
if(typeof params.fileCancelled != 'undefined') this.fileCancelled = params.fileCancelled;
if(typeof params.fileComplete != 'undefined') this.fileComplete = params.fileComplete ;
if(typeof params.queueComplete != 'undefined') this.queueComplete = params.queueComplete;
if(typeof params.buildUI != 'undefined') this.customBuildUI = params.buildUI;
if(typeof params.securityID != 'undefined') this.securityID = params.securityID;
this.onLoad();
},
/**
* Creates SWFUpload object for uploading files.
*
*/
onLoad: function() {
path = this.getBasePath();
sessId = this.getSessionId();//Because flash doesn't send proper cookies, we need to set session id in URL.
this.swfu = new SWFUpload({
upload_url: path + 'admin/assets/UploadForm?SecurityID=' + this.securityID + '&PHPSESSID=' + sessId, // Relative to the SWF file
file_post_name: 'Files',
file_size_limit : this.fileSizeLimit,
file_types : this.fileTypes,
file_types_description : this.fileTypesDescription,
file_upload_limit : this.fileUploadLimit,
begin_upload_on_queue : this.beginUploadOnQueue,
use_server_data_event : true,
validate_files: false,
file_queued_handler : this.uploadFileQueuedCallback.bind(this),
upload_success_handler : this.uploadFileCompleteCallback.bind(this),
upload_progress_handler: this.uploadFileProgressCallback.bind(this),
error_handler : this.uploadErrorCallback.bind(this),
file_validation_handler : Prototype.emptyFunction,
file_cancelled_handler: Prototype.emptyFunction,
flash_url : 'jsparty/SWFUpload/swfupload_f9.swf', // Relative to this file
swfupload_loaded_handler: this.buildUI.bind(this),
debug: false
});
},
/**
* Retrieves base path from URL.
* TODO: Use base tag.
*/
getBasePath: function() {
var path = 'http://' + window.location.host + window.location.pathname;
file_queued_handler : this.uploadFileQueuedCallback.bind(this),
upload_success_handler : this.uploadFileCompleteCallback.bind(this),
upload_progress_handler: this.uploadFileProgressCallback.bind(this),
error_handler : this.uploadErrorCallback.bind(this),
file_validation_handler : Prototype.emptyFunction,
file_cancelled_handler: Prototype.emptyFunction,
flash_url : 'jsparty/SWFUpload/swfupload_f9.swf', // Relative to this file
swfupload_loaded_handler: this.buildUI.bind(this),
debug: false
});
},
/**
* Retrieves base path from URL.
* TODO: Use base tag.
*/
getBasePath: function() {
var path = 'http://' + window.location.host + window.location.pathname;
if(path.match(/^(.*\/)admin/i)) return RegExp.$1;
else return path;
},
/**
* Retrieves sessionId from cookie.
*
*/
},
/**
* Retrieves sessionId from cookie.
*
*/
getSessionId: function() {
var start = document.cookie.indexOf('PHPSESSID')+10;
var end = document.cookie.indexOf(';',start);
if(end == -1) end = document.cookie.length;
return document.cookie.substring(start,end);
},
/**
* Calls method defined by user, method should create user interface.
*
*/
buildUI: function() {
this.customBuildUI();
},
/**
* Called when new file is added to the queue
*
* @param file object
* @param queueLength int
*/
uploadFileQueuedCallback: function(file,queueLength) {
this.filesToUpload++;
this.fileQueued(file, queueLength);
this.addFileParam(file);
},
/**
* Called when uploading of particular file has finished
*
* @param file object
* @param servedData string
*/
uploadFileCompleteCallback: function(file,serverData) {
this.filesUploaded++;
getSessionId: function() {
var start = document.cookie.indexOf('PHPSESSID')+10;
var end = document.cookie.indexOf(';',start);
if(end == -1) end = document.cookie.length;
return document.cookie.substring(start,end);
},
/**
* Calls method defined by user, method should create user interface.
*
*/
buildUI: function() {
this.customBuildUI();
},
/**
* Called when new file is added to the queue
*
* @param file object
* @param queueLength int
*/
uploadFileQueuedCallback: function(file,queueLength) {
this.filesToUpload++;
this.fileQueued(file, queueLength);
this.addFileParam(file);
},
/**
* Called when uploading of particular file has finished
*
* @param file object
* @param servedData string
*/
uploadFileCompleteCallback: function(file,serverData) {
this.filesUploaded++;
if(serverData) {
var toEval = serverData.substr(serverData.indexOf('<script'));
toEval = toEval.replace('<script type="text/javascript">','');
toEval = toEval.replace('</script>','');
this.uploadMessage = toEval;
var toEval = serverData.substr(serverData.indexOf('<script'));
toEval = toEval.replace('<script type="text/javascript">','');
toEval = toEval.replace('</script>','');
this.uploadMessage = toEval;
}
this.fileComplete(file, serverData);
@ -134,123 +134,123 @@ Upload.prototype = {
else {
this.queueComplete();
this.uploadInProgress = false;
this.filesUploaded = 0;
this.filesToUpload = 0;
this.filesUploaded = 0;
this.filesToUpload = 0;
}
},
/**
* Called during uploading file.
*
* @param file object
* @param bytes_complete int
*/
uploadFileProgressCallback: function(file, bytes_complete) {
this.uploadInProgress = true;
this.fileProgress(file, bytes_complete);
},
/**
* Called on error.
* @param error_code int
* @param file object
* @param message string
*/
},
/**
* Called during uploading file.
*
* @param file object
* @param bytes_complete int
*/
uploadFileProgressCallback: function(file, bytes_complete) {
this.uploadInProgress = true;
this.fileProgress(file, bytes_complete);
},
/**
* Called on error.
* @param error_code int
* @param file object
* @param message string
*/
uploadErrorCallback: function(error_code, file, message) {
this.swfu.cancelQueue();
switch(error_code) {
case SWFUpload.ERROR_CODE_HTTP_ERROR:
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: HTTP Error, File name: ' + file.name + ', Message: ' + msg);
break;
case SWFUpload.ERROR_CODE_IO_ERROR:
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: IO Error, File name: ' + file.name + ', Message: ' + msg);
break;
case SWFUpload.ERROR_CODE_SECURITY_ERROR:
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: Security Error, File name: ' + file.name + ', Message: ' + msg);
break;
case SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT:
alert('Files cannot be bigger than ' + this.fileSizeLimit/1024 + ' MB.');
break;
case SWFUpload.ERROR_CODE_ZERO_BYTE_FILE:
alert('Files cannot be empty');
break;
case SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED:
alert('You can only have six files in queue');
break;
case SWFUpload.ERROR_CODE_UPLOAD_FAILED:
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
break;
case SWFUpload.ERROR_CODE_SPECIFIED_FILE_NOT_FOUND:
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
break;
default:
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
}
},
/**
* Because we are on top of standard upload we need to add some POST vars that
* normally are being sent as part of form.
*
* @param file object
*/
addFileParam: function(file) {
this.swfu.addFileParam(file.id,'ID',this.folderID);
this.swfu.addFileParam(file.id,'action_doUpload','1');
this.swfu.addFileParam(file.id,'Files',file.name);
this.swfu.addFileParam(file.id,'MAX_FILE_SIZE','31457280');
},
/**
* Starts file explorer.
*
*/
browse: function() {
this.swfu.selectFiles();
},
/**
* Starts upload
*
*/
startUpload: function() {
this.swfu.startUpload();
},
/**
* Cancels uploading of file.
*/
cancelUpload: function(fileId) {
this.filesToUpload--;
this.swfu.cancelUpload(fileId);
},
/*
* Getters and setters.
*/
setFolderID: function(id) {
this.folderID = id;
},
getFilesUploaded: function() {
return this.filesUploaded;
},
getFilesToUpload: function() {
return this.filesToUpload;
},
getUploadMessage: function() {
return this.uploadMessage;
},
isUploadInProgress: function() {
return this.uploadInProgress;
}
uploadErrorCallback: function(error_code, file, message) {
this.swfu.cancelQueue();
switch(error_code) {
case SWFUpload.ERROR_CODE_HTTP_ERROR:
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: HTTP Error, File name: ' + file.name + ', Message: ' + msg);
break;
case SWFUpload.ERROR_CODE_IO_ERROR:
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: IO Error, File name: ' + file.name + ', Message: ' + msg);
break;
case SWFUpload.ERROR_CODE_SECURITY_ERROR:
alert('You have encountered an error. File hasn\'t been uploaded. Please hit the "Refresh" button in your web browser. Error Code: Security Error, File name: ' + file.name + ', Message: ' + msg);
break;
case SWFUpload.ERROR_CODE_FILE_EXCEEDS_SIZE_LIMIT:
alert('Files cannot be bigger than ' + this.fileSizeLimit/1024 + ' MB.');
break;
case SWFUpload.ERROR_CODE_ZERO_BYTE_FILE:
alert('Files cannot be empty');
break;
case SWFUpload.ERROR_CODE_QUEUE_LIMIT_EXCEEDED:
alert('You can only have six files in queue');
break;
case SWFUpload.ERROR_CODE_UPLOAD_FAILED:
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
break;
case SWFUpload.ERROR_CODE_SPECIFIED_FILE_NOT_FOUND:
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
break;
default:
alert('You have encountered an error. File hasn\'t has been uploaded. Please hit the "Refresh" button in your web browser');
}
},
/**
* Because we are on top of standard upload we need to add some POST vars that
* normally are being sent as part of form.
*
* @param file object
*/
addFileParam: function(file) {
this.swfu.addFileParam(file.id,'ID',this.folderID);
this.swfu.addFileParam(file.id,'action_doUpload','1');
this.swfu.addFileParam(file.id,'Files',file.name);
this.swfu.addFileParam(file.id,'MAX_FILE_SIZE','31457280');
},
/**
* Starts file explorer.
*
*/
browse: function() {
this.swfu.selectFiles();
},
/**
* Starts upload
*
*/
startUpload: function() {
this.swfu.startUpload();
},
/**
* Cancels uploading of file.
*/
cancelUpload: function(fileId) {
this.filesToUpload--;
this.swfu.cancelUpload(fileId);
},
/*
* Getters and setters.
*/
setFolderID: function(id) {
this.folderID = id;
},
getFilesUploaded: function() {
return this.filesUploaded;
},
getFilesToUpload: function() {
return this.filesToUpload;
},
getUploadMessage: function() {
return this.uploadMessage;
},
isUploadInProgress: function() {
return this.uploadInProgress;
}
}

View File

@ -26,7 +26,7 @@ if((typeof tinyMCE != 'undefined')) {
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_toolbar_parent : "right",
plugins : "media,blockquote,contextmenu,table,emotions,paste,../../tinymce_ssbuttons,../../tinymce_advcode,spellchecker",
plugins : "media,contextmenu,table,emotions,paste,../../tinymce_ssbuttons,../../tinymce_advcode,spellchecker",
blockquote_clear_tag : "p",
table_inline_editing : true,
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,separator,bullist,numlist,outdent,indent,blockquote,hr,charmap",

View File

@ -49,8 +49,8 @@
<% if ShowSwitchView %>
<div class="blank"> <% _t('VIEWPAGEIN','Page view:') %> </div>
<span class="current" title="<% _t('EDITINCMS', 'Edit this page in the CMS') %>"><% _t('EDIT','Edit') %></span>
| <a id="viewStageSite" title="<% _t('VIEWINDRAFT', 'View the Page in the Draft Site') %>" href="home/?stage=Stage"><% _t('DRAFTS','Draft Site') %></a>
| <a id="viewLiveSite" title="<% _t('VIEWINPUBLISHED', 'View the Page in the Published Site') %>" href="home/?stage=Live"><% _t('PUBLIS','Published Site') %></a>
<a id="viewStageSite" title="<% _t('VIEWINDRAFT', 'View the Page in the Draft Site') %>" href="home/?stage=Stage"><% _t('DRAFTS','Draft Site') %></a>
<a id="viewLiveSite" title="<% _t('VIEWINPUBLISHED', 'View the Page in the Published Site') %>" href="home/?stage=Live"><% _t('PUBLIS','Published Site') %></a>
<a style="display: none; margin-left: 20px;" id="viewArchivedSite" href="home/"><% _t('ARCHS','Archived Site') %></a>
<% end_if %>
</div>