/* Based on the latest Drupal 6.12-dev
* PROBLEM: if an authenticated user without node administer permission but
* has a permission to edit his/any poll, everytime he edits his poll or
* any poll the vote values become 0 and when he goes to view tab,
* if has voted, the cancel button still exists even though vote values are 0
* so if he decided to cancel, the result is negative value which
* the validator function doesn't even notice
*
* I created a patch, which I am sure, it's not the best, but it works
*
* SOLUTION 1: I added an else statement where I copied the the content in the
* if($admin) {...} and added '#disabled' => 'disabled', and changed
* '#default_value' => $votes, to '#value' => $votes, because if the
* attribute is disabled #default_value doesn't pass its value
*
* SOLUTION 2: I added an else statement where I copied the the content in the
* if($admin) {...} and just change the '#type' => 'textfield', to '#type' => 'hidden',
* but you'll have nothing under the heading VOTE COUNT which is the original
* state when you create a poll in the original poll module
*/

313:	  if ($admin) {
314:	    $form['chvotes'] = array(
315:	      '#type' => 'textfield',
316:	      '#title' => t('Votes for choice @n', array('@n' => ($delta + 1))),
317:	      '#default_value' => $votes,
318:	      '#size' => 5,
319:	      '#maxlength' => 7,
320:	      '#parents' => array('choice', $delta, 'chvotes'),
321:	    );
322
323:	  } else { // <-- add this (daniel's solution 1 )
324:	      '#type' => 'textfield',
325:	      '#title' => t('Votes for choice @n', array('@n' => ($delta + 1))),
326:	      '#value' => $votes,
327:	      '#size' => 5,
328:	      '#maxlength' => 7,
329:		  '#disabled' => 'disabled',
330:	      '#parents' => array('choice', $delta, 'chvotes'),
331:	    );
332:	  }  // <--patch upto here
