Module: Tag Albums
rWatcher
Joined: 2005-09-06
Posts: 722 |
Posted: Fri, 2011-05-06 00:06 | |||
Here is the initial version of my Tag Albums module. It can be downloaded from this thread, or from my account on GitHub. This release has been tested against Gallery 3.0.1 with the default Wind theme only. Newer versions of Gallery and other themes may not work or may not work as well. Tag Albums has several features. When first installed, it will provide a sidebar link labeled "View Tag Albums". This link will allow visitors to the Gallery to browse through a list of all the tags. This list resembles separate sub-albums, one for each tag. Cover art for each "virtual album" is taken from the most recently uploaded photo/album/video for each tag. The photo pages that are accessed from within these "virtual albums" have been modified so that the previous / next buttons navigate within the virtual album instead of the album the photo is actually in, and "fake" breadcrumbs are created to further the illusion that the user is in a real album. Additionally, the module allows for real albums to be linked to the "View Tag Albums" page, via the edit album dialog so that when a user clicks into a specific album, they will be directed to the tag albums page instead of the albums contents. In addition to linking an album to the "View Tag Albums" page, this module also allows for albums to be linked to specific tag sub-albums or to virtual albums generated from combinations of tags. These virtual pages maintain breadcrumbs and previous / next buttons that maintain the appearance of being in the original album and copy the title, description, sort order from the album that linked to the page. To link an album to a dynamic page, follow these steps: To adjust tag links found elsewhere in the Gallery so that they point to the Tag Albums module, install / activate the "Module Order" module ( http://codex.gallery2.org/Gallery3:Modules:moduleorder ), then select Admin -> Settings -> Module order and move "Tag Albums" above Tags. This will cause all tag links (including the All Tags module) to point to Tag Album pages (Warning: Only tested with Gallery 3.0.1). ---
|
||||
Posts: 105
Very nice job. I like this a LOT. Very nice job. Would be nice to sort the "View Tag Albums" by count/instances of photos in addition to alphabetic too (not sure if this would be an alternate "link" to click on the page to change the sort or just make it an option in the Edit Album settings...
Posts: 693
I won't be able to test it for a few days, but my thanks also in anticipation.
U-G
Posts: 105
Undagiga...would be great to make your All Tags module able to detect this module and queue into the same calls...or just get an option on this module to display or not display the thumbnails. That, and I like how the All Tags module adds the link to the "View Tags" to the top menu bar (think more people will see it there too), not to the side bar...
Thanks!
Posts: 105
Wow...I just can't stop. How about also, when sorting alphabetically on the View Tag Albums, a quick skip index at the top or bottom of the page with the alphabet (actually a sorted list of the first character, since some may be special characters or numbers)? I have over 275 tags, so that is a lot of paging through things...Pretend like you are generating the separation from the Admin Tag page code.
Posts: 722
Glad you like it
There's an admin option to change the sort order: Admin -> Settings -> Tag Albums Settings, Select "Count" from the first drop down box to sort by number of items tagged.
Install / Activate the "Module Order" module ( http://codex.gallery2.org/Gallery3:Modules:moduleorder ), then select Admin -> Settings -> Module order and move "Tag Albums" above Tags. This will cause all tag links (including the All Tags module) to point to Tag Album pages (Warning: Only tested with Gallery 3.0.1).
Hmmm... I'll have to think about how best to accomplish something like that.
Posts: 105
Duh! I just saw that before you replied...Thanks!
Hum...interesting...let me give that a shot...thanks.
Posts: 225
Holy cow, you just created dynamic albums! I have one question, while I go and download and try this: does it preserve item permissions? As in, does it only show the pictures with tags that the user would be able to see to begin with?
Thanks,
Tomek
----
Publish on Gallery 3 (WLPG Plugin) | XMP Module
Posts: 722
Yes, it checks the permissions of the original photos / videos when populating a "virtual album" and when displaying photos / videos.
Posts: 225
Can I make a motion to have this be included as a core module? Cause this is just awesome.
----
Publish on Gallery 3 (WLPG Plugin) | XMP Module
Posts: 693
I am traveling at the moment and can't test this, but you can be sure that I am absolutely busting to. I wonder if the XML Sitemap module can pick up these virtual albums?
U-G
Posts: 693
First quick test - I'm very impressed. However I've got some formatting problems in Greydragon. Tomorrow I'll try to track these down.
U-G
Posts: 693
The file tag_albums.html.php contains the following statement:
I take it that page.html.php was taken from the Wind theme. So to get this to work properly in Greydragon, I gather I will need to construct my own version of tag_albums.html.php based on the Greydragon page.html.php with the extra tag albums code added in - Is this correct? If so, I wonder if there is some way that the module could be made to work out of the box with other themes?
This issue also applies to tag_albums_photo.html.php and perhaps other files.
These comments should not be taken as an unappreciative complaint. Far from it. I'm pleased to see that rWatcher has a coffee fund, which will get a top-up once I have this working.
U-G
Posts: 722
I don't know about making it work "out of the box" -- I had to do a few "non-standard" things to make this module work properly in the first place. I can probably tweak the code some to cut back on the number of custom view files, and at least make theming a little easier though, let me look into it.
Posts: 722
I think I've got everything working with Grey Dragon -- attached is an updated version of the module.
I've consolidated my "custom breadcrumbs" code down into a single file, so there are no longer custom versions of photo.html.php and movie.html.php, and I'm now using the same same breadcrumb html that the CalendarView module uses (a module that GreyDragon sorta supports).
I've created an updated version of Grey Dragon's calpage.html.php that properly supports breadcrumbs (so if you happen to use the CalendarView module, this'll make it's custom breadcrumbs work as well).
I've created a modified version of tag_albums_album.html.php for use with Grey Dragon.
I've created a modified version of Grey Dragon's paginator.html.php file so that it can generate proper "page #", "up" and first / last photo links for the dynamic albums, and inserted additional code into controllers/tag_albums.php to support this (as these links are not present on the standard theme they were not originally being generated).
Installation:
Copy the contents of tag_albums/greydragon/views into themes/greydragon/views then remove the tag_albums/greydragon folder. Delete the current modules/tag_albums folder and then replace it with the one in this zip file (to make sure the old view files all get removed). Otherwise this module installs as normal.
I don't normally use Grey Dragon, so let me know if anything still doesn't work properly with it.
Posts: 693
The navigation seems to be working but there's a problem in the formatting of the thumbs pages. I'll PM you some URLs on my test site to have a look at. I'm also debating how best to integrate it with my all tags module. There are two sorts of "all tags" - my module page and your tag albums - this needs thought on my part.
U-G
Posts: 722
I have pm'ed you a response, along with a link to my test Gallery. I'm not seeing the issues you're seeing in my Gallery. It may be that it's web browser specific (I've only tested with Chrome), or it may be related to me using a newer version of Grey Dragon then you. Let me know if you see the same issues in my test Gallery that you're seeing in yours.
Does my tag module URL fix help with that?
Posts: 693
Thanks for your thoughtful reply/PM. I'll do some more testing along the lines you suggested before I ask you to spend any more time on this. I am seeing blank pages on my laptop whereas I wasn't on my desktop, so there may be a combination of effects from caching and an older version of GD (I'm slow to upgrade because I need to test before I install new versions on my production site).
U-G
Posts: 722
Understood, it took me over a month of testing before I was ready to upgrade my production site from Gallery 3.0 to Gallery 3.0.1 Let me know how it works when you get the time to upgrade and do more testing.
Posts: 693
I have upgraded my test site to GD3.0.6 and once I resolved some caching issues it's working - thanks. You can take a look and see if you like. The only outstanding issue is that in a tag album (I think you call these sub-albums) the overlay for the thumbs is the file name rather than the title. I haven't had time to look into this today - tomorrow hopefully. I might then think about applying this to my production site. Is there a new version I can download that has the option to use my all tags module in the breadcrumb trail?
Thanks again.
U-G
p.s. I assume that this module will need updating if there are changes to the GD file album.html.php?
Posts: 2466
@rWatcher: I have looked at your changes to paginator and page.html
Few coments if I may...
* can you simply add your extra JS usual way instead of hardcoding it? yes, I know it would be loaded in any other pages, but then it is chached and loaded once in uniform way
* all this logic around breadcrumbs ... is there a posibility just properly populate $parent tree? in this case everything else would work just fine in any theme. what is so special about my logic versus wind theme? what am I missing?
Posts: 722
Oops, that's my fault, I set it to name instead of title... Fixed!
I'm finishing up a few other changes to the module as well. I hope to have a new finished version of the module uploaded later today.
Possibly, depending on what the actual changes are.
Posts: 722
This module doesn't use any JavaScript.
The issue with doing it this way is that $parent is supposed to correspond to a record in the items table -- it's a complete gallery "item" object, with fields and functions of its own. As my breadcrumbs don't actually correspond to any real gallery items, I'd have to create a fake item object with the same functions and column names to mimic a real Gallery item. I did this before and it broke during a Gallery upgrade, will look into it again though.
Your logic includes individual page numbers on album and photo pages and an "up to parent album" button which are both not present in wind theme. By default, these elements were being populated with links to the "real" parent album and it's contents instead of links to the dynamic page and its contents, which is what I modified paginator to deal with.
Posts: 2466
ok, then there is sync issue with 3.0.6 version of the theme then
I do not think that there is actual model validation in the paginator helper class nor in the breadcrumbs logic anywhere, so if $parent contains array of objects with required fields (which should be something like 2-3), any internal functionality would still work. I still hopeful that G3 team would provide us with more elegant solution.
ok, I need to check it further. I think we can come up with more generic way to define it.
Posts: 24
wow!
Posts: 722
Tag Albums Version 2 is now available
New: Added an admin option to allow for "filtering" the All Tags albums page. Users will see a list of click-able letters across the top of the page that they can click on to only show tag albums that start with that letter. This is off by default and must be turned on from the admin screen.
New: Added an admin option to replace the "All Tags" album view with either the "All Tags" module or the "Tag Cloud Page" module. Note: As these modules don't generate breadcrumbs, you won't get breadcrumbs on the all tags page if you do this. These modules must be installed separately in order to use this option. For more information on either module see:
http://codex.gallery2.org/Gallery3:Modules:tag_cloud_page
http://codex.gallery2.org/Gallery3:Modules:all_tags
NEW: Breadcrumbs for the current items parent album now contain position data -- when it's clicked, the page the photo was on will be loaded instead of page 1 -- this is how Gallery / Wind work.
Bug Fix: Viewing a photo/video through a virtual album will now increase it's view count.
Bug Fix: Display "Title" instead of "File Name" on thumbnails.
Bug Fix: Improved Info Module integration -- mousing over thumbnails now causes views and owner information to be displayed, like on a regular album page. Requires the Info module.
Theme Support:
- Works fine with Gallery 3.0.1 / Wind
- Works with Gallery 3.0.1 / Grey Dragon 3.0.6 with additional files -- Copy the contents of Theme Files\greydragon\views into your gallery/themes/greydragon/views folder. Afterwards the Theme Files folder can be deleted.
Posts: 722
I will look into doing this for the next version. I'm hoping I can "re-task" the class I created for displaying tags as albums to do this, it's already pretty item-like.
I've re-written a lot of my paginator modification in the new release. The "up" button override is already pretty generic (lines 187-195), it basically checks to see if a $parent_url variable is set and if found uses it instead of $parent->url(). I've also significantly simplified my "page numbering links" modification (lines 48-60), it still needs some more work to be completely generic, but something along these lines might work. Either that or maybe I could set a "$pagelist" array directly from the module?
http://github.com/rWatcher/gallery3-contrib/blob/master/3.0/modules/tag_albums/--%20Theme%20Files/greydragon/views/paginator.html.php
Posts: 105
Gahhh! Version 2 seems to have broken "Clean Canvas Wide" Theme. Funny, it was working before...
Posts: 722
According to the codex "Clean Canvas Wide" has been discontinued: http://codex.gallery2.org/Gallery3:Themes:clean_canvas_wide
As there is no download link, I can not provide support.
If you're using the current version of Clean Canvas (1.0.7) instead, extract the attached file and place it in your gallery/themes/cleancanvas/views directory and Tag Albums should start working properly again.
Posts: 693
Just some quick feedback to say that my first quick test indicates that all is well. Those with the URL to my test site can look and see.
I take it that this is the reason that, if I select the admin option to use the All Tags module for the breadcrumb trail, and then click on that link in the trail, I get a URL like
www.mysite.com/tag_albums.html?show=69
U-G
p.s. check your coffee fund
Posts: 105
Thanks! I didn't realize the wide version had expired. Looks like the merged 1.0.7 Clean Canvas fixed the IE9 picture jumping bug too!
Thanks again for great strides forward in tag-modules.
Jeff
P.S. Check your coffee fund! Now, if someone would just revise the server add module to store MD5 checksums of the photos, then compare against that entry before adding it would make my life complete and much easier to rescan with server add, directories for new changes.
Posts: 693
In case it wasn't clear from my last post, my many thanks also. It had been my intention for some time to have a go at this, or at least the navigation part, but it's clear to me from the above that I would have been out of my depth and had I started then it would have taken me a lot of time. So I really do appreciate what you've done - it saved me a lot of pain.
I'd like to think that this will prompt some changes in the core, by which I also mean the modules included in the install package. While virtual albums might be argued to be additional functionality, the changed navigation when viewing images with tags has fixed what I regard as a flaw in the standard package. I find it confusing that if I click on a tag link and then on one of the thumbs with that tag and start navigating from that resize image, I am in fact navigating in that image's album and sooner or later I will see images without the tag that I initially clicked on. This has been the biggest and most frequent complaint that I have had about the G3 version of my site. It really confuses people.
This module fixes that, but I hope the G3 team will re-examine ticket 1136 to see if some of your code could be included in the core and/or basic modules.
Again, thank you very much.
U-G
Posts: 722
You're welcome, I'm glad you like the module
Yes, that's correct. Although I suppose I don't need to set "show" if you're not displaying albums on "All Tags"... Fixed.
Cool, Thank You!
Posts: 722
You're welcome I'm glad it's working for you now.
Thank You!
Just did a quick look through of Gallery's module API -- generating and storing checksums as photos are added would be pretty easy. I'm not seeing anything that looks like it could be used to "reject" a duplicate photo before adding it though
Posts: 105
Yeah, I submitted a ticket 1432 for this 7 months ago, but haven't seen any response or action on it. I've seen the MD5 hash module, but don't know enough about modifying the core database tables to include the hash...once that was done, would think it should be relatively simple to reject/skip loading the file into the DB if a matching entry was already found...
There is a thread on this too.
Posts: 693
For those who haven't been reading other threads, this module removes the need to do this:
http://gallery.menalto.com/node/97132
But read the thread carefully as a couple of changes are needed for it to work correctly and not crash your gallery.
U-G
Posts: 722
I might be able to reject the file if I though a system error... I'm not sure if that would just reject the one file or crash server-add though. I'll have to experiment with the code some and get back to you.
Posts: 722
Cool, thanks for pointing that out.
You could probably also just upload an album cover via ftp, assuming you have direct access to the web server.
Posts: 693
I think that's right, but this is easier.
U-G
Posts: 693
I don't understand this, but even so, I wonder if a ticket might be raised asking for it?
It seems that there is still resistance to incorporating improved tag navigation into the core / standard modules.
U-G
Posts: 722
I opened a "custom breadcrumbs ticket" over a year ago:
http://sourceforge.net/apps/trac/gallery/ticket/1082
Posts: 693
I've found a problem. On my site I use Shadowbox with Greydragon - I click on a resize image and up pops a Shadowbox slideshow. If I do that on a resize image in a tag album then the slideshow runs based on the real album for the image that I clicked on and shows images without the tag. (Clearly not enough testing on my part.)
Related to this: One of the things that I like about Greydragon is image preloading - this can really speed up a gallery when you're going through the images sequentially. It seems to have been lost in these tag albums. I'll have a look at how this is done and see if we can restore it. Any suggestions welcome. I suspect that this is related to the Shadowbox issue.
I've put this module live on my production site and it all seems to be working, apart from the above. (Thanks again.) One thing that catches my eye are the URLs for the resize images, which are not exactly catchy. (I notice another thread about a similar issue in the experimental code.) Can anything be done about this?
U-G
Posts: 2466
this is another argument that any module should use default logic of the theme and not override it
Posts: 693
I would agree in most circumstances. But the additional functionality that this module provides is rather important to some of us. The core seems limited in the support it provides for dynamic albums at the moment. Do you anticipate Greydragon being able to support this module without theme overrides and without without core additions? If not, then what alternative is there to overriding the theme logic?
U-G
Posts: 722
Um, I think this photo.html.php fixes it. I'm not really sure _why_ it fixes it (I was only trying to fix image preloading so I guess shadowbox must use the same code), but as far as I can tell, shadowbox appears to work properly now... So, copy this into your greydragon/views folder and let me know how it works.
URLs: I could probably stick a file name at the end of the URL to make it look a little better, but beyond that I'm not sure that there's anything else I can do.
By providing this functionally now (with overrides) we can potentially figure out exactly what sorts of changes are required for proper support in the core product along with potential fixes (via overrides) which can then be brought to the attention of the core developers and hopefully resolved in a future release.
Additionally, different themes have different theme logic. The only "default" wind theme logic that I'm overriding is breadcrumbs (which will hopefully be fixed in the next release). There are so many different modules and themes available for Gallery 3 at this point, that I doubt it's possible to provide this kind of functionally without running to a compatibility issue with contributed code somewhere.
Posts: 693
Can I just clarify which "this" is "this"? There was nothing attached to your post and the version attached to the top post appears unchanged.
U-G
Posts: 722
Lets try that again... This should fix it.
Posts: 693
I'll do my part again .... YES - THAT WORKS - THANK YOU MUCHLY! It just proves how simple some things are, which can be surprising when you consider how hard some other things are.
U-G
Posts: 722
I've spent the last hour trying to get breadcrumbs working without using a special "page.html.php" file, and it is simply not do-able. In order for breadcrumbs to be displayed, the page must have an $item variable which, if found, is used at numerous locations throughout the page. As tags are not items, no usable item exists for tag albums. Creating a "fake" item, or using the root album as the item creates numerous other issues both on the page itself and for other modules that normally don't load on a dynamic page but that decide to load once $item is set.
Sorry, but I will have to stick with the current breadcrumb system for the time being
Posts: 693
So I take it that this confirms that we really need http://sourceforge.net/apps/trac/gallery/ticket/1082 addressed.
This thread has become rather long and (in places) technical. As a result some people will miss the need to use the Modules Order module to get the full benefits of Tag Albums, and also the benefits of Album Cover Browser. References to both are deeply buried in this thread. Can I suggest that you edit the top post to point to these modules?
U-G
Posts: 27300
undagiga,
One way to contribute to the community if you don't have the coding skills is to work on contributing to documentation.
Perhaps you can update http://codex.gallery2.org/Gallery3:Modules:tag_albums just log-in with your forums username and password and you can edit as you feel it needs. It frees up the developers to do what they do best.....code.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team