<!-- начало багтрекер -->
<div id="bt_main">
	{*
	var1 - страница
	var2 - сортировка
	var3 - тип
	var4 - важность
	var5 - статус
	var6 - версия
	*}
{include file="bug_tracker/toolbar.tpl"}
	
<div id="rss_feeds">
	{foreach $feed_rss as $item}
	<a href="{$item.path}" title="{$item.name|escape}"><img src="/skins/default/images/icons/simple_rss.png" alt="" /></a>
	{/foreach}
</div>

	{if $filter.bug_type || $filter.importance || $filter.status || $filter.version_id}{assign var="filtered" value=true}{/if}

	<div id="filters"{if !$filtered} style="display:none"{/if}>
		<form method="post" action="" id="filter_form">
			<div><span>Тип</span><select name="bug_type">
			<option value=''>нет</option>
			{html_options options=$bug_types selected=$filter.bug_type}
			</select>  </div>
			<div><span>Важность</span><select name="importance">
			<option value=''>нет</option>
			{html_options options=$importances selected=$filter.importance}
			</select> </div>
			<div><span>Статус</span><select name="status">
			<option value=''>нет</option>
			{html_options options=$statuses selected=$filter.status}
			</select> </div>
			<div><span>Версия</span><select name="version_id">
			<option value=''>нет</option>
			{html_options options=$versions selected=$filter.version_id}
			</select> <input type="hidden" name="filter" value="1" /></div>
			<div><a onclick="document.getElementById('filter_form').submit();" href="javascript:void(0)">применить фильтр</a></div>
			{if $filtered}<a href="{url var1=1 var2=$filter.order var3=0 var4=0 var5=0 var6=0}">снять фильтр</a>{/if}
		</form>
	</div>

	<table class="bug_list">
	<colgroup>
		<col width="30" />
		<col />
		<col width="70" />
		<col width="110" />
		<col width="30" />
		<col width="70" />
		<col width="70" />
		<col width="60" />
		{if access('moderator')}<col width="15" />{/if}
	</colgroup>
	<thead>
	<tr>
		<td><a href="{if $filter.order==1}{url var1=$pager.current var2=2 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{else}{url var1=$pager.current var2=1 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{/if}">№</a></td>
		<td><a href="{if $filter.order==3}{url var1=$pager.current var2=4 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{else}{url var1=$pager.current var2=3 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{/if}">тема</a></td>
		<td><a href="{if $filter.order==5}{url var1=$pager.current var2=6 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{else}{url var1=$pager.current var2=5 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{/if}">автор</a></td>
		<td><a href="{if $filter.order==7}{url var1=$pager.current var2=8 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{else}{url var1=$pager.current var2=7 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{/if}">дата</a></td>
		<td><a href="{if $filter.order==9}{url var1=$pager.current var2=10 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{else}{url var1=$pager.current var2=9 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{/if}">версия</a></td>
		<td><a href="{if $filter.order==11}{url var1=$pager.current var2=12 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{else}{url var1=$pager.current var2=11 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{/if}">подтвердил</a></td>
		<td><a href="{if $filter.order==13}{url var1=$pager.current var2=14 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{else}{url var1=$pager.current var2=13 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{/if}">закрыл</a></td>
		<td><a href="{if $filter.order==15}{url var1=$pager.current var2=16 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{else}{url var1=$pager.current var2=15 var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}{/if}">тип</a></td>
		{if access('moderator')}<td></td>{/if}
	</tr>
	</thead>
	<tbody>
	{foreach $bugs as $bug}
	<tr class="status{$bug.status} importance{$bug.importance}{if $_user->id>0 && $_user->last_visit_ut<$bug.bug_date} new{/if}">
	<td><a href="{url action="item" var1=$bug.bug_id}">#{$bug.bug_id}</a></td><td><a href="{url action="item" var1=$bug.bug_id}">{$bug.summary_html}</a></td><td>{$bug.author|escape}</td><td>{$bug.bug_date|date_format:"%H:%M %d.%m.%y"}</td><td>{$bug.version|escape}</td><td>{$bug.approver|escape}</td><td>{$bug.performer|escape}</td><td>{$bug_types[$bug.type]}</td>{if access('moderator')}<td><a href="{url action="delete_bug" var1=$bug.bug_id token=1}"><img class="icon" src="/skins/default/images/icons/simple_delete.png" alt="удалить" /></a></td>{/if}
	</tr>
	{foreachelse}
	<tr><td></td></tr>
	{/foreach}
	</tbody>
	</table>
	
	{if $pager.pages}
	<div class="navigate">
		{foreach $pager.pages as $page}
			{if !$page} ... {elseif $page==$pager.current}
				<b>{$page}</b>	
			{else}
				<a href="{url var1=$page var2=$filter.order var3=$filter.bug_type var4=$filter.importance var5=$filter.status var6=$filter.version_id}">{$page}</a>
			{/if}
			{if !$page@last}|{/if}
		{/foreach}
	</div>
	{/if}
	
	<div style="margin-top:30px;">
		<table class="bug_list" style="width:200px;">
			<tr><td><b>Статусы:</b></td></tr>
			{foreach $statuses as $key=>$status}
			<tr class="status{$key}"><td>{$status|escape}</td></tr>
			{/foreach}
			<tr><td><b>Важность:</b></td></tr>
			{foreach $importances as $key=>$importance}
			<tr class="importance{$key}"><td>{$importance|escape}</td></tr>
			{/foreach}
		</table>
	</div>
</div>
<!-- конец багтрекер -->