Re: set_display_context_callback() and incorrect pagination

Bharat Mediratta <[email protected]> Wed, 30 Jan 2013 09:12:59 -0800
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAESa+_mEcsTvsvGH6aLrgwrUPpramZJV9RiDO5D0gmpjcpAhTg@mail.gmail.com>
I committed this change in
https://github.com/gallery/gallery3/commit/1e4d75c12072b49c3469f18af13bcf3439afc6b0-
check it out.  It only covers the official repo.  The one thing it's
missing is the ability to paginate the sibling responses, but from the GD
example it doesn't look like that's something that the GD module needs.


-Bharat


On Tue, Jan 29, 2013 at 8:20 PM, Mike Miller <[email protected]> wrote:

> On Tue, Jan 29, 2013 at 8:55 PM, Bharat Mediratta <[email protected]>
> wrote:
> > The only canonical place to get the siblings is from the display context,
> > but currently our display context does not provide that information.  I
> > think the right solution here is to extend the API for display contexts
> to
> > provide a callback function that the theme can call to get the entire
> list
> > of siblings.  So for example, Search_Controller::get_display_context
> would
> > return:
> >
> >     return array("position" => $position,
> >                  "previous_item" => $previous_item,
> >                  "next_item" => $next_item,
> >                  "sibling_count" => $count,
> >                  "siblings_callback" => array(array("search",
> > "search_within_album"), array($item, $query_terms, $album)),
> >                  "breadcrumbs" => array(
> >                    Breadcrumb::instance($root->title, "/",
> > $root->id)->set_first(),
> >                    Breadcrumb::instance(t("Search: %q", array("q" =>
> $q)),
> > $search_url),
> >                    Breadcrumb::instance($item->title,
> > $item->url())->set_last()));
> >
> > Then the theme will have access to the siblings as a callback:
> >
> >   call_user_func_array($siblings_callback[0], $siblings_callback[1]);
> >
> > That'll provide the right set of siblings for anybody who wants them.
> > Thoughts?
>
> This seems like it would be perfect for my purposes. From a quick grep
> through the code, the following changes "need" to be made (need is in
> quotes since it's backwards compatible; adding this won't
> automatically break any module that continues to use the
> item->parent()->children() call)
>
> Official:
> modules/gallery/controllers/albums.php
> modules/gallery/helpers/item.php
> modules/search/controllers/search.php
> modules/tag/controllers/tag.php
>
> Unofficial:
> modules/dynamic/controllers/dynamic.php
> modules/tag_albums/controllers/tag_albums.php
> modules/latestupdates/controllers/latestupdates.php
> modules/thumbnav/helpers/thumbnav_block.php
> modules/navcarousel/controllers/navcarousel.php,
> modules/navcarousel/views/navcarousel.html.php
> themes/greydragon
> themes/browny_wind
> themes/pear4gallery3
>
> FYI.
>
> -- Mike
>
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan

__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]