Darren Ferguson - Umbraco, Dev, PhoRSS

Monday, July 17, 2006

Poll macro source

Filed under: Umbraco - by Darren Ferguson @ 10:09 AM

I've had a few requests for the Poll macro source to be released. I am very busy at the moment, so I am just posting the ascx and associated c# for now. Those of you who wanted a complete package will have to wait a week or so I am afraid.

A couple of things:
- If you modify my code, please send me your changes with an explanation so that I can incorporate any new features/enhancements into my source controlled version.
- If you find any bugs and are unable to fix them, please drop me an e-mail.
- If you use the Poll on a for profit site please consider making a donation using the link at the bottom of the right hand navigation.

To get you started here is how the Macro tag looks for the demo
<?UMBRACO_MACRO
macroAlias="Poll"
Width="350"
ResponseStoreNodeId="1201"
Question="What does Umbraco need most?"
Responses="More documentation;Database/OS independence;Better Blog extension;Forum extension;Other">
</?UMBRACO_MACRO>

Note: The width property specifies how wide a 100% response bar would be.

You will also need to create a Document type called fmUmbPollResponse with a single property 'Response' that the extension will use to store votes.

As the original post said, this was created as a 20 minute demo project, so don't expect it to be well thought out and 100% stable yet. Obviously any use is entirely at your own risk.

Download from /media/1695/pollsource.zip

Future enhancements:
- Separate layout from code.
- Supply nice default stylesheet
- Add colour list parameter to allow user to specify voting bar appearance.
- Store all responses in a single Umbraco node.

4 comment(s) for “Poll macro sourceComments RSS

  1. Omid Soleymnai says:
    Omid Soleymnai
    Hi,
    Please send me the poll source code.
    I am new in Umbraco and try to learn it better by viewing some nice code.
    Regards,
  2. Omid Soleymnai says:
    Omid Soleymnai
    Oops! I hadn't read the last line.
    I thought it is a contact us form :-D
  3. Darren Ferguson says:
    Darren Ferguson
    The link is just above your first comment!
    Thanks.
    D.
  4. soheila says:
    soheila
    Hello,

    thanks for your helpful code it works without any problem .but i have a bug with it.
    when i click on "vote" button i see results 2 times in my Response Store page
    would you please help me about it?

    Thanks,

Leave a comment

Darren Ferguson - Umbraco, Dev, Pho is published with Umbraco 3.0.5