Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: silverstripe/silverstripe-cms
...
head fork: silverstripe/silverstripe-cms
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 19 commits
  • 8 files changed
  • 0 commit comments
  • 4 contributors
Commits on Nov 20, 2014
@tractorcow tractorcow Update branch alias for master 8e9ebdb
@tractorcow tractorcow Fix dependency on framework master branch 6ace564
Commits on Dec 10, 2014
@micmania1 micmania1 FIX Removed multifile thirdparty library which isn't used any more in…
… ss.
6ff6c6f
Commits on Jan 15, 2015
@tractorcow tractorcow Merge remote-tracking branch 'origin/3'
Conflicts:
	composer.json
0c62270
Commits on Feb 20, 2015
@tractorcow tractorcow Merge remote-tracking branch 'origin/3' 771baef
Commits on Apr 28, 2015
@chillu chillu Merge pull request #1145 from micmania1/1144-remove-multifile
FIX Removed multifile thirdparty library which isn't used any more in ss...
15f03fa
Commits on Apr 29, 2015
@chillu chillu Merge remote-tracking branch 'origin/3' 3b7abb0
Commits on May 18, 2015
@tractorcow tractorcow Merge remote-tracking branch 'origin/3' f0b9627
Commits on Jun 08, 2015
@tractorcow tractorcow Merge remote-tracking branch 'origin/3' dc93562
@tractorcow tractorcow API Formalise new DataObject::canCreate argument
3bc76e6
Commits on Jun 12, 2015
@dhensby dhensby Merge pull request #1212 from tractorcow/pulls/4.0/fix-extra-args
API Formalise new DataObject::canCreate argument
562f9de
Commits on Jun 17, 2015
@tractorcow tractorcow Merge remote-tracking branch 'origin/3' dd49a88
@tractorcow tractorcow API make DataObject::validate public
4aa84f3
@chillu chillu Merge pull request #1219 from tractorcow/pulls/4.0/make-validate-public
API make DataObject::validate public
82da5a2
Commits on Jul 31, 2015
@tractorcow tractorcow Merge remote-tracking branch 'origin/3'
Conflicts:
	composer.json
3790273
Commits on Aug 17, 2015
@dhensby dhensby Merge branch '3'
Conflicts:
	.travis.yml
7d50e0f
@dhensby dhensby Removing PHP 5.3 from travis f81159c
@dhensby dhensby Fixing behat regression bf6a84b
Commits on Aug 24, 2015
@tractorcow tractorcow Merge remote-tracking branch 'origin/3'
Conflicts:
	.travis.yml
3adef16
View
4 .travis.yml
@@ -15,7 +15,7 @@ addons:
env:
global:
- - CORE_RELEASE=3
+ - CORE_RELEASE=master
- "ARTIFACTS_AWS_REGION=us-east-1"
- "ARTIFACTS_S3_BUCKET=silverstripe-travis-artifacts"
- secure: "7V20Qk3bIG2AlTJaA5D/uzB8vUVvRwQp+xjRYUxlahtj9FcuqEV3HIyjwwJe0T6Z1bnRYuu28ZnCT2CfP9BBZ3FE7AwSZbPase9c0/at2qDJNqkvIdC1xZ1H6Fcy2LSwNB9wLQPe613ItVdanitEuwE41iowxBPslxUUTnwx7eY="
@@ -40,8 +40,6 @@ matrix:
env: DB=MYSQL
- php: 5.4
env: DB=MYSQL BEHAT_TEST=1
- - php: 5.3
- env: DB=MYSQL
- php: 7.0
env: DB=MYSQL
- php: nightly
View
19 code/model/SiteTree.php
@@ -1023,24 +1023,27 @@ public function canDelete($member = null) {
* If omitted, it will be assumed this is to be created as a top level page.
* @return bool True if the current user can create pages on this class.
*/
- public function canCreate($member = null) {
+ public function canCreate($member = null, $context = array()) {
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) {
$member = Member::currentUserID();
}
// Check parent (custom canCreate option for SiteTree)
// Block children not allowed for this parent type
- $context = func_num_args() > 1 ? func_get_arg(1) : array();
$parent = isset($context['Parent']) ? $context['Parent'] : null;
- if($parent && !in_array(get_class($this), $parent->allowedChildren())) return false;
+ if($parent && !in_array(get_class($this), $parent->allowedChildren())) {
+ return false;
+ }
// Check permission
- if($member && Permission::checkMember($member, "ADMIN")) return true;
+ if($member && Permission::checkMember($member, "ADMIN")) {
+ return true;
+ }
// Standard mechanism for accepting permission changes from extensions
- $results = $this->extend('canCreate', $member, $parent);
- if(is_array($results) && ($results = array_filter($results, function($v) {return $v !== null;}))) {
- return min($results);
+ $extended = $this->extendedCan(__FUNCTION__, $member, $context);
+ if($extended !== null) {
+ return $extended;
}
// Fall over to inherited permissions
@@ -1625,7 +1628,7 @@ public function flushCache($persistent = true) {
$this->_cache_statusFlags = null;
}
- protected function validate() {
+ public function validate() {
$result = parent::validate();
// Allowed children validation
View
2  code/model/VirtualPage.php
@@ -344,7 +344,7 @@ public function onAfterWrite() {
}
}
- protected function validate() {
+ public function validate() {
$result = parent::validate();
// "Can be root" validation
View
8 composer.json
@@ -18,13 +18,13 @@
"require": {
"php": ">=5.3.3",
"composer/installers": "*",
- "silverstripe/framework": "~3.3",
- "silverstripe/reports": "~3.3",
- "silverstripe/siteconfig": "~3.3"
+ "silverstripe/framework": "4.0.x-dev",
+ "silverstripe/reports": "*",
+ "silverstripe/siteconfig": "3.2.x-dev"
},
"extra": {
"branch-alias": {
- "3.x-dev": "3.3.x-dev"
+ "dev-master": "4.0.x-dev"
}
},
"autoload": {
View
6 tests/behat/features/insert-an-image.feature
@@ -49,9 +49,9 @@ Feature: Insert an image into a page
And I wait for 2 seconds
# Note change in default behaviour from 3.1, respect default Upload.replaceFile=false
Then there should be a file "assets/Uploads/file1.jpg"
- And there should be a file "assets/Uploads/file2.jpg"
+ And there should be a file "assets/Uploads/file1-v2.jpg"
When I press the "Insert" button
- Then the "Content" HTML field should contain "file2.jpg"
+ Then the "Content" HTML field should contain "file1-v2.jpg"
# Required to avoid "unsaved changed" browser dialog
Then I press the "Save draft" button
@@ -91,4 +91,4 @@ Feature: Insert an image into a page
And I press the "Insert" button
Then the "Content" HTML field should contain "<img src=assets/folder1/file1.jpg width=10 height=20>"
# Required to avoid "unsaved changed" browser dialog
- Then I press the "Save draft" button
+ Then I press the "Save draft" button
View
26 thirdparty/multifile/example.html
@@ -1,26 +0,0 @@
-<html>
-
-<head>
- <!-- Include the javascript -->
- <script src="multifile_compressed.js"></script>
-</head>
-
-<body>
-
-<!-- This is the form -->
-<form enctype="multipart/form-data" action="your_script_here.script" method = "post">
- <!-- The file element -- NOTE: it has an ID -->
- <input id="my_file_element" type="file" name="file_1" >
- <input type="submit">
-</form>
-Files:
-<!-- This is where the output will appear -->
-<div id="files_list"></div>
-<script>
- <!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
- var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 3 );
- <!-- Pass in the file element -->
- multi_selector.addElement( document.getElementById( 'my_file_element' ) );
-</script>
-</body>
-</html>
View
82 thirdparty/multifile/multifile.css
@@ -1,82 +0,0 @@
-#Form_UploadForm {
- padding: 5px;
- line-height: 1.4em;
-}
-
-#Form_UploadForm a {
- font-weight: bold;
-}
-
-#Form_UploadForm ol li {
- list-style: decimal outside;
-}
-
-#Form_UploadForm ul li {
- list-style-type: square;
-}
-
-#Form_UploadForm form {
- text-align: left;
-}
-
-#Form_UploadForm label {
- font-size: 1.2em;
-}
-
-#Form_UploadForm input.delete {
- margin: 2px auto;
- padding: 0px;
- background-color: #FFFFFF;
- border:1px solid #D6D3CE;
-}
-
-#Form_UploadForm input[value="Submit"] {
- cursor: pointer;
-}
-
-#Form_UploadForm input[value="Submit"]:hover{
- background-color: #F6F6E8;
-}
-
-#Form_UploadForm #Form_UploadForm_FilesList div {
- font-size: 1.2em;
- vertical-align: middle;
-}
-
-#Form_UploadForm #Form_UploadForm_FilesList input {
- margin-left: 10px;
-}
-
-#Form_UploadForm #Form_UploadForm_FilesList .clear {
- height: 0;
- line-height: 0;
-}
-
-#Form_UploadForm div.file {
- display: inline;
-}
-
-#Form_UploadForm #Form_UploadForm_action_upload {
- display: inline;
- margin: 5px 0;
-}
-
-#Form_UploadForm p {
- margin-top: 5px;
-}
-
-#Form_UploadForm_FilesList {
- margin-top: 5px;
-}
-
-#Form_UploadForm_FilesList .fileBox {
- width: auto;
- border: 1px solid #F1EFE2;
- padding: 5px;
- margin-bottom: 5px;
-}
-
-#Form_UploadForm_FilesList .fileBox .delete:hover {
- background: red;
- font-weight: bold;
-}
View
225 thirdparty/multifile/multifile.js
@@ -1,225 +0,0 @@
-/**
- * Convert a single file-input element into a 'multiple' input list
- *
- * Modified 2006-11-06 by Silverstripe Ltd.
- *
- * Usage:
- *
- * 1. Create a file input element (no name)
- * eg. <input type="file" id="first_file_element">
- *
- * 2. Create a DIV for the output to be written to
- * eg. <div id="files_list"></div>
- *
- * 3. Instantiate a MultiSelector object, passing in the DIV and an (optional) maximum number of files
- * eg. var multi_selector = new MultiSelector( document.getElementById( 'files_list' ), 3 );
- *
- * 4. Add the first element
- * eg. multi_selector.addElement( document.getElementById( 'first_file_element' ) );
- *
- * 5. That's it.
- *
- * You might (will) want to play around with the addListRow() method to make the output prettier.
- *
- * You might also want to change the line
- * element.name = 'file_' + this.count;
- * ...to a naming convention that makes more sense to you.
- *
- * Licence:
- * Use this however/wherever you like, just don't blame me if it breaks anything.
- *
- * Credit:
- * If you're nice, you'll leave this bit:
- *
- * Class by Stickman -- http://www.the-stickman.com
- * with thanks to:
- * [for Safari fixes]
- * Luis Torrefranca -- http://www.law.pitt.edu
- * and
- * Shawn Parker & John Pennypacker -- http://www.fuzzycoconut.com
- * [for duplicate name bug]
- * 'neal'
- */
-
-// Modified by: Silverstripe Ltd. (changed naming of file-input-elements)
-
-function ObservableObject() {
- this.functions = [];
-}
-ObservableObject.prototype = {
- subscribe : function(evt, fn) {
- this.functions.push([evt, fn]);
- },
- unsubscribe : function(evt, fn) {
- this.functions = this.fns.filter(function(el) {if (el !== [evt, fn]) return el;});
- },
- fire : function(evt, data, scope) {
- scope = scope || window
- jQuery(this.functions).each(function(el) {
- if (el[0] == evt) el[1].call(scope, data);
- });
- }
-};
-
-var MultiSelectorObserver = new ObservableObject();
-
-function MultiSelector( list_target, max, upload_button ){
-
- this.upload_button = upload_button;
- this.upload_button.setAttribute("disabled", "disabled");
-
- // Where to write the list
- this.list_target = list_target;
- // How many elements?
- this.count = -1;
- // How many elements?
- this.id = 0;
- // Is there a maximum?
- if( max ){
- this.max = max;
- } else {
- this.max = -1;
- };
-
- /**
- * Add a new file input element
- */
- this.addElement = function( element ){
-
- // Make sure it's a file input element
- if( element.tagName == 'INPUT' && element.type == 'file' ){
-
- // Element name -- what number am I?
- // Modified by: Silverstripe Ltd. (changed naming of file-input-elements)
- element.name = 'Files[' + this.id++ + ']'
-
- // If we've reached maximum number, disable input element
- if( this.max != -1 && this.count >= this.max ){
- element.disabled = true;
- };
-
- // File element counter
- this.count++;
-
- // Add reference to this object
- element.__scope = this;
- element.multi_selector = this;
-
- // What to do when a file is selected
- element.onchange = function(){
-
- // New file input
- var new_element = document.createElement( 'input' );
- new_element.type = 'file';
-
- // Add new element
- this.parentNode.insertBefore( new_element, this );
-
- // Apply 'update' to element
- this.multi_selector.addElement( new_element );
-
- // Update list
- this.multi_selector.addListRow( this );
-
- // Hide this: we can't use display:none because Safari doesn't like it
- this.style.position = 'absolute';
- this.style.left = '-1000px';
-
- element.__scope.toggleUploadButton();
- };
-
- // Most recent element
- this.current_element = element;
-
- } else {
- // This can only be applied to file input elements!
- alert( 'Error: not a file input element' );
- };
-
- };
-
- this.toggleUploadButton = function() {
- if(this.count > 0) {
- this.upload_button.removeAttribute("disabled");
- } else {
- this.upload_button.setAttribute("disabled", "disabled");
- }
- }
-
- /**
- * Add a new row to the list of files
- */
- this.addListRow = function( element ){
- var fileId = this.id -1;
-
- // Modified 2006-11-06 by Silverstripe Ltd.
- var filenameMatches = element.value.match(/([^\/\\]+)$/);
- var filename = filenameMatches[1];
-
- // Row div
- var new_row = document.createElement('div');
- new_row.className = 'fileBox';
-
- // Delete button
- var new_row_button = document.createElement('input');
- new_row_button.type = 'button';
- new_row_button.value = 'Delete';
- new_row_button.setAttribute('class', 'delete');
-
- // References
- new_row.element = element;
- element.__scope = this,
-
- // Delete function
- new_row_button.onclick= function(){
-
- // Remove element from form
- this.parentNode.element.parentNode.removeChild( this.parentNode.element );
-
- // Remove this row from the list
- this.parentNode.parentNode.removeChild( this.parentNode );
-
- // Decrement counter
- this.parentNode.element.multi_selector.count--;
-
- // Re-enable input element (if it's disabled)
- this.parentNode.element.multi_selector.current_element.disabled = false;
-
- element.__scope.toggleUploadButton();
-
- // Appease Safari
- // without it Safari wants to reload the browser window
- // which nixes your already queued uploads
- return false;
- };
-
- // Set row value
- // Modified 2006-11-06 by Silverstripe Ltd.
- new_row.innerHTML = filename;
-
- MultiSelectorObserver.fire('onBeforeCreateRow', [fileId, new_row], this);
-
- // Add button
- new_row.appendChild( new_row_button );
-
- // Add it to the list
- this.list_target.appendChild( new_row );
-
- MultiSelectorObserver.fire('onAfterCreateRow', [fileId, new_row], this);
-
- // Modified 2006-11-06 by Silverstripe Ltd.
- if(typeof(window.ontabschanged) != 'undefined') window.ontabschanged();
-
- };
-
-};
-
-MultiSelectorObserver.subscribe('onBeforeCreateRow', function(data) {
- if (jQuery('#metadataFormTemplate').length) {
- var parameters = jQuery('#metadataFormTemplate').clone(true);
- parameters.get(0).id = '';
- parameters.find(":input[name!='']").each(function(i) { this.name = this.name.replace(/__X__/g, data[0]); });
- parameters.find(":input[id!='']").each(function(i) { this.id = this.id.replace(/__X__/g, data[0]); });
- data[1].innerHTML = data[1].innerHTML + '<div id="MetadataFor-'+data[0]+'">'+parameters.html()+'</div>';
- }
-});

No commit comments for this range

Something went wrong with that request. Please try again.