Permalink
Browse files

Merge branch '3.0'

  • Loading branch information...
halkyon committed Oct 14, 2012
2 parents 1711303 + 0a92c81 commit 8a0ae5653f340e643bf3906d6c576729660326a7
View
@@ -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)
@@ -478,10 +478,12 @@ public function doAdd($data, $form) {
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) {
@@ -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 @@ public function getEditForm($id = null, $fields = null) {
$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();
@@ -29,9 +29,8 @@ public function sourceRecords($params, $sort, $limit) {
$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) {
@@ -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();

0 comments on commit 8a0ae56

Please sign in to comment.