This commit is contained in:
Naomi Guyer 2012-08-28 16:21:54 -07:00
commit 0f67303d01
19 changed files with 86 additions and 60 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.DS_Store

View File

@ -15,7 +15,7 @@ class BlogEntry extends Page {
static $can_be_root = false;
static $icon = "blog/images/blogpage";
static $icon = "blog/images/blogpage-file.png";
static $has_one = array();

View File

@ -12,7 +12,7 @@
* BlogHolders have a form on them for easy posting, and an owner that can post to them, BlogTrees don't
*/
class BlogHolder extends BlogTree implements PermissionProvider {
static $icon = "blog/images/blogholder";
static $icon = "blog/images/blogholder-file.png";
static $db = array(
'TrackBacksEnabled' => 'Boolean',
@ -34,9 +34,9 @@ class BlogHolder extends BlogTree implements PermissionProvider {
$fields = parent::getCMSFields();
SiteTree::enableCMSFieldsExtensions();
$fields->addFieldToTab('Root.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks'));
$fields->addFieldToTab('Root.Main', new DropdownField('OwnerID', 'Blog owner', array_merge(array('' => "(None)"), $blogOwners->map('ID', 'Name')->toArray())));
$fields->addFieldToTab('Root.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field'));
$fields->addFieldToTab('Root.Main', new CheckboxField('TrackBacksEnabled', 'Enable TrackBacks'), "Content");
$fields->addFieldToTab('Root.Main', new DropdownField('OwnerID', 'Blog owner', array_merge(array('' => "(None)"), $blogOwners->map('ID', 'Name')->toArray())), "Content");
$fields->addFieldToTab('Root.Main', new CheckboxField('AllowCustomAuthors', 'Allow non-admins to have a custom author field'), "Content");
$this->extend('updateCMSFields', $fields);

View File

@ -5,10 +5,13 @@
*/
/**
* Blog tree allows a tree of Blog Holders. Viewing branch nodes shows all blog entries from all blog holder children
* Blog tree is a way to group Blogs. It allows a tree of "Blog Holders".
* Viewing branch nodes shows all blog entries from all blog holder children
*/
class BlogTree extends Page {
static $icon = "blog/images/blogtree-file.png";
// Default number of blog entries to show
static $default_entries_limit = 10;
@ -31,6 +34,8 @@ class BlogTree extends Page {
'BlogTree', 'BlogHolder'
);
/*
* Finds the BlogTree object most related to the current page.
* - If this page is a BlogTree, use that
@ -96,7 +101,7 @@ class BlogTree extends Page {
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Main", new TextField("Name", "Name of blog"));
$fields->addFieldToTab("Root.Main", new TextField("Name", "Name of blog"), "Content");
$fields->addFieldToTab('Root.Main', new DropdownField('LandingPageFreshness', 'When you first open the blog, how many entries should I show', array(
"" => "All entries",
"1" => "Last month's entries",
@ -112,7 +117,7 @@ class BlogTree extends Page {
"11" => "Last 11 months' entries",
"12" => "Last year's entries",
"INHERIT" => "Take value from parent Blog Tree"
)));
)), "Content");
if(class_exists('WidgetArea')) {
$fields->addFieldToTab("Root.Widgets", new CheckboxField("InheritSideBar", 'Inherit Sidebar From Parent'));
$fields->addFieldToTab("Root.Widgets", new WidgetAreaEditor("SideBar"));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 297 B

BIN
images/blogholder-file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 189 B

BIN
images/blogpage-file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
images/blogtree-file.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -1,21 +1,21 @@
<% if DisplayMode == month %>
<ul class="archiveMonths">
<% control Dates %>
<% loop Dates %>
<li>
<a href="$Link">
$Date.Format(F) $Date.Year
</a>
</li>
<% end_control %>
<% end_loop %>
</ul>
<% else %>
<ul class="archiveYears">
<% control Dates %>
<% loop Dates %>
<li>
<a href="$Link">
$Date.Year<% if Last %><% else %>,<% end_if %>
$Date.Year<% if not Last %>,<% end_if %>
</a>
</li>
<% end_control %>
<% end_loop %>
</ul>
<% end_if %>

View File

@ -1,27 +1,41 @@
<% if BlogEntries.MoreThanOnePage %>
<div id="PageNumbers">
<p>
<% if BlogEntries.NotFirstPage %>
<a class="prev" href="$BlogEntries.PrevLink" title="View the previous page">Prev</a>
<div class="pagination">
<ul class="PageNumbers">
<% if BlogEntries.NotFirstPage %>
<li class="prev">
<a class="paginate-left" href="$BlogEntries.PrevLink" title="View the previous page">&lt;</a>
</li>
<% else %>
<li class="prev disabled">
<a class="paginate-left disabled">&lt;</a>
</li>
<% end_if %>
<% loop BlogEntries.PaginationSummary(4) %>
<% if CurrentBool %>
<li class="active"><a class="disabled">$PageNum</a></li>
<% else %>
<% if Link %>
<li>
<a class="<% if BeforeCurrent %>paginate-left<% else %>paginate-right<% end_if %>" href="$Link">
$PageNum
</a>
</li>
<% else %>
<li class="disabled"><a class="disabled">&hellip;</a></li>
<% end_if %>
<% end_if %>
<span>
<% control BlogEntries.PaginationSummary(4) %>
<% if CurrentBool %>
<span class="current">$PageNum</span>
<% else %>
<% if Link %>
<a href="$Link" title="View page number $PageNum">$PageNum</a>
<% else %>
&hellip;
<% end_if %>
<% end_if %>
<% end_control %>
</span>
<% if BlogEntries.NotLastPage %>
<a class="next" href="$BlogEntries.NextLink" title="View the next page">Next</a>
<% end_if %>
</p>
</div>
<% end_loop %>
<% if BlogEntries.NotLastPage %>
<li class="next">
<a class="next paginate-right" href="$BlogEntries.NextLink" title="View the next page">&gt;</a>
</li>
<% else %>
<li class="next disabled">
<a class="next paginate-right disabled">&gt;</a>
</li>
<% end_if %>
</ul>
</div>
<% end_if %>

View File

@ -4,9 +4,9 @@
<% if TagsCollection %>
<p class="tags">
Tags:
<% control TagsCollection %>
<a href="$Link" title="View all posts tagged '$Tag'" rel="tag">$Tag</a><% if Last %><% else %>,<% end_if %>
<% end_control %>
<% loop TagsCollection %>
<a href="$Link" title="View all posts tagged '$Tag'" rel="tag">$Tag</a><% if not Last %>,<% end_if %>
<% end_loop %>
</p>
<% end_if %>

View File

@ -1,5 +1,5 @@
<% if Level(2) %>
<div id="Breadcrumbs">
<p>$Breadcrumbs</p>
$Breadcrumbs
</div>
<% end_if %>

View File

@ -3,12 +3,12 @@
<% if TrackBacks %>
<ul id="TrackBacks">
<% control TrackBacks %>
<% loop TrackBacks %>
<li>
<a href="$Url"><% if Title %>$Title<% else %>$Url<% end_if %></a> <span class="date">on $Created.Nice</span>
<% if Excerpt %><p class="excerpt">$Excerpt</p><% end_if %>
</li>
<% end_control %>
<% end_loop %>
</ul>
<% else %>
<p>No TrackBacks have been submitted for this page.</p>

View File

@ -9,13 +9,11 @@
<p class="tags">
<% _t('TAGS', 'Tags:') %>
<% control TagsCollection %>
<a href="$Link" title="<% _t('VIEWALLPOSTTAGGED', 'View all posts tagged') %> '$Tag'" rel="tag">$Tag</a><% if Last %><% else %>,<% end_if %>
<a href="$Link" title="<% _t('VIEWALLPOSTTAGGED', 'View all posts tagged') %> '$Tag'" rel="tag">$Tag</a><% if not Last %>,<% end_if %>
<% end_control %>
</p>
<% end_if %>
$Content
<% end_if %>
$Content
</div>
<% if IsOwner %><p class="edit-post"><a href="$EditURL" id="editpost" title="<% _t('EDITTHIS', 'Edit this post') %>"><% _t('EDITTHIS', 'Edit this post') %></a> | <a href="$Link(unpublishPost)" id="unpublishpost"><% _t('UNPUBLISHTHIS', 'Unpublish this post') %></a></p><% end_if %>

View File

@ -5,17 +5,25 @@
<% include BreadCrumbs %>
<% if SelectedTag %>
<h3><% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'</h3>
<div class="selectedTag">
<em>
<% _t('VIEWINGTAGGED', 'Viewing entries tagged with') %> '$SelectedTag'
</em>
</div>
<% else_if SelectedDate %>
<h3><% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate</h3>
<div class="selectedTag">
<em>
<% _t('VIEWINGPOSTEDIN', 'Viewing entries posted in') %> $SelectedNiceDate
</em>
</div>
<% end_if %>
<% if BlogEntries %>
<% control BlogEntries %>
<% include BlogSummary %>
<% end_control %>
<% loop BlogEntries %>
<% include BlogSummary %>
<% end_loop %>
<% else %>
<h3><% _t('NOENTRIES', 'There are no blog entries') %></h3>
<h2><% _t('NOENTRIES', 'There are no blog entries') %></h2>
<% end_if %>
<% include BlogPagination %>

View File

@ -12,10 +12,10 @@
<% if BlogEntries %>
<% control BlogEntries %>
<% include BlogSummary %>
<% include BlogSummary %>
<% end_control %>
<% else %>
<h3><% _t('NOENTRIES', 'There are no blog entries') %></h3>
<h2><% _t('NOENTRIES', 'There are no blog entries') %></h2>
<% end_if %>
<% include BlogPagination %>

View File

@ -1,7 +1,7 @@
<ul>
<% control FeedItems %>
<% loop FeedItems %>
<li>
<a href="$Link">$Title</a>
</li>
<% end_control %>
<% end_loop %>
</ul>

View File

@ -1,5 +1,5 @@
<p class="tagcloud">
<% control TagsCollection %>
<% loop TagsCollection %>
<a href="$Link" class="$Class">$Tag</a>
<% end_control %>
<% end_loop %>
</p>