<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="java.sql.*,gbase.db.*,gbase.util.*" %>
<%@ include file="../checkLogin.jsp" %>
<SCRIPT language="JavaScript" src="../js/util.js"></SCRIPT>
<LINK href="../css/css.css" rel=stylesheet>
<html>
<head>
<title>
模板管理
</title>
</head>
<%
//由于新服务器不支持本机访问,特设cms_url
cms_url="http://www.it3838.com/";
String id=request.getParameter("id")==null?"":request.getParameter("id");
String flag=request.getParameter("flag")==null?"":request.getParameter("flag");

DBOperation theDBOperation = new DBOperation();
String test_desc="";
String content="";
String file_name="";
String sql = "select a.*,b.file_name from web_template a,web_template_type b where a.web_template_type_id=b.id and a.id="+id+" and a.web_account='"+web_account+"'";
ResultSet rs =theDBOperation.getResultSet(sql);
if(rs.next())
{
test_desc=rs.getString("test_desc")==null?"":rs.getString("test_desc");
content=rs.getString("content")==null?"":rs.getString("content");
file_name=rs.getString("file_name")==null?"":rs.getString("file_name");
}

ContentToFile theContentToFile=new ContentToFile();
content=content.replaceAll("/my_cms_images/","/"+web_account+"/my_cms_images/");
theContentToFile.geneTemplateFile(web_account,content,"/template",id+".jsp");
String httpUrl=cms_url+web_account+"/template/"+id+".jsp?";
%>

<body leftmargin="0" topmargin="0">

<!--导航-->
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
		<td width="100%" height="20"  bgcolor="#eeeeee" class="p2">您当前所在的位置>>模板管理</td>
	   </tr>
       <tr>
          <td width="100%" height="2"> <img border="0" src="../images/spacer.gif" width="1" height="3"></td>
       </tr>
    </table>
<!--标题-->
  <div align="center">
   <table border="0" width="100%" cellspacing="0" cellpadding="0" height="34">
	<tr>
		<td width="159" background="../images/back_board2.gif" nowrap valign="bottom"><span class="title01">&nbsp;<span class="style1">模板自测</span></span></td>
		<td valign="bottom" align="right" width="642"></td>
	</tr>
	<tr>
		<td bgcolor="#2C9CC4" colspan="2"><img border="0" src="../images/bline_3.gif" width="1" height="2"></td>
	</tr>
</table>
</div><br>
<form name="main" method="post" action="">
<div align="center">
<table width="90%" class="p1" border="0" cellSpacing="1" cellPadding="3" align="center" bgColor="#cccccc">
        <tr>
		<td align="right"  bgColor=#e9f0f4 width=11%">模板参数：</td>
		<td onmouseover='vbscript:me.bgcolor="#F5F5F5"'	onmouseout='vbscript:me.bgcolor="#FFFFFF"' bgColor=#ffffff>&nbsp;
	            <input name="label_para" type="text" size="100" maxlength="500" value="<%=test_desc%>">&nbsp;
	            
                </td>
	</tr>
</table>

<table border="0" cellpadding="3" class="p1" width="90%" bordercolor="#D7D7D7" style="border-collapse: collapse" cellspacing="0">
	<tr>
		
		<td  height="0" align="center">
		        <input border="0" type="button" value="测  试" onclick = "check_validate(this.form,'<%=httpUrl%>','<%=web_account%>')">
		        &nbsp;&nbsp;&nbsp;&nbsp;<input border="0" type="button" value="重  填" onclick = "document.main.reset();">
		        &nbsp;&nbsp;&nbsp;&nbsp;<input border="0" type="button" value="返  回" onclick = "javascript:history.back();">
		</td>
	</tr>
</table>
</div>
</form>
</body>
<Script Language="javaScript">
    function  checkmystring(str){   
      var myReg=/^[a-zA-Z0-9_-]{1,50}$/;
      if(myReg.exec(str))
      {return true;}
      else{     
      return false;
      }   
    }   
    function  check_validate(theForm,http_url,web_account) {
        var new_http_url=http_url+'web_account='+web_account+'&'+theForm.label_para.value;
        window.open(new_http_url,'');
    }
    
</Script>
</html>
