<!-- $Id: user_info.htm 16854 2009-12-07 06:20:09Z sxc_shop $ -->
{include file="pageheader.htm"}
<div class="main-div">
<form method="post" action="users.php" name="theForm" onsubmit="return validate()">
<table width="100%" >
  <tr>
    <td class="label">{$lang.username}:</td>
    <td>{if $form_action eq "update"}{$user.user_name}<input type="hidden" name="username" value="{$user.user_name}" />{else}<input type="text" name="username" maxlength="60" value="{$user.user_name}" />{$lang.require_field}{/if}</td>
  </tr>
  {if $form_action eq "update"}
  <tr>
    <td class="label">{$lang.user_money}:</td>
    <td>{$user.formated_user_money} <a href="account_log.php?act=list&user_id={$user.user_id}&account_type=user_money">[ {$lang.view_detail_account} ]</a> </td>
  </tr>
  <tr>
    <td class="label">{$lang.frozen_money}:</td>
    <td>{$user.formated_frozen_money} <a href="account_log.php?act=list&user_id={$user.user_id}&account_type=frozen_money">[ {$lang.view_detail_account} ]</a> </td>
  </tr>
  <tr>
    <td class="label"><a href="javascript:showNotice('noticeRankPoints');" title="{$lang.form_notice}"><img src="images/notice.gif" width="21" height="21" border="0" alt="{$lang.form_notice}"></a> {$lang.rank_points}:</td>
    <td>{$user.rank_points} <a href="account_log.php?act=list&user_id={$user.user_id}&account_type=rank_points">[ {$lang.view_detail_account} ]</a> <br /><span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticeRankPoints">{$lang.notice_rank_points}</span></td>
  </tr>
  <tr>
    <td class="label"><a href="javascript:showNotice('noticePayPoints');" title="{$lang.form_notice}"><img src="images/notice.gif" width="21" height="21" border="0" alt="{$lang.form_notice}" /></a> {$lang.pay_points}:</td>
    <td>{$user.pay_points} <a href="account_log.php?act=list&user_id={$user.user_id}&account_type=pay_points">[ {$lang.view_detail_account} ]</a> <br />
        <span class="notice-span" {if $help_open}style="display:block" {else} style="display:none" {/if} id="noticePayPoints">{$lang.notice_pay_points}</span></td>
  </tr>
  {/if}
  <tr>
    <td class="label">真實姓名:</td>
    <td><input type="text" name="real_name" maxlength="60" size="40" value="{$user.real_name}" />{$lang.require_field}</td>
  </tr>
  <tr>
    <td class="label">{$lang.email}:</td>
    <td><input type="text" name="email" maxlength="60" size="40" value="{$user.email}" />{$lang.require_field}</td>
  </tr>
  {if $form_action eq "insert"}
  <tr>
    <td class="label">{$lang.password}:</td>
    <td><input type="password" name="password" maxlength="20" size="20" />{$lang.require_field}</td>
  </tr>
  <tr>
    <td class="label">{$lang.confirm_password}:</td>
    <td><input type="password" name="confirm_password" maxlength="20" size="20" />{$lang.require_field}</td>
  </tr>
  {elseif  $form_action eq "update"}
  <tr>
    <td class="label">{$lang.newpass}:</td>
    <td><input type="password" name="password" maxlength="20" size="20" /></td>
  </tr>
  <tr>
    <td class="label">{$lang.confirm_password}:</td>
    <td><input type="password" name="confirm_password" maxlength="20" size="20" /></td>
  </tr>
  {/if}
  <tr>
    <td class="label">{$lang.user_rank}:</td>
    <td><select name="user_rank">
      <option value="0">{$lang.not_special_rank}</option>
      {html_options options=$special_ranks selected=$user.user_rank}
    </select></td>
  </tr>
  <tr>
    <td class="label">{$lang.gender}:</td>
    <td>{html_radios name="sex" options=$lang.sex checked=$user.sex }</td>
  </tr>
  <tr>
    <td class="label">{$lang.birthday}:</td>
    <td>{html_select_date field_order="YMD" prefix="birthday" time=$user.birthday start_year="-60" end_year="+1" display_days=true month_format="%m"}</td>
  </tr>
  <tr>
    <td class="label">{$lang.credit_line}:</td>
    <td><input name="credit_line" type="text" id="credit_line" value="{$user.credit_line}" size="10" /></td>
  </tr>
  {foreach from=$extend_info_list item=field}
  <tr>
    <td class="label">{$field.reg_field_name}:</td>
    <td>
    <input name="extend_field{$field.id}" type="text" size="40" class="inputBg" value="{$field.content}"/>
    </td>
  </tr>
  {/foreach}
  {if $user.parent_id}
  <tr>
    <td class="label">{$lang.parent_user}:</td>
    <td><a href="users.php?act=edit&id={$user.parent_id}">{$user.parent_username}</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="users.php?act=remove_parent&id={$user.user_id}">{$lang.parent_remove}</a></td>
  </tr>
  {/if}
  {if $affiliate.on eq 1 && $affdb}
  <tr>
    <td class="label">{$lang.affiliate_user}:</td>
    <td>[<a href="users.php?act=aff_list&auid={$user.user_id}">{$lang.show_affiliate_users}</a>][<a href="affiliate_ck.php?act=list&auid={$user.user_id}">{$lang.show_affiliate_orders}</a>]</td>
  </tr>
  <tr>
    <td></td>
    <td>   
    <table border="0" cellspacing="1" style="background: #dddddd; width:30%;">
    <tr>
    <td bgcolor="#ffffff">{$lang.affiliate_lever}</td>
    {foreach from=$affdb key=level item=val0}
    <td bgcolor="#ffffff">{$level}</td>
    {/foreach}
    </tr>
    <tr>
    <td bgcolor="#ffffff">{$lang.affiliate_num}</td>
    {foreach from=$affdb item=val}
    <td bgcolor="#ffffff">{$val.num}</td>
    {/foreach}
    </tr>
    </table>
    </td>
  </tr>
  {/if}
  <tr>
    <td colspan="2" align="center">
      <input type="submit" value="{$lang.button_submit}" class="button" />
      <input type="reset" value="{$lang.button_reset}" class="button" />
      <input type="hidden" name="act" value="{$form_action}" />
      <input type="hidden" name="id" value="{$user.user_id}" />    </td>
  </tr>
</table>

</form>
</div>
{insert_scripts files="../js/utils.js,validator.js"}
{literal}
<script language="JavaScript">
<!--

if (document.forms['theForm'].elements['act'].value == "insert")
{
  document.forms['theForm'].elements['username'].focus();
}
else
{
  document.forms['theForm'].elements['email'].focus();
}

onload = function()
{
    // 开始检查订单
    startCheckOrder();
}

/**
 * 检查表单输入的数据
 */
function validate()
{
    validator = new Validator("theForm");
    // validator.isEmail("email", invalid_email, true);

    if (document.forms['theForm'].elements['act'].value == "insert")
    {
        validator.required("username",  no_username);
        validator.required("password", no_password);
        validator.required("confirm_password", no_confirm_password);
        validator.eqaul("password", "confirm_password", password_not_same);

        var password_value = document.forms['theForm'].elements['password'].value;
        if (password_value.length < 6)
        {
          validator.addErrorMsg(less_password);
        }
        if (/ /.test(password_value) == true)
        {
          validator.addErrorMsg(passwd_balnk);
        }
    }
    else if (document.forms['theForm'].elements['act'].value == "update")
    {
        var newpass = document.forms['theForm'].elements['password'];
        var confirm_password = document.forms['theForm'].elements['confirm_password'];
        if(newpass.value.length > 0 || confirm_password.value.length)
        {
          if(newpass.value.length >= 6 || confirm_password.value.length >= 6)
          {
            validator.eqaul("password", "confirm_password", password_not_same);
          }
          else
          {
            validator.addErrorMsg(password_len_err);
          }
        }
    }

    return validator.passed();
}
//-->
</script>
{/literal}
{include file="pagefooter.htm"}
