From be3479085d475428a213868e13e8504e924e32ba Mon Sep 17 00:00:00 2001 From: cash Date: Sun, 11 Dec 2011 20:59:29 -0500 Subject: added navigation when viewing full image --- classes/TidypicsAlbum.php | 36 +++++++++++++++++-------------- languages/en.php | 1 + manifest.xml | 2 +- views/default/object/image/full.php | 13 +++++------ views/default/object/image/navigation.php | 34 +++++++++++++++++++++++++++++ views/default/photos/css.php | 14 ++++++++++++ 6 files changed, 77 insertions(+), 23 deletions(-) create mode 100644 views/default/object/image/navigation.php diff --git a/classes/TidypicsAlbum.php b/classes/TidypicsAlbum.php index e5a8e2c0c..e04344a6b 100644 --- a/classes/TidypicsAlbum.php +++ b/classes/TidypicsAlbum.php @@ -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; } /** diff --git a/languages/en.php b/languages/en.php index c701f98f4..e7d7bb988 100644 --- a/languages/en.php +++ b/languages/en.php @@ -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', diff --git a/manifest.xml b/manifest.xml index 53181fc29..b955ef6bb 100644 --- a/manifest.xml +++ b/manifest.xml @@ -2,7 +2,7 @@ Tidypics Photo Gallery Cash Costello - 1.8.0 + 1.8.0-preview1 A photo gallery with albums, tagging, and a slideshow. content multimedia diff --git a/views/default/object/image/full.php b/views/default/object/image/full.php index f866e432d..48ed40876 100644 --- a/views/default/object/image/full.php +++ b/views/default/object/image/full.php @@ -46,6 +46,13 @@ $summary = elgg_view_image_block($owner_icon, $list_body, $params); echo $summary; +echo '
'; +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 '
'; + if ($photo->description) { echo elgg_view('output/longtext', array( 'value' => $photo->description, @@ -53,10 +60,4 @@ if ($photo->description) { )); } -echo '
'; -echo elgg_view('tidypics/tagging/help'); -echo elgg_view('tidypics/tagging/select', array('photo' => $photo)); -echo $img; -echo '
'; - 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 index 000000000..155b76364 --- /dev/null +++ b/views/default/object/image/navigation.php @@ -0,0 +1,34 @@ +getContainerEntity(); +$previous_photo = $album->getPreviousImage($photo->getGUID()); +$next_photo = $album->getNextImage($photo->getGUID()); +$size = $album->getSize(); +$index = $album->getIndex($photo->getGUID()); + +echo ''; diff --git a/views/default/photos/css.php b/views/default/photos/css.php index 119d98c09..18f225131 100644 --- a/views/default/photos/css.php +++ b/views/default/photos/css.php @@ -52,6 +52,20 @@ 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; +} + -- cgit v1.2.3