Poll List portlet


Jump to: navigation, search
Poll List portlet
module: Content module
supplier: VYRE Ltd.

The Poll List Portlet is used to display the list of polls which have been created


User can find this portlet under the “Polling portlets” section in ”Portlet Types” page

When adding the portlet user will be asked to enter values for the given fields. File:Poll_List_Portlet_Edit_mode.JPG

Example of generated XML output
    <poll total="8" id="156"> 
      <name>Poll with Strategy 'None'</name>  
      <question>Poll with Strategy 'None'</question>  
      <creation-date>16.09.2009 14:31</creation-date>  
        <answer percentage="87.5" id="156" index="0" count="7"> 
        <answer percentage="12.5" id="157" index="1" count="1"> 
    <poll total="3" id="157"> 
      <name>Poll with Strategy 'Cookie'</name>  
      <question>Poll with Strategy 'Cookie'</question>  
      <creation-date>16.09.2009 14:31</creation-date>  
        <answer percentage="100.0" id="159" index="0" count="3"> 
        <answer percentage="0.0" id="158" index="1" count="0"> 
        <answer percentage="0.0" id="162" index="2" count="0"> 


XSL stylesheet:

Create the XSL file to display the list of polls under Publishing > XSL > Others and select the correct xsl file name in this dropdown

Sample XSL file
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE xsl:stylesheet  [
<!ENTITY nbsp   "&#160;">
<!ENTITY copy   "&#169;">
<!ENTITY reg    "&#174;">
<!ENTITY trade  "&#8482;">
<!ENTITY mdash  "&#8212;">
<!ENTITY ldquo  "&#8220;">
<!ENTITY rdquo  "&#8221;">
<!ENTITY pound  "&#163;">
<!ENTITY yen    "&#165;">
<!ENTITY euro   "&#8364;">
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html" encoding="iso-8859-1"/>
  <!-- Remove for Vyre 4.3 and lower -->
  <xsl:param name="current_path" ></xsl:param>
  <xsl:param name="context_path" ></xsl:param>
  <!--                               -->
  <xsl:template match="/">
    <!--textarea><xsl:copy-of select ="*"/></textarea-->
    <h3><xsl:value-of select="search-results/size"/></h3>
    <xsl:apply-templates select="search-results/polls"/>
  <xsl:template match="polls">
  	<table cellspacing = "0" cellpadding = "0" border = "0">
	      <th class = "first">id</th>
	      <th class = "second">question</th>
	      <th class = "third">count</th>
	      <th class = "forth">creation-date</th>
	      <th class = "fifth">edit</th>
		<xsl:apply-templates select="poll"/>
  <xsl:template match="poll">
	  <td><xsl:value-of select="@id"/></td>
	  <td><a href="{$context_path}/polling_portlets/polling_portlets_view/?pollId={@id}"><xsl:value-of select="question"/></a></td>
	  <td><xsl:value-of select="@total"/></td>
	  <td><xsl:value-of select="creation-date"/></td>
	  <td><a href="{$context_path}/polling_portlets/polling_portlets_create/?pollId={@id}">edit</a></td>

Field to sort by:

This Dropdown displays the fields: id,name,question,answer,CreationDate,strategy. User can select any of them to sort the results in Ascending order.

Sort in descending order:

If the user checks this checkbox, the results will get sorted in Decending order

Results per page:

User can limit the number of results per page by using this field. System will display the pagination according to the given number for this field

See Also

Personal tools