<?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=='pubarticle'){?>

<form enctype="multipart/form-data" method="post" action="post.php?action=savearticle&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="articletitle" class="postmsgbox">
			<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>
	  <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  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 }
	if($ipost=='modifyarticle'){
?>
	<form enctype="multipart/form-data" method="post" action="post.php?action=updatearticle&aid=<?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="articletitle" class="postmsgbox" value="<?php echo $modifyinfo['articletitle']?>">&nbsp;	
				<select name="tag" class="smallselect">
	  <?php 
	  foreach($articleidentification 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 valign="top" >内容</th>
		<td valign="top"><?php include("editor.tpl.php");?></td>
		</tr>
<?php if(!empty($modarticleattachs)){?>
				<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($modarticleattachs as $key => $val){	?>
	<tr>
		  <td>
		  <div id="attach<?php echo $key?>">		 
				[<a href="###" onclick="deleteattach('article',<?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>&nbsp;</th>
		<td ><input type="submit" value="修  改" class="postmsgbtn"></td>
			    </tr>
				</table>
			<div class="clear"></div>
			</div>
		</div>
		<div class="rl_d">&nbsp;</div>
	</div>
	</form>
<?php }?>
		</div>
		<div class="rl_d">&nbsp;</div>
	</div>
	</form>

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

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