{include file="$admintemplatepath/header.template"}
{include file="$admintemplatepath/navigation.template" showOpt=editSiteUsers title=$locale->tr("editSiteUsers")} 
<script type="text/javascript" src="js/ui/plogui.js"></script>
<script type="text/javascript">
	var errorStatusMsg = '{$locale->tr("error_select_status")}';
	var showMassiveChangeOption = '{$locale->tr("show_massive_change_option")}';
	var hideMassiveChangeOption = '{$locale->tr("hide_massive_change_option")}';
</script>
<script type="text/javascript">
{literal}
YAHOO.util.Event.addListener( window, "load", function() {
		var t = new Lifetype.UI.TableEffects( "list" );
		t.stripe();
		t.highlightRows();
	});
{/literal}
</script>
        <div id="list_nav_bar">
            <div id="list_nav_select">
            
<form id="viewUsers" action="admin.php" method="post">
 <fieldset>
  <legend>{$locale->tr("show_by")}</legend>
   <div class="list_nav_option">
    <label for="status">{$locale->tr("status")}</label>
	<br />
    <select name="status" id="status">
    {foreach from=$userstatus key=name item=status}
      <option value="{$status}" {if $currentstatus == $status} selected="selected"{/if}>{$locale->tr($name)}</option>
    {/foreach}
    </select>
   </div>
   
   <div class="list_nav_option">
   <label for="search">{$locale->tr("search_terms")}</label>
   <br />
   <input type="text" name="searchTerms" value="{$searchTerms|escape:"html"}" size="15" id="search" />
   </div>   
   
   <div class="list_nav_option">
    <br />
    <input type="hidden" name="op" value="editSiteUsers" />
    <input type="submit" name="Show" value="{$locale->tr("show")}" />
   </div>

	<div class="list_nav_option">
		<br/>
		<a href="{$pager->getCurrentPageLink()}" title="{$locale->tr("bookmark_this_filter")}">
			<img style="border:0px" src="imgs/admin/icon_link-16.png" alt="{$locale->tr("bookmark_this_filter")}" />
		</a>
	</div>

  </fieldset> 
 </form> 
 </div>
 <br style="clear:both" />
 </div>             
 
        <form id="siteUsers" action="admin.php" method="post">
	
			{check_perms adminperm=update_user}	
			     <div class="optionIcon">
					<a id="optionIconLink" href="#bulkEdit" title="{$locale->tr("show_massive_change_option")}" onclick="switchMassiveOption()">{$locale->tr("show_massive_change_option")}</a>
				</div>
			{/check_perms}	
	
        <div id="list">
  {include file="$admintemplatepath/successmessage.template"}
  {include file="$admintemplatepath/errormessage.template"}
            <table id="list" class="info" summary="{$locale->tr("editSiteUsers")}">
                <thead>
                    <tr>
                        <th><input class="checkbox" type="checkbox" name="all" id="all" value="1" onclick="toggleAllChecks('siteUsers');" /></th>
                        <th style="width:5%;">UID</th>
                        <th style="width:20%;">{$locale->tr("username")}</th>
                        <th style="width:30%;">{$locale->tr("full_name")}</th>                        
                        <th style="width:25%;">{$locale->tr("email")}</th>
                        <th style="width:10%;">{$locale->tr("status")}</th>
                        <th style="width:10%;">{$locale->tr("actions")}</th>
                    </tr>
                </thead>
                <tbody>
                   {foreach from=$siteusers item=siteuser}
                    <tr>
                        <td>
                            <input class="checkbox" type="checkbox" name="userIds[{$siteuser->getId()}]" id="checks_{$siteuser->getId()}" value="{$siteuser->getId()}" />
                        </td>
                        <td class="col_highlighted">
                            {$siteuser->getId()}
                        </td>
                        <td class="col_highlighted">
                            <a href="?op=editSiteUser&amp;userId={$siteuser->getId()}">{$siteuser->getUsername()|truncate:20:"..."}</a>
                        </td>
                        <td>
                            {$siteuser->getFullName()|truncate:70:"..."}
                        </td>                        
                        <td>
                            <a href="mailto:{$siteuser->getEmail()}">
                            {$siteuser->getEmail()}
                            </a>
                        </td>
                        <td>
                          {foreach from=$userstatus key=name item=status}
                           {if $siteuser->getStatus() == $status}
                            {if $status == 2}<span style="color:red">{$locale->tr($name)}</span>
							{else}{$locale->tr($name)}{/if}
						   {/if}
                          {/foreach}                           
                        </td>
                        <td>
                            <div class="list_action_button">
							{check_perms adminperm=update_user}
                            <a href="?op=editSiteUser&amp;userId={$siteuser->getId()}" title="{$locale->tr("edit")}">
	                           <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
	                        </a>
                            <a href="?op=deleteUser&amp;userId={$siteuser->getId()}" title="{$locale->tr("delete")}">
	                           <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
	                        </a>
							{/check_perms}
                            </div>
                        </td>
                    </tr>
                    {/foreach}
                </tbody>
            </table>
        </div>        
		<a name="bulkEdit"></a>
        <div id="list_action_bar">
        {adminpager style=list}
		{check_perms adminperm=update_user}
             <input type="submit" name="delete" value="{$locale->tr("delete")}" class="submit" />
             <input type="hidden" name="op" value="deleteUsers" />
		{/check_perms}
		{check_perms adminperm=update_user}
	    <div id="massiveChangeOption" style="display: none">
	        <fieldset>	
	        <legend>{$locale->tr("massive_change_option")}</legend>            
	            <label for="userStatus">{$locale->tr("status")}</label>
	            <select name="userStatus" id="userStatus">
	              <option value="-1">-{$locale->tr("select")}-</option>
			    	{foreach from=$userstatus key=name item=status}
			      		{if $status != -1}<option value="{$status}">{$locale->tr($name)}</option>{/if}
			    	{/foreach}	
	            </select>
	            <input type="button" name="changeUserStatus" value="{$locale->tr("change_status")}" class="submit" onClick="javascript:submitUsersList('changeUserStatus');" /> 
	        </fieldset>
		</div>
		{/check_perms}
	  </div>	
	</form>

{include file="$admintemplatepath/footernavigation.template"}
{include file="$admintemplatepath/footer.template"}
