I would like to find a hack to change the 'Hide Album' feature slightly. You see I don't actually want to hide the album from viewers. I just want to supress its appearance in the displayed tree.
I'm using the Gallery to create a photographic genealogical archive for my family and displaying the tree is a great navigational tool for the mixed capabilities of my group of users. And, although I want those users to be able to create sub-albums, I do not necessarily want all those albums to appear in the tree. But, I would like everyone to be able to view those albums if they navigate to the sub-album in which they occur.
Any ideas??
Posts: 8601
It's actually easier to add a new album property than to dig into changing how gallery handles hidden items... first make backup copies of edit_appearance.php and util.php.
In edit_appearance.php search for:
if (isset($save)) {
Just below this line add:
$gallery->album->fields["hide_in_tree"] = $hide_in_tree;
Then further down find (I've just shown the beginning of the line):
<td><select name="showDimensions"> ...
Just below this line add:
In util.php search for function printChildren. About 11 lines down you'll find:
if ($gallery->user->canReadAlbum($nestedAlbum)) {
Change this to:
if ($gallery->user->canReadAlbum($nestedAlbum) && strcmp($nestedAlbum->fields["hide_in_tree"],"yes")) {
That should do it! Edit the album properties for an album and you'll find the new yes/no box at the bottom of the popup. By default albums will be displayed in the tree on the main gallery page. If you'd prefer by default to hide albums then change the "strcmp" above to !strcmp($nestedAlbum->fields["hide_in_tree"],"no") (and maybe reverse the order of yes/no in the selectOptions array).
Nice feature idea, I might use this one myself :lol:
Posts: 12
Works like a champ!!! Thanks so much for your help. This will make a real difference for my users by removing some of the confusion that is caused when so many nested albums show up in the tree. Absolutely great! It's exactly what I wanted. :D
Posts: 18
I've just tried this and it's brilliant. Thanks so much. This is exactly what I needed!
bonni
Posts: 5
I *think* I've made all of the changes correctly. However, could someone please explain how I can "edit the album properties for an album"? (I'm using v1.4.2 if that makes a difference...) Sorry to be so dense, but I can't see it... (I know how to rename, hide, move, etc from the admin panel.)
Thanks for a point in the right direction.
Posts: 27300
peanut,
If you have changed the files correctly you will see a yes/no in album properties.
To get to album properties; Log in as admin, go into a album, from the pulldown select album properties, a window will pop up, near the bottom it should say "Hide in tree" and a yes/no pulldown next to it. If not then restore from you backup and do mindless's steps over again.
Dave
Posts: 5
Hi Dave,
Thanks for the response. I may be taking you guys too literally when you say, "Album Properties". I'm looking for those words in the "<<Edit Album>>"pulldown and not finding them. Would that selection ONLY be there IF I had done it right? Or, should it be there ALL of the time, regardless?
Here's an image of the pulldown I'm presented with:
[img]http://aedyn.com/EditAlbum.gif[/img]
Posts: 5
nm...I think I found what I'm supposed to up in the right pulldown under "<<admin options>>" --> "Properties".
(I had restored my original files out of frustration...going to try this again.)
Thanks again.
Posts: 27300
peanut,
Maybe when I said "go into a album" I should have said go into a album and find the admin dropdown :wink:
Ohwell glad you found it anyway...
I am sure it will work now.
Dave
Posts: 5
All done. Works like a charm. Thanks again!
Posts: 115
I'm a little confused about what this does.
Could someone post a link to their website that uses this hack?
Thank you,
Marc
Posts: 27300
Marc,
You can't really see as is hides the album from the sub-album tree. :wink:
But if you go to http://langleycom.com/g1/ you will see that the first album does have a sub-album tree, but some of the sub-albums have been hidden.
In each albums properties (color, frame style, printing etc), there is a drop-down for you to hide the album from the sub-album tree or show it in the tree.
You are still able to navigate to the album from it's parent album.
Does that make sense?
Posts: 115
Thanks for the response.
So, if I understand it properly, it's basically on an album by album basis that you have to set whether it's visible in the tree or not?
Is there anyway to keep this hack while upgrading or using a new CVS version?
Thanks for the help..
Marc
Posts: 27300
Marc,
You understand correct.
You have to apply the modification each time you upgrade (like most mods).... but you don't have to go through all the albums again; if that helps.
There is only 2 files that need to be changed, so you could keep a eye on the version # of edit_appearance.php and util.php when you do a upgrade to see if it has changed and is overwritten.
As for CVS versions and auto upgrading I can't offer any support to you on that and would like to be educated myself on how CVS upgrades work as well.
CVS experts chime in now.
Dave
Posts: 115
ahh... looks like I have found exactly what I need :D
I have a problem though. I can't seem to find the if (isset($save)) in my edit_appearance.php
I am running v1.4.5-cvs-b143
I would also have a question wrt to sub-sub-albums. Let's say I disable the tree-view for a sub-album, will it still display all sub-sub-albums in this sub-album (hopefully not), so that I would have to change the setting separately for all sub-sub-albums?
Thanks.
Posts: 27300
primedomain, try to add
$gallery->album->fields["hide_in_tree"] = $hide_in_tree;
just above$gallery->album->fields["bgcolor"] = $bgcolor;
If the parent is hidden then is childern sub-albums are hidden as well.
Dave
Posts: 115
thanks for that; seems to work. :D
However, I guess it's better for me to change the default setting, i.e. hidden by default.
Here's what I have done so far:
1. tree enabled in the config
2. change the "strcmp" above to !strcmp($nestedAlbum->fields["hide_in_tree"],"no")
the tree then disappears completely, i.e. it seems to work.
However, when I then go into a sub-album and set it to "show in tree", it doesn't seem to have any effect at all
I am not sure what this means:
(and maybe reverse the order of yes/no in the selectOptions array).
Is this only in order to change the layout or would this also affect the feature as such? In any case, I don't exactly understand what I would need to change.
Thanks.
Posts: 41
Could anyone tell me how a similar change could be made to work in Gallery 2.1 - ?
I'm also doing a photo geneology.
`·.¸¸.><(((º>`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.><((((º>
Gallery version = 2.1.1 core 1.1.0.1
Default theme = PGtheme
Posts: 27300
Edit album and there is a hide album tickbox under the general tab.
Dave
Posts: 41
Thanks Dave, but this is not really it.
This only hides an album from guests, but I'd actually like to hide some of the sub-albums from showing in the DHTML tree menu itself. This seemed to be what the hack by mindless in the beginning accomplished. But that was in the the old gallery...
`·.¸¸.><(((º>`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.><((((º>
Gallery version = 2.1.1 core 1.1.0.1
Default theme = PGtheme
Posts: 27300
Well Mindless wrote the G2 version as well. Does it work the way expected except for the DHTML tree? Did you want it to hide albums from admins as well? I have not played with it much.
They where not even going to put the hide album checkbox in, as the permissions was the way to go, but Mindless needed the functionality.
If it does not behave as expected then perhaps a bug or RFE is in order.
Dave
____________________________________________________
WPG2 | Gallery Frames / Mods || G1 Test Gallery
Posts: 27300
http://langleycom.com/gallery2/v/hidden/ is an album that is hidden. It does not show on the tree view on the sidebar:
http://langleycom.com/gallery2/main.php
I think you want the album _only_ to be hidden on the tree view, but still viewable in the album/subalbum? In G2 that does not exsist ASAIK. I guess you would have to create a module or mod the tree code.
Dave
____________________________________________________
WPG2 | Gallery Frames / Mods || G1 Test Gallery
Posts: 41
Thanks Dave, I think this one I'll have to pass on since there are more important customizing needs calling. This site is a family album and guests have no viewing permissions. There are family members, and family administrators, so I control the site with permisssions and no hidden folders necessary.
Perhaps you have some thought on this Floating Comment Form issue that has stumped me for a couple weeks; I just posted it:
http://gallery.menalto.com/node/51251
`·.¸¸.><(((º>`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.><((((º>
Gallery version = 2.1.1 core 1.1.0.1
Default theme = PGtheme
Posts: 29
well this seems to be cool, but nothing works like a charm.. damn
i thougt yea cool, drove home looked it up but nothing works, big disappointment..
typically for computers.. damn.. of course there is nothing like u said
i cant find nothing of the code fragments in edit_app.. or util.php..
* $Id: util.php 14311 2006-08-14 07:49:09Z jenst
* $Id: edit_appearance.php 14310 2006-08-14 07:41:08Z jenst
this are my versions.. i dont know what to do, have no platform to look everything up
i mean i got no linux system to make good and easy audition..
i think my version is 1.5.4
maybe someone can make a small grep and tell me where to put these code fragments..
Posts: 14
This is SO what I need, but the code it references is alas too old!!
I'm using G1.5.4 -
PLZ - has anyone found a way to impliment this in 1.5.4?
- thanks
Posts: 27300
I will work on this for version 1.5.5pl1. I don't work with older versions if I can help it. It might take a day or so because I have to install 1.5.5pl1 to make sure it works.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
files for 1.5.5pl1.
There is now a setting in edit properties "misc" tab. Hide from tree.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 29
after updating from 1.5.4 to 1.5.5pl1 the configuration wizard dont start, it says "internal error" ... damn
all i wanted was this hiding feature and each solution produce many other problems.. cus' of this shit i hate these computer crap.. damn
Posts: 14
Thanks Dave -
I will try it after I attempt an update - thanks
- k
Posts: 29
now it seems to change something, i put your files over the old files (dave)
now is my album list a priori hidden,
i found the option in properties -> misc -> on the top (not bottom) it is by default "NO" but all my sub-albums are disappeared on the main page right besides the upper album,i wanted to see some subalbums there but not all 20, now i see none subalbum at all.. when i click on the album all sub-albums appear like always, but on the list on the main page is nothing to see :-/
Posts: 27300
i dont understand. You might have to go into each album and set the option.
PM me your url and login info and I will have a look for you.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 29
i found the "bug" .. i have to change for every album
the option to "yes" and then apply, and again to "no" and apply..
after this step the subalbum appears on the listing..
what i was trying to say is that all subalbums were dissappeared on the main page listing, but the option was set to "no hiding" ... got it?
greets
Posts: 27300
Glad you got it sorted.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team