A different 'Hide Album' feature

mhschuster

Joined: 2004-01-22
Posts: 12
Posted: Wed, 2004-02-04 12:18

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?? :)

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2004-02-05 05:55

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:

</tr>
<tr>
<td class="popup"><?php echo _("Hide in tree") ?></td>
<td><select name="hide_in_tree"><?php echo selectOptions($gallery->album, "hide_in_tree", array("no" => _("no"), "yes" => _("yes"))) ?></select></td>

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:

 
mhschuster

Joined: 2004-01-22
Posts: 12
Posted: Thu, 2004-02-05 14:19

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

 
alicorna
alicorna's picture

Joined: 2002-10-07
Posts: 18
Posted: Sat, 2004-02-14 07:54

I've just tried this and it's brilliant. Thanks so much. This is exactly what I needed!

bonni

 
peanut

Joined: 2004-04-19
Posts: 5
Posted: Mon, 2004-04-19 11:49
mindless wrote:
Edit the album properties for an album and you'll find the new yes/no box at the bottom of the popup.

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.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2004-04-19 14:51

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

 
peanut

Joined: 2004-04-19
Posts: 5
Posted: Mon, 2004-04-19 18:15

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]

 
peanut

Joined: 2004-04-19
Posts: 5
Posted: Mon, 2004-04-19 18:37

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.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Mon, 2004-04-19 18:47

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

 
peanut

Joined: 2004-04-19
Posts: 5
Posted: Mon, 2004-04-19 19:13

All done. Works like a charm. Thanks again!

 
waffull
waffull's picture

Joined: 2002-09-07
Posts: 115
Posted: Tue, 2004-07-06 23:57

I'm a little confused about what this does.

Could someone post a link to their website that uses this hack?

Thank you,
Marc

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2004-07-07 01:33

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?

 
waffull
waffull's picture

Joined: 2002-09-07
Posts: 115
Posted: Wed, 2004-07-07 01:59

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

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2004-07-07 02:12

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

 
primedomain

Joined: 2002-11-09
Posts: 115
Posted: Sat, 2004-09-04 09:32
mindless wrote:
if (isset($save)) {

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

Quote:
---------- Find in Files ----------
"D:\sfnet\gallery\add_comment.php"(54,1):if (isset($save)) {
"D:\sfnet\gallery\edit_caption.php"(36,1):if (isset($save)) {
"D:\sfnet\gallery\edit_field.php"(36,1):if (isset($save)) {
"D:\sfnet\gallery\edit_watermark.php"(38,4): if (isset($save)) {
"D:\sfnet\gallery\modify_user.php"(32,1):if (isset($save)) {
"D:\sfnet\gallery\user_preferences.php"(36,1):if (isset($save)) {
"D:\sfnet\gallery\view_photo.php"(200,1):if (isset($save)) {
"D:\sfnet\gallery\watermark_album.php"(42,4): if (isset($save)) {
8 occurrences have been found.

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.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2004-09-04 15:50

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

 
primedomain

Joined: 2002-11-09
Posts: 115
Posted: Sat, 2004-09-04 19:08

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.

 
oceano

Joined: 2006-05-07
Posts: 41
Posted: Tue, 2006-07-04 16:21

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

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2006-07-04 18:49

Edit album and there is a hide album tickbox under the general tab.

Dave

 
oceano

Joined: 2006-05-07
Posts: 41
Posted: Tue, 2006-07-04 19:53

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

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2006-07-04 20:14

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

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2006-07-04 20:28

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

 
oceano

Joined: 2006-05-07
Posts: 41
Posted: Tue, 2006-07-04 22:42

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

 
kajutus

Joined: 2006-12-23
Posts: 29
Posted: Thu, 2007-03-08 17:18

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

 
neubeedoo

Joined: 2005-10-08
Posts: 14
Posted: Thu, 2007-03-08 20:15

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

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2007-03-08 21:36

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

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2007-03-11 00:26

files for 1.5.5pl1.
There is now a setting in edit properties "misc" tab. Hide from tree.

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
kajutus

Joined: 2006-12-23
Posts: 29
Posted: Sun, 2007-03-11 14:53

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

 
neubeedoo

Joined: 2005-10-08
Posts: 14
Posted: Mon, 2007-03-12 23:28

Thanks Dave -

I will try it after I attempt an update - thanks
- k

 
kajutus

Joined: 2006-12-23
Posts: 29
Posted: Wed, 2007-03-14 16:07

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 :-/

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2007-03-15 02:37

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

 
kajutus

Joined: 2006-12-23
Posts: 29
Posted: Thu, 2007-03-15 20:32

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

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2007-03-15 23:35
Quote:
i found the "bug" .. i have to change for every album

Glad you got it sorted.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team