diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index 976d0712..50e9da9a 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -64,7 +64,6 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr 'cmsmain.js', array_merge( array( - // CMS_DIR . '/javascript/ThumbnailStripField.js', CMS_DIR . '/javascript/CMSMain.js', CMS_DIR . '/javascript/CMSMain.EditForm.js', CMS_DIR . '/javascript/CMSMain.AddForm.js', diff --git a/code/forms/ThumbnailStripField.php b/code/forms/ThumbnailStripField.php deleted file mode 100644 index 1b5b4b42..00000000 --- a/code/forms/ThumbnailStripField.php +++ /dev/null @@ -1,194 +0,0 @@ -parentField = $parentField; - $this->updateMethod = $updateMethod; - - parent::__construct($name); - } - - function ParentField() { - return $this->form->FormName() . '_' . $this->parentField; - } - - function FieldHolder() { - Requirements::javascript(THIRDPARTY_DIR . '/prototype/prototype.js'); - Requirements::javascript(THIRDPARTY_DIR . '/behaviour/behaviour.js'); - Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js'); - Requirements::javascript(CMS_DIR . '/javascript/ThumbnailStripField.js'); - return $this->renderWith('ThumbnailStripField'); - } - - function UpdateMethod() { - return $this->updateMethod; - } - - /** - * Populate the Thumbnail strip field, by looking for a folder, - * and the descendants of this folder. - * - * @see ThumbnailStripField::use_legacy_image_search - */ - function getimages() { - $result = ''; - $images = null; - $whereSQL = ''; - $folderID = isset($_GET['folderID']) ? (int) $_GET['folderID'] : 0; - $searchText = (isset($_GET['searchText']) && $_GET['searchText'] != 'undefined' && $_GET['searchText'] != 'null') ? Convert::raw2sql($_GET['searchText']) : ''; - - $folder = DataObject::get_by_id('Folder', (int) $_GET['folderID']); - - if($folder) { - $folderList = $folder->getDescendantIDList(); - array_unshift($folderList, $folder->ID); - - $whereSQL = '"ParentID" IN (' . implode(', ', $folderList) . ')'; - if($searchText) $whereSQL .= " AND \"Filename\" LIKE '%$searchText%'"; - $images = DataObject::get('Image', $whereSQL, 'Title'); - - } else { - if (!self::$use_legacy_image_search) { - $whereSQL = "\"ParentID\" = 0"; - } else { - $whereSQL = ''; - - // Prevent image search queries all images in the site initially when the page is loaded - if(empty($searchText)) $whereSQL = "\"ParentID\" = 0"; - } - - if($searchText) { - if (!empty($whereSQL)) $whereSQL .= " AND"; - $whereSQL .= " \"Filename\" LIKE '%$searchText%'"; - } - - $images = DataObject::get('Image', $whereSQL, 'Title'); - } - - if($images) { - $result .= ''; - } - else { - if($folder) { - $result = '

' . _t('ThumbnailStripField.NOFOLDERIMAGESFOUND', 'No images found in') . ' ' . $folder->Title . '

'; - } else { - $result = '

' . _t('ThumbnailStripField.NOIMAGESFOUND', 'No images found') . '

'; - } - } - - return $result; - } - - function getflash() { - $flashObjects = null; - $result = ''; - $whereSQL = ''; - $folderID = isset($_GET['folderID']) ? (int) $_GET['folderID'] : 0; - $searchText = (isset($_GET['searchText']) && $_GET['searchText'] != 'undefined' && $_GET['searchText'] != 'null') ? Convert::raw2sql($_GET['searchText']) : ''; - - $width = Image::$strip_thumbnail_width - 10; - $height = Image::$strip_thumbnail_height - 10; - - $folder = DataObject::get_by_id("Folder", (int) $_GET['folderID']); - - if($folder) { - $folderList = $folder->getDescendantIDList(); - array_unshift($folderList, $folder->ID); - - $whereSQL = "\"ParentID\" IN (" . implode(', ', $folderList) . ") AND \"Filename\" LIKE '%.swf'"; - if($searchText) $whereSQL .= " AND \"Filename\" LIKE '%$searchText%'"; - - $flashObjects = DataObject::get('File', $whereSQL); - } else { - if($searchText) { - $flashObjects = DataObject::get('File', "\"Filename\" LIKE '%$searchText%' AND \"Filename\" LIKE '%.swf'"); - } - } - - if($flashObjects) { - $result .= ''; - } else { - if($folder) { - $result = '

' . _t('ThumbnailStripField.NOFOLDERFLASHFOUND', 'No flash files found in') . ' ' . $folder->Title . '

'; - } else { - $result = '

' . _t('ThumbnailStripField.NOFLASHFOUND', 'No flash files found') . '

'; - } - } - - return $result; - } -} - diff --git a/javascript/ThumbnailStripField.js b/javascript/ThumbnailStripField.js deleted file mode 100644 index e08b4ee8..00000000 --- a/javascript/ThumbnailStripField.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * File: ThumbnailStripField.js - */ - -/** - * Class: ThumbnailStripField - */ -ThumbnailStripField = Class.create(); -// We do this instead of div.thumbnailstrip for efficiency. It means that ThumbnailStripField can only be used in the -// CMS toolbar -ThumbnailStripField.applyTo('#FolderImages'); -ThumbnailStripField.applyTo('#Flash'); -ThumbnailStripField.prototype = { - - /** - * @var updateMethod string Specifies the Ajax-call for getting files - * (currently either "getimages" or "getflash"). This can be specified - * in the PHP-constructor of ThumbnailStripField and is passed to the client - * as a fake css-class. - */ - updateMethod: 'getimages', - - initialize: function() { - var self = this; - - try { - this.updateMethod = this.className.match(/updatemethod=([^ ]+)/)[1]; - } catch(err) {} - - if(this.className.match(/parent=([^ ]+)/)) { - // HACK: This is hard-coded to only work with TreeDropdownFields - var inputField = $(RegExp.$1), parentField = inputField.parentNode; - if(parentField) jQuery(parentField).bind('change', function() { - self.ajaxGetFiles(jQuery(inputField).val()); - }); - - var searchField = $$('#' + this.updateMethod + 'Search input')[0]; - var timeout = undefined; - - if(searchField) { - Event.observe(searchField, 'keypress', function(event) { - if(timeout != undefined) clearTimeout(timeout); - - timeout = setTimeout(function() { - var searchText = searchField.value; - var folderID = null; - if (parentField && parentField.inputTag) - folderID = parentField.inputTag.value - $('Flash').ajaxGetFiles(folderID, searchText); - $('FolderImages').ajaxGetFiles(folderID, searchText); - }, 500); - }); - } - } - }, - - ajaxGetFiles: function(folderID, searchText, callback) { - if(!callback) callback = this.reapplyBehaviour.bind(this); - var securityID = ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''); - this.innerHTML = '

Loading...

'; - var ajaxURL = this.helperURLBase() + '&methodName=' + this.updateMethod + '&folderID=' + folderID + '&searchText=' + searchText + securityID + '&cacheKillerDate=' + parseInt((new Date()).getTime()) + '&cacheKillerRand=' + parseInt(10000 * Math.random()); - - jQuery(this).load(ajaxURL, callback); - }, - - reapplyBehaviour: function() { - Behaviour.apply(this); - }, - - helperURLBase: function() { - var fieldName = this.id; - var ownerForm = this.ownerForm(); - var securityID = ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : ''); - - return ownerForm.action + '?action_callfieldmethod=1&fieldName=' + fieldName + '&ajax=1' + securityID; - }, - - ownerForm: function() { - var f =this.parentNode; - while(f && f.tagName.toLowerCase() != 'form') f = f.parentNode; - return f; - } - -} diff --git a/templates/ThumbnailStripField.ss b/templates/ThumbnailStripField.ss deleted file mode 100644 index 9af29958..00000000 --- a/templates/ThumbnailStripField.ss +++ /dev/null @@ -1,3 +0,0 @@ -
-

<% _t('CHOOSEFOLDER','(Choose a folder or search above)') %>

-
\ No newline at end of file