Skip to content

Commit

Permalink
Merge branch '3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Harvey committed Oct 14, 2012
2 parents 1711303 + 0a92c81 commit 8a0ae56
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 15 deletions.
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Original file line number Original file line Diff line number Diff line change
@@ -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)
8 changes: 5 additions & 3 deletions code/controllers/AssetAdmin.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -478,10 +478,12 @@ public function doAdd($data, $form) {
public function currentPage() { public function currentPage() {
$id = $this->currentPageID(); $id = $this->currentPageID();
if($id && is_numeric($id) && $id > 0) { if($id && is_numeric($id) && $id > 0) {
return DataObject::get_by_id('Folder', $id); $folder = DataObject::get_by_id('Folder', $id);
} else { if($folder && $folder->exists()) {
return new Folder(); return $folder;
}
} }
return new Folder();
} }


public function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) { public function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) {
Expand Down
14 changes: 7 additions & 7 deletions code/controllers/CMSFileAddController.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ class CMSFileAddController extends LeftAndMain {
*/ */
public function currentPage() { public function currentPage() {
$id = $this->currentPageID(); $id = $this->currentPageID();

if($id && is_numeric($id) && $id > 0) { if($id && is_numeric($id) && $id > 0) {
return DataObject::get_by_id('Folder', $id); $folder = DataObject::get_by_id('Folder', $id);
} else { if($folder && $folder->exists()) {
// ID is either '0' or 'root' return $folder;
return singleton('Folder'); }
} }
return new Folder();
} }


/** /**
Expand Down Expand Up @@ -64,12 +64,12 @@ public function getEditForm($id = null, $fields = null) {
$uploadField->removeExtraClass('ss-uploadfield'); $uploadField->removeExtraClass('ss-uploadfield');
$uploadField->setTemplate('AssetUploadField'); $uploadField->setTemplate('AssetUploadField');


if ($folder->exists() && $folder->getFilename()) { if($folder->exists() && $folder->getFilename()) {
// The Upload class expects a folder relative *within* assets/ // The Upload class expects a folder relative *within* assets/
$path = preg_replace('/^' . ASSETS_DIR . '\//', '', $folder->getFilename()); $path = preg_replace('/^' . ASSETS_DIR . '\//', '', $folder->getFilename());
$uploadField->setFolderName($path); $uploadField->setFolderName($path);
} else { } else {
$uploadField->setFolderName(ASSETS_DIR); $uploadField->setFolderName('/'); // root of the assets
} }


$exts = $uploadField->getValidator()->getAllowedExtensions(); $exts = $uploadField->getValidator()->getAllowedExtensions();
Expand Down
5 changes: 2 additions & 3 deletions code/reports/BrokenLinksReport.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ public function sourceRecords($params, $sort, $limit) {
$sort = ''; $sort = '';
} }
} }
$q = DB::USE_ANSI_SQL ? '"' : '`'; if (!isset($_REQUEST['CheckSite']) || $params['CheckSite'] == 'Published') $ret = Versioned::get_by_stage('SiteTree', 'Live', '("SiteTree"."HasBrokenLink" = 1 OR "SiteTree"."HasBrokenFile" = 1)', $sort, $join, $limit);
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', '("SiteTree"."HasBrokenFile" = 1 OR "HasBrokenLink" = 1)', $sort, $join, $limit);
else $ret = DataObject::get('SiteTree', "({$q}SiteTree{$q}.{$q}HasBrokenFile{$q} = 1 OR {$q}HasBrokenLink{$q} = 1)", $sort, $join, $limit);


$returnSet = new ArrayList(); $returnSet = new ArrayList();
if ($ret) foreach($ret as $record) { if ($ret) foreach($ret as $record) {
Expand Down
4 changes: 2 additions & 2 deletions javascript/CMSMain.EditForm.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@


var form = self.parents('form'); var form = self.parents('form');
var url_segment = $('.field.urlsegment', form).find(':text'); 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(); self._addActions();


Expand All @@ -40,7 +40,7 @@
self.data('OrigVal', title); self.data('OrigVal', title);


// Criteria for defining a "new" page // 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); self.updateURLSegment(title);
} else { } else {
$('.update', self.parent()).show(); $('.update', self.parent()).show();
Expand Down

0 comments on commit 8a0ae56

Please sign in to comment.