aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/views/default
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-25 17:07:41 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-12-25 17:07:41 +0000
commit58bd19d7cf35e6159124716d0da48d91354d3a2f (patch)
treebaf3133c13b2f5a38e7e16e182a208258069e4ef /mod/blog/views/default
parentf6045914d7488c43cd7761ddaded55b3791ae950 (diff)
downloadelgg-58bd19d7cf35e6159124716d0da48d91354d3a2f.tar.gz
elgg-58bd19d7cf35e6159124716d0da48d91354d3a2f.tar.bz2
amtrak does not have wifi so here is one big commit with group blogs, blog widget, and improved blog sidebar
git-svn-id: http://code.elgg.org/elgg/trunk@7720 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/blog/views/default')
-rw-r--r--mod/blog/views/default/blog/group_module.php40
-rw-r--r--mod/blog/views/default/blog/sidebar.php18
-rw-r--r--mod/blog/views/default/blog/sidebar/archives.php30
-rw-r--r--mod/blog/views/default/blog/sidebar/revisions.php (renamed from mod/blog/views/default/blog/sidebar_revisions.php)0
-rw-r--r--mod/blog/views/default/blog/sidebar/tagcloud.php31
-rw-r--r--mod/blog/views/default/blog/sidebar_menu.php76
-rw-r--r--mod/blog/views/default/forms/blog/save.php7
-rw-r--r--mod/blog/views/default/input/datetime.php2
-rw-r--r--mod/blog/views/default/object/blog.php7
-rw-r--r--mod/blog/views/default/widgets/blog/content.php29
-rw-r--r--mod/blog/views/default/widgets/blog/edit.php22
11 files changed, 180 insertions, 82 deletions
diff --git a/mod/blog/views/default/blog/group_module.php b/mod/blog/views/default/blog/group_module.php
new file mode 100644
index 000000000..6e75966af
--- /dev/null
+++ b/mod/blog/views/default/blog/group_module.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Group blog module
+ */
+
+$group = elgg_get_page_owner();
+
+$all_link = elgg_view('output/url', array(
+ 'href' => "pg/blog/group/$group->guid/owner",
+ 'text' => elgg_echo('link:view:all'),
+));
+
+$header = "<span class=\"group-widget-viewall\">$all_link</span>";
+$header .= '<h3>' . elgg_echo('blog:group') . '</h3>';
+
+
+elgg_push_context('widgets');
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'blog',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'limit' => 6,
+ 'full_view' => false,
+ 'pagination' => false,
+);
+$content = elgg_list_entities($options);
+elgg_pop_context();
+
+$new_link = elgg_view('output/url', array(
+ 'href' => "pg/blog/group/$group->guid/new",
+ 'text' => elgg_echo('blog:write'),
+));
+$content .= "<span class='elgg-widget-more'>$new_link</span>";
+
+
+$params = array(
+ 'header' => $header,
+ 'body' => $content,
+);
+echo elgg_view('layout/objects/module', $params);
diff --git a/mod/blog/views/default/blog/sidebar.php b/mod/blog/views/default/blog/sidebar.php
new file mode 100644
index 000000000..63ed85c0b
--- /dev/null
+++ b/mod/blog/views/default/blog/sidebar.php
@@ -0,0 +1,18 @@
+<?php
+/**
+ * Blog sidebar
+ *
+ * @package Blog
+ */
+
+// fetch & display latest comments
+if ($vars['page'] == 'all') {
+ echo elgg_view_latest_comments(0, 'object', 'blog');
+} elseif ($vars['page'] == 'owner') {
+ // @todo - what we want is the latest comments on this user's blog posts - elgg does not support this
+ echo elgg_view_latest_comments(elgg_get_page_owner_guid(), 'object', 'blog');
+}
+
+echo elgg_view('blog/sidebar/archives', $vars);
+
+echo elgg_view('blog/sidebar/tagcloud', $vars);
diff --git a/mod/blog/views/default/blog/sidebar/archives.php b/mod/blog/views/default/blog/sidebar/archives.php
new file mode 100644
index 000000000..9904be288
--- /dev/null
+++ b/mod/blog/views/default/blog/sidebar/archives.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Blog archives
+ */
+
+$loggedin_user = get_loggedin_user();
+$page_owner = elgg_get_page_owner();
+
+// This is a limitation of the URL schema.
+if ($page_owner && $vars['page'] != 'friends') {
+ $dates = blog_get_blog_months($user);
+
+ if ($dates) {
+ $title = elgg_echo('blog:archives');
+ $content = '<ul class="blog-archives">';
+ foreach($dates as $date) {
+ $date = $date->yearmonth;
+
+ $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 = elgg_get_site_url() . 'pg/blog/archive/' . $page_owner->username . '/' . $timestamplow . '/' . $timestamphigh;
+ $month = elgg_echo('date:month:' . substr($date, 4, 2), array(substr($date, 0, 4)));
+ $content .= "<li><a href=\"$link\" title=\"$month\">$month</a></li>";
+ }
+ $content .= '</ul>';
+
+ echo elgg_view('layout/objects/module', array('title' => $title, 'body' => $content));
+ }
+} \ No newline at end of file
diff --git a/mod/blog/views/default/blog/sidebar_revisions.php b/mod/blog/views/default/blog/sidebar/revisions.php
index e3919648b..e3919648b 100644
--- a/mod/blog/views/default/blog/sidebar_revisions.php
+++ b/mod/blog/views/default/blog/sidebar/revisions.php
diff --git a/mod/blog/views/default/blog/sidebar/tagcloud.php b/mod/blog/views/default/blog/sidebar/tagcloud.php
new file mode 100644
index 000000000..2f5ce3955
--- /dev/null
+++ b/mod/blog/views/default/blog/sidebar/tagcloud.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Blog tag cloud
+ */
+
+$loggedin_user = get_loggedin_user();
+$page_owner = elgg_get_page_owner();
+
+if ($page_owner && $vars['page'] != 'friends') {
+
+ // friends page lists all tags; mine lists owner's
+ $owner_guid = ($vars['page'] == 'friends') ? '' : $page_owner->getGUID();
+ $options = array(
+ 'type' => 'object',
+ 'subtype' => 'blog',
+ 'owner_guid' => $owner_guid,
+ 'threshold' => 0,
+ 'limit' => 50,
+ 'tag_name' => 'tags',
+ );
+ echo elgg_view_tagcloud($options);
+} else {
+ $options = array(
+ 'type' => 'object',
+ 'subtype' => 'blog',
+ 'threshold' => 0,
+ 'limit' => 50,
+ 'tag_name' => 'tags',
+ );
+ echo elgg_view_tagcloud($options);
+}
diff --git a/mod/blog/views/default/blog/sidebar_menu.php b/mod/blog/views/default/blog/sidebar_menu.php
deleted file mode 100644
index 7dfbeb1bc..000000000
--- a/mod/blog/views/default/blog/sidebar_menu.php
+++ /dev/null
@@ -1,76 +0,0 @@
-<?php
-/**
- * Blog sidebar menu.
- *
- * @package Blog
- */
-
-// a few cases to consider:
-// 1. looking at all posts
-// 2. looking at a user's post
-// 3. looking at your posts
-
-/*
-Logged in or not doesn't matter unless you're looking at your blog.
- Does it matter then on the side bar?
-
-All blogs:
- Archives
-
-Owned blogs;
- Archives
-*/
-
-$loggedin_user = get_loggedin_user();
-$page_owner = elgg_get_page_owner();
-
-// include a view for plugins to extend
-echo elgg_view("blogs/sidebar", array("object_type" => 'blog'));
-
-// fetch & display latest comments on all blog posts
-echo elgg_view_latest_comments(0, 'object', 'blog');
-
-// only show archives for users or groups.
-// This is a limitation of the URL schema.
-if ($page_owner && $vars['page'] != 'friends') {
- $dates = blog_get_blog_months($user);
-
- if ($dates) {
- $title = elgg_echo('blog:archives');
- $content = '<ul class="blog-archives">';
- foreach($dates as $date) {
- $date = $date->yearmonth;
-
- $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 = elgg_get_site_url() . 'pg/blog/archive/' . $page_owner->username . '/' . $timestamplow . '/' . $timestamphigh;
- $month = elgg_echo('date:month:' . substr($date, 4, 2), array(substr($date, 0, 4)));
- $content .= "<li><a href=\"$link\" title=\"$month\">$month</a></li>";
- }
- $content .= '</ul>';
-
- echo elgg_view('layout/objects/module', array('title' => $title, 'body' => $content));
- }
-
- // friends page lists all tags; mine lists owner's
- $owner_guid = ($vars['page'] == 'friends') ? '' : $page_owner->getGUID();
- $options = array(
- 'type' => 'object',
- 'subtype' => 'blog',
- 'owner_guid' => $owner_guid,
- 'threshold' => 0,
- 'limit' => 50,
- 'tag_name' => 'tags',
- );
- echo elgg_view_tagcloud($options);
-} else {
- $options = array(
- 'type' => 'object',
- 'subtype' => 'blog',
- 'threshold' => 0,
- 'limit' => 50,
- 'tag_name' => 'tags',
- );
- echo elgg_view_tagcloud($options);
-}
diff --git a/mod/blog/views/default/forms/blog/save.php b/mod/blog/views/default/forms/blog/save.php
index f49340985..8597c135c 100644
--- a/mod/blog/views/default/forms/blog/save.php
+++ b/mod/blog/views/default/forms/blog/save.php
@@ -5,8 +5,6 @@
* @package Blog
*/
-$forward = $_SERVER['HTTP_REFERER'];
-
$draft_warning = $vars['draft_warning'];
if ($draft_warning) {
$draft_warning = '<span class="message warning">' . $draft_warning . '</span>';
@@ -89,6 +87,7 @@ $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(
'internalname' => 'publish_date',
@@ -99,9 +98,8 @@ $publish_date_input = elgg_view('input/datetime', array(
$categories_input = elgg_view('categories', $vars);
// hidden inputs
-//$container_guid_input = elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid']));
+$container_guid_input = elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => elgg_get_page_owner_guid()));
$guid_input = elgg_view('input/hidden', array('internalname' => 'guid', 'value' => $vars['guid']));
-$forward_input = elgg_view('input/hidden', array('internalname' => 'forward', 'value' => $forward));
echo <<<___HTML
@@ -150,7 +148,6 @@ $categories_input
$guid_input
$container_guid_input
-$forward_input
$action_buttons
diff --git a/mod/blog/views/default/input/datetime.php b/mod/blog/views/default/input/datetime.php
index 5586464f1..f4bad188c 100644
--- a/mod/blog/views/default/input/datetime.php
+++ b/mod/blog/views/default/input/datetime.php
@@ -1,6 +1,8 @@
<?php
/**
* A date-time view for the blog publication date.
+ *
+ * not being used
*/
// default date to current time
diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php
index 639031113..19018492a 100644
--- a/mod/blog/views/default/object/blog.php
+++ b/mod/blog/views/default/object/blog.php
@@ -69,7 +69,7 @@ if ($blog->canEdit()) {
$metadata .= "<li>$status_text</li>";
}
- $edit_url = elgg_get_site_url() . "pg/blog/edit/{$owner->username}/{$blog->getGUID()}/";
+ $edit_url = elgg_get_site_url() . "pg/blog/edit/{$blog->getGUID()}/";
$edit_link = elgg_view('output/url', array(
'href' => $edit_url,
'text' => elgg_echo('edit'),
@@ -91,6 +91,11 @@ $metadata .= '</ul>';
$subtitle = "$author_text $date $categories $comments_link";
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
+}
+
if ($full) {
$header = elgg_view_title($blog->title);
diff --git a/mod/blog/views/default/widgets/blog/content.php b/mod/blog/views/default/widgets/blog/content.php
new file mode 100644
index 000000000..83d1c0c41
--- /dev/null
+++ b/mod/blog/views/default/widgets/blog/content.php
@@ -0,0 +1,29 @@
+<?php
+/**
+ * User blog widget display view
+ */
+
+$num = $vars['entity']->num_display;
+
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'blog',
+ 'container_guid' => $vars['entity']->owner_guid,
+ 'limit' => $num,
+ 'full_view' => FALSE,
+ 'pagination' => FALSE,
+);
+$content = elgg_list_entities($options);
+
+echo $content;
+
+if ($content) {
+ $blog_url = "pg/blog/owner/" . elgg_get_page_owner()->username;
+ $more_link = elgg_view('output/url', array(
+ 'href' => $blog_url,
+ 'text' => elgg_echo('blog:moreblogs'),
+ ));
+ echo "<span class=\"elgg-widget-more\">$more_link</span>";
+} else {
+ echo elgg_echo('blog:noblogs');
+}
diff --git a/mod/blog/views/default/widgets/blog/edit.php b/mod/blog/views/default/widgets/blog/edit.php
new file mode 100644
index 000000000..aaa9d1a10
--- /dev/null
+++ b/mod/blog/views/default/widgets/blog/edit.php
@@ -0,0 +1,22 @@
+<?php
+/**
+ * User blog widget edit view
+ */
+
+// set default value
+if (!isset($vars['entity']->num_display)) {
+ $vars['entity']->num_display = 4;
+}
+
+$params = array(
+ 'internalname' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display = 4,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+);
+$dropdown = elgg_view('input/pulldown', $params);
+
+?>
+<p>
+ <?php echo elgg_echo('blog:numbertodisplay'); ?>:
+ <?php echo $dropdown; ?>
+</p>