aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mod/blog/views/default/object/blog.php68
-rw-r--r--views/default/css/elements/core.php29
-rw-r--r--views/default/layout/objects/list/body.php51
3 files changed, 117 insertions, 31 deletions
diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php
index 3efd749f1..f296caa69 100644
--- a/mod/blog/views/default/object/blog.php
+++ b/mod/blog/views/default/object/blog.php
@@ -44,12 +44,29 @@ if ($blog->comments_on != 'Off') {
}
// access is always shown.
-$edit = elgg_view('output/access', array('entity' => $vars['entity']));
+$metadata = '<ul class="elgg-list-metadata">';
+$metadata .= '<li>' . elgg_view('output/access', array('entity' => $vars['entity'])) . '</li>';
+
+if (isloggedin() && $blog->getOwnerGUID() != get_loggedin_userid()) {
+ $likes = elgg_view_likes($blog);
+ $metadata .= "<li>$likes</li>";
+}
+
+// pass <li>your data</li> back from the view
+$metadata .= elgg_view("entity/metadata", array('entity' => $blog));
// links to delete or edit.
if ($blog->canEdit()) {
+
+ $status = '';
+ if ($blog->status != 'published') {
+ $status_text = elgg_echo("blog:status:{$blog->status}");
+ $metadata .= "<li>$status_text</li>";
+ }
+
$edit_url = elgg_get_site_url()."pg/blog/edit/{$owner->username}/{$blog->getGUID()}/";
$edit_link = "<span class='entity-edit'><a href=\"$edit_url\">" . elgg_echo('edit') . '</a></span>';
+ $metadata .= "<li>$edit_link</li>";
$delete_url = "action/blog/delete?guid={$blog->getGUID()}";
$delete_link = elgg_view('output/confirmlink', array(
@@ -59,19 +76,12 @@ if ($blog->canEdit()) {
'confirm' => elgg_echo('deleteconfirm'),
'encode' => false,
));
-
- $status = '';
- if ($blog->status != 'published') {
- $status_text = elgg_echo("blog:status:{$blog->status}");
- $status = "<span class='blog_status'>$status_text</span>";
- }
-
- $edit .= "$status $edit_link $delete_link";
+ $metadata .= "<li>$delete_link</li>";
}
-// include a view for plugins to extend
-$edit = elgg_view("blogs/options", array("object_type" => 'blog', 'entity' => $blog)) .
- $edit . elgg_view_likes($blog);
+$metadata .= '</ul>';
+
+$subtitle = "$author_text $date $categories $comments_link";
if ($full) {
@@ -81,6 +91,14 @@ if ($full) {
);
$header = elgg_view('content/header', $params);
+ $params = array(
+ 'entity' => $blog,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ );
+ $list_body = elgg_view('layout/objects/list/body', $params);
+
$info = <<<HTML
<div class="entity-listing-info clearfix">
<div class="entity-metadata">$edit</div>
@@ -94,7 +112,7 @@ if ($full) {
</div>
HTML;
- $blog_info = elgg_view_image_block($owner_icon, $info);
+ $blog_info = elgg_view_image_block($owner_icon, $list_body);
echo <<<HTML
$header
@@ -107,20 +125,14 @@ HTML;
} else {
// brief view
- $body = <<<HTML
- <div class="entity-listing-info">
- <div class="elgg-metadata">$edit</div>
- <p class="entity-title">$linked_title</p>
- <p class="entity-subtext">
- $author_text
- $date
- $categories
- $comments_link
- </p>
- $tags
- <p>$excerpt</p>
- </div>
-HTML;
+ $params = array(
+ 'entity' => $blog,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ 'content' => $excerpt,
+ );
+ $list_body = elgg_view('layout/objects/list/body', $params);
- echo elgg_view_image_block($owner_icon, $body);
+ echo elgg_view_image_block($owner_icon, $list_body);
}
diff --git a/views/default/css/elements/core.php b/views/default/css/elements/core.php
index 29fdd598b..6f4e46f66 100644
--- a/views/default/css/elements/core.php
+++ b/views/default/css/elements/core.php
@@ -210,11 +210,34 @@ h2 {
margin: 5px 0;
clear: both;
}
-
-.elgg-list li {
+.elgg-list > li {
border-bottom: 1px dotted #CCCCCC;
}
-
+.elgg-list-metadata {
+ float: right;
+ margin-left: 15px;
+ font-size: 90%;
+}
+.elgg-list-metadata li {
+ float: left;
+ margin-left: 15px;
+}
+.elgg-list-metadata, .elgg-list-metadata a {
+ color: #aaaaaa;
+}
+.elgg-list-subtitle {
+ color: #666666;
+ font-size: 85%;
+ line-height: 1.2em;
+ font-style: italic;
+ margin-bottom: 5px;
+}
+.elgg-tags {
+ margin-bottom: 5px;
+}
+.elgg-list-content {
+ margin: 10px 5px;
+}
.elgg-center {
margin: 0 auto;
}
diff --git a/views/default/layout/objects/list/body.php b/views/default/layout/objects/list/body.php
new file mode 100644
index 000000000..9bef21da9
--- /dev/null
+++ b/views/default/layout/objects/list/body.php
@@ -0,0 +1,51 @@
+<?php
+/**
+ * List body
+ *
+ * Sample output
+ * <ul elgg-list-metadata><li>Public</li><li>Like this</li></ul>
+ * <h3><a href="">Title</a></h3>
+ * <p class="elgg-list-subtitle">Posted 3 hours ago by George</p>
+ * <p class="elgg-tags"><a href="">one</a>, <a href="">two</a></p>
+ * <div class="elgg-list-content">Excerpt text</div>
+ *
+ * @uses $vars['entity'] ElggEntity
+ * @uses $vars['title'] Title link (optional)
+ * @uses $vars['metadata'] HTML for entity metadata and actions (optional)
+ * @uses $vars['subtitle'] HTML for the subtitle (optional)
+ * @uses $vars['tags'] HTML for the tags (optional)
+ * @uses $vars['content'] HTML for the entity content (optional)
+ */
+
+$entity = $vars['entity'];
+
+$title_link = elgg_get_array_value('title', $vars, '');
+if (!$title_link) {
+ $params = array(
+ 'text' => $entity->title,
+ 'href' => $entity->getURL(),
+ );
+ $title_link = elgg_view('output/url', $params);
+}
+
+$metadata = elgg_get_array_value('metadata', $vars, '');
+$subtitle = elgg_get_array_value('subtitle', $vars, '');
+$content = elgg_get_array_value('content', $vars, '');
+
+$tags = elgg_get_array_value('tags', $vars, '');
+if (!$tags) {
+ $tag_text = elgg_view('output/tags', array('tags' => $entity->tags));
+ if ($tag_text) {
+ $tags = '<p class="elgg-tags">' . $tag_text . '</p>';
+ }
+}
+
+if ($metadata) {
+ echo $metadata;
+}
+echo "<h3>$title_link</h3>";
+echo "<p class=\"elgg-list-subtitle\">$subtitle</p>";
+echo $tags;
+if ($content) {
+ echo "<div class=\"elgg-list-content\">$content</div>";
+}