<script type="text/javascript">
	$(document).ready(function(){
		$("form#admin-form").validate();
		$("form#admin-form #admin-login").rules("add", {required: true});
		$("form#admin-form #admin-name").rules("add", {required: true});
		$("form#admin-form #admin-email").rules("add", {required: true, email: true});
		$("form#admin-form #admin-signature").rules("add", {required: true});
		$("form#admin-form #pass2").rules("add", {required: false, equalTo: "#pass"});
	});
</script>
<h1>{{$lang.Admin}}</h1>
<form action="?p={{$_GET.p}}" method="post" name="form" id="admin-form">
	<fieldset>
		<input type="hidden" name="iAdmin" value="{{$aAdmin.iAdmin}}" />
		<table class="details">
			<tr>
				<th class="name">{{$lang.Login}}</th><td class="value"><input id="admin-login" type="text" name="sLogin" value="{{$aAdmin.sLogin}}" size="40" maxlength="30" alt="simple" class="input" {{if $self}}readonly="readonly"{{/if}}/></td><td class="help"></td>
			</tr><tr>
				<th class="name">{{$lang.Password}}</th><td class="value"><input type="password" id="pass" name="sPass" value="" size="40" maxlength="30" alt="simple" class="input" /></td><td class="help"></td>
			</tr><tr>
				<th class="name">{{$lang.Password2}}</th><td class="value"><input type="password" id="pass2" value="" size="40" maxlength="30" alt="simple" class="input" /></td><td class="help"></td>
			</tr><tr>
				<th class="name">{{$lang.Firstname_surname}}</th><td class="value"><input id="admin-name" type="text" name="sName" value="{{$aAdmin.sName}}" size="40" maxlength="40" alt="simple" class="input" /></td><td class="help"></td>
			</tr><tr>
				<th class="name">{{$lang.Email}}</th><td class="value"><input id="admin-email" type="text" name="sEmail" value="{{$aAdmin.sEmail}}" size="40" maxlength="40" class="input" /></td><td class="help"></td>
			</tr><tr>
				<th class="name">{{$lang.Signature}}</th><td class="value"><input id="admin-signature" type="text" name="sSignature" value="{{$aAdmin.sSignature}}" size="40" maxlength="40" alt="simple" class="input" /></td><td class="help"><img class="tTip info" src="templates/images/info.png"  title="{{$lang.help_admins_signature}}" /></td>
			</tr>
			{{if count($aPrivilages) > 0}}
				{{* admin sam sobie nie ma opcji nadania statusu, chyba, że ma prawa do edycji uprawnień administratorów *}}
				<tr>
					<th class="name">{{$lang.Status}}</th><td class="value"><input name="iStatus" type="hidden" value="0" /><input name="iStatus" type="checkbox"{{if $aAdmin.iStatus}} checked="checked"{{/if}} value="1" /></td><td class="help"></td>
				</tr>
				{{* admin sam sobie nie ma opcji nadania uprawnień publikacji, chyba, że ma prawa do edycji uprawnień administratorów *}}
				<tr>
					<th class="name">{{$lang.CanPublicate}}</th><td class="value"><input type="hidden" name="iCanPublicate" value="0"><input id="admin-canpublicate" type="checkbox" name="iCanPublicate" value="1" {{if $aAdmin.iCanPublicate}}checked="checked"{{/if}} /></td><td class="help"></td>
				</tr>
				<tr>
					<td colspan="3">
						<div id="tabs">
							<p>{{$lang.Privilages}}</p>
							<div id="tabsForms">
								<ul id="admin-privilages">
									{{foreach from=$aPrivilages item=sPrivilage}}
										<li><input type="checkbox" name="aPrivilagesForm[{{$sPrivilage@key}}]" {{if isset( $aPrivilagesAdmin[ $sPrivilage@key ] )}}checked="checked"{{/if}} value="1" />{{$sPrivilage}}</li>
									{{/foreach}}
								</ul>
								<div class="clear"></div>
							</div>
						</div>
					</td>
				</tr>
			{{/if}}
		</table>
	<div class="save float"><div class="save floatcontainer">
	<input type="button" class="submit" value="&laquo; {{$lang.return}}"  onclick="location.href = '?p=admins-list'; return false;"> <input type="submit" class="submit" value="{{$lang.Save}} &raquo;" name="sOption" />
	</div></div>
	</fieldset>
</form>




