diff options
| -rw-r--r-- | admin/admin_blogs_inc.php | 6 | ||||
| -rw-r--r-- | display_bitblog_inc.php | 9 | ||||
| -rw-r--r-- | display_bitblogpost_inc.php | 59 | ||||
| -rw-r--r-- | recent_posts.php | 6 | ||||
| -rw-r--r-- | templates/blog_list_post.tpl | 7 | ||||
| -rw-r--r-- | templates/header_inc.tpl | 16 | ||||
| -rw-r--r-- | view.php | 5 |
7 files changed, 60 insertions, 48 deletions
diff --git a/admin/admin_blogs_inc.php b/admin/admin_blogs_inc.php index 8bdfd52..50cc7d4 100644 --- a/admin/admin_blogs_inc.php +++ b/admin/admin_blogs_inc.php @@ -1,5 +1,5 @@ <?php -// $Header: /cvsroot/bitweaver/_bit_blogs/admin/admin_blogs_inc.php,v 1.19 2007/07/27 11:40:19 wjames5 Exp $ +// $Header: /cvsroot/bitweaver/_bit_blogs/admin/admin_blogs_inc.php,v 1.20 2007/11/05 21:35:22 wjames5 Exp $ // get a list of blogs for the selection of the home blog require_once( BLOGS_PKG_PATH.'BitBlog.php' ); @@ -61,6 +61,10 @@ $formBlogFeatures = array( 'label' => 'Use 2 Text Fields To Auto Split Blog Posts', 'note' => 'Display two text fields when editing a post, for intro and read more sections. Disabling will display one text field and requires use of ...split... to create a read more section', ), + "blog_ajax_more" => array( + 'label' => 'Ajax Read More', + 'note' => 'Ajax the "read more" text inline into the short description lists of posts.', + ), ); $gBitSmarty->assign( 'formBlogFeatures',$formBlogFeatures ); diff --git a/display_bitblog_inc.php b/display_bitblog_inc.php index 19b3525..1e8f0f3 100644 --- a/display_bitblog_inc.php +++ b/display_bitblog_inc.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_blogs/display_bitblog_inc.php,v 1.11 2007/06/22 09:05:13 lsces Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_blogs/display_bitblog_inc.php,v 1.12 2007/11/05 21:35:22 wjames5 Exp $ * @package blogs * @subpackage functions * @@ -82,7 +82,10 @@ if( $gBitSystem->isFeatureActive( 'users_watches' ) ) { $gBitSmarty->assign('descriptionLength', $gBitSystem->getConfig( 'blog_posts_description_length', 500 ) ); $gBitSmarty->assign('showDescriptionsOnly', TRUE); + +if ( $gBitSystem->isFeatureActive( 'blog_ajax_more' ) ){ + $gBitThemes->loadAjax( 'mochikit' ); +} // Display the template $gBitSystem->display( 'bitpackage:blogs/view_blog.tpl', $gContent->getTitle() ); - -?> +?>
\ No newline at end of file diff --git a/display_bitblogpost_inc.php b/display_bitblogpost_inc.php index a932b1c..2eb6ea5 100644 --- a/display_bitblogpost_inc.php +++ b/display_bitblogpost_inc.php @@ -53,7 +53,6 @@ $gBitSystem->verifyPermission( 'p_blogs_view' ); // Check permissions to access this page if( !$gContent->isValid() ) { - $gBitSystem->setHttpStatus( 404 ); $gBitSystem->fatalError( tra( 'Post cannot be found' )); } @@ -61,47 +60,31 @@ $displayHash = array( 'perm_name' => 'p_blogs_view' ); $gContent->invokeServices( 'content_display_function', $displayHash ); $gBitSmarty->assign('post_id', $gContent->mPostId); - //Build absolute URI for this -$parts = parse_url($_SERVER['REQUEST_URI']); -/* DEPRECATED - these prolly need to be a larger array of any blog_ids -$uri = httpPrefix(). $parts['path'] . '?blog_id=' . $gContent->mInfo['blog_id'] . '&post_id=' . $gContent->mPostId; -$uri2 = httpPrefix(). $parts['path'] . '/' . $gContent->mInfo['blog_id'] . '/' . $gContent->mPostId; -$gBitSmarty->assign('uri', $uri); -$gBitSmarty->assign('uri2', $uri2); -*/ - -/* MOVE THIS - this looks like it should be part of browsing a blog not a post -wjames5 -if (!isset($_REQUEST['offset'])) - $_REQUEST['offset'] = 0; - -if (!isset($_REQUEST['sort_mode'])) - $_REQUEST['sort_mode'] = 'created_desc'; - -if (!isset($_REQUEST['find'])) - $_REQUEST['find'] = ''; - -$gBitSmarty->assign('offset', $_REQUEST["offset"]); -$gBitSmarty->assign('sort_mode', $_REQUEST["sort_mode"]); -$gBitSmarty->assign('find', $_REQUEST["find"]); -$offset = $_REQUEST["offset"]; -$sort_mode = $_REQUEST["sort_mode"]; -$find = $_REQUEST["find"]; -*/ +if ( empty( $_REQUEST['format'] ) || $_REQUEST['format'] == "full" ){ + $parts = parse_url($_SERVER['REQUEST_URI']); + $parsed_data = $gContent->parseData(); + if ($gBitSystem->isFeatureActive( 'blog_posts_comments' ) ) { + $comments_return_url = $_SERVER['PHP_SELF']."?post_id=".$gContent->mPostId; + $commentsParentId = $gContent->mContentId; + include_once ( LIBERTY_PKG_PATH.'comments_inc.php' ); + } + $extendedTitle = isset($gContent->mInfo['blogtitle']) ? ' - '.$gContent->mInfo['blogtitle'] : NULL; + $gBitSystem->setBrowserTitle($gContent->mInfo['title'].$extendedTitle); +}else{ + // if the format requested is not the full post or the readmore data we default to just the first half of the post + $data = ( $_REQUEST['format'] != "more" )?$gContent->mInfo['raw']:$gContent->mInfo['raw_more']; + $data = preg_replace( LIBERTY_SPLIT_REGEX, "", $data); + $parsed_data = $gContent->parseData( $data, ($gContent->getField('format_guid') ? $gContent->getField('format_guid') : 'tikiwiki') ); +} -$parsed_data = $gContent->parseData(); $gBitSmarty->assign('parsed_data', $parsed_data); $gBitSmarty->assign('post_info', $gContent->mInfo ); -if ($gBitSystem->isFeatureActive( 'blog_posts_comments' ) ) { - $comments_return_url = $_SERVER['PHP_SELF']."?post_id=".$gContent->mPostId; - $commentsParentId = $gContent->mContentId; - include_once ( LIBERTY_PKG_PATH.'comments_inc.php' ); -} - -$extendedTitle = isset($gContent->mInfo['blogtitle']) ? ' - '.$gContent->mInfo['blogtitle'] : NULL; -$gBitSystem->setBrowserTitle($gContent->mInfo['title'].$extendedTitle); // Display the template -$gBitSystem->display( 'bitpackage:blogs/view_blog_post.tpl'); - +if ( isset( $_REQUEST['output'] ) && $_REQUEST['output']="ajax"){ + $gBitSystem->display( 'bitpackage:blogs/view_blog_post_xml.tpl', NULL, 'center_only'); +}else{ + $gBitSystem->display( 'bitpackage:blogs/view_blog_post.tpl' ); +} ?> diff --git a/recent_posts.php b/recent_posts.php index 73f9024..62bafad 100644 --- a/recent_posts.php +++ b/recent_posts.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_blogs/recent_posts.php,v 1.5 2007/11/03 20:29:20 wjames5 Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_blogs/recent_posts.php,v 1.6 2007/11/05 21:35:22 wjames5 Exp $ * * @package blogs * @subpackage functions @@ -17,6 +17,10 @@ $gBitSystem->verifyPackage( 'blogs' ); // Now check permissions to access this page $gBitSystem->verifyPermission( 'p_blogs_view' ); +if ( $gBitSystem->isFeatureActive( 'blog_ajax_more' ) ){ + $gBitThemes->loadAjax( 'mochikit' ); +} + // Display the template $gDefaultCenter = 'bitpackage:blogs/center_list_blog_posts.tpl'; $gBitSmarty->assign_by_ref( 'gDefaultCenter', $gDefaultCenter ); diff --git a/templates/blog_list_post.tpl b/templates/blog_list_post.tpl index aa74287..dc79565 100644 --- a/templates/blog_list_post.tpl +++ b/templates/blog_list_post.tpl @@ -52,6 +52,7 @@ {include file="bitpackage:liberty/services_inc.tpl" serviceLocation='body' serviceHash=$aPost} {if $showDescriptionsOnly} {$aPost.summary|default:$aPost.parsed_description} + {if $gBitSystem->isFeatureActive( 'blog_ajax_more' )}<div id="post_more_{$aPost.post_id}"></div>{/if} {else} {$aPost.parsed_data} {/if} @@ -70,7 +71,11 @@ {if $showDescriptionsOnly and $aPost.has_more} {if $spacer} • {/if} {assign var=spacer value=TRUE} - <a class="more" href="{$aPost.display_url}">{tr}Read More…{/tr}</a> + {if $gBitSystem->isFeatureActive( 'blog_ajax_more' )} + <a href="javascript:void(0);" onclick="BitAjax.updater( 'post_more_{$aPost.post_id}', '{$smarty.const.BLOGS_PKG_URL}view_post.php', 'blog_id={$aPost.blog_id}&post_id={$aPost.post_id}&format=more&output=ajax' )">{tr}Read More{/tr}</a> + {else} + <a class="more" href="{$aPost.display_url}">{tr}Read More…{/tr}</a> + {/if} {/if} {if $aPost.trackbacks_from_count}({tr}referenced by{/tr}: {$aPost.trackbacks_from_count} {tr}posts{/tr} / {tr}references{/tr}: {$aPost.trackbacks_to_count} {tr}posts{/tr}){/if} diff --git a/templates/header_inc.tpl b/templates/header_inc.tpl index 812b642..124681a 100644 --- a/templates/header_inc.tpl +++ b/templates/header_inc.tpl @@ -1,6 +1,20 @@ -{* $Header: /cvsroot/bitweaver/_bit_blogs/templates/header_inc.tpl,v 1.7 2006/12/10 15:15:09 squareing Exp $ *} +{* $Header: /cvsroot/bitweaver/_bit_blogs/templates/header_inc.tpl,v 1.8 2007/11/05 21:35:22 wjames5 Exp $ *} {strip} {if $gBitSystem->isPackageActive( 'rss' ) and $gBitSystem->isFeatureActive( 'blogs_rss' ) and $smarty.const.ACTIVE_PACKAGE eq 'blogs' and $gBitUser->hasPermission( 'p_blogs_view' )} <link rel="alternate" type="application/rss+xml" title="{$gBitSystem->getConfig('blogs_rss_title',"{tr}Blogs{/tr} RSS")}" href="{$smarty.const.BLOGS_PKG_URL}blogs_rss.php?version={$gBitSystem->getConfig('rssfeed_default_version',0)}" /> {/if} +{* this is for ajaxing the readmore portion of blog posts. + * this is ugly, but because recent posts are handled by dynamic center outside of the blog package we have + * no way to assign the appropriate ajax library needs the propery way - so we force it here. + * + * this is configured for using center_list_blog_posts in the user pkg, as this is a common configuration, + * but it can be used in other pkgs, like wiki for example. Expand this set of conditionals as + * needed for your site configuation by creating a custom version of this tpl in your theme. Target the + * conditionals to the pkg you are including center_list_blog_posts in. + *} +{if $gBitSystem->isFeatureActive( 'blog_ajax_more' ) && !$gBitThemes->isAjaxLib('mochikit') && ( $smarty.const.ACTIVE_PACKAGE == "users" && $gQueryUserId ) } + <script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/MochiKitBitAjax.js"></script> + <script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/libs/MochiKit/Base.js"></script> + <script type="text/javascript" src="{$smarty.const.UTIL_PKG_URL}javascript/libs/MochiKit/Async.js"></script> +{/if} {/strip} @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_blogs/view.php,v 1.20 2006/11/18 21:43:16 spiderr Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_blogs/view.php,v 1.21 2007/11/05 21:35:22 wjames5 Exp $ * @package blogs * @subpackage functions @@ -16,5 +16,4 @@ require_once( '../bit_setup_inc.php' ); include_once( BLOGS_PKG_PATH.'display_bitblog_inc.php' ); - -?> +?>
\ No newline at end of file |
