summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--feed_lib.php18
-rw-r--r--modules/mod_status.php4
-rw-r--r--modules/mod_status.tpl51
3 files changed, 64 insertions, 9 deletions
diff --git a/feed_lib.php b/feed_lib.php
index 302d4ca..77b78e4 100644
--- a/feed_lib.php
+++ b/feed_lib.php
@@ -108,12 +108,26 @@ function feed_get_status( $pListHash ){
$replyUser->load();
$replyAvatarUrl = $replyUser->getThumbnailUrl();
if(empty($replyAvatarUrl)){
- $replyAvatarUrl = USERS_PKG_URI."users/icons/silhouette.png";
+ $replyAvatarUrl = USERS_PKG_URI."icons/silhouette.png";
}
$reply['feed_icon_url'] = $replyAvatarUrl;
}
-
+ //after loading up the thumbnails in the prior array layout for ease, we break up the array to split long comment threads
+ $MAX_SHOWN_REPLIES = 3;
+ if ( count( $status['replies'] ) > $MAX_SHOWN_REPLIES ){
+ $maxIteration = count( $status['replies'] ) - $MAX_SHOWN_REPLIES;
+ $i = 0;
+ foreach( $status['replies'] as $excess ){
+ if($i < $maxIteration){
+ $status['replies_excess'][$excess['content_id']] = $excess; //use content_id to index for consistency with normal replies array
+ unset($status['replies'][$excess['content_id']]); //remove from the normal replies array
+ }else{
+ break;
+ }
+ $i++;
+ }
+ }
$statuses[] = $status;
}
diff --git a/modules/mod_status.php b/modules/mod_status.php
index f115bbb..fd6271e 100644
--- a/modules/mod_status.php
+++ b/modules/mod_status.php
@@ -15,7 +15,10 @@ if( !empty( $moduleParams['module_params']['no_link_user'] ) ) {
}
if( !empty( $moduleParams['module_rows'] ) ) {
$listHash['max_records'] = $moduleParams['module_rows'];
+}elseif (!empty($moduleParams['module_params']['max_records'])){
+ $listHash['max_records'] = $moduleParams['module_params']['max_records'];
}
+
if( !empty( $moduleParams['module_params']['user_id'] ) ){
$listHash['user_id'] = $moduleParams['module_params']['user_id'];
}else{
@@ -23,7 +26,6 @@ if( !empty( $moduleParams['module_params']['user_id'] ) ){
}
$statuses = feed_get_status( $listHash );
-
$gBitSmarty->assign( 'statuses', $statuses);
foreach ($statuses as $status){
diff --git a/modules/mod_status.tpl b/modules/mod_status.tpl
index 0e8efde..3e1afc4 100644
--- a/modules/mod_status.tpl
+++ b/modules/mod_status.tpl
@@ -1,7 +1,31 @@
-<form>
- <input type="text" name="feed_status"/>
- <input type="submit"/>
-</form>
+{literal}
+<script type="text/javascript">
+
+function showHideReplies( contentId , total , feedback ){
+
+var hidden = document.getElementById('hidden_'+contentId);
+
+if( hidden.style.display == 'none' ){
+ hidden.style.display = 'block';
+ feedback.innerHTML = 'Hide '+ total + ' replies';
+}else{
+ hidden.style.display = 'none';
+ feedback.innerHTML = 'Show '+ total + ' replies';
+}
+
+}
+
+</script>
+
+{/literal}
+
+
+{if $gBitUser->mUserId == $statuses.0.user_id}
+ <form>
+ <input type="text" name="feed_status"/>
+ <input type="submit"/>
+ </form>
+{/if}
{foreach from=$statuses item='status'}
<div style="margin-top:25px;clear:both;">
@@ -10,8 +34,23 @@
{displayname hash=$status} {$status.data} <br/>
<small>{$status.last_modified|date_format}</small>
<div>
+ {if !empty($status.replies_excess) }
+ {* loop through all but the ones we want to be actually visible and place them in a collapsed div*}
+ <div id="hidden_{$status.content_id}" style="display:none;">
+ {foreach from = $status.replies_excess item='reply'}
+ <div style="margin-top:10px;background-color:#eee;">
+ {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>
+ <a onclick="showHideReplies( {$status.content_id}, {$status.replies_excess|@count}, this );">Show {$status.replies_excess|@count} replies</a>
+ {/if}
{foreach from = $status.replies item='reply'}
- <div style="margin-top:10px;">
+ <div style="margin-top:10px;background-color:#eee;">
{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/>
@@ -21,7 +60,7 @@
{/foreach}
</div>
<form>
- <input type="text" name="comment_{$status.content_id}"/>
+ <input type="text" value="write something..." onclick="this.value='';" name="comment_{$status.content_id}"/>
<input style="width:25px;height:20px;" value="go" type="submit"/>
</form>
</div>