mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Revert "BUGFIX Initial fixes to support at least building the blog module on SS3"
This reverts commit 8b58156211
.
This commit is contained in:
parent
8b58156211
commit
90a0e80667
@ -49,7 +49,7 @@ class BlogEntry extends Page {
|
||||
$this->setField('Date', date('Y-m-d H:i:s', strtotime('now')));
|
||||
}
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
function getCMSFields() {
|
||||
Requirements::javascript('blog/javascript/bbcodehelp.js');
|
||||
Requirements::themedCSS('bbcodehelp');
|
||||
|
||||
@ -57,7 +57,7 @@ class BlogEntry extends Page {
|
||||
$codeparser = new BBCodeParser();
|
||||
|
||||
SiteTree::disableCMSFieldsExtensions();
|
||||
$fields = parent::getCMSFields($params);
|
||||
$fields = parent::getCMSFields();
|
||||
SiteTree::enableCMSFieldsExtensions();
|
||||
|
||||
if(!self::$allow_wysiwyg_editing) {
|
||||
@ -87,8 +87,8 @@ class BlogEntry extends Page {
|
||||
* Returns the tags added to this blog entry
|
||||
*/
|
||||
function TagsCollection() {
|
||||
$tags = preg_split('/ *, */', trim($this->Tags));
|
||||
$output = new ArrayList();
|
||||
$tags = split(" *, *", trim($this->Tags));
|
||||
$output = new DataObjectSet();
|
||||
|
||||
$link = $this->getParent() ? $this->getParent()->Link('tag') : '';
|
||||
|
||||
@ -270,6 +270,7 @@ class BlogEntry_Controller extends Page_Controller {
|
||||
*/
|
||||
function PageComments() {
|
||||
if($this->hasMethod('CommentsForm')) return $this->CommentsForm();
|
||||
else return parent::PageComments();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,15 +27,15 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
||||
'BlogEntry'
|
||||
);
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
function getCMSFields() {
|
||||
$blogOwners = $this->blogOwners();
|
||||
|
||||
SiteTree::disableCMSFieldsExtensions();
|
||||
$fields = parent::getCMSFields($params);
|
||||
$fields = parent::getCMSFields();
|
||||
SiteTree::enableCMSFieldsExtensions();
|
||||
|
||||
$fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks'));
|
||||
$fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', $blogOwners->map('ID', 'Name')));
|
||||
$fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', $blogOwners->toDropDownMap('ID', 'Name', 'None')));
|
||||
$fields->addFieldToTab('Root.Content.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field'));
|
||||
|
||||
$this->extend('updateCMSFields', $fields);
|
||||
@ -50,8 +50,8 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
||||
$adminMembers = Permission::get_members_by_permission('ADMIN');
|
||||
$blogOwners = Permission::get_members_by_permission('BLOGMANAGEMENT');
|
||||
|
||||
if(!$adminMembers) $adminMembers = new ArrayList();
|
||||
if(!$blogOwners) $blogOwners = new ArrayList();
|
||||
if(!$adminMembers) $adminMembers = new DataObjectSet();
|
||||
if(!$blogOwners) $blogOwners = new DataObjectSet();
|
||||
|
||||
$blogOwners->merge($adminMembers);
|
||||
$blogOwners->sort($sort, $direction);
|
||||
@ -204,7 +204,7 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
||||
}
|
||||
|
||||
$codeparser = new BBCodeParser();
|
||||
$membername = Member::currentUser() ? Member::currentUser()->getName() : "";
|
||||
$membername = Member::currentMember() ? Member::currentMember()->getName() : "";
|
||||
|
||||
if(BlogEntry::$allow_wysiwyg_editing) {
|
||||
$contentfield = new HtmlEditorField("BlogPost", _t("BlogEntry.CN"));
|
||||
@ -226,7 +226,7 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
||||
if(!$this->AllowCustomAuthors && !Permission::check('ADMIN')) {
|
||||
$field = 'ReadonlyField';
|
||||
}
|
||||
$fields = new FieldList(
|
||||
$fields = new FieldSet(
|
||||
new HiddenField("ID", "ID"),
|
||||
new TextField("Title", _t('BlogHolder.SJ', "Subject")),
|
||||
new $field("Author", _t('BlogEntry.AU'), $membername),
|
||||
@ -237,7 +237,7 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
||||
);
|
||||
|
||||
$submitAction = new FormAction('postblog', _t('BlogHolder.POST', 'Post blog entry'));
|
||||
$actions = new FieldList($submitAction);
|
||||
$actions = new FieldSet($submitAction);
|
||||
$validator = new RequiredFields('Title','BlogPost');
|
||||
|
||||
$form = new Form($this, 'BlogEntryForm',$fields, $actions,$validator);
|
||||
@ -246,7 +246,7 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
||||
$entry = DataObject::get_by_id('BlogEntry', $id);
|
||||
if($entry->IsOwner()) {
|
||||
$form->loadDataFrom($entry);
|
||||
$form->Fields()->dataFieldByName('BlogPost')->setValue($entry->Content);
|
||||
$form->datafieldByName('BlogPost')->setValue($entry->Content);
|
||||
}
|
||||
} else {
|
||||
$form->loadDataFrom(array("Author" => Cookie::get("BlogHolder_Name")));
|
||||
@ -274,7 +274,7 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
||||
|
||||
$form->saveInto($blogentry);
|
||||
$blogentry->ParentID = $this->ID;
|
||||
$blogentry->Content = str_replace("\r\n", "\n", $form->Fields()->dataFieldByName('BlogPost')->dataValue());
|
||||
$blogentry->Content = str_replace("\r\n", "\n", $form->datafieldByName('BlogPost')->dataValue());
|
||||
|
||||
if(Object::has_extension($this->ClassName, 'Translatable')) {
|
||||
$blogentry->Locale = $this->Locale;
|
||||
@ -288,3 +288,5 @@ class BlogHolder_Controller extends BlogTree_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
@ -93,8 +93,8 @@ class BlogTree extends Page {
|
||||
|
||||
/* ----------- CMS CONTROL -------------- */
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
$fields->addFieldToTab("Root.Content.Main", new TextField("Name", "Name of blog"));
|
||||
$fields->addFieldToTab('Root.Content.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array(
|
||||
"" => "All entries",
|
||||
|
@ -2,11 +2,11 @@
|
||||
/**
|
||||
* Add trackback (receive and send) feature blog entry
|
||||
*/
|
||||
class TrackBackDecorator extends DataExtension {
|
||||
class TrackBackDecorator extends DataObjectDecorator {
|
||||
|
||||
static $trackback_server_class = 'TrackbackHTTPServer';
|
||||
|
||||
function extraStatics($class = null, $extension = null) {
|
||||
function extraStatics() {
|
||||
return array(
|
||||
'has_many' => array(
|
||||
'TrackBackURLs' => 'TrackBackURL',
|
||||
@ -15,7 +15,7 @@ class TrackBackDecorator extends DataExtension {
|
||||
);
|
||||
}
|
||||
|
||||
function updateCMSFields(FieldList $fields) {
|
||||
function updateCMSFields($fields) {
|
||||
// Trackback URL field
|
||||
if($this->owner->TrackBacksEnabled()) {
|
||||
$trackbackURLTable = new ComplexTableField(
|
||||
|
@ -28,8 +28,8 @@ class ArchiveWidget extends Widget {
|
||||
|
||||
static $description = 'Show a list of months or years in which there are blog posts, and provide links to them.';
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$fields->merge(
|
||||
new FieldSet(
|
||||
|
@ -39,8 +39,8 @@ class RSSWidget extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$fields->merge(
|
||||
new FieldSet(
|
||||
|
@ -26,8 +26,8 @@ class TagCloudWidget extends Widget {
|
||||
|
||||
static $popularities = array( 'not-popular', 'not-very-popular', 'somewhat-popular', 'popular', 'very-popular', 'ultra-popular' );
|
||||
|
||||
function getCMSFields($params = null) {
|
||||
$fields = parent::getCMSFields($params);
|
||||
function getCMSFields() {
|
||||
$fields = parent::getCMSFields();
|
||||
|
||||
$fields->merge(
|
||||
new FieldSet(
|
||||
|
@ -60,7 +60,7 @@ class BlogTrackbackTest extends SapphireTest {
|
||||
$entry1 = $this->objFromFixture('BlogEntry', 'testpost');
|
||||
$entry1->doPublish();
|
||||
$this->assertEquals(2, $entry1->TrackBackURLs()->Count());
|
||||
$this->assertEquals(array('testGoodTrackbackURL' => 1), $entry1->TrackBackURLs()->map('URL', 'Pung')->toArray());
|
||||
$this->assertEquals(array('testGoodTrackbackURL' => 1), $entry1->TrackBackURLs()->map('URL', 'Pung'));
|
||||
|
||||
$entry2 = $this->objFromFixture('BlogEntry', 'testpost2');
|
||||
$entry2->doPublish();
|
||||
|
Loading…
Reference in New Issue
Block a user