diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-04 13:07:09 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-04 13:07:09 +0000 |
commit | 9bb7b4c8afddc734adfd2717d766d1711cf8127c (patch) | |
tree | 0140067d3c0f32ad29f5e379b9c9a5d86d1a7969 /mod/blog/views | |
parent | 4e80e365f054dea55bd481cbebd7af5fed7bb288 (diff) | |
download | elgg-9bb7b4c8afddc734adfd2717d766d1711cf8127c.tar.gz elgg-9bb7b4c8afddc734adfd2717d766d1711cf8127c.tar.bz2 |
blog sidebar html updates finished - uses modules!
git-svn-id: http://code.elgg.org/elgg/trunk@7526 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/blog/views')
-rw-r--r-- | mod/blog/views/default/blog/sidebar_edit.php | 61 | ||||
-rw-r--r-- | mod/blog/views/default/blog/sidebar_menu.php | 19 | ||||
-rw-r--r-- | mod/blog/views/default/blog/sidebar_revisions.php | 34 |
3 files changed, 26 insertions, 88 deletions
diff --git a/mod/blog/views/default/blog/sidebar_edit.php b/mod/blog/views/default/blog/sidebar_edit.php deleted file mode 100644 index 9b56f9a73..000000000 --- a/mod/blog/views/default/blog/sidebar_edit.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Blog sidebar menu for editing / creating a blog post. - * - * @package Blog - */ - -//If editing a post, show the previous revisions and drafts. -$blog_guid = isset($vars['blog_guid']) ? $vars['blog_guid'] : FALSE; -$blog = get_entity($blog_guid); - -if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { - $revisions = array(); - if ($auto_save_annotations = $blog->getAnnotations('blog_auto_save', 1)) { - $revisions[] = $auto_save_annotations[0]; - } - - // count(FALSE) == 1! AHHH!!! - if ($saved_revisions = $blog->getAnnotations('blog_revision', 10, 0, 'time_created DESC')) { - $revision_count = count($saved_revisions); - } else { - $revision_count = 0; - } - - $revisions = array_merge($revisions, $saved_revisions); -} - -if ($revisions) { - echo '<ul class="blog_revisions">'; - $load_base_url = "pg/blog/{$owner->username}/edit/{$blog->getGUID()}/"; - - foreach ($revisions as $revision) { - $time = elgg_view_friendly_time($revision->time_created); - $load = elgg_view('output/url', array( - 'href' => $load_base_url . $revision->id, - 'text' => elgg_echo('load') - )); - - - 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'); - $text = "$name: $time $load"; - $class = 'class="auto_saved"'; - - $revision_count--; - } - - echo <<<___END -<li $class> -$text -</li> - -___END; - } - - echo '</ul>'; -}
\ No newline at end of file diff --git a/mod/blog/views/default/blog/sidebar_menu.php b/mod/blog/views/default/blog/sidebar_menu.php index 87b0a8cf9..d6bd3e086 100644 --- a/mod/blog/views/default/blog/sidebar_menu.php +++ b/mod/blog/views/default/blog/sidebar_menu.php @@ -29,32 +29,31 @@ echo elgg_view("blogs/sidebar", array("object_type" => 'blog')); // fetch & display latest comments on all blog posts $comments = get_annotations(0, "object", "blog", "generic_comment", "", 0, 4, 0, "desc"); -echo elgg_view('annotation/latest_comments', array('comments' => $comments)); +$title = elgg_echo('generic_comments:latest'); +$body = elgg_view('annotation/latest_comments', array('comments' => $comments)); +echo elgg_view('layout_elements/module', array('title' => $title, 'body' => $body)); // only show archives for users or groups. // This is a limitation of the URL schema. -if ($page_owner) { +if ($page_owner && $vars['page'] != 'friends') { $dates = blog_get_blog_months($user); if ($dates) { - echo "<h3>" . elgg_echo('blog:archives') . "</h3>"; - echo '<ul class="blog_archives">'; + $title = elgg_echo('blog:archives'); + $content = '<ul class="blog_archives">'; foreach($dates as $date) { $date = $date->yearmonth; $timestamplow = mktime(0, 0, 0, substr($date,4,2) , 1, substr($date, 0, 4)); $timestamphigh = mktime(0, 0, 0, ((int) substr($date, 4, 2)) + 1, 1, substr($date, 0, 4)); - if (!isset($page_owner)) { - $page_owner = elgg_get_page_owner(); - } - $link = elgg_get_site_url() . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh; $month = elgg_echo('date:month:' . substr($date, 4, 2), array(substr($date, 0, 4))); - echo "<li><a href=\"$link\" title=\"$month\">$month</a></li>"; + $content .= "<li><a href=\"$link\" title=\"$month\">$month</a></li>"; } + $content .= '</ul>'; - echo '</ul>'; + echo elgg_view('layout_elements/module', array('title' => $title, 'body' => $content)); } // friends page lists all tags; mine lists owner's diff --git a/mod/blog/views/default/blog/sidebar_revisions.php b/mod/blog/views/default/blog/sidebar_revisions.php index ecc479812..fc5170ddc 100644 --- a/mod/blog/views/default/blog/sidebar_revisions.php +++ b/mod/blog/views/default/blog/sidebar_revisions.php @@ -6,18 +6,20 @@ */ //If editing a post, show the previous revisions and drafts. -$blog = isset($vars['entity']) ? $vars['entity'] : FALSE; +$blog = elgg_get_array_value('entity', $vars, FALSE); if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { $owner = $blog->getOwnerEntity(); $revisions = array(); - if ($auto_save_annotations = $blog->getAnnotations('blog_auto_save', 1)) { + $auto_save_annotations = $blog->getAnnotations('blog_auto_save', 1); + if ($auto_save_annotations) { $revisions[] = $auto_save_annotations[0]; } // count(FALSE) == 1! AHHH!!! - if ($saved_revisions = $blog->getAnnotations('blog_revision', 10, 0, 'time_created DESC')) { + $saved_revisions = $blog->getAnnotations('blog_revision', 10, 0, 'time_created DESC'); + if ($saved_revisions) { $revision_count = count($saved_revisions); } else { $revision_count = 0; @@ -26,10 +28,10 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { $revisions = array_merge($revisions, $saved_revisions); if ($revisions) { - echo '<h3>' . elgg_echo('blog:revisions') . '</h3>'; + $title = elgg_echo('blog:revisions'); $n = count($revisions); - echo '<ul class="blog_revisions">'; + $body = '<ul class="blog_revisions">'; $load_base_url = "pg/blog/{$owner->username}/edit/{$blog->getGUID()}/"; @@ -40,15 +42,16 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { 'text' => elgg_echo('blog:status:published') )); - $time = "<span class='entity-subtext'>".elgg_view_friendly_time($blog->publish_date)."</span>"; + $time = "<span class='entity-subtext'>" + . elgg_view_friendly_time($blog->publish_date) . "</span>"; - echo '<li> - ' . $load . ": $time - </li>"; + $body .= "<li>$load : $time</li>"; } foreach ($revisions as $revision) { - $time = "<span class='entity-subtext'>".elgg_view_friendly_time($revision->time_created)."</span>"; + $time = "<span class='entity-subtext'>" + . elgg_view_friendly_time($revision->time_created) . "</span>"; + if ($revision->name == 'blog_auto_save') { $revision_lang = elgg_echo('blog:auto_saved_revision'); } else { @@ -64,14 +67,11 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { $n--; - echo <<<___END -<li $class> -$text -</li> - -___END; + $body .= "<li $class>$text</li>"; } - echo '</ul>'; + $body .= '</ul>'; + + echo elgg_view('layout_elements/module', array('title' => $title, 'body' => $body)); } }
\ No newline at end of file |