Not signed in (Sign In)

Categories

Vanilla 1.1.4 is a product of Lussumo. More Information: Documentation, Community Support.

Help keep Vanilla free:
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorskyfex
    • CommentTimeDec 19th 2005 edited
     # 1
    Latest Version
    Poll Extension 0.1
    Requires Vanilla 0.9.3 beta snapshot from Dec 28 or later.

    To use, you need to install two tables:
    CREATE TABLE `LUM_Poll` (
    `PollID` int(8) NOT NULL auto_increment,
    `DiscussionID` int(8) NOT NULL default '0',
    `Title` varchar(255) NOT NULL default '',
    `Options` text,
    PRIMARY KEY (`PollID`)
    ) ENGINE=MyISAM;

    CREATE TABLE `LUM_PollVote` (
    `PollID` int(8) default NULL,
    `UserID` int(10) default NULL,
    `Vote` int(3) NOT NULL
    ) ENGINE=MyISAM;


    You can go to http://bytetastic.com/vanilla/forum/ to see what it's like.
    You can log in with username "User1" through "User7", and password "vanilla".


    Original post
    I'm working on a Poll extension to Vanilla. I haven't gotten to the PHP part yet, but I'd like some feedback on the default style and javascript mechanism.

    http://bytetastic.com/vanilla/poll/

    I'm not sure how to place it in the discussion though. Suggestions?

    I'm new to Vanilla development though, so I'd like to know.. would this be possible with an extension alone? What should I do to make it easy for the user to set up the tables required (an install script?)

    I'd like to get some tips on where to start. I'm experienced with PHP, and I've already written two patches (for the Opera and Safari bug), so I could figure it out myself, but it would be nice to get some tips from those with more experience writing extensions to vanilla.
    •  
      CommentAuthorBergamot
    • CommentTimeDec 19th 2005
     # 2
    Awesome.
    •  
      CommentAuthorKosmo
    • CommentTimeDec 20th 2005
     # 3
    Seems awesome, we are gradually getting to the point where we have the unnecessary gadgets that some forum users demand even tho they have no actual use and they are used once or twice a year, and even then it is a novelty.

    I hate it when I suggest people to migrate to Vanilla and they are like "but it doesn't have polls, or this and that unnecessary feature that you could as well put in to your site by some cleverly hacked poll script that is as good or even better than the one integrated to your forum engine"

    Now if the Vanilla 1 will introduce quotation nobody should have anything to say.
    •  
      CommentAuthoradrian.
    • CommentTimeDec 20th 2005
     # 4
    and bbcode buttons on the form.
    • CommentAuthorMinisweeper
    • CommentTimeDec 20th 2005 edited
     # 5
    I think it'd be nice built into the control panel. If it was forum wide it could stay there all the time, or if it was for a particular discussion it could just appear on that discussion (and add [poll] or whatever like [sticky] etc.) While it might be a handy feature, what we do have to remember is that technically the discussion is the most important part of the forum (surprise!) so i think it's important to avoid disrupting the flow of the text. The most that should be put into the body of the forum (imo) is perhaps a 'polled' like the 'edited' next to someones name if it isnt an anonymous vote.
    • CommentAuthortimberford
    • CommentTimeDec 20th 2005
     # 6
    i'd definitely use a poll function and that looks well underway. as for feedback on the default style. are you looking to make it fit with mark's default vanilla style?

    If so then you need to change the font to font-family: Trebuchet MS, Verdana, Tahoma, Arial; and i'd swap the green for yellow #FEF9E9 with a border of #FFEDAE.
    • CommentAuthoreB
    • CommentTimeDec 20th 2005
     # 7
    The parentheses are funky on Opera. Other than that, pretty sweet.
    •  
      CommentAuthorskyfex
    • CommentTimeDec 20th 2005
     # 8
    I actually thought polls wouldn't be a problem when I created my community. But even though it was very small, the need immediately came up. So that's why I decided to go for it myself.

    timberford: I dunno.. I think it might be good to distinguish it, but I'll tweak the style more after I have it integrated with the forum to see what works out. I'll make sure to fix the font. I can imagine it doesn't look too great for you Windows users who don't have Lucida Grande, I didn't think about that before publishing it.

    I haven't made much progress.. Just been looking through existing code to see how the extensions system is built. It looks like it might be pretty straightforward.
    •  
      CommentAuthorJan
    • CommentTimeDec 21st 2005
     # 9
    I'm looking forward to see a poll extension for Vanilla. It's looking really promising, skyfex - keep up the good work!
    • CommentAuthortimberford
    • CommentTimeDec 21st 2005
     # 10
    yeah once it's integrated it will be a lot easier to tweak visually. will be good though
    •  
      CommentAuthorJan
    • CommentTimeDec 22nd 2005 edited
     # 11
    Apples to Oranges has some really cool CSS styling techniques for bar graphs. This might be of interest.
    •  
      CommentAuthorskyfex
    • CommentTimeDec 22nd 2005
     # 12
    I think I'm going to develop this extension for 0.9.3 instead. Is everyone okey with that? (=P) It just seems to be too much work with 0.9.2.6.
    •  
      CommentAuthorBergamot
    • CommentTimeDec 22nd 2005
     # 13
    fine with me :D
    •  
      CommentAuthorskyfex
    • CommentTimeDec 22nd 2005
     # 14
    Yeay.. It was much easier to get started with 0.9.3. Thanks to jazzman for the Attachment extension. It helps a lot. So I've managed to add the test-poll to discussions. It shouldn't be too hard from here on out. Just a lot of coding.

    http://bytetastic.com/vanilla/Picture%201.png
    It's the only place I could put it with just delegates. But I think it looks fine. CSS can still change, so I will still take suggestions for the default style. Perhaps I'll match the Attachment extension and make it a blue shade. It would match the default vanilla style more too. But I like the green. It kind of screams "Look at me! I'm a poll!" =P I'll see what it looks like in blue.
    •  
      CommentAuthorskyfex
    • CommentTimeDec 22nd 2005
     # 15
    This is what I came up with:
    http://bytetastic.com/vanilla/Picture%203.png

    I still like the green better. I couldn't get orange (like the comment form) to work out.
    •  
      CommentAuthorBergamot
    • CommentTimeDec 22nd 2005 edited
     # 16
    Is there anyway to tell from the "PreCommentOptionsRender" delegate's parameters whether a comment is the first one in the thread?
    •  
      CommentAuthorskyfex
    • CommentTimeDec 22nd 2005
     # 17
    Yeah.. There is, I think, but it doesn't seem to be completely straightforward. I could place it inside the body of the text (at the beginning would probably be best). Perhaps that would be better. What do you guys think?

    http://bytetastic.com/vanilla/Picture%204.png
    •  
      CommentAuthorskyfex
    • CommentTimeDec 25th 2005 edited
     # 18
    Small update:
    I've managed to load the data from the database, instead of being just hardcoded. The extension needs two new tables:

    Poll:
    `PollID` int(8) NOT NULL auto_increment,
    `DiscussionID` int(8) NOT NULL default '0',
    `Title` varchar(255) NOT NULL default '',
    `Options` text

    PollVote:
    `PollID` int(8) default NULL,
    `UserID` int(10) default NULL,
    `Vote` int(3) NOT NULL


    Where "Options" is a serialized array, with the title of the options (for example serialize(array("The Simpsons", "South Park")); ).

    Major tasks left is:
    - Voting through AJAX
    - Creating a poll in the Discussion form
    •  
      CommentAuthorskyfex
    • CommentTimeDec 25th 2005 edited
     # 19
    What is the standard method for extensions to use AJAX?
    Edit: Nevermind. I found an example.
    •  
      CommentAuthorskyfex
    • CommentTimeDec 25th 2005
     # 20
    The AJAX voting is complete! There are probably security holes though. I have to go through the code eventually to check that users can't vote in discussions they're not allowed to access etc..

    Should users be allowed to vote in a closed discussion?
    •  
      CommentAuthorlech
    • CommentTimeDec 25th 2005
     # 21
    I'd recommend that if the discussion is closed, then voting should also be closed for that discussion.
    •  
      CommentAuthorBergamot
    • CommentTimeDec 25th 2005
     # 22
    Agreed.
    •  
      CommentAuthorgiginger
    • CommentTimeDec 26th 2005
     # 23
    Maybe it could be an option?

    Sometimes you might just want people to vote on something but not wax lyrical.

    I reckon an admin option to have the thread closed and stickied but still be votable in would be useful.

    Of course, I like complicating things.
    •  
      CommentAuthorskyfex
    • CommentTimeDec 26th 2005
     # 24
    I think I'll make it a setting in the extension so that you can configure it with the conf/ files or something.

    Another issue: Should people be able to edit their polls? The problem is that they could manipulate the results (by switching positions etc.), but I've come across many instances where people want to add new options, for example.
    •  
      CommentAuthorskyfex
    • CommentTimeDec 26th 2005 edited
     # 25
    Creating Polls is finished. Pictures:
    http://bytetastic.com/vanilla/Picture%205.png
    http://bytetastic.com/vanilla/Picture%206.png

    A new option field is automagically created when you start writing in the one furthest down.

    I'd still like feedback on wether or not one should be able to edit them.

    This was easier than I expected. <3 Vanila

    mark: Will you include this extension in the default Vanilla 0.9.3 distribution if I finish it before you're done?
  1.  # 26
    i know this isnt entirely the question you asked, but are *any* extensions being included in the v1 distribution?
    •  
      CommentAuthorBergamot
    • CommentTimeDec 26th 2005
     # 27
    Making polls and then editing the options to skew results seems kind of silly; these things were never scientific research tools. I can think of several legitimate reasons, though, why someone would want to edit their options (typos, clarifications, changes, additions)

    I would be happy to install your extension on my site; let's just say that if it works there, it'll work anywhere
    •  
      CommentAuthorBergamot
    • CommentTimeDec 26th 2005
     # 28
    mini: 0.9.3 is pretty sparse with no extensions.
  2.  # 29
    and...?
    •  
      CommentAuthorskyfex
    • CommentTimeDec 26th 2005 edited
     # 30
    It's finally finished! At least to a degree which lets me release an acceptable beta.

    Poll Extension 0.1
    Which requires Vanilla 0.9.3 of course.

    To use, you need to install two tables:
    CREATE TABLE `LUM_Poll` (
    `PollID` int(8) NOT NULL auto_increment,
    `DiscussionID` int(8) NOT NULL default '0',
    `Title` varchar(255) NOT NULL default '',
    `Options` text,
    PRIMARY KEY (`PollID`)
    ) ENGINE=MyISAM;

    CREATE TABLE `LUM_PollVote` (
    `PollID` int(8) default NULL,
    `UserID` int(10) default NULL,
    `Vote` int(3) NOT NULL
    ) ENGINE=MyISAM;


    I'll write a PHP script to do it some other time.

    You can go to http://bytetastic.com/vanilla/forum/ to see what it's like.
    You can log in with username "User1" through "User7", and password "vanilla".
    •  
      CommentAuthorBergamot
    • CommentTimeDec 27th 2005
     # 31
    Hmm, doesn't work here (probably my fault, since I'm running a relatively old and modified revision).

    Copied the files into the extension folder, made the two tables in the database, enabled the extension, started a new discussion, made some poll options and a question (the form works great), but no poll appears in the post.

    I checked the database, and the two poll tables are empty.

    Tomorrow I'll do some debugging and see if the delegates you hooked into are even there in my copy.
    •  
      CommentAuthorskyfex
    • CommentTimeDec 27th 2005
     # 32
    Ah.. No, I think I used a modified delegate after all. Sorry. It's one of the delegates from the Attachment extension:

    Open File:

    Vanilla.Control.DiscussionForm

    =================================================
    Find on Line 97:

    $ResultDiscussion = $dm->SaveDiscussion($this->Discussion);

    Inset After:

    $this->DelegateParameters["ResultDiscussion"] = &$ResultDiscussion;
    $this->CallDelegate("PostSaveDiscussion");
    •  
      CommentAuthorBergamot
    • CommentTimeDec 27th 2005
     # 33
    Well I've been meaning to install the Attachment extension anyway...
    •  
      CommentAuthorskyfex
    • CommentTimeDec 27th 2005
     # 34
    •  
      CommentAuthorBergamot
    • CommentTimeDec 27th 2005 edited
     # 35
    Well I got that problem fixed, but the poll still wouldn't display when I looked at the thread.

    In the end I discovered that "$Comment->Body = $output.$Comment->Body;" wasn't doing anything, so I replaced it with "echo($output);" and everything worked.

    Now, to figure out why the attachment extension is having the same problem...
    •  
      CommentAuthorskyfex
    • CommentTimeDec 27th 2005
     # 36
    Bergamot: Hmm.. Odd. Is your snapshot of 0.9.3 old? The thing is, if you echo the output, it just appears at the top of the entire Discussion form. If you add it to the body of the comment, it'll appear inside the comment (just the first comment for Polls). I have no idea why it wouldn't work for you.
    • CommentAuthortimberford
    • CommentTimeDec 28th 2005
     # 37
    that poll extension is really good skyfex, but i do think that users shouldn't be able to change their vote each time they visit the topic.
  3.  # 38
    Since when were people ever allowed to change their votes? It's not like you walk in on poll day, vote for someone, realise someone else is becoming more popular, and then go back and change yours?
    •  
      CommentAuthorBergamot
    • CommentTimeDec 28th 2005
     # 39
    I got it working; turns out it *was* my fault; I moved the comment options to after the body, and the delegate with it. Moving it back fixed it.

    I kind of like the vote changing, it keeps the results lively.
    •  
      CommentAuthorskyfex
    • CommentTimeDec 28th 2005
     # 40
    I could make changing your vote an option. But it's harder to not let the user change their vote than it is letting them do it, so I won't do it right now =P
    • CommentAuthorwicho
    • CommentTimeMar 29th 2006
     # 41
    Hi all,

    After seeing your poll extension I had to try 0.9.3 to install this. Being a compleet newbie to mysql, php and css it took me a litlle time to get it up and running, but I got it right now. Only problem: I can't get the poll working.

    I installed it in the extensions folder. renamed poll.php to default.php to get it recognized by vanilla. no problems until I try to open a discussion. then about 8 errors are reported starting with this one:

    Notice: Undefined index: Poll in vogelblik.nl/vanilla/library/Framework/Framework.Functions.php on line 369

    the rest appear to be a result of this one

    Warning: Missing argument 2 for addselect() in vogelblik.nl/vanilla/library/Framework/Framework.Class.SqlBuilder.php on line 85

    Warning: Missing argument 4 for addwhere() in vogelblik.nl/vanilla/library/Framework/Framework.Class.SqlBuilder.php on line 114

    Warning: Missing argument 5 for addwhere() in vogelblik.nl/vanilla/library/Framework/Framework.Class.SqlBuilder.php on line 114

    Notice: Undefined index: DiscussionID in vogelblik.nl/vanilla/library/Framework/Framework.Class.SqlBuilder.php on line 115

    Notice: Undefined index: in vogelblik.nl/vanilla/library/Framework/Framework.Class.SqlBuilder.php on line 115

    Notice: Undefined index: = in vogelblik.nl/vanilla/library/Framework/Framework.Class.SqlBuilder.php on line 116

    Notice: Undefined index: in vogelblik.nl/vanilla/library/Framework/Framework.Class.SqlBuilder.php on line 116

    A fatal, non-recoverable error has occurred
    Technical information (for support personel):

    Error Message
    An error occured while getting the poll for this discussion.
    Affected Elements
    Poll.GetPollFromDiscussionID();

    The error occurred on or near: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''=.' limit 0, 1' at line 1

    any suggestions?
    • CommentAuthorynzheng
    • CommentTimeMar 31st 2006
     # 42
    any one can send http://bytetastic.com/vanilla/Polls.zip to me ?

    i cannot downloat it!

    EMail:ynzheng@gmail.com

    much thx
    • CommentAuthorwicho
    • CommentTimeApr 1st 2006
     # 43
    mail has been send
    • CommentAuthorShino
    • CommentTimeJun 16th 2006
     # 44
    Please, me to : ulrich.jr(at)gmail.com

    Thank you :)
    • CommentAuthorLooZ^
    • CommentTimeJun 25th 2006
     # 45
    Any news about poll.extentsion for v1?
    •  
      CommentAuthorbugsmi0
    • CommentTimeSep 26th 2006
     # 46
    has the poll extension been updated for the latest vanilla release ? I doesn't give that indication on this dicussion but there appears to be an updated one in the addon
Add your comments
    Username Password
  • Format comments as