Merge branch '3.0'

This commit is contained in:
Sean Harvey 2012-10-15 10:10:52 +13:00
commit 8a0ae5653f
5 changed files with 28 additions and 15 deletions

12
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,12 @@
# Contributing
Any open source product is only as good as the community behind it. You can participate by sharing code, ideas, or simply helping others. No matter what your skill level is, every contribution counts.
See our [high level overview](http://silverstripe.org/contributing-to-silverstripe) on silverstripe.org on how you can help out.
Or, for more detailed guidance, read one of the following pages:
* [Sharing your opinion and raising issues](http://doc.silverstripe.org/framework/en/trunk/misc/contributing/issues)
* [Providing code, whether it's creating a feature or fixing a bug](http://doc.silverstripe.org/framework/en/trunk/misc/contributing/code)
* [Writing and translating documentation](http://doc.silverstripe.org/framework/en/trunk/misc/contributing/documentation)
* [Translating user-interface elements](http://doc.silverstripe.org/framework/en/trunk/misc/contributing/translation)

View File

@ -478,10 +478,12 @@ JS
public function currentPage() {
$id = $this->currentPageID();
if($id && is_numeric($id) && $id > 0) {
return DataObject::get_by_id('Folder', $id);
} else {
return new Folder();
$folder = DataObject::get_by_id('Folder', $id);
if($folder && $folder->exists()) {
return $folder;
}
}
return new Folder();
}
public function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) {

View File

@ -23,13 +23,13 @@ class CMSFileAddController extends LeftAndMain {
*/
public function currentPage() {
$id = $this->currentPageID();
if($id && is_numeric($id) && $id > 0) {
return DataObject::get_by_id('Folder', $id);
} else {
// ID is either '0' or 'root'
return singleton('Folder');
$folder = DataObject::get_by_id('Folder', $id);
if($folder && $folder->exists()) {
return $folder;
}
}
return new Folder();
}
/**
@ -64,12 +64,12 @@ class CMSFileAddController extends LeftAndMain {
$uploadField->removeExtraClass('ss-uploadfield');
$uploadField->setTemplate('AssetUploadField');
if ($folder->exists() && $folder->getFilename()) {
if($folder->exists() && $folder->getFilename()) {
// The Upload class expects a folder relative *within* assets/
$path = preg_replace('/^' . ASSETS_DIR . '\//', '', $folder->getFilename());
$uploadField->setFolderName($path);
} else {
$uploadField->setFolderName(ASSETS_DIR);
$uploadField->setFolderName('/'); // root of the assets
}
$exts = $uploadField->getValidator()->getAllowedExtensions();

View File

@ -29,9 +29,8 @@ class BrokenLinksReport extends SS_Report {
$sort = '';
}
}
$q = DB::USE_ANSI_SQL ? '"' : '`';
if (!isset($_REQUEST['CheckSite']) || $params['CheckSite'] == 'Published') $ret = Versioned::get_by_stage('SiteTree', 'Live', "({$q}SiteTree{$q}.{$q}HasBrokenLink{$q} = 1 OR {$q}SiteTree{$q}.{$q}HasBrokenFile{$q} = 1)", $sort, $join, $limit);
else $ret = DataObject::get('SiteTree', "({$q}SiteTree{$q}.{$q}HasBrokenFile{$q} = 1 OR {$q}HasBrokenLink{$q} = 1)", $sort, $join, $limit);
if (!isset($_REQUEST['CheckSite']) || $params['CheckSite'] == 'Published') $ret = Versioned::get_by_stage('SiteTree', 'Live', '("SiteTree"."HasBrokenLink" = 1 OR "SiteTree"."HasBrokenFile" = 1)', $sort, $join, $limit);
else $ret = DataObject::get('SiteTree', '("SiteTree"."HasBrokenFile" = 1 OR "HasBrokenLink" = 1)', $sort, $join, $limit);
$returnSet = new ArrayList();
if ($ret) foreach($ret as $record) {

View File

@ -29,7 +29,7 @@
var form = self.parents('form');
var url_segment = $('.field.urlsegment', form).find(':text');
var live_url_segment = $('input[name=LiveURLSegment]', form);
var live_link = $('input[name=LiveLink]', form);
self._addActions();
@ -40,7 +40,7 @@
self.data('OrigVal', title);
// Criteria for defining a "new" page
if ((url_segment.val().indexOf('new') == 0) && live_url_segment.val() == '') {
if ((url_segment.val().indexOf('new') == 0) && live_link.val() == '') {
self.updateURLSegment(title);
} else {
$('.update', self.parent()).show();