<%@language=vbscript codepage=936 %>
<!--#include file="../../Inc/conn.asp"-->
<!--#include file="../admin.asp"-->
<!-- #include file="../Inc/Head.asp" -->
<%
dim SmallClassID,Action,BigClassName, SmallClassName, OldSmallClassName,rs,FoundErr,ErrMsg
SmallClassID=strToNum(Request("SmallClassID"))
Action=ChkFormStr(Request("Action"))
BigClassName=ChkFormStr(Request.form("BigClassName"))
SmallClassName=ChkFormStr(Request.form("SmallClassName"))
OldSmallClassName=ChkFormStr(request.form("OldSmallClassName"))
OrderID=strToNum(request("OrderID"))
IsShow=strToNum(request("IsShow"))

if SmallClassID=0 then
	response.Redirect("News_ClassManage.asp")
end if
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open "Select * from SmallClass_New where SmallClassID="&SmallClassID&"",conn,1,3
if rs.Bof or rs.EOF then
	FoundErr=True
	ErrMsg=ErrMsg & "<br><li>此文章小类不存在！</li>"
else
	if Action="Modify" then
		if SmallClassName="" then
			FoundErr=True
			ErrMsg=ErrMsg & "<br><li>文章小类名不能为空！</li>"
		end if
		if FoundErr<>True then
			rs("SmallClassName")=SmallClassName
			rs("OrderID")=OrderID
			if IsShow=1 Then
				rs("IsShow")=true
			else
				rs("IsShow")=false
			end if
     		rs.update
			rs.Close
    	 	set rs=Nothing
			if SmallClassName<>OldSmallClassName then
				conn.execute "Update News set SmallClassName='" & SmallClassName & "' where BigClassName='" & BigClassName & "' and SmallClass=" & SmallClassID & ""
	     	end if	
			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 checkSmall()
{
  if (document.ModiForm.SmallClassName.value=="")
  {
    alert("小栏目名称不能为空！");
	document.ModiForm.SmallClassName.focus();
	return false;
  }
}
</script>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="top">
      <form name="ModiForm" method="post" action="News_ClassModifySmall.asp"  onSubmit="return checkSmall();">
  <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="table_southidc">
    <tr bgcolor="#A4B6D7" class="title">
              <td height="25" colspan="2" align="center"><strong>修改小类名称</strong></td>
            </tr>
            <tr class="tdbg">
              <td width="34%" height="22" align="right" class="tr_southidc"><strong>所属大类：</strong></td>
              <td width="66%" align="left" class="tr_southidc"><%=rs("BigClassName")%>
                  <input name="SmallClassID" type="hidden" id="SmallClassID" value="<%=rs("SmallClassID")%>">
                  <input name="OldSmallClassName" type="hidden" id="OldSmallClassName" value="<%=rs("SmallClassName")%>">
                  <input name="BigClassName" type="hidden" id="BigClassName" value="<%=rs("BigClassName")%>"></td>
            </tr>
            <tr class="tdbg">
              <td height="22" align="right" class="tr_southidc"><strong>小类名称：</strong></td>
              <td align="left" class="tr_southidc"><input name="SmallClassName" type="text" id="SmallClassName" value="<%=rs("SmallClassName")%>" size="20" maxlength="30"></td>
            </tr>
            <tr bgcolor="#C0C0C0" class="tdbg">
              <td height="22" align="right" class="tr_southidc"><strong>排列顺序：</strong></td>
              <td height="22" align="left" class="tr_southidc"><input name="OrderID" type="text" id="OrderID" value="<%=rs("OrderID")%>" size="5"></td>
            </tr>
            <tr bgcolor="#C0C0C0" class="tdbg">
              <td height="22" align="right" class="tr_southidc"><strong>是否显示：</strong></td>
              <td height="22" align="left" class="tr_southidc">
              <input name="IsShow" type="checkbox" id="IsShow" value="1" <%if rs("IsShow")=True Then%>checked<%end if%>></td>
            </tr>
            <tr class="tdbg">
              <td height="22" align="center" class="tr_southidc">&nbsp;</td>
              <td align="center" class="tr_southidc"><div align="left">
                  <input name="Action" type="hidden" id="Action4" value="Modify">
                  <input name="Save" type="submit" id="Save" value="确认修改">
              &nbsp;
              <input type="button" name="Submit" value="返回上一页" onClick="history.go(-1);">
              </div></td>
            </tr>
        </table>
      </form></td>
  </tr>
</table>
<%
end if
end if
rs.close
set rs=nothing
%>

<!-- #include file="../Inc/Foot.asp" -->