Comments

igorik’s picture

subscribing

Manamarak’s picture

.

igorik’s picture

I found that KarenS added pollfield into core of cck module.
Try latest dev build, I didn't try it, but I notice her comments in CVS messages.

Igorik
http://www.somvprahe.sk

pembeci’s picture

I checked the latest dev build and it is not there. May be you had mistaken it with another CCK field module. I'd also like to see this ported to D6.

igorik’s picture

Hi

I was wrong, probably mistaken by something in cvs messages.

+1 to port this for Drupal 6

lpt6’s picture

subscribe

bejayoharen’s picture

Does anyone know the specific issues that would be required to get this working in D6? In another thread someone mentioned they were using this in D6.2, so I tried just changing the info file and it didn't work. I also tried contacting that user and didn't hear back.

bjorn

igorik’s picture

Maybe KarenS could tell to us if this module is abandoned or if she prepare some d6 port sometime.

this total silence about this module is scary ;-)

Manamarak’s picture

Agreed, this is such a handy module and it looks like it would not be overly complicated to port, but it seems to be just outside my abilities.

I REALLY REALLY hope somebody adopts it and ports it for us.

I would be willing to pitch in a few pounds/euros/dollars if some of the other interested parties will.

**WINK WINK NUDGE NUDGE**

Ed

junedkazi’s picture

Hi Guys,

This is a brilliant module and I too would love to see a D6 version.
So I have started work on this and I hope I will have something ready in a few days time.

junedkazi’s picture

StatusFileSize
new11.54 KB
new3.19 KB
new183 bytes

hi,

Here is the status of the work I have done so far.

I have created the install file as well as the widget .
I am able to create field. But I am facing some problems.
I am not able to save the values at node save.
I am attaching the files below. If anyone can chip in and let me know
where I am going wrong it would really help and then we could
really fix it together.

primerg’s picture

hi junedkazi,

I also plan on porting this one to d6 since I need it quickly. I'll use your codes as a start.

thanks!
primerg

primerg’s picture

Version: » 5.x-1.6
StatusFileSize
new15.62 KB
new3.37 KB

Someone emailed me asking for updates so here it is.
- field is displayed in node and can accept multiple fields
- report is not yet working.
- no views integration

I am still working on the report. I am open to any help/contribution to make this one better.

primerg’s picture

StatusFileSize
new3.37 KB

the previous attachment of pollfield.install.txt is invalid. here is the update one.

lpt6’s picture

Got this error in using

user warning: Unknown column 'field_name_delta' in 'where clause' query: SELECT count(*) as kount from pollfield_votes WHERE nid = 62 AND field_name = 'field_poll' AND uid = 4 AND field_name_delta=0 in /home/lifepoo8/public_html/shuodui.com.cn/sites/all/modules/pollfield/pollfield.module on line 74.

---
My Blog: www.his25.com
www.shuodui.com.cn

Oleksa-1’s picture

On my point of view it is better to use some viewfield for cck instead. Creat in views block with poll you needed and insert it in node.
i did not try it but should work

hupfer’s picture

Hi,

thats exactly, what im looking for :) I tried it in my drupal 6.x. It really works, but i get one error message:
user warning: Unknown column 'field_name_delta' in 'where clause' query: SELECT count(*) as kount from pollfield_votes WHERE nid = 26 AND field_name = 'field_polly' AND uid = 1 AND field_name_delta=0 in /var/www/web77/html/modules/Pollfielddev/pollfield.module on line 74.

field_polly = my field name
Pollfielddev = my folder

Im not able to programe :( Can anybody help me?

Greetings

Kay

mattiasj’s picture

This sounds interesting, subscribing for further notice.

Flying Drupalist’s picture

subscribe

portulaca’s picture

subscribing

mario_prkos’s picture

StatusFileSize
new13.51 KB

I worked on this for the past week, this is what I have so far, it is fully functional. I have tested it but more heads are better than one, please test and give feedback. In the future more features may be added. I plan to request access to maintain this version of the module.

Here are some of the features:

  • Only one choice per question allowed (radio buttons)
  • Maximum number of possible poll responses is set when adding the field to a content type. Unused response fields are ignored.
  • Deleting the node that holds the Pollfield also irreversibly deletes the poll and all the results.
  • Editing the node with the Pollfield preserves the poll results, even if you change the question and responses (editing needs to be allowed because of usability reasons but it allows abuse)
  • More than one pollfield per node allowed
  • If you delete the question or responses vote results remain, deleted entries are not displayed
  • Results are shown even before you voted (unfortunately)
  • Poll duration starts with the creation of the node that holds the Pollfield
  • Cron job automatically closes polls according to the duration period
  • If a poll is deactivated and then reactivated votes will add
  • Registered users can only vote once and they can't cancel their votes
  • Anonymous users (if they have the permission) can vote without restrictions (it's possible to restrict it to one vote per IP address)
  • Visual style is pretty raw, CSS only works on modern browsers (doesn't work in IE6 and IE7, will fix this soon and make it more visually appealing)
Flying Drupalist’s picture

Great news, and thanks for the module!

I was unable to get it to work:

I didn't see any ways of increasing the # of choices from the default 2.

When I viewed the node there didn't seem to be any way to vote. When I gave it a default result it just displayed the result, again, no way to vote.

Would you consider as a feature adding some of advanced poll's poll features as fields too? Thanks again!

portulaca’s picture

It works great, here's what I did:

  • Extract the file into modules/ folder (I had to extract it twice)
  • Go to drupal's Modules and enable Pollfield (it's under CCK fieldset)
  • Create new content type
  • Go to Manage fields for that content type
  • Add new field > Field type: Pollfield
  • You automatically get the settings page for the field, this is where you can set the maximum number of choices, it's called Blank questions (should probably be changed to Maximum number of responses or similar)
  • I skipped the Default value fieldset
  • In the Global settings I set Number of values to 1
  • I went to create the new content with a poll, entered starting vote count, it displayed correctly
  • I voted and my vote was recorded
  • Then I went to Permissions and allowed Anonymous users to View the field I created (before that anonymous visitors couldn't see the poll)
  • After logging out I could vote as many times as I wanted (it's kewl to watch the bars change lol)

Flying Drupalist you were probably looking at Default value fieldset, but there you only enter default question and responses if needed, the place to set the maximum number of responses is under Blank questions. I could also see only 2 choices under Default values, but after saving the field and returning to those settings I could see the correct number of choices so I could set the default values for all of the response fields.

junedkazi’s picture

@KarenS

Now that you have it working copy of the module can u pls review and create a D6 branch.
So that we can have a dev version so that everyone can test it well and report bugs if any.

Thanks

Juned kazi

Delta Bridges’s picture

Thank you so much mario_prkos, portulaca and all the others!!
I will install the module today and report my feedback here :)

mcload’s picture

What is the current status? It looks like version 6.x has not been commited to CVS.

mario_prkos’s picture

I applied for CSV access and still wait for reply as soon as possible I will commit new branch for Drupal 6.x.

Mario

Delta Bridges’s picture

Hello there,
I hope you can get it soon :)
Your zip module in #21 works really well on my site. I haven;t noticed any major bug. Perhaps a few details, but I will wait until you get the cvs account.
Many thanks for your work

lpt6’s picture

I found the module did not include dependency on Core Poll , that;s why it cause me error in first time as i did not enabled the core poll module

----------
My Drupal Webs
www.shuodui.com.cn
www.threekm.com
www.his25.com

mario_prkos’s picture

@Delta Bridges
thank you for your support. I would appreciated any feedback from you.
@lpt6
On my configuration I don't have core poll installed and I don't have any errors. Module should only depends on CCK content module.
If you have any errors please post it so that we can check it out what is wrong.

lpt6’s picture

Now there is no error but can I change the default group setting to be expanded instead of collapsed? thx

mario_prkos’s picture

@lpt6

function theme_pollfield($element) {
  $output = "<fieldset class='menu-item-form collapsible collapsed pollfield-form'><legend>Poll settings</legend>".$element['#children'].'</fieldset>';
  return $output;
}

just delete collapsed in file pollfield.modul in function theme_pollfield($element) will do the job !

lpt6’s picture

Successfully done, thx

----------
My Drupal Webs
www.shuodui.com.cn
www.threekm.com
www.his25.com

lpt6’s picture

Just Discovered one problem, I made up a content-field-pollfield.tpl.php to theme the pollfield and seems everytime the pollfield is rendered in node even i left it blank in form but this does not happen in othe cck fields

----------
My Drupal Webs
www.shuodui.com.cn
www.threekm.com
www.his25.com

acossta’s picture

Hi, Im trying to print the pollfield form directly from node-story.tpl.php with the following function in drupal 6

print theme_pollfield_formatter_default($node->content[field_poll]);

When I see the the HTML that it does'nt show anything, any idea why this isn't working

Im using the pollfield.tar_.gz pollfield.

Thanks in advance for the help

Oleksa-1’s picture

i created field polffield in content type forum.
If i edit any forum topic, even without poll attached, i get followin error message

warning: Invalid argument supplied for foreach() in /home/us11org/public_html/sites/all/modules/pollfield/pollfield.module on line 264.

on 264 string i have:

 foreach ($item['group'] as $delta => $group) {
	      //print_r($item);
		  if (empty($group['choice'])) {
		    unset($items[$key]['group'][$delta]);
		  }

and i have also error:

user warning: Column 'field_pollfield_question' cannot be null query: UPDATE content_type_forum SET vid = 1712, nid = 1674, field_pollfield_question = NULL, field_pollfield_active = NULL, field_pollfield_runtime = NULL, field_pollfield_choice = 'N;', field_pollfield_votes = NULL WHERE vid = 1712 in /home/us11org/public_html/sites/all/modules/cck/content.module on line 1213.

mario_prkos’s picture

@acossta
Did you check what is in $node->content[field_poll] formatter use $element as input which is consists of $element['#item'] and $element['#node'].
From this data formatter builds HTML output. $elements['#item'] is array of six elements question, active, runtime ,choice, delta, votes.
If your input doesn't have elements or data required by formatter you will not get proper html output. For more information please, post it content of variable $node->content[field_poll]. You can do it by print_r($node->content[field_poll]) or dpm($node->content[field_poll]) if you have devel module installed.
And it will be helpfull if you can post HTML output of formatter or page where you have this poll.

@lpt6
Yes, I am aware about that issue and it is on my todo list. Can you please tell do you set label to be hide and do you get something like
' ' in place where you poll is. If you get something else please post it. If I don't get csv access soon I will post the patch otherwise it will go through official pollfield development branch for D6.

@koval2001
From your post it seems that drupal tries to update fileds that is NULL but it is not allowed to be NULL by table definition. Also error
warning: Invalid argument supplied for foreach() in /home/us11org/public_html/sites/all/modules/pollfield/pollfield.module on line 264.
mean that there is no data in database and foreach can not perform because array doesn't exist. I see you try to build content type forum can you tell how did you do it so that I can reproduce problem. I just added pollfield to my forum and I don't get this messages
so probably problem is in working with content_types of different kind.

lpt6’s picture

Pls see my poll in the link below, it's the icon with the tick

http://www.shuodui.com.cn/node/155

Oleksa-1’s picture

StatusFileSize
new32 KB

Thx for reply

From your post it seems that drupal tries to update fileds that is NULL but it is not allowed to be NULL by table definition.

But it is not good. Because not all user on forum want to attach polls to their posts.

Now it works this way. If user created topic and saved it first time , everything fine. But if he will edit this topic and save again he will get error:

user warning: Column 'field_poll_votes' cannot be null query: UPDATE content_type_forum SET vid = 1, nid = 1, field_poll_question = '\' \'', field_poll_active = 0, field_poll_runtime = 0, field_poll_choice = 'a:0:{}', field_poll_votes = NULL WHERE vid = 1 in /home/us11org/public_html/sites/all/modules/cck/content.module on line 1213.

And also as you mentioned

Can you please tell do you set label to be hide and do you get something like
' ' in place where you poll is

see picture in attachment.

So is it poss to allow to be NULL for poll fields?
And how to get rid of ' ' in poll place?

Oleksa-1’s picture

by the way these ' ' are in field "field_poll_question" of this "table content_type_forum" in my case/ And if remove it manually and refresh page , these ' ' will disapear.

mario_prkos’s picture

@koval2001
replace

$out .= '<div class="pollfield-title">'.$element['#item']['question'].'</div>';

with

if ($element['#item']['question']!="' '")
			$out .= '<div class="pollfield-title">'.$element['#item']['question'].'</div>';

in function theme_pollfield_formatter_default and you will not have ' ' any more.
content_type_forum is table of CCK module and is not made by pollfield module I still not able to reproduce your error so
I need some information how did you create content type forum with poll; did you use export import metod or you just
add pollfield field. On my installation I used just to add field and I don't have any error. Also, you can edit table
content_type_forum and change definitions by some database tool like mysql query browser or phpmyadmin but you must be
carefully to do that maybe there is reason for that in cck module .

Oleksa-1’s picture

Status: Closed (fixed) » Active

Thanks,
Regarding NULL error/
I you just added pollfield field in content type forum.

Created post and saved (without poll!!!). It is OK. Then i clicked "edit" on this post and just "saved" it again (i repeat again, i filled nothing in poll settings no question, no responses). And i got error about NULL problem.

Concerning this error
warning: Invalid argument supplied for foreach() in /home/public_html/sites/all/modules/pollfield/pollfield.module on line 264.

i got it when i clicked again "edit" after i got error about NULL, and i saw that in textfield "Question" in poll settings appeared ' ' (but should be empty). i removed it and pressed "save" and got this error.Invalid argument supplied for foreach()

I will check your patch about ' ' . And about NULL problem, it is not needed to make changes with phphmyadmin - you just need to replace in module 'not null' => TRUE, with 'not null' => FALSE,

like this (at least for me it works)

    $columns['question'] = array('type' => 'text', 'not null' => FALSE, 'default' => "' '", 'sortable' => TRUE);
    $columns['active'] = array('type' => 'int', 'not null' => FALSE, 'default' => 0, 'sortable' => TRUE);
    $columns['runtime'] = array('type' => 'int', 'not null' => FALSE, 'default' => 0, 'sortable' => TRUE);
    $columns['choice'] = array('type' => 'text', 'not null' => FALSE, 'default' => "' '", 'sortable' => TRUE);
    $columns['votes'] = array('type' => 'int', 'not null' => FALSE, 'default' => 0, 'sortable' => TRUE);
mario_prkos’s picture

@koval2001

That is right.Thank you for your contribution now I have CSV access thanks to Michelle I will open soon as possible development branch for D6. I will make all this changes on development snapshot so we continue to test and debugging. Any feedback form you guys are most welcome.

Mario

dbeall’s picture

this is very neat news, Michelle is a wonderful member of the Drupal community. She has helped countless situations to move forward.. and our savior mario_prkos and everyone working on this are hot on the trail to make this module a new reality. Wish i could help fix code issues, but i am php stupid and learning is slow for me at this time. Just as soon as any version is up, count me in for test run.

Oleksa-1’s picture

@dbeall
actuallu module from #21 more or lessis working
some issue should be done:
1) this not enough

if ($element['#item']['question']!="' '")
$out .= '<div class="pollfield-title">'.$element['#item']['question'].'</div>';

it is not solved the problem completely
2)would be nice if users during creation of poll would have button "add more" instead of predefine number of choices
3) need work with permissions for users - especcially to have options to forbid anonimous users to vote or some roles

(for the moment i use if ( $user->uid != 0 ) , but defenetly it shoud be in settings or in permissions

function pollfield_voting_form(&$element) {
  
//fobiden to vote for anonimous
global $user; if ( $user->uid != 0 ) {
  $form = array();
  $form_state = array();
  $table=$element['#type_name'];
  $field_name = $element['#field_name'];
  $items = $element['#item'];
  $node = $element['#node'];
  
  if ($items) {
    $list = array();
    $choices = unserialize($items['choice']);
    if (!empty($choices)) {
      foreach ($choices as $delta => $choice) {
      	$list[$delta] = check_plain($choice['choice']);
      }
      $form['choice'] = array('#type' => 'radios', '#title' => $question, '#default_value' => -1, '#options' => $list);
    }
    
  }
 
  $form['field_name'] = array('#type' => 'hidden', '#value' => $field_name);
  $form['nid'] = array('#type' => 'hidden', '#value' => $node->nid);
  $form['vote'] = array('#type' => 'submit', '#value' => t('Vote'));
  $form['table'] = array('#type' => 'hidden', '#value' => $table);
  $form['#action'] = url('pollfield/vote');
  $form['#type'] = 'form';
 
}
// end fobiden to vote for anonimous
  

4) work with css

and so on

mario_prkos’s picture

Yes, that right there is lots of work to be done; this is just starting point; all work in this version is done in few days and now we have to go with further development of new features and fixing bugs.

dbeall’s picture

lol.. well, I'm not scared, I will load just about anything. I will have it in a test site right now. I do know some css. Should someone change the issue title,version,status,category for the thread ? or start new one..

CarbonPig’s picture

subscribe - AWESOME WORK DRUPAL COMMUNITY! - Current 6.X dev is incompatible with Drupal 6.13

portulaca’s picture

CarbonPig I'm using it on 6.13 and I haven't noticed any issues. Can you give more detail about what is wrong?

Edited: Now I see it too, under Modules Pollfield is marked as not compatible, but it actually works on my site as expected, no errors. I installed the version from this thread some time ago, and when the dev was published on the project page I upgraded. Functionality seems fine but the incompatibility message is there.

mario_prkos’s picture

There is error in pollfield.info file, this is the correction and it is updated on cvs. Dev versions refreshed every 12 h so you can change info file by yourself if you don't want to wait.

; $Id: pollfield.info,v 1.2.4.1.2.1 2009/07/17 17:51:55 marioprkos Exp $
name = Pollfield
description = Allows your site to capture votes on different topics in the form of multiple choice questions .
dependencies[] = content
package = CCK
core = 6.x
portulaca’s picture

I replaced everything above the "; Information added by drupal.org packaging script" line with what you posted and that seems to fix it :)

CarbonPig’s picture

It's working great now! Thanks so much!

mario_prkos’s picture

Status: Active » Closed (fixed)

6.x-1.x-dev is pollfiled version for D6

Status: Active » Closed (fixed)