<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file = "tuzh_pri.asp"-->
<!--#include file = "../setup.asp"-->
<!--#include file="../connadmin.asp"-->
<!-- #INCLUDE file="FCKeditor/FCKeditor.asp" -->
<%if request.QueryString("action")="modi" and trim(request.QueryString("id"))<>"" then
	dim modi
	modi="y"
		set rsok=server.createobject("adodb.recordset")
		sqlok="select * from news where id="&cint(trim(request.QueryString("id")))
		rsok.open sqlok,conn,1,1
		doid=rsok("id")
		title= rsok("title")
		content= rsok("content")
		yiid= rsok("yiid")
		erid= rsok("erid")
		shoupic= trim(rsok("shoupic"))
		rsok.close
		set rsok=nothing
end if%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../img/css.css"><title></title>
<title>无标题文档</title>
<SCRIPT language=JavaScript>
function checklogin() {
	if (document.form1.langmu.value=="") {
		alert("请选择一级栏目!");
		form1.langmu.focus();
		return false;
	}
	if (document.form1.langmu2.value=="") {
		alert("请选择二级栏目!");
		form1.langmu2.focus();
		return false;
	}
	if (document.form1.txttitle.value=="") {
		alert("请输入标题!");
		form1.txttitle.focus();
		return false;
	}
	return true;
}
</SCRIPT>
<Script Language=JavaScript>
function doChange(objText, objDrop){
	if (!objDrop) return;
	var str = objText.value;
	var arr = str.split("|");
	objDrop.length=0;
	
	for (var i=0; i<arr.length; i++)
	{
		objDrop.options[i] = new Option(arr[i], arr[i]);
	}
}
function doChangepic(objText, objDrop, dopic){
	if (!objDrop) return;
	var str = objText.value;
	var pic,pkpic;
	var arr = str.split("|");
	objDrop.length=0;
	for (var i=0; i<arr.length; i++)
	{
		objDrop.options[i] = new Option(arr[i], arr[i]);
	    pic=arr[i];
	}
	if(dopic.value==""){
	okpic="uploadfile/image/";
	okpic+=pic;
	dopic.value=okpic;
	document.getElementById("picimg").src="../"+okpic;
	}
}
function doch(dd,hh){
var strin;
strin="uploadfile/image/";
strin+=dd.value;
hh.value=strin;
	document.getElementById("picimg").src="../"+strin;

}   

</Script>
<style type=text/css>
body  {
SCROLLBAR-FACE-COLOR: #9CC5D7;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; 
SCROLLBAR-SHADOW-COLOR: #006699; 
SCROLLBAR-3DLIGHT-COLOR: #006699; 
SCROLLBAR-ARROW-COLOR: #330000; 
SCROLLBAR-TRACK-COLOR: #E2F3F1; 
SCROLLBAR-DARKSHADOW-COLOR: #ffffff;}
</style>
</head>
<%	set rs=server.createobject("adodb.recordset")
	sql="select * from yikind order by yiorder"
	rs.open sql,conn,1,1
	dim lm1
	lm1=""
	do while not rs.eof
			if modi="y" and yiid=rs("yiid") then
				lm1=lm1&"<option value='" &  rs("yiid") &  "' selected>" & rs("yiname")&"</option>"
			else
				lm1=lm1&"<option value='" &  rs("yiid") &  "'>" & rs("yiname")&"</option>"
			end if
		'	lm1=lm1&"<option value='"&rs("yiid")&"'>"&rs("yiname")&"</option>"
	rs.movenext
	loop
	rs.close
	set rs=nothing
'*********************************************************************
if request.QueryString("action")="modi" and trim(request.QueryString("id"))<>"" then
	set rs=server.createobject("adodb.recordset")
	sql="select * from erkind where yiid="&yiid&" order by erorder desc"
	rs.open sql,conn,1,1
	dim lm2
	lm2=""
	do while not rs.eof
			if modi="y" and erid=rs("erid") then
				lm2=lm2&"<option value='" &  rs("erid") &  "' selected>" & rs("ername")&"</option>"
			else
				lm2=lm2&"<option value='" &  rs("erid") &  "'>" & rs("ername")&"</option>"
			end if
		'	lm1=lm1&"<option value='"&rs("yiid")&"'>"&rs("yiname")&"</option>"
	rs.movenext
	loop
	rs.close
	set rs=nothing
end if

'*********************************************************************
set rs=server.createobject("adodb.recordset")
sql="select erid,yiid,ername from erkind"
rs.open sql,conn,3,1%>

<script language = "JavaScript">
var lmcount;
lm=new Array();
<%count=0
do while not rs.eof
%>
lm[<%=count%>]=new Array("<%= trim(rs(2))%>","<%= trim(rs(1))%>","<%= trim(rs(0))%>");
<%
count=count+1
rs.movenext
loop
rs.close
%>
lmcount=<%=count%>;
function changelangmu1(langmu1){
document.form1.langmu2.length=1; 
var langmu1=langmu1;
var i;

for (i=0;i<lmcount; i++){
if (lm[i][1]==langmu1){ 
document.form1.langmu2.options[document.form1.langmu2.length]=new Option(lm[i][0], lm[i][2]);
}        
}

} 
</script>
<%conn.close
set conn=nothing%>
<body>
<table class="border" width="98%" border="0" align="center" cellpadding="1" cellspacing="0">
  <tr> 
    <td height="447" align="center" valign="top" class="bg_low"> <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td align="center" valign="middle" class="bgtop"><font color="#FFFFFF"><b>添加/修改新闻</b></font> 
          </td>
        </tr>
      </table>
      <form name="form1" method="post"  onSubmit="return checklogin()" action="do.asp?newsid=<%=doid%>">
        <table width="98%" border="1" cellpadding="3" cellspacing="0" bordercolor="#ABCEDD">
          <tr> 
            <td width="100" align="right">选择新闻类别 <font class="xing">*</font></td>
            <td valign="top"> <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1">
                <tr> 
                  <td align="center" height="20"> <select size="1" name="langmu" onChange="changelangmu1(document.form1.langmu.value)">
                      <option value="" selected>请选择一级栏目</option>
                      <%=lm1%> </select> &nbsp; </td>
                  <td align="center" height="20"> &nbsp; <select size="1" name="langmu2">
                      <option selected value="">请选择二级栏目</option>
                    <%=lm2%></select></td>
                </tr>
              </table></td>
          </tr>
          <tr> 
            <td width="100" align="right">标题 <font class="xing">*</font></td>
            <td><input name="txttitle" type="text" id="txttitle2" size="50" maxlength="60" value="<%if modi="y" then response.Write(title) end if%>"></td>
          </tr>
          <tr> 
            <td width="100" align="right" valign="top">内容 <font class="xing">*</font></td>
            <td> 
			
			<%
 Dim oFCKeditor
 Set oFCKeditor = New FCKeditor
 oFCKeditor.BasePath = "fckeditor/"
 oFCKeditor.ToolbarSet = "Default"
 oFCKeditor.Width = "100%"
 oFCKeditor.Height = "400"
 if modi="y" then
 oFCKeditor.Value = content
 else
 oFCKeditor.Value =""
 end if
 oFCKeditor.Create "content"
%>
             
            </td>
          </tr>
          <tr> 
            <td width="100" align="right">首页图片地址</td>
            <td>
		
			<input name="shoupic" type="text" id="shoupic" value="<%if modi="y" then response.Write(shoupic) end if%>" size="40" maxlength="50">
				<div style=" WIDTH: 0px; POSITION: absolute; HEIGHT: 0px">
				<div style="position:relative; left:0px; top:0px; z-index:1; background-color: #996600; layer-background-color: #996600; border: 1px solid #cccccc; visibility: visible;"> 
                  <img name="picimg" src=<%if modi="y" and shoupic<>"" then response.Write("../"&shoupic) else response.Write "../img/nopic.gif" end if%> id="picimg" width="100" height="100"></div>
				</div>
			</td>
          </tr>
		  
		  
		     <tr> 
            <td width="100" align="right">上传首页图片</td>
            <td>
			<iframe style="top:2px" ID="UploadFiles" src="../upload_Photo.asp?PhotoUrlID=2" frameborder=0 scrolling=no width="249" height="19"></iframe>
			
			</td>
          </tr>
          <tr> 
            <td width="100" align="right">请选择首页图片</td>
            <td><input name="myText2" value="" type="hidden" id="myText2"  style="width:200px" onChange="doChangepic(this,myDrop2,shoupic)"> 
              <select name="myDrop2" size=1 id="myDrop2" style="width:200px" onChange="doch(this,shoupic)">
              </select></td>
          </tr>
          <tr> 
            <td width="100">&nbsp;</td>
            <td><input type="hidden" name="action" value="<%if modi="y" then response.Write("modi") else response.Write("addnews") end if%>"> <input type="submit" name="Submit" value="提交"> 
              <input type="reset" name="Submit2" value="重置"></td>
          </tr>
        </table>
      </form> </td>
  </tr>
</table>
</body>
</html>
