*/
currentGallery: null,
+ currentImages: null,
+
/**
* Currently loaded image thumbnails
*/
HordeMobile.doAction('getGallery', { id: id }, AnselMobile.galleryLoaded);
},
+ toImage: function(index)
+ {
+ var i = $('<img>').attr({ 'src': ((AnselMobile.currentGallery.tiny) ? 'http://i.tinysrc.mobi/' : '') + AnselMobile.currentImages[index].screen });
+ $('#anselimageview').empty();
+ $('#anselimageview').append(i);
+ $('#imageview h1').text(AnselMobile.currentImages[index].fn)
+ $('#imagebackbutton .ui-btn-text').text(AnselMobile.currentGallery.n);
+ //$('#gallerybackbutton').attr({ 'action': 'back' });
+ $.mobile.changePage('imageview', 'slide', false, true);
+ },
+
/**
* Callback for after a gallery is loaded.
*
$('#thumbs').before(AnselMobile.buildGalleryList(l, r.sg).listview());
}
$('#galleryview h1').text(r.n);
- if ($.mobile.activePage.attr('id') != 'galleryview') {
- $.mobile.changePage('galleryview', 'slide', false, true);
- }
$('#thumbs').empty();
+ AnselMobile.currentImages = r.imgs;
$.each(r.imgs, function(k, i) {
- var img = $('<li>').addClass('anselthumb').append($('<a>').attr({ 'href': '#' }).append($('<img>').attr({ src: i.url })));
+ var img = $('<li>').addClass('anselthumb').append($('<a>').attr({ 'href': '#', 'image-key': k, }).append($('<img>').attr({ src: i.url })));
$('#thumbs').append(img);
});
+ if ($.mobile.activePage.attr('id') != 'galleryview') {
+ $.mobile.changePage('galleryview', 'slide', false, true);
+ }
if (r.p) {
$('#gallerybackbutton .ui-btn-text').text(r.pn);
$('#gallerybackbutton').attr({ 'action': 'gallery', 'gallery-id': r.p });
} else {
$('#gallerybackbutton .ui-btn-text').text($.mobile.page.prototype.options.backBtnText);
- $('#gallerybackbutton').attr({ 'action': 'home' });
+ $('#gallerybackbutton').attr({ 'action': 'home', 'gallery-id': null });
}
AnselMobile.centerGrid();
},
if (elt.hasClass('ansel-gallery')) {
AnselMobile.toGallery(elt.attr('ansel-gallery-id'));
}
+
+ if (elt.attr('image-key')) {
+ AnselMobile.toImage(elt.attr('image-key'));
+ }
if (elt.attr('id') == 'gallerybackbutton') {
switch (elt.attr('action')) {
case 'home':
AnselMobile.toGallery(elt.attr('gallery-id'));
}
}
+ if (elt.attr('id') == 'imagebackbutton') {
+ window.history.back();
+ }
elt = elt.parent();
}
},
}
if ($full) {
+ $json->tiny = ($GLOBALS['conf']['vfs']['src'] == 'direct' || $this->hasPermission('', Horde_Perms::READ));
$json->sg = array();
if ($this->hasSubGalleries()) {
$sgs = $GLOBALS['injector']->getInstance('Ansel_Storage')->listGalleries(array('parent' => $this->getId(), 'all_levels' => false));
}
}
- $images = $this->listImages();
+ $images = $this->getImages();
foreach ($images as $img) {
$i = new StdClass();
- $i->id = $img;
- $i->url = Ansel::getImageUrl($img, 'thumb', false, Ansel::getStyleDefinition('ansel_mobile'))->toString();
+ $i->id = $img->id;
+ $i->url = Ansel::getImageUrl($img->id, 'thumb', false, Ansel::getStyleDefinition('ansel_mobile'))->toString();
+ $i->screen = Ansel::getImageUrl($img->id, 'screen', $json->tiny, Ansel::getStyleDefinition('ansel_default'))->toString();
+ $i->fn = $img->filename;
$json->imgs[] = $i;
}
}