Re: set_display_context_callback() and incorrect pagination

Bharat Mediratta <[email protected]> Wed, 30 Jan 2013 16:40:31 -0800
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAESa+_kGHSbU6d8wLyq9pcmMt8RU80CS=PY3kbZDKo10B-2KgQ@mail.gmail.com>
I wasn't very pleased with the last round of code because exposing the
call_user_func_array to the end user is a crappy API.  I wrapped that in a
function in Gallery_Theme so now the caller can do:

  $theme->siblings()

So in thumbnav_block you can do:

  foreach ($theme->siblings() as $sibling) {

and it should just work (I tested it).

-Bharat


On Wed, Jan 30, 2013 at 1:21 PM, Mike Miller <[email protected]> wrote:

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