<?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=='savearticle'){
    list($pid,$categoryid)=explode(',',$cid);
	article2db($articletitle,$g_editor_doc,$tag,$pid,$categoryid,$uid,$userid);
}
?>
<script language=javascript src="./engine/js/calendar.js"></script>
<form enctype="multipart/form-data" method="post" action="siteadmin.php?iframe=publisharticle&action=savearticle" onsubmit="return submitcheck('article')">
<table>
<caption>文章信息发布</caption>
   <tr>
      <td width="10%"><span>文章标题</span></td>
      <td width="90%" valign="middle"><input type="text" name="articletitle" class="formtext" id="articletitle" > 
	  <select name="tag" class="smallselect">
	  <?php 
	  foreach($articleidentification as $key => $val){
		  echo '<option value="'.$key.'" style="color:'.$val[0].'">'.$val[1].'</option >';
	  }
	  ?>
      </select>
	  </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_articlecategory WHERE pid = 0");
while($category=$db->fetch_array($q)){ ?>
<option value="<?php echo $category['pid'].','.$category['acid']?>"  style="background-color:#B1C3D9"><?php echo $category['categorytitle']?></option >
<?php 
$pid=$category['acid'];
$subq=$db->query("SELECT * FROM g_articlecategory WHERE pid = $pid");
while($subcategory=$db->fetch_array($subq)){
				echo '<option value="'.$subcategory['pid'].','.$subcategory['acid'].'" >>&nbsp;'.$subcategory['categorytitle'].'</option>';
			}
		}
?>
      </select>
	</td>
  </tr>
	  	  <tr>
	  <td>修改时间</td>
	  <td> &nbsp;<input type="checkbox" name="iscustom" id="iscustom" value="1"></td>
	  </tr>
	  <tbody id="custom_tbody">
		  <tr>
		 <td>发布时间</td>
		<td><span id="calendar_subtime"></span></td>
		</tr>
	  </tbody>
   </tbody>

    		<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>

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