diff options
author | pete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-09 18:17:16 +0000 |
---|---|---|
committer | pete <pete@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-03-09 18:17:16 +0000 |
commit | 2c9ea2cd34a1dd782e165b163899d7ba1ec1f41c (patch) | |
tree | e58056e8d909bfffba72366454580b90588ff295 | |
parent | 3b116ee48300d19f36888c078429d668a7418cd4 (diff) | |
download | elgg-2c9ea2cd34a1dd782e165b163899d7ba1ec1f41c.tar.gz elgg-2c9ea2cd34a1dd782e165b163899d7ba1ec1f41c.tar.bz2 |
Blogs updated to new UI (needs Brett to look over first)
git-svn-id: http://code.elgg.org/elgg/trunk@5335 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r-- | mod/blog/actions/add.php | 197 | ||||
-rw-r--r-- | mod/blog/actions/delete.php | 70 | ||||
-rw-r--r-- | mod/blog/actions/edit.php | 194 | ||||
-rw-r--r-- | mod/blog/add.php | 63 | ||||
-rw-r--r-- | mod/blog/edit.php | 70 | ||||
-rw-r--r-- | mod/blog/endpoint/index.php | 92 | ||||
-rw-r--r-- | mod/blog/languages/en.php | 37 | ||||
-rw-r--r-- | mod/blog/manifest.xml | 2 | ||||
-rw-r--r-- | mod/blog/savedraft.php | 44 | ||||
-rw-r--r-- | mod/blog/start.php | 559 | ||||
-rw-r--r-- | mod/blog/views/default/blog/archive.php | 22 | ||||
-rw-r--r-- | mod/blog/views/default/blog/categorylist.php | 26 | ||||
-rw-r--r-- | mod/blog/views/default/blog/css.php | 217 | ||||
-rw-r--r-- | mod/blog/views/default/blog/forms/edit.php | 339 | ||||
-rw-r--r-- | mod/blog/views/default/blog/gallery.php | 52 | ||||
-rw-r--r-- | mod/blog/views/default/blog/listing.php | 85 | ||||
-rw-r--r-- | mod/blog/views/default/blog/menu.php | 24 | ||||
-rw-r--r-- | mod/blog/views/default/blog/notfound.php | 32 | ||||
-rw-r--r-- | mod/blog/views/default/blog/previewpane.php | 10 | ||||
-rw-r--r-- | mod/blog/views/default/blog/stats.php | 13 | ||||
-rw-r--r-- | mod/blog/views/default/blog/view.php | 41 | ||||
-rw-r--r-- | mod/blog/views/default/object/blog.php | 311 |
22 files changed, 1388 insertions, 1112 deletions
diff --git a/mod/blog/actions/add.php b/mod/blog/actions/add.php index 97634638e..ade0c2544 100644 --- a/mod/blog/actions/add.php +++ b/mod/blog/actions/add.php @@ -1,84 +1,113 @@ -<?php - - /** - * Elgg blog: add post action - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Make sure we're logged in (send us to the front page if not) - gatekeeper(); - - // Get input data - $title = get_input('blogtitle'); - $body = get_input('blogbody'); - $tags = get_input('blogtags'); - $access = get_input('access_id'); - $comments_on = get_input('comments_select','Off'); - - // Cache to the session - $_SESSION['user']->blogtitle = $title; - $_SESSION['user']->blogbody = $body; - $_SESSION['user']->blogtags = $tags; - - // Convert string of tags into a preformatted array - $tagarray = string_to_tag_array($tags); - - // Make sure the title / description aren't blank - if (empty($title) || empty($body)) { - register_error(elgg_echo("blog:blank")); - forward($_SERVER['HTTP_REFERER']); - } - - - // Initialise a new ElggObject - $blog = new ElggObject(); - // Tell the system it's a blog post - $blog->subtype = "blog"; - // Set its owner to the current user - $blog->owner_guid = get_loggedin_userid(); - // Set it's container - $blog->container_guid = (int)get_input('container_guid', get_loggedin_userid()); - // For now, set its access - $blog->access_id = $access; - // Set its title and description appropriately - $blog->title = $title; - $blog->description = $body; - // Now let's add tags. We can pass an array directly to the object property! Easy. - if (is_array($tagarray)) { - $blog->tags = $tagarray; - } - //whether the user wants to allow comments or not on the blog post - $blog->comments_on = $comments_on; - - // Now save the object - if (!$blog->save()) { - register_error(elgg_echo("blog:error")); - forward($_SERVER['HTTP_REFERER']); - } - - // Success message - system_message(elgg_echo("blog:posted")); - // add to river - add_to_river('river/object/blog/create', 'create', get_loggedin_userid(), $blog->guid); - // Remove the blog post cache - //unset($_SESSION['blogtitle']); unset($_SESSION['blogbody']); unset($_SESSION['blogtags']); - remove_metadata($_SESSION['user']->guid,'blogtitle'); - remove_metadata($_SESSION['user']->guid,'blogbody'); - remove_metadata($_SESSION['user']->guid,'blogtags'); - - // Forward to the main blog page - $page_owner = get_entity($blog->container_guid); - if ($page_owner instanceof ElggUser) { - $username = $page_owner->username; - } else if ($page_owner instanceof ElggGroup) { - $username = "group:" . $page_owner->guid; - } - - forward("pg/blog/$username"); - -?> +<?php
+
+ /**
+ * Elgg blog: add post action
+ *
+ * @package ElggBlog
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+
+ // Make sure we're logged in (send us to the front page if not)
+ gatekeeper();
+
+ // Make sure action is secure
+ action_gatekeeper();
+
+ // Get input data
+ $title = get_input('blogtitle');
+ $body = get_input('blogbody');
+ $tags = get_input('blogtags');
+ $access = get_input('access_id');
+ //there are three options for an excerpt 1) the user adds one 2) the user uses the {{more}} options
+ //3) we take the first 50 words - check for the excerpt first, then the more option, then grab 50 words
+ $excerpt = get_input('blogexcerpt');
+ if($excerpt){
+ if(strlen($excerpt) > 300)
+ $excerpt = substr($excerpt, 0, strpos($excerpt, ' ', 300));
+ else
+ $excerpt = $excerpt;
+
+ $show_excerpt = true;
+ }
+ //if(!$excerpt){
+ //if no user excerpt,check for the {{more}} option in the post
+ // $excerpt = explode("{{more}}", $body);
+ // $excerpt = $excerpt[0];
+ //}
+ if(!$excerpt){
+ //grab the first 300 characters
+ if(strlen($body) > 300)
+ $excerpt = substr($body, 0, strpos($body, ' ', 300)) . "...";
+ else
+ $excerpt = $body;
+
+ $show_excerpt = false;
+ }
+ $comments_on = get_input('comments_select','Off');
+
+ // Cache to the session
+ $_SESSION['user']->blogtitle = $title;
+ $_SESSION['user']->blogbody = $body;
+ $_SESSION['user']->blogtags = $tags;
+
+ // Convert string of tags into a preformatted array
+ $tagarray = string_to_tag_array($tags);
+
+ // Make sure the title / description aren't blank
+ if (empty($title) || empty($body)) {
+ register_error(elgg_echo("blog:blank"));
+ forward($_SERVER['HTTP_REFERER']);
+
+ // Otherwise, save the blog post
+ } else {
+
+ // Initialise a new ElggObject
+ $blog = new ElggObject();
+ // Tell the system it's a blog post
+ $blog->subtype = "blog";
+ // Set its owner to the current user
+ $blog->owner_guid = $_SESSION['user']->getGUID();
+ // Set it's container
+ $blog->container_guid = (int)get_input('container_guid', $_SESSION['user']->getGUID());
+ // For now, set its access to public (we'll add an access dropdown shortly)
+ $blog->access_id = $access;
+ // Set its title and description appropriately
+ $blog->title = $title;
+ $blog->description = $body;
+ // Before we can set metadata, we need to save the blog post
+ if (!$blog->save()) {
+ register_error(elgg_echo("blog:error"));
+ forward($_SERVER['HTTP_REFERER']);
+ }
+ // Now let's add tags. We can pass an array directly to the object property! Easy.
+ if (is_array($tagarray)) {
+ $blog->tags = $tagarray;
+ }
+ $blog->comments_on = $comments_on; //whether the users wants to allow comments or not on the blog post
+ $blog->excerpt = $excerpt;
+ $blog->show_excerpt = $show_excerpt;
+
+ // Success message
+ system_message(elgg_echo("blog:posted"));
+ // add to river
+ add_to_river('river/object/blog/create','create',$_SESSION['user']->guid,$blog->guid);
+ // Remove the blog post cache
+ //unset($_SESSION['blogtitle']); unset($_SESSION['blogbody']); unset($_SESSION['blogtags']);
+ remove_metadata($_SESSION['user']->guid,'blogtitle');
+ remove_metadata($_SESSION['user']->guid,'blogbody');
+ remove_metadata($_SESSION['user']->guid,'blogtags');
+
+ // Forward to the main blog page
+ $page_owner = get_entity($blog->container_guid);
+ if ($page_owner instanceof ElggUser)
+ $username = $page_owner->username;
+ else if ($page_owner instanceof ElggGroup)
+ $username = "group:" . $page_owner->guid;
+ forward("pg/blog/$username");
+
+ }
+
+?>
diff --git a/mod/blog/actions/delete.php b/mod/blog/actions/delete.php index c01ca3844..5b0120cef 100644 --- a/mod/blog/actions/delete.php +++ b/mod/blog/actions/delete.php @@ -1,38 +1,32 @@ -<?php - - /** - * Elgg blog: delete post action - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Make sure we're logged in (send us to the front page if not) - gatekeeper(); - - // Get input data - $guid = (int) get_input('blogpost'); - - // Make sure we actually have permission to edit - $blog = get_entity($guid); - if ($blog->getSubtype() == "blog" && $blog->canEdit()) { - - // Get owning user - $owner = get_entity($blog->getOwner()); - // Delete it! - $rowsaffected = $blog->delete(); - if ($rowsaffected > 0) { - // Success message - system_message(elgg_echo("blog:deleted")); - } else { - register_error(elgg_echo("blog:notdeleted")); - } - // Forward to the main blog page - forward("mod/blog/?username=" . $owner->username); - - } - -?>
\ No newline at end of file +<?php
+
+/**
+ * Elgg blog: delete post action
+ */
+
+// Make sure we're logged in (send us to the front page if not)
+gatekeeper();
+
+// Get input data
+$guid = (int) get_input('blogpost');
+
+// Make sure we actually have permission to edit
+$blog = get_entity($guid);
+if ($blog->getSubtype() == "blog" && $blog->canEdit()) {
+ $container = get_entity($blog->container_guid);
+
+ // Get owning user
+ $owner = get_entity($blog->getOwner());
+ // Delete it!
+ $rowsaffected = $blog->delete();
+ if ($rowsaffected > 0) {
+ // Success message
+ system_message(elgg_echo("blog:deleted"));
+ } else {
+ register_error(elgg_echo("blog:notdeleted"));
+ }
+ // Forward to the main blog page
+ forward("pg/blog/" . $container->username);
+}else{
+ forward($_SERVER['HTTP_REFERER']);
+}
\ No newline at end of file diff --git a/mod/blog/actions/edit.php b/mod/blog/actions/edit.php index b44106645..3c16a2e8d 100644 --- a/mod/blog/actions/edit.php +++ b/mod/blog/actions/edit.php @@ -1,86 +1,108 @@ -<?php - - /** - * Elgg blog: edit post action - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.org/ - */ - - // Make sure we're logged in (send us to the front page if not) - gatekeeper(); - - // Get input data - $guid = (int) get_input('blogpost'); - $title = get_input('blogtitle'); - $body = get_input('blogbody'); - $access = get_input('access_id'); - $tags = get_input('blogtags'); - $comments_on = get_input('comments_select','Off'); - - // Make sure we actually have permission to edit - $blog = get_entity($guid); - if ($blog->getSubtype() == "blog" && $blog->canEdit()) { - - // Cache to the session - - $_SESSION['user']->blogtitle = $title; - $_SESSION['user']->blogbody = $body; - $_SESSION['user']->blogtags = $tags; - - // Convert string of tags into a preformatted array - $tagarray = string_to_tag_array($tags); - - // Make sure the title / description aren't blank - if (empty($title) || empty($body)) { - register_error(elgg_echo("blog:blank")); - forward("mod/blog/add.php"); - - // Otherwise, save the blog post - } else { - - // Get owning user - $owner = get_entity($blog->getOwner()); - // For now, set its access to public (we'll add an access dropdown shortly) - $blog->access_id = $access; - // Set its title and description appropriately - $blog->title = $title; - $blog->description = $body; - // Before we can set metadata, we need to save the blog post - if (!$blog->save()) { - register_error(elgg_echo("blog:error")); - forward("mod/blog/edit.php?blogpost=" . $guid); - } - // Now let's add tags. We can pass an array directly to the object property! Easy. - $blog->clearMetadata('tags'); - if (is_array($tagarray)) { - $blog->tags = $tagarray; - } - - $blog->comments_on = $comments_on; //whether the users wants to allow comments or not on the blog post - - // Success message - system_message(elgg_echo("blog:posted")); - //add to the river - add_to_river('river/object/blog/update','update',$_SESSION['user']->guid,$blog->guid); - // Remove the blog post cache - //unset($_SESSION['blogtitle']); unset($_SESSION['blogbody']); unset($_SESSION['blogtags']); - remove_metadata($_SESSION['user']->guid,'blogtitle'); - remove_metadata($_SESSION['user']->guid,'blogbody'); - remove_metadata($_SESSION['user']->guid,'blogtags'); - // Forward to the main blog page - $page_owner = get_entity($blog->container_guid); - if ($page_owner instanceof ElggUser) - $username = $page_owner->username; - else if ($page_owner instanceof ElggGroup) - $username = "group:" . $page_owner->guid; - forward("pg/blog/$username"); - - } - - } - -?> +<?php
+
+ /**
+ * Elgg blog: edit post action
+ *
+ * @package ElggBlog
+ * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
+ * @author Curverider Ltd <info@elgg.com>
+ * @copyright Curverider Ltd 2008-2009
+ * @link http://elgg.org/
+ */
+
+ // Make sure we're logged in (send us to the front page if not)
+ gatekeeper();
+
+ // make sure action is secure
+ action_gatekeeper();
+
+ // Get input data
+ $guid = (int) get_input('blogpost');
+ $title = get_input('blogtitle');
+ $body = get_input('blogbody');
+ $access = get_input('access_id');
+ $tags = get_input('blogtags');
+ $comments_on = get_input('comments_select','Off');
+ $excerpt = get_input('blogexcerpt');
+ if($excerpt){
+ if(strlen($excerpt) > 300)
+ $excerpt = substr($excerpt, 0, strpos($excerpt, ' ', 300));
+ else
+ $excerpt = strip_tags($excerpt);
+
+ $show_excerpt = true;
+ }
+ if(!$excerpt){
+ //grab the first 300 characters
+ if(strlen($body) > 300)
+ $excerpt = substr($body, 0, strpos($body, ' ', 300)) . "...";
+ else
+ $excerpt = strip_tags($body);
+
+ $show_excerpt = false;
+ }
+
+ // Make sure we actually have permission to edit
+ $blog = get_entity($guid);
+ if ($blog->getSubtype() == "blog" && $blog->canEdit()) {
+
+ // Cache to the session
+
+ $_SESSION['user']->blogtitle = $title;
+ $_SESSION['user']->blogbody = $body;
+ $_SESSION['user']->blogtags = $tags;
+
+ // Convert string of tags into a preformatted array
+ $tagarray = string_to_tag_array($tags);
+
+ // Make sure the title / description aren't blank
+ if (empty($title) || empty($body)) {
+ register_error(elgg_echo("blog:blank"));
+ forward("mod/blog/add.php");
+
+ // Otherwise, save the blog post
+ } else {
+
+ // Get owning user
+ $owner = get_entity($blog->getOwner());
+ // For now, set its access to public (we'll add an access dropdown shortly)
+ $blog->access_id = $access;
+ // Set its title and description appropriately
+ $blog->title = $title;
+ $blog->description = $body;
+ // Before we can set metadata, we need to save the blog post
+ if (!$blog->save()) {
+ register_error(elgg_echo("blog:error"));
+ forward("mod/blog/edit.php?blogpost=" . $guid);
+ }
+ // Now let's add tags. We can pass an array directly to the object property! Easy.
+ $blog->clearMetadata('tags');
+ if (is_array($tagarray)) {
+ $blog->tags = $tagarray;
+ }
+ $blog->excerpt = $excerpt;
+ $blog->comments_on = $comments_on; //whether the users wants to allow comments or not on the blog post
+ $blog->show_excerpt = $show_excerpt;
+
+ // Success message
+ system_message(elgg_echo("blog:posted"));
+ //add to the river
+ add_to_river('river/object/blog/update','update',$_SESSION['user']->guid,$blog->guid);
+ // Remove the blog post cache
+ //unset($_SESSION['blogtitle']); unset($_SESSION['blogbody']); unset($_SESSION['blogtags']);
+ remove_metadata($_SESSION['user']->guid,'blogtitle');
+ remove_metadata($_SESSION['user']->guid,'blogbody');
+ remove_metadata($_SESSION['user']->guid,'blogtags');
+ // Forward to the main blog page
+ $page_owner = get_entity($blog->container_guid);
+ if ($page_owner instanceof ElggUser)
+ $username = $page_owner->username;
+ else if ($page_owner instanceof ElggGroup)
+ $username = "group:" . $page_owner->guid;
+ forward("pg/blog/$username");
+
+ }
+
+ }
+
+?>
diff --git a/mod/blog/add.php b/mod/blog/add.php index cb3a3fc93..efc6afc43 100644 --- a/mod/blog/add.php +++ b/mod/blog/add.php @@ -1,36 +1,27 @@ -<?php - - /** - * Elgg blog add entry page - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - // Load Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - gatekeeper(); - - // Get the current page's owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - } - if ($page_owner instanceof ElggGroup) - $container = $page_owner->guid; - - //set the title - $area1 = elgg_view_title(elgg_echo('blog:addpost')); - - // Get the form - $area1 .= elgg_view("blog/forms/edit", array('container_guid' => $container)); - - // Display page - page_draw(elgg_echo('blog:addpost'),elgg_view_layout("edit_layout", $area1)); - - -?>
\ No newline at end of file +<?php
+
+/**
+ * Elgg blog add entry page
+ */
+
+// Load Elgg engine
+require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+gatekeeper();
+
+// Get the current page's owner
+$page_owner = page_owner_entity();
+if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+}
+if ($page_owner instanceof ElggGroup)
+ $container = $page_owner->guid;
+
+//set breadcrumbs
+//$area1 = elgg_view('elggcampus_layout/breadcrumbs_general', array('object_type' => 'blog'));
+
+// Get the form
+$area1 .= elgg_view("blog/forms/edit", array('container_guid' => $container));
+
+// Display page
+page_draw(elgg_echo('blog:addpost'),elgg_view_layout("one_column", $area1));
\ No newline at end of file diff --git a/mod/blog/edit.php b/mod/blog/edit.php index fbaf79108..2d605b647 100644 --- a/mod/blog/edit.php +++ b/mod/blog/edit.php @@ -1,41 +1,29 @@ -<?php - - /** - * Elgg blog edit entry page - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - // Load Elgg engine - require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - gatekeeper(); - - // Get the current page's owner - $page_owner = page_owner_entity(); - if ($page_owner === false || is_null($page_owner)) { - $page_owner = $_SESSION['user']; - set_page_owner($_SESSION['guid']); - } - - // Get the post, if it exists - $blogpost = (int) get_input('blogpost'); - if ($post = get_entity($blogpost)) { - - if ($post->canEdit()) { - - $area1 = elgg_view_title(elgg_echo('blog:editpost')); - $area1 .= elgg_view("blog/forms/edit", array('entity' => $post)); - $body = elgg_view_layout("edit_layout", $area1); - - } - - } - - // Display page - page_draw(sprintf(elgg_echo('blog:editpost'),$post->title),$body); - -?>
\ No newline at end of file +<?php
+
+/**
+* Elgg blog edit entry page
+*/
+
+//Load Elgg engine
+ require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
+ gatekeeper();
+
+//Get the current page's owner
+ $page_owner = page_owner_entity();
+ if ($page_owner === false || is_null($page_owner)) {
+ $page_owner = $_SESSION['user'];
+ set_page_owner($_SESSION['guid']);
+ }
+
+//Get the post, if it exists
+ $blogpost = (int) get_input('blogpost');
+ if ($post = get_entity($blogpost)) {
+ if ($post->canEdit()) {
+ //$area1 = elgg_view('elggcampus_layout/breadcrumbs_edit', array('object' => $post, 'object_type' => 'blog'));
+ $area1 .= elgg_view("blog/forms/edit", array('entity' => $post));
+ $body = elgg_view_layout("one_column", $area1);
+ }
+ }
+
+//Display page
+ page_draw(sprintf(elgg_echo('blog:editpost'),$post->title),$body);
\ No newline at end of file diff --git a/mod/blog/endpoint/index.php b/mod/blog/endpoint/index.php new file mode 100644 index 000000000..013770e36 --- /dev/null +++ b/mod/blog/endpoint/index.php @@ -0,0 +1,92 @@ +<?php + + /** + * Elgg external blog. Turns your internal blog into an external one. + */ + + // Load Elgg engine will not include plugins + require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/engine/start.php"); + + global $CONFIG; + + $user = get_input('user'); + $user_object = get_user_by_username($user); + + // Get a list of blog posts + set_context('search'); + $area2 = "<div id=\"blogs\">" . list_user_objects($user_object->guid,'blog',10,false, false) . "<div class='clearfloat'></div></div>"; + set_context('blog'); + + //get some user details + $user_name = $user_object->name; + $user_desc = $user_object->briefdescription; + $user_location = $user_object->location; + + //get archive list + if ($dates = get_entity_dates('object','blog',$user_object->guid)) { + foreach($dates as $date) { + $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)); + $link = $CONFIG->wwwroot . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh; + $year = substr($date,0,-2); + $month = date('F',mktime(0, 0, 0, substr($date,4,2), 1)); //substr($date,4,2); + $display_date = $month . " " . $year; + $archive_list .= "<li><a href=\"{$link}\">" . $display_date . "</a></li>"; + } + } +?> +<html> +<head> +<title>Brighton news blog</title> +<?php + //require_once(dirname(dirname(dirname(dirname(__FILE__)))) . "/mod/blog/themes/ColdBlue/css/style.php"); +?> +</head> +<body> + <div id="header"><div class="inner clear"> + <h1><a href=""><?php echo $user_object->name; ?>: blog</a></h1> + <ul id="navigation"> + <li><a href="<?php echo $CONFIG->wwwroot . 'pg/blog/' . $user .'?view=rss'; ?>">RSS Feed</a></li> + </ul> + </div></div> + <div id="search"><div class="inner clear"> + <a id="rss-link" href="<?php echo $CONFIG->wwwroot . 'pg/blog/' . $user .'?view=rss'; ?>"><strong>Subscribe to the RSS Feed</strong></a> + <a id="technorati-link" href="http://technorati.com/faves?add=""><strong>Add to your Favorites</strong></a> + </div></div> + <div id="wrapper" class="clear"> + <div id="content"> + <?php echo $area2; ?> + <div class="post-navigation"> + <div class="left"></div> + <div class="right"></div> + </div> + </div> +<ul id="sidebar"> +<li><h2>About</h2> + <ul> + <li> + <p><b><?php echo $user_name; ?></b></p> + <p><b><?php echo $user_desc; ?></b></p> + <p><b>Location: <?php echo $user_location; ?></b></p> + </li> + </ul> +</li> +<li><h2>Archives</h2> + <ul> + <?php + //archives + echo $archive_list; + ?> + </ul> +</li> +</ul> +</div> +<div id="footer"> + <p id="blog-name">Copyright © 2009 <a href="<?php echo $user_object->getURL(); ?>"><?php echo $user_object->name; ?></a></p> + <p id="webrevolutionary-link"> + <a href="http://webrevolutionary.com/coldblue/">ColdBlue</a> v1.0 — A theme by <a href="http://webrevolutionary.com/">WebRevolutionary</a> & <a href="http://www.forwebdesigners.com/">ForWebdesigners</a> + </p> +</div> +<!-- ColdBlue v1.0 theme designed by WebRevolutionary.com --> +</body> +</html>
\ No newline at end of file diff --git a/mod/blog/languages/en.php b/mod/blog/languages/en.php index 9496cee00..3e4b3d6d1 100644 --- a/mod/blog/languages/en.php +++ b/mod/blog/languages/en.php @@ -6,39 +6,46 @@ * Menu items and titles */ - 'blog' => "Blog", + 'blog' => "Blog", 'blogs' => "Blogs", 'blog:user' => "%s's blog", 'blog:user:friends' => "%s's friends' blog", - 'blog:your' => "Your blog", + 'blog:yours' => "My blog", 'blog:posttitle' => "%s's blog: %s", 'blog:friends' => "Friends' blogs", + 'blog:workgroup' => "Work Group blogs", 'blog:yourfriends' => "Your friends' latest blogs", - 'blog:everyone' => "All site blogs", - 'blog:newpost' => "New blog post", + 'blog:all' => "All site blogs", + 'blog:new' => "New blog post", + 'blog:posts' => "Latest blog posts", + 'blog:title' => "Blog title", 'blog:via' => "via blog", 'blog:read' => "Read blog", - - 'blog:addpost' => "Write a blog post", + 'blog:backto' => "Back to blogs", + 'blog:addpost' => "New blog post", 'blog:editpost' => "Edit blog post", - + 'blog:defaultaccess' => "Your site wide access level is:", 'blog:text' => "Blog text", - + 'blog:access' => "This blog's access is:", 'blog:strapline' => "%s", - + 'blog:none' => "There are no blog posts to display", 'item:object:blog' => 'Blog posts', - + 'blog:latestcomments' => 'Latest comments', 'blog:never' => 'never', 'blog:preview' => 'Preview', - + 'blog:archive' => 'Archive', + 'blog:excerpt' => 'Excerpt (Optional)', + 'blog:excerptdesc' => 'An optional short summary, displayed on blog and search listings<br />(instead of the first 200 characters).', 'blog:draft:save' => 'Save draft', + 'blog:readmore' => 'Read more', 'blog:draft:saved' => 'Draft last saved', 'blog:comments:allow' => 'Allow comments', + 'blog:widget:description' => 'This widget will display your latest blog post titles on your profile.', 'blog:preview:description' => 'This is an unsaved preview of your blog post.', 'blog:preview:description:link' => 'To continue editing or save your post, click here.', - 'blog:enableblog' => 'Enable group blog', + 'blog:enableblog' => 'Enable community blog', 'blog:group' => 'Group blog', @@ -52,9 +59,9 @@ 'blog:river:posted' => "%s posted", //these get inserted into the river links to take the user to the entity - 'blog:river:create' => "a new blog post titled", - 'blog:river:update' => "a blog post titled", - 'blog:river:annotate' => "a comment on this blog post", + 'blog:river:create' => "a blog post", + 'blog:river:update' => "a blog post", + 'blog:river:annotate' => "a comment on the blog post", /** diff --git a/mod/blog/manifest.xml b/mod/blog/manifest.xml index 98c22b76f..e2b8f89f4 100644 --- a/mod/blog/manifest.xml +++ b/mod/blog/manifest.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <plugin_manifest> <field key="author" value="Curverider" /> - <field key="version" value="1.7" /> + <field key="version" value="1.8" /> <field key="description" value="Elgg blog plugin" /> <field key="website" value="http://www.elgg.org/" /> <field key="copyright" value="(C) Curverider 2008-2010" /> diff --git a/mod/blog/savedraft.php b/mod/blog/savedraft.php index fd8197abd..4533939ed 100644 --- a/mod/blog/savedraft.php +++ b/mod/blog/savedraft.php @@ -1,26 +1,20 @@ -<?php - - /** - * Elgg blog autosaver - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - // Load engine - require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php'); - gatekeeper(); - - // Get input data - $title = $_POST['blogtitle']; - $body = $_POST['blogbody']; - $tags = $_POST['blogtags']; - - $_SESSION['user']->blogtitle = $title; - $_SESSION['user']->blogbody = $body; - $_SESSION['user']->blogtags = $tags; - +<?php
+
+ /**
+ * Elgg blog autosaver
+ */
+
+ // Load engine
+ require_once(dirname(dirname(dirname(__FILE__))) . '/engine/start.php');
+ gatekeeper();
+
+ // Get input data
+ $title = $_POST['blogtitle'];
+ $body = $_POST['blogbody'];
+ $tags = $_POST['blogtags'];
+
+ $_SESSION['user']->blogtitle = $title;
+ $_SESSION['user']->blogbody = $body;
+ $_SESSION['user']->blogtags = $tags;
+
?>
\ No newline at end of file diff --git a/mod/blog/start.php b/mod/blog/start.php index 358c0f014..c2ccb1902 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -1,283 +1,278 @@ -<?php - - /** - * Elgg blog plugin - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - /** - * Blog initialisation - * - * These parameters are required for the event API, but we won't use them: - * - * @param unknown_type $event - * @param unknown_type $object_type - * @param unknown_type $object - */ - - function blog_init() { - - // Load system configuration - global $CONFIG; - - // Set up menu for logged in users - if (isloggedin()) { - - add_menu(elgg_echo('blogs'), $CONFIG->wwwroot . "pg/blog/" . $_SESSION['user']->username); - - // And for logged out users - } else { - add_menu(elgg_echo('blogs'), $CONFIG->wwwroot . "mod/blog/everyone.php"); - } - - // Extend system CSS with our own styles, which are defined in the blog/css view - elgg_extend_view('css','blog/css'); - - // Extend hover-over menu - elgg_extend_view('profile/menu/links','blog/menu'); - - // Register a page handler, so we can have nice URLs - register_page_handler('blog','blog_page_handler'); - - // Register a URL handler for blog posts - register_entity_url_handler('blog_url','object','blog'); - - // Register this plugin's object for sending pingbacks - register_plugin_hook('pingback:object:subtypes', 'object', 'blog_pingback_subtypes'); - - // Register granular notification for this type - if (is_callable('register_notification_object')) - register_notification_object('object', 'blog', elgg_echo('blog:newpost')); - - // Listen to notification events and supply a more useful message - register_plugin_hook('notify:entity:message', 'object', 'blog_notify_message'); - - - // Listen for new pingbacks - register_elgg_event_handler('create', 'object', 'blog_incoming_ping'); - - // Register entity type - register_entity_type('object','blog'); - - // Register an annotation handler for comments etc - register_plugin_hook('entity:annotate', 'object', 'blog_annotate_comments'); - - // Add group menu option - add_group_tool_option('blog',elgg_echo('blog:enableblog'),true); - } - - function blog_pagesetup() { - - global $CONFIG; - - //add submenu options - if (get_context() == "blog") { - $page_owner = page_owner_entity(); - - if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) { - add_submenu_item(elgg_echo('blog:your'),$CONFIG->wwwroot."pg/blog/" . $_SESSION['user']->username); - add_submenu_item(elgg_echo('blog:friends'),$CONFIG->wwwroot."pg/blog/" . $_SESSION['user']->username . "/friends/"); - add_submenu_item(elgg_echo('blog:everyone'),$CONFIG->wwwroot."mod/blog/everyone.php"); - - } else if (page_owner()) { - add_submenu_item(sprintf(elgg_echo('blog:user'),$page_owner->name),$CONFIG->wwwroot."pg/blog/" . $page_owner->username); - if ($page_owner instanceof ElggUser) { // Sorry groups, this isn't for you. - add_submenu_item(sprintf(elgg_echo('blog:user:friends'),$page_owner->name),$CONFIG->wwwroot."pg/blog/" . $page_owner->username . "/friends/"); - } - add_submenu_item(elgg_echo('blog:everyone'),$CONFIG->wwwroot."mod/blog/everyone.php"); - } else { - add_submenu_item(elgg_echo('blog:everyone'),$CONFIG->wwwroot."mod/blog/everyone.php"); - } - - if (can_write_to_container(0, page_owner()) && isloggedin()) - add_submenu_item(elgg_echo('blog:addpost'),$CONFIG->wwwroot."pg/blog/{$page_owner->username}/new/"); - - if (!defined('everyoneblog') && page_owner()) { - - if ($dates = get_entity_dates('object','blog',page_owner())) { - foreach($dates as $date) { - $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 = page_owner_entity(); - $link = $CONFIG->wwwroot . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh; - add_submenu_item(sprintf(elgg_echo('date:month:'.substr($date,4,2)),substr($date,0,4)),$link,'filter'); - } - } - - } - - } - - // Group submenu - $page_owner = page_owner_entity(); - - if ($page_owner instanceof ElggGroup && get_context() == 'groups') { - if($page_owner->blog_enable != "no"){ - add_submenu_item(sprintf(elgg_echo("blog:group"),$page_owner->name), $CONFIG->wwwroot . "pg/blog/" . $page_owner->username ); - } - } - } - - /** - * Blog page handler; allows the use of fancy URLs - * - * @param array $page From the page_handler function - * @return true|false Depending on success - */ - function blog_page_handler($page) { - - // The first component of a blog URL is the username - if (isset($page[0])) { - set_input('username',$page[0]); - } - - // In case we have further input - if (isset($page[2])) { - set_input('param2',$page[2]); - } - // In case we have further input - if (isset($page[3])) { - set_input('param3',$page[3]); - } - - // The second part dictates what we're doing - if (isset($page[1])) { - switch($page[1]) { - case "read": set_input('blogpost',$page[2]); - include(dirname(__FILE__) . "/read.php"); return true; - break; - case "archive": include(dirname(__FILE__) . "/archive.php"); return true; - break; - case "friends": include(dirname(__FILE__) . "/friends.php"); return true; - break; - case "new": include(dirname(__FILE__) . "/add.php"); return true; - break; - - } - // If the URL is just 'blog/username', or just 'blog/', load the standard blog index - } else { - include(dirname(__FILE__) . "/index.php"); - return true; - } - - return false; - - } - - /** - * Hook into the framework and provide comments on blog entities. - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - * @return unknown - */ - function blog_annotate_comments($hook, $entity_type, $returnvalue, $params) - { - $entity = $params['entity']; - $full = $params['full']; - - if ( - ($entity instanceof ElggEntity) && // Is the right type - ($entity->getSubtype() == 'blog') && // Is the right subtype - ($entity->comments_on!='Off') && // Comments are enabled - ($full) // This is the full view - ) - { - // Display comments - return elgg_view_comments($entity); - } - - } - - /** - * Returns a more meaningful message - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - */ - function blog_notify_message($hook, $entity_type, $returnvalue, $params) - { - $entity = $params['entity']; - $to_entity = $params['to_entity']; - $method = $params['method']; - if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'blog')) - { - $descr = $entity->description; - $title = $entity->title; - if ($method == 'sms') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' via blog: ' . $title; - } - if ($method == 'email') { - $owner = $entity->getOwnerEntity(); - return $owner->name . ' via blog: ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL(); - } - } - return null; - } - - - /** - * Populates the ->getUrl() method for blog objects - * - * @param ElggEntity $blogpost Blog post entity - * @return string Blog post URL - */ - function blog_url($blogpost) { - - global $CONFIG; - $title = $blogpost->title; - $title = friendly_title($title); - return $CONFIG->url . "pg/blog/" . $blogpost->getOwnerEntity()->username . "/read/" . $blogpost->getGUID() . "/" . $title; - - } - - /** - * This function adds 'blog' to the list of objects which will be looked for pingback urls. - * - * @param unknown_type $hook - * @param unknown_type $entity_type - * @param unknown_type $returnvalue - * @param unknown_type $params - * @return unknown - */ - function blog_pingback_subtypes($hook, $entity_type, $returnvalue, $params) - { - $returnvalue[] = 'blog'; - - return $returnvalue; - } - - /** - * Listen to incoming pings, this parses an incoming target url - sees if its for me, and then - * either passes it back or prevents it from being created and attaches it as an annotation to a given - * - * @param unknown_type $event - * @param unknown_type $object_type - * @param unknown_type $object - */ - function blog_incoming_ping($event, $object_type, $object) - { - // TODO: Get incoming ping object, see if its a ping on a blog and if so attach it as a comment - } - - // Make sure the blog initialisation function is called on initialisation - register_elgg_event_handler('init','system','blog_init'); - register_elgg_event_handler('pagesetup','system','blog_pagesetup'); - - // Register actions - global $CONFIG; - register_action("blog/add",false,$CONFIG->pluginspath . "blog/actions/add.php"); - register_action("blog/edit",false,$CONFIG->pluginspath . "blog/actions/edit.php"); - register_action("blog/delete",false,$CONFIG->pluginspath . "blog/actions/delete.php"); - +<?php
+
+ /**
+ * Elgg blog plugin
+ **/
+
+ function blog_init() {
+
+ // Load system configuration
+ global $CONFIG;
+
+ // Set up menu for logged in users
+ if (isloggedin()) {
+
+ add_menu(elgg_echo('blog:yours'), $CONFIG->wwwroot . "pg/blog/" . $_SESSION['user']->username);
+
+ // And for logged out users
+ } else {
+ add_menu(elgg_echo('blog'), $CONFIG->wwwroot . "mod/blog/everyone.php",array(
+ ));
+ }
+
+ // Extend system CSS with our own styles, which are defined in the blog/css view
+ extend_view('css','blog/css');
+
+ // Extend hover-over menu
+ extend_view('profile/menu/links','blog/menu');
+
+ // Register a page handler, so we can have nice URLs
+ register_page_handler('blog','blog_page_handler');
+
+ // Register a URL handler for blog posts
+ register_entity_url_handler('blog_url','object','blog');
+
+ // Register this plugin's object for sending pingbacks
+ register_plugin_hook('pingback:object:subtypes', 'object', 'blog_pingback_subtypes');
+
+ // Register granular notification for this type
+ if (is_callable('register_notification_object'))
+ register_notification_object('object', 'blog', elgg_echo('blog:newpost'));
+
+ // Listen to notification events and supply a more useful message
+ register_plugin_hook('notify:entity:message', 'object', 'blog_notify_message');
+
+ // Add a new blog widget
+ add_widget_type('blog',elgg_echo("blog"),elgg_echo("blog:widget:description"),'profile, dashboard');
+
+ // Listen for new pingbacks
+ register_elgg_event_handler('create', 'object', 'blog_incoming_ping');
+
+ // Register entity type
+ register_entity_type('object','blog');
+
+ // Register an annotation handler for comments etc
+ register_plugin_hook('entity:annotate', 'object', 'blog_annotate_comments');
+
+ // Add group menu option
+ add_group_tool_option('blog',elgg_echo('blog:enableblog'),true);
+ }
+
+ function blog_pagesetup() {
+
+ global $CONFIG;
+
+ //add submenu options
+ if (get_context() == "blog") {
+ $page_owner = page_owner_entity();
+
+ if ((page_owner() == $_SESSION['guid'] || !page_owner()) && isloggedin()) {
+ add_submenu_item(elgg_echo('blog:your'),$CONFIG->wwwroot."pg/blog/" . $_SESSION['user']->username);
+ add_submenu_item(elgg_echo('blog:friends'),$CONFIG->wwwroot."pg/blog/" . $_SESSION['user']->username . "/friends/");
+ add_submenu_item(elgg_echo('blog:everyone'),$CONFIG->wwwroot."mod/blog/everyone.php");
+
+ } else if (page_owner()) {
+ add_submenu_item(sprintf(elgg_echo('blog:user'),$page_owner->name),$CONFIG->wwwroot."pg/blog/" . $page_owner->username);
+ if ($page_owner instanceof ElggUser) { // Sorry groups, this isn't for you.
+ add_submenu_item(sprintf(elgg_echo('blog:user:friends'),$page_owner->name),$CONFIG->wwwroot."pg/blog/" . $page_owner->username . "/friends/");
+ }
+ add_submenu_item(elgg_echo('blog:everyone'),$CONFIG->wwwroot."mod/blog/everyone.php");
+ } else {
+ add_submenu_item(elgg_echo('blog:everyone'),$CONFIG->wwwroot."mod/blog/everyone.php");
+ }
+
+ if (can_write_to_container(0, page_owner()) && isloggedin())
+ add_submenu_item(elgg_echo('blog:addpost'),$CONFIG->wwwroot."pg/blog/{$page_owner->username}/new/");
+
+ if (!defined('everyoneblog') && page_owner()) {
+
+ if ($dates = get_entity_dates('object','blog',page_owner())) {
+ foreach($dates as $date) {
+ $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 = page_owner_entity();
+ $link = $CONFIG->wwwroot . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh;
+ add_submenu_item(sprintf(elgg_echo('date:month:'.substr($date,4,2)),substr($date,0,4)),$link,'filter');
+ }
+ }
+
+ }
+
+ }
+
+ // Group submenu
+ $page_owner = page_owner_entity();
+
+ if ($page_owner instanceof ElggGroup && get_context() == 'groups') {
+ if($page_owner->blog_enable != "no"){
+ add_submenu_item(sprintf(elgg_echo("blog:group"),$page_owner->name), $CONFIG->wwwroot . "pg/blog/" . $page_owner->username );
+ }
+ }
+ }
+
+ /**
+ * Blog page handler; allows the use of fancy URLs
+ *
+ * @param array $page From the page_handler function
+ * @return true|false Depending on success
+ */
+ function blog_page_handler($page) {
+
+ // The first component of a blog URL is the username
+ if (isset($page[0])) {
+ set_input('username',$page[0]);
+ }
+
+ // In case we have further input
+ if (isset($page[2])) {
+ set_input('param2',$page[2]);
+ }
+ // In case we have further input
+ if (isset($page[3])) {
+ set_input('param3',$page[3]);
+ }
+
+ // The second part dictates what we're doing
+ if (isset($page[1])) {
+ switch($page[1]) {
+ case "read": set_input('blogpost',$page[2]);
+ include(dirname(__FILE__) . "/read.php"); return true;
+ break;
+ case "archive": include(dirname(__FILE__) . "/archive.php"); return true;
+ break;
+ case "friends": include(dirname(__FILE__) . "/friends.php"); return true;
+ break;
+ case "new": include(dirname(__FILE__) . "/add.php"); return true;
+ break;
+
+ }
+ // If the URL is just 'blog/username', or just 'blog/', load the standard blog index
+ } else {
+ @include(dirname(__FILE__) . "/index.php");
+ return true;
+ }
+
+ return false;
+
+ }
+
+ /**
+ * Hook into the framework and provide comments on blog entities.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+ function blog_annotate_comments($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $full = $params['full'];
+
+ if (
+ ($entity instanceof ElggEntity) && // Is the right type
+ ($entity->getSubtype() == 'blog') && // Is the right subtype
+ ($entity->comments_on!='Off') && // Comments are enabled
+ ($full) // This is the full view
+ )
+ {
+ // Display comments
+ return elgg_view_comments($entity);
+ }
+
+ }
+
+ /**
+ * Returns a more meaningful message
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ */
+ function blog_notify_message($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $to_entity = $params['to_entity'];
+ $method = $params['method'];
+ if (($entity instanceof ElggEntity) && ($entity->getSubtype() == 'blog'))
+ {
+ $descr = $entity->description;
+ $title = $entity->title;
+ if ($method == 'sms') {
+ $owner = $entity->getOwnerEntity();
+ return $owner->username . ' via blog: ' . $title;
+ }
+ if ($method == 'email') {
+ $owner = $entity->getOwnerEntity();
+ return $owner->username . ' via blog: ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Populates the ->getUrl() method for blog objects
+ *
+ * @param ElggEntity $blogpost Blog post entity
+ * @return string Blog post URL
+ */
+ function blog_url($blogpost) {
+
+ global $CONFIG;
+ $title = $blogpost->title;
+ $title = friendly_title($title);
+ return $CONFIG->url . "pg/blog/" . $blogpost->getOwnerEntity()->username . "/read/" . $blogpost->getGUID() . "/" . $title;
+
+ }
+
+ /**
+ * This function adds 'blog' to the list of objects which will be looked for pingback urls.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ * @return unknown
+ */
+ function blog_pingback_subtypes($hook, $entity_type, $returnvalue, $params)
+ {
+ $returnvalue[] = 'blog';
+
+ return $returnvalue;
+ }
+
+ /**
+ * Listen to incoming pings, this parses an incoming target url - sees if its for me, and then
+ * either passes it back or prevents it from being created and attaches it as an annotation to a given
+ *
+ * @param unknown_type $event
+ * @param unknown_type $object_type
+ * @param unknown_type $object
+ */
+ function blog_incoming_ping($event, $object_type, $object)
+ {
+ // TODO: Get incoming ping object, see if its a ping on a blog and if so attach it as a comment
+ }
+
+ /**
+ * remove the more link in the blog text
+ **/
+ function remove_more($body){
+ $text = str_replace("{{more}}", " ", $body);
+ return $text;
+ }
+
+ // Make sure the blog initialisation function is called on initialisation
+ register_elgg_event_handler('init','system','blog_init');
+ register_elgg_event_handler('pagesetup','system','blog_pagesetup');
+
+ // Register actions
+ global $CONFIG;
+ register_action("blog/add",false,$CONFIG->pluginspath . "blog/actions/add.php");
+ register_action("blog/edit",false,$CONFIG->pluginspath . "blog/actions/edit.php");
+ register_action("blog/delete",false,$CONFIG->pluginspath . "blog/actions/delete.php");
+
?>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/archive.php b/mod/blog/views/default/blog/archive.php new file mode 100644 index 000000000..76ae16696 --- /dev/null +++ b/mod/blog/views/default/blog/archive.php @@ -0,0 +1,22 @@ +<?php +//get blog archives +global $CONFIG; +if (!defined('everyoneblog') && page_owner()) { + echo "<div class='SidebarBox'>"; + echo "<h3>" . elgg_echo('blog:archive') ."</h3>"; + echo "<div class='ContentWrapper'><div id='Owner_Block_Links'><ul>"; + if ($dates = get_entity_dates('object','blog',page_owner())) { + foreach($dates as $date) { + $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 = page_owner_entity(); + $link = $CONFIG->wwwroot . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh; + //echo (sprintf(elgg_echo('date:month:'.substr($date,4,2)),substr($date,0,4)),$link,'filter'); + $year = substr($date,0,-2); + $month = date('F',mktime(0, 0, 0, substr($date,4,2), 1)); //substr($date,4,2); + $display_date = $month . " " . $year; + echo "<li><a href=\"{$link}\">" . $display_date . "</a></li>"; + } + } + echo "</ul></div></div></div>"; +}
\ No newline at end of file diff --git a/mod/blog/views/default/blog/categorylist.php b/mod/blog/views/default/blog/categorylist.php index 90403c550..799c837a7 100644 --- a/mod/blog/views/default/blog/categorylist.php +++ b/mod/blog/views/default/blog/categorylist.php @@ -1,14 +1,14 @@ -<?php - $list = elgg_view('categories/list',$vars); - if (!empty($list)) { -?> - - <div class="blog_categories"> - <?php echo $list; ?> - </div> - -<?php - - } - +<?php
+ $list = elgg_view('categories/list',$vars);
+ if (!empty($list)) {
+?>
+
+ <div class="blog_categories">
+ <?php echo $list; ?>
+ </div>
+
+<?php
+
+ }
+
?>
\ 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 c9522c901..738aa9ef6 100644 --- a/mod/blog/views/default/blog/css.php +++ b/mod/blog/views/default/blog/css.php @@ -1,66 +1,127 @@ <?php /** - * Elgg blog CSS extender + * Elgg blog css * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ */ ?> #blogs .pagination { +/* margin:5px 10px 0 10px; padding:5px; display:block; -} -#blogs #two_column_left_sidebar_maincontent { - padding-bottom:10px; +*/ } .singleview { - margin-top:10px; + /* margin-top:10px !important; */ } -.blog_post_icon { - float:left; - margin:3px 0 0 0; - padding:0; +/* +we're partly using the #NewListStyle on blogs +ItemMetaData block only +*/ +#blogs .ContentWrapper.Welcome { + padding:10px 0 10px 0; +} +#blogs .search_listing .search_listing_info .ItemMetaData { + float:right; + margin-left:15px; + margin-top:0; + margin-right: 3px; + color:#AAAAAA; + text-align: right; + font-size:90%; +} +#blogs .search_listing .search_listing_info .ItemMetaData table { + width:200px; + /* float:right; removed for ie7 compatability */ +} +#blogs .search_listing .search_listing_info .ItemMetaData .EditItem a { + color:#AAAAAA; + margin:0 0 0 10px; +} +#blogs .search_listing .search_listing_info .ItemMetaData .EditItem a:hover { + color: #0054a7; + text-decoration: underline; } -.blog_post h3 { - font-size: 150%; - margin:0 0 10px 0; - padding:0; +#blogs .search_listing .search_listing_info .ItemMetaData td.FavouriteItem { + padding-top:0; } +/* IE7 */ +*:first-child+html #blogs .search_listing .search_listing_info .ItemMetaData td.FavouriteItem { width:auto; } -.blog_post h3 a { - text-decoration: none; + +/* BLOG TITLE IN LIST VIEWS */ +#blogs h2.blog_title { + line-height:1.1em; + margin-top:0; + font-size:1.4em; +} +#blogs h2.blog_title a { + color:#0054A7; +} +#blogs .search_listing_info p.blog_excerpt { + margin-top:3px; + padding-top:2px; + border-top:1px solid #cccccc; +} +#blogs .search_listing_info p.owner_timestamp { + margin-top:2px; } -.blog_post p { - margin: 0 0 5px 0; +.Page_Header_Options .cancel_button { + float:right; + margin:0 10px 0 0; +} + +.blog_post_icon { + float:left; + margin:0 0 0 0; + padding:0; +} +#blogs .search_listing_info { + margin-left:34px; } +.blog_post #content_area_user_title { + +} +.blog_post #content_area_user_title h2 { + margin:0 0 5px; + padding:0 0 5px; + border-bottom:1px solid #cccccc; +} .blog_post .strapline { - margin: 0 0 0 35px; + margin: 0 0 0 30px; padding:0; color: #aaa; - line-height:1em; + line-height:0.8em; +} +.blog_post .strapline .generic_access, +.blog_post .strapline .shared_collection, +.blog_post .strapline .group_open, +.blog_post .strapline .group_closed { + line-height:1.4em; + display:block; } .blog_post p.tags { - background:transparent url(<?php echo $vars['url']; ?>_graphics/icon_tag.gif) no-repeat scroll left 2px; - margin:0 0 7px 35px; - padding:0pt 0pt 0pt 16px; + background:transparent url(<?php echo $vars['url']; ?>_graphics/icon_tag.png) no-repeat scroll left 2px; + margin:0; + padding:0 0 0 16px; min-height:22px; } .blog_post .options { margin:0; padding:0; } - +.blog_post_body { + margin-top:2px; + padding-top:8px; + border-top:1px solid #cccccc; +} .blog_post_body img[align="left"] { margin: 10px 10px 10px 0; float:left; @@ -99,47 +160,9 @@ margin:5px 0 5px 0; } -/* New blog edit column */ -#blog_edit_page { - /* background: #bbdaf7; */ - margin-top:-10px; -} -#blog_edit_page #content_area_user_title h2 { - background: none; - border-top: none; - margin:0 0 10px 0px; - padding:0px 0 0 0; -} -#blog_edit_page #blog_edit_sidebar #content_area_user_title h2 { - background:none; - border-top:none; - margin:inherit; - padding:0 0 5px 5px; - font-size:1.25em; - line-height:1.2em; -} -#blog_edit_page #blog_edit_sidebar { - margin:0px 0 22px 0; - background: #dedede; - padding:5px; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - border-bottom:1px solid #cccccc; - border-right:1px solid #cccccc; -} -#blog_edit_page #two_column_left_sidebar_210 { - width:210px; - margin:0px 0 20px 0px; - min-height:360px; - float:left; - padding:0; -} -#blog_edit_page #two_column_left_sidebar_maincontent { - margin:0 0px 20px 20px; - padding:10px 20px 20px 20px; - width:670px; - background: #bbdaf7; -} + + + /* unsaved blog post preview */ .blog_previewpane { border:1px solid #D3322A; @@ -153,12 +176,12 @@ margin:0; } -#blog_edit_sidebar .publish_controls, -#blog_edit_sidebar .blog_access, -#blog_edit_sidebar .publish_options, -#blog_edit_sidebar .publish_blog, -#blog_edit_sidebar .allow_comments, -#blog_edit_sidebar .categories { +#blog_edit_page .publish_controls, +#blog_edit_page .blog_access, +#blog_edit_page .publish_options, +#blog_edit_page .publish_blog, +#blog_edit_page .allow_comments, +#blog_edit_page .categories { margin:0 5px 5px 5px; border-top:1px solid #cccccc; } @@ -170,9 +193,6 @@ #blog_edit_page p { margin:5px 0 5px 0; } -#blog_edit_page #two_column_left_sidebar_maincontent p { - margin:0 0 15px 0; -} #blog_edit_page .publish_blog input[type="submit"] { font-weight: bold; padding:2px; @@ -204,7 +224,46 @@ } +/* blog edit page */ +#blogPostForm .ContentWrapper { + margin-top:10px; +} +#blogPostForm .ContentWrapper #excerpt_editarea { + margin-top:15px; + margin-bottom:15px; +} +#excerpt_editarea .input-textarea { + height:80px; +} +#blogPostForm .current_access { + color:inherit; + font-size:inherit; + line-height:1.0em; + padding-top:0; +} - +/* blog widget on groups */ +.collapsable_box_content .ContentWrapper.blogs.more { + margin:0 10px; + padding:5px 10px; +} +.collapsable_box_content .ContentWrapper.blogs { + line-height:1.2em; + margin-bottom:5px; +} +.collapsable_box_content .ContentWrapper.blogs .river_object_blog_create { + background-position:left 2px; + min-height:17px; + padding:2px 0 2px 19px; + border-bottom:1px solid #DDDDDD; + line-height:1.1em; +} +.collapsable_box_content .ContentWrapper.blogs .river_object_blog_create:first-child { + border-top:1px solid #DDDDDD; +} +.collapsable_box_content .ContentWrapper.blogs .river_object_blog_create span { + font-size: 90%; + color:#666666; +} diff --git a/mod/blog/views/default/blog/forms/edit.php b/mod/blog/views/default/blog/forms/edit.php index d3f4d7e52..09389a8fb 100644 --- a/mod/blog/views/default/blog/forms/edit.php +++ b/mod/blog/views/default/blog/forms/edit.php @@ -1,169 +1,226 @@ +<script> +$(document).ready(function(){ + $('#excerpt.excerpt').each(function(){ + var allowed = 200; + + // set the initial value + $('#countervalue').text(allowed); + + // bind on key up event + $(this).keyup(function(){ + var counter_value = ((allowed - ($(this).val().length))); + + $("#countervalue").removeClass(); + + if ((counter_value > 10)) { + $("#countervalue").addClass("positive"); + } + else if ((counter_value <= 10) && (counter_value >= 0)) { + $("#countervalue").addClass("gettingclose"); + } + else if ((counter_value < 0)) { + $("#countervalue").addClass("negative"); + } + + // insert new length + $('#countervalue').text(counter_value); + + }); + }); +}); +</script> <?php +/** +* Elgg blog edit/add page +*/ - /** - * Elgg blog edit/add page - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['object'] Optionally, the blog post to edit - */ - - // Set title, form destination - if (isset($vars['entity'])) { - $title = sprintf(elgg_echo("blog:editpost"),$object->title); - $action = "blog/edit"; - $title = $vars['entity']->title; - $body = $vars['entity']->description; - $tags = $vars['entity']->tags; - if ($vars['entity']->comments_on == 'Off') { - $comments_on = false; - } else { - $comments_on = true; - } - $access_id = $vars['entity']->access_id; - } else { - $title = elgg_echo("blog:addpost"); - $action = "blog/add"; - $tags = ""; - $title = ""; - $comments_on = true; - $description = ""; - if (defined('ACCESS_DEFAULT')) - $access_id = ACCESS_DEFAULT; - else - $access_id = 0; - - $container = $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; - } +//access details +$loggedin_user_access = get_default_access(get_loggedin_user()); +$user_acl = get_readable_access_level($loggedin_user_access); - // Just in case we have some cached details - if (empty($body)) { - $body = $vars['user']->blogbody; - if (!empty($body)) { - $title = $vars['user']->blogtitle; - $tags = $vars['user']->blogtags; - } - } +//Populate the title, body and acction variables if it is an edit, declare them if it is a new post +if (isset($vars['entity'])) { + $title = sprintf(elgg_echo("blog:editpost"),$object->title); + $action = "blog/edit"; + $title = $vars['entity']->title; + $body = $vars['entity']->description; + $tags = $vars['entity']->tags; + if ($vars['entity']->comments_on == 'Off') + $comments_on = false; + else + $comments_on = true; + $access_id = $vars['entity']->access_id; + $show_excerpt = $vars['entity']->show_excerpt; + if($show_excerpt) + $excerpt = $vars['entity']->excerpt; + else + $excerpt = ""; + $page_title = elgg_view_title(elgg_echo('blog:editpost')); +}else{ + $title = elgg_echo("blog:addpost"); + $action = "blog/add"; + $tags = ""; + $title = ""; + $comments_on = true; + $description = ""; + $excerpt = ""; + $show_excerpt = ''; + $page_title = elgg_view_title(elgg_echo('blog:addpost')); + if(page_owner_entity() instanceof ElggGroup){ + //if in a group, set the access level to default to the group + $access_id = page_owner_entity()->group_acl; + }else{ + $access_id = $loggedin_user_access; + } + $container = $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; +} - // set the required variables - - $title_label = elgg_echo('title'); - $title_textbox = elgg_view('input/text', array('internalname' => 'blogtitle', 'value' => $title)); - $text_label = elgg_echo('blog:text'); - $text_textarea = elgg_view('input/longtext', array('internalname' => 'blogbody', 'value' => $body)); - $tag_label = elgg_echo('tags'); - $tag_input = elgg_view('input/tags', array('internalname' => 'blogtags', 'value' => $tags)); - $access_label = elgg_echo('access'); - - //$comments_select = elgg_view('input/checkboxes', array('internalname' => 'comments_on', 'value' => '')); - if($comments_on) - $comments_on_switch = "checked=\"checked\""; - else - $comment_on_switch = ""; - - $access_input = elgg_view('input/access', array('internalname' => 'access_id', 'value' => $access_id)); - $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('publish'))); - $conversation = elgg_echo('Conversation'); - $publish = elgg_echo('publish'); - $cat = elgg_echo('categories'); - $preview = elgg_echo('blog:preview'); - $privacy = elgg_echo('access'); - $savedraft = elgg_echo('blog:draft:save'); - $draftsaved = elgg_echo('blog:draft:saved'); - $never = elgg_echo('blog:never'); - $allowcomments = elgg_echo('blog:comments:allow'); - - // INSERT EXTRAS HERE - $extras = elgg_view('categories',$vars); - if (!empty($extras)) $extras = '<div id="blog_edit_sidebar">' . $extras . '</div>'; +//Just in case we have some cached details +if (empty($body)) { + $body = $vars['user']->blogbody; + if (!empty($body)) { + $title = $vars['user']->blogtitle; + $tags = $vars['user']->blogtags; + } +} + +//set the required input fields +$title_label = elgg_echo('blog:title'); +$title_textbox = elgg_view('input/text', array('internalname' => 'blogtitle', 'value' => $title)); +$text_label = elgg_echo('blog:text'); +$text_textarea = elgg_view('input/longtext', array('internalname' => 'blogbody', 'value' => $body)); +$excerpt_label = elgg_echo('blog:excerpt'); +$excerpt_counter = "<div class='thewire_characters_remaining'><span id='countervalue'></span></div>"; +$excerpt_textarea = elgg_view('input/text', array('internalname' => 'blogexcerpt', 'internalid' => 'excerpt', 'class' => 'excerpt input-textarea', 'value' => $excerpt)); +$excerpt_desc = elgg_echo('blog:excerptdesc'); +$show_excerpt_field = elgg_view('input/hidden', array('internalname' => 'show_excerpt', 'value' => $show_excerpt)); +$tag_label = elgg_echo('tags'); +$tag_input = elgg_view('input/tags', array('internalname' => 'blogtags', 'value' => $tags)); +$access_label = elgg_echo('access'); +if($comments_on) + $comments_on_switch = "checked=\"checked\""; +else + $comment_on_switch = ""; +//if it is a group, pull out the group access view +if(page_owner_entity() instanceof ElggGroup){ + $options = group_access_options(page_owner_entity()); +}else{ + $options = ''; +} +$access_input = elgg_view('input/access', array('internalname' => 'access_id', 'value' => $access_id, 'options' => $options)); +$submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('publish'))); +$conversation = elgg_echo('Conversation'); +$publish = elgg_echo('publish'); +$cat = elgg_echo('categories'); +$preview = elgg_echo('blog:preview'); +$privacy = elgg_echo('access'); +$savedraft = elgg_echo('blog:draft:save'); +$draftsaved = elgg_echo('blog:draft:saved'); +$never = elgg_echo('blog:never'); +$allowcomments = elgg_echo('blog:comments:allow'); +$user_default_access = elgg_echo('blog:defaultaccess'); +$ownerblock = elgg_view('blog/ownerblock', array('entity' => $vars['entity'])); +if($vars['entity']){ + $deletepage = elgg_view('output/confirmlink',array( + 'href' => $vars['url'] . "action/blog/delete?blogpost=" . $vars['entity']->getGUID(), + 'text' => elgg_echo("delete"), + 'confirm' => elgg_echo("blog:delete:confirm"), + 'class' => "Action_Button Disabled")); +}else{ + $deletepage = ""; +} + +//INSERT EXTRAS HERE +$extras = elgg_view('categories',$vars); +if (!empty($extras)) $extras = '<div class="SidebarBox">' .$cat .'<div class="ContentWrapper">'. $extras . '</div></div>'; ?> <?php +//construct the form +$form_body = <<<EOT +<div id="LayoutCanvas_2ColumnRHS_Sidebar"> + {$ownerblock} + <div class="SidebarBox"> + <h3>{$publish}</h3> - $form_body = <<<EOT - - <div id="two_column_left_sidebar_210"> + <div class="ContentWrapper"> - <div id="blog_edit_sidebar"> - <div id="content_area_user_title"> - <div class="preview_button"><a onclick="javascript:saveDraft(true);return true;">{$preview}</a></div> - <h2>{$publish}</h2></div> - <div class="publish_controls"> - <p> - <a href="#" onclick="javascript:saveDraft(false);return false;">{$savedraft}</a> - </p> + <div class="blog_access"> + <p>{$privacy}: {$access_input}</p> </div> - <div class="publish_options"> - <!-- <p><b>{$publish}:</b> now <a href="">edit</a></p> --> - <p class="auto_save">{$draftsaved}: <span id="draftSavedCounter">{$never}</span></p> + <div class="current_access">{$user_default_access}<br /><b>{$user_acl}</b></span></div> + </div> + + <div class="ContentWrapper"> + <div class="allow_comments"> + <label><input type="checkbox" name="comments_select" {$comments_on_switch} /> {$allowcomments}</label> </div> - <div class="blog_access"> - <p>{$privacy}: {$access_input} - </p></div> + </div> + + <div class="ContentWrapper"> + <div class="publish_blog"> + <div class="publish_controls"> + {$draftsaved}: <span id="draftSavedCounter">{$never}</span> + <a href="#" onclick="javascript:saveDraft(false);return false;">{$savedraft}</a> + </div> + {$submit_input} </div> </div> + </div> - <div id="blog_edit_sidebar"> - <div id="content_area_user_title"><h2>{$conversation}</h2></div> - <div class="allow_comments"> - <p><label> - <input type="checkbox" name="comments_select" {$comments_on_switch} /> {$allowcomments} - </label></p> - </div> - </div> + {$extras} + {$container} +</div> - {$extras} - - $container +<!-- main content --> +<div id="LayoutCanvas_2ColumnRHS_MainArea"> + + +<div id="Page_Header"> + <div class="Page_Header_Title"> + {$page_title} + </div> + + <div class="Page_Header_Options"> - </div><!-- /two_column_left_sidebar_210 --> + <a class="Action_Button" onclick="javascript:saveDraft(true);return true;">{$preview}</a> + {$deletepage} + </div><div class='clearfloat'></div> +</div> - <!-- main content --> - <div id="two_column_left_sidebar_maincontent"> + + + +<div class="ContentWrapper"> EOT; -?> +if (isset($vars['entity'])) + $entity_hidden = elgg_view('input/hidden', array('internalname' => 'blogpost', 'value' => $vars['entity']->getGUID())); +else + $entity_hidden = ''; -<?php - - if (isset($vars['entity'])) { - $entity_hidden = elgg_view('input/hidden', array('internalname' => 'blogpost', 'value' => $vars['entity']->getGUID())); - } else { - $entity_hidden = ''; - } - - $form_body .= <<<EOT - <p> - <label>$title_label</label><br /> - $title_textbox - </p> - <p class='longtext_editarea'> - <label>$text_label</label><br /> - $text_textarea - </p> - <p> - <label>$tag_label</label><br /> - $tag_input - </p> - <!-- <p> - <label>$access_label</label><br /> - $access_input - </p> --> - <p> - $entity_hidden - <!-- $submit_input --> - </p> - </div><div class="clearfloat"></div><!-- /two_column_left_sidebar_maincontent --> +$form_body .= <<<EOT + <p><label>$title_label</label><br />$title_textbox</p> + <p class='longtext_editarea'> + $text_textarea + </p> + <div id='excerpt_editarea'> + <label>$excerpt_label</label><br />$excerpt_desc $excerpt_counter<br /> + $excerpt_textarea + </div> + <p><label>$tag_label</label><br />$tag_input</p> + <p>$entity_hidden</p> + $show_excerpt_field +</div> +</div> +<div class="clearfloat"></div> EOT; - echo elgg_view('input/form', array('action' => "{$vars['url']}action/$action", 'body' => $form_body, 'internalid' => 'blogPostForm')); +//display the form +echo elgg_view('input/form', array('action' => "{$vars['url']}action/$action", 'body' => $form_body, 'internalid' => 'blogPostForm')); ?> <script type="text/javascript"> diff --git a/mod/blog/views/default/blog/gallery.php b/mod/blog/views/default/blog/gallery.php index 23f0418bc..7fa05040e 100644 --- a/mod/blog/views/default/blog/gallery.php +++ b/mod/blog/views/default/blog/gallery.php @@ -1,31 +1,21 @@ -<?php - - /** - * Elgg blog listing - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - $owner = $vars['entity']->getOwnerEntity(); - $friendlytime = friendly_time($vars['entity']->time_created); - $icon = elgg_view( - "profile/icon", array( - 'entity' => $owner, - 'size' => 'small', - ) - ); - $info = "<p>" . elgg_echo('blog') . ": <a href=\"{$vars['entity']->getURL()}\">{$vars['entity']->title}</a></p>"; - $info .= "<p><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</p>"; - - //display - echo "<div class=\"blog_gallery\">"; - echo "<div class=\"blog_gallery_icon\">" . $icon . "</div>"; - echo "<div class=\"blog_gallery_content\">" . $info . "</div>"; - echo "</div>"; - - -?>
\ No newline at end of file +<?php
+
+/**
+ * Elgg blog listing
+ */
+$owner = $vars['entity']->getOwnerEntity();
+$friendlytime = friendly_time($vars['entity']->time_created);
+$icon = elgg_view(
+ "profile/icon", array(
+ 'entity' => $owner,
+ 'size' => 'small',
+ )
+ );
+$info = "<p>" . elgg_echo('blog') . ": <a href=\"{$vars['entity']->getURL()}\">{$vars['entity']->title}</a></p>";
+$info .= "<p><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</p>";
+
+//display
+echo "<div class=\"blog_gallery\">";
+echo "<div class=\"blog_gallery_icon\">" . $icon . "</div>";
+echo "<div class=\"blog_gallery_content\">" . $info . "</div>";
+echo "</div>";
\ No newline at end of file diff --git a/mod/blog/views/default/blog/listing.php b/mod/blog/views/default/blog/listing.php index b2dad2570..7aae87b27 100644 --- a/mod/blog/views/default/blog/listing.php +++ b/mod/blog/views/default/blog/listing.php @@ -1,25 +1,64 @@ <?php - /** - * Elgg blog listing - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - $owner = $vars['entity']->getOwnerEntity(); - $friendlytime = friendly_time($vars['entity']->time_created); - $icon = elgg_view( - "profile/icon", array( - 'entity' => $owner, - 'size' => 'small', - ) - ); - $info = "<p>" . elgg_echo('blog') . ": <a href=\"{$vars['entity']->getURL()}\">{$vars['entity']->title}</a></p>"; - $info .= "<p class=\"owner_timestamp\"><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</p>"; - echo elgg_view_listing($icon,$info); - -?>
\ No newline at end of file +/** + * Elgg blog listing + */ + +$owner = $vars['entity']->getOwnerEntity(); +$friendlytime = sprintf(elgg_echo("blog:strapline"), + date("F j, Y",$vars['entity']->time_created) + ); +$tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags)); +$num_comments = elgg_count_comments($vars['entity']); +$icon = elgg_view( + "profile/icon", array( + 'entity' => $owner, + 'size' => 'tiny', + ) + ); +//sort out the access level for display +$object_acl = get_readable_access_level($vars['entity']->access_id); +//files with these access level don't need an icon +$general_access = array('Public', 'Logged in users', 'Friends'); +//set the right class for access level display - need it to set on groups and shared access only +$check_is_group = get_entity($vars['entity']->container_guid); +if($check_is_group instanceof ElggGroup){ + //get the membership type open/closed + $membership = $check_is_group->membership; + //we decided to show that the item is in a group, rather than its actual access level + $object_acl = "Group: " . $is_group->name; + if($membership == 2) + $access_level = "class='group_open'"; + else + $access_level = "class='group_closed'"; +}elseif($object_acl == 'Private'){ + $access_level = "class='private'"; +}else{ + if(!in_array($object_acl, $general_access)) + $access_level = "class='shared_collection'"; + else + $access_level = "class='generic_access'"; +} +//display the access level + $info = "<div class='ItemMetaData'><table><tr>"; + + //$table_column_number = ""; +//include edit and delete options +if ($vars['entity']->canEdit()) { + $info .= "<td class='EditItem'><span class='EditItem'><a href=\"{$vars['url']}mod/blog/edit.php?blogpost={$vars['entity']->getGUID()}\">" . elgg_echo('edit') . "</a></span></td>"; + $info .= "<td class='DeleteItem'><div class='Delete_Button'>" . elgg_view('output/confirmlink',array('href' => $vars['url'] . "action/blog/delete?blogpost=" . $vars['entity']->getGUID(), 'text' => elgg_echo("delete"),'confirm' => elgg_echo("file:delete:confirm"),)). "</div></td>"; + //$table_column_number = " colspan='3' "; +} + + $info .= "<td class='FavouriteItem'>" . elgg_view("blogs/options",array('entity' => $vars['entity'])) ."</td>"; + +$info .= "</tr></table><div><span {$access_level}>" . $object_acl . "</span></div></div>"; + + +$info .= "<h2 class='blog_title'><a href=\"{$vars['entity']->getURL()}\">{$vars['entity']->title}</a></h2>"; +$info .= "<p class='owner_timestamp'><a href=\"{$vars['url']}pg/blog/{$owner->username}\">{$owner->name}</a> {$friendlytime}, "; +$info .= "<a href='{$vars['entity']->getURL()}'>" . sprintf(elgg_echo("comments")) . " (" . $num_comments . ")</a></p>"; +$info .= "<p class='blog_excerpt'>" . display_objects(strip_tags($vars['entity']->excerpt)) . "</p>"; + +echo elgg_view_listing($icon,$info); + diff --git a/mod/blog/views/default/blog/menu.php b/mod/blog/views/default/blog/menu.php index 45384ae72..8ed3796b7 100644 --- a/mod/blog/views/default/blog/menu.php +++ b/mod/blog/views/default/blog/menu.php @@ -1,17 +1,9 @@ -<?php - - /** - * Elgg hoverover extender for blog - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - -?> - - <p class="user_menu_blog"> - <a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $vars['entity']->username; ?>"><?php echo elgg_echo("blog"); ?></a> +<?php
+/**
+ * Elgg hoverover extender for blog
+ */
+?>
+
+ <p class="user_menu_blog">
+ <a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $vars['entity']->username; ?>"><?php echo elgg_echo("blog"); ?></a>
</p>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/notfound.php b/mod/blog/views/default/blog/notfound.php index 543b98374..2ef231b17 100644 --- a/mod/blog/views/default/blog/notfound.php +++ b/mod/blog/views/default/blog/notfound.php @@ -1,21 +1,13 @@ -<?php - - /** - * Elgg blog not found page - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - -?> - - <p> - <?php - - echo elgg_echo("blog:notfound"); - - ?> +<?php
+/**
+ * Elgg blog not found page
+ */
+?>
+
+ <p>
+ <?php
+
+ echo elgg_echo("blog:notfound");
+
+ ?>
</p>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/previewpane.php b/mod/blog/views/default/blog/previewpane.php index 0828c06a9..da8fac2e5 100644 --- a/mod/blog/views/default/blog/previewpane.php +++ b/mod/blog/views/default/blog/previewpane.php @@ -1,6 +1,6 @@ -<div class="blog_previewpane"> - <p> - <?php echo elgg_echo("blog:preview:description"); ?> - <a href="javascript:history.go(-1);"><?php echo elgg_echo("blog:preview:description:link"); ?></a> - </p> +<div class="blog_previewpane">
+ <p>
+ <?php echo elgg_echo("blog:preview:description"); ?>
+ <a href="javascript:history.go(-1);"><?php echo elgg_echo("blog:preview:description:link"); ?></a>
+ </p>
</div>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/stats.php b/mod/blog/views/default/blog/stats.php new file mode 100644 index 000000000..d5bfe5b8b --- /dev/null +++ b/mod/blog/views/default/blog/stats.php @@ -0,0 +1,13 @@ +<?php +/** + * All site blog stats + **/ + +$count_blogs = get_entities("object", "blog",0,"",10,0,true,0,null,0,0); +$count_blog_comments = count_annotations(0, "object", "blog","generic_comment"); + +echo "<div class='SidebarBox'>"; +echo "<h3>Blog stats</h3>"; +echo "<div class='ContentWrapper'>"; +echo $count_blogs . " blog posts written with " . $count_blog_comments . " comments."; +echo "</div></div>";
\ No newline at end of file diff --git a/mod/blog/views/default/blog/view.php b/mod/blog/views/default/blog/view.php index 18841d224..a90f1775f 100644 --- a/mod/blog/views/default/blog/view.php +++ b/mod/blog/views/default/blog/view.php @@ -1,26 +1,15 @@ -<?php - - /** - * Elgg blog view page - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['posts'] An array of posts to view - */ - - // If there are any posts to view, view them - if (is_array($vars['posts']) && sizeof($vars['posts']) > 0) { - - foreach($vars['posts'] as $post) { - - echo elgg_view_entity($post); - - } - - } - -?>
\ No newline at end of file +<?php
+
+/**
+ * Elgg blog view page
+ * @uses $vars['posts'] An array of posts to view
+ */
+
+// If there are any posts to view, view them
+if (is_array($vars['posts']) && sizeof($vars['posts']) > 0) {
+ foreach($vars['posts'] as $post) {
+ echo elgg_view_entity($post);
+ }
+}else{
+ echo elgg_echo('blog:none');
+}
\ 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 898705911..8a7cd52b8 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -1,150 +1,161 @@ -<?php - - /** - * Elgg blog individual post view - * - * @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-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] Optionally, the blog post to view - */ - - if (isset($vars['entity'])) { - - //display comments link? - if ($vars['entity']->comments_on == 'Off') { - $comments_on = false; - } else { - $comments_on = true; - } - - if (get_context() == "search" && $vars['entity'] instanceof ElggObject) { - - //display the correct layout depending on gallery or list view - if (get_input('search_viewtype') == "gallery") { - - //display the gallery view - echo elgg_view("blog/gallery",$vars); - - } else { - - echo elgg_view("blog/listing",$vars); - - } - - - } else { - - if ($vars['entity'] instanceof ElggObject) { - - $url = $vars['entity']->getURL(); - $owner = $vars['entity']->getOwnerEntity(); - $canedit = $vars['entity']->canEdit(); - - } else { - - $url = 'javascript:history.go(-1);'; - $owner = $vars['user']; - $canedit = false; - - } -?> - - <div class="contentWrapper singleview"> - - <div class="blog_post"> - <h3><a href="<?php echo $url; ?>"><?php echo $vars['entity']->title; ?></a></h3> - <!-- display the user icon --> - <div class="blog_post_icon"> - <?php - echo elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny')); - ?> - </div> - <p class="strapline"> - <?php - - echo sprintf(elgg_echo("blog:strapline"), - date("F j, Y",$vars['entity']->time_created) - ); - - ?> - <?php echo elgg_echo('by'); ?> <a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a> - <!-- display the comments link --> - <?php - if($comments_on && $vars['entity'] instanceof ElggObject){ - //get the number of comments - $num_comments = elgg_count_comments($vars['entity']); - ?> - <a href="<?php echo $url; ?>"><?php echo sprintf(elgg_echo("comments")) . " (" . $num_comments . ")"; ?></a><br /> - <?php - } - ?> - </p> - <!-- display tags --> - <?php - - $tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags)); - if (!empty($tags)) { - echo '<p class="tags">' . $tags . '</p>'; - } - - $categories = elgg_view('categories/view', $vars); - if (!empty($categories)) { - echo '<p class="categories">' . $categories . '</p>'; - } - - ?> - <div class="clearfloat"></div> - <div class="blog_post_body"> - - <!-- display the actual blog post --> - <?php - - echo elgg_view('output/longtext',array('value' => $vars['entity']->description)); - - ?> - </div><div class="clearfloat"></div> - <!-- display edit options if it is the blog post owner --> - <p class="options"> - <?php - - if ($canedit) { - - ?> - <a href="<?php echo $vars['url']; ?>mod/blog/edit.php?blogpost=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("edit"); ?></a> - <?php - - echo elgg_view("output/confirmlink", array( - 'href' => $vars['url'] . "action/blog/delete?blogpost=" . $vars['entity']->getGUID(), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - )); - - // Allow the menu to be extended - echo elgg_view("editmenu",array('entity' => $vars['entity'])); - - ?> - <?php - } - - ?> - </p> - </div> - </div> - -<?php - - // If we've been asked to display the full view - // Now handled by annotation framework - /*if (isset($vars['full']) && $vars['full'] == true && $comments_on == 'on' && $vars['entity'] instanceof ElggEntity) { - echo elgg_view_comments($vars['entity']); - }*/ - - } - - } - -?> +<?php
+/**
+ * Elgg blog individual post view
+ */
+
+$page_owner = page_owner_entity();
+
+if (isset($vars['entity'])) {
+
+ //display comments link?
+ if ($vars['entity']->comments_on == 'Off') {
+ $comments_on = false;
+ } else {
+ $comments_on = true;
+ }
+ if (get_context() == "search" && $vars['entity'] instanceof ElggObject) {
+ //display the correct layout depending on gallery or list view
+ if (get_input('search_viewtype') == "gallery") {
+ //display the gallery view
+ echo elgg_view("blog/gallery",$vars);
+ } else {
+ echo elgg_view("blog/listing",$vars);
+ }
+ } else {
+ if ($vars['entity'] instanceof ElggObject) {
+ $url = $vars['entity']->getURL();
+ $owner = $vars['entity']->getOwnerEntity();
+ $canedit = $vars['entity']->canEdit();
+ } else {
+ $url = 'javascript:history.go(-1);';
+ $owner = $vars['user'];
+ $canedit = false;
+ }
+
+?>
+
+<div id="Page_Header">
+ <div class="Page_Header_Title">
+ <div id="content_area_user_title"><h2><?php echo $page_owner->name; ?>'s Blog</h2></div>
+ </div>
+
+ <div class="Page_Header_Options">
+ <?php
+ if ($vars['entity']->canEdit()) {
+ ?>
+ <a class="Action_Button" href="<?php echo $vars['url']; ?>mod/blog/edit.php?blogpost=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo('blog:editpost'); ?></a>
+ <?php
+ echo elgg_view('output/confirmlink',array(
+ 'href' => $vars['url'] . "action/blog/delete?blogpost=" . $vars['entity']->getGUID(),
+ 'text' => elgg_echo("delete"),
+ 'confirm' => elgg_echo("blog:delete:confirm"),
+ 'class' => "Action_Button Disabled",));
+ }
+ ?>
+ </div><div class='clearfloat'></div>
+</div>
+
+<div class="ContentWrapper singleview">
+ <div class="blog_post">
+ <?php
+ // Allow plugins to extend
+ echo elgg_view("blogs/options",array('entity' => $vars['entity']));
+ ?>
+ <div id="content_area_user_title">
+ <h2><a href="<?php echo $url; ?>"><?php echo $vars['entity']->title; ?></a></h2>
+ </div>
+ <!-- display the user icon -->
+ <div class="blog_post_icon">
+ <?php
+ echo elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny'));
+ ?>
+ </div>
+ <p class="strapline">
+ <!-- username -->
+ <a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a>
+
+ <?php
+
+ echo sprintf(elgg_echo("blog:strapline"),
+ date("F j, Y",$vars['entity']->time_created)
+ );
+
+ ?>
+ <!-- display the comments link -->
+ <?php
+ if($comments_on && $vars['entity'] instanceof ElggObject){
+ //get the number of comments
+ $num_comments = elgg_count_comments($vars['entity']);
+ ?>
+ <a href="<?php echo $url; ?>"><?php echo sprintf(elgg_echo("comments")) . " (" . $num_comments . ")"; ?></a>
+ <?php
+ }
+ //sort out the access level for display
+ $object_acl = get_readable_access_level($vars['entity']->access_id);
+ //files with these access level don't need an icon
+ $general_access = array('Public', 'Logged in users', 'Friends');
+ //set the right class for access level display - need it to set on groups and shared access only
+ $is_group = get_entity($vars['entity']->container_guid);
+ if($is_group instanceof ElggGroup){
+ //get the membership type open/closed
+ $membership = $is_group->membership;
+ if($membership == 2)
+ $access_level = "class='group_open'";
+ else
+ $access_level = "class='group_closed'";
+ }elseif($object_acl == 'Private'){
+ $access_level = "class='private'";
+ }else{
+ if(!in_array($object_acl, $general_access))
+ $access_level = "class='shared_collection'";
+ else
+ $access_level = "class='generic_access'";
+ }
+ echo "<br /><span {$access_level}>" . $object_acl . "</span>";
+ ?>
+ </p>
+
+ <div class="clearfloat"></div>
+ <div class="blog_post_body">
+ <!-- display the actual blog post and excerpt if appropriate -->
+ <?php
+ if($vars['entity']->show_excerpt){
+ //echo "<div class='show_excerpt'>";
+ //echo elgg_view('output/longtext',array('value' => $vars['entity']->excerpt));
+ //echo "</div>";
+ }
+ echo elgg_view('output/longtext',array('value' => $vars['entity']->description));
+ ?>
+ </div><div class="clearfloat"></div>
+ <!-- display edit options if it is the blog post owner -->
+ <p class="options">
+ <?php
+ // Allow plugins to extend
+ echo elgg_view("blogs/extend",array('entity' => $vars['entity']));
+ ?>
+ </p>
+
+ <!-- display tags -->
+ <?php
+
+ $tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags));
+ if (!empty($tags)) {
+ echo '<p class="tags">' . $tags . '</p>';
+ }
+
+ $categories = elgg_view('categories/view', $vars);
+ if (!empty($categories)) {
+ echo '<p class="categories">' . $categories . '</p>';
+ }
+
+ ?>
+
+ <div class="clearfloat"></div>
+ </div>
+</div>
+<?php
+ }
+}else{
+
+ echo "<div class='ContentWrapper singleview'>" . elgg_echo('blog:none') . "</div>";
+}
\ No newline at end of file |