Merge branch '0.6' into 1.0

This commit is contained in:
Daniel Hensby 2018-02-20 13:31:31 +00:00
commit bdea98a875
No known key found for this signature in database
GPG Key ID: B00D1E9767F0B06E
5 changed files with 123 additions and 117 deletions

View File

@ -64,7 +64,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'));
@ -308,6 +307,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());

View File

@ -162,7 +162,6 @@ class BlogTree extends Page {
* @return PaginatedList The list of entries in a paginated list * @return PaginatedList The list of entries in a paginated list
*/ */
public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null, $filter = '') { public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null, $filter = '') {
$tagCheck = ''; $tagCheck = '';
$dateCheck = ''; $dateCheck = '';
@ -203,7 +202,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();
@ -263,7 +261,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'";
@ -387,7 +385,6 @@ class BlogTree_Controller extends Page_Controller {
} }
/** /**
*
* @return string * @return string
*/ */
public function SelectedNiceDate(){ public function SelectedNiceDate(){

View File

@ -86,6 +86,7 @@ if(class_exists('Widget')) {
ORDER BY \"Year\" DESC" ORDER BY \"Year\" DESC"
); );
} }
if($sqlResults) foreach($sqlResults as $sqlResult) { if($sqlResults) foreach($sqlResults as $sqlResult) {
$isMonthDisplay = $this->DisplayMode == 'month'; $isMonthDisplay = $this->DisplayMode == 'month';

View File

@ -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');