<%@ page contentType="text/html; charset=utf-8" language="java" errorPage="" %>
<%@ page import="java.util.*"%>
<%@ page import="tot.search.ArticleIndex"%>
<%@ page import="tot.exception.*"%>
<%@ page import="tot.util.*" %>
<%@ page import="tot.bean.*" %>
<%@ page import="tot.dao.DaoFactory" %>
<%@ page import="java.util.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.net.*" %>
<%@ page import="tot.global.Sysconfig" %>
<%@ page import="tot.global.Syslog" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
<title>add article index</title>
<link href="style/global.css" rel="stylesheet" type="text/css" />
</head>
<body>
<%
/*
	参数说明：
	ChannelId:频道ID(必填参数)
	CatalogId:栏目ID(必填参数)
	ArticleId:文章ID(必填参数)
	Title:文章标题(必填参数)
	Content:文章内容(必填参数)
	PubDate:发布日期,(选填)注意日期格式为：yyyy-MM-dd HH:mm:ss(如2009-11-19 09:13:59)
	Summary:文章摘要(选填)
	LinkUrl:链接地址(必填参数)
*/
boolean ok=true;
String msg="";
String ChannelId=RequestUtil.getString(request,"ChannelId");
String CatalogId=RequestUtil.getString(request,"CatalogId");
String ArticleId=RequestUtil.getString(request,"ArticleId");
String Title=RequestUtil.getString(request,"Title");
String Content=RequestUtil.getString(request,"Content");
String PubDate=RequestUtil.getString(request,"PubDate");
String Summary=RequestUtil.getString(request,"Summary");
String LinkUrl=RequestUtil.getString(request,"LinkUrl");
if(ChannelId==null || ChannelId.equals("")){	
	ok=false;
	msg="频道ID不能为空！";
}else if(CatalogId==null || CatalogId.equals("")){
	ok=false;
	msg="栏目ID不能为空！";
}else if(ArticleId==null || ArticleId.equals("")){
	ok=false;
	msg="文章ID不能为空！";
}else if(Title==null || Title.equals("")){
	ok=false;
	msg="文章标题不能为空！";
}else if(Content==null || Content.equals("")){
	ok=false;
	msg="文章内容不能为空！";
}else if(LinkUrl==null || LinkUrl.equals("")){
	ok=false;
	msg="文章链接不能为空！";
}else if(PubDate==null || PubDate.equals("")){
	PubDate=DateUtil.getStringDate();
}else if(Summary==null || Summary.equals("")){
	Summary=StringUtils.removeHtml(Content);
	if(Summary.length()>100) Summary=Summary.substring(0,100);
}
PubDate=PubDate+".000000000";
if(Content!=null)
Content=new String(Content.getBytes("iso-8859-1"),"gbk");
out.print("Pubdate:"+PubDate+"<br>");
out.print("Title:"+Title+"<br>");
out.print("Content:"+Content+"<br>");
if(ok){
	DataField df=new DataField();
	df.setField("ChannelId",ChannelId,0);
	df.setField("CatalogId",CatalogId,0);
	df.setField("ArticleId",ArticleId,0);
	df.setField("Title",Title,0);
	df.setField("Content",Content,0);
	df.setField("PubDate",PubDate,0);
	df.setField("Summary",Summary,0);
	df.setField("LinkUrl",LinkUrl,0);
	ArticleIndex.scheduleAddTask(df);
	out.print("<br><br><p align=\"center\">(Success Add Article Index!)</p>");
}
else{
	out.print("<div align=\"center\">"+msg+"</div>");
}
%>
</body>
</html>