From d82ba048bfeb869a19e4870af22611ccdfb570b1 Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 17 Jun 2009 11:50:02 +0000 Subject: [PATCH] Merged from branches/2.3 git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@79439 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/sitefeatures/PageComment.php | 8 +- code/sitefeatures/PageCommentInterface.php | 4 +- javascript/CMSMain_upload.js | 4 +- javascript/TinyMCEImageEnhancement.js | 122 ++++++++++----------- 4 files changed, 67 insertions(+), 71 deletions(-) diff --git a/code/sitefeatures/PageComment.php b/code/sitefeatures/PageComment.php index 1db41e49..34f21ccc 100755 --- a/code/sitefeatures/PageComment.php +++ b/code/sitefeatures/PageComment.php @@ -209,8 +209,8 @@ class PageComment_Controller extends Controller { if(Permission::check('CMS_ACCESS_CMSMain')) { // if spam protection module exists - if(class_exists('SpamProtecterManager')) { - SpamProtecterManager::send_feedback($comment, 'spam'); + if(class_exists('SpamProtectorManager')) { + SpamProtectorManager::send_feedback($comment, 'spam'); $comment->setField('IsSpam', true); $comment->write(); } @@ -252,8 +252,8 @@ class PageComment_Controller extends Controller { if(Permission::check('CMS_ACCESS_CMSMain')) { // if spam protection module exists - if(class_exists('SpamProtecterManager')) { - SpamProtecterManager::send_feedback($comment, 'ham'); + if(class_exists('SpamProtectorManager')) { + SpamProtectorManager::send_feedback($comment, 'ham'); $comment->setField('IsSpam', false); $comment->write(); } diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php index 9d950c1e..6e8e1086 100755 --- a/code/sitefeatures/PageCommentInterface.php +++ b/code/sitefeatures/PageCommentInterface.php @@ -181,9 +181,9 @@ class PageCommentInterface extends RequestHandler { $form->setRedirectToFormOnValidationError(true); // Optional Spam Protection. - if(class_exists('SpamProtecterManager')) { + if(class_exists('SpamProtectorManager')) { // Update the form to add the protecter field to it - $protecter = SpamProtecterManager::update_form($form); + $protecter = SpamProtectorManager::update_form($form); if($protecter) { $protecter->setFieldMapping('Name', 'Comment'); diff --git a/javascript/CMSMain_upload.js b/javascript/CMSMain_upload.js index d2d59589..a086add2 100644 --- a/javascript/CMSMain_upload.js +++ b/javascript/CMSMain_upload.js @@ -14,9 +14,7 @@ CMSMain_upload.prototype = { 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; - } + 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'); diff --git a/javascript/TinyMCEImageEnhancement.js b/javascript/TinyMCEImageEnhancement.js index 6f07cf53..b1d1b470 100644 --- a/javascript/TinyMCEImageEnhancement.js +++ b/javascript/TinyMCEImageEnhancement.js @@ -123,68 +123,66 @@ TinyMCEImageEnhancement.prototype = { // Due to a bug in the flash plugin on Linux and Mac, //we need at least version 9.0.64 to use SWFUpload // see http://open.silverstripe.com/ticket/3023 - if(navigator.appVersion.indexOf("Mac") != -1 || navigator.appVersion.indexOf("X11") != -1 || navigator.appVersion.indexOf("Linux") != -1) { - pv = getFlashPlayerVersion(); - if(pv.major < 9 || pv.major > 9 || (pv.major == 9 && pv.minor == 0 && pv.rev < 64)) { - if($('AddFolderGroup')) $('AddFolderGroup').style.display = 'none'; - if($('PipeSeparator')) $('PipeSeparator').style.display = 'none'; - if($('UploadGroup')) $('UploadGroup').style.display = 'none'; - return; - } - } - - if($('FolderID') != null) { - if($('SecurityID')) var securityid=$('SecurityID').value; - else var securityid=null; - this.upload = new Upload( - { - fileTypes : '*.jpeg;*.jpg;*.jpe;*.png;*.gif;', - fileTypesDescription : 'Image files', - fileUploadLimit : '100', - securityID : securityid, - beginUploadOnQueue : true, - buildUI : this.addListeners.bind(this), - fileQueued : this.uploadFileQueuedCallback.bind(this), - fileComplete : this.uploadFileCompleteCallback.bind(this), - queueComplete : this.uploadQueueCompleteCallback.bind(this) - } - ); - } - }, - - uploadFileQueuedCallback: function(file,queueLength) { - this.processInProgress = true; - this.upload.setFolderID(this.getParentID()); - $('UploadFiles').innerHTML = "Uploading ... 1/" + this.upload.getFilesToUpload(); - this.upload.startUpload(); - }, - - uploadFileCompleteCallback: function(file,serverData) { - Element.addClassName($('UploadFiles'),'link');//Safari hack - $('UploadFiles').innerHTML = 'Uploading ... ' + this.upload.getFilesUploaded() + "/" + this.upload.getFilesToUpload(); - }, - - uploadQueueCompleteCallback: function() { - this.filesUploaded = this.upload.getFilesUploaded(); - $('UploadFiles').innerHTML = "upload"; - statusMessage('Uploaded ' + this.upload.getFilesUploaded() + ' files','good'); - if(this.getParentID() != 'root') { - $('Image').ajaxGetFiles(this.getParentID(), null, this.insertImages.bind(this)); - } - }, - - /** - * Iterates over all uploaded images and add them to TinyMCE editor - * - * @param transport object - */ - insertImages: function(transport) { - //HACK FOR STRANGE ERROR OCCURING UNDER SAFARI - if(transport.responseText == '') { - $('Image').ajaxGetFiles(this.getParentID(), null, this.insertImages.bind(this)); - return; - } - //END OF HACK + pv = getFlashPlayerVersion(); + if(pv.major < 9 || pv.major > 9 || (pv.major == 9 && pv.minor == 0 && pv.rev < 64)) { + if($('AddFolderGroup')) $('AddFolderGroup').style.display = 'none'; + if($('PipeSeparator')) $('PipeSeparator').style.display = 'none'; + if($('UploadGroup')) $('UploadGroup').style.display = 'none'; + return; + } + + if($('FolderID') != null) { + if($('SecurityID')) var securityid=$('SecurityID').value; + else var securityid=null; + this.upload = new Upload( + { + fileTypes : '*.jpeg;*.jpg;*.jpe;*.png;*.gif;', + fileTypesDescription : 'Image files', + fileUploadLimit : '100', + securityID : securityid, + beginUploadOnQueue : true, + buildUI : this.addListeners.bind(this), + fileQueued : this.uploadFileQueuedCallback.bind(this), + fileComplete : this.uploadFileCompleteCallback.bind(this), + queueComplete : this.uploadQueueCompleteCallback.bind(this) + } + ); + } + }, + + uploadFileQueuedCallback: function(file,queueLength) { + this.processInProgress = true; + this.upload.setFolderID(this.getParentID()); + $('UploadFiles').innerHTML = "Uploading ... 1/" + this.upload.getFilesToUpload(); + this.upload.startUpload(); + }, + + uploadFileCompleteCallback: function(file,serverData) { + Element.addClassName($('UploadFiles'),'link');//Safari hack + $('UploadFiles').innerHTML = 'Uploading ... ' + this.upload.getFilesUploaded() + "/" + this.upload.getFilesToUpload(); + }, + + uploadQueueCompleteCallback: function() { + this.filesUploaded = this.upload.getFilesUploaded(); + $('UploadFiles').innerHTML = "upload"; + statusMessage('Uploaded ' + this.upload.getFilesUploaded() + ' files','good'); + if(this.getParentID() != 'root') { + $('Image').ajaxGetFiles(this.getParentID(), null, this.insertImages.bind(this)); + } + }, + + /** + * Iterates over all uploaded images and add them to TinyMCE editor + * + * @param transport object + */ + insertImages: function(transport) { + //HACK FOR STRANGE ERROR OCCURING UNDER SAFARI + if(transport.responseText == '') { + $('Image').ajaxGetFiles(this.getParentID(), null, this.insertImages.bind(this)); + return; + } + //END OF HACK $('Image').reapplyBehaviour();