<!--#include file="../inc/config.asp"-->
<!--#include file="../inc/conn.asp"-->
<!-- #include file="inc/Session.asp" -->
<!-- #include file="inc/checkrole.asp" -->
<%
'''''''''''''''''''''''''''''''''''''''''''''''
call checkPrevilege(Session("Name"),"p04")
'''''''''''''''''''''''''''''''''''''''''''''''
BeginTime=Timer
const recpage=20
dim i,classid,ftype,ftitle
ftype=request.QueryString("ftype")
if(ftype<>"") then
	ftype=Cint(ftype)
else
	ftype=0
end if
if(ftype=0) then
	ftitle="标签"
elseif(ftype=1) then
	ftitle="函数"
end if
if not isempty(request("classid")) then
	classid=Clng(request("classid"))
else
	classid=-1
end if
if not isempty(request("page")) then 
	currentpage=Clng(request("page"))
else
	currentpage=1
end if
%>
<html>
<head>
<title>生成js文件</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #FFFFFF;
}
.style1 {color: #FF0000}
.style2 {color: #CCCCCC}
.style3 {color: #FFFFFF;
	font-weight: bold;
}
form{margin:0px;}
-->
</style>
<link href="style/global.css" rel="stylesheet" type="text/css">
<script language="javascript">
function goto(frm)
{
	var gourl ="label_manage.asp?classid=<%=classid%>&";
	gourl += "page=" + (frm.page.value);
     var hid=parseInt(frm.hid.value);
	 if(parseInt(frm.page.value)>hid||frm.page.value<=0){
	 alert("错误！请确定你输入的数字在1-"+hid+"之间");
	 return false;
	 }
	window.location.href(gourl);
}</script>
<script language="JavaScript" type="text/JavaScript">

function ConfirmDel()
{
   if(confirm("确认删除？并且不能恢复！确定要删除此信息吗？"))
     return true;
   else
     return false;
	 
}
</script>
</head>

<body>
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><iframe src="right_top.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" height="30" width="100%"></iframe></td>
  </tr>
</table>
<form name="form2" method="post" action="label_search.asp?act=search">
<table width="100%"  border="0" cellpadding="0" cellspacing="1" bgcolor="#eeeeee">
  <tr>
    <td width="100%" height="22" bgcolor="#FF9900"><div align="center"><span class="style3">◆ 标签搜索 ◆</span></div></td>
  </tr>
  <tr>
    <td height="26" align="center" bgcolor="#FFFFFF">关键字：
      <input name="title" type="text" id="title" size="15" maxlength="50">
      按：
      <select name="searchType" id="searchType">
        <option value="1">标签名称</option>
        <option value="2">标签描述</option>
      </select>
      每页显示条数：
      <input name="perpage" type="text" id="perpage" value="10" size="5" maxlength="5">
      取前几条：
      <input name="topn" type="text" id="topn" value="50" size="5" maxlength="5">
      <input type="submit" name="Submit" value="开始搜索" style="font-size:12px; "></td>
    </tr>
</table>
</form>
<form action="label_do.asp" method="post" name="form1" id="form1">
<table width="100%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#999999">
  <tr bgcolor="#FF9900">
    <td height="22" colspan="6"><div align="center"><span class="style3">◆ 管理<%=ftitle%> ◆</span></div></td>
  </tr>
  <tr bgcolor="#EEEEEE">
    <td width="9%" height="22"><div align="center">id</div></td>
    <td width="16%"><div align="center">所属类别</div></td>
    <td width="38%"><div align="center">名称</div></td>
    <td width="23%"><div align="center">描述</div></td>
    <td width="8%"><div align="center">修改</div></td>
    <td width="6%"><div align="center">删除</div></td>
  </tr>
  <!-- 开始按行循环----------------------->
  <%
		set rs=server.createobject("adodb.recordset")
		sql="select count(*) AS co from label where 1=1"&" and ftype="&ftype
		if(classid>=0) then	
			sql=sql&" and classid="&classid
		end if
		rs.open sql,conn,3,1
		allrec=rs("co")
		totalpage=int((allrec+recpage-1)/recpage)
		rs.close
		set rs=nothing
		set rs=server.createobject("adodb.recordset")
		sql="select top "&recpage&" id,labelname,demons,classid from label where id <=(select min(id) from (select top "&(recpage*(currentpage-1)+1)&" id from label where ftype="&ftype
		if(classid>=0) then	
			sql=sql&" and classid="&classid
		end if
		sql=sql&" order by id desc) as t) and ftype="&ftype
		if(classid>=0) then	
			sql=sql&" and classid="&classid
		end if
		sql=sql&" order by id desc "
		rs.open sql,conn,3,1		
		do while not rs.eof
			if(Clng(rs(3))=0) then
				classname="所有"
			else
				if(conn.execute("select count(*) from catalogs where id="&rs(3))(0)=0) then
					classname="栏目已删除"
				else
					classname=conn.execute("select title from catalogs where id="&rs(3))(0)
				end if
			end if
	%>
  <tr>
    <td height="20" bgcolor="#FFFFFF"><div align="center"><%=rs(0)%>
      <input name="labelid" type="checkbox" id="labelid" value="<%=rs(0)%>">
    </div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=classname%></div></td>
    <td bgcolor="#FFFFFF"><div align="center" title="<%=rs(2)%>"><%=rs(1)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><%=rs(2)%></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="label_modi.asp?id=<%=rs(0)%>&classid=<%=rs(3)%>">修改</a></div></td>
    <td bgcolor="#FFFFFF"><div align="center"><a href="dele.asp?id=<%=rs(0)%>&table=label" onClick="return ConfirmDel()">删除</a></div></td>
  </tr>
  
  <%
    rs.movenext
	  i=i+1
	   if i>=recpage then 
		exit do
	   end if
	  loop
	 ' end sub
	  rs.close
	  set rs=nothing
  %>
</table>
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td height="22" bgcolor="#C6CBD4"><div align="center">
        <input class=Button type="button" name="chkall" value="全选" onClick="CheckAll(this.form)">
        &nbsp;&nbsp;
        <input class=Button type="button" name="chksel" value="反选" onClick="ContraSel(this.form)">
        &nbsp;&nbsp;
        <input class=Button type="submit" name="Submit2" value="批量删除" onClick="return confirm('您确定执行该操作吗?\n建议先备份标签库再进行批量删除.')">
</div></td>
    </tr>
 </table>
</form>
<table width="100%">
  <tr>
    <td height="22" colspan="5" bgcolor="#FFFFFF"><div align="center"><form name="form1" method="post" action="" style="margin:0 0 0 0">
<%
dim n,p
n=currentpage+1
p=currentpage-1
if p>0then
response.write("["&"<a href='label_manage.asp?classid="&classid&"&page="&cstr(p)&"'>上一页</a>]&nbsp;&nbsp;&nbsp;")
else response.write("上一页&nbsp;&nbsp;&nbsp;")
end if 
if (n-1)*recpage>=allrec then 
response.write("下一页" )
else
response.Write("["&"<a href='label_manage.asp?classid="&classid&"&page="&cstr(n)&"'>下一页</a>]")
end if
response.write("&nbsp;共"&allrec&"条&nbsp;")
response.Write("&nbsp;共"&totalpage&"页&nbsp;")
response.Write("&nbsp;第"&currentpage&"页&nbsp;")
%>
          <input type="hidden" name="hid" value="<%=totalpage%>">
&nbsp;&nbsp;跳至
          <input name="page" type="text" size="5" onChange="goto(this.form)" style="border:1px solid #000000;height:18px ">
          页
          <input type="button" name="Button22" value="Go->" style="font-size:12px ;border:1px solid #000000;height:18px ">
        </form></div></td>
  </tr>
  <!--按行循环结束------------------------>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="40"><div align="center">注：鼠标悬停在<%=ftitle%>名称上时,将会显示<%=ftitle%>的作用信息。</div></td>
  </tr>
</table>
<script language="javascript">
function CheckAll(form) {  
	for (var i=0;i<form.elements.length;i++)  {  
		var e = form.elements[i];  
		if (e.name =='labelid')  
		e.checked = true // form.chkall.checked;  
	}  
} 
 
function ContraSel(form) {
	for (var i=0;i<form.elements.length;i++){
		var e = form.elements[i];
		if (e.name =='labelid')
		e.checked=!e.checked;
	}
}
</script>
</body>
</html>
<%
call connclose()
%>
<%=CStr(FormatNumber((Timer-BeginTime)*1000,2))& "毫秒"%>