<?php 
defined('IN_HS') or exit('Access Denied');
include admintpl('header');
include(HS_ROOT."/include/htmlframe.inc.php");
loadMtir();
?>
<script src="<?=HS_PATH?>include/js/checkform.js"></script>
<script language='JavaScript' type='text/JavaScript'>

function CheckForm(){
	var cf = new Check("myform");
	cf.isnumber('pdt_price','商品价格格式不正确，应为整数或小数','required')
	cf.must('pdt_name','商品名称不得为空');
	//cf.notequal('pdt_catid','0','请选择商品分类');
	cf.must('pdt_price','商品价格不得为空');
	//cf.must('introduce','商品介绍不得为空');
	return cf.passed();
}
</script>
<body>
<?=$menu?>

<table width="100%" height="25" border="0" cellpadding="0" cellspacing="0" class="tableborder">
  <tr>
     <td width='80%' class="tablerow">当前位置： <?=$cat_pos?></td>
     <td></td>
  </tr>
</table>
<table width="100%" height="12" border="0" cellpadding="0" cellspacing="0" >
  <tr>
     <td width='80%'>&nbsp;</td>
     <td></td>
  </tr>
</table>

<form name="myform" method="post" action="?mod=<?=$mod?>&file=<?=$file?>&action=add" onSubmit="return CheckForm();" enctype="multipart/form-data" autocomplete="off">
<input name='pdt[catid]' type='hidden' id='catid' value='<?=$catid?>'>
<table cellpadding="2" cellspacing="1" class="tableborder">
  <tbody>
  <th colspan=2>基本信息</th>
    <tr>
      <td class='tablerow'><strong>道具代码</strong></td>
      <td class='tablerow'><input name='pdt[pdt_No]' type='text' id='pdt_No' size='40' maxlength='50' value="<?=$pdt_No?>" onKeyUp="giveitem(this.value)">
        <font color="red">*</font>&nbsp;&nbsp;</td>
    </tr>
  <tr>
  <td width='190' class='tablerow'><strong>道具名称</strong></td>
  <td class='tablerow'><input name='pdt[pdt_name]' type='text' id='pdt_name' size='40' maxlength='50' value="<?=$pdt_name?>"/>  <font color="red">*</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  </td>
  </tr><tr>
      <td class='tablerow'><strong>道具简介</strong><br>简介，用于需要在列表时显示</td>
      <td class='tablerow'><textarea name='pdt[pdt_description]' cols='60' rows='3' id='pdt_description'><?=$pdt_description?></textarea></td>
    </tr>
    <tr>
      <td class='tablerow'><strong>绑定方式</strong><br>  </td>
      <td class='tablerow'><input type='radio' class="radio_style" name='pdt[itembind]' value='1' checked>
      绑定&nbsp;&nbsp;
      <input type='radio' class="radio_style" name='pdt[itembind]' value='0'>
      不绑定</td>
    </tr>
    <tr>
      <td class='tablerow'><strong>道具品质</strong><br>  </td>
      <td class='tablerow'>
	  <input type='radio' class="radio_style" name='pdt[itemcolor]' value='0' checked>
      白色&nbsp;&nbsp;
      <input type='radio' class="radio_style" name='pdt[itemcolor]' value='1'> 
      绿色
	  <input type='radio' class="radio_style" name='pdt[itemcolor]' value='2'>
      蓝色&nbsp;&nbsp;
      <input type='radio' class="radio_style" name='pdt[itemcolor]' value='3'> 
      金色</td>
    </tr>
        <tr>
      <td width='190' class='tablerow'><strong>价格</strong></td>
      <td class='tablerow'>
<input name='pdt[price]' type='text' id='pdt_price' size='20' maxlength='50' value="<?=$price?>"/> 元<font color="red">*</font>	  </td>
    </tr>
        <tr>
      <td  class='tablerow'><strong>道具缩略图</strong><br></td>
      <td class='tablerow'><input name='pdt[pdt_img]' type='text' id='pdt_img' size='40' maxlength='50'  value="<?=$pdt_img?>"/>&nbsp;&nbsp; 
      <input type="button" class="btn" value=" 上传 " onClick="javascript:openwinx('?mod=<?=$mod?>&file=uppic&uploadtext=pdt_img&type=both&width=<?=$MOD['thumbwidth']?>&height=<?=$MOD['thumbheight']?>','upload','350','200')">
      &nbsp;&nbsp;小图，一定要上传。50*50</td>
    </tr>
	<tr>
      <td  class='tablerow'><strong>道具大图</strong><br></td>
      <td class='tablerow'><input name='pdt[pdt_bigimg]' type='text' id='pdt_bigimg' size='40' maxlength='50'  value="<?=$pdt_bigimg?>"/>&nbsp;&nbsp; 
      <input type="button" class="btn" value=" 上传 " onClick="javascript:openwinx('?mod=<?=$mod?>&file=uppic&uploadtext=pdt_bigimg&type=thumb&width=<?=$MOD['bigthumbwidth']?>&height=<?=$MOD['bigthumbheight']?>','upload','350','200')">
      &nbsp;&nbsp;可以不传，传了更美观。高215 宽324 </td>
    </tr>
    <tr>
      <td class='tablerow'><strong>立即上架</strong><br>  </td>
      <td class='tablerow'><input type='radio' class="radio_style" name='pdt[onsale]' id='onsale' value='1' checked>√&nbsp;&nbsp;<input type='radio' class="radio_style" name='pdt[onsale]' id='onsale' value='0'>×
		<font color="red">*</font></td>
    </tr>
    </tr>
  </tbody>
</table>

<table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
  <tr>
     <td width='30%'>
	 <div style="display:none">
       <?=$php_urlrule?>
       <input type="hidden" name="pdt[ishtml]" value="0">
     </div></td>
     <td><input type="submit" class="btn" name="submit" value=" 确定 ">&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" class="btn" name="reset" value=" 重置 "></td>
  </tr>
</table>
</form>
<script language="javascript">
<?php
sajax_show_javascript();
?>
function giveitem(itemid){
 if(itemid == ""){
   window.alert("请填写道具代码");
   $("pdt_name").value='';
   $("pdt_description").value='';
   return false;
 }
 x_giveitem(itemid,giveitem_cb)
 
 function giveitem_cb(z){
    if(z == "noitem"){
	window.alert("该道具不存在，请更新或导入装备数据到数据库");
   $("pdt_name").value='';
   $("pdt_description").value='';
	//window.location.href="?mod=game&file=items&action=manage";
	}else{
	var str=z.split("|||");
	var str0 = str[0].split("|||");
	var str1 = str[1].split("|||");
	$("pdt_name").value=str0;
	$("pdt_description").value=str1;
	}
 }
}

</script>
</body>
</html>