Page 3 of 7

Posted: Fri Dec 21, 2007 4:41 pm
by garvinhicking
Hi!
4. Can you tell me, how to get the entryid in the css event hook? $serendipity['GET']['id'] seems not to be set in there.
That's not available, but for what do you need it? Your diamondstyle.css.php does not reference the "GET"-Variable? You only use th $_GET[points] one. However, instead you should define all images globalles in the CSS, and add a special CSS class to the image links:

Code: Select all

<img src="bla.gif" class="glowing" />
<img src="bla.gif" class="nonglowing" />
...
Instead of adjusting the CSS for each element. Then you don't need any URL variable for the CSS, which is generally better (as it's cachable).

Regards,
Garvin

Posted: Fri Dec 21, 2007 8:59 pm
by gregman
garvinhicking wrote:However, instead you should define all images globalles in the CSS, and add a special CSS class to the image links:

Code: Select all

<img src="bla.gif" class="glowing" />
<img src="bla.gif" class="nonglowing" />
...
Instead of adjusting the CSS for each element. Then you don't need any URL variable for the CSS, which is generally better (as it's cachable).
If I insert a img tag for each dimaond (untill now I used backgound-images) I won't need any individual css. The hovering effects could then be javascript based only. I implemented the new code in the plugin and updated the zip file. Now it comes along without any external css and js files.

Regards
Greg

Posted: Wed Jan 02, 2008 12:18 pm
by gregman
Hi again and a happy new year to everyone!

I updated the plugin, because I experienced two bugs. One was related to the calculation of the points and the other to the animated diamonds. I put the updated files on my blog.

Best regards
Greg

Posted: Thu Jan 03, 2008 2:08 pm
by garvinhicking
Hi!

I'd still love to see the functionality merged into the current karmaplugin, so that users can choose if they want to use your terminology, or the old one. Having a second plugin with 70% duplication of the code is IMHO too much. Sadly I'm lacking the time to do any work on the plugin myself, but I really like your variation of the plugin and would love to offer that to all s9y users...

Regards,
Garvin

Posted: Fri Jan 04, 2008 5:01 pm
by gregman
Hi,
garvinhicking wrote: I'd still love to see the functionality merged into the current karmaplugin, so that users can choose if they want to use your terminology, or the old one.
I had some time these days, so I tried to merge the code. I put a new option in the karma plugin where you can choose weather to use the text based style or not. There you can also specifiy the imagefile, so changing the images is now possible more easily (e.g. i now added small diamonds). For some kind IE7 doesn't change image sources smoothly, therefore I went back to the use of css background-images. You can download the updated files here.

Regards
Greg

Posted: Fri Jan 04, 2008 10:57 pm
by Don Chambers
OK - I'm testing the plugin finally. Observations:

The variable 'PLUGIN_KARMA_VOTES' is missing from the english language file... I presume the value of it should be: '%3$s Vote(s)');

The definition of good to bad is exactly backwards from what I would expect. The first star, to the left, is marked "very good" while the fifth, right star is marked "bad".

Provide a class for the div containing the stars.

Do you have source files for the images, such as photoshop or illustrator?

I'll keep checking it out, but these are my first reactions.

EDIT: More observations:
The image alt tag appears to be hard coded in the plugin php file.

<div class="serendipity_karmaVoting"> is not closed, at least, not when displayed on the overview page.

Posted: Sat Jan 05, 2008 1:44 pm
by gregman
Hi Don,

thanks for having a look at the plugin. First of all I'm very sorry for the bugs (and feel like Mic**s**t, bothering you with uncomplete code). I changed the plugin as recommended.

The image-based voting now fully supports english and german, but I don't know what to do with the other language files.

The image files are in the image directory of the plugin. I created them with Photofiltre and don't have any other files. I know that the amount of images used is not ideal, but I think this is something for future improvements (and overstrains my grafical skills).

Greg

Posted: Sat Jan 05, 2008 7:14 pm
by Don Chambers
Greg - no need for apologies.... if you start, we will ALL have to do it because I doubt any of us have ever turned out something completely error free! :lol:

Thanks for making the changes. Latest observations:

1) Newly added class for the image div is karamVotingImage - ie, typo - the "a" and "m" are transposed. Also, this is the class used on the overview page, but the images are contained within a karmaVotingLinks on the detailed page.... perhaps they should be the same class.

2) IMHO, it might be a good idea to have a configuration option to allow voting from the overview pages... not all entries use extended body, and not everyone clicks through to the permalink to read an entry. What do you think?

3) Can images be created in any name format? In other words, could I create a series of images with the name circles_small, or blue_diamonds, as long as I created the entire series (ie, 0circles_small.png - 50circles_small.png and glow_circles_small.png)?


EDIT: I have been working on some images for the plugin. I think you might be better off in the long run with a slight change to the naming convention.

In the current version, you have 2 basic image formats:
  • a) diamonds.png: five images at 28 x 28px, for a total width of 140px
    b) diamonds_small.png: five images at 14 x 14, for a total width of 70 px.
Each of these files is has 10 variations prepended with "0" through "50" (increments of 5 indicating 0 1.5, 2.0, 2.5, upto 5.0). For example: 30_diamonds.png and 30_diamonds_small.png.

In addition to the graphical representation of 5 "diamonds", both "diamonds" and "diamonds_small" have 5 versions containing just a single image ("diamond") at 28 x 28 and 14 x 14 respectively, prepending text that describes the purpose of that image:
  • a) "glow" - alternate color, used to place vote. (green)
    b) "off" - dim color (grey)
    c) "on" - normal color (yellow)
    d) "onoff" - half normal, half dim (yellow/grey).
    e) "transparent" - blank image.
From an image management perspective, I think it would be better to place all of the prepended text as appended (at the end)... so 30_diamonds.png would be diamonds_30.png, and glow_diamonds.png becomes diamonds_glow.png.

Also - I mentioned this a long time ago... The template Bulletproof uses a technique in its config.inc.php file to detect all stylesheets that follow a certain naming convention, then populates a drop down list allowing a user to choose from all available stylesheets that follow that naming convention. The naming convention is color_style.css, so the code is looking for all filenames ending in "_style.css". The list of available stylesheets does not display this ending "_style.css", and instead just shows the "color" portion of the file name. Perhaps the base image file (ie diamonds.png, or diamonds_small.png) could be something like diamonds_karma.png or diamonds_small_karma.png, and the plugin can detect all filenames that end in "_karma.png" and display a list of available images in a dropdown list. Even better - also show the image, or only the image and no name!!! 8)

And finally - although my text above may contradict this next suggestion - I think it would be a good idea to be able to select the "glow" image separately from the others. That way, you could have yellow, red, or blue diamonds, but still always use the existing green diamond for "glow". Conversely, you could use green for regular, and maybe red for glow.

Posted: Sun Jan 06, 2008 1:39 pm
by gregman
Hi,

1) I changed the class name as suggested.

2) The text based voting does support this feature. Implementing this feature for the image based voting is more difficult, because the html code is created before the current rating of each entry is retrieved from the database. But surely it would be possible in some way.

3) Of course ;-). (Actually I'm wondering, if the basic files diamonds.png and diamonds_small.png are really needed, because a zero is prepended, if no vote has been submitted).

Appending the text would be possible too, but is also more difficult: the specified filename has to be seperated in the imagename and the ending. If you think this is really necessary from an image management point of view, I can change it.

Unfortunately, today is my last day of holiday, so changes may last longer.

EDIT: For some reason the klicks aren't tracked in this plugin and I don't find the bug. Can anynone help?

Greg

Posted: Sun Jan 06, 2008 5:11 pm
by Don Chambers
regarding the class name - make sure you do not change anything that may have been a class name before you introduced your graphical version - old templates often have styles for the karma voting plugin, and will not work correctly if anything is changed. I do not know if you have, or have not, changed anything - I am just mentioning it.

Now, it appears to me that the class used for all images on overview pages is karmaVoting_links..... that is also the class name for images WITH VOTES on the detailed page, but it looks like the class name for images WITHOUT votes on detailed pages is serendipity_karmaVoting_links. All should be the same class name, and looking at some older template stylesheets, it looks like serendipity_karmaVoting_links is the correct one.

Voting from the overview page is important I think. It is not really obvious that someone has to go to the detailed page to vote.

Prepending vs appending - I did not mean to imply that it is "important", although, looking at the code, I don't see where it would be any more, or less, difficult. I just thought image management would be easier if the variations were at the end, so that all files were grouped together alphabetically, such as all diamonds*.png, then all diamonds_small*.png. Just thought this would be easier than all the zeros, followed by all the 10's, etc.

I am very interested in the naming convention because I already have a photoshop template set up to create the images, and have a few concepts nearly complete!!!

BTW - I just noticed something. There is no file for 0.5. the numbers correspond to 0, 1, 1.5, 2.0, 2.5, etc. Is 0.5 mathmatically impossible?

How about the idea of selecting images in the manner I described?

Finally - not sure about clicks not being tracked... they are working where I am testing it, but I see that it is not working on your blog entry for the plugin...

Anyway, if you have the opportunity to bang through some of this stuff in the remaining hours of your holiday, I will be more than happy to continue testing!!!

Posted: Sun Jan 06, 2008 6:47 pm
by Don Chambers
More notes:

English language file (have not checked others) defines PLUGIN_KARMA_VISITS_BASEIMAGE and PLUGIN_KARMA_VISITS_BASEIMAGE_DESC. I believe "_VISITS" should not be in the variable names.

I also see this for the description:
Enter the base name of the image file (e.g. diamonds.png) for image based voting. Enter 0 (zero) for text based voting (-- | - | 0 | + | ++). Attention: The voting scales are not compatible! See the image directory for all necessary image files.
What do you mean the voting scales are not compatible?

I just took a look at the original karma voting, something I have not done since this revision began. I see the original plugin calculated 5 as bad, and 1 as very good. I personally feel that was always backwards.... and when we switch to graphical, it becomes even more obvious as most think of "5 stars" as the best possible rating, not the worse!

However, there probably has to be a way to preserve the original computation while graphically showing it as left=bad right=good, otherwise, for people who have rankings of 1 in the previous plugin version, which means good, that will now calculate as bad. There are also 2 other plugins that I know of that use the karma plugin - one that shows karma for authors, and another which computes popular posts.

Keep up the great work Greg! Cannot wait until you are finished!

Posted: Wed Jan 09, 2008 10:47 pm
by gregman
Well,

I corrected the english language file and the class name.

The scales are not compatible because the text based voting ranges from -2 to 2 whereas the image based voting ranges from 1 to 5 (relatively to the amount of votes). For example: If an entry gets 10 times best vote text based (= 2), it's 20, which means "uninteresting" for the image based vote. The problem was weather to keep the compatibility to earlier votes or to the image based vote.

Voting on the overview page is now supported but lacks of massive (js-)code. I also changed the naming convention from prepending to appending. A 0.5 is mathematically impossible when you only use the image based vote (minimum vote = 1). Because someone may change from text based voting I added those images.

I moved the tracking of the clicks from the frontend_configure event to the entry_display event. Now it works again, but I experienced one duplicate karma db entry after that. As I wasn't able to reproduce it, I don't know, if it really relays to the change.

Greg

Posted: Thu Jan 10, 2008 9:03 pm
by Don Chambers
gregman wrote:The scales are not compatible because the text based voting ranges from -2 to 2 whereas the image based voting ranges from 1 to 5 (relatively to the amount of votes). For example: If an entry gets 10 times best vote text based (= 2), it's 20, which means "uninteresting" for the image based vote. The problem was weather to keep the compatibility to earlier votes or to the image based vote.
I think the scale needs to remain unchanged. There are people who have been using the plugin for years, and could have hundreds of entries using the original scale that would now result in a completely inaccurate rating. And, as previously mentioned, there are other plugins that use or display the karma rating.
Voting on the overview page is now supported but lacks of massive (js-)code.
Lacks a lot of code, or contains too much code? I didn't quite understand you.

Are you considering some method to detect/display the images available?

Posted: Fri Jan 11, 2008 7:33 pm
by gregman
I think the scale needs to remain unchanged.
Me too, that's why I didn't change it.
Lacks a lot of code, or contains too much code? I didn't quite understand you.
... contains very much code: not very good from a seo point of view!
Are you considering some method to detect/display the images available?
Maybe, but first I have to examine how to add a select box to the configuration screen.

Posted: Fri Jan 11, 2008 8:56 pm
by Don Chambers
Thanks for your continued efforts Greg!!

When I said it should remain unchanged, I meant the graphical version should calculate exactly the same as the text version. It is difficult to call this a plugin "upgrade" when former text users cannot switch to the graphical version.

If the overview voting is nasty from an SEO perspective, or too much code overhead (and there is no better way to do what the code is doing), perhaps it would be a good idea to have a configuration option for whether or not to allow voting from overview pages???

For the dropdown, look at the bulletproof template's config.inc.php file.... although, we are storing our values in an array.