<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Conn.asp"-->
<!--#include file="Ex_Cls/Ex_SkinCls.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css"> 
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor">
<%
Dim ExCls
Set ExCls=new ExClass
ExCls.execute
Class ExClass
Private ExComm,ExFso
Private Sub class_initialize
	Set ExComm=new Ex_CommonCls
	ExComm.IsAdLogin 
	ExComm.IsIpAllow
	Set ExFso=new Ex_FsoCls
End Sub
Private Sub class_terminate
	Set ExComm=Nothing 
End Sub
public Sub Execute
dim action
	action=request.querystring("action")
	select case action
	case "del"
	call del()
	case "change"
	call change()
	case "add"
	call add()
	Case Else
	addform
	show
	end Select
End Sub 
sub ReFreshCache
	ExComm.ClearCaches(sn)
	Dim ExSkin
	Set ExSkin=new Ex_SkinCls
	ExSkin.RefreshSkinCache
	Set ExSkin=Nothing 
End Sub 
%>
<%sub addform()%>
<center>
<form name="form1" method="post" action="?action=add">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr>
      <th colspan="3" class="topbg">添加博客栏目</th>
      </tr>
    
    <tr>
      <td class="tdbg" colspan="3"><table width="99%" border="0" align="center">
        <tr>
          <td class="tdbg"><div align="center">栏目名称</div>            
            <div align="center"></div></td>
          <td width="33%" class="tdbg"><div align="center">栏目网址</div></td>
          <td width="33%" class="tdbg"><div align="center">序号</div></td>
        </tr>
        <tr>
          <td class="tdbg"><div align="center">
            <input name="channelname" type="text" id="channelname">
</div>            <div align="center"></div></td>
          <td class="tdbg"><div align="center">
              <input name="channelurl" type="text" id="channelurl">
          </div></td>
          <td class="tdbg"><div align="center">
              <input name="channelorder" type="text" id="channelorder" value="0">
          </div></td>
        </tr>
        <tr>
          <td class="tdbg" colspan="3"><div id="strclass"></div></td>
        </tr>
      </table></td>
      </tr>
    <tr>
      <td class="tdbg" colspan="3"><div align="center">
        <input type="submit" name="Submit2" value="提交">
      </div></td>
      </tr>
  </table>
</form>
</center>
<%end sub%>
<%sub add()
 dim ChannelName,ChannelUrl,ChannelOrder,StrSql
 ChannelName=request.Form("channelname")
 ChannelUrl=request.Form("channelurl")
 ChannelOrder=request.Form("channelorder")
 If isnumeric(ChannelOrder)=False Then
	ExComm.ShowMsg "序号必须填写，并且是数字。",""
 End If
 If Trim(ChannelName)="" Then 
	ExComm.ShowMsg "栏目名不能为空",""
 End If 
 If Trim(ChannelUrl)="" Then
	ExComm.ShowMsg "请填写栏目网址",""
 End If 
strsql="insert into Ex_Channel(channelname,channelurl,channelorder) values('"&channelname&"','"&channelurl&"',"&channelorder&")"
 Conn.execute(strsql)
 ReFreshCache
 ExComm.ShowMsg "添加成功","admin_Channel.asp"
 end sub%>
 <%sub show()
   dim strsql,rs,i
   i=0
   strsql="select * from Ex_Channel order by channelorder asc"
   set rs=Conn.execute(strsql)
   %>
   <center>
<form name="form1" method="post" action="?action=change">
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
    <tr>
      <th colspan="4" class="topbg"><div align="center">管理博客栏目</div></th>
    </tr>
    <tr>
      <td class="tdbg"><div align="center">栏目名称</div></td>
      <td class="tdbg" width="203"><div align="center">栏目网址</div></td>
	  <td class="tdbg"><div align="center">序号</div></td>
      <td class="tdbg" width="92"><div align="center">操作</div></td>
    </tr>
	<%do while not rs.eof%>
    <tr>
      <td class="tdbg"><div align="center"><input id="id" name="id" type="hidden" value="<%=rs("id")%>">
        <input name="strclass<%=rs("id")%>" type="text" id="strclass<%=rs("id")%>" value="<%=rs("channelname")%>" size="15">
      </div></td>
      <td class="tdbg"><div align="center">
        <input name="classurl<%=rs("id")%>" type="text" id="classurl<%=rs("id")%>" value="<%=rs("channelurl")%>">
      </div></td>
	  <td class="tdbg"><div align="center">
	    <input name="orderx<%=rs("id")%>" type="text" id="orderx<%=rs("id")%>" value="<%=rs("channelorder")%>" size="10">
      </div></td>
      <td class="tdbg"><div align="center"><a href="?action=del&id=<%=rs("id")%>" onClick="return confirm('确定删除?')">删除
      </a></div></td>
    </tr>
	<%rs.movenext
	i=i+1
	loop%>
    <tr>
      <td class="tdbg" colspan="4"><div align="center">
        <input type="submit" name="Submit" value="提交">
      </div></td>
      </tr>
  </table>
</form></center>
提示：<br>1.序号越小排名越靠前！！
<br>
<a href="http://www.ex123.net/bbs" target="_blank"><font color="red">如果您对日志分类的添加和管理还有什么疑问,点此查看易心博客使用教程</font></a>
   <%end sub%>
   <%sub del()
    dim id,strsql
	id=request.querystring("id")
	strsql="delete from Ex_Channel where id="&id
    'response.write(strsql)
	Conn.execute(strsql)
	ReFreshCache
	ExComm.ShowMsg "删除成功",request.servervariables("http_referer")
   end sub%>
   <%sub change()
    dim classx,orderx,default,classurl,strsql,id,i,openmode
	Id=Request("id")
	Id=Split(Id,",")
	For I=0 to UBound(Id)
		classx=request.form("strclass"&Trim(id(I)))
		orderx=request.form("orderx"&Trim(id(I)))
		classurl=request.form("classurl"&Trim(id(I)))
		If isnumeric(orderx)=False Then
			ExComm.ShowMsg "序号必须填写，并且是数字。",""
		End If
		If Trim(classx)="" Then 
			ExComm.ShowMsg "栏目名不能为空",""
		End If 
		If Trim(classurl)="" Then
			ExComm.ShowMsg "栏目 "&classx&" 的网址必须填写",""
		End If
		strsql="update Ex_Channel set channelName='"&classx&"',ChannelOrder="&orderx&",ChannelUrl='"&classurl&"'"
		strsql=strsql&" where id="&id(I)
		'response.write(strsql)
		Conn.execute(strsql)
	Next
	ReFreshCache
	ExComm.ShowMsg "修改成功",request.servervariables("http_referer")
    end Sub
    End class%>
</body>
</html>
