{include file="$admingentemplates/admin_top.tpl"}

<div class="back">
	<a href="admin_moderators.php?sel=list" title="">{$lang.button.back}</a>
</div>
<div class="cr"></div>
<div class="show_help" style="display: none;">&nbsp;</div>
<div class="red_header">{$lang.moderators.list}</div>
<div class="cr">&nbsp;</div>
<div class="cr">&nbsp;</div>
<div class="help_text" style="display:block;">
    <div class="close_help">
        <img src="{$site_root}{$template_root}/images/close_help.png" alt="">
    </div>
    <div class="help_body">
        <span class="help_title">{$lang.help}:</span>{$lang.admin_help.moderators_list}
    </div>
</div>
<div class="cr">&nbsp;</div>

<ul class="tabs">
    <li>
        <a {if $sec eq 1} class="current" {else} href="admin_settings.php?section=1" {/if}>{$lang.settings.section_name.1}</a>
    </li>
    <li>
        <a {if $sec eq 2} class="current" {else} href="admin_settings.php?section=2" {/if}>{$lang.settings.section_name.2}</a>
    </li>
    <li>
        <a {if $sec eq 5} class="current" {else} href="admin_settings.php?section=5" {/if}>{$lang.settings.section_name.5}</a>
    </li>
    <li>
        <a class="current" >{$lang.moderators.name}</a>
    </li>
    <li>
        <a {if $sec eq 20} class="current" {else} href="admin_settings.php?section=20" {/if}>{$lang.settings.section_name.20}</a>
    </li>
</ul>
<div class="panel">
	<div class="panel_section">
		<div class="panel_content">
			<div>
				<form name="form_moderator" method="post" action="admin_moderators.php?sel=save" style="margin: 0px; padding: 0px;">
				<input type="hidden" value="{$form.par}" name="par">
				{if $form.par eq 'edit'}
				<input type="hidden" value="{$data.id}" name="id">
				{/if}
				<div>
				<table cellspacing=0 cellpadding=5>
				<tr>
					<td width="120" class="main_header_text">{$header.login}:&nbsp;</td>
					<td><input type="text" name="login" value="{$data.login}" style="width: 200px;"></td>
				</tr>
				<tr>
					<td class="main_header_text">{$header.email}:&nbsp;</td>
					<td><input type="text" name="email" value="{$data.email}" style="width: 200px;"></td>
				</tr>
				<tr>
					<td class="main_header_text">{$header.fname}:&nbsp;</td>
					<td><input type="text" name="fname" value="{$data.fname}" style="width: 200px;"></td>
				</tr>
				<tr>
					<td class="main_header_text">{$header.sname}:&nbsp;</td>
					<td><input type="text" name="sname" value="{$data.sname}" style="width: 200px;"></td>
				</tr>
				<tr>
					<td class="main_header_text">{$header.status}:&nbsp;</td>
					<td><input type="checkbox" name="status" value="1" {if $data.status ne 0}checked{/if}></td>
				</tr>
				<tr>
					<td class="main_header_text">{if $form.par eq 'edit'}{$header.new_password}{else}{$header.password}{/if}:&nbsp;</td>
					<td><input type="password" name="pass" value=""></td>
				</tr>
				</table>
				</div>
				<div style="padding-top: 10px; padding-left: 5px;"><font class="main_header_text">{$header.permissions}</font></div>
				<div style="padding-top: 5px; padding-left: 5px;">
				<table border=0 class="table_main" cellspacing=1 cellpadding=5>
				<tr class="table_header">
					<td width="20"><input type="checkbox" id="select_all" name="select_all" onclick="PutAll();"></td>
					<td width="120">{$lang.groups.module}</td>
					<td>{$lang.groups.module_comment}</td>
				</tr>
				{foreach item=item from=$rights}
					<tr bgcolor="#ffffff">
						<td><input type="checkbox" name="rights[]" value="{$item.id}" {if $item.sel eq 1} checked {/if}></td>
						<td>{$item.name}</td>
						<td>{$item.comment}</td>
					</tr>
				{/foreach}
				<tr class="table_header"><td colspan="3"></td></tr>
				</table>
				</div>
				<div style="padding-top: 5px; padding-left: 5px;">
					<a href="#" class="admin_button_major" onclick="javascript:document.form_moderator.submit();">{$header.save}<span>&nbsp;</span></a>
					&nbsp;&nbsp;
					{if $form.par eq 'edit'}
					<a href="#" class="admin_button" style="float:right;" onclick="document.location.href='admin_moderators.php?sel=delete&id={$data.id}'">{$header.delete}<span>&nbsp;</span><a/>
					{/if}
				</div>
				</form>
</div>
		</div>
	</div>
</div>
{literal}
<script type="text/javascript">
function PutAll() {
	var permiss = document.form_moderator;
	var i;
    var o=document.getElementsByName('select_all')	
	if (o[0].checked){                    
		for (i=0; i<permiss.length; i++){                
			if (permiss[i].name == 'rights[]'){
				permiss[i].checked = true
			}
		}            
	}
	else{
		for (i=0; i<permiss.length; i++){
			if (permiss[i].name == 'rights[]'){
				permiss[i].checked = false
			}
		}            
	}
}
</script>
{/literal}
<div class="cr">&nbsp;</div>
{include file="$admingentemplates/admin_bottom.tpl"}