<%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*,com.jspsmart.upload.*" errorPage="" %>
<%@ page import="java.sql.*"%> 
<%@ page import="java.util.Date"%>
<%@ page import="java.text.*"%>
<%@ include file="checkbbsuser.jsp"%>
<%@ include file="../inc/conn.jsp"%>
<%!String str,sql,strsql,title,remenu,bbs_img_text,picture,zhiye,admintobz,postuser;%>
<%
 String post=request.getParameter("postnum");
 String pid=request.getParameter("id");
 postuser=request.getParameter("postuser");
 String reid=request.getParameter("reid");
 String bbsname=(String)session.getAttribute("name");
 //String str,sql,strsql,title,remenu,bbs_img_text,picture,zhiye;
 int j;
 ResultSet rs,rs1,rs2,rs3,rsr;
 sql="select top 1 BBS_Cate.BBS_Cate_Manager_Name from BBS_Cate,bbstitle where BBS_Cate.BBS_Cate_ID = bbstitle.BoardID_2 and bbstitle.id="+pid;
 Statement stmt4=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
 rs3=stmt4.executeQuery(sql);
 if(rs3.next()){
 String myname=rs3.getString("BBS_Cate_Manager_Name");
 if(myname.indexOf(bbsname)!=-1){
   admintobz="1";
   }
   else{
   admintobz="0";
   }
 }

if(reid!=null){
   str="select * from bbsmenu where id="+reid;
   rs=stmt.executeQuery(str);
   if(rs.next()){
   remenu=rs.getString("remenu");
   bbs_img_text=rs.getString("bbs_img_text");
   postuser=rs.getString("rename");
   }
}
else{
   str="select * from bbstitle where id="+pid;
   Statement stmt1=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
   rs1=stmt1.executeQuery(str);
   if(rs1.next()){
   title=rs1.getString("title");
   remenu=rs1.getString("menu");
   bbs_img_text=rs1.getString("bbs_img_text");
   picture=rs1.getString("picture");
   zhiye=rs1.getString("zhiye");
   postuser=rs1.getString("name");
   }
}

if (session.getAttribute("bz").equals("1") || session.getAttribute("name").equals(postuser) || admintobz.equals("1")){
}
else{
  out.print("<script language='javascript'>");
  out.print("alert('对不起，你不能修改别人的贴子！');");
  out.print("history.go(-1);");
  out.print("</script>");
  out.close();
}		
%>
<link href="../css/xmwuye.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
<!--
	function check(form)
		{
		//if (form.BoardID_1.value=="")
			//{
			//alert("请选择主论坛！");
			//form.BoardID_1.focus();
			//return false;
			//}
		//if (form.BoardID_2.value=="")
			//{
			//alert("请选择分论坛！");
			//form.BoardID_2.focus();
			//return false;
			//}			
		if (form.title.value=="")
			{
			alert("请填写主题！");
			form.title.focus();
			return false;
			}
			return true;
		}
//-->
</script>
<body leftmargin="0" topmargin="2">
<form name="myform" method="post" ENCTYPE="multipart/form-data" action="editpostact.jsp" <%//if (reid==null){%> onsubmit="return CheckForm(this)" <%//}%> style="MARGIN-BOTTOM: 0px">
  <table border="0" width="99%" align="center" cellpadding="2" cellspacing="1" bgcolor="#A4B6D7">
    <tr> 
      <td width="100%" height="25" class="font10_5" background="../images/bbs_bg1.gif"> 
        <div align="center"><b>论 坛 话 题 编 辑 </b></div>
      </td>
  </tr>
</table>
  <table width="99%" border="0" cellspacing="1" cellpadding="2" align="center" bgcolor="#A4B6D7">
<script LANGUAGE="javascript">
<!--

//选择楼盘地区分类
var onecount;
onecount=0;
var j;
  
subcat = new Array();
<%
strsql="select BBS_Cate_ID,BBS_Cate_PID,BBS_Cate_Name,Initial from BBS_Cate where BBS_Cate_PID<>'0' and deleted=0  order by Initial asc";
Statement stmt2=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
rsr=stmt2.executeQuery(strsql);

j=0;
while(rsr.next()){
%>
subcat[<%=j%>] = new Array("<%=rsr.getString("BBS_Cate_Name")%>","<%=rsr.getString("BBS_Cate_PID")%>","<%=rsr.getString("BBS_Cate_ID")%>");
<%
j=j+1;
}
%>

onecount=<%=j%>;

function changelocation(locationid)
    {
    document.myform.BoardID_2.length = 0; 

    var locationid=locationid;
    var i;
    document.myform.BoardID_2.options[0] = new Option('==请选择==','');
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
            document.myform.BoardID_2.options[document.myform.BoardID_2.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
        
    }    

//-->
</script>
<%if (reid==null){%>
    <%if (session.getAttribute("bz").equals("1") || session.getAttribute("name").equals(postuser) || admintobz.equals("1")){%>
     <TR bgcolor="#F2F8FF"> 
      <TD width="16%"> 
        <div align="right">主论坛：</div>
      </TD>
      <TD width="84%"> 
        <SELECT NAME="BoardID_1" onChange="changelocation(document.myform.BoardID_1.options[document.myform.BoardID_1.selectedIndex].value)">
          <option value="">==请选择==</option>
<%
str="select BBS_Cate_ID,BBS_Cate_Name from BBS_CATE Where BBS_Cate_PID='0' and deleted=0 order by BBS_ID asc";
Statement stmt3=conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs2=stmt3.executeQuery(str);
while(rs2.next()){
%>
          <option value="<%=rs2.getString("BBS_Cate_ID")%>"><%=rs2.getString("BBS_Cate_Name")%></option>
<%
}
%>
        </SELECT>
      </TD>
    </TR>
    <TR bgcolor="#F2F8FF"> 
      <TD width="16%"> 
        <div align="right">分论坛：</div>
      </TD>
      <TD width="84%"> 
        <SELECT NAME="BoardID_2">
          <option value="">==请选择==</option>
        </SELECT>
      </TD>
    </TR>
<%}%>
    <TR bgcolor="#F2F8FF"> 
      <TD width="16%"> 
        <div align="right">主　题：</div>
      </TD>
      <TD width="84%">
	    <%if(reid==null){%>
	    <select name="zhiye" id="zhiye" style="width:50px">
          <option value="1" <%if (zhiye.equals("1") || zhiye.equals("0")){%>selected<%}%>>原创</option>
          <option value="2" <%if (zhiye.equals("2")){%>selected<%}%>>转载</option>
        </select>
	    <%}%>
        <input name="title" type="text" value="<%=title%>" size="60" >
      </TD>
    </TR>
<%}%>
    <TR bgcolor="#F2F8FF"> 
      <TD width="16%"> 
        <div align="right">内　容：</div>
      </TD>
      <TD width="84%" height="300"> 
        <TEXTAREA type="hidden" rows=1 cols=1 name="menu" style="position:absolute;left:0;visibility:hidden;"><%=remenu%></textarea> 
        <SCRIPT src="../htmledit/wbTextBox/htmledit.js"></SCRIPT>
      </TD>
    </TR>
	<%if(reid==null){%>
    <TR bgcolor="#F2F8FF"> 
      <TD width="16%"> 
        <div align="right">表　情：</div>
      </TD>
      <TD width="84%"> 
        <input type=radio name=ticon value=0.gif <%if (picture.equals("0.gif")){%>checked<%}%>>
        <img src=../images/0.gif width=19 height=19 > 
		<input type=radio name=ticon value=1.gif <%if (picture.equals("1.gif")){%>checked<%}%>>
        <img src=../images/1.gif width=19 height=19 > 
		<input type=radio name=ticon value=2.gif <%if (picture.equals("2.gif")){%>checked<%}%>>
        <img src=../images/2.gif width=19 height=19> 
		<input type=radio name=ticon value=3.gif <%if (picture.equals("3.gif")){%>checked<%}%>>
        <img src=../images/3.gif width=19 height=19> 
		<input type=radio name=ticon value=4.gif <%if (picture.equals("4.gif")){%>checked<%}%>>
        <img src=../images/4.gif width=19 height=19> 
		<input type=radio name=ticon value=5.gif <%if (picture.equals("5.gif")){%>checked<%}%>>
        <img src=../images/5.gif width=19 height=19> 
		<input type=radio name=ticon value=6.gif <%if (picture.equals("6.gif")){%>checked<%}%>>
        <img src=../images/6.gif width=19 height=19> 
		<input type=radio name=ticon value=7.gif <%if (picture.equals("7.gif")){%>checked<%}%>>
        <img src=../images/7.gif width=19 height=19>
        <input type=radio name=ticon value=8.gif <%if (picture.equals("8.gif")){%>checked<%}%>>
        <img src=../images/8.gif width=19 height=19> <br>
        <input type=radio name=ticon value=9.gif <%if (picture.equals("9.gif")){%>checked<%}%>>
        <img src=../images/9.gif width=19 height=19> 
		<input type=radio name=ticon value=10.gif <%if (picture.equals("10.gif")){%>checked<%}%>>
        <img src=../images/10.gif width=19 height=19> 
        <input type=radio name=ticon value=11.gif <%if (picture.equals("11.gif")){%>checked<%}%>>
        <img src=../images/11.gif width=19 height=19> 
        <input type=radio name=ticon value=12.gif <%if (picture.equals("12.gif")){%>checked<%}%>>
        <img src=../images/12.gif width=19 height=19> 
        <input type=radio name=ticon value=13.gif <%if (picture.equals("13.gif")){%>checked<%}%>>
        <img src=../images/13.gif width=19 height=19> 
        <input type=radio name=ticon value=14.gif <%if (picture.equals("14.gif")){%>checked<%}%>>
        <img src=../images/14.gif width=19 height=19> 
        <input type=radio name=ticon value=15.gif <%if (picture.equals("15.gif")){%>checked<%}%>>
        <img src=../images/15.gif width=19 height=19> 
        <input type=radio name=ticon value=16.gif <%if (picture.equals("16.gif")){%>checked<%}%>>
        <img src=../images/16.gif width=19 height=19> 
        <input type=radio name=ticon value=17.gif <%if (picture.equals("17.gif")){%>checked<%}%>>
        <img src=../images/17.gif width=19 height=19> <br>
        <input type=radio name=ticon value=18.gif <%if (picture.equals("18.gif")){%>checked<%}%>>
        <img src=../images/18.gif width=19 height=19> 
        <input type=radio name=ticon value=19.gif <%if (picture.equals("19.gif")){%>checked<%}%>>
        <img src=../images/19.gif width=19 height=19> 
        <input type=radio name=ticon value=20.gif <%if (picture.equals("20.gif")){%>checked<%}%>>
        <img src=../images/20.gif width=19 height=19> 
        <input type=radio name=ticon value=21.gif <%if (picture.equals("21.gif")){%>checked<%}%>>
        <img src=../images/21.gif width=19 height=19> 
        <input type=radio name=ticon value=22.gif <%if (picture.equals("22.gif")){%>checked<%}%>>
        <img src=../images/22.gif width=19 height=19> 
        <input type=radio name=ticon value=23.gif <%if (picture.equals("23.gif")){%>checked<%}%>>
        <img src=../images/23.gif width=19 height=19> 
        <input type=radio name=ticon value=24.gif <%if (picture.equals("24.gif")){%>checked<%}%>>
        <img src=../images/24.gif width=19 height=19> 
        <input type=radio name=ticon value=25.gif <%if (picture.equals("25.gif")){%>checked<%}%>>
        <img src=../images/25.gif width=19 height=19> 
        <input type=radio name=ticon value=26.gif <%if (picture.equals("26.gif")){%>checked<%}%>>
        <img src=../images/26.gif width=19 height=19> <br>
        <input type=radio name=ticon value=27.gif <%if (picture.equals("27.gif")){%>checked<%}%>>
        <img src=../images/27.gif width=19 height=19> 
        <input type=radio name=ticon value=28.gif <%if (picture.equals("28.gif")){%>checked<%}%>>
        <img src=../images/28.gif width=19 height=19> 
        <input type=radio name=ticon value=29.gif <%if (picture.equals("29.gif")){%>checked<%}%>>
        <img src=../images/29.gif width=19 height=19> 
        <input type=radio name=ticon value=30.gif <%if (picture.equals("30.gif")){%>checked<%}%>>
        <img src=../images/30.gif width=19 height=19> 
        <input type=radio name=ticon value=31.gif <%if (picture.equals("31.gif")){%>checked<%}%>>
        <img src=../images/31.gif width=19 height=19> 
        <input type=radio name=ticon value=32.gif <%if (picture.equals("32.gif")){%>checked<%}%>>
        <img src=../images/32.gif width=19 height=19> 
        <input type=radio name=ticon value=33.gif <%if (picture.equals("33.gif")){%>checked<%}%>>
        <img src=../images/33.gif width=19 height=19> 
        <input type=radio name=ticon value=34.gif <%if (picture.equals("34.gif")){%>checked<%}%>>
        <img src=../images/34.gif width=19 height=19> 
        <input type=radio name=ticon value=35.gif <%if (picture.equals("35.gif")){%>checked<%}%>>
        <img src=../images/35.gif width=19 height=19> <br>
        <input type=radio name=ticon value=36.gif <%if (picture.equals("36.gif")){%>checked<%}%>>
        <img src=../images/36.gif width=19 height=19> 
        <input type=radio name=ticon value=37.gif <%if (picture.equals("37.gif")){%>checked<%}%>>
        <img src=../images/37.gif width=19 height=19> 
        <input type=radio name=ticon value=38.gif <%if (picture.equals("38.gif")){%>checked<%}%>>
        <img src=../images/38.gif width=19 height=19> 
        <input type=radio name=ticon value=39.gif <%if (picture.equals("39.gif")){%>checked<%}%>>
        <img src=../images/39.gif width=19 height=19> 
        <input type=radio name=ticon value=40.gif <%if (picture.equals("40.gif")){%>checked<%}%>>
        <img src=../images/40.gif width=19 height=19> 
        <input type=radio name=ticon value=41.gif <%if (picture.equals("41.gif")){%>checked<%}%>>
        <img src=../images/41.gif width=19 height=19> 
        <input type=radio name=ticon value=42.gif <%if (picture.equals("42.gif")){%>checked<%}%>>
        <img src=../images/42.gif width=19 height=19> 
        <input type=radio name=ticon value=43.gif <%if (picture.equals("43.gif")){%>checked<%}%>>
        <img src=../images/43.gif width=19 height=19> <font color="#FF0000"> 
        <input type=radio name=ticon value=44.gif <%if (picture.equals("44.gif")){%>checked<%}%>>
        <img src="../images/44.gif" width="17" height="16"></font> 
        <!--<input type="text" name="tel" size="20" maxlength="20">-->
      </TD>
    </TR>
	<%}%>
    <TR bgcolor="#F2F8FF"> 
      <TD width="16%"> 
        <div align="right">图　片：</div>
      </TD>
      <TD width="84%"> 
        <input TYPE="file" NAME="bbs_img">
        <FONT  COLOR="#990000">(允许上传gif,jpg类型的图片)</FONT></TD>
    </TR>
    <TR bgcolor="#F2F8FF"> 
      <TD width="16%"> 
        <div align="right">图片说明：</div>
      </TD>
      <TD width="84%"> 
        <input NAME="bbs_img_text" TYPE="text" value="<%=bbs_img_text%>" size="60" maxlength="100">
      </TD>
    </TR>
	<!--
    <TR bgcolor="#F2F8FF"> 
      <TD width="22%"></TD>
      <TD width="78%" height="25">&nbsp;<FONT  COLOR="#990000">说明：您上传的图片需经过网站的审核通过后，才能在论坛显示。</FONT></TD>
    </TR>
	-->
    <TR bgcolor="#F2F8FF"> 
      <TD height="35" colspan=2 align=center>
	    <INPUT TYPE="hidden" name="postuser" value="<%=postuser%>"> 
        <INPUT TYPE="hidden" name="id" value="<%=pid%>">
		<%if(reid!=null){%>
        <INPUT TYPE="hidden" name="reid" value="<%=reid%>">
		<%}%>		
        <input type="submit" value="修改话题" name="submit1">
        &nbsp; 
        <input type="reset" value="全部重写" name="B2"> 
      </TD>
    </TR>
  </TABLE>
</form>
<script language="JavaScript" src="../inc/bbstail.js"></script>
</body>
</html>