<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="net.sz600.database.*" %>
<%@ page import="java.util.*,java.sql.*" %>
<%@ page import="net.sz600.weboffice.*" %>
<%@ include file="/sessionInfo.jsp"%>
<%
	String mRecordID=request.getParameter("RecordID");
	String mFileName = SzConvert.strWriteData(request.getParameter("FileName"));
	String mDescript = SzConvert.strWriteData(request.getParameter("Descript"));
	String moduleName = SzConvert.strWriteData(request.getParameter("module"));
	String mBDID = SzConvert.toZeroStr(request.getParameter("BDID"));
	String type= SzConvert.toZeroStr(request.getParameter("type"));

	String PrintFilePath = SzConvert.toSpaceStr((String)session.getAttribute("PrintFilePath"));

	if (!PrintFilePath.equals("")) {
		//不做任何动作
		
		session.setAttribute("PrintFilePath", null);
		if (type.equals("2")) {
			response.sendRedirect("../../../share/formEngine2/print/index.jsp?module=" + moduleName);			
		} else {
			response.sendRedirect("../../../xml/formEngine2/print/index.jsp?module=" + moduleName);
		}
	} else {
		//判断模板名称是否存在
		iTemplate template = new iTemplate();
		boolean flag = template.isExist(mFileName, mRecordID);
		if (!flag) {
			template.save(szCOMPANY_SESSION, mFileName, mDescript, mRecordID, mBDID);
			response.sendRedirect("TemplateList.jsp");
		} else {
	    out.println(SzPageHelp.jsAlertBack("模板名称已经存在！"));
		}
	
	}
%>
