$Item->children and collection's $children items - technical question

Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Thu, 2012-01-12 21:08

@bharat and G3 team:

I run into interesting situation

"Hide" module extends viewable() method of the item in order to hide it.
it work on general level when enumerating collection's $children list. But in order to see items outside of the current page, I was doing to following in album.html.php

$siblings = $item->children();

and then comparing items in $children and $siblings, anything what does not match assumed to be outside of current page.
Interesting part is that when doing $siblings[i]->viewable() it would not take in consideration override above even though $siblings[i] is an item.

Why are two different? Can I tell $siblings list to take override in consideration?

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Sun, 2012-01-15 18:37

bump

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Fri, 2012-01-20 23:37

bump

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Wed, 2012-01-25 16:36

Bharat or Dave?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2012-01-25 21:43

I have pinged Bharat to chime in, but life/work is taking priority right now.
If I knew the answer I would try.
The hide module is giving me some issues as well.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2012-02-05 23:59

I suspect what we need to do is to improve the hide module to overload Item_Model::children to do the right thing. I took at stab at this and checked it in under https://github.com/gallery/gallery3-contrib/commit/228946e98cbb87f115a8a2440cda395c9706fcb8 - this is probably not the only place that we need to fix up the implementation. Let me know if this works.
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Mon, 2012-02-06 01:02

Did not help (assuming that the only thing I need to do is to place the file in libraries folder)

http://photo.dragonsoft.us/chicago/05-11-08_1424

Please note that photo page navigation is working as intended, while thumb navigator and colorbox does not.
Code which is doing enumeration is as following (from the context of photo page)

$siblings = $item->parent()->children();
$itemlist = Array();
foreach ($siblings as $sibling):
  if (isset($sibling)):
    if ($sibling->viewable()):
      if (($hide_albums and ($sibling->is_photo())) or (!$hide_albums)):
        $itemlist[] = $sibling;
      endif;
    endif;
  endif;
endforeach;

Serge
_____________________________________________
Photo Gallery | GreyDragon Theme | Follow on Twitter

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Mon, 2012-02-06 01:44

Hm. Can you tell me the steps to set up a test case for this? If I can reproduce it, I can fix it. I'm surprise that this isn't working, since the $item->parent()->children() call should filter out the non-viewable items for you should be able to use $siblings without the additional $sibling->viewable() call.

Did you get the latest version of the hide module from github? You might try that just to be sure that you've got the right code.
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Mon, 2012-02-06 02:54

Re-uploaded, same thing
test case is code above, sample page is a link above

if you'd like live code, please download thumbnav module and see for yourself

Serge
_____________________________________________
Photo Gallery | GreyDragon Theme | Follow on Twitter

 
Serge D
Serge D's picture

Joined: 2009-06-11
Posts: 2466
Posted: Sat, 2012-03-03 22:09

bump

any news on that?

Serge
_____________________________________________
Photo Gallery | GreyDragon Theme | Follow on Twitter