<script language="javascript">
$(document).ready(function(){
	$("#adddj").click(function(){
		var S_Name=$("#S_Name").val();
		var S_ClassID=$("#S_ClassID").val();
		var S_Author=$("#S_Author").val();
		var S_Source=$("#S_Source").val();
		var S_ConTent=$("#S_ConTent").val();
	$("#S_Name").css("border-color","#666 #ccc #ccc #666");
	$("#SClassID").text("");
	$("#S_Source").css("border-color","#666 #ccc #ccc #666");
	$("#SConTent").text("");
	if(S_Name==""){
		$("#S_Name").css("border","1px solid red");
		jAlert("出错了，请填写文章名称！","操作提示");
		return false;
		}
	else if(S_ClassID=="0"){
		$("#SClassID").text("请选择文章分类！").css("color","red");
		jAlert("出错了，请选择文章分类！","操作提示");
		return false;
		}
	else if(S_Source==""){
		$("#S_Source").css("border","1px solid red");
		jAlert("出错了，请填写文章来源！","操作提示");
		return false;}
	else if(S_ConTent==""){
		$("#SConTent").text("请填写文章内容").css("color","red");
		jAlert("出错了，请填写文章内容！","操作提示");
		return false;}
	});

});
</script>
<?php
$classid=SafeRequest("classId","get");
if($op==""){
$op="main";
}
?>
		<div class="userMain">
			<div class="uMain_title"><span class="iconMiniblog">文章信息</span></div>
			<div class="uMain_content">
				<div class="stageBox">
					<div class="stageBoxTop"><span></span></div>
					<div class="stageBoxCenter">
						<div class="stageBoxCenterContent">
							<div class="main_nav">
								<ul>
								<li class="<?php if($op=="main"){ echo "nava_6";}else{ echo "navb_5";}?>"><a href="?ac=article">我发表的文章</a></li>
								</ul>
								<div class="action"><a href="?ac=article&op=add">填加新文章</a></div>
							</div>
							<div class="main_nav2">
<?php
if($op=="main"){
?>
								<ul>
								<li <?php if($classid==""){ echo "class='nav2a_4'";}else{ echo "";}?>><a href="?ac=article">全部文章</a></li>
<?php
	global $db;
	$sql="select * from s_class where S_SystemID=2 and S_IsHide=0 order by S_id asc";
	$rs=$db->query($sql);
	$num=$db->num_rows($rs);
	if($num==0) echo "<li>没有栏目类容。</li>";
	$nums=6;
	if($num<$nums){
		$j=$num;
	}else{
		$j=$nums;
	}
	for($i=0;$i<$j;$i++){
		$row=$db->fetch_array($rs);
?>
								<li <?php if($classid==$row["S_ID"]){ echo "class='nav2a_4'";}else{ echo "";}?>><a href="?ac=article&op=<?php echo $op?>&classId=<?php echo $row["S_ID"]?>"><?php echo $row["S_Name"]?></a></li>
<?php
	}
?>

								</ul>
							</div><FORM id="frmList" name="frmList" method="post" action="">
							<div class="minHeight500" id="favoritesFriend">

								<div class="downList">

<?php
$a=1;
global $db;
if($classid==""){
	$sql="select * from s_article where S_Author='".$chsh_username."' order by s_addtime desc";
}else{
	$sql="select * from s_article where S_Author='".$chsh_username."' and S_Classid=$classid order by s_addtime desc";
}
		$Arr=getuserpage($sql,"30");//sql,每页显示条数
		$result=$db->query($Arr[2]);
		$numdate="a";
		if($result){
			while ($row = $db ->fetch_array($result)){
		$numdate="b";
	$sqlu="select * from s_users where S_name='".$row["S_Author"]."' order by s_id desc";
	$rsu=$db->query($sqlu);
	$rowu=$db->fetch_array($rsu);
           $sqlug="select * from s_class where S_ID=".$row["S_ClassID"];
	   $results = $db->query($sqlug);
	   $rowug = $db->fetch_array($results);
	$classname=$rowug["S_Name"];
	$S_Reco=$row["S_Reco"];
if($S_Reco>0){
	$S_Reco=$S_Reco-1;
}
?>
		<li><span class="cbox"></span><span class="mname"><a href="<?php echo LinkUrl("s_article",$row['S_ClassID'],1,$row['S_ID'])?>" target="p"><?php echo $a?>.<?php echo $row["S_Name"]?></a></span><span class="mclass"><?php echo $classname?></span><span class="mtime" title="下载时间"><?php echo datetime($row["S_AddTime"])?></span><span id="del-m42559" class="mdel" title="删除" onClick="window.open('do.php?ac=article&op=del&id=<?php echo $row["S_ID"]?>')"></span></li>
<?php
$a=$a+1;
}
?>


																			</ul>
																	</div>
																<div class="page"></form>
									<div class="pages"><?php echo $Arr[0];?></div>
<?php
}
if($numdate=="a"){
		echo("<div class='nothing'>还木有没有文章。</div>");
}
?>
								</div>
<?php
}elseif($op=="add"){
if((!$userlogin==true)){showmessage("出错了，请登陆后再操作。","index.php",0);}
$playadd=playadd(1);
?>

								<div class="profile">
									<div class="title">
										<div class="name">文章发布</div>
									</div>
									<ul><form  name="form3" action="do.php?ac=article&op=add" method="post"> 
										<li>
											<div class="name">名称：</div>
											<div class="input"><input type="texe" style="width:190px;" class="input_normal" name="S_Name" id="S_Name" maxlength="50"/></div>
											<div class="input_msg" id="moldpassword"><font color="#FF0000">＊</font>文章名称。</div>
										</li>
										<li>
											<div class="name">分类：</div>
											<div class="input"><select name="S_ClassID" id="S_ClassID">
              <?php
              	global $db;
              	$sqlclass="select * from s_class where S_SystemID=2 and S_Name<>'站内公告' ";
				$results=$db->query($sqlclass);
				if($results){
					while ($row3=$db->fetch_array($results)){
						if($class==$row3['S_ID']){
							echo "<option value='".$row3['S_ID']."' selected='selected'>".$row3['S_Name']."</option>";
							}
						else{
							echo "<option value='".$row3['S_ID']."' >".$row3['S_Name']."</option>";
							}	
						
						}
					}
			  ?>	 
</select></div>
											<div class="input_msg" id="moldpassword"><font color="#FF0000">＊</font>文章分类。</div>
										</li>
										<li>
											<div class="name">作者：</div>
											<div class="input"><input type="texe" style="width:190px;" class="input_normal" name="S_Author" id="S_Author"  value="<?php echo $chsh_username?>" maxlength="30"  readonly/></div>
											<div class="input_msg" id="mpassword"><font color="#FF0000">＊</font>文章作者,自动获取。</div>
										</li>
										<li>
											<div class="name">来源：</div>
											<div class="input"><input type="texe" style="width:190px;" class="input_normal" name="S_Source" id="S_Source"  value="<?php echo S_SiteName?>" maxlength="20"/></div>
											<div class="input_msg" id="mpassword2"><font color="#FF0000">＊</font>文章来源。</div>
										</li>
										<li>
											<div class="name">内容：</div>
											<div class="input"><textarea name="S_ConTent" id="S_ConTent" style="width:400px;height:210px"></textarea></div>
											<div class="input_msg" id="mpassword2"><font color="#FF0000">＊</font>文章内容。</div>
										</li>

			<li></li>
			<li></li>
			<li></li>
			<li></li>
										<li>
											<div class="name"></div>
											<div class="input"><span class="button-main"><span><button type="submit" id="adddj" >确定发布</button></span></span></div>
									<div class="input_msg" id="mpassword2"><font color="#FF0000">＊注意：文章发布默认为未审核，我们一般在3天类审核，如果需要加速审核，请联系QQ：<?php echo S_AdminQQ?></font></div>
										</li></form>
									</ul>
								</div>
<?php
}
?>
															</div>
						</div>
					</div>


					<div class="stageBoxBottom"><span></span></div>
				</div>
			</div>