<%@ page contentType="text/html; charset=UTF-8" language="java" errorPage="" %>
<%@ page import="java.util.*"%>
<%@ page import="tot.search.ArticleIndex"%>
<%@ include file="../inc/common.jsp"%>
<%@ include file="session.jsp"%>
<%
String act=RequestUtil.getString(request,"act");
String separator=FileUtil.getSeparator();	
%> 
<!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">

<fmt:bundle basename="resources.totcms_i18n">

<head>
<meta HTTP-EQUIV="content-type" CONTENT="text/html; charset=UTF-8">
<title>rebuild article index</title>
<link href="style/global.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style3 {color: #666666}
.style4 {
	color: #FFFFFF;
	font-weight: bold;
}
-->
</style>
<script src="js/commen.js"></script>
</head>
<body>
<%@ include file="top.jsp"%>
<%
if(act!=null && act.equals("do")){	
	ArticleIndex.scheduleCreateEmptyIndexTask();	
	out.print("<br><br><p align=\"center\">成功生成索引(Success Rebuild Article Index!)</p>");
	ArrayList fileList=(ArrayList)FileUtil.getList(request.getRealPath("/id"));
	for (Iterator iter = fileList.iterator(); iter.hasNext(); ) 
	{
		DataField df=(DataField)iter.next();
		String name=df.getFieldValue("name");
		if(FileUtil.exitsFile(request.getRealPath("/id")+separator+name)){
			FileUtil.deleteFile(request.getRealPath("/id")+separator+name);
		}		
	}
}
else{
%>
<div align="center">
<br />
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr>
    <td height="20" bgcolor="#9AEBE4"><div align="center" class="style4">重置索引</div></td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF"><div align="center">
      <p>&nbsp;</p>
      <p><a href="?act=do" onClick="return confirm('确定执行吗？执行后，已有的索引也将被置空')"><fmt:message key="totcms.admin.searchindex.rebuild" /></a><br />
        <br />
        <span class="style3"><fmt:message key="totcms.admin.searchindex.rebuildnotes" /></span></p>
      <p>&nbsp;</p>
    </div></td>
  </tr>
</table>
</div>
<%}%>
</fmt:bundle>
</body>
</html>