summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FeedStatus.php51
-rw-r--r--modules/mod_status.php52
-rw-r--r--modules/mod_status.tpl29
3 files changed, 132 insertions, 0 deletions
diff --git a/FeedStatus.php b/FeedStatus.php
new file mode 100644
index 0000000..8cbb28a
--- /dev/null
+++ b/FeedStatus.php
@@ -0,0 +1,51 @@
+<?php
+
+require_once( LIBERTY_PKG_PATH.'LibertyComment.php' );
+require_once( USERS_PKG_PATH.'BitUser.php');
+
+define( 'FEEDSTATUS_CONTENT_TYPE_GUID','feedstatus');
+
+class FeedStatus extends LibertyComment {
+
+ /**
+ * During initialisation, be sure to call our base constructors
+ **/
+ function FeedStatus($pCommentId = NULL, $pContentId = NULL, $pInfo = NULL) {
+
+ LibertyComment::LibertyComment($pCommentId,$pContentId,$pInfo);
+
+/* // Permission setup
+ $this->mViewContentPerm = 'p_boards_read';
+ $this->mUpdateContentPerm = 'p_boards_post_update';
+ $this->mAdminContentPerm = 'p_boards_admin';
+*/
+
+ $this->mContentTypeGuid = FEEDSTATUS_CONTENT_TYPE_GUID;
+ $this->registerContentType( FEEDSTATUS_CONTENT_TYPE_GUID, array(
+ 'content_type_guid' => FEEDSTATUS_CONTENT_TYPE_GUID,
+ 'content_description' => 'Feed Status',
+ 'handler_class' => 'FeedStatus',
+ 'handler_package' => 'feed',
+ 'handler_file' => 'FeedStatus.php',
+ 'maintainer_url' => 'http://www.bitweaver.org'
+ ) );
+/*
+ $this->mViewContentPerm = 'p_loc_view';
+ $this->mCreateContentPerm = 'p_loc_edit';
+ $this->mUpdateContentPerm = 'p_loc_edit';
+ $this->mAdminContentPerm = 'p_loc_admin';
+*/
+ }
+
+ function getThumbnailUrl($pSize = 'avatar', $pInfoHash = NULL){
+ $rootUser = new BitUser(NULL,$this->mInfo['root_id']);
+ $rootUser->load();
+ $thumbnailUrl = $rootUser->getThumbnailUrl( $pSize );
+ if( empty ($thumbnailUrl) ){
+ $thumbnailUrl = USERS_PKG_URL.'icons/silhouette.png';
+ }
+ return $thumbnailUrl;
+ }
+
+}
+?>
diff --git a/modules/mod_status.php b/modules/mod_status.php
new file mode 100644
index 0000000..f115bbb
--- /dev/null
+++ b/modules/mod_status.php
@@ -0,0 +1,52 @@
+<?php
+
+global $gQueryUser,$gBitSmarty;
+
+require_once( FEED_PKG_PATH.'feed_lib.php' );
+
+if( !empty( $_REQUEST['feed_status'] ) ){
+
+ $pParamHash['status_message'] = $_REQUEST['feed_status'];
+ feed_set_status($pParamHash);
+}
+
+if( !empty( $moduleParams['module_params']['no_link_user'] ) ) {
+ $listHash['no_link_user'] = TRUE;
+}
+if( !empty( $moduleParams['module_rows'] ) ) {
+ $listHash['max_records'] = $moduleParams['module_rows'];
+}
+if( !empty( $moduleParams['module_params']['user_id'] ) ){
+ $listHash['user_id'] = $moduleParams['module_params']['user_id'];
+}else{
+ $listHash['user_id'] = $gQueryUser->mUserId;
+}
+
+$statuses = feed_get_status( $listHash );
+
+$gBitSmarty->assign( 'statuses', $statuses);
+
+foreach ($statuses as $status){
+
+ $commentContentId = 'comment_'.$status['content_id'];
+ if(!empty($_REQUEST[$commentContentId])){
+ //then there is a reply to this comment and break, we only handle one at a time
+ $reply = new LibertyComment();
+
+ $pParamHash['root_id'] = $status['content_id'];
+ $pParamHash['parent_id'] = $status['content_id'];
+
+ $pParamHash['comment_data'] = $_REQUEST[$commentContentId];
+ $pParamHash['title'] = substr($_REQUEST[$commentContentId],0,20);
+
+ $reply->storeComment($pParamHash);
+
+ $statuses = feed_get_status( $listHash );
+
+ $gBitSmarty->assign( 'statuses', $statuses);
+ break;
+ }
+}
+
+?>
+
diff --git a/modules/mod_status.tpl b/modules/mod_status.tpl
new file mode 100644
index 0000000..0e8efde
--- /dev/null
+++ b/modules/mod_status.tpl
@@ -0,0 +1,29 @@
+<form>
+ <input type="text" name="feed_status"/>
+ <input type="submit"/>
+</form>
+
+{foreach from=$statuses item='status'}
+ <div style="margin-top:25px;clear:both;">
+ {if $status.feed_icon_url}<img style="width:50px;height:50px;float:left;" src="{$status.feed_icon_url}" />{/if}
+ <div style="width:250px;float:right;vertical-align:top;">
+ {displayname hash=$status} {$status.data} <br/>
+ <small>{$status.last_modified|date_format}</small>
+ <div>
+ {foreach from = $status.replies item='reply'}
+ <div style="margin-top:10px;">
+ {if $reply.feed_icon_url} <img style="width:25px;height:25px;float:left;" src="{$reply.feed_icon_url}"/> {/if}
+ <div style="vertical-align:top;">
+ {displayname hash=$reply} {$reply.data} <br/>
+ <small>{$reply.last_modified|date_format}</small>
+ </div>
+ </div>
+ {/foreach}
+ </div>
+ <form>
+ <input type="text" name="comment_{$status.content_id}"/>
+ <input style="width:25px;height:20px;" value="go" type="submit"/>
+ </form>
+ </div>
+ </div>
+{/foreach}