<!-- $Id: user_info.htm 16854 2009-12-07 06:20:09Z sxc_shop $ -->
{include file="pageheader.htm"}
<!-- Magnific Popup core CSS file -->
<link rel="stylesheet" href="styles/jquery-ui.min.css">
<script src="js/jquery-ui.min.js"></script>
<script src="js/clipboard.min.js"></script>
 <script>
	function openwindow(url,name,iWidth,iHeight)
	{
	  var url;     //網頁位置;
	  var name;    //網頁名稱;
	  var iWidth;  //視窗的寬度;
	  var iHeight; //視窗的高度;
	  var iTop = (window.screen.availHeight-30-iHeight)/2;  //視窗的垂直位置;
	  var iLeft = (window.screen.availWidth-10-iWidth)/2;   //視窗的水平位置;
	  window.open(url,name,'height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft);
	}
  </script>
<div class="main-div">
<form method="post" action="users.php" name="theForm" onsubmit="return validate()" enctype="multipart/form-data">
<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 "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">名稱:</td>
    <td><input type="text" id="name" name="name" maxlength="60" size="40" value="{$user.name}" />{$lang.require_field}</td>
  </tr>
  <tr>
    <td class="label">電話:</td>
    <td><input type="text" id="tel" name="tel" size="40" value="{$user.tel}" /></td>
  </tr>
  <tr>
    <td class="label">Email:</td>
    <td><input type="text" id="email" name="email" size="40" value="{$user.email}" /></td>
  </tr>
  <tr>
    <td class="label">地址:</td>
    <td><input type="text" id="address" name="address"  size="40" value="{$user.address}" /></td>
  </tr>
  {if $form_action eq "update"}
  <tr>
  	<td class="label">狀態:</td>
    <td>
    	<select name="status">
        	<option value="0" {if $user.status eq 0} selected="selected"{/if}>上架</option>
            <option value="1" {if $user.status eq 1} selected="selected"{/if}>下架</option>
     	</select>
    </td>
  </tr>
  <tr>
  	<td class="label">{$lang.note}:</td>
    <td>
    	<textarea name="note" cols="50" rows="5">{$user.note}</textarea>
    </td>
  </tr>
  {/if}
  {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_id}</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="oldstatus" value="{$user.status}" />
      <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.isMobile("mobile_phone", invalid_mobile_phone, 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.required("mobile_phone", no_mobile_phone);
				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"}
