[ansel] [patch] Gallery list/view layout enhancements
Brian Keifer
brian at valinor.net
Fri Oct 17 14:51:10 PDT 2003
This patch does two things:
1. Adds a pref to toggle the display of a gallery's default image in the
gallery list.
2. Reformats the gallery view to a grid layout (see my previous e-mail,
"Gallery details layout" for pretty pictures). A new pref is also introduced
to control the number of thumbnails per row.
-Brian
--
I live in the United States of America, where we are gradually coming to
understand that nothing we do is ever our fault, especially if it is really
stupid.
--Dave Barry, "The Tide is high and other household problems"
-------------- next part --------------
Index: config/prefs.php.dist
===================================================================
RCS file: /repository/ansel/config/prefs.php.dist,v
retrieving revision 1.8
diff -u -r1.8 prefs.php.dist
--- config/prefs.php.dist 15 Oct 2003 19:56:49 -0000 1.8
+++ config/prefs.php.dist 31 Dec 1999 15:23:02 -0000
@@ -12,13 +12,20 @@
'members' => array('language')
);
-$prefGroups['display'] = array(
+$prefGroups['sorting'] = array(
'column' => _("Other Options"),
'label' => _("Sort Options"),
'desc' => _("Change your gallery sorting options."),
'members' => array('sortby', 'sortdir')
);
+$prefGroups['display'] = array(
+ 'column' => _("Other Options"),
+ 'label' => _("Display Options"),
+ 'desc' => _("Change your display options."),
+ 'members' => array('showdefaultimages', 'imagesperrow')
+);
+
// user language
$_prefs['language'] = array(
@@ -59,4 +66,21 @@
'locked' => false,
'shared' => false,
'type' => 'implicit'
+);
+
+// number of images on each row in the gallery view
+$_prefs['imagesperrow'] = array(
+ 'value' => 3,
+ 'locked' => false,
+ 'shared' => false,
+ 'type' => 'number',
+ 'desc' => _("Number of images per row")
+);
+
+$_prefs['showdefaultimages'] = array(
+ 'value' => true,
+ 'locked' => false,
+ 'shared' => false,
+ 'type' => 'checkbox',
+ 'desc' => _("Show default images in the gallery list?")
);
Index: templates/list/gallery_headers.inc
===================================================================
RCS file: /repository/ansel/templates/list/gallery_headers.inc,v
retrieving revision 1.8
diff -u -r1.8 gallery_headers.inc
--- templates/list/gallery_headers.inc 16 Oct 2003 03:25:51 -0000 1.8
+++ templates/list/gallery_headers.inc 31 Dec 1999 15:23:02 -0000
@@ -13,4 +13,10 @@
<?php echo Horde::link(Horde::applicationUrl(Util::addParameter($sortbyurl, 'sortby', ANSEL_SORT_DESC)), _("Sort Direction"), 'widget') . Horde::img($prefs->getValue('sortdir') ? 'za.gif' : 'az.gif', _("Sort Direction"), '', $registry->getParam('graphics', 'horde')) ?></a>
<?php echo Horde::link(Horde::applicationUrl(Util::addParameter('list.php', 'sortby', ANSEL_SORT_DESC)), _("Sort by Description"), 'widget') . _("Description") ?></a>
</th>
+<?php if ($prefs->getValue('showdefaultimages')) { ?>
+ <th class="item" width="1%">
+
+ </th>
+<?php } ?>
+
</tr>
Index: templates/list/gallery_summaries.inc
===================================================================
RCS file: /repository/ansel/templates/list/gallery_summaries.inc,v
retrieving revision 1.11
diff -u -r1.11 gallery_summaries.inc
--- templates/list/gallery_summaries.inc 16 Oct 2003 03:25:51 -0000 1.11
+++ templates/list/gallery_summaries.inc 31 Dec 1999 15:23:02 -0000
@@ -6,4 +6,12 @@
<td>
<?php echo Horde::link(Horde::applicationUrl($viewurl), _("View Gallery Details"), '', '', '', $gallery->get('desc')) ?><?php echo ($gallery->get('desc') ? htmlspecialchars($gallery->get('desc')) : _("[none]")) ?></a>
</td>
+
+<?php if ($prefs->getValue('showdefaultimages')) { ?>
+ <td>
+ <?php echo Horde::link(Horde::applicationUrl($viewurl), _("View Gallery Details"), '', '', '', $gallery->get('name')) ?>
+ <?php echo Horde::img(Ansel::getImageUrl($gallery_id, $gallery->getDefaultImage(), 'thumb'), '', '', '') . " </a>" ?>
+ </td>
+<?php } ?>
+
</tr>
Index: templates/view/gallery.inc
===================================================================
RCS file: /repository/ansel/templates/view/gallery.inc,v
retrieving revision 1.1
diff -u -r1.1 gallery.inc
--- templates/view/gallery.inc 16 Oct 2003 15:26:55 -0000 1.1
+++ templates/view/gallery.inc 31 Dec 1999 15:23:02 -0000
@@ -37,7 +43,18 @@
<td class="text">
<?php
if (count($imagelist = $gallery->listImages())) {
+
+ $imagesperrow = $prefs->getValue('imagesperrow');
+ $cellwidth = 100 / $imagesperrow;
+ $count = 0;
+
+ echo "<table cellpadding=15><tr>\n";
+
foreach ($imagelist as $id => $image) {
+
+ echo "<td width=" . $cellwidth . "% align=center valign=top>\n";
+ echo "<table><tr><td align=center valign=middle>\n";
+
$image_url = Util::addParameter('view.php', 'gallery', $gallery_id);
$image_url = Util::addParameter($image_url, 'image', $id);
$image_url = Util::addParameter($image_url, 'actionID', 'viewimage');
@@ -45,8 +62,24 @@
$thumb_url = Ansel::getImageUrl($gallery_id, $id, 'thumb');
echo Horde::linkTooltip(Horde::applicationUrl($image_url), _("View Image"), '', '', '', $image['filename'] . (!empty($image['description']) ? "\n\n" . wordwrap($image['description']) : ''));
- echo Horde::img($thumb_url, '', '', '') . '</a> ';
+ echo Horde::img($thumb_url, '', '', '') . "</a> \n";
+ echo "</td></tr><tr><td width=" . $cellwidth . "% align=center valign=top>\n";
+
+ if (!empty($image['description'])) {
+ echo $image['description'] . "\n";
+ }
+
+ echo "</td></tr></table></td>\n";
+
+ $count++;
+ if (($count % $imagesperrow) == 0) {
+ echo "</tr><tr>\n";
+ }
+
}
+
+ echo ("</tr></table>\n");
+
} else {
echo '<i>' . _("There are no images in this gallery.") . '</i>';
} ?>
More information about the ansel
mailing list