From e71b5221f3896f6ddacdda5e0df406a8ce058c46 Mon Sep 17 00:00:00 2001 From: brettp Date: Tue, 8 Mar 2011 03:20:34 +0000 Subject: Fixes #2229. Removed published data metadata in blog. Added upgrade to set all status metadata for old blog posts. git-svn-id: http://code.elgg.org/elgg/trunk@8626 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/actions/blog/auto_save_revision.php | 2 - mod/blog/actions/blog/save.php | 14 ------- mod/blog/classes/ElggBlog.php | 27 ------------- mod/blog/languages/en.php | 1 - mod/blog/views/default/blog/sidebar/revisions.php | 2 +- mod/blog/views/default/forms/blog/save.php | 13 ++---- mod/blog/views/default/input/datetime.php | 48 ----------------------- mod/blog/views/default/js/blog/save_draft.php | 2 +- mod/blog/views/default/object/blog.php | 2 +- 9 files changed, 6 insertions(+), 105 deletions(-) delete mode 100644 mod/blog/views/default/input/datetime.php (limited to 'mod/blog') diff --git a/mod/blog/actions/blog/auto_save_revision.php b/mod/blog/actions/blog/auto_save_revision.php index 86812c6d3..1acf3b31b 100644 --- a/mod/blog/actions/blog/auto_save_revision.php +++ b/mod/blog/actions/blog/auto_save_revision.php @@ -38,8 +38,6 @@ if ($title && $description) { $blog->title = $title; $blog->description = $description; $blog->excerpt = elgg_get_excerpt($excerpt); - // must be present or doesn't show up when metadata sorting. - $blog->publish_date = time(); // mark this as a brand new post so we can work out the // river / revision logic in the real save action. diff --git a/mod/blog/actions/blog/save.php b/mod/blog/actions/blog/save.php index 5dccab45d..099a89cc0 100644 --- a/mod/blog/actions/blog/save.php +++ b/mod/blog/actions/blog/save.php @@ -106,18 +106,6 @@ foreach ($values as $name => $default) { } } -// build publish_date -//$publish_month = get_input('publish_month'); -//$publish_day = get_input('publish_day'); -//$publish_year = get_input('publish_year'); -//$publish_hour = get_input('publish_hour'); -//$publish_minute = get_input('publish_minute'); -//$datetime = "$publish_year-$publish_month-$publish_day $publish_hour:$publish_minute:00"; -//$values['publish_date'] = date('U', strtotime($datetime)); - -// setting publish_date to now until the problems with locale dates can be resolved. -$values['publish_date'] = time(); - // assign values to the entity, stopping on error. if (!$error) { foreach ($values as $name => $value) { @@ -154,8 +142,6 @@ if (!$error) { // because we remove it for drafts. if (($new_post || $old_status == 'draft') && $status == 'published') { add_to_river('river/object/blog/create', 'create', elgg_get_logged_in_user_guid(), $blog->getGUID()); - - $date = $blog->publish_date; if ($guid) { $q = "UPDATE {$db_prefix}entities SET time_created = '$date' diff --git a/mod/blog/classes/ElggBlog.php b/mod/blog/classes/ElggBlog.php index 0f0f27cf8..ee2ec73ef 100644 --- a/mod/blog/classes/ElggBlog.php +++ b/mod/blog/classes/ElggBlog.php @@ -13,33 +13,6 @@ class ElggBlog extends ElggObject { $this->attributes['subtype'] = "blog"; } - /** - * @todo this won't work until we have date l10n working. - * Rewrite the time created to be publish time. - * This is a bit dirty, but required for proper sorting. - */ -// public function save() { -// if (parent::save()) { -// global $CONFIG; -// -// // try to grab the publish date, but default to now. -// foreach (array('publish_date', 'time_created') as $field) { -// if (isset($this->$field) && $this->field) { -// $published = $this->field; -// break; -// } -// } -// if (!$published) { -// $published = time(); -// } -// -// $sql = "UPDATE {$CONFIG->dbprefix}entities SET time_created = '$published', time_updated = '$published' WHERE guid = '{$this->getGUID()}'"; -// return update_data($sql); -// } -// -// return FALSE; -// } - /** * Can a user comment on this blog? * diff --git a/mod/blog/languages/en.php b/mod/blog/languages/en.php index b5a9f070d..b11eb1e75 100644 --- a/mod/blog/languages/en.php +++ b/mod/blog/languages/en.php @@ -27,7 +27,6 @@ $english = array( 'blog:body' => 'Body', 'blog:save_status' => 'Last saved: ', 'blog:never' => 'Never', - 'blog:publish_date' => 'Publish Date', // Statuses 'blog:status' => 'Status', diff --git a/mod/blog/views/default/blog/sidebar/revisions.php b/mod/blog/views/default/blog/sidebar/revisions.php index b8f07b336..5e4f45bd9 100644 --- a/mod/blog/views/default/blog/sidebar/revisions.php +++ b/mod/blog/views/default/blog/sidebar/revisions.php @@ -43,7 +43,7 @@ if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { )); $time = "" - . elgg_view_friendly_time($blog->publish_date) . ""; + . elgg_view_friendly_time($blog->time_created) . ""; $body .= "
  • $load : $time
  • "; } diff --git a/mod/blog/views/default/forms/blog/save.php b/mod/blog/views/default/forms/blog/save.php index c8c0fde55..b2d20579f 100644 --- a/mod/blog/views/default/forms/blog/save.php +++ b/mod/blog/views/default/forms/blog/save.php @@ -48,8 +48,9 @@ $body_input = elgg_view('input/longtext', array( )); $save_status = elgg_echo('blog:save_status'); -if ($vars['publish_date']) { - $saved = date('F j, Y @ H:i', $vars['publish_date']); +if ($vars['guid']) { + $entity = get_entity($vars['guid']); + $saved = date('F j, Y @ H:i', $entity->time_created); } else { $saved = elgg_echo('blog:never'); } @@ -87,14 +88,6 @@ $access_input = elgg_view('input/access', array( 'value' => $vars['access_id'] )); -// not being used -$publish_date_label = elgg_echo('blog:publish_date'); -$publish_date_input = elgg_view('input/datetime', array( - 'name' => 'publish_date', - 'id' => 'blog_publish_date', - 'value' => $vars['publish_date'] -)); - $categories_input = elgg_view('categories', $vars); // hidden inputs diff --git a/mod/blog/views/default/input/datetime.php b/mod/blog/views/default/input/datetime.php deleted file mode 100644 index 1f4a33ecd..000000000 --- a/mod/blog/views/default/input/datetime.php +++ /dev/null @@ -1,48 +0,0 @@ - 'publish_month', - 'value' => date('m', $publish_date), - 'options_values' => $months, - 'class' => 'elgg-input-datetime-month', -)); - -$day = elgg_view('input/text', array( - 'name' => 'publish_day', - 'value' => date('d', $publish_date), - 'class' => 'elgg-input-datetime-day', -)); - -$year = elgg_view('input/text', array( - 'name' => 'publish_year', - 'value' => date('Y', $publish_date), - 'class' => 'elgg-input-datetime-year', -)); - -$hour = elgg_view('input/text', array( - 'name' => 'publish_hour', - 'value' => date('H', $publish_date), - 'class' => 'elgg-input-datetime-hour', -)); - -$minute = elgg_view('input/text', array( - 'name' => 'publish_minute', - 'value' => date('i', $publish_date), - 'class' => 'elgg-input-datetime-minute', -)); - -echo "$month $day, $year @ $hour:$minute"; diff --git a/mod/blog/views/default/js/blog/save_draft.php b/mod/blog/views/default/js/blog/save_draft.php index 990ab357d..44b54acb0 100644 --- a/mod/blog/views/default/js/blog/save_draft.php +++ b/mod/blog/views/default/js/blog/save_draft.php @@ -55,7 +55,7 @@ elgg.blog.saveDraft = function() { } }); - $.post(draftURL, postData, blogSaveDraftCallback, 'json'); + $.post(draftURL, postData, elgg.blog.blogSaveDraftCallback, 'json'); } elgg.blog.init = function() { diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index 8c339236c..9687e8f34 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -24,7 +24,7 @@ $owner_link = elgg_view('output/url', array( )); $author_text = elgg_echo('byline', array($owner_link)); $tags = elgg_view('output/tags', array('tags' => $blog->tags)); -$date = elgg_view_friendly_time($blog->publish_date); +$date = elgg_view_friendly_time($blog->time_created); // The "on" status changes for comments, so best to check for !Off if ($blog->comments_on != 'Off') { -- cgit v1.2.3