From 9bb7b4c8afddc734adfd2717d766d1711cf8127c Mon Sep 17 00:00:00 2001 From: cash Date: Sat, 4 Dec 2010 13:07:09 +0000 Subject: blog sidebar html updates finished - uses modules! git-svn-id: http://code.elgg.org/elgg/trunk@7526 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/views/default/blog/sidebar_edit.php | 61 ----------------------- mod/blog/views/default/blog/sidebar_menu.php | 19 ++++--- mod/blog/views/default/blog/sidebar_revisions.php | 34 ++++++------- views/default/annotation/latest_comments.php | 8 +-- views/default/css/screen.php | 4 +- views/default/layout_elements/module.php | 55 ++++++++++++++++++++ views/default/layouts/module.php | 44 ---------------- views/default/output/tagcloud.php | 44 ++++++++-------- 8 files changed, 109 insertions(+), 160 deletions(-) delete mode 100644 mod/blog/views/default/blog/sidebar_edit.php create mode 100644 views/default/layout_elements/module.php delete mode 100644 views/default/layouts/module.php 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 @@ -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 ''; -} \ 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 "

" . elgg_echo('blog:archives') . "

"; - echo ''; + 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 '

' . elgg_echo('blog:revisions') . '

'; + $title = elgg_echo('blog:revisions'); $n = count($revisions); - echo ''; + + echo elgg_view('layout_elements/module', array('title' => $title, 'body' => $body)); } } \ No newline at end of file diff --git a/views/default/annotation/latest_comments.php b/views/default/annotation/latest_comments.php index a43ec4fee..d603a3830 100644 --- a/views/default/annotation/latest_comments.php +++ b/views/default/annotation/latest_comments.php @@ -1,12 +1,12 @@ " . elgg_echo('generic_comments:latest') . ""; - foreach($vars['comments'] as $comment){ + //echo "

" . elgg_echo('generic_comments:latest') . "

"; + foreach ($vars['comments'] as $comment) { //grab the entity the comment is on $entity = get_entity($comment->entity_guid); //comment owner diff --git a/views/default/css/screen.php b/views/default/css/screen.php index 18e4a0bad..a33586aa7 100644 --- a/views/default/css/screen.php +++ b/views/default/css/screen.php @@ -207,14 +207,14 @@ h2 { background-position: -250px top; text-indent: -1000em; } -.tags { +.elgg-tags { background-image:url(_graphics/elgg_sprites.png); background-repeat: no-repeat; background-position: left -196px; padding:1px 0 0 14px; font-size: 85%; } -.tagcloud { +.elgg-tagcloud { text-align:justify; } .ajax-loader { diff --git a/views/default/layout_elements/module.php b/views/default/layout_elements/module.php new file mode 100644 index 000000000..46ddcfbfd --- /dev/null +++ b/views/default/layout_elements/module.php @@ -0,0 +1,55 @@ +

$title

"; +//if ($header) { +// $header = "
$header
"; +//} + +$body_class = 'elgg-body'; +$additional_class = elgg_get_array_value('body_class', $vars, ''); +if ($additional_class) { + $body_class = "$body_class $additional_class"; +} +$body = "
$body
"; + + +if ($footer) { + $footer = "
$footer
"; +} + +echo << +
+ $header + $body + $footer +
+ +HTML; diff --git a/views/default/layouts/module.php b/views/default/layouts/module.php deleted file mode 100644 index db940aedc..000000000 --- a/views/default/layouts/module.php +++ /dev/null @@ -1,44 +0,0 @@ -$header"; -} - -if ($footer) { - $footer = "
$footer
"; -} - -echo << -
- $header -
$body
- $footer -
- -HTML; diff --git a/views/default/output/tagcloud.php b/views/default/output/tagcloud.php index d28fbf05f..b0737c6f1 100644 --- a/views/default/output/tagcloud.php +++ b/views/default/output/tagcloud.php @@ -31,26 +31,18 @@ if (empty($vars['tagcloud']) && !empty($vars['value'])) { if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) { $counter = 0; - $cloud = "
"; $max = 0; - if ($context != 'tags') { - $title = elgg_echo('tagcloud'); - $cloud .= "

$title

"; - } - - $cloud .= '
'; - - foreach($vars['tagcloud'] as $tag) { + foreach ($vars['tagcloud'] as $tag) { if ($tag->total > $max) { $max = $tag->total; } } - $list = ''; - foreach($vars['tagcloud'] as $tag) { - if ($list != '') { - $list .= ', '; + $cloud = ''; + foreach ($vars['tagcloud'] as $tag) { + if ($cloud != '') { + $cloud .= ', '; } // protecting against division by zero warnings $size = round((log($tag->total) / log($max + .0001)) * 100) + 30; @@ -58,18 +50,26 @@ if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) { $size = 100; } $url = elgg_get_site_url()."pg/search/?q=". urlencode($tag->tag) . "&search_type=tags$type$subtype"; - $list .= "tag)." ($tag->total)\" style=\"text-decoration:none;\">" . htmlspecialchars($tag->tag, ENT_QUOTES, 'UTF-8') . ""; + $cloud .= "tag)." ($tag->total)\" style=\"text-decoration:none;\">" . htmlspecialchars($tag->tag, ENT_QUOTES, 'UTF-8') . ""; } - - $cloud .= "$list
"; - + if ($context != 'tags') { - $cloud .= '

'; - $cloud .= "All site tags"; + $text = elgg_echo('tagcloud:allsitetags'); + $cloud .= '

'; + $cloud .= "$text"; $cloud .= '

'; } $cloud .= elgg_view('tagcloud/extend'); - $cloud .= '
'; - echo $cloud; -} \ No newline at end of file + + if ($context != 'tags') { + $params = array( + 'title' => elgg_echo('tagcloud'), + 'body' => $cloud, + 'body_class' => 'elgg-tagcloud', + ); + echo elgg_view('layout_elements/module', $params); + } else { + echo "
$cloud
"; + } +} -- cgit v1.2.3