[comment]
ui_name: poll
ui_type: component
ui_class: vertical
ui_group: info
ui_label: Quick one-question poll

code:
	label: Poll ID
	lookup_query: select distinct code, question from poll
	type: select

answer_type:
	label: Answer type
	default: select
	options: radio_left_1=Radio box, select=Dropdown, checkbox_left_1=Checkbox (multiple choice)
	type: select

submit_label:
	label: Button text
	type: text_10
	default: Go

[/comment]
<!-- BEGIN COMPONENT poll -->

[tmp tmp_answered][calc]
		my $code = $Tag->control('code');
		return $Session->{quickpoll}{$code};
		[/calc][/tmp]

[if !scratch tmp_answered] 

	[loop list="[control code]"]
	<form action="[area quickpoll]">
	[form-session-id]
	<input type=hidden name="poll" value="[loop-code]">
	<input type=hidden name="mv_nextpage" value="@@MV_PAGE@@">
	<input type=hidden name="mv_arg" value="[data session arg]">
	  <div class=titlebox>
		[either][loop-data quickpoll title][or]Quick poll[/either]
	  </div>
	  <div class=shadowbox>
			[loop-data quickpoll question]<br>
			[display
				name="answer"
				type="[control answer_type radio_left_1]"
				passed="[loop-data quickpoll choices]"
			]
			<br>
			<input type=submit value="[control submit_label Go]">
	  </div>
	</form>
	[/loop]

[else]
	[loop list="[control code]"]
	  <div class=titlebox>
		[either][loop-data quickpoll title][or]Quick poll[/either]
	  </div>
	  <div class=shadowbox>
			<h5>[loop-data quickpoll question]</h5>
			[poll-answer code="[control code]"]
	  </div>
	[/loop]
[/else]
[/if]

<!-- END COMPONENT poll -->
