{* Error and confirmation messages *}
{include file="messages.tpl"}

{strip}
<div class="block">
   <!-- Action Links -->
   <ul class="page-action-list">
      <li><a href="{$smarty.const.DOC_ROOT}/conf_users_edit.php?action=N" title="{l}Create new user{/l}" class="btn"><span class="new-user">{l}New User{/l}</span></a></li>
   </ul>
   <!-- /Action Links -->
</div>

<div class="block">
   <!-- Users Search Form -->
   <form action="{$smarty.const.DOC_ROOT}/conf_users.php" method="get">
      <table class="list search-box">
      <thead>
         <tr>
            <th class="listHeader" colspan="3">{l}Search Users{/l}</th>
         </tr>
      </thead>
      <tbody>
         <tr class="{cycle values="odd,even"}">
            <td>
               <input type="text" id="searchinput" name="search" maxlength="255" value="{if !empty($search)}{$search|escape}{/if}" class="text searchinput" title="{l}Add your search keywords{/l}" />
            </td>
            <td>
               <input type="submit" value="{l}Search{/l}" title="{l}Click to start search{/l}" class="button" />
            </td>
            <td class="notice">
               {$min_keyword_length_comment}
            </td>
         </tr>
      </tbody>
      </table>
   </form>
   <!-- /Users Search Form -->
</div>

<div class="block">
   <table class="list">
   <thead>
      <tr>
         {foreach from=$columns key=col item=name}
            {if $ENABLE_REWRITE or $col ne 'TITLE_URL'}
               <th class="listHeader" id="{$col}"><a href="{$smarty.const.DOC_ROOT}/conf_users.php{if isset($columnURLs) and is_array($columnURLs)}?{$columnURLs.$col}{/if}" title="{l}Sort by{/l}: {$name|escape|trim}" class="sort{if $SORT_FIELD eq $col and $requestOrder eq 1} {$smarty.const.SORT_ORDER}{/if}">{$name|escape|trim}</a></th>
            {/if}
         {/foreach}
         <th colspan="3" class="last-child">{l}Action{/l}</th>
      </tr>
   </thead>

   <tbody>
   {foreach from=$list item=row key=id}
      <tr class="{cycle values="odd,even"}">
         {foreach from=$columns key=col item=name}
            {if $ENABLE_REWRITE or $col ne 'TITLE_URL'}
               <td>
               {if $col eq 'LEVEL'}
                  {assign var="s1" value=$row.$col}
                  {$admin_user[$s1]}
               {elseif $col eq 'SUBMIT_NOTIF'}
                  {assign var="s2" value=$row.$col}
                  {$yes_no[$s2]}
               {elseif $col eq 'PAYMENT_NOTIF'}
                  {assign var="s3" value=$row.$col}
                  {$yes_no[$s3]}
               {elseif $col eq 'EMAIL'}
                  <a href="mailto:{$row.$col|escape|trim}" title="{l}Email{/l}: {$row.LOGIN|escape|trim} ({$row.$col|escape|trim})">{$row.$col|escape|trim}</a>
               {elseif $col eq 'EMAIL_CONFIRMED'}
                  {if $row.EMAIL_CONFIRMED eq '1'}<span style="color: green;">YES</span>{else}<span style="color: red;">NO</span>{/if}
               {else}
                  {$row.$col}
               {/if}
               </td>
            {/if}
         {/foreach}
		 <td class="noborder">
            {if $current_user_is_admin eq 1 or $id eq $current_user_id}
               <a href="{$smarty.const.DOC_ROOT}/conf_users_actions.php?action=E:{$id}" title="{l}Edit user Actions{/l}: {$row.LOGIN|escape|trim}" class="action actions"><span>{l}Edit User Actions{/l}</span></a>
            {/if}
         </td>

         <td class="noborder">
            {if $current_user_is_admin eq 1 or $id eq $current_user_id}
               <a href="{$smarty.const.DOC_ROOT}/conf_users_edit.php?action=E:{$id}" title="{l}Edit user{/l}: {$row.LOGIN|escape|trim}" class="action edit"><span>{l}Edit{/l}</span></a>
            {/if}
         </td>

         <td class="noborder last-child">
            {if $current_user_is_admin eq 1}
               <a href="{$smarty.const.DOC_ROOT}/conf_users_edit.php?action=D:{$id}" onclick="return user_rm_confirm('{l}Are you sure you want to remove this user account?{/l}\n{l}Note: user accounts can not be restored after removal!{/l}');" title="{l}Remove user{/l}: {$row.LOGIN|escape|trim}" class="action delete"><span>{l}Delete{/l}</span></a>
            {/if}
         </td>

      </tr>
      {foreachelse}
         <tr>
            <td colspan="{$col_count}" class="norec">{l}No records found.{/l}</td>
         </tr>
      {/foreach}
   </tbody>
   </table>

   {include file=$smarty.const.ADMIN_TEMPLATE|cat:"/list_pager.tpl"}
</div>
{/strip}