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'; public $popupClass = 'MemberTableField_Popup';
static $data_class = 'Member'; 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()} * @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->sourceJoin = " INNER JOIN \"Group_Members\" ON \"MemberID\"=\"Member\".\"ID\"";
$this->setFieldListCsv($csvFieldList); $this->setFieldListCsv($csvFieldList);
$this->setPageSize(100); $this->setPageSize($this->stat('page_size'));
} }
function sourceID() { function sourceID() {
@ -408,4 +414,4 @@ class MemberTableField_ItemRequest extends ComplexTableField_ItemRequest {
} }
?> ?>

View File

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

View File

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

View File

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

View File

@ -26,7 +26,7 @@ if((typeof tinyMCE != 'undefined')) {
theme_advanced_toolbar_location : "top", theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left", theme_advanced_toolbar_align : "left",
theme_advanced_toolbar_parent : "right", 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", blockquote_clear_tag : "p",
table_inline_editing : true, 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", 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 %> <% if ShowSwitchView %>
<div class="blank"> <% _t('VIEWPAGEIN','Page view:') %> </div> <div class="blank"> <% _t('VIEWPAGEIN','Page view:') %> </div>
<span class="current" title="<% _t('EDITINCMS', 'Edit this page in the CMS') %>"><% _t('EDIT','Edit') %></span> <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="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="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> <a style="display: none; margin-left: 20px;" id="viewArchivedSite" href="home/"><% _t('ARCHS','Archived Site') %></a>
<% end_if %> <% end_if %>
</div> </div>