Re: set_display_context_callback() and incorrect pagination

Mike Miller <[email protected]> Wed, 30 Jan 2013 06:20:50 +0200
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAGYq59cMC8xbWNf61Qmqk1QbjnaQB8F_mYks5dMDknqkm89ejQ@mail.gmail.com>
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 ]