diff options
Diffstat (limited to 'mod/blog')
-rw-r--r-- | mod/blog/activate.php | 10 | ||||
-rw-r--r-- | mod/blog/deactivate.php | 6 | ||||
-rw-r--r-- | mod/blog/lib/blog.php | 10 | ||||
-rw-r--r-- | mod/blog/manifest.xml | 7 | ||||
-rw-r--r-- | mod/blog/start.php | 16 | ||||
-rw-r--r-- | mod/blog/views/default/blog/group_module.php | 2 | ||||
-rw-r--r-- | mod/blog/views/default/blog/sidebar/revisions.php | 6 | ||||
-rw-r--r-- | mod/blog/views/default/forms/blog/save.php | 2 | ||||
-rw-r--r-- | mod/blog/views/default/js/blog/save_draft.php | 4 | ||||
-rw-r--r-- | mod/blog/views/default/object/blog.php | 21 | ||||
-rw-r--r-- | mod/blog/views/default/river/object/blog/create.php | 2 | ||||
-rw-r--r-- | mod/blog/views/default/widgets/blog/content.php | 1 |
12 files changed, 56 insertions, 31 deletions
diff --git a/mod/blog/activate.php b/mod/blog/activate.php new file mode 100644 index 000000000..a90525291 --- /dev/null +++ b/mod/blog/activate.php @@ -0,0 +1,10 @@ +<?php +/** + * Register the ElggBlog class for the object/blog subtype + */ + +if (get_subtype_id('object', 'blog')) { + update_subtype('object', 'blog', 'ElggBlog'); +} else { + add_subtype('object', 'blog', 'ElggBlog'); +} diff --git a/mod/blog/deactivate.php b/mod/blog/deactivate.php new file mode 100644 index 000000000..4a275fa94 --- /dev/null +++ b/mod/blog/deactivate.php @@ -0,0 +1,6 @@ +<?php +/** + * Deregister the ElggBlog class + */ + +update_subtype('object', 'blog'); diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index b7b1a2baa..590547a8c 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -20,7 +20,6 @@ function blog_get_page_content_read($guid = NULL) { // no header or tabs for viewing an individual blog $return['filter'] = ''; - $return['header'] = ''; if (!elgg_instanceof($blog, 'object', 'blog')) { $return['content'] = elgg_echo('blog:error:post_not_found'); @@ -67,6 +66,9 @@ function blog_get_page_content_list($container_guid = NULL) { $loggedin_userid = elgg_get_logged_in_user_guid(); if ($container_guid) { + // access check for closed groups + group_gatekeeper(); + $options['container_guid'] = $container_guid; $container = get_entity($container_guid); if (!$container) { @@ -121,6 +123,9 @@ function blog_get_page_content_list($container_guid = NULL) { function blog_get_page_content_friends($user_guid) { $user = get_user($user_guid); + if (!$user) { + forward('blog/all'); + } $return = array(); @@ -311,9 +316,6 @@ function blog_get_page_content_edit($page, $guid = 0, $revision = NULL) { $title = elgg_echo('blog:add'); $content = elgg_view_form('blog/save', $vars, $body_vars); - - $blog_js = elgg_get_simplecache_url('js', 'blog/save_draft'); - elgg_register_js('elgg.blog', $blog_js); } $return['title'] = $title; diff --git a/mod/blog/manifest.xml b/mod/blog/manifest.xml index 991462060..29ee1bfc8 100644 --- a/mod/blog/manifest.xml +++ b/mod/blog/manifest.xml @@ -10,11 +10,10 @@ <description>Adds simple blogging capabilities to your Elgg installation.</description> <website>http://elgg.org/</website> <copyright>See COPYRIGHT.txt</copyright> - <license>GNU Public License version 2</license> + <license>GNU General Public License version 2</license> <requires> - <type>elgg_version</type> - <version>2010030101</version> + <type>elgg_release</type> + <version>1.8</version> </requires> - <admin_interface>simple</admin_interface> <activate_on_install>true</activate_on_install> </plugin_manifest> diff --git a/mod/blog/start.php b/mod/blog/start.php index 2d8f75ed2..fa57e7b96 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -32,6 +32,7 @@ function blog_init() { // register the blog's JavaScript $blog_js = elgg_get_simplecache_url('js', 'blog/save_draft'); + elgg_register_simplecache_view('js/blog/save_draft'); elgg_register_js('elgg.blog', $blog_js); // routing of urls @@ -92,14 +93,14 @@ function blog_init() { * @todo no archives for all blogs or friends * * @param array $page - * @return NULL + * @return bool */ function blog_page_handler($page) { elgg_load_library('elgg:blog'); // @todo remove the forwarder in 1.9 - // forward to correct URL for bookmarks pre-1.7.5 + // forward to correct URL for blog pages pre-1.7.5 blog_url_forwarder($page); // push all blogs breadcrumb @@ -138,17 +139,22 @@ function blog_page_handler($page) { $params = blog_get_page_content_list($page[1]); break; case 'all': - default: - $title = elgg_echo('blog:title:all_blogs'); $params = blog_get_page_content_list(); break; + default: + return false; } - $params['sidebar'] .= elgg_view('blog/sidebar', array('page' => $page_type)); + if (isset($params['sidebar'])) { + $params['sidebar'] .= elgg_view('blog/sidebar', array('page' => $page_type)); + } else { + $params['sidebar'] = elgg_view('blog/sidebar', array('page' => $page_type)); + } $body = elgg_view_layout('content', $params); echo elgg_view_page($params['title'], $body); + return true; } /** diff --git a/mod/blog/views/default/blog/group_module.php b/mod/blog/views/default/blog/group_module.php index d769fbd59..028827178 100644 --- a/mod/blog/views/default/blog/group_module.php +++ b/mod/blog/views/default/blog/group_module.php @@ -12,6 +12,7 @@ if ($group->blog_enable == "no") { $all_link = elgg_view('output/url', array( 'href' => "blog/group/$group->guid/all", 'text' => elgg_echo('link:view:all'), + 'is_trusted' => true, )); elgg_push_context('widgets'); @@ -33,6 +34,7 @@ if (!$content) { $new_link = elgg_view('output/url', array( 'href' => "blog/add/$group->guid", 'text' => elgg_echo('blog:write'), + 'is_trusted' => true, )); echo elgg_view('groups/profile/module', array( diff --git a/mod/blog/views/default/blog/sidebar/revisions.php b/mod/blog/views/default/blog/sidebar/revisions.php index c23b3b052..cd2e7f3d8 100644 --- a/mod/blog/views/default/blog/sidebar/revisions.php +++ b/mod/blog/views/default/blog/sidebar/revisions.php @@ -39,7 +39,8 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { if ($blog->status == 'published') { $load = elgg_view('output/url', array( 'href' => $load_base_url, - 'text' => elgg_echo('blog:status:published') + 'text' => elgg_echo('blog:status:published'), + 'is_trusted' => true, )); $time = "<span class='elgg-subtext'>" @@ -59,7 +60,8 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { } $load = elgg_view('output/url', array( 'href' => "$load_base_url/$revision->id", - 'text' => $revision_lang + 'text' => $revision_lang, + 'is_trusted' => true, )); $text = "$load: $time"; diff --git a/mod/blog/views/default/forms/blog/save.php b/mod/blog/views/default/forms/blog/save.php index 8246fdec3..a805541bd 100644 --- a/mod/blog/views/default/forms/blog/save.php +++ b/mod/blog/views/default/forms/blog/save.php @@ -104,7 +104,7 @@ $access_input = elgg_view('input/access', array( 'value' => $vars['access_id'] )); -$categories_input = elgg_view('categories', $vars); +$categories_input = elgg_view('input/categories', $vars); // hidden inputs $container_guid_input = elgg_view('input/hidden', array('name' => 'container_guid', 'value' => elgg_get_page_owner_guid())); diff --git a/mod/blog/views/default/js/blog/save_draft.php b/mod/blog/views/default/js/blog/save_draft.php index fd76c870c..8a994ffb0 100644 --- a/mod/blog/views/default/js/blog/save_draft.php +++ b/mod/blog/views/default/js/blog/save_draft.php @@ -28,7 +28,7 @@ elgg.blog.saveDraftCallback = function(data, textStatus, XHR) { } else { $(".blog-save-status-time").html(elgg.echo('error')); } -} +}; elgg.blog.saveDraft = function() { if (typeof(tinyMCE) != 'undefined') { @@ -55,7 +55,7 @@ elgg.blog.saveDraft = function() { }); $.post(draftURL, postData, elgg.blog.saveDraftCallback, 'json'); -} +}; elgg.blog.init = function() { // get a copy of the body to compare for auto save diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index ba08180b1..3525b3d48 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -21,6 +21,7 @@ $owner_icon = elgg_view_entity_icon($owner, 'tiny'); $owner_link = elgg_view('output/url', array( 'href' => "blog/owner/$owner->username", 'text' => $owner->name, + 'is_trusted' => true, )); $author_text = elgg_echo('byline', array($owner_link)); $tags = elgg_view('output/tags', array('tags' => $blog->tags)); @@ -35,6 +36,7 @@ if ($blog->comments_on != 'Off') { $comments_link = elgg_view('output/url', array( 'href' => $blog->getURL() . '#blog-comments', 'text' => $text, + 'is_trusted' => true, )); } else { $comments_link = ''; @@ -50,8 +52,7 @@ $metadata = elgg_view_menu('entity', array( 'class' => 'elgg-menu-hz', )); -$subtitle = "<p>$author_text $date $comments_link</p>"; -$subtitle .= $categories; +$subtitle = "$author_text $date $comments_link $categories"; // do not show the metadata and controls in widget view if (elgg_in_context('widgets')) { @@ -65,8 +66,6 @@ if ($full) { 'class' => 'blog-post', )); - $header = elgg_view_title($blog->title); - $params = array( 'entity' => $blog, 'title' => false, @@ -75,15 +74,13 @@ if ($full) { 'tags' => $tags, ); $params = $params + $vars; - $list_body = elgg_view('object/elements/summary', $params); + $summary = elgg_view('object/elements/summary', $params); - $blog_info = elgg_view_image_block($owner_icon, $list_body); - - echo <<<HTML -$header -$blog_info -$body -HTML; + echo elgg_view('object/elements/full', array( + 'summary' => $summary, + 'icon' => $owner_icon, + 'body' => $body, + )); } else { // brief view diff --git a/mod/blog/views/default/river/object/blog/create.php b/mod/blog/views/default/river/object/blog/create.php index 613cbb165..a054c1061 100644 --- a/mod/blog/views/default/river/object/blog/create.php +++ b/mod/blog/views/default/river/object/blog/create.php @@ -7,7 +7,7 @@ $object = $vars['item']->getObjectEntity(); $excerpt = strip_tags($object->excerpt); $excerpt = elgg_get_excerpt($excerpt); -echo elgg_view('river/item', array( +echo elgg_view('river/elements/layout', array( 'item' => $vars['item'], 'message' => $excerpt, ));
\ No newline at end of file diff --git a/mod/blog/views/default/widgets/blog/content.php b/mod/blog/views/default/widgets/blog/content.php index 7bbfc3c74..330171662 100644 --- a/mod/blog/views/default/widgets/blog/content.php +++ b/mod/blog/views/default/widgets/blog/content.php @@ -22,6 +22,7 @@ if ($content) { $more_link = elgg_view('output/url', array( 'href' => $blog_url, 'text' => elgg_echo('blog:moreblogs'), + 'is_trusted' => true, )); echo "<span class=\"elgg-widget-more\">$more_link</span>"; } else { |