[ansel] Creating pop-up windows?

Heath S. Hendrickson heath at outerspaceconsultants.com
Thu Jan 22 13:51:18 PST 2004


>>
>> You can't create a popup window with PHP. You can either use 
>> javascript, or
>> target="_blank". You should go ahead and use javascript, like we do 
>> everywhere
>> else for all of the popup windows in Horde. Look at the gallery 
>> permissions
>> window, for example. There are popups scattered all over the various 
>> apps -
>> also, horde/templates/javascript/open_*_win.js, etc....
>>

Okay, attached are patches that modify templates/image/exif-view.inc and 
templates/view/navbar-image.inc to make the "Image Attributes" a pop-up 
window instead of replacing the image window.  I also modified  
image.php to remove the Ansel::menu() from the exif case so it doesn't 
clutter the pop-up.

Unfortunately, these diffs also include the changes from the previous 
exif work that I sent in, so they should be applied instead of the ones 
sent earlier where patched files overlap as these will include both sets 
of changes.

heath
-------------- next part --------------
Index: image.php
===================================================================
RCS file: /usr/local/horde/cvs/ansel/image.php,v
retrieving revision 1.56
diff -u -r1.56 image.php
--- image.php	20 Jan 2004 18:13:46 -0000	1.56
+++ image.php	22 Jan 2004 21:38:27 -0000
@@ -226,7 +226,7 @@
     $imageFile = $image->toFile();
 
     require_once ANSEL_BASE . '/lib/Exif.php';
-    $result = read_exif_data_raw($imageFile);
+    $result = get_exif_data($imageFile);
 
     @unlink($imageFile);
 
@@ -239,8 +239,8 @@
     $title = sprintf(_("Attributes for %s :: %s"), $gallery->get('name'), $image->get('filename'));
 
     require ANSEL_TEMPLATES . '/common-header.inc';
-    Ansel::menu();
-    require ANSEL_TEMPLATES . '/image/exif.inc';
+    //Ansel::menu();
+    require ANSEL_TEMPLATES . '/image/exif-view.inc';
     require $registry->getParam('templates', 'horde') . '/common-footer.inc';
     exit;
     break;
-------------- next part --------------
Index: templates/view/navbar-image.inc
===================================================================
RCS file: /usr/local/horde/cvs/ansel/templates/view/navbar-image.inc,v
retrieving revision 1.17
diff -u -r1.17 navbar-image.inc
--- templates/view/navbar-image.inc	16 Jan 2004 00:31:07 -0000	1.17
+++ templates/view/navbar-image.inc	22 Jan 2004 21:42:39 -0000
@@ -1,4 +1,5 @@
 <?php
+Horde::addScriptFile('open_share_edit_win.js','horde');
 $imageurl = Util::addParameter('image.php', 'gallery', $galleryId);
 $imageurl = Util::addParameter($imageurl, 'image', $image_id);
 $imageurl = Util::addParameter($imageurl, 'page', $page);
@@ -28,7 +29,7 @@
     <?php endif; ?>
   </td>
   <td align="right">
-    <?php echo Horde::link(Horde::applicationUrl(Util::addParameter($imageurl, 'actionID', 'exif')), _("Image Attributes"), 'widget') . _("Image Attributes") ?></a>
+    <?php echo Horde::link('', _("Image Attributes"), 'widget', '', 'open_share_edit_win(\'' . str_replace('&amp;', '&', Util::addParameter(Horde::applicationUrl(Util::addParameter($imageurl, 'actionID', 'exif')), 'share', $gallery->getName())) . '\'); return false;') . _("Image Attributes") ?></a>
     | <?php echo Horde::link('', _("Print on Shutterfly"), 'widget', null, 'document.shutterfly.returl.value = document.location; document.shutterfly.submit(); return false;') . _("Print on Shutterfly") ?></a>
     | <?php echo Horde::link(Horde::applicationUrl(Util::addParameter($imageurl, 'actionID', 'downloadfull')), _("Download Full Image"), 'widget') . _("Download Full Image") ?></a>
   </td>
-------------- next part --------------
Index: templates/view/exif-image.inc
===================================================================
RCS file: /usr/local/horde/cvs/ansel/templates/view/exif-image.inc,v
retrieving revision 1.1
diff -u -r1.1 exif-image.inc
--- templates/view/exif-image.inc	19 Jan 2004 22:37:55 -0000	1.1
+++ templates/view/exif-image.inc	22 Jan 2004 16:56:17 -0000
@@ -1,33 +1,11 @@
 <?php
-require_once ANSEL_BASE . '/lib/Exif.php';
-$imageFile = $image->toFile();
-$result = read_exif_data_raw($imageFile);
-if (!empty($result['ValidEXIFData'])) {
-    $IDF0 = array('Make', 'Model', 'Orientation', 'xResolution',
-                  'yResolution', 'ResolutionUnit', 'Software', 'DateTime',
-                  'YCbCrPositioning');
-    $SubIDF = array('ExposureTime', 'FNumber', 'ExifVersion',
-                    'DateTimeOriginal', 'DateTimedigitized', 'ComponentsConfiguration',
-                    'ComponentsConfiguration', 'CompressedBitsPerPixel',
-                    'ShutterSpeedValue', 'ApertureValue', 'MeteringMode', 'Flash',
-                    'FocalLength', 'UserComment', 'ColorSpace', 'ExifImageWidth',
-                    'ExifImageHeight', 'SensingMethod', 'FileSource');
-
-    $output = array();
-
-    foreach ($result['IFD0'] as $key => $value) {
-        if (in_array($key, $IDF0) && trim($value) != '') {
-            $output[] = "<b>$key</b>:&nbsp;$value";
-        }
-    }
-
-    foreach ($result['SubIFD'] as $key => $value) {
-        if (in_array($key, $SubIDF) && trim($value) != '') {
-            $output[] = "<b>$key</b>:&nbsp;$value";
-        }
-    }
-
-    if (count($output)) {
-        echo '<br /><div align="center"><table border="0" cellpadding="2" cellspacing="0"><tr><td class="item">[&nbsp;' . implode(' | ', $output) . '&nbsp;]</td></tr></table></div>';
+require ANSEL_TEMPLATES . '/image/exif.inc';
+if (count($output)) {
+    $newout = array_chunk($output,3);
+    echo '<br /><div align="center"><table border="0" cellpadding="2" cellspacing="0">';
+    foreach($newout as $elem) {
+        echo '<tr>'.implode('<td class="item">&nbsp;</td>',$elem).'</tr>';
     }
+    echo '</table></div>';
 }
+?>


More information about the ansel mailing list