diff options
-rw-r--r-- | mod/blog/languages/en.php | 4 | ||||
-rw-r--r-- | mod/blog/read.php | 40 | ||||
-rw-r--r-- | mod/blog/views/default/blog/css.php | 20 | ||||
-rw-r--r-- | mod/blog/views/default/object/blog.php | 47 |
4 files changed, 103 insertions, 8 deletions
diff --git a/mod/blog/languages/en.php b/mod/blog/languages/en.php index 1467f4774..1beb5129d 100644 --- a/mod/blog/languages/en.php +++ b/mod/blog/languages/en.php @@ -8,6 +8,7 @@ 'blog' => "Blog",
'blog:user' => "%s's blog",
+ 'blog:posttitle' => "%s's blog: %s",
'blog:read' => "Read blog",
@@ -18,6 +19,9 @@ 'blog:strapline' => "%s",
+ 'blog:comment:add' => "Add a comment",
+ 'blog:comment:text' => "Comment text",
+
/**
* Status messages
*/
diff --git a/mod/blog/read.php b/mod/blog/read.php new file mode 100644 index 000000000..35ee0c997 --- /dev/null +++ b/mod/blog/read.php @@ -0,0 +1,40 @@ +<?php
+
+ /**
+ * Elgg read blog post page
+ *
+ * @package ElggBlog
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Ben Werdmuller <ben@curverider.co.uk>
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+
+ // Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+
+ // Get the specified blog post
+ $post = (int) get_input('blogpost');
+ if ($blogpost = get_entity($post)) {
+
+ // Get any comments
+ $comments = $blogpost->getAnnotations('comments');
+
+ // Set the page owner
+ set_page_owner($blogpost->getOwner());
+ $page_owner = get_entity($blogpost->getOwner());
+
+ // Display it
+ $body = elgg_view("object/blog",array(
+ 'entity' => $blogpost,
+ 'entity_owner' => $page_owner,
+ 'comments' => $comments,
+ 'full' => true
+ ));
+
+ }
+
+ // Display page
+ page_draw(sprintf(elgg_echo("blog:posttitle"),$page_owner->name,$blogpost->title),$body);
+
+?>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/css.php b/mod/blog/views/default/blog/css.php index 1aa20f8e0..2808508d6 100644 --- a/mod/blog/views/default/blog/css.php +++ b/mod/blog/views/default/blog/css.php @@ -22,6 +22,13 @@ }
+.blog-post a {
+
+ text-decoration: underline;
+ color: #777;
+
+}
+
.blog-post h3 {
font-size: 200%;
@@ -29,10 +36,23 @@ }
+.blog-post h3 a {
+
+ text-decoration: none;
+
+}
+
.blog-post .strapline {
font-size: 130%;
margin-bottom: 20px;
color: #aaa;
+}
+
+.blog-post .strapline a {
+
+ text-decoration: none;
+ color: #aaa;
+
}
\ No newline at end of file diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index ee88a0888..b023d76e5 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -17,7 +17,7 @@ ?>
<div class="blog-post">
- <h3><?php echo $vars['entity']->title; ?></h3>
+ <h3><a href="<?php echo $vars['url']; ?>mod/blog/read.php?blogpost=<?php echo $vars['entity']->getGUID(); ?>"><?php echo $vars['entity']->title; ?></a></h3>
<p class="strapline">
<span style="float:right">
<?php
@@ -28,12 +28,7 @@ ?>
</span>
- <?php
-
- $owner = get_entity($vars['entity']->getOwner());
- echo $owner->name;
-
- ?>
+ <a href="<?php echo $vars['url']; ?>mod/blog/?username=<?php echo $vars['entity_owner']->username; ?>"><?php echo $vars['entity_owner']->name; ?></a>
</p>
<p>
<?php
@@ -52,7 +47,43 @@ </div>
<?php
-
+
+ // If we've been asked to display the full view
+ if (isset($vars['full']) && $vars['full'] == true) {
+
+?>
+
+ <div class="blog-comments">
+
+<?php
+
+ // Display comments if any
+ echo elgg_view('object/blog-comments',array('comments' => $vars['comments']));
+
+?>
+ <form action="<?php echo $vars['url']; ?>action/blog/comment/add" method="post">
+ <h3>
+ <?php echo elgg_echo("blog:comment:add"); ?>
+ </h3>
+ <p>
+ <label><?php echo elgg_echo("blog:comment:text"); ?>
+ <?php
+
+ echo elgg_view("input/longtext",array('internalname' => 'comment'));
+
+ ?>
+ </label>
+ </p>
+ <p>
+ <input type="submit" value="<?php echo elgg_echo("save"); ?>" />
+ </p>
+ </form>
+
+ </div>
+
+<?php
+
+ }
}
?>
\ No newline at end of file |