]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
added navigation when viewing full image
authorcash <cash.costello@gmail.com>
Mon, 12 Dec 2011 01:59:29 +0000 (20:59 -0500)
committercash <cash.costello@gmail.com>
Mon, 12 Dec 2011 01:59:29 +0000 (20:59 -0500)
classes/TidypicsAlbum.php
languages/en.php
manifest.xml
views/default/object/image/full.php
views/default/object/image/navigation.php [new file with mode: 0644]
views/default/photos/css.php

index e5a8e2c0cb160505c533b7133f34026127fd8936..e04344a6bbf38c36ac4a76c1d90ce07ca9bfac42 100644 (file)
@@ -207,41 +207,45 @@ class TidypicsAlbum extends ElggObject {
        }
 
        /**
-        * Get the GUID of the image before the current one
+        * Get the previous image in the album
         *
-        * @param int $currentGuid
-        * @return int
+        * @param int $guid GUID of the current image
+        * @return TidypicsImage
         */
-       public function getPreviousImageGuid($currentGuid) {
+       public function getPreviousImage($guid) {
                $imageList = $this->getImageList();
-               $key = array_search($currentGuid, $imageList);
+               $key = array_search($guid, $imageList);
                if ($key === FALSE) {
-                       return 0;
+                       return null;
                }
                $key--;
                if ($key < 0) {
-                       return 0;
+                       return get_entity(end($imageList));
                }
-               return $imageList[$key];
+               return get_entity($imageList[$key]);
        }
 
        /**
-        * Get the GUID of the image after the current one
+        * Get the next image in the album
         *
-        * @param int $currentGuid
-        * @return int
+        * @param int $guid GUID of the current image
+        * @return TidypicsImage
         */
-       public function getNextImageGuid($currentGuid) {
+       public function getNextImage($guid) {
                $imageList = $this->getImageList();
-               $key = array_search($currentGuid, $imageList);
+               $key = array_search($guid, $imageList);
                if ($key === FALSE) {
-                       return 0;
+                       return null;
                }
                $key++;
                if ($key >= count($imageList)) {
-                       return 0;
+                       return get_entity($imageList[0]);
                }
-               return $imageList[$key];
+               return get_entity($imageList[$key]);
+       }
+
+       public function getIndex($guid) {
+               return array_search($guid, $this->getImageList()) + 1;
        }
 
        /**
index c701f98f43f501fcfbca051c28e436a7bc675f3a..e7d7bb988677722746c8b82b5f5d560c1e086ec9 100644 (file)
@@ -126,6 +126,7 @@ $english = array(
                        'image:none' => "No images have been added yet.",
                        'image:back' => "Previous",
                        'image:next' => "Next",
+                       'image:index' => "%u of %u",
 
                // tagging
                        'tidypics:taginstruct' => 'Select area that you want to tag',
index 53181fc29705b4fc7f0667ce8c027ba0b4703133..b955ef6bb0720b88f69da58284aeb846cebc5b37 100644 (file)
@@ -2,7 +2,7 @@
 <plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
        <name>Tidypics Photo Gallery</name>
        <author>Cash Costello</author>
-       <version>1.8.0</version>
+       <version>1.8.0-preview1</version>
        <description>A photo gallery with albums, tagging, and a slideshow.</description>
        <category>content</category>
        <category>multimedia</category>
index f866e432dda145541173036f5c8d455086ba9a9c..48ed40876d7598286caeff5d6b558ac6ba529795 100644 (file)
@@ -46,6 +46,13 @@ $summary = elgg_view_image_block($owner_icon, $list_body, $params);
 
 echo $summary;
 
+echo '<div class="tidypics-wrapper-photo">';
+echo elgg_view('object/image/navigation', $vars);
+//echo elgg_view('tidypics/tagging/help');
+//echo elgg_view('tidypics/tagging/select', array('photo' => $photo));
+echo $img;
+echo '</div>';
+
 if ($photo->description) {
        echo elgg_view('output/longtext', array(
                'value' => $photo->description,
@@ -53,10 +60,4 @@ if ($photo->description) {
        ));
 }
 
-echo '<div class="tidypics-wrapper-photo">';
-echo elgg_view('tidypics/tagging/help');
-echo elgg_view('tidypics/tagging/select', array('photo' => $photo));
-echo $img;
-echo '</div>';
-
 echo elgg_view_comments($photo);
diff --git a/views/default/object/image/navigation.php b/views/default/object/image/navigation.php
new file mode 100644 (file)
index 0000000..155b763
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * Photo navigation
+ *
+ * @uses $vars['entity']
+ */
+
+$photo = $vars['entity'];
+
+$album = $photo->getContainerEntity();
+$previous_photo = $album->getPreviousImage($photo->getGUID());
+$next_photo = $album->getNextImage($photo->getGUID());
+$size = $album->getSize();
+$index = $album->getIndex($photo->getGUID());
+
+echo '<ul class="elgg-menu elgg-menu-hz tidypics-album-nav">';
+echo '<li>';
+echo elgg_view('output/url', array(
+       'text' => elgg_view_icon('arrow-left'),
+       'href' => $previous_photo->getURL(),
+));
+echo '</li>';
+
+echo '<li>';
+echo '<span>' . elgg_echo('image:index', array($index, $size)) . '</span>';
+echo '</li>';
+
+echo '<li>';
+echo elgg_view('output/url', array(
+       'text' => elgg_view_icon('arrow-right'),
+       'href' => $next_photo->getURL(),
+));
+echo '</li>';
+echo '</ul>';
index 119d98c09fa301e596d1181aec6330c5bff1a4e6..18f225131995123e58d2b4179f1c7a5c0c02b5f4 100644 (file)
        padding: 0 10px;
 }
 
+.tidypics-album-nav {
+       margin: 3px 0;
+       text-align: center;
+       color: #aaa;
+}
+
+.tidypics-album-nav > li {
+       padding: 0 3px;
+}
+
+.tidypics-album-nav > li {
+       vertical-align: top;
+}
+
 <?php
 return true;
 ?>