Glossary Item Box

Modules: Modules

See Also CmsDeveloperGuide Send comments on this topic.

Poll

This module allows you to organize a poll on your site. There could be several polls with different questions on one site. The poll questions can be of two types – checkbox and radiobutton. The poll results can be displayed in graphic bars. The poll questions, their types and voting time settings take place in the CMS system administrative part.

Poll form

To show a poll, it is used a PollForm tag. If the user has already voted, the poll results are displayed in this form. Using a MenuItemGuid of the PollForm tag you can relate your poll form with a certain poll. The poll form can be placed everywhere on the site.

 

To organize several polls on one site you can do the following:

  1. Relate the poll forms, based on different site templates, with different polls.
  2. Place the poll forms, related with different polls, into different Panel controls, which are displayed in required menu items.
 

Example of inserting a poll form into a site page (internal tags description below):

<%@ Register TagPrefix="cmspl" Namespace="CMSLib.Modules.Poll" Assembly="CMSLib" %>

<cmspl:pollform id="PollForm" runat="server" BarBackColors="red" MenuItemGuid="03e2236b-3c37-4109-b930-5b4746961be0">
<Header>
    <table>
        <tr bgColor="paleturquoise">
        <td width="50%"><%# Container.Name %></td>
        <td width="10%"><%# Container.DateBegin %></td>
        <td width="10%"><%# Container.DateEnd %></td>
        <td width="30%"><%# Container.QuestionType %></td>
    </tr>
</Header>
<Answer>
    <tr>
        <td><%# Container.Answer %></td>
        <td><%# Container.Votes %></td>
        <td>
            <table cellSpacing="0" cellPadding="0" border="0">
                <tr>
                <td><%# Container.Percents %></td>
                </tr>
            </table>
        </td>
        <td height="35"><%# Container.Bar %></td>
    </tr>
</Answer>
<Quest>
    <tr>
        <td><%# Container.Answer %></td>
        <td><%# Container.ControlToSave %></td>
    </tr>
</Quest>
<Separator>
    <tr><td colspan="4"><hr /></td></tr>
</Separator>
<Footer>
    <tr height="20">
        <td><a href="<%# Container.LinkToArchive %>">Archive</a></td>
    <td></td>
    <td><%# Container.VotesCount %></td>
    <td></td>
    </tr></table>
</Footer>
<SaveButton>
    <input type="Submit" Value="PollSave"/>
</SaveButton>
</cmspl:pollform>


 

Displaying poll results

To display poll results it is used a PollList tag.

A template file for displaying poll results lies in a modules/poll folder and can look as follows (internal tags description below):

<%@ Control Language="c#" Inherits="CMSLib.Pages.SiteControl" %>
<%@ Register TagPrefix="cmsctp" Namespace="CMSLib.Controls.TemplatePaging" Assembly="CMSLib" %>
<%@ Register TagPrefix="cmspl" Namespace="CMSLib.Modules.Poll" Assembly="CMSLib" %>

<cmspl:PollList id="PollList1" runat="server" PageSize="15" ShowActive="true">
<Header>
    <table>
    <tr>
        <td width="50%"><%# Container.Name %></td>
        <td width="10%"><%# Container.DateBegin %></td>
        <td width="10%"><%# Container.DateEnd %></td>
        <td width="30%"><%# Container.QuestionType %></td>
    </tr>
</Header>
<Answer>
    <tr>
        <td><%# Container.Answer %></td>
        <td><%# Container.Votes %></td>
        <td>
        <table cellspacing="0" cellpadding="0" border="0">
        <tr>
            <td><%# Container.Percents %></td>
            </tr>
        </table>
        </td>
        <td height="35px"><%# Container.Bar %></td>
    </tr>
</Answer>
<Separator>
    <hr />
</Separator>
<Footer>
    <tr>
        <td><a href="<%# Container.LinkToArchive %>=">Archive</a></td>
        <td><%# Container.VotesCount %></TD>
        <td></td>
        <td></td>
    </tr>
    </table>
</Footer>
<WithoutItems></WithoutItems>
</cmspl:PollList>

<cmsctp:TemplatePaging id="TemplatePaging1" runat="server" ControlForNavigate="PollList1" />


 

You can add a poll form to this page if you wish in order to let the user vote, if he didn’t vote on this poll yet.

 

 

Internal tags for the PollForm and PollList tags

Answer and Quest tags of the PollForm and PollList tags are assigned to display information about poll questions. In this tags the following parameters can be used:

Template's part Description
<%# Container.Answer %> Answer for the question
<%# Container.Votes %> Number of votes for the answer
<%# Container.Percents %> Number of votes for the answer in percents
<%# Container.Bar %> HTML code with percent bar
<%# Container.BarBackColor %> Bar's color that representing the poll's percents
<%# Container.ControlToSave %> Control to display checkbox or radiobutton
 

Header and Footer tags of the PollForm and PollList tags are assigned to display general information about a poll. In this tags the following parameters can be used:

Template's part Description
<%# Container.Name %> Poll's name
<%# Container.LinkToArchive %> Link to poll's archive
<%# Container.DateBegin %> Poll's start date
<%# Container.DateEnd %> Poll's end date
<%# Container.LinkToArchive %> Link to poll's archive
<%# Container.QuestionType %> Type of the poll's question
<%# Container.VotesCount %> Summary count of votes for the poll
 

Modules: Modules

 

 


© 2005-2007 Astron Digital Ltd. All Rights Reserved.