mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Merge branch '0.5' into 0.6
This commit is contained in:
commit
e2cf6421c6
@ -65,7 +65,6 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
/**
|
/**
|
||||||
* Get members who have BLOGMANAGEMENT and ADMIN permission
|
* Get members who have BLOGMANAGEMENT and ADMIN permission
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function blogOwners($sort = array('FirstName'=>'ASC','Surname'=>'ASC'), $direction = null) {
|
function blogOwners($sort = array('FirstName'=>'ASC','Surname'=>'ASC'), $direction = null) {
|
||||||
|
|
||||||
$members = Permission::get_members_by_permission(array('ADMIN','BLOGMANAGEMENT'));
|
$members = Permission::get_members_by_permission(array('ADMIN','BLOGMANAGEMENT'));
|
||||||
@ -183,6 +182,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',
|
||||||
@ -304,6 +304,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->Fields()->fieldByName('BlogPost')->dataValue());
|
$blogentry->Content = str_replace("\r\n", "\n", $form->Fields()->fieldByName('BlogPost')->dataValue());
|
||||||
|
@ -22,6 +22,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(
|
||||||
'LandingPageFreshness' => 'Varchar',
|
'LandingPageFreshness' => 'Varchar',
|
||||||
);
|
);
|
||||||
@ -144,7 +151,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 = '';
|
||||||
|
|
||||||
@ -185,7 +191,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();
|
||||||
|
|
||||||
@ -221,7 +226,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","blog");
|
Requirements::themedCSS("blog","blog");
|
||||||
}
|
}
|
||||||
@ -234,7 +241,7 @@ class BlogTree_Controller extends Page_Controller {
|
|||||||
// only use freshness if no action is present (might be displaying tags or rss)
|
// only use freshness if no action is present (might be displaying tags or rss)
|
||||||
if ($this->LandingPageFreshness && !$this->request->param('Action')) {
|
if ($this->LandingPageFreshness && !$this->request->param('Action')) {
|
||||||
$d = new Zend_Date(SS_Datetime::now()->getValue());
|
$d = new Zend_Date(SS_Datetime::now()->getValue());
|
||||||
$d->sub($this->LandingPageFreshness, Zend_Date::MONTH);
|
$d->sub(intval($this->LandingPageFreshness, Zend_Date::MONTH), Zend_Date::MONTH);
|
||||||
$date = $d->toString('YYYY-MM-dd');
|
$date = $d->toString('YYYY-MM-dd');
|
||||||
|
|
||||||
$filter = "\"BlogEntry\".\"Date\" > '$date'";
|
$filter = "\"BlogEntry\".\"Date\" > '$date'";
|
||||||
|
@ -33,7 +33,6 @@ if(class_exists('Widget')) {
|
|||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
$fields->merge(
|
$fields->merge(
|
||||||
|
|
||||||
new FieldList(
|
new FieldList(
|
||||||
new OptionsetField(
|
new OptionsetField(
|
||||||
'DisplayMode',
|
'DisplayMode',
|
||||||
@ -58,7 +57,7 @@ if(class_exists('Widget')) {
|
|||||||
$container = BlogTree::current();
|
$container = BlogTree::current();
|
||||||
$ids = $container->BlogHolderIDs();
|
$ids = $container->BlogHolderIDs();
|
||||||
|
|
||||||
$stage = Versioned::current_stage();
|
if(empty($ids)) return $results;$stage = Versioned::current_stage();
|
||||||
$suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage";
|
$suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage";
|
||||||
|
|
||||||
$monthclause = method_exists(DB::getConn(), 'formattedDatetimeClause') ? DB::getConn()->formattedDatetimeClause('"Date"', '%m') : 'MONTH("Date")';
|
$monthclause = method_exists(DB::getConn(), 'formattedDatetimeClause') ? DB::getConn()->formattedDatetimeClause('"Date"', '%m') : 'MONTH("Date")';
|
||||||
|
@ -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