From 2a309755d930aed39ec4476853941d74dc2ceca0 Mon Sep 17 00:00:00 2001 From: Will Rossiter Date: Mon, 17 Nov 2008 23:07:46 +0000 Subject: [PATCH] Merged pre-2.3-oct08 into branches/2.3 (via trunk) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.3@66086 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/ModelAdmin.php | 7 +- code/staticpublisher/FilesystemPublisher.php | 16 +++- css/TinyMCEImageEnhancement.css | 10 +-- javascript/ModelAdmin.js | 79 +++++++++++++++++++- javascript/tinymce.template.js | 2 +- 5 files changed, 101 insertions(+), 13 deletions(-) diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index 3f6b79fa..2ba3bd3f 100644 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -581,7 +581,10 @@ class ModelAdmin_CollectionController extends Controller { new HeaderField('SearchResultsHeader',_t('ModelAdmin.SEARCHRESULTS','Search Results'), 2), $tf ), - new FieldSet() + new FieldSet( + new FormAction("goBack", _t('ModelAdmin.GOFORWARD', "Back")), + new FormAction("goForward", _t('ModelAdmin.GOFORWARD', "Forward")) + ) ); // Include the search criteria on the results form URL, but not dodgy variables like those below @@ -589,6 +592,8 @@ class ModelAdmin_CollectionController extends Controller { unset($filteredCriteria['ctf']); unset($filteredCriteria['url']); unset($filteredCriteria['action_search']); + if(isset($filteredCriteria['Investors__PEFirm__IsPECMember']) && !$filteredCriteria['Investors__PEFirm__IsPECMember']) unset($filteredCriteria['Investors__PEFirm__IsPECMember']); + $form->setFormAction($this->Link() . '/ResultsForm?' . http_build_query($filteredCriteria)); return $form; } diff --git a/code/staticpublisher/FilesystemPublisher.php b/code/staticpublisher/FilesystemPublisher.php index 2a70f67d..a996a7cf 100644 --- a/code/staticpublisher/FilesystemPublisher.php +++ b/code/staticpublisher/FilesystemPublisher.php @@ -7,6 +7,16 @@ class FilesystemPublisher extends StaticPublisher { protected $destFolder; protected $fileExtension; + protected static $static_base_url = null; + + /** + * Set a different base URL for the static copy of the site. + * This can be useful if you are running the CMS on a different domain from the website. + */ + static function set_static_base_url($url) { + self::$static_base_url = $url; + } + /** * @param $destFolder The folder to save the cached site into * @param $fileExtension The file extension to use, for example, 'html'. If omitted, then each page will be placed @@ -24,7 +34,8 @@ class FilesystemPublisher extends StaticPublisher { //$base = Director::absoluteURL($this->destFolder); //$base = preg_replace('/\/[^\/]+\/\.\./','',$base) . '/'; - //Director::setBaseURL($base); + + if(self::$static_base_url) Director::setBaseURL(self::$static_base_url); $files = array(); $i = 0; @@ -83,7 +94,8 @@ class FilesystemPublisher extends StaticPublisher { } }*/ } - Director::setBaseURL(null); + + if(self::$static_base_url) Director::setBaseURL(null); //Debug::show(array_keys($files)); //Debug::show(array_keys($missingFiles)); diff --git a/css/TinyMCEImageEnhancement.css b/css/TinyMCEImageEnhancement.css index bb8a47dc..18acead9 100644 --- a/css/TinyMCEImageEnhancement.css +++ b/css/TinyMCEImageEnhancement.css @@ -1,20 +1,20 @@ -.group { +.contentPanel .group { display: inline; margin-left: 2px; } -.middleColumn { +.contentPanel .middleColumn { margin-bottom: 2px; } -.link { +.contentPanel .link { text-decoration: none; margin-left: 2px; } -.tree_holder { +.contentPanel .tree_holder { display: inline; } -#NewFolderName { +.contentPanel #NewFolderName { width: 120px; margin-top: 0; } diff --git a/javascript/ModelAdmin.js b/javascript/ModelAdmin.js index 425f9283..688fd72b 100644 --- a/javascript/ModelAdmin.js +++ b/javascript/ModelAdmin.js @@ -85,8 +85,16 @@ $(document).ready(function() { */ $('#SearchForm_holder .tab form:not(#Form_ImportForm)').submit(function () { var $form = $(this); + + $('#ModelAdminPanel').fn('startHistory', $(this).attr('action'), $(this).formToArray()); $('#ModelAdminPanel').load($(this).attr('action'), $(this).formToArray(), standardStatusHandler(function(result) { - __lastSearch = $form; + if(!this.future || !this.future.length) { + $('#Form_EditForm_action_goForward, #Form_ResultsForm_action_goForward').hide(); + } + if(!this.history || this.history.length <= 1) { + $('#Form_EditForm_action_goBack, #Form_ResultsForm_action_goBack').hide(); + } + $('#form_actions_right').remove(); Behaviour.apply(); // Remove the loading indicators from the buttons @@ -136,10 +144,11 @@ $(document).ready(function() { * Table record handler for search result record * @todo: Shouldn't this be part of TableListField? */ - $('#right #Form_ResultsForm tbody td a') + $('#right #Form_ResultsForm tbody td a:not(.deletelink)') .livequery('click', function(){ $(this).parent().parent().addClass('loading'); var el = $(this); + $('#ModelAdminPanel').fn('addHistory', el.attr('href')); $('#ModelAdminPanel').fn('loadForm', el.attr('href')); return false; }); @@ -161,8 +170,16 @@ $(document).ready(function() { /** * RHS panel Back button */ - $('#Form_EditForm_action_goBack').livequery('click', function() { - if(__lastSearch) __lastSearch.trigger('submit'); + $('#Form_EditForm_action_goBack, #Form_ResultsForm_action_goBack').livequery('click', function() { + $('#ModelAdminPanel').fn('goBack'); + return false; + }); + + /** + * RHS panel Back button + */ + $('#Form_ResultsForm_action_goForward').livequery('click', function() { + $('#ModelAdminPanel').fn('goForward'); return false; }); @@ -257,9 +274,63 @@ $(document).ready(function() { loadForm: function(url, successCallback) { $('#right #ModelAdminPanel').load(url, standardStatusHandler(function(result) { if(typeof(successCallback) == 'function') successCallback.apply(); + if(!this.future || !this.future.length) { + $('#Form_EditForm_action_goForward, #Form_ResultsForm_action_goForward').hide(); + } + if(!this.history || this.history.length <= 1) { + $('#Form_EditForm_action_goBack, #Form_ResultsForm_action_goBack').hide(); + } + Behaviour.apply(); // refreshes ComplexTableField })); + }, + + startHistory: function(url, data) { + this.history = []; + $(this).fn('addHistory', url, data); + }, + + /** + * Add an item to the history, to be accessed by goBack and goForward + */ + addHistory: function(url, data) { + // Combine data into URL + if(data) { + if(url.indexOf('?') == -1) url += '?' + $.param(data); + else url += '&' + $.param(data); + } + + // Add to history + if(this.history == null) this.history = []; + this.history.push(url); + + // Reset future + this.future = []; + }, + + goBack: function() { + if(this.history && this.history.length) { + if(this.future == null) this.future = []; + + var currentPage = this.history.pop(); + var previousPage = this.history[this.history.length-1]; + + this.future.push(currentPage); + $(this).fn('loadForm', previousPage); + } + }, + + goForward: function() { + if(this.future && this.future.length) { + if(this.future == null) this.future = []; + + var nextPage = this.future.pop(); + + this.history.push(nextPage); + $(this).fn('loadForm', nextPage); + } } + }); /** diff --git a/javascript/tinymce.template.js b/javascript/tinymce.template.js index 3fb53c91..eee141c7 100755 --- a/javascript/tinymce.template.js +++ b/javascript/tinymce.template.js @@ -40,7 +40,7 @@ if((typeof tinyMCE != 'undefined')) { safari_warning : false, relative_urls : true, verify_html : true, - valid_elements : "+a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],-td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align],-span[class|align],-pre[class|align],address[class|align],-h1[id|dir|class|align],-h2[id|dir|class|align],-h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|dir|class|align],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir]", + valid_elements : "+a[id|rel|rev|dir|tabindex|accesskey|type|name|href|target|title|class],-strong/-b[class],-em/-i[class],-strike[class],-u[class],#p[id|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|longdesc|usemap|class|src|border|alt=|title|width|height|align],-sub[class],-sup[class],-blockquote[dir|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|dir|id|style],-tr[id|dir|class|rowspan|width|height|align|valign|bgcolor|background|bordercolor|style],tbody[id|class|style],thead[id|class|style],tfoot[id|class|style],-td[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],-th[id|dir|class|colspan|rowspan|width|height|align|valign|scope|style],caption[id|dir|class],-div[id|dir|class|align],-span[class|align],-pre[class|align],address[class|align],-h1[id|dir|class|align],-h2[id|dir|class|align],-h3[id|dir|class|align],-h4[id|dir|class|align],-h5[id|dir|class|align],-h6[id|dir|class|align],hr[class],dd[id|class|title|dir],dl[id|class|title|dir],dt[id|class|title|dir],iframe[align