<?php
		include("header.tpl.php");
		include("bodytop.tpl.php"); 
		include("navigation.tpl.php"); 
		?>
	<link rel="stylesheet" type="text/css" href="templates/<?php echo $sytle='default'?>/editor.css" />
	<script language=javascript src="./engine/js/attach.js"></script>
	<script language=javascript src="./engine/js/editor.js"></script>
	<script language=javascript src="./engine/js/menu.js"></script>
	<script language=javascript src="./engine/js/calendar.js"></script>
<div class="clear"></div>
<?php if($action=='pubproduct'){?>
<form enctype="multipart/form-data" method="post" action="post.php?action=saveproduct&pid=<?php echo $pid?>&categoryid=<?php echo $categoryid?>" onsubmit="parseurl()" >
	<div id="postmsg">
       <div class="rl_u">&nbsp;</div>
		<div class="content">
			<h2>发布产品信息</h2>
			<div class="div_p font_14">
			     <table>
			<tr>
				<th width="20%">产品名称</th>
			<td><input type="text" name="producttitle" class="postmsgbox">&nbsp;	
  <select name="tag" class="smallselect">
	  <?php 
	  foreach($productidentification as $key => $val){
		  echo '<option value="'.$key.'" style="color:'.$val[0].'">'.$val[1].'</option >';
	  }
	  ?>
      </select>
	  </td>
	  </tr>

	  <tr>
	  <th>自定义发布时间</th>
	  <td> &nbsp;<input type="checkbox" name="iscustom" id="iscustom" value="1"></td>
	  </tr>
	  <tbody id="custom_tbody">
		  <tr>
		 <th>设置发布时间</th>
		<td><span id="calendar_subtime"></span></td>
		</tr>
	  </tbody>

	  <tr>
	 <th>产品标识图</th>
      <td><input type="file" id="logoimg" name="logoimg[1]" class="postmsgattach">&nbsp; </td>
	  </tr>
	   <tr>
	  <th>产品简介</th>
      <td ><textarea name="productintro" class="postmsgarea"></textarea></td>
	  </tr>
	  <tr>
	  <th valign="top">产品内容</th>
		<td valign="top"><?php include("editor.tpl.php");?></td>
		</tr>
		<tr>
	  <th>&nbsp;</th>
	  <td ><input type="submit" value="发  布" class="postmsgbtn"></td>
	  </tr>
		</table>
			<div class="clear"></div>
			</div>
		</form>

<?php }elseif($ipost=='modifyproduct'){?>
	<form enctype="multipart/form-data" method="post" action="post.php?action=updateproduct&productid=<?php echo $mid?>&pid=<?php echo $modifyinfo['pid']?>&categoryid=<?php echo $modifyinfo['categoryid']?>" onsubmit="parseurl()">
	<div id="postmsg">
       <div class="rl_u">&nbsp;</div>
		<div class="content">
			<h2>修改产品信息</h2>
			<div class="div_p font_14">
			    <table>
			<tr>
				<th width="20%">产品名称</th>
			<td><input type="text" name="producttitle" class="postmsgbox" value="<?php echo $modifyinfo['producttitle']?>">&nbsp;	
  <select name="tag" class="smallselect">
	  <?php 
	  foreach($productidentification as $key => $val){
	      $tagselect=$modifyinfo['tag']==$key ? 'selected':'';
		  echo '<option value="'.$key.'" style="color:'.$val[0].'" '.$tagselect.' >'.$val[1].'</option >';
	  }
	  ?>
      </select></td>
	  </tr>
	  <tr>
	  <th>修改发布时间</th>
	  <td> &nbsp;<input type="checkbox" name="iscustom" id="iscustom" value="1"></td>
	  </tr>
	  <tbody id="custom_tbody">
		  <tr>
		 <th>设置发布时间</th>
		<td><span id="calendar_subtime"></span></td>
		</tr>
	  </tbody>

	  <tr>
	 <th>产品标识图</th>
      <td>
	  <?php if($modifyinfo['islogo']){?>&nbsp;
	  <span id="modifyattach<?php echo $modifyinfo['fid']?>"></span>
	  <span id="attach<?php echo $modifyinfo['fid']?>"><a href="javascript:popwindows('<?php echo $modifyinfo['storename']?>',1,0)"><?php echo $modifyinfo['name']?></a> <a href="###" onclick="modifyattach(<?php echo $modifyinfo['fid']?>)">[修改]</a> <a href="###" onclick="deleteattach('product',<?php echo $mid?>,<?php echo $modifyinfo['fid']?>,true)">[删除]</a></span>	    
	  <?php }else{?>
	  <input type="file" id="logoimg" name="logoimg[1]" class="postmsgattach">
	  <?php }?>
	  </td>
	  </tr>
	  <tr>
	  <th>产品简介</th>
      <td ><textarea name="productintro" class="postmsgarea"><?php echo $modifyinfo['productintro']?></textarea></td>
	  </tr>
	<tr>
	  <th valign="top">产品内容</th>
		<td valign="top"><?php include("editor.tpl.php");?></td>
		</tr>

		<?php if(!empty($modproductattachs)){?>
				<tr><th valign="top" >&nbsp;</th><td >
<table>
			<tr>
				<th width="60%" class="font_12">文章附件</th>
				<th width="10%" class="font_12">附件大小</th>
				<th width="22%" class="font_12">附件类型</th>
				<th width="8%" class="font_12">下载</th>
			</tr>
   <?php

	foreach($modproductattachs as $key => $val){
	?>
	<tr>
		  <td>
		  <div id="attach<?php echo $key?>">		 
				[<a href="###" onclick="deleteattach('product',<?php echo $mid?>,<?php echo $key?>,true)">删除</a>] 
				[<a href="###" onclick="modifyattach('<?php echo $key?>')">修改</a>] 
				[<a href="###" onclick="insertAttachtext('<?php echo $key?>');return false;">插入</a>]
				<?php echo '('.$key.') '.$val['name']?>
				</div>
				<span id="modifyattach<?php echo $key?>"></span>
			</td>
			<td><?php echo sizecount($val['size'])?></td>
			<td><?php echo $val['type']?></td>
			<td><?php echo $val['downtimes']?></td>
			</td>
   </tr>
<?php		}?>

   </table>
				</td>
				</tr>
<?php		}?>

			<tr>
				  <th valign="top">&nbsp;</th>
				<td class="t_r"><input type="submit" value="发  布" class="postmsgbtn"></td>
			</tr>
			</table>
			<div class="clear"></div>
			</div>
		</form>
<?php }?>
		</div>
		<div class="rl_d">&nbsp;</div>
	</div>

<?php
include("tail.tpl.php"); 
?>

<SCRIPT LANGUAGE="JavaScript">
loadcalendar("_subtime");
loadcustomtime();
</SCRIPT>