Re: set_display_context_callback() and incorrect pagination

Mike Miller <[email protected]> Wed, 30 Jan 2013 23:21:21 +0200
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAGYq59dBLZ6FOLSCxhetc3tokr7hn-FN=B9B+ZbtpybX3WCJXw@mail.gmail.com>
On Wed, Jan 30, 2013 at 7:12 PM, Bharat Mediratta <[email protected]> wrote:
>
> 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.

Working great so far; I simply replaced (in GD):

-        $siblings = $parent->children();

with

+         $siblings = call_user_func_array($siblings_callback[0],
$siblings_callback[1]);

And it's behaving correctly for search, albums (which always worked) and tags.

I then moved onto adding this API to the dynamic module, and it went
quite smoothly (although browsing a virtual album with 11K items was
quite slow, and reminded me that I needed to optimize GD not to
actually look up every URL, but only the ~30 that we might potentially
display). In case anyone's interested (I need to get in touch with
Serge D one of these days), all of my modified code is at
https://github.com/mikeage/greydragon .

I then tried modifying the thumbnav plugin
(http://codex.galleryproject.org/Gallery3:Modules:thumbnav), and here
I got into a bit of trouble. thumbnav is a block, but
$siblings_callback doesn't seem to be defined here. I'm assuming this
is because it's not created through the normal theme view mechanism; I
tried a few combinations involving item::get_display_context($item))
or this->set_global(), but I'm not really sure what I'm doing <g>. I
hate to ask such a silly question, but I suspect this is something
that you can answer in a few seconds, and save me quite a bunch of
time poking around.

Thanks

-- 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 ]