Skip to content

Commit

Permalink
Created 0.4.0-rc1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Barberis committed Mar 18, 2010
1 parent af61e6b commit 84af09c
Show file tree
Hide file tree
Showing 70 changed files with 9,462 additions and 0 deletions.
42 changes: 42 additions & 0 deletions 0.4.0-rc1/ChangeLog
@@ -0,0 +1,42 @@
ChangeLog

0.2.0

Features
- Blogs can now be configured to use HTML instead of BBCode
- Tags now follow the rel-tag microformat standard
- Blog module is now translatable
- The entries shown on the BlogHolder when not browsing by date/tag can now be restricted to only show entries that are younger than a user specified age
- The RSS feed name can now be changed in the CMS
- Added support for receiving trackback pings
- Added SubscribeRSSWidget for linking directly to the blog RSS feed
- Tag widget title is now editable
- Added empty relationship statics so BlogEntry and BlogHolder can be decorated by a DataObjectDecorator
- Use pagination summary, so a full list of pages isnt generated
- Added Date variable to RSSWidget feed items, so Date can be used in template if wanted
- Cast Title variable on RSSWidget feed items, so Title can have Text functions called in the template if wanted

Bugfixes
- Removed deprecated calls to sapphire, and made other fixes to support sapphire 2.3.0
- Don't use PHP short tags
- Don't display $Content on a BlogHolder, as it isnt editable in the CMS
- Prevent infinite loops when an RSSWidget on a blog points to itself
- Fix URL segment generation
- RSS feed is now sorted by date, newest first
- Fixed pagination
- Fixed summaries on BlogHolder
- Fixed issues with display by month when blog post is on last month of the day
- BlogEntry::Tags() was renamed to TagsCollection() to prevent conflicts with the database fields called Tags
- Fixed invalid use of single quotes in BlogEntryForm HTML
- Fixed extra <p> tags around blog content
- Default parent needs to be a string instead of an array
- Fixed escaping in BlogHolder
- Use themedCSS instead of hardlinking paths
- Fixed rss feed caching
- Fixed archive widget showing months and years for unpublished posts
- SetDate doesn't need to be called, as the date is automatically set


0.1

Initial release
15 changes: 15 additions & 0 deletions 0.4.0-rc1/README
@@ -0,0 +1,15 @@
####################################################
Blog Module
####################################################

# Maintainer Contact
Andrew O'Neil (Nickname: aoneil)
<andrew (at) silverstripe (dot) com>

# Requirements
SilverStripe minimum version 2.3.0

# Documentation
http://doc.silverstripe.com/doku.php?id=modules:blog


7 changes: 7 additions & 0 deletions 0.4.0-rc1/_config.php
@@ -0,0 +1,7 @@
<?php

Director::addRules(10, array(
'metaweblog' => 'MetaWeblogController'
));

?>
232 changes: 232 additions & 0 deletions 0.4.0-rc1/code/BlogEntry.php
@@ -0,0 +1,232 @@
<?php
/**
* An individual blog entry page type.
*
* @package blog
*/
class BlogEntry extends Page {
static $db = array(
"Date" => "Datetime",
"Author" => "Text",
"Tags" => "Text"
);

static $default_parent = 'BlogHolder';

static $can_be_root = false;

static $icon = "blog/images/blogpage";

static $has_one = array();

static $has_many = array();

static $many_many = array();

static $belongs_many_many = array();

static $defaults = array(
"ProvideComments" => true,
'ShowInMenus' => false
);

static $extensions = array(
'Hierarchy',
'TrackBackDecorator',
"Versioned('Stage', 'Live')"
);

/**
* Is WYSIWYG editing allowed?
* @var boolean
*/
static $allow_wysiwyg_editing = true;

/**
* Is WYSIWYG editing enabled?
* Used in templates.
*
* @return boolean
*/
public function IsWYSIWYGEnabled() {
return self::$allow_wysiwyg_editing;
}

/**
* Overload so that the default date is today.
*/
public function populateDefaults(){
parent::populateDefaults();

$this->setField('Date', date('Y-m-d H:i:s', strtotime('now')));
}

function getCMSFields() {
Requirements::javascript('blog/javascript/bbcodehelp.js');
Requirements::themedCSS('bbcodehelp');

$firstName = Member::currentUser() ? Member::currentUser()->FirstName : '';
$codeparser = new BBCodeParser();

SiteTree::disableCMSFieldsExtensions();
$fields = parent::getCMSFields();
SiteTree::enableCMSFieldsExtensions();

if(!self::$allow_wysiwyg_editing) {
$fields->removeFieldFromTab("Root.Content.Main","Content");
$fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", _t("BlogEntry.CN", "Content"), 20));
}

$fields->addFieldToTab("Root.Content.Main", $dateField = new DatetimeField("Date", _t("BlogEntry.DT", "Date")),"Content");
$dateField->getDateField()->setConfig('showcalendar', true);
$dateField->getTimeField()->setConfig('showdropdown', true);
$fields->addFieldToTab("Root.Content.Main", new TextField("Author", _t("BlogEntry.AU", "Author"), $firstName),"Content");

if(!self::$allow_wysiwyg_editing) {
$fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "<div id='BBCode' class='field'>" .
"<a id=\"BBCodeHint\" target='new'>" . _t("BlogEntry.BBH", "BBCode help") . "</a>" .
"<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");

$this->extend('updateCMSFields', $fields);

return $fields;
}

/**
* Returns the tags added to this blog entry
*/
function TagsCollection() {
$tags = split(" *, *", trim($this->Tags));
$output = new DataObjectSet();

$link = $this->getParent() ? $this->getParent()->Link('tag') : '';

foreach($tags as $tag) {
$output->push(new ArrayData(array(
'Tag' => $tag,
'Link' => $link . '/' . urlencode($tag),
'URLTag' => urlencode($tag)
)));
}

if($this->Tags) {
return $output;
}
}

/**
* Get the sidebar from the BlogHolder.
*/
function SideBar() {
return $this->getParent()->SideBar();
}

/**
* Get a bbcode parsed summary of the blog entry
*/
function ParagraphSummary(){
if(self::$allow_wysiwyg_editing) {
return $this->obj('Content')->FirstParagraph('html');
} else {
$parser = new BBCodeParser($this->Content);
$html = new HTMLText('Content');
$html->setValue($parser->parse());
return $html->FirstParagraph('html');
}
}

/**
* Get the bbcode parsed content
*/
function ParsedContent() {
if(self::$allow_wysiwyg_editing) {
return $this->obj('Content');
} else {
$parser = new BBCodeParser($this->Content);
$content = new Text('Content');
$content->value = $parser->parse();

return $content;
}
}

/**
* Link for editing this blog entry
*/
function EditURL() {
return $this->getParent()->Link('post') . '/' . $this->ID . '/';
}

/**
* Check to see if trackbacks are enabled.
*/
function TrackBacksEnabled() {
return $this->getParent()->TrackBacksEnabled;
}

function trackbackping() {
if($this->TrackBacksEnabled() && $this->hasExtension('TrackBackDecorator')) {
return $this->decoratedTrackbackping();
} else {
Director::redirect($this->Link());
}
}

function IsOwner() {
if(method_exists($this->Parent(), 'IsOwner')) {
return $this->Parent()->IsOwner();
}
}

/**
* Call this to enable WYSIWYG editing on your blog entries.
* By default the blog uses BBCode
*/
static function allow_wysiwyg_editing() {
self::$allow_wysiwyg_editing = true;
}
}

class BlogEntry_Controller extends Page_Controller {
static $allowed_actions = array(
'index',
'trackbackping',
'unpublishPost',
'PageComments',
'SearchForm'
);

function init() {
parent::init();

Requirements::themedCSS('blog');
}

/**
* Gets a link to unpublish the blog entry
*/
function unpublishPost() {
if(!$this->IsOwner()) {
Security::permissionFailure(
$this,
'Unpublishing blogs is an administrator task. Please log in.'
);
} else {
$SQL_id = (int) $this->ID;

$page = DataObject::get_by_id('SiteTree', $SQL_id);
$page->deleteFromStage('Live');
$page->flushCache();

$page = DataObject::get_by_id('SiteTree', $SQL_id);
$page->Status = 'Unpublished';

Director::redirect($this->getParent()->Link());
}
}

}
?>

0 comments on commit 84af09c

Please sign in to comment.