summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwjames5 <will@tekimaki.com>2009-03-17 20:23:21 +0000
committerwjames5 <will@tekimaki.com>2009-03-17 20:23:21 +0000
commit9f81375d86b32bf88bc3b836b6222ace914f8297 (patch)
tree194c40a92f61bc0c1c426640e72d4dc96c1a861e
parenta5e4c1f684379b8371cb88babe221f89be7c93d4 (diff)
downloadliberty-9f81375d86b32bf88bc3b836b6222ace914f8297.tar.gz
liberty-9f81375d86b32bf88bc3b836b6222ace914f8297.tar.bz2
liberty-9f81375d86b32bf88bc3b836b6222ace914f8297.zip
upgrade Comments to LiberytMime to support attaching files to comments. big move also of comment storage hash verification into LComm::verifyComment, everything else is support. new liberty admin option to enabled attachments on comments. boards and tickters verification bits move into verification services
-rw-r--r--LibertyComment.php76
-rw-r--r--admin/admin_liberty_inc.php9
-rw-r--r--comments_inc.php127
-rw-r--r--templates/admin_liberty.tpl10
-rw-r--r--templates/comments_post_inc.tpl13
-rw-r--r--templates/display_comment.tpl3
-rw-r--r--templates/list_comment_files_inc.tpl45
7 files changed, 187 insertions, 96 deletions
diff --git a/LibertyComment.php b/LibertyComment.php
index 1188c35..cce5cee 100644
--- a/LibertyComment.php
+++ b/LibertyComment.php
@@ -3,14 +3,15 @@
* Management of Liberty Content
*
* @package liberty
- * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyComment.php,v 1.76 2009/02/06 20:04:40 tekimaki_admin Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyComment.php,v 1.77 2009/03/17 20:23:21 wjames5 Exp $
* @author spider <spider@steelsun.com>
*/
/**
* required setup
*/
-require_once( LIBERTY_PKG_PATH.'LibertyContent.php' );
+require_once( LIBERTY_PKG_PATH.'LibertyMime.php' );
+require_once( LIBERTY_PKG_PATH.'LibertyMime.php');
define( 'BITCOMMENT_CONTENT_TYPE_GUID', 'bitcomment' );
@@ -20,11 +21,11 @@ define( 'BITCOMMENT_CONTENT_TYPE_GUID', 'bitcomment' );
*
* @package kernel
*/
-class LibertyComment extends LibertyContent {
+class LibertyComment extends LibertyMime {
var $mCommentId;
function LibertyComment($pCommentId = NULL, $pContentId = NULL, $pInfo = NULL) {
- LibertyContent::LibertyContent();
+ LibertyMime::LibertyMime();
$this->registerContentType( BITCOMMENT_CONTENT_TYPE_GUID, array(
'content_type_guid' => BITCOMMENT_CONTENT_TYPE_GUID,
'content_description' => 'Comment',
@@ -78,13 +79,27 @@ class LibertyComment extends LibertyContent {
function verifyComment(&$pParamHash) {
global $gBitUser, $gBitSystem;
- if (!$pParamHash['parent_id']) {
- $this->mErrors['parent_id'] = "Missing parent id for comment";
+ /* should be unnecessary
+ if( !empty( $_REQUEST['format_guid'] )) {
+ $storeRow['format_guid'] = $_REQUEST['format_guid'];
+ }
+ */
+
+ $pParamHash['content_id'] = (@BitBase::verifyId($this->mContentId) ? $this->mContentId : NULL);
+
+ if( !empty( $pParamHash['comments_parent_id'] ) ) {
+ $pParamHash['root_id'] = $pParamHash['comments_parent_id'];
}
if (!$pParamHash['root_id']) {
$this->mErrors['root_id'] = "Missing root id for comment";
}
+
+ $pParamHash['parent_id'] = (@BitBase::verifyId($this->mInfo['parent_id']) ? $this->mInfo['parent_id'] : (!@BitBase::verifyId($pParamHash['post_comment_reply_id']) ? $pParamHash['comments_parent_id'] : $pParamHash['post_comment_reply_id']));
+
+ if (!$pParamHash['parent_id']) {
+ $this->mErrors['parent_id'] = "Missing parent id for comment";
+ }
if (empty($pParamHash['anon_name'])) {
$pParamHash['anon_name']=null;
@@ -94,6 +109,14 @@ class LibertyComment extends LibertyContent {
$this->mErrors['store'] = tra( 'Incorrect validation code' );
}
+ if( !empty( $pParamHash['comment_title'] ) ){
+ $pParamHash['title'] = $pParamHash['comment_title'];
+ }
+
+ if( !empty( $pParamHash['comment_data'] ) ){
+ $pParamHash['edit'] = $pParamHash['comment_data'];
+ }
+
if( empty( $pParamHash['edit'] ) ) {
$this->mErrors['store'] = tra( 'Your comment was empty.' );
} elseif( !$gBitUser->hasPermission( 'p_liberty_trusted_editor' ) && ($linkCount = preg_match_all( '/http\:\/\//', $pParamHash['edit'], $links )) > $gBitSystem->getConfig( 'liberty_unstrusted_max_http_in_content', 0 ) ) {
@@ -106,13 +129,26 @@ class LibertyComment extends LibertyContent {
}
}
}
+
+ // verify attachments are allowed on comments
+ if( ( isset( $pParamHash['_files_override'] ) || !empty( $_FILES ) ) && !$gBitSystem->isFeatureActive( 'comments_allow_attachments' ) ) {
+ $this->mErrors['comment_attachments'] = tra( 'Files can not be uploaded with comments.' );
+ }
+
+ // if we have an error we get them all by checking parent classes for additional errors
+ if( count( $this->mErrors ) > 0 ){
+ parent::verify( $pParamHash );
+ }
+
return (count($this->mErrors) == 0);
}
function storeComment( &$pParamHash ) {
$pParamHash['content_type_guid'] = BITCOMMENT_CONTENT_TYPE_GUID;
+
+ $this->mDb->StartTrans();
if (!$this->mCommentId) {
- if( $this->verifyComment($pParamHash) && LibertyContent::store( $pParamHash ) ) {
+ if( $this->verifyComment($pParamHash) && LibertyMime::store( $pParamHash ) ) {
$this->mCommentId = $this->mDb->GenID( 'liberty_comment_id_seq');
@@ -145,7 +181,7 @@ class LibertyComment extends LibertyContent {
$this->mContentId = $pParamHash['content_id'];
}
} else {
- if( $this->verifyComment($pParamHash) && LibertyContent::store($pParamHash) ) {
+ if( $this->verifyComment($pParamHash) && LibertyMime::store($pParamHash) ) {
$sql = "UPDATE `".BIT_DB_PREFIX."liberty_comments` SET `parent_id` = ?, `content_id`= ? WHERE `comment_id` = ?";
$this->mDb->query($sql, array($pParamHash['parent_id'], $pParamHash['content_id'], $this->mCommentId));
$this->mInfo['parent_id'] = $pParamHash['parent_id'];
@@ -156,6 +192,8 @@ class LibertyComment extends LibertyContent {
$this->invokeServices( 'comment_store_function', $pParamHash );
+ $this->mDb->CompleteTrans();
+
return (count($this->mErrors) == 0);
}
@@ -601,6 +639,28 @@ class LibertyComment extends LibertyContent {
$c->mInfo=$row;
$c->mRootObj = $this->getRootObj();
$row['editable'] = $c->userCanEdit();
+
+ global $gBitSystem;
+ if( $gBitSystem->isFeatureActive( 'comments_allow_attachments' ) ){
+ // get attachments for each comment
+ global $gLibertySystem;
+ $query = "SELECT * FROM `".BIT_DB_PREFIX."liberty_attachments` la WHERE la.`content_id`=? ORDER BY la.`pos` ASC, la.`attachment_id` ASC";
+ if( $result2 = $this->mDb->query( $query,array( (int)$row['content_id'] ))) {
+ while( $row2 = $result2->fetchRow() ) {
+ if( $func = $gLibertySystem->getPluginFunction( $row2['attachment_plugin_guid'], 'load_function', 'mime' )) {
+ // we will pass the preferences by reference that the plugin can easily update them
+ if( empty( $row['storage'][$row2['attachment_id']] )) {
+ $row['storage'][$row2['attachment_id']] = array();
+ }
+ $row['storage'][$row2['attachment_id']] = $func( $row2, $row['storage'][$row2['attachment_id']] );
+ } else {
+ print "No load_function for ".$row2['attachment_plugin_guid'];
+ }
+ }
+ }
+ // end get attachements for each comment
+ }
+
$flat_comments[$row['content_id']] = $row;
}
}
diff --git a/admin/admin_liberty_inc.php b/admin/admin_liberty_inc.php
index 20fc473..00841be 100644
--- a/admin/admin_liberty_inc.php
+++ b/admin/admin_liberty_inc.php
@@ -61,6 +61,13 @@ $attachmentStyleOptions = array(
);
$gBitSmarty->assign( 'attachmentStyleOptions', $attachmentStyleOptions );
+$attachmentOptions = array(
+ 'comments_allow_attachments' => array(
+ 'label' => 'Allow Attachments to Comments',
+ 'note' => 'Allow users with permission to upload file attachments to add them to comments. This is a new feature and can conflict with ajax attachments and ajax comments.',
+ ),
+);
+$gBitSmarty->assign( 'attachmentOptions', $attachmentOptions );
$imageProcessors = array(
'gd' => array(
@@ -161,7 +168,7 @@ $gBitSmarty->assign( 'imageSizes', get_image_size_options() );
$formValues = array( 'image_processor', 'liberty_attachment_link_format', 'comments_per_page', 'comments_default_ordering', 'comments_default_display_mode' );
if( !empty( $_REQUEST['change_prefs'] )) {
- $formFeatures = array_merge( $formLibertyFeatures, $formImageFeatures, $formCaptcha );
+ $formFeatures = array_merge( $formLibertyFeatures, $formImageFeatures, $formCaptcha, $attachmentOptions );
foreach( $formFeatures as $item => $data ) {
simple_set_toggle( $item, LIBERTY_PKG_NAME );
}
diff --git a/comments_inc.php b/comments_inc.php
index 545449d..5f741ed 100644
--- a/comments_inc.php
+++ b/comments_inc.php
@@ -3,12 +3,12 @@
* comment_inc
*
* @author spider <spider@steelsun.com>
- * @version $Revision: 1.59 $
+ * @version $Revision: 1.60 $
* @package liberty
* @subpackage functions
*/
-// $Header: /cvsroot/bitweaver/_bit_liberty/comments_inc.php,v 1.59 2009/03/12 18:44:27 wjames5 Exp $
+// $Header: /cvsroot/bitweaver/_bit_liberty/comments_inc.php,v 1.60 2009/03/17 20:23:21 wjames5 Exp $
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
@@ -41,15 +41,6 @@ require_once( LIBERTY_PKG_PATH.'LibertyComment.php' );
global $commentsLib, $gBitSmarty, $gBitSystem;
-// @TODO get this shit out of here - boards and any other package ridding on comments should make use of services
-if( $gBitSystem->isPackageActive( 'bitboards' )) {
- require_once(BITBOARDS_PKG_PATH.'BitBoardTopic.php');
-}
-// @TODO get this shit out of here - boards and any other package ridding on comments should make use of services
-if( $gBitSystem->isPackageActive( 'tickets' )) {
- require_once( TICKETS_PKG_PATH.'BitTicket.php' );
-}
-
$postComment = array();
$formfeedback = array( 'error' => array() );
$gBitSmarty->assign_by_ref( 'formfeedback', $formfeedback );
@@ -102,7 +93,7 @@ $gBitSmarty->assign('post_comment_id', $post_comment_id);
// Store comment posts
if( !empty( $_REQUEST['post_comment_submit'] ) && $gContent->hasUserPermission( 'p_liberty_post_comments', TRUE, TRUE )) {
- $storeRow = array();
+
// check for !anon_post before logging in (auto-fill can hork things up)
if( empty( $_REQUEST['anon_post'] ) && !empty( $_REQUEST['login_email'] ) && !empty( $_REQUEST['login_password'] ) ) {
$gBitUser->login( $_REQUEST['login_email'], $_REQUEST['login_password'] );
@@ -110,87 +101,42 @@ if( !empty( $_REQUEST['post_comment_submit'] ) && $gContent->hasUserPermission(
$formfeedback['error'][] = $gBitUser->mErrors['login'];
}
} else {
- if( !empty( $_REQUEST['captcha'] )) {
- $storeRow['captcha'] = $_REQUEST['captcha'];
- }
if( !empty($_REQUEST['comment_name'] )) {
- $storeRow['anon_name'] = $_REQUEST['comment_name'];
+ $_REQUEST['anon_name'] = $_REQUEST['comment_name'];
}
}
+
+ // this commentsParentId is some crazy ass business - lets prepare for the day when this can be removed
+ // there are references to it in LibertyComments::verifyComments as well
+ $_REQUEST['comments_parent_id'] = $commentsParentId;
$storeComment = new LibertyComment( @BitBase::verifyId( $editComment->mCommentId ) ? $editComment->mCommentId : NULL );
- $storeRow['title'] = $_REQUEST['comment_title'];
- $storeRow['edit'] = $_REQUEST['comment_data'];
- if( empty( $_REQUEST['post_comment_id'] ) && $gBitSystem->isPackageActive( 'bitboards' )) {
- $content_type = $gBitUser->getPreference( 'signature_content_type' );
- $content_data = $gBitUser->getPreference( 'signature_content_data' );
- if( !empty( $content_type ) && !empty( $content_data )) {
- $storeRow['edit'] .= "\n{renderer format_guid=$content_type class=mb-signature}$content_data{/renderer}";
+ if( empty( $formfeedback['error'] ) && $storeComment->storeComment( $_REQUEST )) {
+ // store successful
+ $storeComment->loadComment();
+ if( empty( $_REQUEST['post_comment_id'] ) && $gBitSystem->isPackageActive( 'switchboard' ) ) {
+ // A new comment, and we have switchboard to send notifications
+ global $gSwitchboardSystem;
+ // Draft the message:
+ $message['subject'] = tra( 'New comment on:' ).' '.$gContent->getTitle().' @ '.$gBitSystem->getConfig( 'site_title' );
+ $message['message'] = tra('A new message was posted to ').' '.$gContent->getTitle()."<br/>\n".$gContent->getDisplayUri()."<br/>\n"
+ .'/----- '.tra('Here is the message')." -----/<br/>\n<br/>\n".'<h2>'.$storeComment->getTitle()."</h2>\n".tra('By').' '.$gBitUser->getDisplayName()."\n<p>".$storeComment->parseData().'</p>';
+ $gSwitchboardSystem->sendEvent('My Content', 'new comment', $gContent->mContentId, $message );
}
- }
-
- $storeRow['root_id'] = $commentsParentId;
- $storeRow['parent_id'] = (@BitBase::verifyId($storeComment->mInfo['parent_id']) ? $storeComment->mInfo['parent_id'] : (!@BitBase::verifyId($_REQUEST['post_comment_reply_id']) ? $commentsParentId : $_REQUEST['post_comment_reply_id']));
- $storeRow['content_id'] = (@BitBase::verifyId($storeComment->mContentId) ? $storeComment->mContentId : NULL);
-
- if( !empty( $_REQUEST['format_guid'] )) {
- $storeRow['format_guid'] = $_REQUEST['format_guid'];
- }
-
- // @TODO get this shit out of here - boards and any other package ridding on comments should make use of services
- // seriously - this stuff right here can go in a verify service stop mucking up this file
- $ticketValid = TRUE;
- if( $gBitSystem->isPackageActive( 'tickets' )) {
- $ticketValid = $gContent->storeOnlyHeader( $_REQUEST['ticket'] );
- if( $ticketValid ) {
- $gContent->loadTicketHistory();
- $storeRow['edit'] = "{history id=".$_REQUEST['ticket']['historyIds'][0]."} ".$storeRow['edit'];
+ $postComment = NULL;
+ } else {
+ // store fails handle errors and preview
+ $formfeedback['error']=array_merge( $formfeedback['error'], $storeComment->mErrors );
+ $postComment['data'] = $_REQUEST['comment_data'];
+ $postComment['title'] = $_REQUEST['comment_title'];
+ if( !empty( $_REQUEST['comment_name'] ) ) {
+ $postComment['anon_name'] = $_REQUEST['comment_name'];
}
- }
-
- // @TODO get this shit out of here - boards and any other package ridding on comments should make use of services
- // this locked msg check can go in a verify service, no reason for it to be here
- if( !( $gBitSystem->isPackageActive( 'bitboards' ) && BitBoardTopic::isLockedMsg( $storeRow['parent_id'] ))) {
- $storeComment->mDb->StartTrans();
- if( empty( $formfeedback['error'] ) && $ticketValid && $storeComment->storeComment( $storeRow )) {
- $storeComment->loadComment();
- if( empty( $_REQUEST['post_comment_id'] ) && $gBitSystem->isPackageActive( 'switchboard' ) ) {
- // A new comment, and we have switchboard to send notifications
- global $gSwitchboardSystem;
- // Draft the message:
- $message['subject'] = tra( 'New comment on:' ).' '.$gContent->getTitle().' @ '.$gBitSystem->getConfig( 'site_title' );
- $message['message'] = tra('A new message was posted to ').' '.$gContent->getTitle()."<br/>\n".$gContent->getDisplayUri()."<br/>\n"
- .'/----- '.tra('Here is the message')." -----/<br/>\n<br/>\n".'<h2>'.$storeComment->getTitle()."</h2>\n".tra('By').' '.$gBitUser->getDisplayName()."\n<p>".$storeComment->parseData().'</p>';
- $gSwitchboardSystem->sendEvent('My Content', 'new comment', $gContent->mContentId, $message );
- }
- // @TODO get this shit out of here - boards and any other package ridding on comments should make use of services
- // this can go in a store service no reason to have it here
- if( $gBitSystem->isPackageActive('bitboards') && $gBitSystem->isFeatureActive( 'bitboards_thread_track' )) {
- $topic_id = substr( $storeComment->mInfo['thread_forward_sequence'], 0, 10 );
- $data = BitBoardTopic::getNotificationData($topic_id);
- foreach( $data['users'] as $login => $user ) {
- if( $data['topic']->mInfo['llc_last_modified'] > $user['track_date'] && $data['topic']->mInfo['llc_last_modified'] > $user['track_notify_date'] ) {
- $data['topic']->sendNotification( $user );
- }
- }
- }
- $postComment = NULL;
- } else {
- $formfeedback['error']=array_merge( $formfeedback['error'], $storeComment->mErrors );
- $postComment['data'] = $_REQUEST['comment_data'];
- $postComment['title'] = $_REQUEST['comment_title'];
- if( !empty( $_REQUEST['comment_name'] ) ) {
- $postComment['anon_name'] = $_REQUEST['comment_name'];
- }
- $_REQUEST['post_comment_request'] = TRUE;
- //this is critical and triggers other settings if store fails - do not remove without looking at what preview effects
- $_REQUEST['post_comment_preview'] = TRUE;
- }
- $storeComment->mDb->CompleteTrans();
- } else {
- $formfeedback['warning']="The selected Topic is Locked posting is disabled";
+ $_REQUEST['post_comment_request'] = TRUE;
+ //this is critical and triggers other settings if store fails - do not remove without looking at what preview effects
+ $_REQUEST['post_comment_preview'] = TRUE;
}
} elseif(!empty($_REQUEST['post_comment_request']) && !$gContent->hasUserPermission( 'p_liberty_post_comments', TRUE, TRUE )) {
$formfeedback['warning']="You don't have permission to post comments.";
@@ -201,6 +147,10 @@ if( empty( $_REQUEST['post_comment_request'] ) && !$gBitSystem->isFeatureActive(
$post_comment_request = NULL;
} elseif( $gContent->hasUserPermission( 'p_liberty_post_comments', TRUE, TRUE ) ) {
$post_comment_request = TRUE;
+ // force off ajax attachments which does not work for comments attachments
+ if( $gBitSystem->isFeatureActive( 'comments_allow_attachments' ) && $gBitSystem->getConfig( 'liberty_attachment_style') == 'ajax' ){
+ $gBitSystem->setConfig( 'liberty_attachment_style', 'standard' );
+ }
}
if( !empty( $_REQUEST['post_comment_request'] ) && $_REQUEST['post_comment_request'] == 'y' && !$gContent->hasUserPermission( 'p_liberty_post_comments', TRUE, TRUE ) ) {
@@ -389,9 +339,14 @@ $gBitSmarty->assign( 'textarea_id', 'commentpost' );
$gBitSmarty->assign( 'comments_count', $numComments );
// @TODO get this shit out of here - boards and any other package ridding on comments should make use of services
-// this clearly can go in an edit service.
+if( $gBitSystem->isPackageActive( 'boards' )) {
+ require_once(BOARDS_PKG_PATH.'BitBoardTopic.php');
+}
+
+// @TODO get this shit out of here - boards and any other package ridding on comments should make use of services
+// this clearly can go in an edit service, but need to be careful since comments currently does not call edit service - have to check what doing so might trigger.
if( !empty( $_REQUEST['post_comment_request'] )) {
- if( $gBitSystem->isPackageActive( 'bitboards' )
+ if( $gBitSystem->isPackageActive( 'boards' )
&& (
BitBoardTopic::isLockedMsg( @BitBase::verifyId( $storeComment->mInfo['parent_id'] )
? $storeComment->mInfo['parent_id'] : ( !@BitBase::verifyId( $_REQUEST['post_comment_reply_id'] )
diff --git a/templates/admin_liberty.tpl b/templates/admin_liberty.tpl
index 58052ec..ba35e51 100644
--- a/templates/admin_liberty.tpl
+++ b/templates/admin_liberty.tpl
@@ -28,6 +28,16 @@
{formhelp note=""}
{/forminput}
</div>
+
+ {foreach from=$attachmentOptions key=item item=output}
+ <div class="row">
+ {formlabel label=`$output.label` for=$item}
+ {forminput}
+ {html_checkboxes name="$item" values="y" checked=$gBitSystem->getConfig($item) labels=false id=$item}
+ {formhelp note=`$output.note` page=`$output.page`}
+ {/forminput}
+ </div>
+ {/foreach}
{/legend}
{legend legend="Miscellaneous"}
diff --git a/templates/comments_post_inc.tpl b/templates/comments_post_inc.tpl
index 13acd50..a9d0836 100644
--- a/templates/comments_post_inc.tpl
+++ b/templates/comments_post_inc.tpl
@@ -8,7 +8,7 @@
</div><!-- end .preview -->
{/if}
- {form action="`$comments_return_url`#editcomments" id="editcomment-form"}
+ {form enctype="multipart/form-data" action="`$comments_return_url`#editcomments" id="editcomment-form"}
{formfeedback hash=$formfeedback}
@@ -66,6 +66,17 @@
{textarea id="commentpost" name="comment_data" rows=$gBitSystem->getConfig('comments_default_post_lines', 6)}{$postComment.data}{/textarea}
+ {* @TODO perm check more accurately should be on root content object *}
+ {if $gBitSystem->isFeatureActive( 'comments_allow_attachments' ) && $gBitUser->hasPermission('p_liberty_attach_attachments') }
+ {* @TODO make edit_storage_list.tpl work with comments attachments - it is nested in edit_storage.tpl - for now bypass it, remove mime code when edit_storage.tpl can be used directly*}
+ {* include file="bitpackage:liberty/edit_storage.tpl" *}
+ {if $gLibertySystem->isPluginActive( $smarty.const.LIBERTY_DEFAULT_MIME_HANDLER )}
+ {foreach from=$gLibertySystem->getAllMimeTemplates('upload') item=tpl}
+ {include file=$tpl}
+ {/foreach}
+ {/if}
+ {/if}
+
<div class="row submit">
<input type="submit" name="post_comment_preview" value="{tr}Preview{/tr}" {if $comments_ajax}onclick="LibertyComment.previewComment(); return false;"{/if}/>&nbsp;
<input type="submit" name="post_comment_submit" value="{tr}Post{/tr}" {if $comments_ajax}onclick="LibertyComment.postComment(); return false;"{/if}/>&nbsp;
diff --git a/templates/display_comment.tpl b/templates/display_comment.tpl
index 40cc75f..1ad4bfb 100644
--- a/templates/display_comment.tpl
+++ b/templates/display_comment.tpl
@@ -32,6 +32,9 @@
<div class="content">
{include file="bitpackage:liberty/services_inc.tpl" serviceLocation='comment' serviceHash=$comment}
{$comment.parsed_data}
+ {if $gBitSystem->isFeatureActive( 'comments_allow_attachments' )}
+ {include file="bitpackage:liberty/list_comment_files_inc.tpl" storageHash=$comment.storage}
+ {/if}
</div>
</div><!-- end .post -->
diff --git a/templates/list_comment_files_inc.tpl b/templates/list_comment_files_inc.tpl
new file mode 100644
index 0000000..d928537
--- /dev/null
+++ b/templates/list_comment_files_inc.tpl
@@ -0,0 +1,45 @@
+{* $Header: /cvsroot/bitweaver/_bit_liberty/templates/list_comment_files_inc.tpl,v 1.1 2009/03/17 20:23:21 wjames5 Exp $ *}
+{strip}
+{if $storageHash}
+ <h4 class="table">
+ {if $storageHash|@count > 1}
+ {tr}Files{/tr}
+ {else}
+ {tr}File{/tr}
+ {/if}
+ </h4>
+
+ {if $errors}
+ {formfeedback warning=`$errors`}
+ {/if}
+
+ <table class="data">
+ <tr>
+ <th style="width:40%;">{tr}File{/tr}</th>
+ <th style="width:10%;">{tr}Type{/tr}</th>
+ <th style="width:10%;">{tr}Size{/tr}</th>
+ {* not really pertinent but here in case of some future need
+ <th style="width:20%;">{tr}Last Modified{/tr}</th>
+ *}
+ </tr>
+ {foreach from=$storageHash item=item key=id}
+ <tr class="{cycle values="odd,even"}" >
+ <td style="text-align:left;">
+ {jspopup notra=1 href="`$item.display_url`&popup=y" title=$item.filename|escape}
+ </td>
+ <td style="text-align:center;">
+ {$item.mime_type}
+ </td>
+ <td style="text-align:center;">
+ {$item.file_size|display_bytes}
+ </td>
+ {* not really pertinent but here in case of some future need
+ <td style="text-align:right;">
+ {$item.last_modified|bit_short_datetime}
+ </td>
+ *}
+ </tr>
+ {/foreach}
+ </table>
+{/if}
+{/strip}