mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge branch '0.4' into 0.5
This commit is contained in:
commit
ded09bda7d
@ -152,6 +152,7 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class BlogHolder_Controller extends BlogTree_Controller {
|
class BlogHolder_Controller extends BlogTree_Controller {
|
||||||
|
|
||||||
static $allowed_actions = array(
|
static $allowed_actions = array(
|
||||||
'index',
|
'index',
|
||||||
'tag',
|
'tag',
|
||||||
@ -273,6 +274,7 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$form->saveInto($blogentry);
|
$form->saveInto($blogentry);
|
||||||
|
|
||||||
$blogentry->ParentID = $this->ID;
|
$blogentry->ParentID = $this->ID;
|
||||||
$blogentry->Content = str_replace("\r\n", "\n", $form->datafieldByName('BlogPost')->dataValue());
|
$blogentry->Content = str_replace("\r\n", "\n", $form->datafieldByName('BlogPost')->dataValue());
|
||||||
|
|
||||||
@ -280,6 +282,10 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
|||||||
$blogentry->Locale = $this->Locale;
|
$blogentry->Locale = $this->Locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Object::hasExtension('Translatable')) {
|
||||||
|
$blogentry->Locale = $this->Locale;
|
||||||
|
}
|
||||||
|
|
||||||
$blogentry->Status = "Published";
|
$blogentry->Status = "Published";
|
||||||
$blogentry->writeToStage("Stage");
|
$blogentry->writeToStage("Stage");
|
||||||
$blogentry->publish("Stage", "Live");
|
$blogentry->publish("Stage", "Live");
|
||||||
|
@ -13,6 +13,13 @@ class BlogTree extends Page {
|
|||||||
// Default number of blog entries to show
|
// Default number of blog entries to show
|
||||||
static $default_entries_limit = 10;
|
static $default_entries_limit = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool Include an automatic link to the rss feed for
|
||||||
|
* the browser. Disabling this will allow you to include your
|
||||||
|
* own feedburner link
|
||||||
|
*/
|
||||||
|
static $include_rss_link = true;
|
||||||
|
|
||||||
static $db = array(
|
static $db = array(
|
||||||
'Name' => 'Varchar',
|
'Name' => 'Varchar',
|
||||||
'InheritSideBar' => 'Boolean',
|
'InheritSideBar' => 'Boolean',
|
||||||
@ -152,7 +159,6 @@ class BlogTree extends Page {
|
|||||||
* @return DataObjectSet
|
* @return DataObjectSet
|
||||||
*/
|
*/
|
||||||
public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null, $filter = '') {
|
public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null, $filter = '') {
|
||||||
|
|
||||||
$tagCheck = '';
|
$tagCheck = '';
|
||||||
$dateCheck = '';
|
$dateCheck = '';
|
||||||
|
|
||||||
@ -193,7 +199,6 @@ class BlogTree extends Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build a list of all IDs for BlogHolders that are children of us
|
// Build a list of all IDs for BlogHolders that are children of us
|
||||||
$holderIDs = $this->BlogHolderIDs();
|
$holderIDs = $this->BlogHolderIDs();
|
||||||
|
|
||||||
@ -225,7 +230,9 @@ class BlogTree_Controller extends Page_Controller {
|
|||||||
function init() {
|
function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
|
if(BlogTree::$include_rss_link) {
|
||||||
$this->IncludeBlogRSS();
|
$this->IncludeBlogRSS();
|
||||||
|
}
|
||||||
|
|
||||||
Requirements::themedCSS("blog");
|
Requirements::themedCSS("blog");
|
||||||
}
|
}
|
||||||
|
@ -56,6 +56,8 @@ class ArchiveWidget extends Widget {
|
|||||||
$container = BlogTree::current();
|
$container = BlogTree::current();
|
||||||
$ids = $container->BlogHolderIDs();
|
$ids = $container->BlogHolderIDs();
|
||||||
|
|
||||||
|
if(empty($ids)) return $results;
|
||||||
|
|
||||||
$stage = Versioned::current_stage();
|
$stage = Versioned::current_stage();
|
||||||
$suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage";
|
$suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage";
|
||||||
|
|
||||||
|
@ -6,9 +6,12 @@
|
|||||||
class BlogHolderFunctionalTest extends FunctionalTest {
|
class BlogHolderFunctionalTest extends FunctionalTest {
|
||||||
|
|
||||||
static $fixture_file = 'blog/tests/BlogHolderFunctionalTest.yml';
|
static $fixture_file = 'blog/tests/BlogHolderFunctionalTest.yml';
|
||||||
|
static $origlThemes;
|
||||||
|
|
||||||
function setUp() {
|
function setUp() {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
self::$origlThemes = SSViewer::current_theme();
|
||||||
|
SSViewer::set_theme(null);
|
||||||
|
|
||||||
$blogHolder = $this->objFromFixture('BlogHolder', 'blogholder');
|
$blogHolder = $this->objFromFixture('BlogHolder', 'blogholder');
|
||||||
$blogHolder->publish('Stage', 'Live');
|
$blogHolder->publish('Stage', 'Live');
|
||||||
@ -16,6 +19,11 @@ class BlogHolderFunctionalTest extends FunctionalTest {
|
|||||||
$blogEntry->publish('Stage', 'Live');
|
$blogEntry->publish('Stage', 'Live');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tearDown(){
|
||||||
|
SSViewer::set_theme(self::$origlThemes);
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
function testFrontendBlogPostRequiresPermission() {
|
function testFrontendBlogPostRequiresPermission() {
|
||||||
// get valid SecurityID (from comments form, would usually be copy/pasted)
|
// get valid SecurityID (from comments form, would usually be copy/pasted)
|
||||||
$blogEntry = $this->objFromFixture('BlogEntry', 'entry1');
|
$blogEntry = $this->objFromFixture('BlogEntry', 'entry1');
|
||||||
|
Loading…
Reference in New Issue
Block a user