Permalink
Browse files

Created 0.2.1-rc1 release

  • Loading branch information...
1 parent fc60f70 commit b7293651ed15b615234e87ac5fe0d980ea62fae3 @sminnee sminnee committed Jul 7, 2009
Showing with 2,852 additions and 0 deletions.
  1. +42 −0 0.2.1-rc1/ChangeLog
  2. +15 −0 0.2.1-rc1/README
  3. +3 −0 0.2.1-rc1/_config.php
  4. +92 −0 0.2.1-rc1/code/ArchiveWidget.php
  5. +216 −0 0.2.1-rc1/code/BlogEntry.php
  6. +381 −0 0.2.1-rc1/code/BlogHolder.php
  7. +56 −0 0.2.1-rc1/code/BlogManagementWidget.php
  8. +75 −0 0.2.1-rc1/code/RSSWidget.php
  9. +52 −0 0.2.1-rc1/code/SubscribeRSSWidget.php
  10. +158 −0 0.2.1-rc1/code/TagCloudWidget.php
  11. +53 −0 0.2.1-rc1/code/TrackBackDecorator.php
  12. +16 −0 0.2.1-rc1/code/TrackBackPing.php
  13. +152 −0 0.2.1-rc1/code/import/TypoImport.php
  14. +9 −0 0.2.1-rc1/css/archivewidget.css
  15. +32 −0 0.2.1-rc1/css/bbcodehelp.css
  16. +11 −0 0.2.1-rc1/css/blog.css
  17. +3 −0 0.2.1-rc1/css/flickrwidget.css
  18. +4 −0 0.2.1-rc1/css/subscribersswidget.css
  19. +6 −0 0.2.1-rc1/css/tagcloud.css
  20. BIN 0.2.1-rc1/images/blogholder-file.gif
  21. BIN 0.2.1-rc1/images/blogpage-file.gif
  22. BIN 0.2.1-rc1/images/feed-icon-14x14.png
  23. BIN 0.2.1-rc1/images/feed-icon-28x28.png
  24. +12 −0 0.2.1-rc1/javascript/bbcodehelp.js
  25. 0 0.2.1-rc1/lang/_manifest_exclude
  26. +62 −0 0.2.1-rc1/lang/ar_SA.php
  27. +62 −0 0.2.1-rc1/lang/bg_BG.php
  28. +61 −0 0.2.1-rc1/lang/da_DK.php
  29. +61 −0 0.2.1-rc1/lang/de_DE.php
  30. +62 −0 0.2.1-rc1/lang/en_GB.php
  31. +119 −0 0.2.1-rc1/lang/en_US.php
  32. +20 −0 0.2.1-rc1/lang/es_419.php
  33. +39 −0 0.2.1-rc1/lang/es_ES.php
  34. +62 −0 0.2.1-rc1/lang/es_MX.php
  35. +62 −0 0.2.1-rc1/lang/et_EE.php
  36. +62 −0 0.2.1-rc1/lang/fr_FR.php
  37. +56 −0 0.2.1-rc1/lang/hr_HR.php
  38. +63 −0 0.2.1-rc1/lang/is_IS.php
  39. +32 −0 0.2.1-rc1/lang/it_IT.php
  40. +37 −0 0.2.1-rc1/lang/nl_NL.php
  41. +62 −0 0.2.1-rc1/lang/pl_PL.php
  42. +40 −0 0.2.1-rc1/lang/pt_PT.php
  43. +62 −0 0.2.1-rc1/lang/ru_RU.php
  44. +58 −0 0.2.1-rc1/lang/sr_RS.php
  45. +62 −0 0.2.1-rc1/lang/tr_TR.php
  46. +21 −0 0.2.1-rc1/templates/ArchiveWidget.ss
  47. +5 −0 0.2.1-rc1/templates/BlogManagementWidget.ss
  48. +27 −0 0.2.1-rc1/templates/Includes/BlogPagination.ss
  49. +3 −0 0.2.1-rc1/templates/Includes/BlogSideBar.ss
  50. +14 −0 0.2.1-rc1/templates/Includes/BlogSummary.ss
  51. +20 −0 0.2.1-rc1/templates/Includes/TrackBacks.ss
  52. +30 −0 0.2.1-rc1/templates/Layout/BlogEntry.ss
  53. +21 −0 0.2.1-rc1/templates/Layout/BlogHolder.ss
  54. +7 −0 0.2.1-rc1/templates/RSSWidget.ss
  55. +5 −0 0.2.1-rc1/templates/SubscribeRSSWidget.ss
  56. +5 −0 0.2.1-rc1/templates/TagCloudWidget.ss
  57. +5 −0 0.2.1-rc1/templates/TrackBackPingReturn.ss
  58. +3 −0 0.2.1-rc1/templates/TrackBackRdf.ss
  59. +49 −0 0.2.1-rc1/tests/BlogHolderFunctionalTest.php
  60. +20 −0 0.2.1-rc1/tests/BlogHolderFunctionalTest.yml
  61. +57 −0 0.2.1-rc1/tests/BlogHolderTest.php
  62. +28 −0 0.2.1-rc1/tests/BlogTest.yml
View
@@ -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
View
@@ -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
+
+
View
@@ -0,0 +1,3 @@
+<?php
+
+?>
@@ -0,0 +1,92 @@
+<?php
+/**
+ * Shows a widget with viewing blog entries
+ * by months or years.
+ *
+ * @package blog
+ */
+class ArchiveWidget extends Widget {
+ static $db = array(
+ 'DisplayMode' => 'Varchar'
+ );
+
+ static $defaults = array(
+ 'DisplayMode' => 'month'
+ );
+
+ static $title = 'Browse by Date';
+
+ static $cmsTitle = 'Blog Archive';
+
+ static $description = 'Show a list of months or years in which there are blog posts, and provide links to them.';
+
+ function getBlogHolder() {
+ $page = Director::currentPage();
+
+ if($page instanceof BlogHolder) {
+ return $page;
+ } elseif(($page instanceof BlogEntry) && ($page->getParent() instanceof BlogHolder)) {
+ return $page->getParent();
+ } else {
+ return DataObject::get_one('BlogHolder');
+ }
+ }
+
+ function getCMSFields() {
+ return new FieldSet(
+ new OptionsetField(
+ 'DisplayMode',
+ _t('ArchiveWidget.DispBY', 'Display by'),
+ array(
+ 'month' => _t('ArchiveWidget.MONTH', 'month'),
+ 'year' => _t('ArchiveWidget.YEAR', 'year')
+ )
+ )
+ );
+ }
+
+ function Dates() {
+ Requirements::themedCSS('archivewidget');
+
+ $results = new DataObjectSet();
+ $blogHolder = $this->getBlogHolder();
+ $id = $blogHolder->ID;
+
+ $stage = Versioned::current_stage();
+ $suffix = (!$stage || $stage == 'Stage') ? "" : "_$stage";
+
+
+ if($this->DisplayMode == 'month') {
+ $sqlResults = DB::query("SELECT DISTINCT MONTH(`Date`) AS `Month`, YEAR(`Date`) AS `Year` FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` WHERE `ParentID` = $id ORDER BY `Date` DESC");
+ } else {
+ $sqlResults = DB::query("SELECT DISTINCT YEAR(`Date`) AS `Year` FROM `SiteTree$suffix` NATURAL JOIN `BlogEntry$suffix` WHERE `ParentID` = $id ORDER BY `Date` DESC");
+ }
+
+ if(!$sqlResults) return new DataObjectSet();
+
+ foreach($sqlResults as $sqlResult) {
+ $date = new Date('Date');
+ $month = ($this->DisplayMode == 'month') ? (int)$sqlResult['Month'] : 1;
+
+ $date->setValue(array(
+ 'Day' => 1,
+ 'Month' => $month,
+ 'Year' => (int) $sqlResult['Year']
+ ));
+
+ if($this->DisplayMode == 'month') {
+ $link = $blogHolder->Link() . $sqlResult['Year']. '/' . sprintf("%'02d", $sqlResult['Month']);
+ } else {
+ $link = $blogHolder->Link() . $sqlResult['Year'];
+ }
+
+ $results->push(new ArrayData(array(
+ 'Date' => $date,
+ 'Link' => $link
+ )));
+ }
+
+ return $results;
+ }
+}
+?>
@@ -0,0 +1,216 @@
+<?php
+/**
+ * An individual blog entry page type.
+ *
+ * @package blog
+ */
+class BlogEntry extends Page {
+
+ static $default_parent = 'BlogHolder';
+
+ static $can_be_root = false;
+
+ static $icon = "blog/images/blogpage";
+
+ static $db = array(
+ "Date" => "SSDatetime",
+ "Author" => "Text",
+ "Tags" => "Text"
+ );
+
+ static $has_one = array(
+ );
+
+ static $has_many = array(
+ );
+
+ static $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 = false;
+
+ /**
+ * 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();
+
+ $fields = parent::getCMSFields();
+
+ 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", new PopupDateTimeField("Date", _t("BlogEntry.DT", "Date")),"Content");
+ $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");
+ return $fields;
+ }
+
+ /**
+ * Returns the tags added to this blog entry
+ */
+ function TagsCollection() {
+ $tags = split(" *, *", trim($this->Tags));
+ $output = new DataObjectSet();
+
+ foreach($tags as $tag) {
+ $output->push(new ArrayData(array(
+ 'Tag' => $tag,
+ 'Link' => $this->getParent()->Link() . 'tag/' . 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()) {
+ return $this->extInstance('TrackBackDecorator')->trackbackping();
+ } else {
+ Director::redirect($this->Link());
+ }
+ }
+
+ /**
+ * 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(
+ 'trackbackping',
+ 'unpublishPost',
+ 'PageComments'
+ );
+
+ function init() {
+ parent::init();
+
+ Requirements::themedCSS('blog');
+ }
+
+ /**
+ * Gets a link to unpublish the blog entry
+ */
+ function unpublishPost() {
+ if(!Permission::check('ADMIN')) {
+ 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());
+ }
+ }
+
+}
+?>
Oops, something went wrong.

0 comments on commit b729365

Please sign in to comment.