Forums / Setup & design / poll locking

poll locking

Author Message

Marko Žmak

Saturday 27 November 2004 3:02:30 pm

I have several polls on my site and I would like to 'lock' some of them. So that users can vote only for polls that aren't locked but view results for all of them.

Is there any mechanism in eZ that provides that functionallity?

I know that it can be done by overriding some templates, but I want to know if there's a more generic eZ solution.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Tuesday 30 November 2004 4:05:34 pm

Does anyone have an answer to this?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Łukasz Serwatka

Tuesday 30 November 2004 10:31:00 pm

Hi,

Poll i normaly object so you can build templeate for for this class and add this to view results.

{set-block scope=global variable=title}{'Poll %pollname'|i18n('design/standard/content/poll',,hash('%pollname',$node.name))}{/set-block}


 <div class="folderTitle">Poll results</div><br />

<div style="padding-left: 4px">

{section loop=$node.object.contentobject_attributes}
    {section show=$:item.contentclass_attribute.is_information_collector}
	{let  attribute=$:item
	      contentobject_attribute_id=cond($attribute|get_class|eq('ezinformationcollectionattribute'),$attribute.contentobject_attribute_id,
                                     $attribute|get_class|eq('ezcontentobjectattribute'),$attribute.id)
     contentobject_attribute=cond($attribute|get_class|eq('ezinformationcollectionattribute'),$attribute.contentobject_attribute,
			          $attribute|get_class|eq('ezcontentobjectattribute'),$attribute)
     total_count=fetch('content','collected_info_count', hash( 'object_attribute_id', $contentobject_attribute_id ) )
     item_counts=fetch('content','collected_info_count_list', hash( 'object_attribute_id', $contentobject_attribute_id  ) ) }

<h3>{$contentobject_attribute.content.nazwa}</h3>

<table width="100%"border="0" cellspacing="0" cellpadding="0">
<tr>
{section name=Option loop=$contentobject_attribute.content.option_list}
    {let item_count=0}
    {section show=is_set($item_counts[$:item.id])}
        {set item_count=$item_counts[$:item.id]}
    {/section}
<td>

    </td>

    <td>
        <table width="250px" cellspacing="0" cellpadding="0" border="0">
  <tr>
<td colspan="2">
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%" align="left" height="23">{$:item.value}</td>
    <td width="50%" align="right"><strong>{div(mul($:item_count,100),$total_count)|l10n(number)} % </strong> ({$:item_count})
</td>
  </tr>
</table>
</td>
</tr>
        <tr>
            <td bgcolor="#890101" height="2" width="{div(mul($:item_count,250),$total_count)}"></td>
            <td bgcolor="#D9D9D9" height="2" width="{sub(250,div(mul($:item_count,250),$total_count))}"></td>
        </tr>
        </table>
    </td>
<td>
       
    </td>

    {/let}

    {delimiter}
</tr>
<tr>
    {/delimiter}

{/section}
</tr>
</table>

{/let}

    {section-else}

        {section show=$attribute_hide_list|contains($:item.contentclass_attribute.identifier)|not}
            <div class="object_title">{attribute_view_gui attribute=$:item}</div>
        {/section}

    {/section}

{/section}

<br/>

{"%count total votes"|i18n( 'design/standard/content/poll' ,,
                             hash( '%count', fetch( content, collected_info_count, hash( object_id, $node.object.id ) ) ) )}

</div>

Just paste it into new template thet display poll results. You will get only results so your users cant`t vote for it any more.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Marko Žmak

Wednesday 01 December 2004 11:28:10 am

As I mentioned before, I know that it can be done this way, but I was looking for another solution. Because in your solution the problem is just half solved, you only hide the form used for poll voting, but users can still vote for this poll by posting data in some other way.

The problem is in the template that processes the poll data, how do I make it to process only some polls?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Łukasz Serwatka

Thursday 02 December 2004 7:09:03 am

Because in your solution the problem is just half solved, 
you only hide the form used for poll voting, 
but users can still vote for this poll by posting data in some other way.

Who will be posting data in some other way? I closed poll by viewing only results of this poll and I`m sure that nobody post data using other way. I never vot for a poll using emulator of post method ;-)

I remember that closing poll was submited as a new suggestion.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Marko Žmak

Thursday 02 December 2004 3:40:00 pm

> Who will be posting data in some other way?

Then you are sure that you ore the people who you make this site for don't have any enemies who want to fake thei poll data. If so, your solution is O.K. but I don't want to exclude any possibility.

> I remember that closing poll was submited as a new suggestion.

What happened to that? Is it done in some new version? eZ crew?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

eZ debug

Timing: Jan 19 2025 06:25:42
Script start
Timing: Jan 19 2025 06:25:42
Module start 'content'
Timing: Jan 19 2025 06:25:42
Module end 'content'
Timing: Jan 19 2025 06:25:42
Script end

Main resources:

Total runtime0.1642 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0079 589.9609180.8516
Module start 'content' 0.00790.0061 770.8125101.8516
Module end 'content' 0.01400.1502 872.6641529.9609
Script end 0.1641  1,402.6250 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00432.6058200.0002
Check MTime0.00160.9945200.0001
Mysql Total
Database connection0.00090.539010.0009
Mysqli_queries0.115270.17521410.0008
Looping result0.00130.77831390.0000
Template Total0.149791.210.1497
Template load0.00130.780810.0013
Template processing0.148490.401210.1484
Override
Cache load0.00090.542010.0009
Sytem overhead
Fetch class attribute can translate value0.00110.640210.0011
XML
Image XML parsing0.00040.246710.0004
General
dbfile0.00382.3083200.0002
String conversion0.00000.003030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs