Test:Poll
From EcoReality
Proposal for implementing a poll system.
Contents |
[edit]
Operation:
- A poll-taker starts a new page
- Any amount of text before and after the <poll></poll> is treated as normal Wikitext.
- Inside the <poll></poll> is the following XML:
- exactly one expiration date (wrapped in <expires></expires>), after which the poll stops taking entries, and only displays results
- exactly one <title>, which is shown at the top of the poll
- any number of poll <item> items
- zero or one <other />, which results in a fill-in field
- upon saving, it would be nice if the poll could be write-protected
- A person visits the page
- If the visitor's username or IP address has already voted, that fact is noted and the poll results are displayed.
- If the expiration time has passed, the poll results are displayed.
- Otherwise, a form is generated with the items previously entered.
- Upon accepting the form, the poll results are displayed.
[edit]
Implementation:
- raw database access using PHP/MySQL calls for now
- possibly use MediaWiki's generalized database interface later
- POLL table holds per-poll data, keyed by <expires>
- AUTHOR username of author
- TITLE text
- ITEM table holds items, foreign key <expires>
- RESULTS table holds results, key <expires> and username or IP
- display histograms using ImageMagick or GD
[edit]
Issues/Problems:
- how to scrape the screen after fill-in (target of <form>?)
- should items be kept in entered order, or alphabetized (both create bias), or randomized? (Authoring option?)
- should stuff entered as <other /> be dynamically added to the ITEM table, and displayed on future views? (Authoring option?)
- allow wikitext or HTML in title and items for some simple formatting?
- menu syntax sounds like a lot of work for a tiny bit of user comfort. Don't design it out -- maybe V2.
[edit]
Example Code:
<poll><br>
<expires>200502152200</expires> <!-- After this date/time, no new data is collected, but results are shown. /><br>
<title>Where should we make our home?</title><br>
<menu>In a<br>
<menuitem>boat</menuitem><br>
<menuitem>car</menuitem><br>
<menuitem>closet</menuitem><br>
</menu><br>
<item>In the zoo.</item><br>
<item>In the school.</item><br>
<item>In a tree.</item><br>
<other /> <!-- Allows an "other" choice, with a blank to collect additional choices /><br>
</poll>
[edit]
Example Output:
<poll>
- <expires>200502152200</expires> <!-- After this date/time, no new data is collected, but results are shown. />
- <title>Where should we make our home?</title>
- <menu>In a
- <menuitem>boat</menuitem>
- <menuitem>car</menuitem>
- <menuitem>closet</menuitem>
- <menuitem>boat</menuitem>
- .</menu>
- <item>In the zoo.</item>
- <item>In the school.</item>
- <item>In a tree.</item>
- <other /> <!-- Allows an "other" choice, with a blank to collect additional choices />
</poll>

