<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="gbase.html.HtmlGenerater,gbase.init.*,gbase.db.*,java.sql.*"%>
<%@ include file="../checkLogin.jsp" %>
<%
	
	String message="操作失败";
	String id=request.getParameter("id")==null?"":request.getParameter("id");
        String url="barmenu_modify.jsp?id="+id;
        boolean flag=false;
        String name=request.getParameter("name")==null?"":request.getParameter("name");
        String menu_type=request.getParameter("menu_type")==null?"0":request.getParameter("menu_type");
        String content_type=request.getParameter("content_type")==null?"0":request.getParameter("content_type");
        String web_template_id=request.getParameter("web_template_id")==null?"0":request.getParameter("web_template_id");
        String web_template_id2=request.getParameter("web_template_id2")==null?"0":request.getParameter("web_template_id2");
        if(web_template_id2.equals(""))web_template_id2="0";
        try {
        WebConfig theWebConfig=new WebConfig();
        WebInfo webInfo=theWebConfig.getWebInfo(web_account);
        String web_name=webInfo.getWeb_name();
        
        DBOperation theDBOperation=new DBOperation();
        String sql ="";
        ResultSet rs=null;
        if(content_type.equals("2"))
          sql= "select * from web_titleinfo where bar_id="+id;
        else if(content_type.equals("3"))
          sql= "select * from web_imageinfo where bar_id="+id+"";
        rs =theDBOperation.getResultSet(sql);
        while(rs.next())
        {
          String web_title=rs.getString("title")+" ("+web_name+":"+name+")";
          String httpUrl=cms_url+web_account+"/template/"+web_template_id2+".jsp?bar_id="+id+"&content_id="+rs.getString("id")+"&web_account="+web_account+"&bar_name="+name+"&web_title="+web_title;
          String htmlFilePath="/"+id;
          String htmlFileName="content"+rs.getString("id")+".html";
          HtmlGenerater theHtmlGenerater=new HtmlGenerater();
          flag=theHtmlGenerater.geneHtmlFile(web_account,httpUrl,htmlFilePath,htmlFileName); 
        }
        
      if(flag)
          message = "操作成功!";
        else
          message = "操作失败!";
      }
      catch (Exception ex) {
        message = "操作失败!";
      }
	
%>
<script language="javascript">
	function process ( message,url){
		alert(message);
		self.location = url;
		window.parent.detail_left.location="left.jsp?id=<%=id%>";
	}
</script>
<html>
	<head>
		<title></title>
	</head>
	<body onload="javascript: process('<%=message%>','<%=url%>');">
	</body>
</html>