<%@ codepage ="936" %>
<%charset="gb2312"%>
<%Session.CodePage=936%>
<!--#include file="Admin.asp"-->
<!--#include file="Conn.asp"-->
<!--#include file="../Inc/Ubbcode.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
session("firstin_zn")="yes"
dim ArticleID,rsArticle,FoundErr,ErrMsg
ArticleID=trim(request("ArticleID"))
FoundErr=False
if ArticleID="" then 
	response.Redirect("News_Manage.asp")
end if
sql="select * from conews where ArticleID=" & ArticleID & ""
Set rsArticle= Server.CreateObject("ADODB.Recordset")
rsArticle.open sql,conn,1,1
if FoundErr=True then
	call WriteErrMsg()
else
%>
<%
dim rs
dim sql
dim count
set rs=server.createobject("adodb.recordset")
sql = "select * from NewsSmallClass order by orders desc,SmallClassID asc"
rs.open sql,conn,1,1
%>
<script language = "JavaScript">
var onecount;
subcat = new Array();
        <%
        count = 0
        do while not rs.eof 
        %>
subcat[<%=count%>] = new Array("<%= trim(rs("SmallClassName"))%>","<%= trim(rs("BigClassID"))%>","<%= trim(rs("SmallClassID"))%>");
        <%
        count = count + 1
        rs.movenext
        loop
        rs.close
        %>
onecount=<%=count%>;

function changelocation(locationid)
    {
    document.myform.SmallClassID.length = 1; 
    var locationid=locationid;
    var i;
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            { 
                document.myform.SmallClassID.options[document.myform.SmallClassID.length] = new Option(subcat[i][0], subcat[i][2]);
            }        
        }
    }   

function CheckForm()
{
  if (document.myform.Title.value=="")
  {
    alert("信息标题不能为空！");
	document.myform.Title.focus();
	return false;
  }
  if (editor.getHTML()=="")
  {
    alert("信息内容不能为空！");
	editor.shuziren_editor.focus();
	return false;
  }
  return true;  
}
function loadForm()
{
  editor.shuziren_editor.document.body.innerHTML=document.myform.Content.value;
  return true
}
function InsertImage()
{
	var toph = screen.availHeight/2-90;
	var left = screen.availWidth/2-200;	window.open("insertfile.asp?mode=Article","","width=400,height=130,top="+toph+",left="+left);
}
</script>
<script type="text/javascript" src="inc/color.js"></script>
<script type="text/javascript" src="../inc/rq.js"></script>
<!-- #include file="Inc/Head.asp" -->
<body onLoad="javascipt:setTimeout('loadForm()',1000);">
<div align=center>
<TABLE class=tableBorder1 style="WIDTH: 100%" cellSpacing=0 cellPadding=3 
align=center border=0>
  <TBODY>
  <TR>
    <TD height=20></TD></TR></TBODY></TABLE>
<TABLE class=tableBorder cellSpacing=0 cellPadding=0 width="85%" align=center border=0>
	<tr> 
	  <td height="25" class=forumHeaderBackgroundAlternate>
	    <div align="center"><strong>修 改 频 道 内 容</strong></div>
	  </td>
	</tr>
	  <td align=center class=forumrowHighlight>
      <form method="POST" name="myform" onSubmit="return CheckForm();" action="News_Save.asp?action=Modify">
        <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
          <tr>
            <td height="25" align="center" class="title">　</td>
    </tr>
    <tr align="center">
      <td class="tdbg">
	<table width="100%" border="0" cellpadding="0" cellspacing="2" class=tableBorder_white>
                <tr> 
                  <td width="100" height="22" align="right" bgcolor="#CBDCFD">所属栏目：</td>
                  <td bgcolor="#D2E1FD"> <%
		
        sql = "select * From NewsBigClass order by orders desc,BigClassID asc"
        rs.open sql,conn,1,1
		if rs.eof and rs.bof then
			response.write "请先添加栏目。"
		else
		%>			<select name="BigClassID" onChange="changelocation(document.myform.BigClassID.options[document.myform.BigClassID.selectedIndex].value)" size="1">
                      <%
		    do while not rs.eof
			%>
                      <option <% if rs("BigClassID")=rsArticle("BigClassID") then response.Write("selected") end if%> value="<%=trim(rs("BigClassID"))%>"><%=trim(rs("BigClassName"))%></option>
                      <%
		        rs.movenext
    	    loop
		end if
        rs.close
			%>
                    </select>

				    <select name="SmallClassID">
                      <option value="0" <%if rsArticle("SmallClassID")=0 then response.write "selected"%>>不指定小类</option>
                      <%
			sql="select * from NewsSmallClass where BigClassID=" & rsArticle("BigClassID") & ""
			rs.open sql,conn,1,1
			if not(rs.eof and rs.bof) then
				do while not rs.eof%>
                      <option <% if rs("SmallClassID")=rsArticle("SmallClassID") then response.Write("selected") end if%> value="<%=rs("SmallClassID")%>"><%=rs("SmallClassName")%></option>
                      <%
			    	rs.movenext
				loop
			end if
	        rs.close
			%>
                    </select>
                  </td>
                </tr>
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">标　　题：</td>
                  <td bgcolor="#D2E1FD"> <input name="Title" type="text" id="Title" value="<%=rsArticle("Title")%>" size="50" maxlength="80">&nbsp;<input type="hidden" name="post[style]" id="color_input_1" value="<%=rsArticle("tcolor")%>"/><img src="image/color.gif" width="21" height="18" style="cursor:pointer;background:<%=rsArticle("tcolor")%>" align="absmiddle" id="color_img_1" style="cursor:pointer;background:" alt="选择颜色" title="选择颜色" onclick="color_show(1, document.getElementById('color_input_1').value, this);"/> 
                    <font color="#FF0000">*</font></td>
                </tr>

                </tr>
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">作　　者：</td>
                  <td bgcolor="#D2E1FD"> <input name="admin" type="text" id="admin" value="<%=trim(rsArticle("admin"))%>" size="50" maxlength="255"></td>
                </tr>
                <tr> 
                  <td height="22" align="left" valign="middle" bgcolor="#CBDCFD" colspan="2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;信息内容：</td>
                </tr>
                <tr bgcolor="#D2E1FD"> 
                  <td colspan="2" align="right" valign="middle"> <div align="left"> 
                      <textarea name="Content" style="display:none"><%=confilter(rsArticle("Content"))%></textarea>
					  <iframe id="editor" src="../edit/hy_html/edit.asp?id=Content&source=0" frameborder="0" scrolling="no" width="100%" height="350"></iframe>
                    </div></td>
                </tr>
                <tr> 
                  <td width="100" align="right" bgcolor="#CBDCFD">展示图片： 
                    <input name="IncludePic" type="hidden" id="IncludePic" value="yes"></td>
                  <td bgcolor="#D2E1FD" style="padding-top:3px;"> 
				    <input name="DefaultPicUrl" type="text" id="DefaultPicUrl" value="<%=rsArticle("DefaultPicUrl")%>" size="50" maxlength="200"> 
					&nbsp;<input type=button onClick="InsertImage()" value=" 上传 ">
					<input type="hidden" name="D_changed" value="no">  
                    <br>
                    展示的图片,直接从上传图片中选择： 
                    <select name="DefaultPicList" id="DefaultPicList" onChange="DefaultPicUrl.value=this.value;">
                      <option value=""<%if rsArticle("DefaultPicUrl")="" then response.write " selected" %>>不指定展示图片</option>
                      <%
				if rsArticle("UploadFiles")<>"" then
					dim IsOtherUrl
					IsOtherUrl=True
					if instr(rsArticle("UploadFiles"),"|")>0 then
						dim arrUploadFiles,intTemp
						arrUploadFiles=split(rsArticle("UploadFiles"),"|")						
						for intTemp=0 to ubound(arrUploadFiles)
							if rsArticle("DefaultPicUrl")=arrUploadFiles(intTemp) then
								response.write "<option value='" & arrUploadFiles(intTemp) & "' selected>" & arrUploadFiles(intTemp) & "</option>"
								IsOtherUrl=False
							else
								response.write "<option value='" & arrUploadFiles(intTemp) & "'>" & arrUploadFiles(intTemp) & "</option>"
							end if
						next
					else
						if rsArticle("UploadFiles")=rsArticle("DefaultPicUrl") then
							response.write "<option value='" & rsArticle("UploadFiles") & "' selected>" & rsArticle("UploadFiles") & "</option>"
							IsOtherUrl=False
						else
							response.write "<option value='" & rsArticle("UploadFiles") & "'>" & rsArticle("UploadFiles") & "</option>"		
						end if
					end If
					if IsOtherUrl=True and rsArticle("DefaultPicUrl")<>"" then
						response.write "<option value='" & rsArticle("DefaultPicUrl") & "' selected>" & rsArticle("DefaultPicUrl") & "</option>"
					end if
				end if
				 %>
                    </select> <input name="UploadFiles" type="hidden" id="UploadFiles" value="<%=rsArticle("UploadFiles")%>"> 
                  </td>
                </tr>
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">推荐：</td>
                  <td bgcolor="#D2E1FD"> <input name="Passed" type="checkbox" id="Passed" value="yes" <% if rsArticle("Passed")=true then response.Write("checked") end if%>>
                    是<font color="#0000FF">（首页推荐资讯栏展示）</font></td>
                </tr>
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">图文：</td>
                  <td bgcolor="#D2E1FD"> <input name="Elite" type="checkbox" id="Elite" value="yes" <% if rsArticle("Elite")=true then response.Write("checked") end if%>>
                    是<font color="#0000FF">（首页推荐图文栏展示）</font></td>
                </tr>
                <tr> 
                  <td height="22" align="right" bgcolor="#CBDCFD">录入时间：</td>
                  <td bgcolor="#D2E1FD"> <input name="UpdateTime" type="text" id="UpdateTime" value="<%=now()%>" maxlength="50">
                    当前时间为：<%=now()%> 注意不要改变格式。</td>
                </tr>
              </table>
      </td>
    </tr>
  </table>
  <div align="center">
    <p>
      <input name="ArticleID" type="hidden" id="ArticleID" value="<%=rsArticle("ArticleID")%>">
      <input name="Save" type="submit"  id="Save" value="保存修改结果">&nbsp;&nbsp;
	  <input name="btn01" type="button" onclick="history.go(-1);" value=" 返回 ">
    </p>
  </div>
</form>
	  </td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
</div>
<%
end if
rsArticle.close
set rsArticle=nothing
call CloseConn()
%>