Thanks Alec for the favorites module. It brings a very usefull feature that many Gallery users were missing.
I installed version 2.2.4 and it fixed the issue Chris was experiencing:
Quote:
I can only remove the first photo (the rest don't show the link). If I delete that one then I can delete the next one and so on, but there is no way for me to delete the others out of order. If I click on a photo from the favourites folder to goto it's individual page I can remove the photo, but not from the album view.
For version 2.2.4, could you please release a new "module.inc" that prevents "Add to Favorites" from appearing on Album pages? Thank you, Alec!
reusta
Joined: 2008-02-11
Posts: 14
Posted: Mon, 2008-02-18 15:12
Thank you Alec for your quick reply.
I added your code at line 120. It does prevent Albums from beeing added to favorites, which is a valuable option.
What I want to achieve is a bit more: I do not want "Add to Favorites" to appear on Album pages at all, even not bellow photo thumnails. So not only my users will not be able to add entire albums to Favs, but they will have to visit the Photo Page in order to add that photo to their favs. This is because I don't want Item Actions to show in a drop down menu.
Idealy: while still preventing entire albums from being added to Favs, I would love to show "Add to Favorites" bellow photo thumbnails on album pages, but not in a drop down menu (see the photoshoped screenshots bellow for Album pages and for Favorites page.
[img]http://i269.photobucket.com/albums/jj69/reusta/favs_add.gif[/img][img]http://i269.photobucket.com/albums/jj69/reusta/favs_remove.gif[/img]
As you can see I also photoshoped a heart to the "Add" image and a striked out heart to the "Remove" image.
Is that doable? Thank you for your help!
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2008-02-18 15:30
I think you're asking for something similar to ckawalek was for the flashnifitiessource module I wrote, which, after a bit of discussion we decided was outside the simple scope of the gallery structure: in this case the "add/remove to favourites" is declared as an "itemLink", in module.inc - starting around line 120 - so it appears alongside all the other itemlinks wherever they appear. As far as I know there's no simple way to determine the context for the link at the time it is required to be declared by the gallery API, and so no basis exists for a decision on whether to withold its declaration.
Sorry!
(love the heart icon btw)
reusta
Joined: 2008-02-11
Posts: 14
Posted: Tue, 2008-02-19 02:01
Alec, thank you very much for your assistance.
I found a workaround that does what I needed. However by removing the ItemLinks from album.tpl I lost the "add to cart" on album pages bellow photo thumbnails, but that's not an issue for me.
Here is what I did:
1) Duplicated my matrix theme to create a new one I called matrixfavs
(Read: http://codex.gallery2.org/Gallery2:Themes:How_to_Copy_an_Existing_Theme)
2) Activated the matrixfavs theme (Site Admin>Plugins)
3) Removed the following line from album.tpl of my matrix theme:
{g->block type="core.ItemLinks" item=$child links=$child.itemLinks}
4) Linked the Favorites album to the matrixfavs theme (Site Admin>Favorites)
5) In modules/core/templates/blocks/: copied ItemLinks.tpl to a "local" folder and changed {g->text text="« item actions »"} to {g->text text="Choose Action..."}
6) I'm using the silk icon pack and wanted to add an icon to the Add to/Remove from Favorites on Photo pages.
So first I placed file heart.png (http://s269.photobucket.com/albums/jj69/reusta/?action=view¤t=heart.png) in /modules/icons/iconpacks/silk/
Second, I edited file /modules/icons/iconpacks/silk/icons.css, and added:
.gbLink-favourites_AddFavourite {
background: url(heart.png) left center no-repeat;
}
Voila.
There still is something I'd like to change in your module. Maybe you Alec, or someone else could help:
1) When adding a photo to favorites, instead of getting a page that reads "photo added to favorites.", I'd like the user to automatically jump to his favorites album.
2) When removing a photo from favorites, instead of getting a page that reads "photo removed from favorites.", I'd like the user to stay in his favorites album (or jump to the root album in case no favorite remains).
The messages "photo added" and "photo removed" should now be some sort of alert box or ajax wich may be complicated to code. But after all those messages are not mendatory.
puwtest
Joined: 2007-11-15
Posts: 30
Posted: Wed, 2008-03-12 15:54
Alec:
Thanks for your removing the (mistaken) dependence on dynamicalbum module. I've got some another questions.
1. Is it possible to show just 4 items next to oneself in Fav. album? This is just because my website have got the strict width and if the fav album shows more than 4 items in one row, it's going to be disorder.
2. I can't see the new "top10 favourites block". Actually I don't understand what's going on. Can you explain me, where I can find this option? Thanks
3. I agree with reusta's questions and I think it could be good to have it:
Quote:
There still is something I'd like to change in your module. Maybe you Alec, or someone else could help:
1) When adding a photo to favorites, instead of getting a page that reads "photo added to favorites.", I'd like the user to automatically jump to his favorites album.
2) When removing a photo from favorites, instead of getting a page that reads "photo removed from favorites.", I'd like the user to stay in his favorites album (or jump to the root album in case no favorite remains).
The messages "photo added" and "photo removed" should now be some sort of alert box or ajax wich may be complicated to code. But after all those messages are not mendatory.
Thank you Alec for your support! I really appreciate it.
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-03-12 16:17
Hi puwtest
1 - the display is up to your theme - you should be able to set the theme settings for the favourites album in the admin page. So if your theme allows you to restrict, say to three items in a row then you should be able to do just that, but it's not something that is or can be controlled by the plugin
2 - It's a piece of private code that I use on one of my sites, and probably shouldn't have been included in a public release. It scrolls the logged-in user's first 10 marked favourites across the page, using a javascript library for the animation.
I have an $isItRoot set somewhere in the album view, so I can display it on the front page of the album by including this:
You might be able to get it to do something interesting on your site, depending on your theme, but if not, just ignore it.
3 - (1) Edit the AddFavourite.inc file, round about line 68, where it declares the (delegated) next view for the AddFavourite controller. Try changing the declared view to favourites.FavouritesAlbum
3 - (2) ditto - if you want different behaviours for add and remove favourites (or if the favourites album is empty) then extend the php round line 68 to test for your desired conditions and set the 'view' element in the $results['delegate'] array appropriately.
Ajax is beyond me, I'm afraid - the Gallery framework doesn't support it very easily.
Let me know how you get on.
Guevara666
Joined: 2008-04-03
Posts: 1
Posted: Thu, 2008-04-03 19:04
Hello,
I need your help: I want to add a link for add (remove) to favourites in the photo.tpl. I used this code:
{if ($theme.itemLinks)}
{foreach from=$theme.itemLinks item=item}
{if $item.moduleId == "favourites"}
<a href="{g->url params=$item.params}">{$item.text}</a> |
{/if}
{/foreach}
{/if}
The link should be below the microthumbs, above the additional blocks like exif, viewcomments, addcomment. But when I add the link, the blocks below aren´t shown any more...? What´s wrong with my code for favourites?
Thanks,
Guevara
bentr7040
Joined: 2004-08-02
Posts: 61
Posted: Mon, 2008-04-07 19:58
alecmeyers, Hey many many thanks for great work on this module. been waiting for this for soo long!! Thanks much
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2008-04-07 20:03
Guevara666: I'm sorry, I'm not really sure what you're trying to do, or what the problem is. Maybe a screenshot would help? You haven't said what theme you're using, either.
bentr7040
Joined: 2004-08-02
Posts: 61
Posted: Fri, 2008-04-18 19:44
Alec,
a question: When click "add photo to favorite", Is there a way to keep user stay at the photo rather redirect to the page indicate"photo added to favorite"??
Many thanks for the great module!!
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-04-19 16:26
Probably...
try changing the AddFavourite.inc file at line 72 from: $results['redirect'] = array ('view' => 'favourites.AddFavourite', 'itemId' => $itemId);
Thanks for the module, I've been looking for something like this for a long time. I have a feature suggestion. It would be cool if a user could optionally share their favorites with other users (perhaps a configurable list of users)?
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-05-03 08:02
hogalot wrote:
Hey,
Thanks for the module, I've been looking for something like this for a long time. I have a feature suggestion. It would be cool if a user could optionally share their favorites with other users (perhaps a configurable list of users)?
Interesting idea. Could you perhaps mock up a screen shot for how you'd want the extra pages/options to look?
gatorjim
Joined: 2008-05-16
Posts: 3
Posted: Fri, 2008-05-16 13:56
Thanks for your efforts in developing this module...it's what I was looking for (the cart features, although useful, don't address this as easily as your module). One feature that would be desirable is the ability to remove all the photos in favorites with one operation. As it is now (but I might have missed it) you have to delete each photo one-by-one. This would be useful if someone has built a gallery of favorites for a specific set of photos. When they are ready to move on to a different set of photos, all the current images in favorites need to be removed. Thanks for considering this.
Sounds a bit complicated, but hopefully someone will come up with a solution. Thanks again for your efforts.
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Sat, 2008-05-17 23:55
The reason I want an answer is because I'd like to have "empty my favourites" (or whatever it's called) as an itemLink, one that appears in the favourites album view only (i.e. you only see it when you're looking at the favourites collection). I don't want it to appear under every single item in every single view alongside "add to favourites", and I don't want it as a systemLink in the header either. But I can't see a way to make this happen. I could create a block that you can add to your pages manually just for that one command but that's really clumsy and ugly. Do you have any bright ideas as to where else I could have the it appear?
gatorjim
Joined: 2008-05-16
Posts: 3
Posted: Sun, 2008-05-18 13:46
Agree it should only show when viewing the favorites album. I would think placing it at the right end of the row just above the thumbs (i.e., the one that starts with "Favorites:username") would make the most sense. I don't know much about the code behind Gallery...can you put a conditional block (or whatever its called) in that row? I assume trying to do that is what led to your question above. The other location would be placing a "clumsy, ugly" block in the sidebar, but I've noticed that item actions don't show up there when you are viewing a keyword album, or the favorites album, so that might not work either. If it did, it would then show up when viewing keyword albums as well. Wish I knew more about the coding so as to offer better suggestions.
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-05-28 11:45
This module is now in the community repository, so you can/should download it from the more plugins page.
I've added a 'clear favourites' command, too - visible from the favourites album.
nicdj
Joined: 2008-06-09
Posts: 1
Posted: Mon, 2008-06-09 11:06
Hi,
Just wanted to say thanks for this module. Been watching and testing this one for a while. My only issue was needing a method of returning to the last view when adding to favourites. I found this snippet of code which when added gives me the desired result. Hopefully it'll be useful to someone!
Note: I commented out the redirect on line 83 and added the two new lines shown.
Good idea... you omitted to mention that should be in file addFavourite.inc, though!
bentr7040
Joined: 2004-08-02
Posts: 61
Posted: Thu, 2008-06-19 23:20
Hi everybody, This favorite module is great, However, one issue I can't figure how: If I'm on the favorite view, I can not go back to the album through the breadcrumb line, maybe I overlooked, but I don't find any info in the discussion? anyone can give me suggestion? Thanks
bentr7040
Joined: 2004-08-02
Posts: 61
Posted: Fri, 2008-06-20 20:25
I think I need to edit FavouritesAlbum.inc , but just don't know what to change.....
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2008-06-20 22:11
Hi
I'm not sure how you can expect to go back to anywhere on the breadcrumb line except the Root as the favourites album is not a sub-album of any other album. Therefore I believe the correct breadcrumb to display is <<Root Album Name>> / Favourites: <<user Name>> which is what is displayed.
bentr7040
Joined: 2004-08-02
Posts: 61
Posted: Fri, 2008-06-20 23:39
he correct breadcrumb to display is <<Root Album Name>> / Favourites: <<user Name>> which is what is displayed.
Quote:
Hi Alec, Thanks for reply. I thought it should display that way too, but mine only shown Favourites: <<user Name>> . So that's why user can not go back to their album from Favourite page.
Ben
bentr7040
Joined: 2004-08-02
Posts: 61
Posted: Fri, 2008-06-20 23:41
Sorry, wrong quote marks on the last post. Ben
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2008-06-20 23:47
Hi Ben,
I'm not sure why that should be. It works ok out-of-the-box for both the Matrix and Siriux themes, the two with which I have some experience. Try switching to one of those first, to see if it works. I suspect it's a function of how your theme is written and therefore not something that can be altered from within the favourites module.
Try also the Dynamic Albums module that has three further dynamic albums (updates/random/popular) from which the Favourites module was derived and see if they behave the same way. Dynamic Albums module was written by one of the core developers and is pretty much canonical for this kind of dynamic album.
hogalot
Joined: 2005-10-06
Posts: 13
Posted: Mon, 2008-06-30 16:30
Alec, Sorry for the delay in responding. I was thinking of having a shared favorites link. When you press on the link it would allow you to maintain a list of user names (to share your favorites) and a list of user favorites that have been shared with you. Would you want a mock up as an image?
Also, a silly question...how do you remove an album from your favorites? On my server the link stays as add album to favorites and there doesn't seem to be any way to remove the album from favorites as either a user or administrator. The images work fine. Or as an alternative...how do you prevent users from adding albums to their favorites?
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2008-06-30 16:38
Interesting... add/remove seems to work fine for albums for me! Want to send me a link to your site so I can try it?
Shared favourites: would need a considerable extension to the module, I'm not sure I have time for it at the moment. Send me a mockup by all means though.
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Mon, 2008-06-30 19:29
OK, just for the benefit of anyone following, it was a caching issue that was solved by reducing the Gallery acceleration level from partial to none.
tlmothy
Joined: 2005-11-10
Posts: 41
Posted: Thu, 2008-08-14 22:00
Great module, but I think you should be able to see other users favorites. Maybe add a link within a users main album? Or a drop down menu somewhere.
What do you guys think?
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2008-08-15 10:37
I'm unlikely to add this feature because it's not one I want to use - but feel free to add it yourself and send me the modifications, and I'll have a look.
giorgos
Joined: 2002-08-19
Posts: 115
Posted: Thu, 2008-08-28 04:16
It uses high CPU utilization (apache 80-100%) and takes more than 10 seconds to respond. That behavior is noticed only in favorites module.
Any idea what is causing that?
It uses high CPU utilization (apache 80-100%) and takes more than 10 seconds to respond. That behavior is noticed only in favorites module.
Any idea what is causing that?
Sorry - no clue.
If you narrow it down a bit more (doing what, exactly, causes the load? What do you mean by "in favorites module"? how many favourite images are you displaying? how many people?) that would help.
giorgos
Joined: 2002-08-19
Posts: 115
Posted: Thu, 2008-08-28 09:44
I know the information is insufficient for troubleshooting. I just thought that might be a clue or a tip for such a behavior
when I click on favorites link as logged in user(my favorites)it takes long time to load. As a guest there is no issue.
there are only 5 users that have some favorites. http://www.dailyalbum.com/albums/favourites
great feature! especially along with the blocks like the "top 10"!
after installing I can chose "add to favorites" and "favorites" appears in the admin-menu. but then trying to access the dynamic album via the "favorites"-link there I get an "internal server error".
are there any inconsistencies known? do I need url-rewrite to be activated? or is it a bug?
I use
favorites 0.2.4
and
Gallery version = 2.2.6 core 1.2.0.8
PHP version = 5.0.5 cgi
Webserver = Apache/1.3.33 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7d SE/0.5.2
Database = mysqlt 4.1.22-standard-log, lock.system=flock
Operating system = Linux hex14.freehostia.com 2.6.24.3-SE #6 SMP Sun Mar 9 09:58:43 GMT 2008 i686
Default theme = nature
gettext = enabled
Locale = en_GB
Browser = Mozilla/5.
thanks already for hints!
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2008-09-24 17:10
No bugs or inconsistencies that I know of, no. And no, no need for url-rewrites.
The block isn't what you think - it was a bit of private code that snuck in when it shouldn't have. But apart from that, it should be fine.
lerone
Joined: 2008-09-22
Posts: 16
Posted: Mon, 2008-09-29 16:24
thanks for reply! – by now i assume the problem originally stems from a server with "safe mode" and outdated system features. I will check soon on an appropriate server. in case this really was the root-cause, sorry for the stir.
I will give feedback later to verify.
Carpcatcher
Joined: 2004-02-02
Posts: 92
Posted: Tue, 2008-11-18 00:05
is it possible to show ALL pictures from multiple users ?
normaly these are the special and better looked pictures (best of)
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2008-11-18 09:08
Quote:
is it possible to show ALL pictures from multiple users ?
The usual answer for "is it possible..." type queries for Gallery: No, unless you rewrite the code, in which case anything is possible.
Jigoro
Joined: 2005-09-12
Posts: 14
Posted: Tue, 2009-01-27 04:39
Hello,
I love this module, but I have a stupid question... How can you specify the order in which the pictures are displayed in the favourites album? I would like to see them sorted by date, but I can't find a place where to specify it... If not possible, what is the default sorting order?
Thanks!
alecmyers
Joined: 2006-08-01
Posts: 4342
Posted: Tue, 2009-01-27 08:55
Not a stupid question.
There's no specific order, I think it probably works out to the order they were picked in, latest first.
To sort by date you will need to modify function fetchFavourites(...) in modules/favourites/classes/FavouritesMapHelper.class.
At present that function uses GalleryCoreApi::getMapEntry(...). To sort by date you'd need to rewrite that as a SQL query (see further down the same file, eg function fetchUsersWithFavourites() and fetchUsernamesWithFavouritesLike(...) for inspiration) because you'll need to JOIN the relevant table in the db that has the date and use an ORDER BY clause. You can put an ORDER BY clause in a call to getMapEntry but you can't join a second table - hence the need to build the query manually.
Jigoro
Joined: 2005-09-12
Posts: 14
Posted: Tue, 2009-01-27 10:52
Great, thank you for the answer. I will try this and post the query here if I am successful
Jigoro
Joined: 2005-09-12
Posts: 14
Posted: Wed, 2009-01-28 02:36
Here is the mod, if other people are interested:
--- FavouritesMapHelper.class.ori 2009-01-28 03:35:29.000000000 +0100
+++ FavouritesMapHelper.class 2009-01-28 03:33:08.000000000 +0100
@@ -36,9 +36,20 @@
function fetchFavourites ($userId) {
global $gallery;
- list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('FavouritesMap',
- array('itemId'),
- array('userId' => $userId));
+// --- Hack to sort items by date ---
+// list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('FavouritesMap',
+// array('itemId'),
+// array('userId' => $userId));
+ $query = 'SELECT
+ [GalleryFavouritesMap::itemId]
+ FROM [GalleryFavouritesMap]
+ INNER JOIN [GalleryItem]
+ ON [GalleryFavouritesMap::itemId] = [GalleryItem::id]
+ WHERE [GalleryFavouritesMap::userId] = ?
+ ORDER BY [GalleryItem::originationTimestamp]
+ ';
+ list($ret, $searchResults) = $gallery->search($query,array($userId));
+// --- / end of hack ---
if ($ret) {
return array($ret, null);
}
Carpcatcher
Joined: 2004-02-02
Posts: 92
Posted: Wed, 2009-02-18 21:26
serbanc wrote:
installed yesterday... great module!
also developed a small block that can be added on the photo/album pages, that displays the list of users that added that item to their favourites.
also a romanian .po translation.
new files attached in a zip; does not require modification to existing module files.
Hi this is a cool add-on,
but is it also possible to view instate of the useralbum the users favourites ?
stark1974
Joined: 2009-06-17
Posts: 1
Posted: Wed, 2009-06-17 17:21
Great module - thanks!
A really minor thing... How can I remove the colon after the word 'Favorites' in the breadcrumb trail (ie. it shows up as "Favorites:")? I've tried looking at module.inc and can't find it anywhere there, unless I'm missing something.
Posts: 314
cool!
Saw that you put also a top10 favourites block!
serbanc - www.e-poze.ro
Posts: 14
Thanks Alec for the favorites module. It brings a very usefull feature that many Gallery users were missing.
I installed version 2.2.4 and it fixed the issue Chris was experiencing:
For version 2.2.4, could you please release a new "module.inc" that prevents "Add to Favorites" from appearing on Album pages? Thank you, Alec!
Posts: 14
Thank you Alec for your quick reply.
I added your code at line 120. It does prevent Albums from beeing added to favorites, which is a valuable option.
What I want to achieve is a bit more: I do not want "Add to Favorites" to appear on Album pages at all, even not bellow photo thumnails. So not only my users will not be able to add entire albums to Favs, but they will have to visit the Photo Page in order to add that photo to their favs. This is because I don't want Item Actions to show in a drop down menu.
Idealy: while still preventing entire albums from being added to Favs, I would love to show "Add to Favorites" bellow photo thumbnails on album pages, but not in a drop down menu (see the photoshoped screenshots bellow for Album pages and for Favorites page.
[img]http://i269.photobucket.com/albums/jj69/reusta/favs_add.gif[/img][img]http://i269.photobucket.com/albums/jj69/reusta/favs_remove.gif[/img]
As you can see I also photoshoped a heart to the "Add" image and a striked out heart to the "Remove" image.
Is that doable? Thank you for your help!
Posts: 4342
I think you're asking for something similar to ckawalek was for the flashnifitiessource module I wrote, which, after a bit of discussion we decided was outside the simple scope of the gallery structure: in this case the "add/remove to favourites" is declared as an "itemLink", in module.inc - starting around line 120 - so it appears alongside all the other itemlinks wherever they appear. As far as I know there's no simple way to determine the context for the link at the time it is required to be declared by the gallery API, and so no basis exists for a decision on whether to withold its declaration.
Sorry!
(love the heart icon btw)
Posts: 14
Alec, thank you very much for your assistance.
I found a workaround that does what I needed. However by removing the ItemLinks from album.tpl I lost the "add to cart" on album pages bellow photo thumbnails, but that's not an issue for me.
Here is what I did:
1) Duplicated my matrix theme to create a new one I called matrixfavs
(Read: http://codex.gallery2.org/Gallery2:Themes:How_to_Copy_an_Existing_Theme)
2) Activated the matrixfavs theme (Site Admin>Plugins)
3) Removed the following line from album.tpl of my matrix theme:
{g->block type="core.ItemLinks" item=$child links=$child.itemLinks}
4) Linked the Favorites album to the matrixfavs theme (Site Admin>Favorites)
5) In modules/core/templates/blocks/: copied ItemLinks.tpl to a "local" folder and changed {g->text text="« item actions »"} to {g->text text="Choose Action..."}
6) I'm using the silk icon pack and wanted to add an icon to the Add to/Remove from Favorites on Photo pages.
So first I placed file heart.png (http://s269.photobucket.com/albums/jj69/reusta/?action=view¤t=heart.png) in /modules/icons/iconpacks/silk/
Second, I edited file /modules/icons/iconpacks/silk/icons.css, and added:
.gbLink-favourites_AddFavourite {
background: url(heart.png) left center no-repeat;
}
Voila.
There still is something I'd like to change in your module. Maybe you Alec, or someone else could help:
1) When adding a photo to favorites, instead of getting a page that reads "photo added to favorites.", I'd like the user to automatically jump to his favorites album.
2) When removing a photo from favorites, instead of getting a page that reads "photo removed from favorites.", I'd like the user to stay in his favorites album (or jump to the root album in case no favorite remains).
The messages "photo added" and "photo removed" should now be some sort of alert box or ajax wich may be complicated to code. But after all those messages are not mendatory.
Posts: 30
Alec:
Thanks for your removing the (mistaken) dependence on dynamicalbum module. I've got some another questions.
1. Is it possible to show just 4 items next to oneself in Fav. album? This is just because my website have got the strict width and if the fav album shows more than 4 items in one row, it's going to be disorder.
2. I can't see the new "top10 favourites block". Actually I don't understand what's going on. Can you explain me, where I can find this option? Thanks
3. I agree with reusta's questions and I think it could be good to have it:
Thank you Alec for your support! I really appreciate it.
Posts: 4342
Hi puwtest
1 - the display is up to your theme - you should be able to set the theme settings for the favourites album in the admin page. So if your theme allows you to restrict, say to three items in a row then you should be able to do just that, but it's not something that is or can be controlled by the plugin
2 - It's a piece of private code that I use on one of my sites, and probably shouldn't have been included in a public release. It scrolls the logged-in user's first 10 marked favourites across the page, using a javascript library for the animation.
I have an $isItRoot set somewhere in the album view, so I can display it on the front page of the album by including this:
You might be able to get it to do something interesting on your site, depending on your theme, but if not, just ignore it.
3 - (1) Edit the AddFavourite.inc file, round about line 68, where it declares the (delegated) next view for the AddFavourite controller. Try changing the declared view to favourites.FavouritesAlbum
3 - (2) ditto - if you want different behaviours for add and remove favourites (or if the favourites album is empty) then extend the php round line 68 to test for your desired conditions and set the 'view' element in the $results['delegate'] array appropriately.
Ajax is beyond me, I'm afraid - the Gallery framework doesn't support it very easily.
Let me know how you get on.
Posts: 1
Hello,
I need your help: I want to add a link for add (remove) to favourites in the photo.tpl. I used this code:
{if ($theme.itemLinks)}
{foreach from=$theme.itemLinks item=item}
{if $item.moduleId == "favourites"}
<a href="{g->url params=$item.params}">{$item.text}</a> |
{/if}
{/foreach}
{/if}
The link should be below the microthumbs, above the additional blocks like exif, viewcomments, addcomment. But when I add the link, the blocks below aren´t shown any more...? What´s wrong with my code for favourites?
Thanks,
Guevara
Posts: 61
alecmeyers, Hey many many thanks for great work on this module. been waiting for this for soo long!! Thanks much
Posts: 4342
Guevara666: I'm sorry, I'm not really sure what you're trying to do, or what the problem is. Maybe a screenshot would help? You haven't said what theme you're using, either.
Posts: 61
Alec,
a question: When click "add photo to favorite", Is there a way to keep user stay at the photo rather redirect to the page indicate"photo added to favorite"??
Many thanks for the great module!!
Posts: 4342
Probably...
try changing the AddFavourite.inc file at line 72 from:
$results['redirect'] = array ('view' => 'favourites.AddFavourite', 'itemId' => $itemId);
to
$results['redirect'] = array ('view' => 'core.ShowItem', 'itemId' => $itemId);
Posts: 61
Alec, thanks. It works!
Posts: 13
Hey,
Thanks for the module, I've been looking for something like this for a long time. I have a feature suggestion. It would be cool if a user could optionally share their favorites with other users (perhaps a configurable list of users)?
Posts: 4342
Interesting idea. Could you perhaps mock up a screen shot for how you'd want the extra pages/options to look?
Posts: 3
Thanks for your efforts in developing this module...it's what I was looking for (the cart features, although useful, don't address this as easily as your module). One feature that would be desirable is the ability to remove all the photos in favorites with one operation. As it is now (but I might have missed it) you have to delete each photo one-by-one. This would be useful if someone has built a gallery of favorites for a specific set of photos. When they are ready to move on to a different set of photos, all the current images in favorites need to be removed. Thanks for considering this.
Posts: 4342
Good idea. Let me work on it.
OK - I've looked into it. I need an answer to this question (http://gallery.menalto.com/node/77724) before I can implement it.
Posts: 3
Sounds a bit complicated, but hopefully someone will come up with a solution. Thanks again for your efforts.
Posts: 4342
The reason I want an answer is because I'd like to have "empty my favourites" (or whatever it's called) as an itemLink, one that appears in the favourites album view only (i.e. you only see it when you're looking at the favourites collection). I don't want it to appear under every single item in every single view alongside "add to favourites", and I don't want it as a systemLink in the header either. But I can't see a way to make this happen. I could create a block that you can add to your pages manually just for that one command but that's really clumsy and ugly. Do you have any bright ideas as to where else I could have the it appear?
Posts: 3
Agree it should only show when viewing the favorites album. I would think placing it at the right end of the row just above the thumbs (i.e., the one that starts with "Favorites:username") would make the most sense. I don't know much about the code behind Gallery...can you put a conditional block (or whatever its called) in that row? I assume trying to do that is what led to your question above. The other location would be placing a "clumsy, ugly" block in the sidebar, but I've noticed that item actions don't show up there when you are viewing a keyword album, or the favorites album, so that might not work either. If it did, it would then show up when viewing keyword albums as well. Wish I knew more about the coding so as to offer better suggestions.
Posts: 4342
This module is now in the community repository, so you can/should download it from the more plugins page.
I've added a 'clear favourites' command, too - visible from the favourites album.
Posts: 1
Hi,
Just wanted to say thanks for this module. Been watching and testing this one for a while. My only issue was needing a method of returning to the last view when adding to favourites. I found this snippet of code which when added gives me the desired result. Hopefully it'll be useful to someone!
Note: I commented out the redirect on line 83 and added the two new lines shown.
/** $results['redirect'] = array ('view' => 'favourites.AddFavourite', 'itemId' => $itemId); */
$returnUrl = GalleryUtilities::getRequestVariables('return');
$results['redirect']['href'] = $returnUrl;
Posts: 4342
Good idea... you omitted to mention that should be in file addFavourite.inc, though!
Posts: 61
Hi everybody, This favorite module is great, However, one issue I can't figure how: If I'm on the favorite view, I can not go back to the album through the breadcrumb line, maybe I overlooked, but I don't find any info in the discussion? anyone can give me suggestion? Thanks
Posts: 61
I think I need to edit FavouritesAlbum.inc , but just don't know what to change.....
Posts: 4342
Hi
I'm not sure how you can expect to go back to anywhere on the breadcrumb line except the Root as the favourites album is not a sub-album of any other album. Therefore I believe the correct breadcrumb to display is <<Root Album Name>> / Favourites: <<user Name>> which is what is displayed.
Posts: 61
he correct breadcrumb to display is <<Root Album Name>> / Favourites: <<user Name>> which is what is displayed.
Posts: 61
Sorry, wrong quote marks on the last post. Ben
Posts: 4342
Hi Ben,
I'm not sure why that should be. It works ok out-of-the-box for both the Matrix and Siriux themes, the two with which I have some experience. Try switching to one of those first, to see if it works. I suspect it's a function of how your theme is written and therefore not something that can be altered from within the favourites module.
Try also the Dynamic Albums module that has three further dynamic albums (updates/random/popular) from which the Favourites module was derived and see if they behave the same way. Dynamic Albums module was written by one of the core developers and is pretty much canonical for this kind of dynamic album.
Posts: 13
Alec, Sorry for the delay in responding. I was thinking of having a shared favorites link. When you press on the link it would allow you to maintain a list of user names (to share your favorites) and a list of user favorites that have been shared with you. Would you want a mock up as an image?
Also, a silly question...how do you remove an album from your favorites? On my server the link stays as add album to favorites and there doesn't seem to be any way to remove the album from favorites as either a user or administrator. The images work fine. Or as an alternative...how do you prevent users from adding albums to their favorites?
Posts: 4342
Interesting... add/remove seems to work fine for albums for me! Want to send me a link to your site so I can try it?
Shared favourites: would need a considerable extension to the module, I'm not sure I have time for it at the moment. Send me a mockup by all means though.
Posts: 4342
OK, just for the benefit of anyone following, it was a caching issue that was solved by reducing the Gallery acceleration level from partial to none.
Posts: 41
Great module, but I think you should be able to see other users favorites. Maybe add a link within a users main album? Or a drop down menu somewhere.
What do you guys think?
Posts: 4342
I'm unlikely to add this feature because it's not one I want to use - but feel free to add it yourself and send me the modifications, and I'll have a look.
Posts: 115
It uses high CPU utilization (apache 80-100%) and takes more than 10 seconds to respond. That behavior is noticed only in favorites module.
Any idea what is causing that?
Gallery version = 2.2.5 core 1.2.0.7
PHP version = 5.2.5 apache2handler
Webserver = Apache
Database = mysqli 5.0.51a, lock.system=flock
Toolkits = Exif, LinkItemToolkit, Ffmpeg, Gd, NetPBM, ArchiveUpload, ImageMagick, Thumbnail
Acceleration = full/86400, partial/43200
http://www.dailyalbum.com
Posts: 4342
Sorry - no clue.
If you narrow it down a bit more (doing what, exactly, causes the load? What do you mean by "in favorites module"? how many favourite images are you displaying? how many people?) that would help.
Posts: 115
I know the information is insufficient for troubleshooting. I just thought that might be a clue or a tip for such a behavior
when I click on favorites link as logged in user(my favorites)it takes long time to load. As a guest there is no issue.
there are only 5 users that have some favorites.
http://www.dailyalbum.com/albums/favourites
For displaying dynamic albums for example there is no much delay.
http://www.dailyalbum.com/albums/updates
Sorry but I can’t think of anything else for the moment that can helps.
Posts: 4342
It's a pretty basic db query to fetch the favourites list, and the table is correctly keyed, so I don't think I can be of much help.
MySQL has a facility for logging slow queries that you could investigate.
Posts: 115
Thanks alecmyers. I will check.
http://www.dailyalbum.com
Posts: 16
hey,
great feature! especially along with the blocks like the "top 10"!
after installing I can chose "add to favorites" and "favorites" appears in the admin-menu. but then trying to access the dynamic album via the "favorites"-link there I get an "internal server error".
are there any inconsistencies known? do I need url-rewrite to be activated? or is it a bug?
I use
favorites 0.2.4
and
Gallery version = 2.2.6 core 1.2.0.8
PHP version = 5.0.5 cgi
Webserver = Apache/1.3.33 (Unix) mod_ssl/2.8.22 OpenSSL/0.9.7d SE/0.5.2
Database = mysqlt 4.1.22-standard-log, lock.system=flock
Operating system = Linux hex14.freehostia.com 2.6.24.3-SE #6 SMP Sun Mar 9 09:58:43 GMT 2008 i686
Default theme = nature
gettext = enabled
Locale = en_GB
Browser = Mozilla/5.
thanks already for hints!
Posts: 4342
No bugs or inconsistencies that I know of, no. And no, no need for url-rewrites.
The block isn't what you think - it was a bit of private code that snuck in when it shouldn't have. But apart from that, it should be fine.
Posts: 16
thanks for reply! – by now i assume the problem originally stems from a server with "safe mode" and outdated system features. I will check soon on an appropriate server. in case this really was the root-cause, sorry for the stir.
I will give feedback later to verify.
Posts: 92
is it possible to show ALL pictures from multiple users ?
normaly these are the special and better looked pictures (best of)
Posts: 4342
The usual answer for "is it possible..." type queries for Gallery: No, unless you rewrite the code, in which case anything is possible.
Posts: 14
Hello,
I love this module, but I have a stupid question... How can you specify the order in which the pictures are displayed in the favourites album? I would like to see them sorted by date, but I can't find a place where to specify it... If not possible, what is the default sorting order?
Thanks!
Posts: 4342
Not a stupid question.
There's no specific order, I think it probably works out to the order they were picked in, latest first.
To sort by date you will need to modify function fetchFavourites(...) in modules/favourites/classes/FavouritesMapHelper.class.
At present that function uses GalleryCoreApi::getMapEntry(...). To sort by date you'd need to rewrite that as a SQL query (see further down the same file, eg function fetchUsersWithFavourites() and fetchUsernamesWithFavouritesLike(...) for inspiration) because you'll need to JOIN the relevant table in the db that has the date and use an ORDER BY clause. You can put an ORDER BY clause in a call to getMapEntry but you can't join a second table - hence the need to build the query manually.
Posts: 14
Great, thank you for the answer. I will try this and post the query here if I am successful
Posts: 14
Here is the mod, if other people are interested:
--- FavouritesMapHelper.class.ori 2009-01-28 03:35:29.000000000 +0100
+++ FavouritesMapHelper.class 2009-01-28 03:33:08.000000000 +0100
@@ -36,9 +36,20 @@
function fetchFavourites ($userId) {
global $gallery;
- list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('FavouritesMap',
- array('itemId'),
- array('userId' => $userId));
+// --- Hack to sort items by date ---
+// list ($ret, $searchResults) = GalleryCoreApi::getMapEntry('FavouritesMap',
+// array('itemId'),
+// array('userId' => $userId));
+ $query = 'SELECT
+ [GalleryFavouritesMap::itemId]
+ FROM [GalleryFavouritesMap]
+ INNER JOIN [GalleryItem]
+ ON [GalleryFavouritesMap::itemId] = [GalleryItem::id]
+ WHERE [GalleryFavouritesMap::userId] = ?
+ ORDER BY [GalleryItem::originationTimestamp]
+ ';
+ list($ret, $searchResults) = $gallery->search($query,array($userId));
+// --- / end of hack ---
if ($ret) {
return array($ret, null);
}
Posts: 92
Hi this is a cool add-on,
but is it also possible to view instate of the useralbum the users favourites ?
Posts: 1
Great module - thanks!
A really minor thing... How can I remove the colon after the word 'Favorites' in the breadcrumb trail (ie. it shows up as "Favorites:")? I've tried looking at module.inc and can't find it anywhere there, unless I'm missing something.
Help appreciated