-{if $__wcf->getUser()->userID && !$__pollLoadedJavaScript|isset}
+{if ($__wcf->getUser()->userID || $poll->canSeeResult() || $poll->canViewParticipants()) && !$__pollLoadedJavaScript|isset}
{assign var=__pollLoadedJavaScript value=true}
<script data-relocate="true" src="{@$__wcf->getPath()}js/WCF.Poll{if !ENABLE_DEBUG_MODE}.min{/if}.js?v={@$__wcfVersion}"></script>
<script data-relocate="true">
</script>
{/if}
-<div class="container containerPadding pollContainer" data-poll-id="{@$poll->pollID}" data-can-vote="{if $poll->canVote()}1{else}0{/if}" data-can-view-result="{if $poll->canSeeResult()}1{else}0{/if}" data-can-view-participants="{if $poll->isPublic}true{else}false{/if}" data-in-vote="{if $poll->canVote() && !$poll->isParticipant()}1{else}0{/if}" data-question="{$poll->question}" data-max-votes="{@$poll->maxVotes}">
+<div class="container containerPadding pollContainer" data-poll-id="{@$poll->pollID}" data-can-vote="{if $poll->canVote()}1{else}0{/if}" data-can-view-result="{if $poll->canSeeResult()}1{else}0{/if}" data-can-view-participants="{if $poll->canViewParticipants()}true{else}false{/if}" data-in-vote="{if $poll->canVote() && !$poll->isParticipant()}1{else}0{/if}" data-question="{$poll->question}" data-max-votes="{@$poll->maxVotes}">
<fieldset>
<legend>{$poll->question} <span class="badge jsTooltip" title="{lang}wcf.poll.totalVotes{/lang}">{#$poll->votes}</span></legend>
</div>
</fieldset>
- {if $__wcf->getUser()->userID}
+ {hascontent}
<div class="formSubmit jsOnly">
- <button class="small jsButtonPollVote">{lang}wcf.poll.button.vote{/lang}</button>
- <button class="small jsButtonPollShowVote">{lang}wcf.poll.button.showVote{/lang}</button>
- <button class="small jsButtonPollShowResult">{lang}wcf.poll.button.showResult{/lang}</button>
- <button class="small jsButtonPollShowParticipants">{lang}wcf.poll.button.showParticipants{/lang}</button>
- {event name='pollButtons'}
+ {content}
+ {if $__wcf->getUser()->userID}
+ <button class="small jsButtonPollVote">{lang}wcf.poll.button.vote{/lang}</button>
+ <button class="small jsButtonPollShowVote">{lang}wcf.poll.button.showVote{/lang}</button>
+ <button class="small jsButtonPollShowResult">{lang}wcf.poll.button.showResult{/lang}</button>
+ {/if}
+ {if $poll->canViewParticipants()}
+ <button class="small jsButtonPollShowParticipants">{lang}wcf.poll.button.showParticipants{/lang}</button>
+ {/if}
+
+ {event name='pollButtons'}
+ {/content}
</div>
- {/if}
+ {/hascontent}
</div>
\ No newline at end of file
* @category Community Framework
*/
class PollAction extends AbstractDatabaseObjectAction implements IGroupedUserListAction {
+ /**
+ * @see wcf\data\AbstractDatabaseObjectAction::$allowGuestAccess
+ */
+ protected $allowGuestAccess = array('getGroupedUserList');
+
/**
* @see wcf\data\AbstractDatabaseObjectAction::$className
*/
if (!$this->poll->pollID) {
throw new UserInputException('pollID');
}
- else if (!$this->poll->isPublic || !$this->poll->canSeeResult()) {
+ else if (!$this->poll->canViewParticipants()) {
throw new PermissionDeniedException();
}
}