[ansel] Mod to tile_owner.inc

Heath S. Hendrickson heath at outerspaceconsultants.com
Wed Jan 28 13:45:14 PST 2004


I made a small modification to the templates/list/tile_owner.inc 
template so that it would display the full path to the gallery in the 
pull-down list (i.e., "Parent1 : Parent2 : Child1" and so on).  I wanted 
to know when a gallery was a sub-gallery or not.  On that note, would 
anyone object if I created a new gallery view that displayed the 
galleries in a tree-like view?  My idea is sorta like the pull-down on 
the tile view, just not via a pull-down and without the previews.

I also sorta fixed a bug that caused it to diplay and error for the 
gallery preview image.  Now it just displays the text "Gallery Preview" 
as a clickable link.  There has to be a better way to handle this, but I 
couldn't think of one due to the use of javascript to acuatlly display 
the image.  And this works for now until I can come up with something 
better.

heath

-------------- next part --------------
Index: templates/list/tile_owner.inc
===================================================================
RCS file: /usr/local/horde/cvs/ansel/templates/list/tile_owner.inc,v
retrieving revision 1.12
diff -u -r1.12 tile_owner.inc
--- templates/list/tile_owner.inc	16 Jan 2004 04:25:01 -0000	1.12
+++ templates/list/tile_owner.inc	28 Jan 2004 21:38:35 -0000
@@ -12,7 +12,11 @@
 <?php
 $i = 0;
 foreach ($galleries as $galleryId => $gallery) {
-    echo $owner . '_previews[' . $i . '] = \'' . addslashes(str_replace('&amp;', '&', Ansel::getImageUrl($gallery->getDefaultImage(), 'thumb'))) . "';\n";
+    if($gallery->getDefaultImage() != false) {
+        echo $owner . '_previews[' . $i . '] = \'' . addslashes(str_replace('&amp;', '&', Ansel::getImageUrl($gallery->getDefaultImage(), 'thumb'))) . "';\n";
+    } else {
+        echo $owner . '_previews[' . $i . '] = \'' . 0 . "';\n";
+    }
     echo $owner . '_gallery_size[' . $i . '] = ' . $gallery->get('num-images') . ";\n";
     echo $owner . '_gallery_id[' . $i . '] = \'' . addslashes($galleryId) . "';\n";
     echo $owner . '_gallery_desc[' . $i . '] = \'' . addslashes($gallery->get('desc')) . "';\n";
@@ -80,7 +84,7 @@
         <?php Util::pformInput() ?>
         <select name="gallery" onchange="<?php echo $owner ?>_updateTile()">
         <?php foreach ($galleries as $galleryId => $gallery): ?>
-          <option value="<?php echo $galleryId ?>"><?php echo $gallery->get('name') ?></option>
+          <option value="<?php echo $galleryId ?>"><?php $p = $gallery; $gs = array(); while (is_a($p = $p->getParent(),'DataTreeObject_Gallery')) { $gs[] = $p->get('name'); } if (count($gs)) { $gs = array_reverse($gs); echo implode(' : ',$gs) . ' : '; } ?><?php echo $gallery->get('name') ?></option>
         <?php endforeach; ?>
         </select>
         <input type="submit" class="button" value="<?php echo _("Go") ?>" />


More information about the ansel mailing list