I don't want to re-open the other issue, because the good/fair/etc tags are very useful. Thank you!

How difficult would it be to have more than one topic for voting? Like, if the node is about a book, to have one topic of "Grammar....good", and also "Plot.....great", and also "Research......poor"?

But this flash interface is just slick, even the way it is -- thanks again.

Comments

benshell’s picture

I thought about multiple voting forms per page when designing the database structure, but at the moment I don't have an easy way to use them. What you can do is call voting_form_generic($content_type, $content_id) from a node using the PHP input format. Or you can make this call from your theme. Maybe from _node($node, $main = 0, $page = 0) you could make this function call inside an if statement, e.g. if ($node->type == 'book)

In either case you can pass any unique name/value combination to voting_form_generic(). You could call the content_type "grammar", and the content_id your node id, and make a second call on the same page calling your content_type "plot", and using the same node id.

What I can do (and will do as soon as possible), is add a filter to the voting module to make it easier to make these calls without using the PHP input format. I can also add a way to change the text variables on a per instance basis. It will probably look something like this:

[voting|type=grammar|prompt=Grammar]
[voting|type=plot|prompt=Plot]
[voting|type=research|prompt=Research]

Let me know if you have any other ideas of how to implement this. I'm trying to make the voting module as flexible as possible, but it's impossible to think of every possible way that it could be used, so keep the ideas coming!

benshell’s picture

I think I've completed your feature request. I just committed the changes to CVS this morning, so if you're using the builds on the downloads page you might have to wait until tomorrow to try it.

I added a filter like I was talking about in this format:

[voting|type=grammar|prompt=Rate Grammar|confirmation=Thank you]

I also made a drupalvoting plugin for the TinyMCE WYSIWYG editor. Hopefully it will make it easy for anyone to add one or more voting controls to their posts. The plugin translates the filter code to an image placeholder for a graphical display in the WYSIWYG editor.

Let me know what you think. I've added a lot of code, so please don't hesitate to post bug reports or additional features requests. Thanks.

kastaway’s picture

Have downloaded. 'CHANGELOG.txt' mentions July 13, so it is the most recent version.

Have installed, there appears to be no changes required to the DB tables. Will try it out, and post back here.

AND: Thanks so much. This is appreciated!

kastaway’s picture

This is excellent!

Apologies for taking so long to reply -- I was travelling, and then it took me a bit to understand how to use the new functionality.

At first, I tried installing ImageAssist, but it was just more trouble than I needed. Then, I tried calling your PHP function "voting_control_node", but was frustrated when all the voting bars ended up acting in unison.

Finally, I realized that I should be using "voting_control_generic", with this type of syntax:
$output .= voting_control_generic('service', $node->nid, array(t('Your Vote'), t('Vote Confirmed!')));

That does work, and saves the data into the database. If you could give an example of how the third part, the array(), should be used, that would be nice, but even without the modified $prompt and $confirmation, this module does a great job.

Thanks again!

benshell’s picture

I'm glad you like it! I'm out of town right now so I don't remember the exact variables I used, but the idea is to pass an associate array with the key as the variable to want to override. An example would look like this:

$output .= voting_control_generic('service', $node->nid, array('my_vote' => 'Your Vote', 'vote_confirm' => 'Vote Confirmed!'));
kastaway’s picture

Perfect -- the variable names are 'prompt' and 'confirmation', and they need to be added to the array like that, as text strings. So my final line which I dropped into the bottom of my 'node.module' (and I turned off the Voting option in admin/node/configure/types/node):

$output .= voting_control_generic(
               'service', 
               $node->nid, 
               array(
                  'prompt' => 'Please vote:', 
                  'confirmation' => 'Vote saved!'));

Very nice. I tweaked the background colors, and I look like a genius. ;-)

benshell’s picture

Status: Active » Closed (fixed)

I'm glad it worked for you. :)