A new poll problem

Creating and modifying plugins.
Post Reply
Ripper^^

A new poll problem

Post 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^^
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: A new poll problem

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Ripper^^
Regular
Posts: 50
Joined: Mon Aug 15, 2005 7:49 am
Location: Gainesville, Florida, USA
Contact:

poll interface

Post by Ripper^^ »

sure thing hopefully this is what you meant by poll interface.

Image

hope this helps
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: poll interface

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Ripper^^
Regular
Posts: 50
Joined: Mon Aug 15, 2005 7:49 am
Location: Gainesville, Florida, USA
Contact:

Thanks!

Post by Ripper^^ »

Thanks Garvin I really appreciate it a bunch, and who doesn't like to get their hands dirty? :D
Post Reply