<?php defined('IN_HS') or exit('Access Denied'); ?>
<?php include 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="<?php echo HS_PATH;?>checkcode.php?id='+Math.random()*5";
}
}
}

function doCheck(){

if ($('catid').value=='0'){
alert('指定的栏目不允许添加文章！只允许在其子栏目中添加文章。');
//$('catid').focus();
return false;
}

<?php if($MOD['check_code']) { ?>
if ($('checkcodestr').value=='') {
alert("请输入验证码!");
return false;
}
<?php } ?>

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>

<?php include template('member','left_post'); ?>

<DIV class="ad_rbarB boxC">

<?php 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="<?php echo $HS['siteurl'];?><?php echo $CHA['channeldir'];?>/myitem.php?action=add" method="post" name="myform" onsubmit="return doCheck();">
  <TR>
    <TH><font color=#FF0000>提示：</font> </TH>
    <TD colSpan=2><input type="hidden" name='catid' id="catid" value='<?php echo $catid;?>'><font color=#FF0000>请务必认真填写，信息一经通过审核，将无法修改！</font></TD></TR>
 <?php 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='<?php echo HS_PATH;?>checkcode.php?id='+Math.random()*5;" style="cursor:pointer;" alt="验证码,看不清楚?请点击刷新验证码" align="absmiddle"/> 

</TD>
</TR>
<?php } ?>
  <TR>
    <TH>文章标题： </TH>
    <TD colSpan=2><input class="inputT" name="title" type="text" id="title" maxlength="30"> </TD></TR>
<TR>
    <TH>所在服务器： </TH>
    <TD colSpan=2><input class="inputA" name="copyfrom" type="text" id="copyfrom"> </TD></TR>
<TR>
    <TH>游戏中昵称： </TH>
    <TD colSpan=2><input class="inputA" name="author" type="text" id="author"> </TD></TR>
  <TR>
    <TH>　</TH>
    <TD colSpan=2>
<textarea name="content" id="content" cols="100" rows="25"><?php echo $content;?></textarea>
<?php echo editor("content",$MOD['editor_mode'],580,300);?>	 </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>

<?php } 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="<?php echo $HS['siteurl'];?><?php echo $CHA['channeldir'];?>/myitem.php?action=edit&articleid=<?php echo $articleid;?>" method="post" name="myform" onsubmit="return doCheck();">
  <TR>
    <TH><font color=#FF0000>提示：</font> </TH>
    <TD colSpan=2><input type="hidden" name="catid" value="<?php echo $catid;?>"> <font color=#FF0000>请务必认真填写，信息一经通过审核，将无法修改！</font></TD></TR>
 <?php 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='<?php echo HS_PATH;?>checkcode.php?id='+Math.random()*5;" style="cursor:pointer;" alt="验证码,看不清楚?请点击刷新验证码" align="absmiddle"/> 

</TD>
</TR>
<?php } ?>
  <TR>
    <TH>标题： </TH>
    <TD colSpan=2><input class="inputT" name="title" type="text" id="title" value="<?php echo $title;?>" maxlength="30"> </TD></TR>
<TR>
    <TH>所在服务器： </TH>
    <TD colSpan=2><input class="inputA" name="copyfrom" type="text" id="copyfrom" value="<?php echo $copyfrom;?>">
<!--
<SELECT name="copyfrom">
<OPTION value="">-- 请选择 --</OPTION>
<?php if(is_array($servs)) foreach($servs AS $serv) { ?>
<OPTION value="<?php echo $serv['servername'];?>" <?php if($copyfrom == $serv[servername]) { ?> checked<? } ?>><?php echo $serv['servername'];?></OPTION>

<?php } ?>

</SELECT>
-->
 </TD></TR>
<TR>
    <TH>游戏中昵称： </TH>
    <TD colSpan=2><input class="inputA" name="author" type="text" id="author" value="<?php echo $author;?>"> </TD></TR>
  <TR>
    <TH>　</TH>
    <TD colSpan=2>
<textarea name="content" id="content" cols="100" rows="25"><?php echo $content;?></textarea>
<?php echo editor("content",$MOD['editor_mode'],580,300);?>	 </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>

<?php } elseif ($action=='manage') { ?>
<DIV class=columnC><input type="button" class="shsbtn" value="新稿件" onclick="window.location.href='/article/myitem.php?action=add&catid=<?php echo $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>
<?php if(is_array($articles)) foreach($articles AS $article) { ?>
  <TR align=middle>
    <TD align=middle width="10%" height="30"><?php if($article['status']==3) { ?><font color=green><b>已通过</b><?php } elseif ($article['status']==2) { ?><font color=black><b>被退回</b><?php } else { ?><font color=red><b>待审核</b><?php } ?></font></TD>
<TD align=left width="36%"><?php if($article['status']==3) { ?><a href="<?php echo $article['linkurl'];?>" target="_blank"><?php echo $article['title'];?></a>(<?php echo $article['hits'];?>)<?php } else { ?><?php echo $article['title'];?><?php } ?> </TD>
    <TD align=middle width="20%"><?php echo $article['adddate'];?> </TD>
    <TD align=middle width="20%"><?php if($article['checktime']!='1970-01-01 08:00:00') { ?><?php echo $article['checktime'];?><?php } else { ?>--<?php } ?> </TD>
    <TD align=middle width="14%"><?php if($_groupid ==1 || $article['status']<3) { ?><a href="<?php echo $HS['siteurl'];?><?php echo $CHA['channeldir'];?>/myitem.php?action=edit&articleid=<?php echo $article['articleid'];?>">编辑</a> | <a href="<?php echo $HS['siteurl'];?><?php echo $CHA['channeldir'];?>/myitem.php?action=delete&articleid=<?php echo $article['articleid'];?>">删除</a><?php } else { ?><span style="color:#C0C0C0">编辑 | 删除</span><?php } ?> </TD></TR>

<?php } ?>

</TBODY></TABLE>

</DIV>
<?php } ?>
  </DIV></DIV></DIV>
  

<?php include template('member','footer'); ?>
