
{include file="../head.tpl"}

{if count($errors)}
<ul>
	{foreach from=$errors item=error}
	<li>{$error}</li>
	{/foreach}
</ul>
{/if}

<form action="poll.php?action=new" method="post">
<input type="hidden" name="area_id" value="{$smarty.request.area}" />
<input type="hidden" name="poll_id" value="{if $editerror==1}{$poll_id}{else}{$poll->id|default:"-1"}{/if}" />
	<table width="100%"  border="0" cellspacing="1" cellpadding="5" class="tableborder">
		<tr>
			<td class="header" colspan="2">{if $smarty.request.action=="edit"}{$langadmin.poll_edit}{else}{$langadmin.poll_add}{/if}</td>
		</tr>
		<tr>
			<td class="firstrow">{$langadmin.title}</td>
			<td class="secondrow">
				<input name="title" type="text" size="50" value="{if $smarty.request.action=="new"}{$title|escape:"htmlall"}{else}{$poll->title|escape:"htmlall"}{/if}" />
			</td>
		</tr>
		<tr>
			<td class="firstrow">
				{$langadmin.start_date}
			</td>
			<td class="secondrow">

			
				<select name="s_day">
					{section name=s_day loop=32 start=1}
					<option value="{$smarty.section.s_day.index}" 
						{if 
							$smarty.post.s_day == $smarty.section.s_day.index or
							$poll->start_date.day == $smarty.section.s_day.index
						}
							selected
						{/if}>{$smarty.section.s_day.index}</option>
					{/section}
				</select>
				<select name="s_mon">
					{section name=s_mon loop=13 start=1}
					<option value="{$smarty.section.s_mon.index}" 
						{if 
							$smarty.post.s_mon == $smarty.section.s_mon.index or
							$poll->start_date.mon == $smarty.section.s_mon.index
						}
							selected
						{/if}>{$smarty.section.s_mon.index}</option>
					{/section}
				</select>
				<select name="s_year">
					{section name=s_year loop=$year+50 start=$year}
					<option value="{$smarty.section.s_year.index}" 
						{if 
							$smarty.post.s_year == $smarty.section.s_year.index or
							$poll->start_date.year == $smarty.section.s_year.index
						}
							selected
						{/if}>{$smarty.section.s_year.index}</option>
					{/section}
				</select>
				
				
				&nbsp;-&nbsp;<select name="s_hour">
					{section name=s_hour loop=24 start=0}
					<option value="{$smarty.section.s_hour.index}" 
						{if 
							$smarty.post.s_hour == $smarty.section.s_hour.index or
							$poll->start_date.hour == $smarty.section.s_hour.index
						}
							selected
						{/if}>{$smarty.section.s_hour.index}</option>
					{/section}
				</select>
				<select name="s_min">
					{section name=s_min loop=60 start=0}
					<option value="{$smarty.section.s_min.index}" 
						{if 
							$smarty.post.s_min == $smarty.section.s_min.index or
							$poll->start_date.min == $smarty.section.s_min.index
						}
							selected
						{/if}>{$smarty.section.s_min.index}</option>
					{/section}
				</select>
			</td>
		</tr>
		<tr>
			<td class="firstrow">
				{$langadmin.end_date}
			</td>
			<td class="secondrow">
				<select name="e_day">
					{section name=e_day loop=32 start=1}
					<option value="{$smarty.section.e_day.index}" 
						{if 
							$smarty.post.e_day == $smarty.section.e_day.index or
							$poll->end_date.day == $smarty.section.e_day.index
						}
							selected
						{/if}>{$smarty.section.e_day.index}</option>
					{/section}
				</select>
				<select name="e_mon">
					{section name=e_mon loop=13 start=1}
					<option value="{$smarty.section.e_mon.index}" 
						{if 
							$smarty.post.e_mon == $smarty.section.e_mon.index or
							$poll->end_date.mon == $smarty.section.e_mon.index
						}
							selected
						{/if}>{$smarty.section.e_mon.index}</option>
					{/section}
				</select>
				<select name="e_year">
					{section name=e_year loop=$year+100 start=$year}
					<option value="{$smarty.section.e_year.index}" 
						{if 
							$smarty.post.e_year == $smarty.section.e_year.index or
							$poll->end_date.year == $smarty.section.e_year.index
						}
							selected
						{/if}>{$smarty.section.e_year.index}</option>
					{/section}
				</select>
				
				&nbsp;-&nbsp;<select name="e_hour">
					{section name=e_hour loop=24 start=0}
					<option value="{$smarty.section.e_hour.index}" 
						{if 
							$smarty.post.e_hour == $smarty.section.e_hour.index or
							$poll->end_date.hour == $smarty.section.e_hour.index
						}
							selected
						{/if}>{$smarty.section.e_hour.index}</option>
					{/section}
				</select>
				
				
				<select name="e_min">
					{section name=e_min loop=60 start=0}
					<option value="{$smarty.section.e_min.index}" 
						{if 
							$smarty.post.e_min == $smarty.section.e_min.index or
							$poll->end_date.min == $smarty.section.e_min.index
						}
							selected
						{/if}>{$smarty.section.e_min.index}</option>
					{/section}
				</select>
			</td>
		</tr>
		<tr>
			<td class="firstrow">{$langadmin.status}</td>
			<td class="secondrow">
				<select name="active">
					<option value="1"
						{if 
							$smarty.post.active or
							$poll->active
						}
							selected
						{/if}>{$langadmin.active}</option>
					<option value="0"
						{if 
							$smarty.post.active == 0 and
							$poll->active == 0
						}
							selected
						{/if}>{$langadmin.inactive}</option>
				</select>
			</td>
		</tr>
		<tr>
			<td class="firstrow">{$langadmin.poll_allow_comments}</td>
			<td class="secondrow">
				<select name="can_comment">
					<option value="1"
						{if 
							$smarty.post.can_comment == 1 or
							$poll->can_comment == 1
						}
							selected
						{/if}>{$langadmin.yes}</option>
					<option value="0"
						{if 
							$smarty.post.can_comment == 0 and
							$poll->can_comment == 0
						}
							selected
						{/if}>{$langadmin.no}</option>
				</select>
			</td>
		</tr>
		<tr>
			<td class="firstrow">{$langadmin.poll_id_vaiable}</td>
			<td class="secondrow">
				<select name="place">
				{section name=place loop=51 start=1}
					<option value="{$smarty.section.place.index}"
						{if 
							$smarty.post.place == $smarty.section.place.index or
							$poll->place_id == $smarty.section.place.index
						}
							selected
						{/if}>{$smarty.section.place.index}</option>
				{/section}
				</select>
			</td>
		</tr>
		<tr>
			<td width="20%" valign="top" class="firstrow">{$langadmin.groupsmain}<br /><small>{$langadmin.poll_select_groups}</small></td>
			<td class="secondrow">
				<select name="group[]" multiple size="7">
		    	{foreach from=$groups item=group}
					<option value="{$group->ugroup}" {if $poll->group_id}{if (in_array($group->ugroup, $poll->group_id)) || ($smarty.request.action == "new")}selected{/if}{/if}>{$group->groupname}</option>
		    	{/foreach}
				</select>
			</td>
	  	</tr>
		<tr>
			<td colspan="2" class="secondrow">
			{if $editmode==1}
			  <input name="edit" type="hidden" id="edit" value="1">
			 {else}
			 <input name="donew" type="hidden" id="donew" value="1">
			  {/if}
				<input name="send" type="hidden" id="send" value="1">
				<input name="submit" type="submit" class="button" value="{$langadmin.save}" />
		  </td></tr>
  </table>
</form>

{include file="../foot.tpl"}