summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTekimaki <tekimaki_admin@users.sourceforge.net>2009-05-20 15:47:53 +0000
committerTekimaki <tekimaki_admin@users.sourceforge.net>2009-05-20 15:47:53 +0000
commitfa7a0c56c53d37ecb6fb804139b33120d33780bd (patch)
treef36118d3f633f611d65a63df74d943838adcf5b8
parent3fe9798c1f7d781af4f057435496d37535976c56 (diff)
downloadliberty-fa7a0c56c53d37ecb6fb804139b33120d33780bd.tar.gz
liberty-fa7a0c56c53d37ecb6fb804139b33120d33780bd.tar.bz2
liberty-fa7a0c56c53d37ecb6fb804139b33120d33780bd.zip
add new opt in join to pull primary attachment in lists - nothing in tpls yet, and need some feedback on mimetype flagging - hoping this is simpler and lighter than what seems like an earlier attempt at this
-rw-r--r--LibertyContent.php22
-rw-r--r--admin/admin_liberty_inc.php4
2 files changed, 25 insertions, 1 deletions
diff --git a/LibertyContent.php b/LibertyContent.php
index b42d444..cd9d821 100644
--- a/LibertyContent.php
+++ b/LibertyContent.php
@@ -3,7 +3,7 @@
* Management of Liberty content
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.402 2009/05/20 14:09:29 tekimaki_admin Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertyContent.php,v 1.403 2009/05/20 15:47:53 tekimaki_admin Exp $
* @author spider <spider@steelsun.com>
*/
@@ -2246,6 +2246,13 @@ class LibertyContent extends LibertyBase {
$selectSql .= ", lc.`data`, lc.`format_guid`";
}
+ // if we want the primary attachment for each object
+ if( $gBitSystem->isFeatureActive( 'liberty_display_primary_attach' ) ){
+ $selectSql .= ', lfp.storage_path AS `image_attachment_path`';
+ $joinSql .= "LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_attachments` la ON( la.`content_id` = lc.`content_id` AND la.`is_primary` = 'y' )
+ LEFT OUTER JOIN `".BIT_DB_PREFIX."liberty_files` lfp ON( lfp.`file_id` = la.`foreign_id` )";
+ }
+
// Allow selection based on arbitrary time limits -- used in calendar
// TODO: We should replace usages of from_date and until_date with this generic setup and depricate those
if( !empty( $pListHash['time_limit_column'] )) {
@@ -2458,7 +2465,20 @@ class LibertyContent extends LibertyBase {
$aux['thumbnail_url'] = $aux['content_object']->getThumbnailUrl( $pListHash['thumbnail_size'] );
}
}
+
}
+
+ /**
+ * @TODO standardize use of thumbnail_url and provision for hash of thumbnail sizes
+ *
+ * We have a bit of a mess with the use of thumbnail_url where sometimes it is a hash of sizes, and sometimes it is a single size
+ * we should standardize the param and what kind of value it returns, and if we need both types then have two params.
+ * This ultimately might need to be more sophisticated to deal with different mime types.
+ **/
+ if( $gBitSystem->isFeatureActive( 'liberty_display_primary_attach' ) ){
+ $aux['thumbnail_urls'] = liberty_fetch_thumbnails( array( "storage_path" => $aux['image_attachment_path'] ) );
+ }
+
$ret[] = $aux;
}
}
diff --git a/admin/admin_liberty_inc.php b/admin/admin_liberty_inc.php
index 00841be..7641b2e 100644
--- a/admin/admin_liberty_inc.php
+++ b/admin/admin_liberty_inc.php
@@ -66,6 +66,10 @@ $attachmentOptions = 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.',
),
+ 'liberty_display_primary_attach' => array(
+ 'label' => 'Display primary attachments in lists generated by Liberty (such as list_content.php)',
+ 'note' => 'This is a new feature in Beta, and will not display anything unless you have modified your templates to do so.',
+ ),
);
$gBitSmarty->assign( 'attachmentOptions', $attachmentOptions );