{extends file="layout.html"}
{block name=title}LMS: {$layout.pagetitle|striphtml}{/block}
{block name=module_content}
<!--// $Id$ //-->
<SCRIPT type="text/javascript">
<!--
	function update_homedir()
	{
		var prefix = "{ConfigHelper::getConfig('phpui.homedir_prefix')}";
		document.forms['account'].elements['account[home]'].value = prefix + document.forms['account'].elements['account[login]'].value;
	}
//-->
</SCRIPT>
<H1>{$layout.pagetitle}</H1>
<FORM method="POST" action="?m=accountedit&id={$account.id}" name="account">
<INPUT type="submit" class="hiddenbtn">
<TABLE class="lmsbox">
    <THEAD>
	<TR>
		<TD width="1%">
			<img src="img/account.gif" alt="">
		</TD>
		<TD width="1%">
			<B>{trans("Login:")}</B>
		</TD>
		<TD width="98%">
			<input type="text" name="account[login]" value="{$account.login}" required {tip text="Enter account name" trigger="login"} onkeyup="update_homedir();">
		</TD>
	</TR>
    </THEAD>
    <TBODY>
	<TR>
	    <TD width="100%" colspan="3" class="">
		<TABLE width="100%" cellpadding="0">
		    <TR>
			<TD width="50%" style="vertical-align: top">
			    <TABLE width="100%" cellpadding="3">
				<TR>
				    <TD width="1%">
					<img src="img/domain.gif" alt="">
				    </TD>
				    <TD width="1%" nowrap>
					<B>{trans("Domain:")}</B>
				    </TD>
				    <TD width="98%">
				    	<select name="account[domainid]" {tip text="Select domain name" trigger="domainid"}>
					    <option value="0" {if !$account.domainid}SELECTED{/if}>{trans("— select domain —")}</option>
					    {section name=domainlist loop=$domainlist}
					    <option value="{$domainlist[domainlist].id}" {if $domainlist[domainlist].id == $account.domainid}SELECTED{/if}>{$domainlist[domainlist].name}</option>
					    {/section}
					</select>
				    </TD>
				</TR>
			    	<TR>
				    <TD width="1%">
					<img src="img/customer.gif" alt="">
				    </TD>
				    <TD width="1%">
					<B>{trans("Owner:")}</B>
		    		    </TD>
				    <TD width="98%">
					<SELECT SIZE="1" NAME="account[ownerid]" {tip text="Select owner or 'SYSTEM ACCOUNT' if you don't want to assign it to any customer" trigger="ownerid"}>
    					    <OPTION VALUE="0"{if !$account.ownerid} SELECTED{/if}>{trans("SYSTEM ACCOUNT")}</OPTION>
					    {foreach from=$customers item=customer}
					    <OPTION VALUE="{$customer.id}"{if $account.ownerid == $customer.id} SELECTED{/if}>{$customer.customername|truncate:40:"&hellip;":true} ({$customer.id|string_format:"%04d"})</OPTION>
					    {/foreach}
					</SELECT>
				    </TD>
				</TR>
				<TR>
				    <TD width="1%">
					<img src="img/name.gif" alt="">
				    </TD>
				    <TD width="1%" nowrap>
					<B>{trans("First/last or Company name:")}</B>
				    </TD>
				    <TD width="98%">
					<input type="text" size="30" name="account[realname]" value="{$account.realname}" {tip text="Enter optional account name" trigger="realname"}>
				    </TD>
				</TR>
				<TR>
				    <TD width="1%">
					<img src="img/home.gif" alt="">
				    </TD>
				    <TD width="1%" nowrap>
					<B>{trans("Homedir:")}</B>
				    </TD>
				    <TD width="98%">
					<input type="text" size="30" name="account[home]" value="{$account.home}" {tip text="Enter home directory" trigger="home"}>
				    </TD>
				</TR>
				<TR>
				    <TD width="1%">
					<img src="img/calendar.gif" alt="">
				    </TD>
				    <TD width="1%" nowrap>
					<B>{trans("Expiration date:")}</B>
				    </TD>
				    <TD width="98%">
					<input type="text" size="10" name="account[expdate]" value="{if $account.expdate}{$account.expdate|date_format:"Y/m/d"}{/if}" placeholder="{trans("yyyy/mm/dd")}" {tip class="lms-ui-date" text="Enter or click to choose expiration date for account in YYYY/MM/DD format (Empty field means account never expires)" trigger="expdate"}>
				    </TD>
			    	</TR>
				<TR>
				    <TD width="1%">
					<img src="img/forward.gif" alt="">
				    </TD>
				    <TD width="1%" nowrap>
					<B>{trans("Forward e-mail:")}</B>
				    </TD>
				    <TD width="98%">
					<input type="email" name="account[mail_forward]" size="25" value="{$account.mail_forward}" {tip text="Enter destination e-mail address for redirect (optional)" trigger="mail_forward"}>
				    </TD>
				</TR>
				<TR>
				    <TD width="1%">
					<img src="img/forward.gif" alt="">
				    </TD>
				    <TD width="1%" nowrap>
					<B>{trans("BCC e-mail:")}</B>
				    </TD>
				    <TD width="98%">
					<input type="email" name="account[mail_bcc]" size="25" value="{$account.mail_bcc}" {tip text="Enter e-mail address for blind carbon copy (optional)" trigger="mail_bcc"}>
				    </TD>
				</TR>
			    </TABLE>
			</TD>
			<TD width="50%" style="vertical-align: top">
			    <TABLE width="100%" cellpadding="3">
				<TR>
				    <TD width="1%">
					<img src="img/account.gif" alt="">
				    </TD>
				    <TD width="1%">
					<B>{trans("Type/Quota:")}</B>
				    </TD>
				    <TD width="98%">
					    <table width="100%">
							{foreach $_ACCOUNTTYPES as $typeidx => $type}
							<tr>
								<td style="width: 1%;" class="nobr">
									<INPUT type="checkbox" id="type_{$typeidx}" name="account[type][{$typeidx}]" value="{$typeidx}" {if ($account.type & $typeidx) == $typeidx} checked{/if}>
									<label for="type_{$typeidx}">{$type.label}</label>
								</td>
								<td>
									&nbsp;<input type="text" size="5" maxlendth="10" name="quota[{$typeidx}]" value="{$quota[$typeidx]}" {tip text="Enter account quota in MB" trigger="quota[$typeidx]"}>
								</td>
							</tr>
							{/foreach}
					    </table>
				    </TD>
				</TR>
				<TR>
				    <TD width="1%">
					<img src="img/info.gif" alt="">
				    </TD>
				    <TD width="99%" colspan="2">
					<textarea name="account[description]" rows="5" cols="50" {tip text="Enter additional information (optional)"}>{$account.description}</textarea>
				    </TD>
				</TR>
			    </TABLE>
			</TD>
		    </TR>
		</TABLE>
	    </TD>
	</TR>
	<TR>
		<TD align="right" colspan="3">
			<A href="javascript:document.account.submit();" accesskey="s">{trans("Submit")} <img src="img/save.gif" alt=""></A>
			<A href="?m=accountlist">{trans("Cancel")} <img src="img/cancel.gif" alt=""></A>
		</TD>
	</TR>
    </TBODY>
</TABLE>
</FORM>
<SCRIPT type="text/javascript">
<!--
$(function() {
	$('form[name="account"] [name="account[login]"]').focus();
});
//-->
</SCRIPT>
{/block}
