diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-21 21:43:13 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-04-21 21:43:13 +0000 |
commit | 3c3f717d3008c5bf4c22c53b5421d2f15bd87db5 (patch) | |
tree | d20a76367ed11d23ff34721d7c1619a0f8e9a4f8 | |
parent | 42063543808de7a57026610f267cbd0452ab8799 (diff) | |
download | elgg-3c3f717d3008c5bf4c22c53b5421d2f15bd87db5.tar.gz elgg-3c3f717d3008c5bf4c22c53b5421d2f15bd87db5.tar.bz2 |
Cleaned up code to show revisions.
Added ability to go to published revision.
git-svn-id: http://code.elgg.org/elgg/trunk@5841 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/blog/views/default/blog/sidebar_revisions.php | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/mod/blog/views/default/blog/sidebar_revisions.php b/mod/blog/views/default/blog/sidebar_revisions.php index f777316ec..7207d9c95 100644 --- a/mod/blog/views/default/blog/sidebar_revisions.php +++ b/mod/blog/views/default/blog/sidebar_revisions.php @@ -12,7 +12,6 @@ //If editing a post, show the previous revisions and drafts. $blog = isset($vars['entity']) ? $vars['entity'] : FALSE; - if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { $owner = $blog->getOwnerEntity(); $revisions = array(); @@ -34,10 +33,24 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { echo '<h3>' . elgg_echo('blog:revisions') . '</h3>'; $n = count($revisions); - echo '<ul class="blog_revisions">'; + $load_base_url = "{$vars['url']}pg/blog/{$owner->username}/edit/{$blog->getGUID()}/"; + // show the "published revision" + if ($blog->status == 'published') { + $load = elgg_view('output/url', array( + 'href' => $load_base_url, + 'text' => elgg_echo('load') + )); + + $time = friendly_time($blog->publish_date); + + echo '<li> + ' . elgg_echo('blog:status:published') . ": $time $load + </li>"; + } + foreach ($revisions as $revision) { $time = friendly_time($revision->time_created); $load = elgg_view('output/url', array( @@ -47,14 +60,13 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { if ($revision->name == 'blog_auto_save') { $name = elgg_echo('blog:auto_saved_revision'); - $text = "$name: $time $load"; - $class = 'class="auto_saved"'; } else { $name = elgg_echo('blog:revision') . " $n"; - $text = "$name: $time $load"; - $class = 'class="auto_saved"'; } + $text = "$name: $time $load"; + $class = 'class="auto_saved"'; + $n--; echo <<<___END |