<%@ codepage ="936" %>
<%charset="gb2312"%>
<%Session.CodePage=936%>
<!--#include file="Admin.asp"-->
<!--#include file="Conn.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
dim BigClassID,Action,rs,NewBigClassName,OldBigClassName,FoundErr,ErrMsg
BigClassID=trim(Request("BigClassID"))
Action=trim(Request("Action"))
NewBigClassName=trim(Request("NewBigClassName"))

logo=trim(request("logo"))
title=trim(request("title"))
keywords=trim(request("keywords"))
sitedesc=trim(request("sitedesc"))
target=trim(request("target"))
orders=trim(request("orders"))
If orders="" Then orders=0
show=trim(request("show"))
If show="" Then show=0
if BigClassID="" then
  response.Redirect("News_ClassManage.asp")
end if
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open "Select * from NewsBigClass where BigClassID=" & CLng(BigClassID),conn,1,3
if rs.Bof and rs.EOF then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>此频道大类不存在！</li>"
else
	if Action="Modify" Then
	
		if request("changed")="yes" then 
		  sql_del="select logo from links Where id="&id
		  Set rs_del = Server.CreateObject("ADODB.Recordset")
		  rs_del.open sql_del,conn,1,3
		  if Lcase(left(rs_del("logo"),4))<>"http" then
			'***************************************
			'删除无用的上传文件
				dim fso,strRubbishFile
				Set fso = Server.CreateObject("Scripting.FileSystemObject")
				strRubbishFile=server.MapPath(rs_del("logo"))
				if fso.FileExists(strRubbishFile) then
					fso.DeleteFile(strRubbishFile)
				end if
				set fso=nothing
			'结束
			'***************************************
		  end If
		  rs_del.close
		end if


		if NewBigClassName="" then
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>频道大类名不能为空！</li>"
		end if
		if FoundErr<>True then
			rs("BigClassName")=NewBigClassName
			rs("Admin")=Admin
     		rs("logo")=logo
     		rs("title")=title
     		rs("keywords")=keywords
     		rs("sitedesc")=sitedesc
     		rs("target")=target
     		rs("orders")=orders
			rs("show")=show
			rs("html")=0
    	 	rs.update
			rs.Close
	     	set rs=Nothing
			call CloseConn()
     		Response.Redirect "News_ClassManage.asp" 
		end if
	end if
	if FoundErr=True then
		call WriteErrMsg()
	else
%>
<script language="JavaScript" type="text/JavaScript">
function checkBig()
{
  if (document.form1.BigClassName.value=="")
  {
    alert("大类名称不能为空！");
    document.form1.BigClassName.focus();
    return false;
  }
}

function InsertImage()
{
	var toph = screen.availHeight/2-90;
	var left = screen.availWidth/2-200;	window.open("insertfile.asp?Mode=Link","","width=400,height=130,top="+toph+",left="+left);
}
</script>
<!-- #include file="Inc/Head.asp" -->
<div align=center>
<TABLE class=tableBorder1 style="WIDTH: 100%" cellSpacing=0 cellPadding=3 
align=center border=0>
  <TBODY>
  <TR>
    <TD height=50></TD></TR></TBODY></TABLE>
<TABLE class=tableBorder cellSpacing=0 cellPadding=0 width="85%" align=center border=0>
	<tr> 
		<TH align=left height=23 class="tableHeaderText"><div align="center"><font color=white>频 道 类 别 设 置</font></div></TH>
	</tr>
	<tr> 
	  <td height="25" class=forumrow>
		<form name="form1" method="post" action="News_ClassModifyBig.asp">
		<input type="hidden" name="changed" value="no">
        <table width="100%" border="0" align="center" cellpadding="1" cellspacing="2">
          <tr class="title"> 
            <td height="25" colspan="2" align="center" class=forumHeaderBackgroundAlternate><strong>修改大类名称</strong></td>
          </tr>
          <tr> 
            <td width="15%" class=forumRow_shui align="right"><strong>大类ID：</strong></td>
            <td width="85%" bgcolor="#E3E3E3"><%=rs("BigClassID")%> 
              <input name="BigClassID" type="hidden" id="BigClassID" value="<%=rs("BigClassID")%>"></td>
          </tr>
          <tr> 
            <td class=forumRow_shui align="right"><strong>大类名称：</strong></td>
            <td bgcolor="#E3E3E3">
			  <input name="NewBigClassName" type="text" id="NewBigClassName" value="<%=rs("BigClassName")%>" size="30" maxlength="30"></td>
          </tr>


          <tr style="display:none;"> 
            <td class=forumRow_shui height="25" bgcolor="#C0C0C0"> 
              <div align="right"><strong>Logo地址：</strong></div></td>
            <td bgcolor="#E3E3E3"> 
              <input type="text" name="logo" size="30" maxlength="100" value="<%=rs("logo")%>">&nbsp;<input type=button onclick="InsertImage()" value="上 传">　宽313 px : 高76 px
            </td>

          <tr> 
            <td class=forumRow_shui height="25" bgcolor="#C0C0C0"> 
              <div align="right"><strong>页面标题：</strong></div></td>
            <td bgcolor="#E3E3E3"> 
              <input name="title" type="text" size="80" maxlength="250" value="<%=rs("title")%>">
            </td>
          </tr>

          <tr> 
            <td class=forumRow_shui height="25" bgcolor="#C0C0C0"> 
              <div align="right"><strong>页面关键字：</strong></div></td>
            <td bgcolor="#E3E3E3"> 
			  <textarea name="keywords" rows="3" cols="80"><%=rs("keywords")%></textarea>
            </td>
          </tr>

          <tr> 
            <td class=forumRow_shui height="25" bgcolor="#C0C0C0"> 
              <div align="right"><strong>页面描述：</strong></div></td>
            <td bgcolor="#E3E3E3"> 
              <textarea name="sitedesc" rows="3" cols="80"><%=rs("sitedesc")%></textarea>
            </td>
          </tr>

          <tr> 
            <td class=forumRow_shui height="25" bgcolor="#C0C0C0"> 
              <div align="right"><strong>打开方式：</strong></div></td>
            <td bgcolor="#E3E3E3"> 
              <input name="target" type="radio" value="0"<%If rs("target")=0 Then response.write " checked"%>>本窗口   <input name="target" type="radio" value="1"<%If rs("target")=1 Then response.write " checked"%>>新窗口
            </td>
          </tr>

          <tr> 
            <td class=forumRow_shui height="25" bgcolor="#C0C0C0"> 
              <div align="right"><strong>排序值：</strong></div></td>
            <td bgcolor="#E3E3E3"> 
              <input name="orders" type="text" size="5" maxlength="5" value="<%=rs("orders")%>">
            </td>
          </tr>

          <tr style="display:none;"> 
            <td class=forumRow_shui height="25" bgcolor="#C0C0C0"> 
              <div align="right"><strong>首页推荐值：</strong></div></td>
            <td bgcolor="#E3E3E3"> 
              <input name="show" type="text" size="5" maxlength="5" value="<%=rs("show")%>">　　<font color=#777777>(说明：值越大越靠前显示，最多显示4个)</font>
            </td>
          </tr>

          <tr> 
            <td align="center" class=forumRow_shui>&nbsp;</td>
            <td align="center" bgcolor="#E3E3E3">
			  <div align="left">
                <input name="Action" type="hidden" id="Action" value="Modify">
                <input name="Save" type="submit" id="Save" value=" 修 改 ">
				&nbsp;&nbsp;&nbsp;
				<input name="back" type="button" id="back" value=" 返 回 " onclick="history.go(-1);">
              </div></td>
          </tr>
        </table> 
  </form>	
   </td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->
</div>
<%
	end if
end if
rs.close
set rs=nothing
call CloseConn()
%>
