<?php
// Subroutine: FORM_user.php
//   Output FORM for user registration / update
// Xinfeng Chen, 2002.11.21
// Require: class CUser
// Input: $oUsr, $url
//   For register, set $oUsr->name='';

$icon=($oUsr->icon) ? $oUsr->icon : 'null';
if($oUsr->gender == "女"){$sexselected=selected;}

$_iconOption='';
for($ii=0; $ii<190; $ii++){
 $_iconOption.=($ii==$oUsr->icon) ? '<option selected ' : '<option ';
 $_iconOption.=($ii<10) ? "value=0$ii>0$ii" : "value=$ii>$ii";
 $_iconOption.='</option>';
}

if($oUsr->name!=''){
 $_action='update';
 $_readonly='readonly';
 $_newpass="
<TR><TD align=right width=186 class=row1>您的新密码：</TD>
<TD class=row1><input type=password name=f_newpass class=plain>
<FONT color=red>如果您不打算更改密码，此处请留空！</font></TD></TR>";
 list($_year,$_month,$_day)=explode('-',$oUsr->birthday);
}else{
 $_action='new';
 $_readonly='';
 $_newpass='';
 $_year=$_month=$_day='';
}

$_monthSelection="<SELECT name=f_month>";
for($ii=1; $ii<=12; $ii++){
 $_monthSelection.=($ii==$_month) ? '<option selected>' : '<option>';
 $_monthSelection.=($ii<10) ? "0$ii" : "$ii";
 $_monthSelection.='</option>';
}
$_monthSelection.='</SELECT>';

$_daySelection="<SELECT name=f_day>";
for($ii=1; $ii<=31; $ii++){
 $_daySelection.=($ii==$_day) ? '<option selected>' : '<option>';
 $_daySelection.=($ii<10) ? "0$ii" : "$ii";
 $_daySelection.='</option>';
}
$_daySelection.='</SELECT>';

print <<<EOT
<FORM method=post action='$url' name=form>
<input type=hidden name=action value='$_action'>
<TABLE border=0 cellpadding=3 cellspacing=1 width=600 align=center class=forumLine>
<TR>
 <TD class=rowCaption align=center colspan=2> 用户资料 ( <a href=zuser_reg.php?action=rule>用户守则</a> )</TD>
</TR>
<TR>
 <TD class=rowCat colspan=2> ● 带 <FONT color=red>*</FONT> 为必填 </TD>
</TR>
<TR>
 <TD align=right width=186 class=row1><FONT color=red>*</FONT>网上尊称：</TD>
 <TD class=row1><INPUT $_readonly name=f_user value='$oUsr->name' class=plain></TD>
</TR>
<TR>
 <TD align=right width=186 class=row1><FONT color=red>*</FONT>您的密码：</TD>
 <TD class=row2><INPUT name=f_pass type=password class=plain></TD>
</TR>
$_newpass
<TR>
 <TD align=right width=186 class=row2><FONT color=red>*</FONT> 您的Email地址：</TD>
 <TD class=row2><INPUT maxLength=80 name=f_email value='$oUsr->email' class=plain>
 <FONT color=red>我们将根据您提供的邮件地址把注册密码发送给您</FONT></TD>
</TR>
<TR>
 <TD align=right width=186 class=row2><FONT color=red>*</FONT> 您的生日：</TD>
 <TD class=row2>
 <INPUT name=f_year value='$_year' size=4 maxlength=4>年
 {$_monthSelection}月{$_daySelection}日
 <FONT color=red>用于忘记密码时确认身份。</FONT></TD>
</TR>
<TR>
 <TD align=right width=186 class=row1>性　　别：</TD>
 <TD class=row1>
  <select name=f_gender>
  <option value=男>男</option><option value=女 $sexselected>女</option>
  </select>
 </TD>
</TR>
<TR>
 <TD align=right width=186 class=row2>职　　业：</TD>
 <TD class=row2><INPUT maxLength=80 name=f_career value='$oUsr->career' class=plain></TD>
</TR>
<TR>
 <TD align=right width=186 class=row1>爱　　好：</TD>
 <TD class=row1><INPUT maxLength=20 name=f_hobby value='$oUsr->hobby' class=plain></TD>
</TR>
<TR>
 <TD align=right width=186 class=row2>QQ　号码：</TD>
 <TD class=row2><INPUT maxLength=20 name=f_ims value='$oUsr->ims' class=plain></TD>
</TR>
<TR>
 <TD align=right width=186 class=row1>个人主页：</TD>
 <TD class=row1><INPUT name=f_homepage size=30 value='$oUsr->homepage' class=plain></TD>
</TR>
<TR>
 <TD align=right class=row2>个人信息：</TD>
 <TD class=row2><textarea name=f_desc cols=60 rows=5 class=plain>$oUsr->desc</textarea></TD>
</TR>
<TR> 
 <TD align=right width=186 class=row1>您的签名档：<br>
EOT;

if ($zcodeallowed) {
 print "<FONT color=red>（支持 <a href=# onclick=javascript:window.open('$imgurl/zbb.htm','','width=500,height=300,resizable,scrollbars')>ZBB 代码</a>）</FONT>";
}

print <<<EOT
 </TD>
 <TD class=row1><textarea name=f_signature cols=60 rows=5 class=plain>$oUsr->signature</textarea></TD>
</TR>
<TR>
 <TD align=right width=186 class=row2>您所在的省份：</TD>
 <TD class=row2 ><INPUT maxLength=12 name=f_location value='$oUsr->location' class=plain></TD>
</TR>
<TR>
 <TD align=right width=186 class=row1>请选择您的头像：</TD>
 <TD class=row1>&nbsp;<img src="$imgurl/face/{$icon}.gif" name="tus">&nbsp;&nbsp;
<script>
function showimage(){
document.images.tus.src="$imgurl/face/"+document.form.f_icon.options[document.form.f_icon.selectedIndex].value+".gif";
}
</script>
  <select name=f_icon size=1 onChange="showimage()">
  <option value='$oUsr->icon'>默认</option>$_iconOption
  </select>
  <a href=JavaScript:New('$imgurl/index.htm')>查看所有的头像列表</a></TD>
</TR>
<TR>
 <TD colspan=2 align=center class=row2><input type=submit value="填好了，继续！"></TD>
</TR>
</TABLE>
</FORM>
<script>
function New(para_URL){
var URL=new String(para_URL);
window.open(URL,'','resizable,scrollbars')
}
</script>
EOT;

?>