[ansel] [patch] Add admin links to the gallery view
Brian Keifer
brian at valinor.net
Sun Oct 19 17:49:10 PDT 2003
Hi, list!
The attached patch adds a toolbar below each image in the gallery view if the
viewer has the appropriate permissions. There's a screenshot here:
http://valinor.net/ss/ansel-gallery-admin-commands.jpg
It also fixes some broken references to $gallery_id, which was renamed to
$galleryId in version 1.17 of view.php.
-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: description-image.inc
===================================================================
RCS file: /repository/ansel/templates/view/description-image.inc,v
retrieving revision 1.12
diff -u -r1.12 description-image.inc
--- description-image.inc 17 Oct 2003 18:30:49 -0000 1.12
+++ description-image.inc 19 Oct 2003 23:24:05 -0000
@@ -1,5 +1,5 @@
<?php
-$image_url = Ansel::getImageUrl($gallery_id, $image_id);
+$image_url = Ansel::getImageUrl($galleryId, $image_id);
$caption = !empty($image['description']) ? $image['description'] : $image['filename'];
?>
Index: gallery.inc
===================================================================
RCS file: /repository/ansel/templates/view/gallery.inc,v
retrieving revision 1.7
diff -u -r1.7 gallery.inc
--- gallery.inc 19 Oct 2003 05:28:03 -0000 1.7
+++ gallery.inc 19 Oct 2003 23:24:05 -0000
@@ -54,21 +54,55 @@
echo '<td width="' . $cellwidth . '%" align="center" valign="top">';
echo '<table><tr><td align="center" valign="middle">';
- $image_url = Util::addParameter('view.php', 'gallery', $galleryId);
+ $image_url = Util::addParameter('image.php', 'gallery', $galleryId);
$image_url = Util::addParameter($image_url, 'image', $id);
- $image_url = Util::addParameter($image_url, 'actionID', 'viewimage');
+
+ $view_url = Util::addParameter('view.php', 'gallery', $galleryId);
+ $view_url = Util::addParameter($view_url, 'image', $id);
+ $view_url = Util::addParameter($view_url, 'actionID', 'viewimage');
+
+ $crop_url = Util::addParameter('crop.php', 'gallery', $galleryId);
+ $crop_url = Util::addParameter($crop_url, 'image', $galleryId);
$thumb_url = Ansel::getImageUrl($galleryId, $id, 'thumb');
- echo Horde::link(Horde::applicationUrl($image_url), $image['filename']);
+ echo Horde::link(Horde::applicationUrl($view_url), $image['filename']);
echo Horde::img($thumb_url, '', 'style="border: 1px solid black;"', '') . '</a>';
- echo '</td></tr><tr><td width="' . $cellwidth . '%" align="center" valign="top">';
+ echo '</td></tr>';
+
+?>
+
+<?php if ($gallery->hasPermission(Auth::getAuth(), _PERMS_EDIT)
+ || Ansel::isAvailable('crop')
+ || $gallery->hasPermission(Auth::getAuth(), _PERMS_DELETE)): ?>
+
+<tr class="control">
+ <?php echo "<td width=\"" . $cellwidth . "%\" align=\"center\">" ?>
+ <?php if ($gallery->hasPermission(Auth::getAuth(), _PERMS_EDIT)): ?>
+ <?php echo Horde::link(Horde::applicationUrl(Util::addParameter($image_url, 'actionID', 'modify')), _("Caption"), 'widget') . _("Caption") ?></a>
+ | <?php echo Horde::link(Horde::applicationUrl(Util::addParameter($image_url, 'actionID', 'editimage')), _("Edit"), 'widget') . _("Edit") ?></a>
+ <?php if (Ansel::isAvailable('crop')): ?>
+ | <?php echo Horde::link(Horde::applicationUrl($crop_url), _("Crop"), 'widget') . _("Crop") ?></a>
+ <?php endif; ?>
+ <?php endif; ?>
+ <?php if ($gallery->hasPermission(Auth::getAuth(), _PERMS_DELETE)): ?>
+ | <?php echo Horde::link(Horde::applicationUrl(Util::addParameter($image_url, 'actionID', 'delete')), _("Delete"), 'widget', '', 'return window.confirm(\'' . addslashes(sprintf(_("Do you want to permanently delete %s?"), $image['filename'])) . '\');') . _("Delete") ?></a>
+ <?php endif; ?>
+ </td>
+</tr>
+
+<?php endif; ?>
+
+<?php
+
if (!empty($image['description'])) {
+ echo '<tr><td width="' . $cellwidth . '%" align="center" valign="top">';
echo $image['description'] . "\n";
+ echo '</td></tr>';
}
- echo '</td></tr></table></td>';
+ echo '</table></td>';
$count++;
if (($count % $imagesperrow) == 0) {
Index: navbar-image.inc
===================================================================
RCS file: /repository/ansel/templates/view/navbar-image.inc,v
retrieving revision 1.12
diff -u -r1.12 navbar-image.inc
--- navbar-image.inc 17 Oct 2003 18:45:22 -0000 1.12
+++ navbar-image.inc 19 Oct 2003 23:24:05 -0000
@@ -1,14 +1,14 @@
<?php
-$imageurl = Util::addParameter('image.php', 'gallery', $gallery_id);
+$imageurl = Util::addParameter('image.php', 'gallery', $galleryId);
$imageurl = Util::addParameter($imageurl, 'image', $image_id);
-$cropurl = Util::addParameter('crop.php', 'gallery', $gallery_id);
+$cropurl = Util::addParameter('crop.php', 'gallery', $galleryId);
$cropurl = Util::addParameter($cropurl, 'image', $image_id);
-$viewurl = Ansel::getImageUrl($gallery_id, $image_id, 'full', true);
-$thumburl = Ansel::getImageUrl($gallery_id, $image_id, 'thumb', true);
+$viewurl = Ansel::getImageUrl($galleryId, $image_id, 'full', true);
+$thumburl = Ansel::getImageUrl($galleryId, $image_id, 'thumb', true);
-$galleryurl = Util::addParameter('view.php', 'gallery', $gallery_id);
+$galleryurl = Util::addParameter('view.php', 'gallery', $galleryId);
?>
<table border="0" align="center" width="100%" cellspacing="0" cellpadding="2">
<tr class="control">
More information about the ansel
mailing list