Skip to content

Commit

Permalink
Allow for fetching other user's galleries too.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrubinsk committed Dec 14, 2015
1 parent 685e391 commit 71aa515
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ansel/js/ansel.js
Expand Up @@ -228,10 +228,15 @@ AnselCore =
$('anselViewImages').stopObserving('AnselLayout:scroll', this.onImageScroll.bindAsEventListener(this));
$('anselViewGalleries').observe('AnselLayout:scroll', this.onGalleryScroll.bindAsEventListener(this));
if (data) {
// Loading a single gallery.
this.addHistory(view + ':' + subview + ':' + data);
this.loadGallery(data);
} else {
// Listing galleries.
this.addHistory(view + ':' + subview);
if (view == 'all') {
params = { user: '*' };
}
HordeCore.doAction('listGalleries', {}, { callback: this.listGalleriesCallback.bind(this) });
}
break;
Expand Down
10 changes: 7 additions & 3 deletions ansel/lib/Ajax/Application/Handler.php
Expand Up @@ -29,18 +29,22 @@ class Ansel_Ajax_Application_Handler extends Horde_Core_Ajax_Application_Handler
protected $_external = array('embed');

/**
* Return an array of gallery objects, matching the requested paramters.
* Return an array of gallery objects, matching the requested parameters.
*
* @todo
* @see Ansel_Storage::listGalleries for list of parameters.
*
* @return array A hash of gallery id -> gallery object.
*/
public function listGalleries()
{
$params = array(
'attributes' => $GLOBALS['registry']->getAuth(),
'all_levels' => false
);
if (!empty($this->vars->user) && $this->vars->user != '*') {
$params['attributes'] = $this->vars->user;
} elseif (empty($this->vars->user)) {
$params['attributes'] = $GLOBALS['registry']->getAuth();
}
$galleries = $GLOBALS['storage']->listGalleries($params);
$return = new stdClass();
foreach ($galleries as $gallery) {
Expand Down

0 comments on commit 71aa515

Please sign in to comment.