From b3e40dd0c3bc63c98f0027970c43d7d6da1480e7 Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Tue, 19 Feb 2013 11:38:40 -0400 Subject: [PATCH 1/7] Fixed issue with cms help toggles not functioning correctly --- admin/javascript/LeftAndMain.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index 41f1960bd..e753bf8d7 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -841,16 +841,26 @@ jQuery.noConflict(); * in the href attribute (which doubles as an anchor link to that element). */ $('.cms .cms-help-toggle').entwine({ + ToggleElement: null, onmatch: function() { this._super(); - $(this.attr('href')).hide(); + var id=this.attr('href'); + if(id.indexOf('#')!=0) { + id=id.split('#'); + id='#'+id[1]; + } + + var element = jQuery(id); + $(this).setToggleElement(element); + element.hide(); }, onunmatch: function() { this._super(); + $(this).setToggleElement(null); }, onclick: function(e) { - $(this.attr('href')).toggle(); + $(this).getToggleElement().toggle(); e.preventDefault(); } }); From e954c8c1d11092008fb362b2660a2ebe044e21f1 Mon Sep 17 00:00:00 2001 From: UndefinedOffset Date: Tue, 19 Feb 2013 12:10:19 -0400 Subject: [PATCH 2/7] No longer caching the target element to be toggled --- admin/javascript/LeftAndMain.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/admin/javascript/LeftAndMain.js b/admin/javascript/LeftAndMain.js index e753bf8d7..709443ac1 100644 --- a/admin/javascript/LeftAndMain.js +++ b/admin/javascript/LeftAndMain.js @@ -841,7 +841,6 @@ jQuery.noConflict(); * in the href attribute (which doubles as an anchor link to that element). */ $('.cms .cms-help-toggle').entwine({ - ToggleElement: null, onmatch: function() { this._super(); @@ -851,16 +850,19 @@ jQuery.noConflict(); id='#'+id[1]; } - var element = jQuery(id); - $(this).setToggleElement(element); - element.hide(); + jQuery(id).hide(); }, onunmatch: function() { this._super(); - $(this).setToggleElement(null); }, onclick: function(e) { - $(this).getToggleElement().toggle(); + var id=this.attr('href'); + if(id.indexOf('#')!=0) { + id=id.split('#'); + id='#'+id[1]; + } + + jQuery(id).toggle(); e.preventDefault(); } }); From a772eb15284067747b0b50561e91a3ed2ea4a173 Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Tue, 12 Mar 2013 23:00:41 +1300 Subject: [PATCH 3/7] Update coding conventions to match SilverStripe practices --- docs/en/misc/coding-conventions.md | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/en/misc/coding-conventions.md b/docs/en/misc/coding-conventions.md index 666e69473..0624d8118 100644 --- a/docs/en/misc/coding-conventions.md +++ b/docs/en/misc/coding-conventions.md @@ -17,10 +17,11 @@ Always use hard tabs rather then spaces for indentation, with one tab per nestin ### Maximum Line Length -The target line length is 100 characters, meaning developers should strive keep each line of their code -under 80 characters where possible and practical. +The target line length is 100 columns with tabs being treated as four columns, +meaning developers should strive keep each line of their code +under 80 columns where possible and practical. However, longer lines are acceptable in some circumstances. -The maximum length of any line of PHP code is 120 characters. +The maximum length of any line of PHP code is 120 columns. ### Line Termination @@ -40,8 +41,9 @@ Class and filenames are in `UpperCamelCase` format: :::php class MyClass {} -If a class name is comprised of more than one word, the first letter of each new word must be capitalized. -Successive capitalized letters are not allowed, e.g. a class `XMLImporter` is not allowed while `XmlImporter` is acceptable. +If a class name is comprised of more than one word, the first letter of each +new word must be capitalized. Successive capitalized letters are used in +acronyms, e.g. a class `XMLImporter` is used while `XmlImporter` is not. ### Methods @@ -128,6 +130,9 @@ PHP code must always be delimited by the full-form, standard PHP tags: Short tags are never allowed. For files containing only PHP code, the closing tag must always be omitted. It is not required by PHP, and omitting it prevents the accidental injection of trailing white space into the response. +Files must end with an empty new line. This prevents problems arising from the end-of-file marker appearing where other +white space is expected. + ### Strings #### String Literals From 0cc2aeb827f39ce928df9028ff672d2539888c39 Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Tue, 12 Mar 2013 23:16:22 +1300 Subject: [PATCH 4/7] Update examples to match conventions --- docs/en/misc/coding-conventions.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/en/misc/coding-conventions.md b/docs/en/misc/coding-conventions.md index 0624d8118..068d779e2 100644 --- a/docs/en/misc/coding-conventions.md +++ b/docs/en/misc/coding-conventions.md @@ -91,6 +91,8 @@ All letters used in a constant name must be capitalized, while all words in a constant name must be separated by underscore characters. :::php + const INTEREST_RATE = 0.19; + define('INTEREST_RATE', 0.19); Constants must be defined as class members with the `const` modifier. @@ -286,7 +288,7 @@ The opening brace and closing brace are written on the same line as the conditio Any content within the braces must be indented using a tab. :::php - if ($a != 2) { + if($a != 2) { $a = 2; } @@ -297,7 +299,7 @@ The closing paren in the conditional will then be placed on a line with the open with one space separating the two, at an indentation level equivalent to the opening control statement. :::php - if (($a == $b) + if(($a == $b) && ($b == $c) || (Foo::CONST == $d) ) { @@ -310,9 +312,9 @@ the formatting conventions are similar to the `if` construct. The following examples demonstrate proper formatting for `if` statements with `else` and/or `elseif` constructs: :::php - if ($a != 2) { + if($a != 2) { $a = 2; - } elseif ($a == 3) { + } elseif($a == 3) { $a = 4; } else { $a = 7; From 97df009a4148317a24ec0d236ddcbf1bbcb33c2c Mon Sep 17 00:00:00 2001 From: Simon Welsh Date: Tue, 12 Mar 2013 23:17:15 +1300 Subject: [PATCH 5/7] Correct spelling --- docs/en/misc/coding-conventions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/en/misc/coding-conventions.md b/docs/en/misc/coding-conventions.md index 068d779e2..7f70da430 100644 --- a/docs/en/misc/coding-conventions.md +++ b/docs/en/misc/coding-conventions.md @@ -282,7 +282,7 @@ apart from the last argument. #### if/else/elseif No control structure is allowed to have spaces directly -before or after the opening parathesis, as well as no space before the closing parenthesis. +before or after the opening parenthesis, as well as no space before the closing parenthesis. The opening brace and closing brace are written on the same line as the conditional statement. Any content within the braces must be indented using a tab. From 72d5f3cf17ba5964ef4c491862bd732aba4c7d20 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 20 Mar 2013 11:37:20 +0100 Subject: [PATCH 6/7] Composer contribution fork/upstream docs (fixes #8332) --- docs/en/installation/composer.md | 9 +++++++-- docs/en/misc/contributing/code.md | 29 ++++++++++++++++++++++------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/docs/en/installation/composer.md b/docs/en/installation/composer.md index 7e078e0d3..d98603acd 100644 --- a/docs/en/installation/composer.md +++ b/docs/en/installation/composer.md @@ -203,7 +203,7 @@ This is how you do it: "repositories": [ { "type": "vcs", - "url": "git@github.com:sminnee/advancedworkflow.git" + "url": "git@github.com:sminnee/silverstripe-cms.git" } ], ... @@ -211,10 +211,15 @@ This is how you do it: * **Install the module as you would normally.** Use the regular composer function - there are no special flags to use a fork. Your fork will be used in place of the package version. - composer require silverstripe/advancedworkflow + composer require silverstripe/cms Composer will scan all of the repositories you list, collect meta-data about the packages within them, and use them in favour of the packages listed on packagist. To switch back to using the mainline version of the package, just remove your the `repositories` section from `composer.json` and run `composer update`. +Now add an "upstream" remote to the original repository location so you can rebase or merge your fork as required. + + cd advancedworkflow + git remote add -f upstream git://github.com/silverstripe/silverstripe-cms.git + For more information, read the ["Repositories" chapter of the Composer documentation](http://getcomposer.org/doc/05-repositories.md). ### Forks and branch names diff --git a/docs/en/misc/contributing/code.md b/docs/en/misc/contributing/code.md index 677f1e5a4..0a57d17b7 100644 --- a/docs/en/misc/contributing/code.md +++ b/docs/en/misc/contributing/code.md @@ -16,32 +16,47 @@ We ask for this so that the ownership in the license is clear and unambiguous, a ## Step-by-step: From forking to sending the pull request -1. Follow the [Installation through Composer](../../installation/composer#contributing) instructions, -which explain how to fork the core modules and add the correct "upstream" remote. In short: +1. Install the project through composer. The process is described in detail in "[Installation through Composer](../../installation/composer#contributing)". composer create-project --keep-vcs --dev silverstripe/installer ./my/website/folder 3.0.x-dev -2. [Branch for new issue and develop on issue branch](code#branch-for-new-issue-and-develop-on-issue-branch) +2. Edit the `composer.json`. Remove the `@stable` markers from the core modules in there. + Add your fork URLs, in this example a fork of the `cms` module on the `sminnee` github account + (replace with your own fork URL). Run a `composer update` afterwards. + + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:sminnee/silverstripe-cms.git" + } + ] + +3. Add a new "upstream" remote so you can track the original repository for changes, and rebase/merge your fork as required. + + cd cms + git remote add -f upstream git://github.com/silverstripe/silverstripe-cms.git + +4. [Branch for new issue and develop on issue branch](code#branch-for-new-issue-and-develop-on-issue-branch) git branch ###-description git checkout ###-description -3. As time passes, the upstream repository accumulates new commits. Keep your working copy's master branch and issue branch up to date by periodically [rebasing your development branch on the latest upstream](code#rebase-your-development-branch-on-the-latest-upstream). +5. As time passes, the upstream repository accumulates new commits. Keep your working copy's master branch and issue branch up to date by periodically [rebasing your development branch on the latest upstream](code#rebase-your-development-branch-on-the-latest-upstream). # [make sure all your changes are committed as necessary in branch] git fetch upstream git rebase upstream/master -4. When development is complete, [squash all commit related to a single issue into a single commit](code#squash-all-commits-related-to-a-single-issue-into-a-single-commit). +6. When development is complete, [squash all commit related to a single issue into a single commit](code#squash-all-commits-related-to-a-single-issue-into-a-single-commit). git fetch upstream git rebase -i upstream/master -5. Push release candidate branch to GitHub +7. Push release candidate branch to GitHub git push origin ###-description -6. Issue pull request on GitHub. Visit your forked respoistory on GitHub.com and click the "Create Pull Request" button nex tot the new branch. +8. Issue pull request on GitHub. Visit your forked respoistory on GitHub.com and click the "Create Pull Request" button nex tot the new branch. The core team is then responsible for reviewing patches and deciding if they will make it into core. If there are any problems they will follow up with you, so please ensure they have a way to contact you! From 2787d360c18e1d6c64c89ba1c237b0fd9ed06774 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 20 Mar 2013 17:58:17 +0100 Subject: [PATCH 7/7] FIX "Insert Link" and other TinyMCE loading bugs (fixes #8327) Caused by SS loading a URL with html entities (&) through the Requirements API, which only works when directly inserted into the HTML template (standard behaviour), but garbles the URL GET parameters when loaded via the jQuery.ondemand JavaScript/XHR logic. It didn't fail the request, just meant that tiny_mce_gzip.php wasn't getting all the required options from the GET parameters. And since this newly loaded file contains the same JS globals, it would override previously loaded (correct) state. --- forms/HtmlEditorField.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index b5ffd7844..bda325e5e 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -33,7 +33,7 @@ class HtmlEditorField extends TextareaField { 'languages' => $configObj->getOption('language') ), true); preg_match('/src="([^"]*)"/', $tag, $matches); - Requirements::javascript($matches[1]); + Requirements::javascript(html_entity_decode($matches[1])); } else { Requirements::javascript(MCE_ROOT . 'tiny_mce_src.js');