<!--#include file="conn.asp"-->
<%	
	'检查用户访问的权限
	call checkuser(5)
	
	'删除模板
	if request.QueryString("action")="dele" then
		strIDs="(0" & request.Form("chkDele") & ")"
		strSQL="Select t_code From templet Where id in " & strIDs
		strCodes="('"
		rs.open strSQL,conn,1,1
		For i=1 to rs.recordcount
			strCodes=strCodes & Trim(rs("t_code")) & "','"
			rs.movenext
		next
		rs.close
		
		strCodes=strCodes & "')"
		
		strSQL="Delete From templet Where id in " & strIDs
		conn.execute strSQL,0,1
		
		'删除模板栏目
		strSQL="Delete From templet_menu Where t_code in " & strCodes
		conn.execute strSQL,0,1
		
	end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>电子商务自助建站--您理想的助手</title>
<link href="common/styleMain.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
function checkform(){
	if(!confirm('确定要删除选择的模板吗？　')){
		return false;
	}
}

</script>
</head>
<body leftmargin="0" topmargin="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="0" align="center">
		  <!--#include file="common/top.asp"-->
          </td>
        </tr>
        <tr> 
          <td height="100%" align="center" valign="top">
<TABLE class=table002 cellSpacing=0 cellPadding=0 border=0>
              <TBODY>
                <TR> 
                  <!--左边开始-->
                  <TD width="20%" align=right vAlign=top> <!--#include file="common/adminleft.asp"--> </TD>
                  <!--左边结束-->
                  <TD width="2%" background="images/rowline.gif">&nbsp;</TD>
                  <!--右边开始-->
                  <TD vAlign=top align=center width="78%">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td> <form name="form1" method="post" action="?action=dele" onSubmit="return checkform()">
                            <TABLE width="100%" height="100%" border=0 cellPadding=6 cellSpacing=0>
                              <TBODY>
                                <TR> 
                                  <TD height="320" vAlign=top bgColor=#ffffff><strong><font color="#FF0000">模板管理</font></strong><BR> 
                                    <HR SIZE=1> 
                                    <table width="567" height="82" border="0" cellpadding="2" cellspacing="1" bgcolor="#5F8AC5">
                                      <tr bgcolor="#FFFFFF"> 
                                        <td height="31" colspan="8"><strong>模板分类 
                                          <select name="selClass" id="selClass" onChange="location='?class=' + this.value">
                                            <option value="" selected>所有模板</option>
                                            <%
													Set rSub=server.CreateObject("ADODB.RecordSet")
													rSub.open "Select * From templet_class",conn,1,1
													for i=1 to rSub.recordcount
														response.Write("<option value=" & rSub("id") & ">" & Trim(rSub("tc_name")) & "</option>")
														rSub.movenext
													next
													rSub.close
											%>
                                          </select>
                                          <input type="button" name="Submit" value="添加模板" onClick="location='Admin_TempAdd.asp?class=<%=request.QueryString("class")%>'">
                                          </strong></td>
                                      </tr>
                                      <tr> 
                                        <td width="34" height="25" align="center" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">&nbsp;编号</font></strong></td>
                                        <td width="68" align="center" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">模板名称</font></strong></td>
                                        <td width="80" align="center" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">类型</font></strong></td>
                                        <td width="49" align="center" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">会员制</font></strong></td>
                                        <td width="47" align="center" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">投票</font></strong></td>
                                        <td width="55" align="center" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">友情链接</font></strong></td>
                                        <td width="48" align="center" bgcolor="#5F8AC5">
<input type="submit" name="Submit2" value="删除"></td>
                                        <td width="145" align="center" bgcolor="#5F8AC5"><strong><font color="#FFFFFF">说明</font></strong></td>
                                      </tr>
                                      <tr> 
                                        <td height="2" colspan="8" bgcolor="#5F8AC5"></td>
                                      </tr>
                                      <%
									strQueryString="&class=" & request.QueryString("class")
									strQuery=""
									if request.QueryString("class")<>"" then
										strQuery=strQuery & " And t_type=" & request.QueryString("class")
									end if
									strSQL="Select * from v_templet_list Where 1=1 " & strQuery & " Order by t_code"
									rs.open strSQL,conn,1,1
										'分页显示初始化
									page=GetVariable("page")
									if page="" then
										page=1
									else
										page=Cint(page)
									end if
									
									Section=GetVariable("section")
									if Section="" then
										Section=1
									else
										Section=Cint(Section)
									end if
									'变量赋值
									intPageSize=12		'每页显示记录数
									intSectionSize=5		'多少页为一段，像GOOGLE一样
									PrevSectionText="<FONT face=webdings>7</FONT>"		'上一段的链接文字
									NextSectionText="<FONT face=webdings>8</FONT>"		'下一段的链接文字
									PrevPageText="<FONT face=webdings>3</FONT>"			'上页的链接文字	
									NextPageText="<FONT face=webdings>4</FONT>"			'下页的链接文字
									
									strPageUrl="?t=" & strQueryString
									
									rs.pagesize=intPageSize
									intCount=rs.RecordCount 
									intPageCount=rs.pagecount
									intSectionCount=(intPageCount - 1) \ intSectionSize + 1
									if intCount>0 then
										rs.AbsolutePage=page  
									else
										response.Write("没有任何模板！")
									end if
									
									%>
                                      <%
									 '循环输出
									 for i=1 to intPageSize
										if rs.eof then exit for
										if i mod 2=0 then
											strColor="#F8F8F8"
										else
											strColor="#fFfFfF"
										end if
									 %>
                                      <tr bgcolor="<%=strColor%>"> 
                                        <td height="23" align="center"><%=rs("t_code")%></td>
                                        <td><a href="Admin_TempAdd.asp?id=<%=rs("id")%>"><%=rs("t_name")%></a></td>
                                        <td align="center"><%=rs("tc_name")%></td>
                                        <td align="center"> <input name="chkMember" type="checkbox" id="chkMember" value="True" <% if rs("t_member") then response.Write("checked")%>> 
                                        </td>
                                        <td align="center"> <input name="chkVote" type="checkbox" id="chkVote" value="True" <% if rs("t_vote") then response.Write("checked")%>> 
                                        </td>
                                        <td align="center"> <input name="chkLink" type="checkbox" id="chkLink" value="True" <% if rs("t_link") then response.Write("checked")%>> 
                                        </td>
                                        <td align="center"><input name="chkDele" type="checkbox" id="chkDele" value="<%=rs("id")%>"></td>
                                        <td><%=rs("t_intro")%></td>
                                      </tr>
                                      <%
										 rs.movenext
									  next
									%>
                                    </table>
                                    <table width="100%" height="30" border="0" cellpadding="0" cellspacing="0">
                                      <tr> 
                                        <td width="100%" height="25" colspan="2" align="right"> 
                                          共有<%=intCount%>记录，分<%=intPageCount%>页，当前页<%=Page%>，每页显示<%=intPageSize%>条记录 
                                          <%
												'计算每一段的开始页
												intStarPage=(Section-2) * intSectionSize + 1
												'前一段
												if Section<=1 then
													response.Write(PrevSectionText & " ")
												else
													response.Write("<a href='" & strPageUrl & "&page=" & intStarPage & "&section=" & Section-1 & "'>" & PrevSectionText & "</a> ")
												end if 
												
												'显示页码列表
												response.Write("第")
												intStarPage=(Section-1) * intSectionSize + 1
												for p=intStarPage to intStarPage + intSectionSize - 1
													if p > intPageCount then exit for
													if p=page then
														response.Write("<strong>[" & p & "]</strong> ")
													else
														response.Write("<a href='" & strPageUrl & "&page=" & p & "&section=" & Section & "'>[" & p & "]</a> ")
													end if	
												next
												response.Write("页")
												'后一段
												intStarPage=(Section) * intSectionSize + 1
												if Section>=intSectionCount then
													response.Write(" " & NextSectionText)
												else
													response.Write(" <a href='" & strPageUrl & "&page=" & intStarPage & "&section=" & Section+1 & "'>" & NextSectionText & "</a> ")
												end if 
											  %>
                                          <select name="page" size="1" onchange="window.location='<%=strPageUrl & "&section="%>' + (Math.floor((parseInt(this.value)-1)/<%=intSectionSize%>)+1) + '<%="&page="%>' + this.value">
                                            <option value="<%=page%>" selected>第<%=page%>页</option>
                                            <%
													for i=1 to rs.pagecount
													%>
                                            <option value="<%=i%>" >第<%=i%>页</option>
                                            <%
														next
													%>
                                          </select>
                                          　 </td>
                                      </tr>
                                    </table></TD>
                                </TR>
                              </TBODY>
                            </TABLE>
                          </form></td>
                      </tr>
                    </table> 
                  </TD>
                </TR>
              </TBODY>
            </TABLE></td>
        </tr>
        <tr> 
          <td height="0" align="center">
		  <!--#include file="common/bottom.asp"-->
		  </td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
