diff options
Diffstat (limited to 'mod/blog')
-rw-r--r-- | mod/blog/actions/blog/delete.php | 2 | ||||
-rw-r--r-- | mod/blog/actions/blog/save.php | 17 | ||||
-rw-r--r-- | mod/blog/lib/blog.php | 4 | ||||
-rw-r--r-- | mod/blog/manifest.xml | 1 | ||||
-rw-r--r-- | mod/blog/start.php | 4 | ||||
-rw-r--r-- | mod/blog/views/default/blog/group_module.php | 2 | ||||
-rw-r--r-- | mod/blog/views/default/forms/blog/save.php | 33 | ||||
-rw-r--r-- | mod/blog/views/default/object/blog.php | 4 |
8 files changed, 47 insertions, 20 deletions
diff --git a/mod/blog/actions/blog/delete.php b/mod/blog/actions/blog/delete.php index 6028480ff..ca4eb8a7f 100644 --- a/mod/blog/actions/blog/delete.php +++ b/mod/blog/actions/blog/delete.php @@ -13,7 +13,7 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { if ($blog->delete()) { system_message(elgg_echo('blog:message:deleted_post')); if (elgg_instanceof($container, 'group')) { - forward("blog/group/$container->guid/owner"); + forward("blog/group/$container->guid/all"); } else { forward("blog/owner/$container->username"); } diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index c42845037..8be67ec6c 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -8,6 +8,9 @@ // start a new sticky form session in case of failure elgg_make_sticky_form('blog'); +// save or preview +$save = (bool)get_input('save'); + // store errors to pass along $error = FALSE; $error_forward_url = REFERER; @@ -106,6 +109,11 @@ foreach ($values as $name => $default) { } } +// if preview, force status to be draft +if ($save == false) { + $values['status'] = 'draft'; +} + // assign values to the entity, stopping on error. if (!$error) { foreach ($values as $name => $value) { @@ -148,12 +156,13 @@ if (!$error) { $blog->save(); } } elseif ($old_status == 'published' && $status == 'draft') { - $q = "DELETE FROM {$db_prefix}river - WHERE object_guid = $blog->guid AND action_type = 'create'"; - delete_data($q); + elgg_delete_river(array( + 'object_guid' => $blog->guid, + 'action_type' => 'create', + )); } - if ($blog->status == 'published') { + if ($blog->status == 'published' || $save == false) { forward($blog->getURL()); } else { forward("blog/edit/$blog->guid"); diff --git a/mod/blog/lib/blog.php b/mod/blog/lib/blog.php index 2c53c0f0f..8964d5b53 100644 --- a/mod/blog/lib/blog.php +++ b/mod/blog/lib/blog.php @@ -32,7 +32,7 @@ function blog_get_page_content_read($guid = NULL) { $container = $blog->getContainerEntity(); $crumbs_title = $container->name; if (elgg_instanceof($container, 'group')) { - elgg_push_breadcrumb($crumbs_title, "blog/group/$container->guid/owner"); + elgg_push_breadcrumb($crumbs_title, "blog/group/$container->guid/all"); } else { elgg_push_breadcrumb($crumbs_title, "blog/owner/$container->username"); } @@ -396,7 +396,7 @@ function blog_url_forwarder($page) { $guid = $matches[1]; $entity = get_entity($guid); if ($entity) { - $url = "{$CONFIG->wwwroot}blog/group/$guid/owner"; + $url = "{$CONFIG->wwwroot}blog/group/$guid/all"; register_error(elgg_echo("changebookmark")); forward($url); } diff --git a/mod/blog/manifest.xml b/mod/blog/manifest.xml index f0ec96e8b..991462060 100644 --- a/mod/blog/manifest.xml +++ b/mod/blog/manifest.xml @@ -5,6 +5,7 @@ <version>1.8</version> <category>bundled</category> <category>content</category> + <category>widget</category> <blurb>Blog plugin</blurb> <description>Adds simple blogging capabilities to your Elgg installation.</description> <website>http://elgg.org/</website> diff --git a/mod/blog/start.php b/mod/blog/start.php index 33c6ee20d..b9911aa74 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -85,7 +85,7 @@ function blog_init() { * New post: blog/add/<guid> * Edit post: blog/edit/<guid>/<revision> * Preview post: blog/preview/<guid> - * Group blog: blog/group/<guid>/owner + * Group blog: blog/group/<guid>/all * * Title is ignored * @@ -178,7 +178,7 @@ function blog_owner_block_menu($hook, $type, $return, $params) { $return[] = $item; } else { if ($params['entity']->blog_enable != "no") { - $url = "blog/group/{$params['entity']->guid}/owner"; + $url = "blog/group/{$params['entity']->guid}/all"; $item = new ElggMenuItem('blog', elgg_echo('blog:group'), $url); $return[] = $item; } diff --git a/mod/blog/views/default/blog/group_module.php b/mod/blog/views/default/blog/group_module.php index 9a1515585..6cfe6c98e 100644 --- a/mod/blog/views/default/blog/group_module.php +++ b/mod/blog/views/default/blog/group_module.php @@ -10,7 +10,7 @@ if ($group->blog_enable == "no") { } $all_link = elgg_view('output/url', array( - 'href' => "blog/group/$group->guid/owner", + 'href' => "blog/group/$group->guid/all", 'text' => elgg_echo('link:view:all'), )); diff --git a/mod/blog/views/default/forms/blog/save.php b/mod/blog/views/default/forms/blog/save.php index b2d20579f..d99f45f01 100644 --- a/mod/blog/views/default/forms/blog/save.php +++ b/mod/blog/views/default/forms/blog/save.php @@ -5,6 +5,8 @@ * @package Blog */ +$blog = get_entity($vars['guid']); + $draft_warning = $vars['draft_warning']; if ($draft_warning) { $draft_warning = '<span class="message warning">' . $draft_warning . '</span>'; @@ -12,6 +14,7 @@ if ($draft_warning) { $action_buttons = ''; $delete_link = ''; +$preview_button = ''; if ($vars['guid']) { // add a delete button if editing @@ -19,12 +22,24 @@ if ($vars['guid']) { $delete_link = elgg_view('output/confirmlink', array( 'href' => $delete_url, 'text' => elgg_echo('delete'), - 'class' => 'elgg-button elgg-button-delete elgg-state-disabled' + 'class' => 'elgg-button elgg-button-delete elgg-state-disabled float-alt' )); } -$save_button = elgg_view('input/submit', array('value' => elgg_echo('save'))); -$action_buttons = $save_button . $delete_link; +// published blogs do not get the preview button +if (!$vars['guid'] || ($blog && $blog->status != 'published')) { + $preview_button = elgg_view('input/submit', array( + 'value' => elgg_echo('preview'), + 'name' => 'preview', + 'class' => 'mls', + )); +} + +$save_button = elgg_view('input/submit', array( + 'value' => elgg_echo('save'), + 'name' => 'save', +)); +$action_buttons = $save_button . $preview_button . $delete_link; $title_label = elgg_echo('title'); $title_input = elgg_view('input/text', array( @@ -135,13 +150,15 @@ $body_input $categories_input -<div class="elgg-subtext pvm mbn elgg-divide-top"> +<div class="elgg-form-footer-alt"> + <div class="elgg-subtext mbm"> $save_status <span class="blog-save-status-time">$saved</span> -</div> + </div> -$guid_input -$container_guid_input + $guid_input + $container_guid_input -$action_buttons + $action_buttons +</div> ___HTML; diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index 048a68a1a..8456829fe 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -74,7 +74,7 @@ if ($full) { 'subtitle' => $subtitle, 'tags' => $tags, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); $blog_info = elgg_view_image_block($owner_icon, $list_body); @@ -94,7 +94,7 @@ HTML; 'tags' => $tags, 'content' => $excerpt, ); - $list_body = elgg_view('page/components/summary', $params); + $list_body = elgg_view('object/elements/summary', $params); echo elgg_view_image_block($owner_icon, $list_body); } |