Module: Ratings

jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2012-05-29 01:23

A simple photo ratings module - See full details here

It can be found here

CURRENT VERSION: v15


We need help from you, the community:

1) More hearts.png files - This is a weird file, and the PSD for photoshop is included
 in the module zip file

 It is a reverse transparent png (meaning only the center of the hearts are transparent)
 We could use anything unique for our gallery!
 These need to be same size/proportion/etc. as the the hearts.png for simplicity sakes

2) CSS needs to be tweaked to be more attractive.  It's wrapped in a white box because
 the hearts.png background is white.  We're going to make this configurable, but still
 need a more attractive solution.

3) A new module that uses that will use this data to allow viewing by 
rankings / searching by ratings / etc.

Current issue working list:
* Config option for allowing on registered users to vote - DONE

* Ability for admin to 'zero' out an image's rating (start ratings over for an image) - DONE

* Ability for admin to alter vote count on an item

* Ability to alter background color (once we get more iconsets)

Thanks!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2012-05-29 03:58

Not sure how you want to collaborate.
We should be able to rate videos as well.
ratings_block.php
if($item->is_photo()){
to
if ($item->is_photo() || $item->is_movie()){

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2012-05-29 05:14

Found a star image.
I guess some admin setting to choose the type of image to use as we get more feedback.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
skunker

Joined: 2005-02-04
Posts: 344
Posted: Tue, 2012-05-29 11:04

Fantastic!

There seem to be many open-source star icons we can use, I suppose that we can add our own star images if we edit the code?

Also, will albums be able to sort by star ratings?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2012-05-29 13:39

post the star icons that you find that are similar to the ones in the images directory. Must be the same size/dimensions.
In the future we might be able to sort by ratings as well as a dynamic album.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2012-05-29 13:59
floridave wrote:
Not sure how you want to collaborate.
We should be able to rate videos as well.
ratings_block.php
if($item->is_photo()){
to
if ($item->is_photo() || $item->is_movie()){

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

updated code... if you have suggestions on collaboration, let me know :)

 
skunker

Joined: 2005-02-04
Posts: 344
Posted: Tue, 2012-05-29 14:13

Guys , just curious...what's the purpose of the ratings module if you can't sort an album by it?

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2012-05-29 14:58

skunker, to rate them of course!

Seriously though, did you read this above in the original post:

Quote:
It currently works, but is lacking any features at this point. We're working on that.

 
skunker

Joined: 2005-02-04
Posts: 344
Posted: Tue, 2012-05-29 15:26

Hi jnash,
Don't take my comment the wrong way. I love the new module you are working on and I will support you as much as I can. I was just wondering what happens after you rate the images. If there are new features you are working on, then I'll shut up:) Keep up the good work!

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2012-05-29 15:46

skunker and others:

Quote:
what we need from you, the community:

1) More hearts.png files - This is a weird file, and the PSD for photoshop is included in the module zip file
It is a reverse transparent png (meaning only the center of the hearts are transparent) We could use from stars, or anything else unique!

so the more the community gives the more the community gets.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Tue, 2012-05-29 15:51

Some of the ideas that I have came up with:
http://codex.gallery2.org/Gallery3:Modules:ratings#Development

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2012-05-29 16:08
skunker wrote:
Hi jnash,
Don't take my comment the wrong way. I love the new module you are working on and I will support you as much as I can. I was just wondering what happens after you rate the images. If there are new features you are working on, then I'll shut up:) Keep up the good work!

I'm not taking it the wrong way, I just meant that we have to walk before we can run! Thanks for the feedback.

James

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2012-05-29 17:46

Dave, I've made the 'hearts' image configurable... (sort of, still working it - framework done though)

However, the images you provided above are not drop in replacements, the image is off when displayed. However, I see that there are vars that must be set for the image being used on the msteigerwalt page. This may be difficult to code in if they aren't drop-in replacements...

EDIT: it appears that the CSS would need modification as well if the images are swapped out. UNLESS the images are exact in dimensions (including the 'hearts')...

So this should be added into the CSS part of the TO-DO's

We really need a collaborative space for this... :)

* The ratings.css and bottom of ratings.js both define where/how the icon image is placed and 'filled'

* Should the 'search and sorts' be included in this module, or the search module modified/updated? I'm think this module as an 'option' in the blocks displayed.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Tue, 2012-05-29 21:09

NOTES GOING FORWARD: I bumped the version to 2, however, keep in mind that since quite a few things changed, the module should be completely removed and then reinstalled to get everything back on track...

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2012-05-30 04:10
Quote:
However, the images you provided above are not drop in replacements,

I figured one might be close. I was really hoping the community that has barked and barked so long for a module like this, that at least one member of this community would step up with the skills we don't have to do a simple image or two.
I will stop my rant now.

I think that we should just use images that are the same dimensions to fit in the existing method for now.
@search: I don't think at this time. Just a dynamic album first and then sorting of albums later.
I think that getting more images (see above community) will further the deployment of this module in dark themes.

@collaboration: I will let you be the prime and I'll give code snippets as needed. I'll send you a email address as well. JUst keep the codex version up to date so I can work on the most recent version, unless you want to do a git gallery-contrib. I'm open to anything you want.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
skunker

Joined: 2005-02-04
Posts: 344
Posted: Wed, 2012-05-30 11:58

if you guys give me a chance, I'll help out. This has been the busiest week for me thus far of the year. Stand by!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Wed, 2012-05-30 13:25

Great, thanks!

Dave, I added all the frameworks for the customization of the image and the word used (heart) in the text.

So, we're set once we get some images to work with.

I'm freezing things on my end for now, so feel free to go to town.

James

 
skunker

Joined: 2005-02-04
Posts: 344
Posted: Thu, 2012-05-31 22:50

Here are some custom stars I made. Just need to know what size they need to be for this module and how to implement them.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2012-05-31 23:34
 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2012-06-01 00:15

skunker, What we need is images like the one provided 100x300px.
If you can make files similar to:
gallery/modules/ratings/vendor/img/hearts.png
with stars and not hearts with a white background.
with stars and not hearts with a black background.
with hearts with a black background.
all the same dimensions following this as a general guideline:
[img]http://gallery.menalto.com/files/hearts-diagram.png[/img]

Thanks!
Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
skunker

Joined: 2005-02-04
Posts: 344
Posted: Fri, 2012-06-01 12:46

Thanks Dave, will work on that tonight.

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Fri, 2012-06-01 19:59

I hope you guys get this to work as I really like this idea.

Fingers crossed.

Keep up the great work!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sat, 2012-06-02 18:49

I did this icon up real quick as a drop-in replacement for hearts.png

Filmstrip

[img]http://codex.gallery2.org/images/5/59/Filmstrip.png[/img]

- also -

[img]http://codex.gallery2.org/images/3/35/Filmstrip-blk.png[/img]

- also -

[img]http://codex.gallery2.org/images/9/98/Filmstrip-gry.png[/img]

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sat, 2012-06-02 18:50

I also modified the css a bit to make things appear a bit better with the iconsets...

So, new version up on the codex.

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Sat, 2012-06-02 20:07

New version is much easier to install. Thanks.

It comes up in the modules list as Ratings and is Version 4. I still cant get it to work. I see the text under the photo saying

"Ratings
Click on a heart to cast your vote:
0/5 s (0 vote)"

But I don't see any hearts and there is no-where to click. Have I missed something or done something wrong?

Cheers

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sat, 2012-06-02 21:40

Doh, made a mistake on version in the installer... I'll fix that and re-upload.

Also, ensure that the directory is owned and readable by the webserver user. This may be why the hearts aren't showing up. (I re-did the perms in the zip as well, but double check)

Bumped to v5 for a minor fix on display...

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Sat, 2012-06-02 22:03

Now have V5 thanks. Permissions set in the rating directory and sub albums and files to 777 - is that what you meant?

Still no hearts to click :-(

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sat, 2012-06-02 22:06

hmmm

Will have to troubleshoot somehow, let me think about it a bit.

See if you can see them by browsing to:

http://yourgalleryurl/modules/ratings/vendor/img/hearts.png

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Sat, 2012-06-02 22:14

jnash - a couple of things.

Yes, if I browse to that folder I can see the image.

I should say that I have 4 websites with gallery installed - all are 3.0.2. but they have different themes, modules etc

I have been trying your module on my own StAndrews theme and having limited success.
Just tried it on another site using left & right wind and I get the text with an area to drag the mouse over where I assume the hearts should be. There is a dragable area which changes colour but when I click in the area - I get a busy icon but nothing seems to happen.

Sorry about this.

Maybe other folk are having more success ?

You are doing great work. I have the utmost admiration for people who can write modules.

Cheers (and goodnight)

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sat, 2012-06-02 22:49

One more piece, and maybe we can solve the first part: Go to your Admin->settings->advanced and tell me what you have for ratings/iconset

I don't think it's a 3.0.2 issue, but we'll get there.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2012-06-03 00:49

It is a SQL issue.
mysql_query("select * from vars where module_name = 'ratings' and name = 'iconset'");
returns nothing for me as I have a table prefix.
I was thinking making this a UI admin setting like:
[img]http://gallery.menalto.com/files/Admin_movie_overlay.png[/img]

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-06-03 01:03

floridave, awesome catch on the error, fixed, and re-uploaded corrected - still v5 though, so reinstall.

shug17: redownload and reinstall

I like the UI design, now I just need to incorporate it. That's next I suppose.

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Sun, 2012-06-03 09:42

Blimey! do you guys never sleep? lol!

Sorry to say the new update is still not working - I still can't see the hearts. They are there in the folder - I can browse and see them there but they just do not show up on the photo page.

The module is nearly working on the left&right wind theme but is working less well on StAndrews theme.

I wish I could help!

 
jusie

Joined: 2007-06-21
Posts: 48
Posted: Sun, 2012-06-03 12:46

Same problem here, I've just installed the latest version of the add-on but the images won't show up in my gallery - I've tried both hearts and stars, located under photo or in sidebar. The text appears but nothing to click on. I am on Gallery 3.0.2.

I am very excited about this add-on and can't wait to get it to work! Sorry I am no good with graphics so I can't be of much help here :(

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-06-03 14:11

I'm wondering if this is a g3 3.0.2 issue. I can't ascertain what could possibly be wrong here.

EDIT: I found a couple more db selects that weren't prefixed properly. Fixed and re-uploaded. Try this ver and see if it's still broke, and if so, please check your admin->settings->advanced and tell me what you have set for ratings->iconset

Thanks

Ver 6 up - these fixes and adds initial support for iconset selection.

 
jusie

Joined: 2007-06-21
Posts: 48
Posted: Sun, 2012-06-03 14:35

The value for 'iconset' is
http://gallery.ronankeatingnews.com/index.php/modules/ratings/vendor/img/hearts.png

Looking at it, I just realised that the 'index.php/' is what makes the URL incorrect - the image is at
http://gallery.ronankeatingnews.com/modules/ratings/vendor/img/hearts.png

I think that's it. In the source code of a gallery item page, I can see it uses the incorrect URL as background image in the <style> information.

Another thing I've noticed is that when I set the rating to show in the sidebar, the ratings block displays twice.

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Sun, 2012-06-03 15:36

Hello,

I see the changes in the settings menu but nothing has changed when I got to the photo page - still no graphic on the StAndrews Theme and only a coloured bar on the wind left&right theme.

I am going to attach some grabs from the one website that is working better which uses the wind left&right theme.

Hope this helps.

Gonna go try it on one more gallery install with another different theme.

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Sun, 2012-06-03 15:42

Me again!

tried v6 on a third gallery installation using a themroller theme and I get the block under the photo but no graphic or coloured dragable block.
I attach a screen grab showing what comes up.

Hope this is all helping?

 
jusie

Joined: 2007-06-21
Posts: 48
Posted: Sun, 2012-06-03 15:48
shug17 wrote:
Me again!

tried v6 on a third gallery installation using a themroller theme and I get the block under the photo but no graphic or coloured dragable block.
I attach a screen grab showing what comes up.

Hope this is all helping?

Check out the URL to the rating image in the source code of your page.... Perhaps the path in your gallery is wrong like it is in mine?

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Sun, 2012-06-03 17:33

I will if you point me towards where I am looking.

Thanks

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-06-03 18:03

Okay, jusie, excellent catch. I think I can account for this in the code and make appropriate corrections. Give me a bit to work with it.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-06-03 18:31

Jusie, new file uploaded, give this one a shot. It removes the 'index.php' from the img URL

Shug, I'm not sure what the issue is with yours, the URL looks good from your screenshot. Does it work on the wind theme? Also, what browser are you using? And, do you have a link to your website? (You can 'write to author' below to send it to me privately if you want)

 
jusie

Joined: 2007-06-21
Posts: 48
Posted: Sun, 2012-06-03 19:10
shug17 wrote:
I will if you point me towards where I am looking.

Thanks

Open the source code by right clicking anywhere on your page and in the context menu there is an option to show the source code. Search the HTML file for e.g. 'rabidRating' and you will find a bit that starts with <style> and contains a background image URL for the rating.

 
jusie

Joined: 2007-06-21
Posts: 48
Posted: Sun, 2012-06-03 19:14
jnash wrote:
Jusie, new file uploaded, give this one a shot. It removes the 'index.php' from the img URL

Just downloaded and installed v6 - I think it removes the complete URL, not just 'index.php', lol!

HTML source now contains:

<style>
	.rabidRating .ratingStars {
		display: block;
		background: url('') no-repeat center;
	}
</style>

Feel free to have a look at the source to see the 'ratingurl' that was constructed in my gallery.
http://gallery.ronankeatingnews.com/index.php/fanpics/2012/0205_melbourne/sam057

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Sun, 2012-06-03 19:43

here is a link to the website with the wind left&right theme - the one that is nearly working.

http://seangroat.co.uk/gallery3/index.php/animals/13437

I am using Firefox 12.0

Best wishes

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-06-03 20:28

Okay, give v7 a try, if not, I'm going back to the drawing board for a while to rethink this out. This plugin is a pain to modify for gallery unfortunately.

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Sun, 2012-06-03 20:31

I think I'm going to just rewrite the entire thing here soon. We're using a JS module from a third party, and it's integration into the gallery is a real PITA... I think if the functionality is brought in to a true G3 module, we may be better off.

 
skunker

Joined: 2005-02-04
Posts: 344
Posted: Sun, 2012-06-03 20:57

I held off on doing any design work because I couldn't get it to work on my default theme. Also, the PSD was confusing. Jnash, let us know how we can help. Thanks,

 
jusie

Joined: 2007-06-21
Posts: 48
Posted: Sun, 2012-06-03 21:01

Sorry to hear this is turning out to be so difficult =/

I can try the latest version out tomorrow. But I guess if it is easier to start from scratch and create a clean new add-on, that might be the better option.

 
shug17

Joined: 2009-01-10
Posts: 76
Posted: Sun, 2012-06-03 21:04

Dinna do anything rash!

It appears to be working on the wind left&right theme - the hearts are there and they change colour - just waiting to see if the database records it.

Nope - the wee icon keeps spinning round and never stops.

You are so close!!

 
jnash
jnash's picture

Joined: 2004-08-02
Posts: 814
Posted: Mon, 2012-06-04 00:23

Think we got the image bug fixed up. Also found another instance of a bad url with index.php in it causing vote not to succeed.

shug17, give v8 a shot.

I've not given up yet, cause I can't find another good alternative to this script. Maybe I just need a break from it for a bit.

Let's cross our fingers.


Skunker, take a look at filmstrip.png and you'll get a better idea now hopefully on the graphics... Only thing to remember is the center of the 'star' needs to be transparent, and if I got this right,

2px side border, [20pxL x 20-30pxH star, 2px divider](x5 stars) and then 2px side border -- all this centered on a 100Hx300W background <- hopefully this makes some sense...