<%@ 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>
<%
/*
	参数说明：
	Categoryid:栏目ID(必填参数)
	id:文章ID(必填参数)
	Title:文章标题(必填参数)
	Content:文章内容(必填参数)
	PubDate:发布日期,注意日期格式为：YYYY-MM-DD(如2009-01-22)
	Demons:文章摘要
	LinkUrl:链接地址(必填参数)
*/
boolean ok=true;
String msg="";
String classid=RequestUtil.getString(request,"Categoryid");
String id=RequestUtil.getString(request,"id");
String Title=RequestUtil.getString(request,"Title");
String Content=RequestUtil.getString(request,"Content");
String PubDate=RequestUtil.getString(request,"ModDate");
String demons=RequestUtil.getString(request,"Demons");
String linkurl=RequestUtil.getString(request,"LinkUrl");
if(classid==null || classid.equals("")){
	ok=false;
	msg="栏目ID不能为空！";
}else if(id==null || id.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(PubDate==null || PubDate.equals("")){
	PubDate=DateUtil.getStringDate();
} 
PubDate=PubDate+".000000000";
if(Title!=null) Title=new String(Title.getBytes("iso-8859-1"),"utf-8");
if(Content!=null) Content=new String(Content.getBytes("iso-8859-1"),"utf-8");
//out.print(Content);
if(ok){
	DataField df=new DataField();
	df.setField("classid",classid,0);
	df.setField("id",id,0);
	df.setField("title",Title,0);
	df.setField("content",Content,0);
	df.setField("newstime",PubDate,0);
	df.setField("demons",demons,0);	
	df.setField("linkurl",linkurl,0);	
	out.print(PubDate);
	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>