diff options
Diffstat (limited to 'mod/blog/views')
-rw-r--r-- | mod/blog/views/default/blog/archive.php | 22 | ||||
-rw-r--r-- | mod/blog/views/default/blog/categorylist.php | 14 | ||||
-rw-r--r-- | mod/blog/views/default/blog/css.php | 269 | ||||
-rw-r--r-- | mod/blog/views/default/blog/forms/edit.php | 489 | ||||
-rw-r--r-- | mod/blog/views/default/blog/gallery.php | 21 | ||||
-rw-r--r-- | mod/blog/views/default/blog/listing.php | 64 | ||||
-rw-r--r-- | mod/blog/views/default/blog/menu.php | 9 | ||||
-rw-r--r-- | mod/blog/views/default/blog/notfound.php | 13 | ||||
-rw-r--r-- | mod/blog/views/default/blog/previewpane.php | 6 | ||||
-rw-r--r-- | mod/blog/views/default/blog/sidebar_menu.php | 42 | ||||
-rw-r--r-- | mod/blog/views/default/blog/stats.php | 13 | ||||
-rw-r--r-- | mod/blog/views/default/blog/view.php | 15 | ||||
-rw-r--r-- | mod/blog/views/default/object/blog.php | 265 | ||||
-rw-r--r-- | mod/blog/views/default/river/object/blog/annotate.php | 13 | ||||
-rw-r--r-- | mod/blog/views/default/river/object/blog/create.php | 20 | ||||
-rw-r--r-- | mod/blog/views/default/river/object/blog/update.php | 13 |
16 files changed, 399 insertions, 889 deletions
diff --git a/mod/blog/views/default/blog/archive.php b/mod/blog/views/default/blog/archive.php deleted file mode 100644 index 76ae16696..000000000 --- a/mod/blog/views/default/blog/archive.php +++ /dev/null @@ -1,22 +0,0 @@ -<?php -//get blog archives -global $CONFIG; -if (!defined('everyoneblog') && page_owner()) { - echo "<div class='SidebarBox'>"; - echo "<h3>" . elgg_echo('blog:archive') ."</h3>"; - echo "<div class='ContentWrapper'><div id='Owner_Block_Links'><ul>"; - if ($dates = get_entity_dates('object','blog',page_owner())) { - 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)); - if (!isset($page_owner)) $page_owner = page_owner_entity(); - $link = $CONFIG->wwwroot . 'pg/blog/' . $page_owner->username . '/archive/' . $timestamplow . '/' . $timestamphigh; - //echo (sprintf(elgg_echo('date:month:'.substr($date,4,2)),substr($date,0,4)),$link,'filter'); - $year = substr($date,0,-2); - $month = date('F',mktime(0, 0, 0, substr($date,4,2), 1)); //substr($date,4,2); - $display_date = $month . " " . $year; - echo "<li><a href=\"{$link}\">" . $display_date . "</a></li>"; - } - } - echo "</ul></div></div></div>"; -}
\ No newline at end of file diff --git a/mod/blog/views/default/blog/categorylist.php b/mod/blog/views/default/blog/categorylist.php deleted file mode 100644 index 799c837a7..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 361e1572c..e69de29bb 100644 --- a/mod/blog/views/default/blog/css.php +++ b/mod/blog/views/default/blog/css.php @@ -1,269 +0,0 @@ -<?php - - /** - * Elgg blog css - * - */ - -?> -#blogs .pagination { -/* - margin:5px 10px 0 10px; - padding:5px; - display:block; -*/ -} - -.singleview { - /* margin-top:10px !important; */ -} - -/* -we're partly using the #NewListStyle on blogs -ItemMetaData block only -*/ -#blogs .ContentWrapper.Welcome { - padding:10px 0 10px 0; -} -#blogs .search_listing .search_listing_info .ItemMetaData { - float:right; - margin-left:15px; - margin-top:0; - margin-right: 3px; - color:#AAAAAA; - text-align: right; - font-size:90%; -} -#blogs .search_listing .search_listing_info .ItemMetaData table { - width:200px; - /* float:right; removed for ie7 compatability */ -} -#blogs .search_listing .search_listing_info .ItemMetaData .EditItem a { - color:#AAAAAA; - margin:0 0 0 10px; -} -#blogs .search_listing .search_listing_info .ItemMetaData .EditItem a:hover { - color: #0054a7; - text-decoration: underline; -} - -#blogs .search_listing .search_listing_info .ItemMetaData td.FavouriteItem { - padding-top:0; -} -/* IE7 */ -*:first-child+html #blogs .search_listing .search_listing_info .ItemMetaData td.FavouriteItem { width:auto; } - - -/* BLOG TITLE IN LIST VIEWS */ -#blogs h2.blog_title { - line-height:1.1em; - margin-top:0; - font-size:1.4em; -} -#blogs h2.blog_title a { - color:#0054A7; -} -#blogs .search_listing_info p.blog_excerpt { - margin-top:3px; - padding-top:2px; - border-top:1px solid #cccccc; -} -#blogs .search_listing_info p.owner_timestamp { - margin-top:2px; -} - -.Page_Header_Options .cancel_button { - float:right; - margin:0 10px 0 0; -} - -.blog_post_icon { - float:left; - margin:0 0 0 0; - padding:0; -} -#blogs .search_listing_info { - margin-left:34px; -} - -.blog_post #content_area_user_title { - -} -.blog_post #content_area_user_title h2 { - margin:0 0 5px; - padding:0 0 5px; - border-bottom:1px solid #cccccc; -} -.blog_post .strapline { - margin: 0 0 0 30px; - padding:0; - color: #aaa; - line-height:0.8em; -} -.blog_post .strapline .generic_access, -.blog_post .strapline .shared_collection, -.blog_post .strapline .group_open, -.blog_post .strapline .group_closed { - line-height:1.4em; - display:block; -} -.blog_post p.tags { - background:transparent url(<?php echo $vars['url']; ?>_graphics/icon_tag.png) no-repeat scroll left 2px; - margin:0; - padding:0 0 0 16px; - min-height:22px; -} -.blog_post .options { - margin:0; - padding:0; -} -.blog_post_body { - margin-top:2px; - padding-top:8px; - border-top:1px solid #cccccc; -} -.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; -} - - - - -/* 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_edit_page .publish_controls, -#blog_edit_page .blog_access, -#blog_edit_page .publish_options, -#blog_edit_page .publish_blog, -#blog_edit_page .allow_comments, -#blog_edit_page .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; -} -#blog_edit_page p { - margin:5px 0 5px 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%; -} - - -/* blog edit page */ -#blogPostForm .ContentWrapper { - margin-top:10px; -} -#blogPostForm .ContentWrapper #excerpt_editarea { - margin-top:15px; - margin-bottom:15px; -} -#excerpt_editarea .input_textarea { - height:80px; -} -#blogPostForm .current_access { - color:inherit; - font-size:inherit; - line-height:1.0em; - padding-top:0; -} - -/* blog widget on groups */ -.collapsable_box_content .ContentWrapper.blogs.more { - margin:0 10px; - padding:5px 10px; -} -.collapsable_box_content .ContentWrapper.blogs { - line-height:1.2em; - margin-bottom:5px; -} -.collapsable_box_content .ContentWrapper.blogs .river_object_blog_create { - background-position:left 2px; - min-height:17px; - padding:2px 0 2px 19px; - border-bottom:1px solid #DDDDDD; - line-height:1.1em; -} -.collapsable_box_content .ContentWrapper.blogs .river_object_blog_create:first-child { - border-top:1px solid #DDDDDD; -} -.collapsable_box_content .ContentWrapper.blogs .river_object_blog_create span { - font-size: 90%; - color:#666666; -} - - diff --git a/mod/blog/views/default/blog/forms/edit.php b/mod/blog/views/default/blog/forms/edit.php index 28a0980a4..3c9912daa 100644 --- a/mod/blog/views/default/blog/forms/edit.php +++ b/mod/blog/views/default/blog/forms/edit.php @@ -1,257 +1,272 @@ -<script> -$(document).ready(function(){ - $('#excerpt.excerpt').each(function(){ - var allowed = 200; - - // set the initial value - $('#countervalue').text(allowed); - - // bind on key up event - $(this).keyup(function(){ - var counter_value = ((allowed - ($(this).val().length))); - - $("#countervalue").removeClass(); - - if ((counter_value > 10)) { - $("#countervalue").addClass("positive"); - } - else if ((counter_value <= 10) && (counter_value >= 0)) { - $("#countervalue").addClass("gettingclose"); - } - else if ((counter_value < 0)) { - $("#countervalue").addClass("negative"); - } - - // insert new length - $('#countervalue').text(counter_value); - - }); - }); -}); -</script> <?php /** -* Elgg blog edit/add page -*/ - -//access details -$loggedin_user_access = get_default_access(get_loggedin_user()); -$user_acl = get_readable_access_level($loggedin_user_access); - -//Populate the title, body and acction variables if it is an edit, declare them if it is a new post -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; - $show_excerpt = $vars['entity']->show_excerpt; - if($show_excerpt) - $excerpt = $vars['entity']->excerpt; - else - $excerpt = ""; - $page_title = elgg_view_title(elgg_echo('blog:editpost')); -}else{ - $title = elgg_echo("blog:addpost"); - $action = "blog/add"; - $tags = ""; - $title = ""; - $comments_on = true; - $description = ""; - $excerpt = ""; - $show_excerpt = ''; - $page_title = elgg_view_title(elgg_echo('blog:addpost')); - if(page_owner_entity() instanceof ElggGroup){ - //if in a group, set the access level to default to the group - $access_id = page_owner_entity()->group_acl; - }else{ - $access_id = $loggedin_user_access; - } - $container = $vars['container_guid'] ? elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $vars['container_guid'])) : ""; -} + * Edit blog form + * + * @package Blog + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +$values = array( + 'title' => NULL, + 'description' => NULL, + 'status' => 'final', + //'publish_date' => NULL, + 'access_id' => ACCESS_DEFAULT, + 'comments_on' => 'On', + 'excerpt' => NULL, + 'tags' => NULL, + 'container_guid' => NULL, + 'guid' => NULL +); + +$forward = $_SERVER['HTTP_REFERER']; + +$action_buttons = ''; +$guid_input = ''; -//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; +// if entity is set, we're editing. +if (isset ($vars['entity'])) { + $blog = $vars['entity']; + + if ($blog && ($blog instanceof ElggObject) && ($blog->getSubtype() == 'blog')) { + foreach (array_keys($values) as $field) { + $values[$field] = $blog->$field; + } + } else { + echo elgg_echo('blog:error:post_not_found'); + return FALSE; } + + // add a delete button if editing + $delete_url = "{$vars['url']}action/blog/delete?guid={$blog->getGUID()}"; + $delete_link = elgg_view('output/confirmlink', array( + 'href' => $delete_url, + 'text' => elgg_echo('delete'), + 'class' => 'action_button' + )); + + $action_buttons = $delete_link; + + $guid_input = elgg_view('input/hidden', array('internalname' => 'guid', 'value' => $values['guid'])); } -//set the required input fields -$title_label = elgg_echo('blog: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)); +$save_button = elgg_view('input/submit', array('value' => elgg_echo('save'), 'class' => 'action_button')); +$action_buttons .= $save_button; + +$title_label = elgg_echo('title'); +$title_input = elgg_view('input/text', array( + 'internalname' => 'title', + 'internalid' => 'blog_title', + 'value' => $values['title'] +)); + $excerpt_label = elgg_echo('blog:excerpt'); -$excerpt_counter = "<div class='thewire_characters_remaining'><span id='countervalue'></span></div>"; -$excerpt_textarea = elgg_view('input/text', array('internalname' => 'blogexcerpt', 'internalid' => 'excerpt', 'class' => 'excerpt input_textarea', 'value' => $excerpt)); -$excerpt_desc = elgg_echo('blog:excerptdesc'); -$show_excerpt_field = elgg_view('input/hidden', array('internalname' => 'show_excerpt', 'value' => $show_excerpt)); -$tag_label = elgg_echo('tags'); -$tag_input = elgg_view('input/tags', array('internalname' => 'blogtags', 'value' => $tags)); +$excerpt_input = elgg_view('input/text', array( + 'internalname' => 'excerpt', + 'internalid' => 'blog_excerpt', + 'value' => $values['excerpt'] +)); + +$body_label = elgg_echo('blog:body'); +$body_input = elgg_view('input/longtext', array( + 'internalname' => 'description', + 'internalid' => 'blog_description', + 'value' => $values['description'] +)); + +$save_status = elgg_echo('blog:save_status'); +$never = elgg_echo('never'); + +$status_label = elgg_echo('blog:status'); +$status_input = elgg_view('input/pulldown', array( + 'internalname' => 'status', + 'internalid' => 'blog_status', + 'value' => $values['status'], + 'options_values' => array( + 'draft' => elgg_echo('blog:draft'), + 'final' => elgg_echo('blog:final') + ) +)); + +$comments_label = elgg_echo('comments'); +$comments_input = elgg_view('input/pulldown', array( + 'internalname' => 'comments_on', + 'internalid' => 'blog_comments_on', + 'value' => $values['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( + 'internalname' => 'tags', + 'internalid' => 'blog_tags', + 'value' => $values['tags'] +)); + $access_label = elgg_echo('access'); -if($comments_on) - $comments_on_switch = "checked=\"checked\""; -else - $comment_on_switch = ""; -//if it is a group, pull out the group access view -if(page_owner_entity() instanceof ElggGroup){ - $options = group_access_options(page_owner_entity()); -}else{ - $options = ''; -} -$access_input = elgg_view('input/access', array('internalname' => 'access_id', 'value' => $access_id, 'options' => $options)); -$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'); -$user_default_access = elgg_echo('blog:defaultaccess'); -$ownerblock = elgg_view('blog/ownerblock', array('entity' => $vars['entity'])); -if($vars['entity']){ - $deletepage = elgg_view('output/confirmlink',array( - 'href' => $vars['url'] . "action/blog/delete?blogpost=" . $vars['entity']->getGUID(), - 'text' => elgg_echo("delete"), - 'confirm' => elgg_echo("blog:delete:confirm"), - 'class' => "Action_Button Disabled")); -}else{ - $deletepage = ""; -} +$access_input = elgg_view('input/access', array( + 'internalname' => 'access_id', + 'internalid' => 'blog_access_id', + 'value' => $values['access_id'] +)); -//INSERT EXTRAS HERE -$extras = elgg_view('categories',$vars); -if (!empty($extras)) $extras = '<div class="SidebarBox">' .$cat .'<div class="ContentWrapper">'. $extras . '</div></div>'; - -?> +$publish_date_label = elgg_echo('blog:publish_date'); +$publish_date_input = elgg_view('input/datepicker', array( + 'internalname' => 'publish_date', + 'internalid' => 'blog_publish_date', + 'value' => $vars['publish_date'] +)); + +// hidden inputs +//$container_guid_input = elgg_view('input/hidden', array('internalname' => 'container_guid', 'value' => $values['container_guid'])); +$forward_input = elgg_view('input/hidden', array('internalname' => 'forward', 'value' => $forward)); + +$form_body = <<<___END +<p> + <label for="blog_title">$title_label</label> + $title_input +</p> + +<p> + <label for="blog_excerpt">$excerpt_label</label> +$excerpt_input +</p> + +<p> + <label for="blog_description">$body_label</label> + $body_input +</p> + +<p id="blog_save_status"> + $save_status:<span id="blog_save_status_time">$never</span> +</p> + +<p> + <label for="blog_publish_date">$publish_date_label</label> + $publish_date_input +</p> + + +<p> + <label for="blog_tags">$tags_label</label> + $tags_input +</p> + +<p> + <label for="blog_comments_on">$comments_label</label> + $comments_input +</p> + +<p> + <label for="blog_access_id">$access_label</label> + $access_input +</p> + + + +<p> + <label for="blog_status">$status_label</label> + $status_input +</p> + +$guid_input +$container_guid_input +$forward_input + +$action_buttons + +<span> + +___END; + +echo elgg_view('input/form', array( + 'internalname' => 'blog_post', + 'action' => "{$vars['url']}action/blog/save", + 'body' => $form_body +)); -<?php -//construct the form -$form_body = <<<EOT -<div id="LayoutCanvas_2ColumnRHS_Sidebar"> - {$ownerblock} - <div class="SidebarBox"> - <h3>{$publish}</h3> - - <div class="ContentWrapper"> - - <div class="blog_access"> - <p>{$privacy}: {$access_input}</p> - </div> - <div class="current_access">{$user_default_access}<br /><b>{$user_acl}</b></span></div> - </div> - - <div class="ContentWrapper"> - <div class="allow_comments"> - <label><input type="checkbox" name="comments_select" {$comments_on_switch} /> {$allowcomments}</label> - </div> - </div> - - <div class="ContentWrapper"> - - <div class="publish_blog"> - <div class="publish_controls"> - {$draftsaved}: <span id="draftSavedCounter">{$never}</span> - <a href="#" onclick="javascript:saveDraft(false);return false;">{$savedraft}</a> - </div> - - {$submit_input} - </div> - </div> - </div> - - {$extras} - {$container} -</div> - -<!-- main content --> -<div id="LayoutCanvas_2ColumnRHS_MainArea"> - - -<div id="Page_Header"> - <div class="Page_Header_Title"> - {$page_title} - </div> - - <div class="Page_Header_Options"> - - <a class="Action_Button" onclick="javascript:saveDraft(true);return true;">{$preview}</a> - {$deletepage} - </div><div class='clearfloat'></div> -</div> - - - - -<div class="ContentWrapper"> -EOT; - -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'> - $text_textarea - </p> - <div id='excerpt_editarea'> - <label>$excerpt_label</label><br />$excerpt_desc $excerpt_counter<br /> - $excerpt_textarea - </div> - <p><label>$tag_label</label><br />$tag_input</p> - <p>$entity_hidden</p> - $show_excerpt_field -</div> -</div> -<div class="clearfloat"></div> -EOT; - -//display the form -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; + setInterval("blogSaveDraft()", 60000); + + /* + * Attempt to save and update the input with the guid. + */ + function blogSaveDraftCallback(data, textStatus, XHR) { + if (textStatus == 'success' && data.success == true) { + var form = $('form[name=blog_post]'); + form.append('<input type="hidden" name="guid" value="' + data.guid + '" />'); - 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(); + $("#blog_save_status_time").html(d.getHours() + ":" + mins); + + } else { + $("#blog_save_status_time").html("<?php echo elgg_echo('error'); ?>"); + } + } + + function blogSaveDraft() { + if (typeof(tinyMCE) != 'undefined') { + tinyMCE.triggerSave(); + } + + // only save when content exists + var form = $('form[name=blog_post]'); + var title = form.children('input[name=title]').val(); + var description = form.children('textarea[name=description]').val(); + + if (!(title && description)) { + return false; + } + + var draftURL = "<?php echo $vars['url']; ?>action/blog/save?ajax=1"; + var postData = form.serializeArray(); + + // force draft status + $(postData).each(function(i, e) { + if (e.name == 'status') { + e.value = 'draft'; } }); - + + $.post(draftURL, postData, blogSaveDraftCallback, 'json'); + } - -</script> + + $(document).ready(function(){ + $('#excerpt.excerpt').each(function(){ + var allowed = 200; + + // set the initial value + $('#countervalue').text(allowed); + + // bind on key up event + $(this).keyup(function(){ + var counter_value = ((allowed - ($(this).val().length))); + + $("#countervalue").removeClass(); + + if ((counter_value > 10)) { + $("#countervalue").addClass("positive"); + } + else if ((counter_value <= 10) && (counter_value >= 0)) { + $("#countervalue").addClass("gettingclose"); + } + else if ((counter_value < 0)) { + $("#countervalue").addClass("negative"); + } + + // insert new length + $('#countervalue').text(counter_value); + + }); + }); + }); + +</script>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/gallery.php b/mod/blog/views/default/blog/gallery.php deleted file mode 100644 index 7fa05040e..000000000 --- a/mod/blog/views/default/blog/gallery.php +++ /dev/null @@ -1,21 +0,0 @@ -<?php
-
-/**
- * Elgg blog listing
- */
-$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/listing.php b/mod/blog/views/default/blog/listing.php deleted file mode 100644 index 7aae87b27..000000000 --- a/mod/blog/views/default/blog/listing.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php - -/** - * Elgg blog listing - */ - -$owner = $vars['entity']->getOwnerEntity(); -$friendlytime = sprintf(elgg_echo("blog:strapline"), - date("F j, Y",$vars['entity']->time_created) - ); -$tags = elgg_view('output/tags', array('tags' => $vars['entity']->tags)); -$num_comments = elgg_count_comments($vars['entity']); -$icon = elgg_view( - "profile/icon", array( - 'entity' => $owner, - 'size' => 'tiny', - ) - ); -//sort out the access level for display -$object_acl = get_readable_access_level($vars['entity']->access_id); -//files with these access level don't need an icon -$general_access = array('Public', 'Logged in users', 'Friends'); -//set the right class for access level display - need it to set on groups and shared access only -$check_is_group = get_entity($vars['entity']->container_guid); -if($check_is_group instanceof ElggGroup){ - //get the membership type open/closed - $membership = $check_is_group->membership; - //we decided to show that the item is in a group, rather than its actual access level - $object_acl = "Group: " . $is_group->name; - if($membership == 2) - $access_level = "class='group_open'"; - else - $access_level = "class='group_closed'"; -}elseif($object_acl == 'Private'){ - $access_level = "class='private'"; -}else{ - if(!in_array($object_acl, $general_access)) - $access_level = "class='shared_collection'"; - else - $access_level = "class='generic_access'"; -} -//display the access level - $info = "<div class='ItemMetaData'><table><tr>"; - - //$table_column_number = ""; -//include edit and delete options -if ($vars['entity']->canEdit()) { - $info .= "<td class='EditItem'><span class='EditItem'><a href=\"{$vars['url']}mod/blog/edit.php?blogpost={$vars['entity']->getGUID()}\">" . elgg_echo('edit') . "</a></span></td>"; - $info .= "<td class='DeleteItem'><div class='Delete_Button'>" . elgg_view('output/confirmlink',array('href' => $vars['url'] . "action/blog/delete?blogpost=" . $vars['entity']->getGUID(), 'text' => elgg_echo("delete"),'confirm' => elgg_echo("file:delete:confirm"),)). "</div></td>"; - //$table_column_number = " colspan='3' "; -} - - $info .= "<td class='FavouriteItem'>" . elgg_view("blogs/options",array('entity' => $vars['entity'])) ."</td>"; - -$info .= "</tr></table><div><span {$access_level}>" . $object_acl . "</span></div></div>"; - - -$info .= "<h2 class='blog_title'><a href=\"{$vars['entity']->getURL()}\">{$vars['entity']->title}</a></h2>"; -$info .= "<p class='owner_timestamp'><a href=\"{$vars['url']}pg/blog/{$owner->username}\">{$owner->name}</a> {$friendlytime}, "; -$info .= "<a href='{$vars['entity']->getURL()}'>" . sprintf(elgg_echo("comments")) . " (" . $num_comments . ")</a></p>"; -$info .= "<p class='blog_excerpt'>" . display_objects(strip_tags($vars['entity']->excerpt)) . "</p>"; - -echo elgg_view_listing($icon,$info); - diff --git a/mod/blog/views/default/blog/menu.php b/mod/blog/views/default/blog/menu.php deleted file mode 100644 index 15e67061c..000000000 --- a/mod/blog/views/default/blog/menu.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php
-/**
- * Elgg hoverover extender for blog
- */
-?>
-
- <li class="user_menu_blog">
- <a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $vars['entity']->username; ?>"><?php echo elgg_echo("blog"); ?></a>
- </li>
\ 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 2ef231b17..000000000 --- a/mod/blog/views/default/blog/notfound.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php
-/**
- * Elgg blog not found page
- */
-?>
-
- <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 da8fac2e5..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_menu.php b/mod/blog/views/default/blog/sidebar_menu.php new file mode 100644 index 000000000..74d69356b --- /dev/null +++ b/mod/blog/views/default/blog/sidebar_menu.php @@ -0,0 +1,42 @@ +<?php +/** + * Blog sidebar menu. + * + * @package Blog + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +// 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 = page_owner_entity(); + +if ($loggedin_user) { + +} + +?> + +<ul> +<li>Drafts</li> +</ul>
\ No newline at end of file diff --git a/mod/blog/views/default/blog/stats.php b/mod/blog/views/default/blog/stats.php deleted file mode 100644 index d5bfe5b8b..000000000 --- a/mod/blog/views/default/blog/stats.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php -/** - * All site blog stats - **/ - -$count_blogs = get_entities("object", "blog",0,"",10,0,true,0,null,0,0); -$count_blog_comments = count_annotations(0, "object", "blog","generic_comment"); - -echo "<div class='SidebarBox'>"; -echo "<h3>Blog stats</h3>"; -echo "<div class='ContentWrapper'>"; -echo $count_blogs . " blog posts written with " . $count_blog_comments . " comments."; -echo "</div></div>";
\ 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 a90f1775f..000000000 --- a/mod/blog/views/default/blog/view.php +++ /dev/null @@ -1,15 +0,0 @@ -<?php
-
-/**
- * Elgg blog view page
- * @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);
- }
-}else{
- echo elgg_echo('blog:none');
-}
\ 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 8a7cd52b8..7a40de67d 100644 --- a/mod/blog/views/default/object/blog.php +++ b/mod/blog/views/default/object/blog.php @@ -1,161 +1,106 @@ -<?php
-/**
- * Elgg blog individual post view
- */
-
-$page_owner = page_owner_entity();
-
-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") {
- //display the gallery view
- echo elgg_view("blog/gallery",$vars);
- } else {
- echo elgg_view("blog/listing",$vars);
- }
- } 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;
- }
-
-?>
-
-<div id="Page_Header">
- <div class="Page_Header_Title">
- <div id="content_area_user_title"><h2><?php echo $page_owner->name; ?>'s Blog</h2></div>
- </div>
-
- <div class="Page_Header_Options">
- <?php
- if ($vars['entity']->canEdit()) {
- ?>
- <a class="Action_Button" href="<?php echo $vars['url']; ?>mod/blog/edit.php?blogpost=<?php echo $vars['entity']->getGUID(); ?>"><?php echo elgg_echo('blog:editpost'); ?></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("blog:delete:confirm"),
- 'class' => "Action_Button Disabled",));
- }
- ?>
- </div><div class='clearfloat'></div>
-</div>
-
-<div class="ContentWrapper singleview">
- <div class="blog_post">
- <?php
- // Allow plugins to extend
- echo elgg_view("blogs/options",array('entity' => $vars['entity']));
- ?>
- <div id="content_area_user_title">
- <h2><a href="<?php echo $url; ?>"><?php echo $vars['entity']->title; ?></a></h2>
- </div>
- <!-- display the user icon -->
- <div class="blog_post_icon">
- <?php
- echo elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny'));
- ?>
- </div>
- <p class="strapline">
- <!-- username -->
- <a href="<?php echo $vars['url']; ?>pg/blog/<?php echo $owner->username; ?>"><?php echo $owner->name; ?></a>
-
- <?php
-
- echo sprintf(elgg_echo("blog:strapline"),
- date("F j, Y",$vars['entity']->time_created)
- );
-
- ?>
- <!-- 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>
- <?php
- }
- //sort out the access level for display
- $object_acl = get_readable_access_level($vars['entity']->access_id);
- //files with these access level don't need an icon
- $general_access = array('Public', 'Logged in users', 'Friends');
- //set the right class for access level display - need it to set on groups and shared access only
- $is_group = get_entity($vars['entity']->container_guid);
- if($is_group instanceof ElggGroup){
- //get the membership type open/closed
- $membership = $is_group->membership;
- if($membership == 2)
- $access_level = "class='group_open'";
- else
- $access_level = "class='group_closed'";
- }elseif($object_acl == 'Private'){
- $access_level = "class='private'";
- }else{
- if(!in_array($object_acl, $general_access))
- $access_level = "class='shared_collection'";
- else
- $access_level = "class='generic_access'";
- }
- echo "<br /><span {$access_level}>" . $object_acl . "</span>";
- ?>
- </p>
-
- <div class="clearfloat"></div>
- <div class="blog_post_body">
- <!-- display the actual blog post and excerpt if appropriate -->
- <?php
- if($vars['entity']->show_excerpt){
- //echo "<div class='show_excerpt'>";
- //echo elgg_view('output/longtext',array('value' => $vars['entity']->excerpt));
- //echo "</div>";
- }
- 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
- // Allow plugins to extend
- echo elgg_view("blogs/extend",array('entity' => $vars['entity']));
- ?>
- </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>
-</div>
-<?php
- }
-}else{
-
- echo "<div class='ContentWrapper singleview'>" . elgg_echo('blog:none') . "</div>";
+<?php +/** + * View for blog objects + * + * @package Blog + * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2 + * @author Curverider Ltd + * @copyright Curverider Ltd 2008-2010 + * @link http://elgg.org/ + */ + +$full = (isset($vars['full'])) ? $vars['full'] : FALSE; +$blog = (isset($vars['entity'])) ? $vars['entity'] : FALSE; + +if (!$blog) { + return ''; +} + +$owner = get_entity($blog->owner_guid); +$container = get_entity($blog->container_guid); +$linked_title = "<a href=\"{$blog->getURL()}\" title=\"" . htmlentities($blog->title) . "\">{$blog->title}</a>"; +$categories = elgg_view('categories/view', $vars); +$excerpt = $blog->excerpt; +$body = $blog->description; +$owner_icon = elgg_view("profile/icon",array('entity' => $owner, 'size' => 'tiny')); +$tags = elgg_view('output/tags', array('tags' => $blog->tags)); +$date = friendly_time($blog->time_created); + +if ($blog->comments_on == 'Yes') { + $comments_count = elgg_count_comments($blog); + $comments_link = "<a href=\"{$blog->getURL()}#annotations\">" . sprintf(elgg_echo("comments"), $comments_count) . '</a>'; +} else { + $comments_link = ''; +} + +// links to delete or edit. +if ($blog->canEdit()) { + $edit_url = "{$vars['url']}pg/blog/{$owner->username}/edit/{$blog->getGUID()}/"; + $edit_link = "<a class=\"action_button\" href=\"$edit_url\">" . elgg_echo('edit') . '</a>'; + + $delete_url = "{$vars['url']}action/blog/delete?guid={$blog->getGUID()}"; + $delete_link = elgg_view('output/confirmlink', array( + 'href' => $delete_url, + 'text' => elgg_echo('delete'), + 'class' => 'action_button' + )); + + $edit = "$edit_link $delete_link"; +} else { + $edit = ''; +} + +if ($full) { + // The "on" status changes for comments, so best to check for !Off + if ($blog->comments_on != 'Off') { + $comments = elgg_view_comments($blog); + } else { + $comments = ''; + } + + $owner_title = sprintf(elgg_echo('blog:owner_title'), $user->name); + +echo <<<___END +<div class="blog clearfloat"> + <h1>$owner_title</h2> + $edit + <h2 class="entity_title">{$blog->title}</h2> + <div class="blog entity_listing_icon"> + $owner_icon + </div> + <div class="entity_listing_info"> + <p class="entity_subtext"> + $date + $tags + $categories + $comments_link + </p> + <p class="blog body">$body</p> + </div> +</div> + +$comments + +___END; + +} else { + echo <<<___END +<div class="blog entity_listing clearfloat"> + <div class="entity_listing_icon"> + $owner_icon + </div> + <div class="entity_listing_info"> + $edit + <p class="entity_title">$linked_title</p> + <p class="entity_subtext"> + $date + $tags + $categories + $comments_link + </p> + <p>$excerpt</p> + </div> +</div> + +___END; }
\ No newline at end of file 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 deleted file mode 100644 index b5b3dc2e4..000000000 --- a/mod/blog/views/default/river/object/blog/create.php +++ /dev/null @@ -1,20 +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>"; - $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>"; -?> - -<?php echo $string; ?>
\ No newline at end of file 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 |