{extends "manage/manage.tpl.html"}

{block "manage_content"}
{if $prj_id == ''}
<span>
    {t}This page can only be accessed in relation to a project. Please go to the project page and choose{/t}&nbsp;"{t}Edit Columns to Display{/t}"&nbsp;{t}to access this page.{/t}<br />
    <a href="{$core.rel_url}manage/projects.php">{t}Manage Projects{/t}</a>
    </span>
{else}
<form name="column_display_form" method="post">
    <input type="hidden" name="cat" value="save">
    <input type="hidden" name="page" value="{$page}">
    <input type="hidden" name="prj_id" value="{$prj_id}">
    <table class="bordered grid">
        <tr class="title">
            <th colspan="3">
                {t}Manage Columns to Display{/t} {include file="help_link.tpl.html" topic="column_display"}
                <div class="right">({t}Current Project{/t}: {$project_name})</div>
            </th>
        </tr>
        <tr>
            <th nowrap align="center" width="40%">
                {t}Column Name{/t}
            </th>
            <th align="center" width="20%">
                {t}Minimum Role{/t}
            </th>
            <th align="center" width="40%">
                {t}Order{/t}
            </th>
        </tr>
        {assign var=default_rank value=1}
        {foreach from=$available item=column key=field_name}
        <tr class="{cycle values='odd,even'}">
            <td align="center" width="40%">
                {$column.title}
            </td>
            <td align="center" width="20%">
                {assign var="selected_field" value=$selected[$field_name]|default:''}
                {if $selected_field == '' or $selected_field.min_role == ''}
                {assign var="selected_role" value=$column.default_role|default:''}
                {else}
                {assign var="selected_role" value=$selected[$field_name].min_role|default:''}
                {/if}
                <select name="min_role[{$field_name}]">
                    {html_options options=$user_roles selected=$selected_role}
                </select>
                {if $field_name == 'status_action_date'}
                <br />
                <em>
                    {* TRANSLATORS: %1: url to status_action_date.php *}
                    {t escape=no 1="status_action_date.php?prj_id=$prj_id"}Note: You need to <a href="%1">configure this field</a> before it can be used.{/t}
                </em>
                {/if}
            </td>
            <td align="center" width="40%">
                {assign var="selected_field" value=$selected[$field_name]|default:''}
                {if $selected_field == '' or $selected[$field_name].rank}
                {assign var=selected_rank value=$default_rank}
                {else}
                {assign var=selected_rank value=$selected[$field_name].rank}
                {/if}
                <select name="rank[{$field_name}]">
                    {html_options options=$ranks selected=$selected_rank}
                </select>
            </td>
        </tr>
        {assign var=default_rank value=$default_rank+1}
        {/foreach}
        <tr class="buttons">
            <td colspan="3">
                <input type="submit" name="save" value="{t}Save{/t}">
            </td>
        </tr>
    </table>
</form>
{/if}
{/block}
