First of all, I am ecstatic to find this solution as it's the first one that really looks like Doodle. Very nice!

The only thing I wonder is if there's any way to have the votes per date automatically counted as Doodle does. I don't seem to be able to do this with Views/Vote count per node, as the vote is not per the node AFAIS but per field.

Any ideas?

CommentFileSizeAuthor
#9 picker_01.jpg44.19 KBthepanz
#9 picker_02.jpg57.2 KBthepanz

Comments

zeropaper’s picture

Just a few thoughts about that...

the date picker is a field formatter, so, clearly, unless doing a new handler for views or a (very) complex view, you won't be able to count the votes for a node.

on the other hand, as the module utilize the voting API and as voting API offers the ability to "count" the votes, it *might* be possible to count the votes.

We could maybe start digging if you could post the content type and view definition, but the answers seems to be "no, by design".

itsnotme’s picture

Ah, thanks for the quick reply.

I was just looking into using CCK computed field and extracting the values from the "votingapi_vote" table but I'm not an SQL hero so I'm struggling with the correct query. (Problem is that the table saves all votings ever done, so one needs to filter for the correct node_id and the latest user votes. Which is obviously more than my brain can handle this morning :)

Views doesn't seem to put out any of the votes, no matter how I try...

zeropaper’s picture

did you give a try to mix the tables within your view using the "relations"? It might be handy.
by the way... my brain is also in maintenance mode today ;(

itsnotme’s picture

The Views w/o relationships didn't work for me, so I ended up writing a little custom module that calculates the votes and prints out a table. Might share when it's done. :)

zeropaper’s picture

neat :)
I'll be happy see that (perhaps integrate it within the module?)

itsnotme’s picture

Here the current implementation in my project. A module called doodle_calculate, which puts out an extra table for the results. It comes with this .module code:

<?php

function doodle_calculate(&$node) {
  
 // print "<pre>"; print_r($nid);print "</pre>";
    
   $sql = 'select v.tag, sum(v.value) / 100 as val from (select tag, uid, max(timestamp) as timestamp from {votingapi_vote} ' .
      "where $node->nid=content_id " .     
      "group by tag, uid) m " .
      "join votingapi_vote v on v.tag=m.tag and v.uid=m.uid and v.timestamp=m.timestamp " .
      "group by v.tag ";
     
   // print "<pre>$sql</pre>";
     
     $allresults = db_query($sql);
      
     while ($result = db_fetch_array($allresults)) {
        $my_tag[] = $result['tag'];
        $my_val[] = $result['val'];
     }

   // print "<pre>"; print_r($my_results);print "</pre>";
   if (is_array($my_tag) && count($my_tag)) { 

           print "<h3 class=\"h3-doodle\">Doodle Result</h3>";
           print "<div class=\"doodleresults\">";
           print "<table class=\"date-picker-formatter-table\" border=\"1\">";
           print "<tr>"; foreach($my_tag as $r) print "<td class=\"answer\">" . date('d/m/Y H:i', $r) . "</td>"; print "</tr>";
           print "<tr class=\"result odd\">"; foreach($my_val as $r) print "<td class=\"answer\">$r</td>"; print "</tr>";
           print "</table></div>";
   
   }
   
   // return $my_results;
}     
?>

And this in the node...tpl.php:

  <?php if($node->type == "doodle") { doodle_calculate($node);
  } ?> 

Plus some formatting in the css. If anyone knows a way to better integrate this into the CCK proceedings, I'd welcome hints. The extra table is not my favorite but I didn't find a way to add the results right below the CCK fields (which would have given the doodle look).

j0nathan’s picture

subscribing

socialnicheguru’s picture

subscribing.

thepanz’s picture

Version: 6.x-1.0-beta1 » 6.x-1.x-dev
Component: Miscellaneous » User interface
Category: support » feature
StatusFileSize
new57.2 KB
new44.19 KB

Hi, I've implemented this and other features (like #836564: provide .date-picker-formatter-yes and .date-picker-formatter-no classes):
- voting counts for each date-time
- customizable vote-icon (using pure CSS)
- customizable voting-cells (CSS)
- customizable voting stats cell (CSS)
- "winner" indicator, each color is linked using CSS to the item-value defined in date-picker-formatter (CSS applicable even if two o more votes equals)
- if "checkbox" is selected, in the summary will present only the "Yes" count

Attached some previews..

Feel free to contact me for donations..

Regards

zeropaper’s picture

Very neat!

may I ask you to post a zip of your module (I hate patches :) ).
I'll then make a new release of the module.

Thanks and best regards,
Valentin

PS: i you do want to co-maintain the module... that would be awesome (I can not give it enough attention and it's a shame for me...)

thepanz’s picture

Yep! Add me as a module-maintainer / co-maintainer.. I'll be glad to help!
My patches are still under development.. i'll accept donations to finish the work!

itsnotme’s picture

Awesome. I'm very interested in implementing this new version, and will do testing soon.

The "maybe" count is also cool and had been a feature request in my Intranet a while ago.

thepanz’s picture

Hi itsnotme: unfortunately my client dropped this feature request and I can't work on it anymore nor release my customer module source code (even if incomplete) due to some restrictions written in my work-contract.

I accept donations to finish my work if you're interested in (maybe you can consider this as a module sponsorship?).

Regards

zeropaper’s picture

I do not know exactly the terms of your contract.. but.. GPL is pretty clear about transmitting work/code, if you do it for 1 you have to make the code available to everyone.

If you work as an employee, this is an other story.

thepanz’s picture

Yes, I'm in the last option you gave. I can't "stole" the code, but I can "re-do" the same work for someone else ;)
If anyone is interested, please PM me...
Regards

thepanz’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Active » Fixed

I'm proud to announce that the new 2.x branch is ready for testing with all the new features listed here.. feedbacks are welcome!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.