From 3838caed15ac73f81827829b6c094aae3c3f3539 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Wed, 4 Aug 2010 23:09:57 +0000 Subject: fixed bug where latest photos widget was trying to display 4 photos across instead of three - need a better long term solution --- lib/tidypics.php | 4 ++-- views/default/object/image.php | 2 +- views/default/tidypics/gallery.php | 8 ++++++-- views/default/widgets/latest_photos/view.php | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/tidypics.php b/lib/tidypics.php index 539db451a..20d3df81f 100644 --- a/lib/tidypics.php +++ b/lib/tidypics.php @@ -31,8 +31,8 @@ * Good luck */ -function tp_get_latest_photos($num_images, $owner_guid = 0) { - $prev_context = set_context('front'); +function tp_get_latest_photos($num_images, $owner_guid = 0, $context = 'front') { + $prev_context = set_context($context); $image_html = tp_list_entities('object', 'image', $owner_guid, null, $num_images, false, false, false); set_context($prev_context); return $image_html; diff --git a/views/default/object/image.php b/views/default/object/image.php index da3e257a1..8c1f23ec2 100644 --- a/views/default/object/image.php +++ b/views/default/object/image.php @@ -49,7 +49,7 @@ if (get_context() == "search") { * front page view * ****************************************************************/ -} else if (get_context() == "front") { +} else if (get_context() == "front" || get_context() == "widget") { // the front page view is a clickable thumbnail of the image ?> diff --git a/views/default/tidypics/gallery.php b/views/default/tidypics/gallery.php index 74aa34500..ba6f7b11d 100644 --- a/views/default/tidypics/gallery.php +++ b/views/default/tidypics/gallery.php @@ -4,8 +4,12 @@ * */ -// four albums across -$num_wide = 4; +if ($vars['context'] == 'widget') { + $num_wide = 3; +} else { + // four albums across + $num_wide = 4; +} $context = $vars['context']; $offset = $vars['offset']; diff --git a/views/default/widgets/latest_photos/view.php b/views/default/widgets/latest_photos/view.php index d6bc4a0df..108d070c9 100644 --- a/views/default/widgets/latest_photos/view.php +++ b/views/default/widgets/latest_photos/view.php @@ -9,7 +9,7 @@ if (!$number) { } echo '
'; -echo tp_get_latest_photos($number, page_owner()); +echo tp_get_latest_photos($number, page_owner(), 'widget'); echo '
'; ?> -- cgit v1.2.3