<!--#include file="inc/function.asp" -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<TITLE>采集管理 - 采集项目管理 - 126电影程序CMS</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="../images/css_body.css" type=text/css rel=stylesheet>
<script language="javascript" src="../images/admin.js"></script>
</head>
<BODY>
<%
Sub EditSave()
dim rs,sql
		Set Rs=Server.CreateObject(recordsStr)
		sql="select * from [Collect_ClassId] where ID="&Request.Form("ID")
		Rs.open sql,Connc,1,3
		RS("ClassType")=Request.Form("ClassType")
		RS("ClassId")=Request.Form("ClassId")
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		Call Admin_ShowErr("<li>采集栏目转换修改成功</li>","CustomClass.asp",1)
End Sub
Sub AddSave()
dim rs,sql
		Set Rs=Server.CreateObject(recordsStr)
		sql="select * from [Collect_ClassId] where ClassType='"&Request.Form("ClassType")&"'"
		Rs.open sql,Connc,1,3
		If Rs.eof Then
		Rs.addnew
		RS("ClassType")=Request.Form("ClassType")
		RS("ClassId")=Request.Form("ClassId")
		Rs.Update
		Rs.Close
		Set Rs = Nothing
		Call Admin_ShowErr("<li>采集栏目转换添加成功</li>","CustomClass.asp",1)
		Else
		Call Admin_ShowErr("<li>对不起已经有此转换栏目</li>","CustomClass.asp",0)
		End If
End Sub
Sub Del()
	Connc.Execute "delete from [Collect_ClassId] where ID = "&Request("ID")&""
	Call Admin_ShowErr("<li>栏目转换删除成功！</li>","CustomClass.asp",1)
End Sub
Sub DelAll()
	Connc.Execute "delete from [Collect_ClassId] "
	Call Admin_ShowErr("<li>所有栏目转换删除成功！</li>","CustomClass.asp",1)
End Sub%>
<div class="container" id="cpcontainer">
<TABLE width="96%" border=0 align=center cellpadding="5" cellSpacing=1 class=tbtitle style="BACKGROUND: #cad9ea;">
<tr bgColor="#f5fafe">
      <th  colspan="7"> <font color="#FF0000">此操作只在入库分类为(自定义分类)时起作用,也就是编辑入库规则时入库分类选择为(按对应栏目自动转换)时</font></th>
</tr>
<tr bgColor="#f5fafe">
      <th  colspan="7">采集栏目转换管理 | <a href="CustomClass.asp">采集栏目转换管理首页</a> | <a href="CustomClass.asp?Action=Add">添加采集栏目转换</a> | <a href="CustomClass.asp?Action=Delall" onClick="return confirm('删除后将不能恢复,确定要删除吗?');">删除所有栏目转换</a> </th>
</tr>
<%
Dim Action,Page
Action=Trim(request("Action"))
Page=PE_CLng(request.QueryString ("page"))
If page<=0 or page="" then page=1'初始化分页参数
'
Select Case Action
Case "Add"
	Call Add()
Case "AddSave"
	Call AddSave()
Case "EditSave"
	Call EditSave()
Case "Del"
	Call Del()
Case "Delall"
	Call DelAll()	
Case else
	Call List()
End Select

Sub List()
dim rs,sql,i,m,n,z,cPageNo
%>
    <tr bgcolor="#FFFFFF">
      <td width="5%" >ID</td>
      <td width="40%" >取得栏目</td>
      <td width="40%" >对应系统栏目</td>
      <td width="15%" >操作</td>
    </tr>
<% 

 Set Rs = Server.CreateObject(recordsStr)
sql="Select ID,ClassType,ClassId from [Collect_ClassId] Order by id desc"
Rs.open sql,Connc,1,1
If Rs.eof Then
   Response.Write"<TR ><TD >没有记录。</TD></TR>"
Else
	i=0
	rs.pagesize=15       '每页数据
	rs.AbsolutePage=page
	m=rs.recordcount     '总记录
	n=rs.PageCount       '总页数
	z=rs.pagesize        '每页数量
	Do while not rs.eof  and i<rs.pagesize
%> 
	<form name="form<%=i%>" action="CustomClass.asp?Action=EditSave" method="post">
    <tr bgcolor="#FFFFFF">
      <td><%= RS("ID") %></td>
      <td><input name="ClassType" type="text" id="ClassType" value="<%= RS("ClassType") %>" size="40"></td>
      <td><select name="ClassId" id="ClassId">
	  <% makeTypeOptionSelected 0,"&nbsp;|&nbsp;&nbsp;",RS("ClassId") %>
	  
      </select><input name="ID" type="hidden" value="<%= RS("ID") %>"></td>
      <td ><A href="javascript:form<%=i%>.submit();">修改</A>｜<A href="CustomClass.asp?ID=<%= RS("ID") %>&Action=Del">删除</A></td>
    </tr>
	</form>
<%
    i=i+1
    Rs.MoveNext
    Loop 
End if
%>
	<tr bgcolor="#FFFFFF">
	<th   colspan="7" height="32"><% response.Write fPageCount(Rs,cPageNo) %></th>
	</tr>
<%RS.Close
Set RS = Nothing
End Sub
Sub Add()%>
    <tr bgcolor="#FFFFFF">
      <th  colspan="7" height="32">
		<p style="text-align: center">添加采集栏目转换</th>
    </tr>
  <form name="form" action="CustomClass.asp?Action=AddSave" method="post">
    <tr bgcolor="#FFFFFF">
      <td width="15%" >取得栏目：</td>
      <td width="35%" ><input name="ClassType" type="text" id="ClassType" size="40"></td>
      <td width="15%" >对应系统栏目：</td>
      <td width="35%" ><select name="ClassId" id="ClassId">
	  <% makeTypeOption 0,"&nbsp;|&nbsp;&nbsp;" %>
	  </select></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td colspan="4"><input type="submit" name="Submit" class="btn" value="添 加"></td>
    </tr>
  </form>
</table>
</div>
<%
End Sub
Call Conncclose()%>
</body>
</html>