Hi Marvil
Great progress on this module! Sorry... I've been away for a little while, got caught up in work projects (non drupal). Very glad you went the ctools route!
As for the splitting of votes (x upvotes, x downvotes), can I suggest that we implement the solution in comment #30 (http://drupal.org/node/413980#comment-2735202) as a permanent solution for 2.x-dev? I'm happy overwriting the theme function but it leads to a lot of code duplication which could cause problems for future upgrades.
The idea is that we provide all the information a potential widget might need right out the box. Variables available to the widget would then be:
$points : Number of total vote points for the vote object (signed)
$unsigned_points : Number of total vote points for the object (unsigned)
$points_down : Number of down votes
$points_up: : Number of up votes
Obviously current widgets would continue to work, but now themers can very easily split the votes if they choose to.
If you are happy with this suggestion I can roll you a patch (I will also include the updates needed WIDGETAPI.txt).
Comment | File | Size | Author |
---|---|---|---|
#18 | upanddown-widget-v3.patch | 22.68 KB | marvil07 |
#14 | arrows.png | 1.01 KB | Soren Jones |
#13 | upanddown-widget-v2.patch | 15.43 KB | marvil07 |
#8 | upanddown.png | 2.81 KB | marvil07 |
#5 | 0001-starting-new-widget-ups-and-downs.patch | 8.56 KB | marvil07 |
Comments
Comment #1
marvil07 CreditAttribution: marvil07 commentedYep, that would be great :-), but I would like to have a another widget which shows that variables in the main module.
Comment #2
enzipher CreditAttribution: enzipher commentedHi,
Just wanted to know if there are any updates in this area? I need this feature and would be happy to do testing if needed.
It would also be nice if the the numbers could be changed on-the-fly as the total score does when clicking the vote down/vote up links.
Cheers
Comment #3
wiifmManaged to get this basically working by porting the old code from http://drupal.org/node/413980#comment-2735202 into version 2.0 beta 1
Changes (sorry, I am a noob when it comes to creating patches)
Insert line 250 into file vud.theme.inc
I then created a new widget using the API supplied to take advantage of the new variables available ($up_votes and $down_votes)
Hope this helps someone
Comment #4
khanz CreditAttribution: khanz commentedHas this been committed yet...
Comment #5
marvil07 CreditAttribution: marvil07 commented\o/ first implementation!
It still needs work, but marking as needs review to get feedback. I think this patch resolves the logic.
It would be really great to have feedback about how to present the information, I attach one simple propose, but in the patch I used a updown widget clone :-p.
Comment #6
marvil07 CreditAttribution: marvil07 commentedComment #7
Fidelix CreditAttribution: Fidelix commentedI applied the patch successfully, but i dont have a clue how to actually get what you showed in the PNG.
Any tips, please?
Thank you very much for the good work!
Comment #8
marvil07 CreditAttribution: marvil07 commentedI attached the image only as a propose, I am really bad at design and I need a suggestion about it if possible.
I attach here what I got in the new widget after applying this patch for reference, but I should change it to have IMHO something better, so feedback is welcome!
Comment #9
Fidelix CreditAttribution: Fidelix commentedThe "hand" icon, green and red would be nice, just like in Youtube.
I got how it works, i'm developing a widget and i'll share it with everybody once i'm done.
I think it is actually getting pretty good.
Comment #10
jacobpov CreditAttribution: jacobpov commentedthanks very nice of you!
Subscribing
Comment #11
Soren Jones CreditAttribution: Soren Jones commentedI started a duplicate issue #856946: Make separate up and down vote totals accessible from views before I noticed this.
All of my issue searches included views.
Anyway, maybe you could implement hook_votingapi_metadata_alter here, too.
Comment #12
marvil07 CreditAttribution: marvil07 commentedJust about to send a new patch with the missing hook
Comment #13
marvil07 CreditAttribution: marvil07 commentedOk, after some delay, I got:
- The missing hook (
hook_votingapi_metadata_alter()
), originally by Soren Jones, let us define a view where you can list two new fields separately(inside the votingapi vote results field): positives and negatives :-)- A functional propose for the widget visualization using sprites!
Please take a look a this, so I can commit it soon ;-)
Comment #14
Soren Jones CreditAttribution: Soren Jones commentedThank you!
For anyone who doesn't see the arrows next to the numbers, you need the attached png.
Put it in the /vote_up_down/widgets/upanddown folder.
Comment #15
marvil07 CreditAttribution: marvil07 commentedThanks for the test! I forgot the diff do not include the binaries as output :-p
Comment #16
Soren Jones CreditAttribution: Soren Jones commentedAh, right! That makes sense. Good to know.
I just took a quick look. I'll try to do a careful test on Wednesday evening (Japan) -- not that it's necessarily needed.
But looking quickly, all seemed well. In PHP 5.3 even.
Thank you again for this!
Comment #17
Soren Jones CreditAttribution: Soren Jones commentedWell, I'm sorry, but I didn't find any serious bugs. ;-)
A few comments.
Take them or leave them.
Let me know if you want any of them in a patch.
Maybe some documentation about why _vud_get_standard_results is being used in addition to hook_votingapi_results_alter to help people like me who are learning.
"if not votes found" isn't grammatical. Maybe something like:
+ * Returns 0 when there are no votes.
And maybe move that comment just above each if statement?
For the function in the views_cache table, I understand wanting to use one word, but in the Views interface, positives and negatives might be confusing. Would it be OK to add "total" for consistency with "Total score"?
+ 'name' => t('Total positives'),
+ 'name' => t('Total negatives'),
"for a content" isn't grammatical. I can think of a number of alternatives, but maybe this is best:
+ 'description' => t('The positive vote total.'),
+ 'description' => t('The negative vote total.'),
Lastly, in Vote Up/Down Terms, the total within the default (updown) widget and the alternative widget update in real time (not the "Score" total, but the total within the widget), but the upanddown widget doesn't. A page refresh is required to update the number.
Powered by Dreditor.
Comment #18
marvil07 CreditAttribution: marvil07 commentedI'm going to commit this patch to 2.x and 3.x
Comment #19
marvil07 CreditAttribution: marvil07 commented\o/ Thanks to all people that help me in this patch. Commited to 2.x and 3.x.
Comment #21
lesleyfernandes CreditAttribution: lesleyfernandes commentedWhat about Drupal 7?
Comment #22
TimelessDomain CreditAttribution: TimelessDomain commented@lesleyfernandes - There is no reason that upanddown widget would be abandoned for D7. So yes D7 will have it.
Furthermore you should refrain from posting so many times, in so many threads for something that is logically implied... People will answer such questions in good time when they are answering other questions/ requests that are more relevant.
Comment #23
lesleyfernandes CreditAttribution: lesleyfernandes commented@TimelessDomain: hey man, two times is not "so many times" I think... but thanks for the answer.
Comment #24
jeffwidman CreditAttribution: jeffwidman commentedsub