Page 1 of 1

A new poll problem

Posted: Sun Aug 14, 2005 10:04 am
by Ripper^^
so i've got the poll plugins installed and upgraded to their latest versions (2.03) using s9y version 0.8.3 and i have two blank extra options in my current pole, one below the first legitimate option the second at the bottom.

here is the url http://www.theripper.com/index.php

when i go to "select a voting to edit or create" the title is listed along with all six actual options. all the actual options have a delete button next to them, then below the options is a blank box with an add button beside it

I don't understand why i'm getting these extra blank options in the poll, any help would be appreciated.

Ripper^^

Re: A new poll problem

Posted: Mon Aug 15, 2005 12:22 pm
by garvinhicking
Can you post a screenshot of your poll interface there? Blank options might get added if you click the "add" button without filling in an option field...

Regards,
Garvin

poll interface

Posted: Mon Aug 15, 2005 9:57 pm
by Ripper^^
sure thing hopefully this is what you meant by poll interface.

Image

hope this helps

Re: poll interface

Posted: Tue Aug 16, 2005 3:14 pm
by garvinhicking
Thanks, this definitely helped. I just committed version 2.04 of the two plugins which fix this error. You can get them from CVS after about 24 hours. :)

If you want to get your hands dirty, here's a diff:

Code: Select all

Index: common.inc.php
===================================================================
RCS file: /cvsroot/php-blog/additional_plugins/serendipity_plugin_pollbox/common.inc.php,v
retrieving revision 1.7
diff -u -r1.7 common.inc.php
--- common.inc.php	13 Aug 2005 22:27:11 -0000	1.7
+++ common.inc.php	16 Aug 2005 11:09:17 -0000
@@ -76,6 +76,9 @@
     function showOptions() {
         if (is_array($this->poll['options'])) {
             foreach($this->poll['options'] AS $optid => $option) {
+                if (empty($option['title'])) {
+                    continue;
+                }
                 echo '<input type="radio" style="width: 15px; margin: 0px;" name="serendipity[vote]" value="' . $optid . '" /> ' . htmlspecialchars($option['title']) . '<br />';
             }
         }
Index: serendipity_event_pollbox.php
===================================================================
RCS file: /cvsroot/php-blog/additional_plugins/serendipity_plugin_pollbox/serendipity_event_pollbox.php,v
retrieving revision 1.6
diff -u -r1.6 serendipity_event_pollbox.php
--- serendipity_event_pollbox.php	13 Aug 2005 22:27:11 -0000	1.6
+++ serendipity_event_pollbox.php	16 Aug 2005 11:09:17 -0000
@@ -19,7 +19,7 @@
 
         $propbag->add('configuration', array('permalink', "articleformat", "pagetitle", "articleformattitle"));
         $propbag->add('author', 'Garvin Hicking');
-        $propbag->add('version', '2.03');
+        $propbag->add('version', '2.04');
         $propbag->add('requirements',  array(
             'serendipity' => '0.8',
             'smarty'      => '2.6.7',
@@ -305,9 +305,6 @@
         echo '</tr>';
         
         foreach((array)$this->poll['options'] AS $optid => $option) {
-            if (empty($option['title'])) {
-                continue;
-            }
             echo '<tr>';
             echo '<td><input type="text" name="serendipity[pollOptions][' . $optid . '][title]" value="' . htmlspecialchars($option['title']) . '" /></td>';
             echo '<td><input type="submit" name="serendipity[pollOptionRemove][' . $optid . ']" value="' . DELETE . '" /></td>';
Index: serendipity_plugin_pollbox.php
===================================================================
RCS file: /cvsroot/php-blog/additional_plugins/serendipity_plugin_pollbox/serendipity_plugin_pollbox.php,v
retrieving revision 1.7
diff -u -r1.7 serendipity_plugin_pollbox.php
--- serendipity_plugin_pollbox.php	13 Aug 2005 22:27:11 -0000	1.7
+++ serendipity_plugin_pollbox.php	16 Aug 2005 11:09:17 -0000
@@ -14,7 +14,7 @@
         $propbag->add('configuration', array('title'));
         $propbag->add('author', 'Garvin Hicking, Evan Nemerson');
         $propbag->add('stackable', false);
-        $propbag->add('version', '2.03');
+        $propbag->add('version', '2.04');
         $propbag->add('groups', array('STATISTICS'));
         $this->dependencies = array('serendipity_event_pollbox' => 'keep');
     }
Regard,s
Garvin

Thanks!

Posted: Tue Aug 16, 2005 7:09 pm
by Ripper^^
Thanks Garvin I really appreciate it a bunch, and who doesn't like to get their hands dirty? :D