mirror of
https://github.com/silverstripe/silverstripe-blog
synced 2024-10-22 11:05:58 +02:00
Fixed compatibility issues for SilverStripe 3.0
This commit is contained in:
parent
b91fdd0443
commit
a9c0b3dd76
@ -61,22 +61,22 @@ class BlogEntry extends Page {
|
|||||||
SiteTree::enableCMSFieldsExtensions();
|
SiteTree::enableCMSFieldsExtensions();
|
||||||
|
|
||||||
if(!self::$allow_wysiwyg_editing) {
|
if(!self::$allow_wysiwyg_editing) {
|
||||||
$fields->removeFieldFromTab("Root.Content.Main","Content");
|
$fields->removeFieldFromTab("Root.Main","Content");
|
||||||
$fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", _t("BlogEntry.CN", "Content"), 20));
|
$fields->addFieldToTab("Root.Main", new TextareaField("Content", _t("BlogEntry.CN", "Content"), 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields->addFieldToTab("Root.Content.Main", $dateField = new DatetimeField("Date", _t("BlogEntry.DT", "Date")),"Content");
|
$fields->addFieldToTab("Root.Main", $dateField = new DatetimeField("Date", _t("BlogEntry.DT", "Date")),"Content");
|
||||||
$dateField->getDateField()->setConfig('showcalendar', true);
|
$dateField->getDateField()->setConfig('showcalendar', true);
|
||||||
$dateField->getTimeField()->setConfig('showdropdown', true);
|
$dateField->getTimeField()->setConfig('showdropdown', true);
|
||||||
$fields->addFieldToTab("Root.Content.Main", new TextField("Author", _t("BlogEntry.AU", "Author"), $firstName),"Content");
|
$fields->addFieldToTab("Root.Main", new TextField("Author", _t("BlogEntry.AU", "Author"), $firstName),"Content");
|
||||||
|
|
||||||
if(!self::$allow_wysiwyg_editing) {
|
if(!self::$allow_wysiwyg_editing) {
|
||||||
$fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "<div id='BBCode' class='field'>" .
|
$fields->addFieldToTab("Root.Main", new LiteralField("BBCodeHelper", "<div id='BBCode' class='field'>" .
|
||||||
"<a id=\"BBCodeHint\" target='new'>" . _t("BlogEntry.BBH", "BBCode help") . "</a>" .
|
"<a id=\"BBCodeHint\" target='new'>" . _t("BlogEntry.BBH", "BBCode help") . "</a>" .
|
||||||
"<div id='BBTagsHolder' style='display:none;'>".$codeparser->useable_tagsHTML()."</div></div>"));
|
"<div id='BBTagsHolder' style='display:none;'>".$codeparser->useable_tagsHTML()."</div></div>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$fields->addFieldToTab("Root.Content.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")),"Content");
|
$fields->addFieldToTab("Root.Main", new TextField("Tags", _t("BlogEntry.TS", "Tags (comma sep.)")),"Content");
|
||||||
|
|
||||||
$this->extend('updateCMSFields', $fields);
|
$this->extend('updateCMSFields', $fields);
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ class BlogEntry extends Page {
|
|||||||
*/
|
*/
|
||||||
function TagsCollection() {
|
function TagsCollection() {
|
||||||
$tags = split(" *, *", trim($this->Tags));
|
$tags = split(" *, *", trim($this->Tags));
|
||||||
$output = new DataObjectSet();
|
$output = new ArrayList();
|
||||||
|
|
||||||
$link = $this->getParent() ? $this->getParent()->Link('tag') : '';
|
$link = $this->getParent() ? $this->getParent()->Link('tag') : '';
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
SiteTree::enableCMSFieldsExtensions();
|
SiteTree::enableCMSFieldsExtensions();
|
||||||
|
|
||||||
$fields->addFieldToTab('Root.Content.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks'));
|
$fields->addFieldToTab('Root.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks'));
|
||||||
$fields->addFieldToTab('Root.Content.Main', new DropdownField('OwnerID', 'Blog owner', $blogOwners->toDropDownMap('ID', 'Name', 'None')));
|
$fields->addFieldToTab('Root.Main', new DropdownField('OwnerID', 'Blog owner', $blogOwners->map('ID', 'Name')));
|
||||||
$fields->addFieldToTab('Root.Content.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field'));
|
$fields->addFieldToTab('Root.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field'));
|
||||||
|
|
||||||
$this->extend('updateCMSFields', $fields);
|
$this->extend('updateCMSFields', $fields);
|
||||||
|
|
||||||
@ -50,8 +50,8 @@ class BlogHolder extends BlogTree implements PermissionProvider {
|
|||||||
$adminMembers = Permission::get_members_by_permission('ADMIN');
|
$adminMembers = Permission::get_members_by_permission('ADMIN');
|
||||||
$blogOwners = Permission::get_members_by_permission('BLOGMANAGEMENT');
|
$blogOwners = Permission::get_members_by_permission('BLOGMANAGEMENT');
|
||||||
|
|
||||||
if(!$adminMembers) $adminMembers = new DataObjectSet();
|
if(!$adminMembers) $adminMembers = new ArrayList();
|
||||||
if(!$blogOwners) $blogOwners = new DataObjectSet();
|
if(!$blogOwners) $blogOwners = new ArrayList();
|
||||||
|
|
||||||
$blogOwners->merge($adminMembers);
|
$blogOwners->merge($adminMembers);
|
||||||
$blogOwners->sort($sort, $direction);
|
$blogOwners->sort($sort, $direction);
|
||||||
|
@ -95,8 +95,8 @@ class BlogTree extends Page {
|
|||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields() {
|
||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
$fields->addFieldToTab("Root.Content.Main", new TextField("Name", "Name of blog"));
|
$fields->addFieldToTab("Root.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(
|
$fields->addFieldToTab('Root.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array(
|
||||||
"" => "All entries",
|
"" => "All entries",
|
||||||
"1 MONTH" => "Last month's entries",
|
"1 MONTH" => "Last month's entries",
|
||||||
"2 MONTH" => "Last 2 months' entries",
|
"2 MONTH" => "Last 2 months' entries",
|
||||||
@ -113,8 +113,8 @@ class BlogTree extends Page {
|
|||||||
"INHERIT" => "Take value from parent Blog Tree"
|
"INHERIT" => "Take value from parent Blog Tree"
|
||||||
)));
|
)));
|
||||||
|
|
||||||
$fields->addFieldToTab("Root.Content.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
|
$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
|
||||||
$fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar"));
|
$fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
@ -149,7 +149,7 @@ class BlogTree extends Page {
|
|||||||
* @param string date Only get blog entries on this date - either a year, or a year-month eg '2008' or '2008-02'
|
* @param string date Only get blog entries on this date - either a year, or a year-month eg '2008' or '2008-02'
|
||||||
* @param callback retrieveCallback A function to call with pagetype, filter and limit for custom blog sorting or filtering
|
* @param callback retrieveCallback A function to call with pagetype, filter and limit for custom blog sorting or filtering
|
||||||
* @param string $where
|
* @param string $where
|
||||||
* @return DataObjectSet
|
* @return DataList
|
||||||
*/
|
*/
|
||||||
public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null, $filter = '') {
|
public function Entries($limit = '', $tag = '', $date = '', $retrieveCallback = null, $filter = '') {
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ class TrackBackDecorator extends DataObjectDecorator {
|
|||||||
'',
|
'',
|
||||||
'ID'
|
'ID'
|
||||||
);
|
);
|
||||||
$fields->addFieldToTab("Root.Content.Main", $trackbackURLTable);
|
$fields->addFieldToTab("Root.Main", $trackbackURLTable);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$fields->addFieldToTab("Root.Content.Main", new ReadonlyField("TrackBackURLsReadOnly", _t("BlogEntry.TrackbackURLs", "Trackback URLs"), _t("BlogEntry.TrackbackURLs_DISABLED", "To use this feature, please check 'Enable TrackBacks' check box on the blog holder.")));
|
$fields->addFieldToTab("Root.Main", new ReadonlyField("TrackBackURLsReadOnly", _t("BlogEntry.TrackbackURLs", "Trackback URLs"), _t("BlogEntry.TrackbackURLs_DISABLED", "To use this feature, please check 'Enable TrackBacks' check box on the blog holder.")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class TypoImport extends Controller {
|
|||||||
$Ccreated_at = $row2[8];
|
$Ccreated_at = $row2[8];
|
||||||
|
|
||||||
// put the typo blog comment in the SS database
|
// put the typo blog comment in the SS database
|
||||||
$newCEntry = new PageComment();
|
$newCEntry = new Comment();
|
||||||
$newCEntry->Name = $Cauthor;
|
$newCEntry->Name = $Cauthor;
|
||||||
$newCEntry->Comment = $comment;
|
$newCEntry->Comment = $comment;
|
||||||
$newCEntry->Created = $created_at;
|
$newCEntry->Created = $created_at;
|
||||||
@ -129,17 +129,17 @@ class TypoImport extends Controller {
|
|||||||
pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"™\", \"™\")");
|
pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"™\", \"™\")");
|
||||||
pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"&\", \"&\")");
|
pg_query($dbconn, "UPDATE SiteTree SET Content = REPLACE(Content, \"&\", \"&\")");
|
||||||
|
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"×\", \"x\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"×\", \"x\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"’\", \"’\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"’\", \"’\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"‘\", \"‘\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"‘\", \"‘\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"—\", \"—\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"—\", \"—\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"“\", \"“\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"“\", \"“\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"”\", \"”\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"”\", \"”\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"–\", \"–\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"–\", \"–\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"—\", \"—\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"—\", \"—\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"…\", \"…\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"…\", \"…\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"™\", \"™\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"™\", \"™\")");
|
||||||
pg_query($dbconn, "UPDATE PageComment SET Comment = REPLACE(Comment, \"&\", \"&\")");
|
pg_query($dbconn, "UPDATE Comment SET Comment = REPLACE(Comment, \"&\", \"&\")");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ class ArchiveWidget extends Widget {
|
|||||||
function Dates() {
|
function Dates() {
|
||||||
Requirements::themedCSS('archivewidget');
|
Requirements::themedCSS('archivewidget');
|
||||||
|
|
||||||
$results = new DataObjectSet();
|
$results = new ArrayList();
|
||||||
$container = BlogTree::current();
|
$container = BlogTree::current();
|
||||||
$ids = $container->BlogHolderIDs();
|
$ids = $container->BlogHolderIDs();
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class BlogManagementWidget extends Widget implements PermissionProvider {
|
|||||||
static $description = "Provide a number of links useful for administering a blog. Only shown if the user is an admin.";
|
static $description = "Provide a number of links useful for administering a blog. Only shown if the user is an admin.";
|
||||||
|
|
||||||
function CommentText() {
|
function CommentText() {
|
||||||
$unmoderatedcount = DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"NeedsModeration\"=1")->value();
|
$unmoderatedcount = DB::query("SELECT COUNT(*) FROM \"Comment\" WHERE \"NeedsModeration\"=1")->value();
|
||||||
if($unmoderatedcount == 1) {
|
if($unmoderatedcount == 1) {
|
||||||
return _t("BlogManagementWidget.UNM1", "You have 1 unmoderated comment");
|
return _t("BlogManagementWidget.UNM1", "You have 1 unmoderated comment");
|
||||||
} else if($unmoderatedcount > 1) {
|
} else if($unmoderatedcount > 1) {
|
||||||
@ -35,7 +35,7 @@ class BlogManagementWidget extends Widget implements PermissionProvider {
|
|||||||
if(!Permission::check('BLOGMANAGEMENT')) {
|
if(!Permission::check('BLOGMANAGEMENT')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$unmoderatedcount = DB::query("SELECT COUNT(*) FROM \"PageComment\" WHERE \"NeedsModeration\"=1")->value();
|
$unmoderatedcount = DB::query("SELECT COUNT(*) FROM \"Comment\" WHERE \"NeedsModeration\"=1")->value();
|
||||||
|
|
||||||
if($unmoderatedcount > 0) {
|
if($unmoderatedcount > 0) {
|
||||||
return "admin/comments/unmoderated";
|
return "admin/comments/unmoderated";
|
||||||
|
@ -59,7 +59,7 @@ class RSSWidget extends Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function FeedItems() {
|
function FeedItems() {
|
||||||
$output = new DataObjectSet();
|
$output = new ArrayList();
|
||||||
|
|
||||||
// Protection against infinite loops when an RSS widget pointing to this page is added to this page
|
// Protection against infinite loops when an RSS widget pointing to this page is added to this page
|
||||||
if(stristr($_SERVER['HTTP_USER_AGENT'], 'SimplePie')) {
|
if(stristr($_SERVER['HTTP_USER_AGENT'], 'SimplePie')) {
|
||||||
|
@ -105,7 +105,7 @@ class TagCloudWidget extends Widget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = new DataObjectSet();
|
$output = new ArrayList();
|
||||||
foreach($allTags as $tag => $fields) {
|
foreach($allTags as $tag => $fields) {
|
||||||
$output->push(new ArrayData($fields));
|
$output->push(new ArrayData($fields));
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ class BlogHolderTest extends SapphireTest {
|
|||||||
|
|
||||||
function testBlogOwners() {
|
function testBlogOwners() {
|
||||||
$mainblog = $this->objFromFixture('BlogHolder', 'mainblog');
|
$mainblog = $this->objFromFixture('BlogHolder', 'mainblog');
|
||||||
$actualMembers = array_values($mainblog->blogOwners()->toDropDownMap('ID', 'Name'));
|
$actualMembers = array_values($mainblog->blogOwners()->map('ID', 'Name'));
|
||||||
$expectedMembers = array(
|
$expectedMembers = array(
|
||||||
'ADMIN User', // test default admin
|
'ADMIN User', // test default admin
|
||||||
'Admin One',
|
'Admin One',
|
||||||
|
Loading…
Reference in New Issue
Block a user