<?php
if(!defined('IN_GATEWEI')) {	exit('access denied');}
require_once GATEWEI_ROOT.'./engine/attachment.func.php';
require_once GATEWEI_ROOT.'./engine/post.func.php';

if($action=='saveproduct'){
		list($pid,$categoryid)=explode(',',$cid);
		product2db($producttitle , $productintro , $g_editor_doc,$tag,$pid,$categoryid,$uid,$userid);
}
?>

<form enctype="multipart/form-data" method="post" action="siteadmin.php?iframe=publishproduct&action=saveproduct" onsubmit="return submitcheck('product')">
<table>
<caption>产品信息发布</caption>
   <tr>
      <td width="10%"><span>产品标题</span></td>
      <td width="90%"><input type="text" id="producttitle" name="producttitle" class="formtext" >&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>
          <td >
	       <span>产品标识图</span>
	      </td>
		   <td >
				<input type="file" id="logoimg" name="logoimg[1]" class="logoimgfile">&nbsp;
	      </td>
   </tr>
  <tr>
    <td><span>所属分类</span></td>
    <td >
	  <select id="cid" name="cid" class="formselect">
		<option value="0,0" selected >产品根分类</option >
<?php
$q=$db->query("select * from g_productcategory where pid = 0");
while($category=$db->fetch_array($q)){ ?>
<option value="<?php echo $category['pid'].','.$category['pcid']?>"  style="background-color:#b1c3d9"><?php echo $category['categorytitle']?></option >
<?php 
$pid=$category['pcid'];
$subq=$db->query("select * from g_productcategory where pid = $pid");
while($subcategory=$db->fetch_array($subq)){
				echo '<option value="'.$subcategory['pid'].','.$subcategory['pcid'].'" >'.$subcategory['categorytitle'].'</option>';
			}
		}
?>
      </select>
	</td>
  </tr>

<tr>
<tr>
          <td valign="top">
	       <span>产品简介</span>
	      </td>
		    <td >
	       <textarea name="productintro" class="formtextarea"></textarea>
	      </td>
   </tr>
    		<tr>
          <td colspan="2">
	       <span>产品内容</span>
	      </td>
   </tr>
<tr>
          <td colspan="2" valign="top">
<?php
require_once("./admin/g_admin_editor.func.php");
geditor();
?>
</td>
   </tr>

  		<tr>
          <td colspan="2">&nbsp;
	         <div id="hr_u"> </div>
	         <div id="hr_d"> </div>
			 
	      </td>
   </tr>

   <tr>
    <td  colspan="2"> <div id="submitdiv"><input name="" type="submit" value="提&nbsp;&nbsp;交" ></div></td>
    </tr>
</table>

</form>