summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChristian Fowler <spider@viovio.com>2005-06-28 07:45:43 +0000
committerChristian Fowler <spider@viovio.com>2005-06-28 07:45:43 +0000
commitbd10b08318a6c42661f584dee8cea4d06bd6b591 (patch)
treeb61b3cf499323b6c3e2705758117ea11508229a0 /modules
parent31cd95eaa1359a33a637cda2fd0bfe3068115a4e (diff)
downloadfisheye-bd10b08318a6c42661f584dee8cea4d06bd6b591.tar.gz
fisheye-bd10b08318a6c42661f584dee8cea4d06bd6b591.tar.bz2
fisheye-bd10b08318a6c42661f584dee8cea4d06bd6b591.zip
Merge recent changes from R1 into HEAD
Diffstat (limited to 'modules')
-rw-r--r--modules/help_mod_images.tpl7
-rw-r--r--modules/mod_images.php88
-rw-r--r--modules/mod_images.tpl6
3 files changed, 80 insertions, 21 deletions
diff --git a/modules/help_mod_images.tpl b/modules/help_mod_images.tpl
index b808de4..a47675c 100644
--- a/modules/help_mod_images.tpl
+++ b/modules/help_mod_images.tpl
@@ -1,4 +1,4 @@
-{tr}<strong>Summary</strong>: Display the most recently changed content.{/tr}<br />
+{tr}<strong>Summary</strong>: Display images from the fisheye gallery.{/tr}<br />
<table class="data">
<tr>
<th style="width:20%;">{tr}Parameter{/tr}</th>
@@ -25,4 +25,9 @@
<td>( {tr}numeric{/tr} )</td>
<td>{tr}Truncate the description to the specified number of letters.{/tr}</td>
</tr>
+ <tr class="odd">
+ <td>recent_users</td>
+ <td>( {tr}boolean{/tr} )</td>
+ <td>{tr}This will display the most recent image from the most recent users.{/tr}</td>
+ </tr>
</table>
diff --git a/modules/mod_images.php b/modules/mod_images.php
index 05ffb14..b937bb1 100644
--- a/modules/mod_images.php
+++ b/modules/mod_images.php
@@ -1,28 +1,82 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_fisheye/modules/mod_images.php,v 1.2 2005/06/21 18:17:51 squareing Exp $
-global $gQueryUserId, $module_rows, $module_params;
+/**
+ * @version $Header: /cvsroot/bitweaver/_bit_fisheye/modules/mod_images.php,v 1.3 2005/06/28 07:45:43 spiderr Exp $
+ * @package fisheye
+ * @subpackage modules
+ */
+global $gQueryUserId, $module_rows, $module_params, $gContent;
+
+/**
+ * required setup
+ */
require_once( FISHEYE_PKG_PATH.'FisheyeImage.php' );
$image = new FisheyeImage();
-$listHash = $module_params;
-$listHash['max_records'] = $module_rows;
-$listHash['user_id'] = $gQueryUserId;
+$display = TRUE;
-// this is needed to avoid wrong sort_modes entered resulting in db errors
-$sort_options = array( 'hits', 'created' );
-if( !empty( $module_params['sort_mode'] ) && in_array( $module_params['sort_mode'], $sort_options ) ) {
- $sort_mode = $module_params['sort_mode'].'_asc';
-} else {
- $sort_mode = 'random';
+$listHash = $module_params;
+if( !empty( $gContent ) && $gContent->mInfo['content_type_guid'] == FISHEYEGALLERY_CONTENT_TYPE_GUID ) {
+ $displayCount = empty( $gContent->mItems ) ? 0 : count( $gContent->mItems );
+ $thumbCount = $gContent->mInfo['rows_per_page'] * $gContent->mInfo["cols_per_page"];
+ $listHash['gallery_id'] = $_REQUEST['gallery_id'];
+ $display = $displayCount >= $thumbCount;
}
-$listHash['sort_mode'] = $sort_mode;
-$images = $image->getList( $listHash );
+if( $display ) {
+
+ $listHash['max_records'] = $module_rows;
+ if( $gQueryUserId ) {
+ $listHash['user_id'] = $gQueryUserId;
+ } elseif( !empty( $_REQUEST['user_id'] ) ) {
+ $listHash['user_id'] = $_REQUEST['user_id'];
+ } elseif( !empty( $module_params['recent_users'] ) ) {
+ $listHash['recent_users'] = TRUE;
+ }
+
+ // this is needed to avoid wrong sort_modes entered resulting in db errors
+ $sort_options = array( 'hits', 'created' );
+ if( !empty( $module_params['sort_mode'] ) && in_array( $module_params['sort_mode'], $sort_options ) ) {
+ $sort_mode = $module_params['sort_mode'].'_desc';
+ } else {
+ $sort_mode = 'random';
+ }
+ $listHash['sort_mode'] = $sort_mode;
-$smarty->assign( 'modImages', $images );
-$smarty->assign( 'module_params', $module_params );
-$smarty->assign( 'maxlen', isset( $module_params["maxlen"] ) ? $module_params["maxlen"] : 0 );
-$smarty->assign( 'maxlendesc', isset( $module_params["maxlendesc"] ) ? $module_params["maxlendesc"] : 0 );
+ $images = $image->getList( $listHash );
+
+ if( empty( $module_title ) && $images ) {
+ $moduleTitle = '';
+ if( !empty( $module_params['sort_mode'] ) ) {
+ if( $module_params['sort_mode'] == 'random' ) {
+ $moduleTitle = 'Random';
+ } elseif( $module_params['sort_mode'] == 'created' ) {
+ $moduleTitle = 'Recent';
+ } elseif( $module_params['sort_mode'] == 'hits' ) {
+ $moduleTitle = 'Popular';
+ }
+ } else {
+ $moduleTitle = 'Recent';
+ }
+
+ $moduleTitle .= ' Images';
+ $moduleTitle = tra( $moduleTitle );
+
+ if( !empty( $listHash['user_id'] ) ) {
+ $moduleTitle .= ' '.tra('by').' '.BitUser::getDisplayName( TRUE, current( $images ) );
+ } elseif( !empty( $listHash['recent_users'] ) ) {
+ $moduleTitle .= ' '.tra( 'by' ).' <a href="'.USERS_PKG_URL.'">'.tra( 'New Users' ).'</a>';
+ }
+
+ $listHash['sort_mode'] = $sort_mode;
+ $smarty->assign( 'moduleTitle', $moduleTitle );
+ }
+
+ $smarty->assign( 'imageSort', $sort_mode );
+ $smarty->assign( 'modImages', $images );
+ $smarty->assign( 'module_params', $module_params );
+ $smarty->assign( 'maxlen', isset( $module_params["maxlen"] ) ? $module_params["maxlen"] : 0 );
+ $smarty->assign( 'maxlendesc', isset( $module_params["maxlendesc"] ) ? $module_params["maxlendesc"] : 0 );
+}
?>
diff --git a/modules/mod_images.tpl b/modules/mod_images.tpl
index a8adc95..8f27a37 100644
--- a/modules/mod_images.tpl
+++ b/modules/mod_images.tpl
@@ -1,12 +1,12 @@
-{* $Header: /cvsroot/bitweaver/_bit_fisheye/modules/mod_images.tpl,v 1.1 2005/06/21 10:24:40 squareing Exp $ *}
+{* $Header: /cvsroot/bitweaver/_bit_fisheye/modules/mod_images.tpl,v 1.2 2005/06/28 07:45:43 spiderr Exp $ *}
{strip}
-{if $gBitSystem->isPackageActive( 'fisheye' )}
+{if $gBitSystem->isPackageActive( 'fisheye' ) && $modImages}
{bitmodule title="$moduleTitle" name="fisheye_images"}
<ul class="data">
{foreach from=$modImages item=modImg}
<li class="{cycle values='odd,even'} item">
<a href="{$modImg.display_url}" title="{$modImg.title} - {$modImg.last_modified|bit_short_datetime}, by {displayname user=$modImg.modifier_user real_name=$modImg.modifier_real_name nolink=1}{if (strlen($modImg.title) > $maxlen) AND ($maxlen > 0)}, {$modImg.title}{/if}">
- <img src="{$modImg.thumbnail_url}" />
+ <img src="{$modImg.thumbnail_url}" title="{$modImg.title}" alt="{$modImg.title}" />
{if !$modImg.has_machine_name}
<br />