From 7abb6eccc14f11766d347f6991348d7bcea0d248 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 1 Nov 2012 15:47:50 +0100 Subject: [PATCH 1/7] Added composer.json --- composer.json | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 composer.json diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..bb68921c --- /dev/null +++ b/composer.json @@ -0,0 +1,23 @@ +{ + "name": "silverstripe/cms", + "description": "The SilverStripe Content Management System", + "type": "silverstripe-module", + "keywords": ["silverstripe", "cms"], + "homepage": "http://silverstripe.org/cms", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "SilverStripe", + "homepage": "http://silverstripe.com" + }, + { + "name": "The SilverStripe Community", + "homepage": "http://silverstripe.org" + } + ], + "require": { + "php": ">=5.2.4", + "composer/installers": "*", + "silverstripe/framework": "self.version" + } +} \ No newline at end of file From 65793e2b3835f256719642e49ba8ea6ec4251d99 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 9 Nov 2012 13:01:29 +0100 Subject: [PATCH 2/7] Added travis support --- .travis.yml | 27 +++++++++++++++++++++++++++ tests/travis/before_script | 10 ++++++++++ 2 files changed, 37 insertions(+) create mode 100644 .travis.yml create mode 100755 tests/travis/before_script diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..324f2621 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +language: php +php: + - 5.3 + +env: + - TESTDB=MYSQL + - TESTDB=PGSQL + +before_script: + - ./tests/travis/before_script ~/builds/ss + - cd ~/builds/ss + +script: + - php framework/cli-script.php dev/tests/module/cms + +branches: + except: + - 2.1 + - 2.2 + - 2.3 + - post-2.4 + - translation-staging + +notifications: + irc: + channels: + - "irc.freenode.org#silverstripe" \ No newline at end of file diff --git a/tests/travis/before_script b/tests/travis/before_script new file mode 100755 index 00000000..ac9a6f0c --- /dev/null +++ b/tests/travis/before_script @@ -0,0 +1,10 @@ +BUILD_DIR=$1 +git clone --depth=100 --branch 2.4 --quiet git://github.com/silverstripe/silverstripe-installer.git $BUILD_DIR +git clone --depth=100 --branch 1.2 --quiet git://github.com/silverstripe-labs/silverstripe-sqlite3.git $BUILD_DIR/sqlite3 +git clone --depth=100 --branch 1.0 --quiet git://github.com/silverstripe/silverstripe-postgresql.git $BUILD_DIR/postgresql +git clone --depth=100 --quiet --branch 2.4 git://github.com/silverstripe/sapphire.git $BUILD_DIR/sapphire +cp $BUILD_DIR/sapphire/tests/travis/_ss_environment.php $BUILD_DIR +cp $BUILD_DIR/sapphire/tests/travis/_config.php $BUILD_DIR/mysite +cp -r . $BUILD_DIR/cms + +cd $BUILD_DIR From 3f24b0fc174eadc50341a67792a833c50f5d0d42 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 9 Nov 2012 13:14:28 +0100 Subject: [PATCH 3/7] Added README with build status --- README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..99ac0bec --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# SilverStripe CMS + +[![Build Status](https://secure.travis-ci.org/silverstripe/silverstripe-cms.png?branch=2.4)](https://travis-ci.org/silverstripe/silverstripe-cms) \ No newline at end of file From 6eb597a2d5701d0a7161106ecfd123da8830bcba Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 21 Nov 2012 14:03:04 +0100 Subject: [PATCH 4/7] Fixed travis.yml paths --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 324f2621..000cc5fd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ before_script: - cd ~/builds/ss script: - - php framework/cli-script.php dev/tests/module/cms + - php sapphire/cli-script.php dev/tests/module/cms branches: except: From 75e58c95083ed983d1b12e92ff34f4c11ee98879 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 4 Dec 2012 11:38:32 +0100 Subject: [PATCH 5/7] More graceful handling of missing GET data in ModelAdmin See https://github.com/silverstripe/silverstripe-cms/pull/253 --- code/ModelAdmin.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/ModelAdmin.php b/code/ModelAdmin.php index 59d2f18c..23da2e71 100755 --- a/code/ModelAdmin.php +++ b/code/ModelAdmin.php @@ -696,7 +696,11 @@ class ModelAdmin_CollectionController extends Controller { $summaryFields = $this->columnsAvailable(); - if($selectedOnly && isset($searchCriteria['ResultAssembly'])) { + if( + $selectedOnly + && isset($searchCriteria['ResultAssembly']) + && !empty($searchCriteria['ResultAssembly']) + ) { $resultAssembly = $searchCriteria['ResultAssembly']; if(!is_array($resultAssembly)) { $explodedAssembly = split(' *, *', $resultAssembly); From 41aec54e88c2838a862453ad27acbbce075cc3e2 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 21 Nov 2012 13:33:47 +0100 Subject: [PATCH 6/7] BUG Consistently use FormResponse in CMS JavaScript (fixes #8036) Regression caused by a security fix in 9bf3ae9a190 --- code/AssetAdmin.php | 7 +++++-- code/CommentAdmin.php | 23 ++++++++++++++++++----- code/LeftAndMain.php | 12 +++++++----- javascript/AssetAdmin.js | 2 -- javascript/CMSMain_left.js | 3 --- javascript/CMSMain_right.js | 1 - javascript/LeftAndMain.js | 7 ------- javascript/LeftAndMain_left.js | 3 --- javascript/LeftAndMain_right.js | 4 +--- javascript/PageCommentInterface.js | 3 +-- javascript/SecurityAdmin_left.js | 3 --- javascript/TranslationTab.js | 5 +---- 12 files changed, 33 insertions(+), 40 deletions(-) diff --git a/code/AssetAdmin.php b/code/AssetAdmin.php index bd5064c9..64e4e88c 100755 --- a/code/AssetAdmin.php +++ b/code/AssetAdmin.php @@ -654,7 +654,8 @@ JS; $script .= "statusMessage('$message');"; - return $script; + FormResponse::add($script); + return FormResponse::respond(); } public function removefile($request){ @@ -671,10 +672,12 @@ JS; $file->destroy(); if(Director::is_ajax()) { - echo <<ParentID; $title = Convert::raw2js($page->TreeTitle()); - $response = <<ID, "$title", "$page->class"); var parentNode = $('sitetree').getTreeNodeByIdx($parentID); if(parentNode) parentNode.appendTreeNode(newNode); JS; - $response .= ($select ? "newNode.selectTreeNode();\n" : "") ; - return $response; + $js .= ($select ? "newNode.selectTreeNode();\n" : "") ; + FormResponse::add($js); + return FormResponse::respond(); } /** * Returns a javascript snippet to remove a tree node for the given page, if it exists. @@ -846,7 +847,7 @@ JS; */ public function deleteTreeNodeJS($page) { $id = $page->ID ? $page->ID : $page->OldID; - $response = <<setCurrentPageID(null); } - return $response; + FormResponse::add($js); + return FormResponse::respond(); } /** diff --git a/javascript/AssetAdmin.js b/javascript/AssetAdmin.js index f83f1b4d..89c65787 100755 --- a/javascript/AssetAdmin.js +++ b/javascript/AssetAdmin.js @@ -321,7 +321,6 @@ addfolder.prototype = { return false; }, onSuccess: function(response) { - Ajax.Evaluator(response); // Make it possible to drop files into the new folder DropFileItem.applyTo('#sitetree li'); }, @@ -456,7 +455,6 @@ var deletefolder = { }, submit_success: function(response) { - Ajax.Evaluator(response); treeactions.closeSelection($('deletepage')); } }; diff --git a/javascript/CMSMain_left.js b/javascript/CMSMain_left.js index 5c398660..aa5bb234 100755 --- a/javascript/CMSMain_left.js +++ b/javascript/CMSMain_left.js @@ -131,7 +131,6 @@ addpageclass.prototype = { var suffix = _NEW_PAGES[parentID]++; Ajax.SubmitForm(_HANDLER_FORMS.addpage, "action_addpage", { - onSuccess : Ajax.Evaluator, onFailure : function(response) { if (response.status == 403) { alert('You cannot add that page at that location.'); }}, @@ -592,7 +591,6 @@ publishpage.prototype = { // Submit form Ajax.SubmitForm(this, null, { onSuccess : function(response) { - Ajax.Evaluator(response); $('batchactions_go').className = ''; batchActionGlobals.deselectAll(); }, @@ -639,7 +637,6 @@ deletepage.prototype = { $('Form_DeleteItemsForm_action_deleteitems').className = 'loading'; Ajax.SubmitForm(this, null, { onSuccess : function(response) { - Ajax.Evaluator(response); $('Form_DeleteItemsForm_action_deleteitems').className = ''; treeactions.closeSelection($('batchactions')); }, diff --git a/javascript/CMSMain_right.js b/javascript/CMSMain_right.js index 236c7b9a..4aedbc2f 100755 --- a/javascript/CMSMain_right.js +++ b/javascript/CMSMain_right.js @@ -8,7 +8,6 @@ function action_revert_right() { $('Form_EditForm_action_revert').value = ss.i18n._t('CMSMAIN.RESTORING'); $('Form_EditForm_action_revert').className = 'action loading'; Ajax.SubmitForm('Form_EditForm', 'action_revert', { - onSuccess : Ajax.Evaluator, onFailure : function(response) { errorMessage(ss.i18n._t('CMSMAIN.ERRORREVERTING'), response); } diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index 778c63b4..b2f0b0e2 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -302,7 +302,6 @@ function prepareAjaxActions(actions, formName, tabName) { } else { statusMessage('...'); Ajax.SubmitForm(this.ownerForm, this.name, { - onSuccess: Ajax.Evaluator, onFailure: ajaxErrorHandler }); } @@ -333,7 +332,6 @@ function ajaxSubmitForm(automated, callAfter, form, action, verb) { statusMessage(verb + '...', '', true); var success = function(response) { - Ajax.Evaluator(response); if(callAfter) callAfter(); } @@ -364,10 +362,6 @@ function ajaxSubmitFieldSet(href, fieldSet, extraData) { // Send request new Ajax.Request(href, { method : 'post', postBody : data, - onSuccess : function(response) { - //alert(response.responseText); - Ajax.Evaluator(response); - }, onFailure : function(response) { alert(response.responseText); //errorMessage('Error: ', response); @@ -382,7 +376,6 @@ function ajaxLink(href) { // Send request new Ajax.Request(href + (href.indexOf("?") == -1 ? "?" : "&") + "ajax=1", { method : 'get', - onSuccess : Ajax.Evaluator, onFailure : ajaxErrorHandler }); } diff --git a/javascript/LeftAndMain_left.js b/javascript/LeftAndMain_left.js index ab278c2b..7e8c4452 100755 --- a/javascript/LeftAndMain_left.js +++ b/javascript/LeftAndMain_left.js @@ -286,7 +286,6 @@ TreeNodeAPI.prototype = { new Ajax.Request(url, { method : 'get', - onSuccess : Ajax.Evaluator, onFailure : function(response) { errorMessage('Error: ', response); } @@ -297,7 +296,6 @@ TreeNodeAPI.prototype = { var url = baseHref() + 'admin/duplicatewithchildren/' + this.getIdx() + '?ajax=1&SecurityID=' + token; new Ajax.Request(url, { method : 'get', - onSuccess : Ajax.Evaluator, onFailure : function(response) { errorMessage('Error: ', response); } @@ -431,7 +429,6 @@ SiteTreeNode.prototype = { new Ajax.Request(SiteTreeHandlers.parentChanged_url, { method : 'post', postBody : 'ID=' + node.getIdx() + '&ParentID=' + newParent.getIdx() + '&CurrentlyOpenPageID=' + currentlyOpenPageID + '&SecurityID=' + token, - onSuccess : Ajax.Evaluator, onFailure : function(response) { errorMessage('error saving parent', response); } diff --git a/javascript/LeftAndMain_right.js b/javascript/LeftAndMain_right.js index 69324397..c9faf9a2 100755 --- a/javascript/LeftAndMain_right.js +++ b/javascript/LeftAndMain_right.js @@ -103,7 +103,7 @@ CMSForm.prototype = { } if(response && evalResponse) { - Ajax.Evaluator(response); + // no-op, has already been evaluated by prototype.js } else { this.innerHTML = rightHTML; } @@ -178,8 +178,6 @@ CMSForm.prototype = { } var success = function(response) { - Ajax.Evaluator(response); - __form.resetElements(); if(__callAfter) __callAfter(); if(__form.notify && __form.elements.ID != undefined) __form.notify('PageSaved', __form.elements.ID.value); diff --git a/javascript/PageCommentInterface.js b/javascript/PageCommentInterface.js index 534c8b34..cfe48b00 100755 --- a/javascript/PageCommentInterface.js +++ b/javascript/PageCommentInterface.js @@ -66,8 +66,7 @@ PageCommentInterface.prototype = { //need to check if there is actually a spam question to change first if(form.elements.Math){ new Ajax.Request(document.getElementsByTagName('base')[0].href+'PageCommentInterface_Controller/newspamquestion', { - onSuccess: loadSpamQuestion, - onFailure: Ajax.Evaluator + onSuccess: loadSpamQuestion }); } diff --git a/javascript/SecurityAdmin_left.js b/javascript/SecurityAdmin_left.js index 3655b397..7efb5ed8 100755 --- a/javascript/SecurityAdmin_left.js +++ b/javascript/SecurityAdmin_left.js @@ -25,7 +25,6 @@ var addgroup = { var st = $('sitetree'); $('addgroup_options').elements.ParentID.value = st.firstSelected() ? st.getIdxOf(st.firstSelected()) : 0; Ajax.SubmitForm('addgroup_options', null, { - onSuccess : Ajax.Evaluator, onFailure : function(response) { errorMessage('Error adding page', response); } @@ -113,8 +112,6 @@ var deletegroup = { Ajax.SubmitForm('deletegroup_options', null, { onSuccess : function(response) { - Ajax.Evaluator(response); - var sel; if((sel = $('sitetree').firstSelected()) && sel.parentNode) sel.addNodeClass('current'); else $('Form_EditForm').innerHTML = ""; diff --git a/javascript/TranslationTab.js b/javascript/TranslationTab.js index a1aecfdb..61f14dd8 100755 --- a/javascript/TranslationTab.js +++ b/javascript/TranslationTab.js @@ -11,10 +11,7 @@ Behaviour.register({ url += "&locale=" + $('Form_EditForm_Locale').value; url += "&SecurityID=" + $$('input[name=SecurityID]')[0].value; - new Ajax.Request( url, { - onSuccess: Ajax.Evaluator, - onFailure: Ajax.Evaluator - }); + new Ajax.Request(url); return false; } From 4c525fe801838255212c98ac8976eb310319471a Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 4 Dec 2012 23:01:41 +0100 Subject: [PATCH 7/7] Fixed composer.json dependencies --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bb68921c..12e1d781 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,6 @@ "require": { "php": ">=5.2.4", "composer/installers": "*", - "silverstripe/framework": "self.version" + "silverstripe/framework": "2.4.*" } } \ No newline at end of file