{template 'member','header'}
<script type="text/javascript">
<?php
sajax_show_javascript();
?>
function codedocheck(){
    strcode = $('checkcodestr').value;
	x_codedocheck(strcode,codedocheck_cb);

function codedocheck_cb(z) {
    if(z == "true")
	{
	$('checkcodestr').style.backgroundColor="green";
	$('checkcodestr').style.color="white";
	}
	else
	{
	window.alert("验证码输入错误，请检查！");
	$('checkcodestr').style.backgroundColor="";
	$('checkcodestr').style.color="";
	$("imgaecode").src="{HS_PATH}checkcode.php?id='+Math.random()*5";
	}
}
}

function doCheck(){

	if ($('catid').value=='0'){
		alert('指定的栏目不允许添加文章！只允许在其子栏目中添加文章。');
		//$('catid').focus();
		return false;
	}
	
	{if $MOD['check_code']}
	if ($('checkcodestr').value=='') {
		alert("请输入验证码!");
		return false;
	}
	{/if}
	
	if ($('title').value=='') {
		alert('请填写文章标题！');
        $('title').focus();
		return false;
	}
	if ($('copyfrom').value=='') {
		alert('请填所在服务器！');
        $('copyfrom').focus();
		return false;
	}
	if ($('author').value=='') {
		alert('请填写游戏昵称！');
        $('author').focus();
		return false;
	}
	
	if(FCKeditorAPI.GetInstance('content').GetXHTML()=='')
	{
		alert('请输入文章内容！');
		return false;
	}



}
</script>
<DIV class=main>
<DIV class=main>
{template 'member','left_post'}
<DIV class="ad_rbarB boxC">

{if $action=='add'}
<DIV class=columnC><SPAN class="l_tit f_l">发布文章</SPAN></DIV>
<DIV class=mainboxD>
<TABLE class=regform cellSpacing=0 cellPadding=0 width="100%" align=center 
border=0>
  <TBODY>
     <form action="{$HS[siteurl]}{$CHA[channeldir]}/myitem.php?action=add" method="post" name="myform" onsubmit="return doCheck();">
  <TR>
    <TH><font color=#FF0000>提示：</font> </TH>
    <TD colSpan=2 width="85%"><input type="hidden" name='catid' id="catid" value='{$catid}'><font color=#FF0000>请务必认真填写，信息一经通过审核，将无法修改！</font></TD></TR>
	 {if $MOD['check_code']}
  <TR>
    <TH>验证码： </TH>
    <TD colSpan=2 width="85%"><input onBlur="codedocheck()" class="inputC" name="checkcodestr" type="text" id="checkcodestr" value=""> 
	<img src="<?=HS_PATH?>checkcode.php" id="imgaecode" onclick="this.src='{HS_PATH}checkcode.php?id='+Math.random()*5;" style="cursor:pointer;" alt="验证码,看不清楚?请点击刷新验证码" align="absmiddle"/> 
	
	</TD>
	</TR>
	{/if}
  <TR>
    <TH>文章标题： </TH>
    <TD colSpan=2 width="85%"><input class="inputT" name="title" type="text" id="title" maxlength="30"> </TD></TR>
	<TR>
    <TH>所在服务器： </TH>
    <TD colSpan=2 width="85%"><input class="inputA" name="copyfrom" type="text" id="copyfrom"> </TD></TR>
	<TR>
    <TH>游戏中昵称： </TH>
    <TD colSpan=2 width="85%"><input class="inputA" name="author" type="text" id="author"> </TD></TR>
  <TR>
    <TH>　</TH>
    <TD colSpan=2 width="85%">
	<textarea name="content" id="content" cols="100" rows="25">{$content}</textarea>
	{$editor("content",$MOD['editor_mode'],450,250)}	 </TD></TR>
  <TR>
    <TH>　</TH>
	<TD colSpan=2 width="85%"><div style="text-align:center"><input type="submit" name="dosubmit" class="hsbtn" value="发布"></div></TD>
    </TR>
	  </form>
	  </TBODY></TABLE>
</DIV>

{elseif $action=='edit'}
<DIV class=columnC><SPAN class="l_tit f_l">编辑文章</SPAN></DIV>
<DIV class=mainboxD>
<TABLE class=regform cellSpacing=0 cellPadding=0 width="100%" align=center 
border=0>
  <TBODY>
<form action="{$HS[siteurl]}{$CHA[channeldir]}/myitem.php?action=edit&articleid={$articleid}" method="post" name="myform" onsubmit="return doCheck();">
  <TR>
    <TH><font color=#FF0000>提示：</font> </TH>
    <TD colSpan=2><input type="hidden" name="catid" value="{$catid}"> <font color=#FF0000>请务必认真填写，信息一经通过审核，将无法修改！</font></TD></TR>
	 {if $MOD['check_code']}
  <TR>
    <TH>验证码： </TH>
    <TD colSpan=2><input onBlur="codedocheck()" class="inputC" name="checkcodestr" type="text" id="checkcodestr" value=""> 
	<img src="<?=HS_PATH?>checkcode.php" id="imgaecode" onclick="this.src='{HS_PATH}checkcode.php?id='+Math.random()*5;" style="cursor:pointer;" alt="验证码,看不清楚?请点击刷新验证码" align="absmiddle"/> 
	
	</TD>
	</TR>
	{/if}
  <TR>
    <TH>标题： </TH>
    <TD colSpan=2><input class="inputT" name="title" type="text" id="title" value="{$title}" maxlength="30"> </TD></TR>
	<TR>
    <TH>所在服务器： </TH>
    <TD colSpan=2><input class="inputA" name="copyfrom" type="text" id="copyfrom" value="{$copyfrom}">
	<!--
	<SELECT name="copyfrom">
	<OPTION value="">-- 请选择 --</OPTION>
	{loop $servs $serv}
	<OPTION value="{$serv[servername]}" <?php if($copyfrom == $serv[servername]) { ?> checked<? } ?>>{$serv[servername]}</OPTION>
	{/loop}
	</SELECT>
	-->
	 </TD></TR>
	<TR>
    <TH>游戏中昵称： </TH>
    <TD colSpan=2><input class="inputA" name="author" type="text" id="author" value="{$author}"> </TD></TR>
  <TR>
    <TH>　</TH>
    <TD colSpan=2>
	<textarea name="content" id="content" cols="100" rows="25">{$content}</textarea>
	{$editor("content",$MOD['editor_mode'],450,250)}	 </TD></TR>
  <TR>
    <TH>　</TH>
	<TD colSpan=2><div style="text-align:center"><input type="submit" name="dosubmit" class="hsbtn" value="编辑"></div></TD>
    </TR>
	  </form>
	  </TBODY></TABLE>
</DIV>

{elseif $action=='manage'}
<DIV class=columnC><input type="button" class="shsbtn" value="新稿件" onclick="window.location.href='/article/myitem.php?action=add&catid={$catid}'"></DIV>
<DIV class=paylist id=block_bill>
<TABLE class=paylist cellSpacing=0 cellPadding=0 width=100% align=center border=0>
  <TBODY>
  <TR align=middle>
    <TH align=middle height="30">状态 </TH>
	<TH align=middle>标题(点击率) </TH>
    <TH align=middle>发布时间 </TH>
    <TH align=middle>审核时间 </TH>
    <TH align=middle>管理 </TH></TR>
	{loop $articles  $article}
  <TR align=middle>
    <TD align=middle width="10%" height="30">{if $article['status']==3}<font color=green><b>已通过</b>{elseif $article['status']==2}<font color=black><b>被退回</b>{else}<font color=red><b>待审核</b>{/if}</font></TD>
	<TD align=left width="36%">{if $article['status']==3}<a href="{$article['linkurl']}" target="_blank">{$article['title']}</a>({$article['hits']}){else}{$article['title']}{/if} </TD>
    <TD align=middle width="18%">{$article['adddate']} </TD>
    <TD align=middle width="18%">{if $article['checktime']!='1970-01-01 08:00:00'}{$article['checktime']}{else}--{/if} </TD>
    <TD align=middle width="18%">{if $_groupid ==1 || $article['status']<3}<a href="{$HS[siteurl]}{$CHA[channeldir]}/myitem.php?action=edit&articleid={$article[articleid]}">编辑</a> | <a href="{$HS[siteurl]}{$CHA[channeldir]}/myitem.php?action=delete&articleid={$article[articleid]}">删除</a>{else}<span style="color:#C0C0C0">编辑 | 删除</span>{/if} </TD></TR>
	{/loop}
</TBODY></TABLE>

</DIV>
{/if}
	  </DIV></DIV></DIV>
	  
{template 'member','footer'}