diff options
Diffstat (limited to 'mod/blog/views/default')
21 files changed, 581 insertions, 725 deletions
diff --git a/mod/blog/views/default/blog/categorylist.php b/mod/blog/views/default/blog/categorylist.php deleted file mode 100644 index 90403c550..000000000 --- a/mod/blog/views/default/blog/categorylist.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - $list = elgg_view('categories/list',$vars); - if (!empty($list)) { -?> - - <div class="blog_categories"> - <?php echo $list; ?> - </div> - -<?php - - } - -?>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/css.php b/mod/blog/views/default/blog/css.php index c9522c901..12ac4df2a 100644 --- a/mod/blog/views/default/blog/css.php +++ b/mod/blog/views/default/blog/css.php @@ -1,210 +1,14 @@ <?php - - /** - * Elgg blog CSS extender - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - +/** + * Blog CSS + * + * @package Blog +*/ ?> -#blogs .pagination { - margin:5px 10px 0 10px; - padding:5px; - display:block; -} -#blogs #two_column_left_sidebar_maincontent { - padding-bottom:10px; -} - -.singleview { - margin-top:10px; -} - -.blog_post_icon { - float:left; - margin:3px 0 0 0; - padding:0; -} - -.blog_post h3 { - font-size: 150%; - margin:0 0 10px 0; - padding:0; -} - -.blog_post h3 a { - text-decoration: none; -} - -.blog_post p { - margin: 0 0 5px 0; -} - -.blog_post .strapline { - margin: 0 0 0 35px; - padding:0; - color: #aaa; - line-height:1em; -} -.blog_post p.tags { - background:transparent url(<?php echo $vars['url']; ?>_graphics/icon_tag.gif) no-repeat scroll left 2px; - margin:0 0 7px 35px; - padding:0pt 0pt 0pt 16px; - min-height:22px; -} -.blog_post .options { - margin:0; - padding:0; -} - -.blog_post_body img[align="left"] { - margin: 10px 10px 10px 0; - float:left; -} -.blog_post_body img[align="right"] { - margin: 10px 0 10px 10px; - float:right; -} -.blog_post_body img { - margin: 10px !important; -} - -.blog-comments h3 { - font-size: 150%; - margin-bottom: 10px; -} -.blog-comment { - margin-top: 10px; - margin-bottom:20px; - border-bottom: 1px solid #aaaaaa; -} -.blog-comment img { - float:left; - margin: 0 10px 0 0; -} -.blog-comment-menu { - margin:0; -} -.blog-comment-byline { - background: #dddddd; - height:22px; - padding-top:3px; - margin:0; -} -.blog-comment-text { - margin:5px 0 5px 0; -} -/* New blog edit column */ -#blog_edit_page { - /* background: #bbdaf7; */ - margin-top:-10px; -} -#blog_edit_page #content_area_user_title h2 { - background: none; - border-top: none; - margin:0 0 10px 0px; - padding:0px 0 0 0; -} -#blog_edit_page #blog_edit_sidebar #content_area_user_title h2 { - background:none; - border-top:none; - margin:inherit; - padding:0 0 5px 5px; - font-size:1.25em; - line-height:1.2em; -} -#blog_edit_page #blog_edit_sidebar { - margin:0px 0 22px 0; - background: #dedede; - padding:5px; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - border-bottom:1px solid #cccccc; - border-right:1px solid #cccccc; -} -#blog_edit_page #two_column_left_sidebar_210 { - width:210px; - margin:0px 0 20px 0px; - min-height:360px; - float:left; - padding:0; -} -#blog_edit_page #two_column_left_sidebar_maincontent { - margin:0 0px 20px 20px; - padding:10px 20px 20px 20px; - width:670px; - background: #bbdaf7; -} -/* unsaved blog post preview */ -.blog_previewpane { - border:1px solid #D3322A; - background:#F7DAD8; - padding:10px; - margin:10px; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; -} -.blog_previewpane p { - margin:0; -} +/* Blog Plugin */ -#blog_edit_sidebar .publish_controls, -#blog_edit_sidebar .blog_access, -#blog_edit_sidebar .publish_options, -#blog_edit_sidebar .publish_blog, -#blog_edit_sidebar .allow_comments, -#blog_edit_sidebar .categories { - margin:0 5px 5px 5px; - border-top:1px solid #cccccc; -} -#blog_edit_page ul { - padding-left:0px; - margin:5px 0 5px 0; - list-style: none; +/* force tinymce input height for a more useful editing / blog creation area */ +form#blog-post-edit #description_parent #description_ifr { + height:400px !important; } -#blog_edit_page p { - margin:5px 0 5px 0; -} -#blog_edit_page #two_column_left_sidebar_maincontent p { - margin:0 0 15px 0; -} -#blog_edit_page .publish_blog input[type="submit"] { - font-weight: bold; - padding:2px; - height:auto; -} -#blog_edit_page .preview_button a { - font: 12px/100% Arial, Helvetica, sans-serif; - font-weight: bold; - background:white; - border: 1px solid #cccccc; - color:#999999; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - width: auto; - height: auto; - padding: 3px; - margin:1px 1px 5px 10px; - cursor: pointer; - float:right; -} -#blog_edit_page .preview_button a:hover { - background:#4690D6; - color:white; - text-decoration: none; - border: 1px solid #4690D6; -} -#blog_edit_page .allow_comments label { - font-size: 100%; -} - - - - - - diff --git a/mod/blog/views/default/blog/forms/edit.php b/mod/blog/views/default/blog/forms/edit.php deleted file mode 100644 index d3f4d7e52..000000000 --- a/mod/blog/views/default/blog/forms/edit.php +++ /dev/null @@ -1,200 +0,0 @@ -<?php - - /** - * Elgg blog edit/add page - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['object'] Optionally, the blog post to edit - */ - - // Set title, form destination - if (isset($vars['entity'])) { - $title = sprintf(elgg_echo("blog:editpost"),$object->title); - $action = "blog/edit"; - $title = $vars['entity']->title; - $body = $vars['entity']->description; - $tags = $vars['entity']->tags; - if ($vars['entity']->comments_on == 'Off') { - $comments_on = false; - } else { - $comments_on = true; - } - $access_id = $vars['entity']->access_id; - } else { - $title = elgg_echo("blog:addpost"); - $action = "blog/add"; - $tags = ""; - $title = ""; - $comments_on = true; - $description = ""; - if (defined('ACCESS_DEFAULT')) - $access_id = ACCESS_DEFAULT; - else - $access_id = 0; - - $container = $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; - } - - // Just in case we have some cached details - if (empty($body)) { - $body = $vars['user']->blogbody; - if (!empty($body)) { - $title = $vars['user']->blogtitle; - $tags = $vars['user']->blogtags; - } - } - - // set the required variables - - $title_label = elgg_echo('title'); - $title_textbox = elgg_view('input/text', array('internalname' => 'blogtitle', 'value' => $title)); - $text_label = elgg_echo('blog:text'); - $text_textarea = elgg_view('input/longtext', array('internalname' => 'blogbody', 'value' => $body)); - $tag_label = elgg_echo('tags'); - $tag_input = elgg_view('input/tags', array('internalname' => 'blogtags', 'value' => $tags)); - $access_label = elgg_echo('access'); - - //$comments_select = elgg_view('input/checkboxes', array('internalname' => 'comments_on', 'value' => '')); - if($comments_on) - $comments_on_switch = "checked=\"checked\""; - else - $comment_on_switch = ""; - - $access_input = elgg_view('input/access', array('internalname' => 'access_id', 'value' => $access_id)); - $submit_input = elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('publish'))); - $conversation = elgg_echo('Conversation'); - $publish = elgg_echo('publish'); - $cat = elgg_echo('categories'); - $preview = elgg_echo('blog:preview'); - $privacy = elgg_echo('access'); - $savedraft = elgg_echo('blog:draft:save'); - $draftsaved = elgg_echo('blog:draft:saved'); - $never = elgg_echo('blog:never'); - $allowcomments = elgg_echo('blog:comments:allow'); - - // INSERT EXTRAS HERE - $extras = elgg_view('categories',$vars); - if (!empty($extras)) $extras = '<div id="blog_edit_sidebar">' . $extras . '</div>'; - -?> - -<?php - - $form_body = <<<EOT - - <div id="two_column_left_sidebar_210"> - - <div id="blog_edit_sidebar"> - <div id="content_area_user_title"> - <div class="preview_button"><a onclick="javascript:saveDraft(true);return true;">{$preview}</a></div> - <h2>{$publish}</h2></div> - <div class="publish_controls"> - <p> - <a href="#" onclick="javascript:saveDraft(false);return false;">{$savedraft}</a> - </p> - </div> - <div class="publish_options"> - <!-- <p><b>{$publish}:</b> now <a href="">edit</a></p> --> - <p class="auto_save">{$draftsaved}: <span id="draftSavedCounter">{$never}</span></p> - </div> - <div class="blog_access"> - <p>{$privacy}: {$access_input} - </p></div> - <div class="publish_blog"> - {$submit_input} - </div> - </div> - - <div id="blog_edit_sidebar"> - <div id="content_area_user_title"><h2>{$conversation}</h2></div> - <div class="allow_comments"> - <p><label> - <input type="checkbox" name="comments_select" {$comments_on_switch} /> {$allowcomments} - </label></p> - </div> - </div> - - {$extras} - - $container - - </div><!-- /two_column_left_sidebar_210 --> - - <!-- main content --> - <div id="two_column_left_sidebar_maincontent"> -EOT; - -?> - -<?php - - if (isset($vars['entity'])) { - $entity_hidden = elgg_view('input/hidden', array('internalname' => 'blogpost', 'value' => $vars['entity']->getGUID())); - } else { - $entity_hidden = ''; - } - - $form_body .= <<<EOT - <p> - <label>$title_label</label><br /> - $title_textbox - </p> - <p class='longtext_editarea'> - <label>$text_label</label><br /> - $text_textarea - </p> - <p> - <label>$tag_label</label><br /> - $tag_input - </p> - <!-- <p> - <label>$access_label</label><br /> - $access_input - </p> --> - <p> - $entity_hidden - <!-- $submit_input --> - </p> - </div><div class="clearfloat"></div><!-- /two_column_left_sidebar_maincontent --> -EOT; - - echo elgg_view('input/form', array('action' => "{$vars['url']}action/$action", 'body' => $form_body, 'internalid' => 'blogPostForm')); -?> - -<script type="text/javascript"> - setInterval( "saveDraft(false)", 120000); - function saveDraft(preview) { - temppreview = preview; - - if (typeof(tinyMCE) != 'undefined') { - tinyMCE.triggerSave(); - } - - var drafturl = "<?php echo $vars['url']; ?>mod/blog/savedraft.php"; - var temptitle = $("input[name='blogtitle']").val(); - var tempbody = $("textarea[name='blogbody']").val(); - var temptags = $("input[name='blogtags']").val(); - - var postdata = { blogtitle: temptitle, blogbody: tempbody, blogtags: temptags }; - - $.post(drafturl, postdata, function() { - var d = new Date(); - var mins = d.getMinutes() + ''; - if (mins.length == 1) mins = '0' + mins; - $("span#draftSavedCounter").html(d.getHours() + ":" + mins); - if (temppreview == true) { - $("form#blogPostForm").attr("action","<?php echo $vars['url']; ?>mod/blog/preview.php"); - $("input[name='submit']").click(); - //$("form#blogPostForm").submit(); - //document.blogPostForm.submit(); - } - }); - - } - -</script> diff --git a/mod/blog/views/default/blog/gallery.php b/mod/blog/views/default/blog/gallery.php deleted file mode 100644 index 23f0418bc..000000000 --- a/mod/blog/views/default/blog/gallery.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php - - /** - * Elgg blog listing - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - $owner = $vars['entity']->getOwnerEntity(); - $friendlytime = friendly_time($vars['entity']->time_created); - $icon = elgg_view( - "profile/icon", array( - 'entity' => $owner, - 'size' => 'small', - ) - ); - $info = "<p>" . elgg_echo('blog') . ": <a href=\"{$vars['entity']->getURL()}\">{$vars['entity']->title}</a></p>"; - $info .= "<p><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</p>"; - - //display - echo "<div class=\"blog_gallery\">"; - echo "<div class=\"blog_gallery_icon\">" . $icon . "</div>"; - echo "<div class=\"blog_gallery_content\">" . $info . "</div>"; - echo "</div>"; - - -?>
\ No newline at end of file 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..6082cdafd --- /dev/null +++ b/mod/blog/views/default/blog/group_module.php @@ -0,0 +1,46 @@ +<?php +/** + * Group blog module + */ + +$group = elgg_get_page_owner_entity(); + +if ($group->blog_enable == "no") { + return true; +} + +$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'); +$options = array( + 'type' => 'object', + 'subtype' => 'blog', + 'container_guid' => elgg_get_page_owner_guid(), + 'metadata_name_value_pairs' => array('name' => 'status', 'value' => 'published'), + 'limit' => 6, + 'full_view' => false, + 'pagination' => false, +); +$content = elgg_list_entities_from_metadata($options); +elgg_pop_context(); + +if (!$content) { + $content = '<p>' . elgg_echo('blog:none') . '</p>'; +} + +$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( + 'title' => elgg_echo('blog:group'), + 'content' => $content, + 'all_link' => $all_link, + 'add_link' => $new_link, +)); diff --git a/mod/blog/views/default/blog/listing.php b/mod/blog/views/default/blog/listing.php deleted file mode 100644 index b2dad2570..000000000 --- a/mod/blog/views/default/blog/listing.php +++ /dev/null @@ -1,25 +0,0 @@ -<?php - - /** - * Elgg blog listing - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - - $owner = $vars['entity']->getOwnerEntity(); - $friendlytime = friendly_time($vars['entity']->time_created); - $icon = elgg_view( - "profile/icon", array( - 'entity' => $owner, - 'size' => 'small', - ) - ); - $info = "<p>" . elgg_echo('blog') . ": <a href=\"{$vars['entity']->getURL()}\">{$vars['entity']->title}</a></p>"; - $info .= "<p class=\"owner_timestamp\"><a href=\"{$owner->getURL()}\">{$owner->name}</a> {$friendlytime}</p>"; - echo elgg_view_listing($icon,$info); - -?>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/menu.php b/mod/blog/views/default/blog/menu.php deleted file mode 100644 index 45384ae72..000000000 --- a/mod/blog/views/default/blog/menu.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php - - /** - * Elgg hoverover extender for blog - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - -?> - - <p class="user_menu_blog"> - <a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $vars['entity']->username; ?>"><?php echo elgg_echo("blog"); ?></a> - </p>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/notfound.php b/mod/blog/views/default/blog/notfound.php deleted file mode 100644 index 543b98374..000000000 --- a/mod/blog/views/default/blog/notfound.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php - - /** - * Elgg blog not found page - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - */ - -?> - - <p> - <?php - - echo elgg_echo("blog:notfound"); - - ?> - </p>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/previewpane.php b/mod/blog/views/default/blog/previewpane.php deleted file mode 100644 index 0828c06a9..000000000 --- a/mod/blog/views/default/blog/previewpane.php +++ /dev/null @@ -1,6 +0,0 @@ -<div class="blog_previewpane"> - <p> - <?php echo elgg_echo("blog:preview:description"); ?> - <a href="javascript:history.go(-1);"><?php echo elgg_echo("blog:preview:description:link"); ?></a> - </p> -</div>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/sidebar.php b/mod/blog/views/default/blog/sidebar.php new file mode 100644 index 000000000..0ae2b431c --- /dev/null +++ b/mod/blog/views/default/blog/sidebar.php @@ -0,0 +1,30 @@ +<?php +/** + * Blog sidebar + * + * @package Blog + */ + +// fetch & display latest comments +if ($vars['page'] == 'all') { + echo elgg_view('page/elements/comments_block', array( + 'subtypes' => 'blog', + )); +} elseif ($vars['page'] == 'owner') { + echo elgg_view('page/elements/comments_block', array( + 'subtypes' => 'blog', + 'owner_guid' => elgg_get_page_owner_guid(), + )); +} + +// only users can have archives at present +if ($vars['page'] == 'owner' || $vars['page'] == 'group') { + echo elgg_view('blog/sidebar/archives', $vars); +} + +if ($vars['page'] != 'friends') { + echo elgg_view('page/elements/tagcloud_block', array( + 'subtypes' => 'blog', + 'owner_guid' => elgg_get_page_owner_guid(), + )); +} 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..5098e6e3e --- /dev/null +++ b/mod/blog/views/default/blog/sidebar/archives.php @@ -0,0 +1,34 @@ +<?php +/** + * Blog archives + */ + +$loggedin_user = elgg_get_logged_in_user_entity(); +$page_owner = elgg_get_page_owner_entity(); + +if (elgg_instanceof($page_owner, 'user')) { + $url_segment = 'blog/archive/' . $page_owner->username; +} else { + $url_segment = 'blog/group/' . $page_owner->getGUID() . '/archive'; +} + +// This is a limitation of the URL schema. +if ($page_owner && $vars['page'] != 'friends') { + $dates = array_reverse(get_entity_dates('object', 'blog', $page_owner->getGUID())); + + if ($dates) { + $title = elgg_echo('blog:archives'); + $content = '<ul class="blog-archives">'; + foreach ($dates as $date) { + $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() . $url_segment . '/' . $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_module('aside', $title, $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 new file mode 100644 index 000000000..cd2e7f3d8 --- /dev/null +++ b/mod/blog/views/default/blog/sidebar/revisions.php @@ -0,0 +1,79 @@ +<?php +/** + * Blog sidebar menu showing revisions + * + * @package Blog + */ + +//If editing a post, show the previous revisions and drafts. +$blog = elgg_extract('entity', $vars, FALSE); + +if (elgg_instanceof($blog, 'object', 'blog') && $blog->canEdit()) { + $owner = $blog->getOwnerEntity(); + $revisions = array(); + + $auto_save_annotations = $blog->getAnnotations('blog_auto_save', 1); + if ($auto_save_annotations) { + $revisions[] = $auto_save_annotations[0]; + } + + // count(FALSE) == 1! AHHH!!! + $saved_revisions = $blog->getAnnotations('blog_revision', 10, 0, 'time_created DESC'); + if ($saved_revisions) { + $revision_count = count($saved_revisions); + } else { + $revision_count = 0; + } + + $revisions = array_merge($revisions, $saved_revisions); + + if ($revisions) { + $title = elgg_echo('blog:revisions'); + + $n = count($revisions); + $body = '<ul class="blog-revisions">'; + + $load_base_url = "blog/edit/{$blog->getGUID()}"; + + // show the "published revision" + if ($blog->status == 'published') { + $load = elgg_view('output/url', array( + 'href' => $load_base_url, + 'text' => elgg_echo('blog:status:published'), + 'is_trusted' => true, + )); + + $time = "<span class='elgg-subtext'>" + . elgg_view_friendly_time($blog->time_created) . "</span>"; + + $body .= "<li>$load : $time</li>"; + } + + foreach ($revisions as $revision) { + $time = "<span class='elgg-subtext'>" + . elgg_view_friendly_time($revision->time_created) . "</span>"; + + if ($revision->name == 'blog_auto_save') { + $revision_lang = elgg_echo('blog:auto_saved_revision'); + } else { + $revision_lang = elgg_echo('blog:revision') . " $n"; + } + $load = elgg_view('output/url', array( + 'href' => "$load_base_url/$revision->id", + 'text' => $revision_lang, + 'is_trusted' => true, + )); + + $text = "$load: $time"; + $class = 'class="auto-saved"'; + + $n--; + + $body .= "<li $class>$text</li>"; + } + + $body .= '</ul>'; + + echo elgg_view_module('aside', $title, $body); + } +}
\ No newline at end of file diff --git a/mod/blog/views/default/blog/view.php b/mod/blog/views/default/blog/view.php deleted file mode 100644 index 18841d224..000000000 --- a/mod/blog/views/default/blog/view.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php - - /** - * Elgg blog view page - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Curverider Ltd <info@elgg.com> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['posts'] An array of posts to view - */ - - // If there are any posts to view, view them - if (is_array($vars['posts']) && sizeof($vars['posts']) > 0) { - - foreach($vars['posts'] as $post) { - - echo elgg_view_entity($post); - - } - - } - -?>
\ No newline at end of file diff --git a/mod/blog/views/default/forms/blog/save.php b/mod/blog/views/default/forms/blog/save.php new file mode 100644 index 000000000..f825acca1 --- /dev/null +++ b/mod/blog/views/default/forms/blog/save.php @@ -0,0 +1,166 @@ +<?php +/** + * Edit blog form + * + * @package Blog + */ + +$blog = get_entity($vars['guid']); +$vars['entity'] = $blog; + +$draft_warning = $vars['draft_warning']; +if ($draft_warning) { + $draft_warning = '<span class="mbm elgg-text-help">' . $draft_warning . '</span>'; +} + +$action_buttons = ''; +$delete_link = ''; +$preview_button = ''; + +if ($vars['guid']) { + // add a delete button if editing + $delete_url = "action/blog/delete?guid={$vars['guid']}"; + $delete_link = elgg_view('output/confirmlink', array( + 'href' => $delete_url, + 'text' => elgg_echo('delete'), + 'class' => 'elgg-button elgg-button-delete float-alt' + )); +} + +// 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( + 'name' => 'title', + 'id' => 'blog_title', + 'value' => $vars['title'] +)); + +$excerpt_label = elgg_echo('blog:excerpt'); +$excerpt_input = elgg_view('input/text', array( + 'name' => 'excerpt', + 'id' => 'blog_excerpt', + 'value' => _elgg_html_decode($vars['excerpt']) +)); + +$body_label = elgg_echo('blog:body'); +$body_input = elgg_view('input/longtext', array( + 'name' => 'description', + 'id' => 'blog_description', + 'value' => $vars['description'] +)); + +$save_status = elgg_echo('blog:save_status'); +if ($vars['guid']) { + $entity = get_entity($vars['guid']); + $saved = date('F j, Y @ H:i', $entity->time_created); +} else { + $saved = elgg_echo('blog:never'); +} + +$status_label = elgg_echo('blog:status'); +$status_input = elgg_view('input/dropdown', array( + 'name' => 'status', + 'id' => 'blog_status', + 'value' => $vars['status'], + 'options_values' => array( + 'draft' => elgg_echo('blog:status:draft'), + 'published' => elgg_echo('blog:status:published') + ) +)); + +$comments_label = elgg_echo('comments'); +$comments_input = elgg_view('input/dropdown', array( + 'name' => 'comments_on', + 'id' => 'blog_comments_on', + 'value' => $vars['comments_on'], + 'options_values' => array('On' => elgg_echo('on'), 'Off' => elgg_echo('off')) +)); + +$tags_label = elgg_echo('tags'); +$tags_input = elgg_view('input/tags', array( + 'name' => 'tags', + 'id' => 'blog_tags', + 'value' => $vars['tags'] +)); + +$access_label = elgg_echo('access'); +$access_input = elgg_view('input/access', array( + 'name' => 'access_id', + 'id' => 'blog_access_id', + 'value' => $vars['access_id'] +)); + +$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())); +$guid_input = elgg_view('input/hidden', array('name' => 'guid', 'value' => $vars['guid'])); + + +echo <<<___HTML + +$draft_warning + +<div> + <label for="blog_title">$title_label</label> + $title_input +</div> + +<div> + <label for="blog_excerpt">$excerpt_label</label> + $excerpt_input +</div> + +<div> + <label for="blog_description">$body_label</label> + $body_input +</div> + +<div> + <label for="blog_tags">$tags_label</label> + $tags_input +</div> + +$categories_input + +<div> + <label for="blog_comments_on">$comments_label</label> + $comments_input +</div> + +<div> + <label for="blog_access_id">$access_label</label> + $access_input +</div> + +<div> + <label for="blog_status">$status_label</label> + $status_input +</div> + +<div class="elgg-foot"> + <div class="elgg-subtext mbm"> + $save_status <span class="blog-save-status-time">$saved</span> + </div> + + $guid_input + $container_guid_input + + $action_buttons +</div> + +___HTML; diff --git a/mod/blog/views/default/js/blog/save_draft.php b/mod/blog/views/default/js/blog/save_draft.php new file mode 100644 index 000000000..8cd07ff5d --- /dev/null +++ b/mod/blog/views/default/js/blog/save_draft.php @@ -0,0 +1,67 @@ +<?php +/** + * Save draft through ajax + * + * @package Blog + */ +?> +elgg.provide('elgg.blog'); + +/* + * Attempt to save and update the input with the guid. + */ +elgg.blog.saveDraftCallback = function(data, textStatus, XHR) { + if (textStatus == 'success' && data.success == true) { + var form = $('form[id=blog-post-edit]'); + + // update the guid input element for new posts that now have a guid + form.find('input[name=guid]').val(data.guid); + + oldDescription = form.find('textarea[name=description]').val(); + + var d = new Date(); + var mins = d.getMinutes() + ''; + if (mins.length == 1) { + mins = '0' + mins; + } + $(".blog-save-status-time").html(d.toLocaleDateString() + " @ " + d.getHours() + ":" + mins); + } else { + $(".blog-save-status-time").html(elgg.echo('error')); + } +}; + +elgg.blog.saveDraft = function() { + if (typeof(tinyMCE) != 'undefined') { + tinyMCE.triggerSave(); + } + + // only save on changed content + var form = $('form[id=blog-post-edit]'); + var description = form.find('textarea[name=description]').val(); + var title = form.find('input[name=title]').val(); + + if (!(description && title) || (description == oldDescription)) { + return false; + } + + var draftURL = elgg.config.wwwroot + "action/blog/auto_save_revision"; + var postData = form.serializeArray(); + + // force draft status + $(postData).each(function(i, e) { + if (e.name == 'status') { + e.value = 'draft'; + } + }); + + $.post(draftURL, postData, elgg.blog.saveDraftCallback, 'json'); +}; + +elgg.blog.init = function() { + // get a copy of the body to compare for auto save + oldDescription = $('form[id=blog-post-edit]').find('textarea[name=description]').val(); + + setInterval(elgg.blog.saveDraft, 60000); +}; + +elgg.register_hook_handler('init', 'system', elgg.blog.init);
\ No newline at end of file diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php index 898705911..4403a6006 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -1,150 +1,99 @@ <?php +/** + * View for blog objects + * + * @package Blog + */ - /** - * Elgg blog individual post view - * - * @package ElggBlog - * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 - * @author Ben Werdmuller <ben@curverider.co.uk> - * @copyright Curverider Ltd 2008-2010 - * @link http://elgg.com/ - * - * @uses $vars['entity'] Optionally, the blog post to view - */ +$full = elgg_extract('full_view', $vars, FALSE); +$blog = elgg_extract('entity', $vars, FALSE); - if (isset($vars['entity'])) { - - //display comments link? - if ($vars['entity']->comments_on == 'Off') { - $comments_on = false; - } else { - $comments_on = true; - } - - if (get_context() == "search" && $vars['entity'] instanceof ElggObject) { - - //display the correct layout depending on gallery or list view - if (get_input('search_viewtype') == "gallery") { +if (!$blog) { + return TRUE; +} - //display the gallery view - echo elgg_view("blog/gallery",$vars); +$owner = $blog->getOwnerEntity(); +$container = $blog->getContainerEntity(); +$categories = elgg_view('output/categories', $vars); +$excerpt = $blog->excerpt; +if (!$excerpt) { + $excerpt = elgg_get_excerpt($blog->description); +} - } else { - - echo elgg_view("blog/listing",$vars); +$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)); +$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') { + $comments_count = $blog->countComments(); + //only display if there are commments + if ($comments_count != 0) { + $text = elgg_echo("comments") . " ($comments_count)"; + $comments_link = elgg_view('output/url', array( + 'href' => $blog->getURL() . '#blog-comments', + 'text' => $text, + 'is_trusted' => true, + )); + } else { + $comments_link = ''; + } +} else { + $comments_link = ''; +} - - } else { - - if ($vars['entity'] instanceof ElggObject) { - - $url = $vars['entity']->getURL(); - $owner = $vars['entity']->getOwnerEntity(); - $canedit = $vars['entity']->canEdit(); - - } else { - - $url = 'javascript:history.go(-1);'; - $owner = $vars['user']; - $canedit = false; - - } -?> +$metadata = elgg_view_menu('entity', array( + 'entity' => $vars['entity'], + 'handler' => 'blog', + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', +)); - <div class="contentWrapper singleview"> - - <div class="blog_post"> - <h3><a href="<?php echo $url; ?>"><?php echo $vars['entity']->title; ?></a></h3> - <!-- display the user icon --> - <div class="blog_post_icon"> - <?php - echo elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny')); - ?> - </div> - <p class="strapline"> - <?php - - echo sprintf(elgg_echo("blog:strapline"), - date("F j, Y",$vars['entity']->time_created) - ); - - ?> - <?php echo elgg_echo('by'); ?> <a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a> - <!-- display the comments link --> - <?php - if($comments_on && $vars['entity'] instanceof ElggObject){ - //get the number of comments - $num_comments = elgg_count_comments($vars['entity']); - ?> - <a href="<?php echo $url; ?>"><?php echo sprintf(elgg_echo("comments")) . " (" . $num_comments . ")"; ?></a><br /> - <?php - } - ?> - </p> - <!-- display tags --> - <?php - - $tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags)); - if (!empty($tags)) { - echo '<p class="tags">' . $tags . '</p>'; - } - - $categories = elgg_view('categories/view', $vars); - if (!empty($categories)) { - echo '<p class="categories">' . $categories . '</p>'; - } - - ?> - <div class="clearfloat"></div> - <div class="blog_post_body"> +$subtitle = "$author_text $date $comments_link $categories"; - <!-- display the actual blog post --> - <?php - - echo elgg_view('output/longtext',array('value' => $vars['entity']->description)); - - ?> - </div><div class="clearfloat"></div> - <!-- display edit options if it is the blog post owner --> - <p class="options"> - <?php - - if ($canedit) { - - ?> - <a href="<?php echo $vars['url']; ?>mod/blog/edit.php?blogpost=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo("edit"); ?></a> - <?php - - echo elgg_view("output/confirmlink", array( - 'href' => $vars['url'] . "action/blog/delete?blogpost=" . $vars['entity']->getGUID(), - 'text' => elgg_echo('delete'), - 'confirm' => elgg_echo('deleteconfirm'), - )); - - // Allow the menu to be extended - echo elgg_view("editmenu",array('entity' => $vars['entity'])); - - ?> - <?php - } - - ?> - </p> - </div> - </div> +// do not show the metadata and controls in widget view +if (elgg_in_context('widgets')) { + $metadata = ''; +} -<?php +if ($full) { + + $body = elgg_view('output/longtext', array( + 'value' => $blog->description, + 'class' => 'blog-post', + )); + + $params = array( + 'entity' => $blog, + 'title' => false, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + ); + $params = $params + $vars; + $summary = elgg_view('object/elements/summary', $params); + + echo elgg_view('object/elements/full', array( + 'summary' => $summary, + 'icon' => $owner_icon, + 'body' => $body, + )); - // If we've been asked to display the full view - // Now handled by annotation framework - /*if (isset($vars['full']) && $vars['full'] == true && $comments_on == 'on' && $vars['entity'] instanceof ElggEntity) { - echo elgg_view_comments($vars['entity']); - }*/ - - } +} else { + // brief view - } + $params = array( + 'entity' => $blog, + 'metadata' => $metadata, + 'subtitle' => $subtitle, + 'content' => $excerpt, + ); + $params = $params + $vars; + $list_body = elgg_view('object/elements/summary', $params); -?> + echo elgg_view_image_block($owner_icon, $list_body); +} diff --git a/mod/blog/views/default/river/object/blog/annotate.php b/mod/blog/views/default/river/object/blog/annotate.php deleted file mode 100644 index 77b75c6d9..000000000 --- a/mod/blog/views/default/river/object/blog/annotate.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - - $statement = $vars['statement']; - $performed_by = $statement->getSubject(); - $object = $statement->getObject(); - - $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("blog:river:posted"),$url) . " "; - $string .= elgg_echo("blog:river:annotate:create") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; - -?> - -<?php echo $string; ?>
\ No newline at end of file diff --git a/mod/blog/views/default/river/object/blog/create.php b/mod/blog/views/default/river/object/blog/create.php index b5b3dc2e4..b808f1bdc 100644 --- a/mod/blog/views/default/river/object/blog/create.php +++ b/mod/blog/views/default/river/object/blog/create.php @@ -1,20 +1,15 @@ <?php +/** + * Blog river view. + */ - $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - $url = $object->getURL(); - - $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $contents = strip_tags($object->description); //strip tags from the contents to stop large images etc blowing out the river view - $string = sprintf(elgg_echo("blog:river:created"),$url) . " "; - $string .= elgg_echo("blog:river:create") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; - $string .= "<div class=\"river_content_display\">"; - if(strlen($contents) > 200) { - $string .= substr($contents, 0, strpos($contents, ' ', 200)) . "..."; - }else{ - $string .= $contents; - } - $string .= "</div>"; -?> +$object = $vars['item']->getObjectEntity(); -<?php echo $string; ?>
\ No newline at end of file +$excerpt = $object->excerpt ? $object->excerpt : $object->description; +$excerpt = strip_tags($excerpt); +$excerpt = elgg_get_excerpt($excerpt); + +echo elgg_view('river/elements/layout', array( + 'item' => $vars['item'], + 'message' => $excerpt, +)); diff --git a/mod/blog/views/default/river/object/blog/update.php b/mod/blog/views/default/river/object/blog/update.php deleted file mode 100644 index cf98afa8b..000000000 --- a/mod/blog/views/default/river/object/blog/update.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - - $performed_by = get_entity($vars['item']->subject_guid); // $statement->getSubject(); - $object = get_entity($vars['item']->object_guid); - $url = $object->getURL(); - - $url = "<a href=\"{$performed_by->getURL()}\">{$performed_by->name}</a>"; - $string = sprintf(elgg_echo("blog:river:updated"),$url) . " "; - $string .= elgg_echo("blog:river:update") . " <a href=\"" . $object->getURL() . "\">" . $object->title . "</a>"; - -?> - -<?php echo $string; ?>
\ 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 new file mode 100644 index 000000000..330171662 --- /dev/null +++ b/mod/blog/views/default/widgets/blog/content.php @@ -0,0 +1,30 @@ +<?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 = "blog/owner/" . elgg_get_page_owner_entity()->username; + $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 { + 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..30c3b2e73 --- /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( + 'name' => 'params[num_display]', + 'value' => $vars['entity']->num_display, + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), +); +$dropdown = elgg_view('input/dropdown', $params); + +?> +<div> + <?php echo elgg_echo('blog:numbertodisplay'); ?>: + <?php echo $dropdown; ?> +</div> |
