aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/start.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-18 21:45:48 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-03-18 21:45:48 +0000
commit94ccaa1a5f6c927674698f1788f95241dce5bc29 (patch)
treeec666baad142c7aea5644aa0f386e161ee0511f8 /mod/blog/start.php
parenta12e51d597b5ca22af44609b778eca66ca681492 (diff)
downloadelgg-94ccaa1a5f6c927674698f1788f95241dce5bc29.tar.gz
elgg-94ccaa1a5f6c927674698f1788f95241dce5bc29.tar.bz2
Updated blog to support multiple revisions and automatic saving of drafts.
git-svn-id: http://code.elgg.org/elgg/trunk@5437 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/blog/start.php')
-rw-r--r--mod/blog/start.php71
1 files changed, 11 insertions, 60 deletions
diff --git a/mod/blog/start.php b/mod/blog/start.php
index b3a8e32ee..bf0d3fb56 100644
--- a/mod/blog/start.php
+++ b/mod/blog/start.php
@@ -39,7 +39,6 @@ function blog_init() {
elgg_extend_view('css', 'blog/css');
register_page_handler('blog', 'blog_page_handler');
- register_page_handler('blog_ajax', 'blog_ajax_page_handler');
register_entity_url_handler('blog_url_handler', 'object', 'blog');
@@ -60,6 +59,7 @@ function blog_init() {
$action_path = dirname(__FILE__) . '/actions/blog';
register_action('blog/save', FALSE, "$action_path/save.php");
+ register_action('blog/auto_save_revision', FALSE, "$action_path/auto_save_revision.php");
register_action('blog/delete', FALSE, "$action_path/delete.php");
}
@@ -111,13 +111,13 @@ function blog_page_handler($page) {
switch ($action) {
case 'read':
$title = sprintf(elgg_echo('blog:title:user_blogs'), $user->name);
- $content = elgg_view('page_elements/content_header', array('context' => $content, 'type' => 'blog'));
- $content .= blog_get_page_content_read($user->getGUID(), $page2);
+ $content_info = blog_get_page_content_read($user->getGUID(), $page2);
break;
case 'new':
case 'edit':
- $content = blog_get_page_content_edit($page2);
+ //$sidebar = elgg_view('blog/sidebar_edit', array('blog_guid' => $page2));
+ $content_info = blog_get_page_content_edit($page2, $page3);
break;
case 'archives':
@@ -136,17 +136,14 @@ function blog_page_handler($page) {
}
} else {
$title = elgg_echo('blog:title:all_blogs');
- $content = elgg_view('page_elements/content_header', array('context' => $content, 'type' => 'blog'));
- $content .= elgg_list_entities_from_metadata(array(
- 'type' => 'object',
- 'subtype' => 'blog',
- 'full_view' => FALSE,
- 'metadata_name_value_pair' => array('name' => 'status', 'value' => 'final')
- ));
+ $content_info = blog_get_page_content_read();
}
- $sidebar = elgg_view('blog/sidebar_menu');
- $content = elgg_view('navigation/breadcrumbs') . $content;
+ $sidebar .= elgg_view('blog/sidebar_menu');
+ if (isset($content_info['sidebar'])) {
+ $sidebar .= $content_info['sidebar'];
+ }
+ $content = elgg_view('navigation/breadcrumbs') . $content_info['content'];
$body = elgg_view_layout('one_column_with_sidebar', $content, $sidebar);
@@ -154,52 +151,6 @@ function blog_page_handler($page) {
}
/**
- * Handles ajax calls for blog.
- *
- * @param array $page
- */
-function blog_ajax_page_handler($page) {
- $action = isset($page[0]) ? $page[0] : FALSE;
-
- var_dump($page);
-
- switch ($action) {
- case 'save_draft':
- // @todo recycle the save action
- $values = array(
- 'title' => '',
- 'description' => '',
- 'status' => 'draft',
- 'access_id' => ACCESS_DEFAULT,
- 'comments_on' => 'On',
- 'excerpt' => '',
- 'tags' => '',
- 'container_guid' => '',
- 'guid' => ''
- );
-
- foreach ($values as $name => $default) {
- $values[$name] = get_input($name, $default);
- }
-
-
-
- /*
- If a title and body, create a blog post marked as a draft and update the
- GUID
- */
- break;
-
- default:
- $content = 0;
- break;
- }
-
- exit;
-}
-
-
-/**
* Format and return the correct URL for blogs.
*
* @param ElggObject $entity
@@ -220,4 +171,4 @@ function blog_url_handler($entity) {
}
-register_elgg_event_handler('init', 'system', 'blog_init'); \ No newline at end of file
+register_elgg_event_handler('init', 'system', 'blog_init');