]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
blog sidebar html updates finished - uses modules!
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 4 Dec 2010 13:07:09 +0000 (13:07 +0000)
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>
Sat, 4 Dec 2010 13:07:09 +0000 (13:07 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@7526 36083f99-b078-4883-b0ff-0f9b5a30f544

mod/blog/views/default/blog/sidebar_edit.php [deleted file]
mod/blog/views/default/blog/sidebar_menu.php
mod/blog/views/default/blog/sidebar_revisions.php
views/default/annotation/latest_comments.php
views/default/css/screen.php
views/default/layout_elements/module.php [moved from views/default/layouts/module.php with 64% similarity]
views/default/output/tagcloud.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 (file)
index 9b56f9a..0000000
+++ /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
index 87b0a8cf9ab3fbd6f3e139e6690fea7026a68c65..d6bd3e08676496896a71eb24451c9bfab3c5f0dc 100644 (file)
@@ -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
index ecc479812a41b65d3ed2a157f66eb26fa89f1165..fc5170ddc516f4a95e5ef8c91ac9bc8ca69f7f2f 100644 (file)
@@ -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
index a43ec4feec863e452f6fb1fc43a02cd8a2d1be93..d603a3830c3418ed3646d044e32f237a5d5e3e59 100644 (file)
@@ -1,12 +1,12 @@
 <?php
 /**
  * Display latest comments on objects
- **/
+ */
         
-if($vars['comments']){
+if ($vars['comments']){
        global $CONFIG;
-       echo "<h3>" . elgg_echo('generic_comments:latest') . "</h3>";           
-       foreach($vars['comments'] as $comment){
+       //echo "<h3>" . elgg_echo('generic_comments:latest') . "</h3>";
+       foreach ($vars['comments'] as $comment) {
           //grab the entity the comment is on
           $entity = get_entity($comment->entity_guid);
                //comment owner
index 18e4a0bad992de0c9a015df8b3957b9e8282dea1..a33586aa79c1f67f042ad676955cb89da9e5b6ba 100644 (file)
@@ -207,14 +207,14 @@ h2 {
        background-position: -250px top;
        text-indent: -1000em;
 }
-.tags {
+.elgg-tags {
        background-image:url(<?php echo elgg_get_site_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 {
similarity index 64%
rename from views/default/layouts/module.php
rename to views/default/layout_elements/module.php
index db940aedc17fd8643a31f821eee608bf4f549e04..46ddcfbfdb3757909297d1372ab632fa87af2bfd 100644 (file)
@@ -1,14 +1,17 @@
 <?php
 /**
- * Elgg module layout
+ * Elgg module
  *
+ * @uses $vars['title']        Title text
  * @uses $vars['header']       HTML content of the header
  * @uses $vars['body']         HTML content of the body
  * @uses $vars['footer']       HTML content of the footer
  * @uses $vars['class']        Optional additional class for module
  * @uses $vars['header_class'] Optional additional class for header
+ * @uses $vars['body_class']   Optional additional class for body
  */
 
+$title = elgg_get_array_value('title', $vars, '');
 $header = elgg_get_array_value('header', $vars, '');
 $body = elgg_get_array_value('body', $vars, '');
 $footer = elgg_get_array_value('footer', $vars, '');
@@ -24,10 +27,18 @@ $additional_class = elgg_get_array_value('header_class', $vars, '');
 if ($additional_class) {
        $header_class = "$header_class $additional_class";
 }
+$header = "<div class=\"$header_class\"><h3>$title</h3></div>";
+//if ($header) {
+//     $header = "<div class=\"$header_class\">$header</div>";
+//}
 
-if ($header) {
-       $header = "<div class=\"$header_class\">$header</div>";
+$body_class = 'elgg-body';
+$additional_class = elgg_get_array_value('body_class', $vars, '');
+if ($additional_class) {
+       $body_class = "$body_class $additional_class";
 }
+$body = "<div class=\"$body_class\">$body</div>";
+
 
 if ($footer) {
        $footer = "<div class=\"elgg-footer\">$footer</div>";
@@ -37,7 +48,7 @@ echo <<<HTML
 <div class="$class">
        <div class="elgg-inner">
                $header
-               <div class="elgg-body">$body</div>
+               $body
                $footer
        </div>
 </div>
index d28fbf05ff641b85e72d903f72837f97ce739ee5..b0737c6f194cdfe93dd6cac126e8d6abbce6e00f 100644 (file)
@@ -31,26 +31,18 @@ if (empty($vars['tagcloud']) && !empty($vars['value'])) {
 
 if (!empty($vars['tagcloud']) && is_array($vars['tagcloud'])) {
        $counter = 0;
-       $cloud = "<div class='tagcloud_wrapper'>";
        $max = 0;
        
-       if ($context != 'tags') {
-               $title = elgg_echo('tagcloud');
-               $cloud .= "<h3>$title</h3>";
-       }
-       
-       $cloud .= '<div class="tagcloud">';
-
-       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 .= "<a href=\"$url\" style=\"font-size: $size%\" title=\"".addslashes($tag->tag)." ($tag->total)\" style=\"text-decoration:none;\">" . htmlspecialchars($tag->tag, ENT_QUOTES, 'UTF-8') . "</a>";
+               $cloud .= "<a href=\"$url\" style=\"font-size: $size%\" title=\"".addslashes($tag->tag)." ($tag->total)\" style=\"text-decoration:none;\">" . htmlspecialchars($tag->tag, ENT_QUOTES, 'UTF-8') . "</a>";
        }
-       
-       $cloud .= "$list</div>";
-       
+               
        if ($context != 'tags') {
-               $cloud .= '<p class="tags">';
-               $cloud .= "<a href=\"".elgg_get_site_url()."pg/tags\">All site tags</a>";
+               $text = elgg_echo('tagcloud:allsitetags');
+               $cloud .= '<p class="elgg-tags">';
+               $cloud .= "<a href=\"".elgg_get_site_url()."pg/tags\">$text</a>";
                $cloud .= '</p>';
        }
        
        $cloud .= elgg_view('tagcloud/extend');
-       $cloud .= '</div>';
-       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 "<div class=\"elgg-tagcloud\">$cloud</div>";
+       }
+}