<!--#include file = "../inc/dbconn.asp"-->
<!--#include file = "CheckLogin.asp"-->
<!--#include file = "../inc/cache.asp"-->
<!--#include file = "../inc/function.asp"-->
<% LOADING_ADMIN_HEAD %>
<script language=javascript src="../inc/changedate.js"></script>
<% call dbconn %>
<%
select case gqv("do")
	case "moveurl":moveurl
	case "default":default
	case else default
end select
sub default
  dim classid:classid=gqv("classid")
  LINE "<form name=""form1"" action=""DH_Move.asp?do=moveurl&task=mbc"" method=""post"">"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
  LINE "<tr>"
  LINE "<td align=""middle"" valign=""center"">"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
  LINE "<tr>"
  LINE "<td height=""30""colspan=""2"" style=""padding-left:10px;"" class=""tbl_head"">指定栏目移动</td>"
  LINE "</tr>"
  LINE "<tr>"
  LINE "<td width=""20%"" height=""30"" bgcolor=""#ffffff"" align=""right"">被移动栏目:</td>"
  LINE "<td width=""80%"" height=""30"" bgcolor=""#ffffff"" align=""left"">"
  dim aa,list
  set aa = new classlist
	  aa.id = "id"
	  aa.parentid = "parent"
	  aa.table = "DH654_class"
	  aa.name = "cname"
  list = aa.arrylist()
  LINE "<select name=""bid"">"
    dim o:for o = 0 to ubound(list,2)-1   
    	if classid<>"" and list(0,o)=int(classid) then	  
		  LINE "<option value=""" & list(0,o)  &""" selected>" & insertchr(list(2,o)) & list(1,o)  &"</option>"	  
        else
		  LINE "<option value=""" & list(0,o)  &""">" & insertchr(list(2,o)) & list(1,o)  &"</option>"  
        end if
    next 
  LINE "</select>"
  LINE "</td>"
  LINE "</tr>"
  LINE "<tr>"
  LINE "<td width=""20%"" height=""30"" bgcolor=""#ffffff"" align=""right"">目标栏目:</td>"
  LINE "<td width=""80%"" height=""30"" bgcolor=""#ffffff"" align=""left"">"
  LINE "<select name=""tid"">"
  for o = 0 to ubound(list,2)-1%>
		 <option value="<% = list(0,o) %>"><% = insertchr(list(2,o)) & list(1,o) %></option>	  
<%next 
  LINE "</select>"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
  LINE "<tr>"
  LINE "<td align=""middle"" valign=""center"">"
  LINE "<table bgcolor=""#c0c0c0"" align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
  LINE "<tr>"
  LINE "<td height=""30"" bgcolor=""#ffffff"" align=""left"" colspan=""2"">"
  LINE "<input name=""submit1"" type=""submit"" value=""确定"" onclick=""this.disabled=true;document.form1.submit();"">"
  LINE "<input name=""submit2"" type=""reset"" value=""还原"">"
  LINE "<input name=""submit3"" type=""button"" value=""返回"" onclick=""window.history.back();"">"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "</form>"%>

<%LINE "<form name=""form2"" action=""DH_Move.asp?do=moveurl&task=mbi"" method=""post"">"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
  LINE "<tr>"
  LINE "<td align=""middle"" valign=""center"">"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
  LINE "<tr>"
  LINE "<td height=""30"" colspan=""2"" style=""padding-left:10px;"" class=""tbl_head"">指定编号移动</td>"
  LINE "</tr>"
  LINE "<tr>"
  LINE "<td width=""20%"" height=""30"" bgcolor=""#ffffff"" align=""right"">被移动网址:</td>"
  LINE "<td width=""80%"" height=""30"" bgcolor=""#ffffff"" align=""left"">起始ID:<input name=""sid"" type=""text"" value=""1"" size=""5"">结束ID:<input name=""eid"" type=""text"" value=""1"" size=""5"">"
  LINE "</td>"
  LINE "</tr>"
  LINE "<tr>"
  LINE "<td width=""20%"" height=""30"" bgcolor=""#ffffff"" align=""right"">目标栏目:</td>"
  LINE "<td width=""80%"" height=""30"" bgcolor=""#ffffff"" align=""left"">"
  LINE "<select name=""tid"">"
  for o = 0 to ubound(list,2)-1 %>
	<option value="<% = list(0,o) %>"><% = insertchr(list(2,o)) & list(1,o) %></option>
<%next 
  LINE "</select>"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
  LINE "<tr>"
  LINE "<td align=""middle"" valign=""center"">"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
  LINE "<tr>"
  LINE "<td height=""30"" bgcolor=""#ffffff"" align=""left"" colspan=""2"">"
  LINE "<input name=""submit1"" type=""submit"" value=""确定"" onclick=""this.disabled=true;document.form2.submit();"">"
  LINE "<input name=""submit2"" type=""reset"" value=""还原"">"
  LINE "<input name=""submit3"" type=""button"" value=""返回"" onclick=""window.history.back();"">"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "</form>"%>

<%LINE "<form name=""form3"" action=""DH_Move.asp?do=moveurl&task=mbd"" method=""post"">"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
  LINE "<tr>"
  LINE "<td align=""middle"" valign=""center"">"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
  LINE "<tr>"
  LINE "<td height=""30"" colspan=""2"" style=""padding-left:10px;"" class=""tbl_head"">指定日期移动</td>"
  LINE "</tr>"
  LINE "<tr>"
  LINE "<td width=""20%"" height=""30"" bgcolor=""#ffffff"" align=""right"">起始日期:</td>"
  LINE "<td width=""80%"" height=""30"" bgcolor=""#ffffff"" align=""left""><input name=""stime"" value="""&date()&""" onClick='popUpCalendar(this, this, ""yyyy-m-dd"")'>&nbsp;<font color=""red"">0000-0-00</font></td>"
  LINE "</tr>"
  LINE "<tr>"
  LINE "<td width=""20%"" height=""30"" bgcolor=""#ffffff"" align=""right"">结束日期:</td>"
  LINE "<td width=""80%"" height=""30"" bgcolor=""#ffffff"" align=""left""><input name=""etime"" value="""&date()&""" onClick='popUpCalendar(this, this, ""yyyy-m-dd"")'>&nbsp;<font color=""red"">0000-0-00</font></td>"
  LINE "</tr>"
  LINE "<tr>"
  LINE "<td width=""20%"" height=""30"" bgcolor=""#ffffff"" align=""right"">目标栏目:</td>"
  LINE "<td width=""80%"" height=""30"" bgcolor=""#ffffff"" align=""left"">"
  LINE "<select name=""tid"">"
  for o = 0 to ubound(list,2)-1 %>
      <option value="<% = list(0,o) %>"><% = insertchr(list(2,o)) & list(1,o) %></option>
<%next
  LINE "</select>"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
  LINE "<tr>"
  LINE "<td align=""middle"" valign=""center"">"
  LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
  LINE "<tr>"
  LINE "<td height=""30"" bgcolor=""#ffffff"" align=""left"" colspan=""2"">"
  LINE "<input name=""submit1"" type=""submit"" value=""确定"" onclick=""this.disabled=true;document.form3.submit();"">"
  LINE "<input name=""submit2"" type=""reset"" value=""还原"">"
  LINE "<input name=""submit3"" type=""button"" value=""返回"" onclick=""window.history.back();"">"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "</td>"
  LINE "</tr>"
  LINE "</table>"
  LINE "</form>"
end sub  %>
  
<%
sub moveurl
    if not Check_Popedom("H504") then call alertbox("你没有权限操作",2)
	dim bid:bid = gfv("bid")
	dim tid:tid = gfv("tid")
	dim sid:sid = gfv("sid")
	dim eid:eid = gfv("eid")
	dim stime:stime = gfv("stime")
	dim etime:etime = gfv("etime")
	dim task:task = gqv("task")
	if task = "mbc" then
		if bid = tid then
			call alertbox("栏目不能相同!",2)
		end if
		call fileloading("select id,classid from DH654_URL where classid=" & bid & " order by id desc",tid)
	elseif task = "mbi" then
		if sid = "" or eid = "" or not isnumeric(sid) or not isnumeric(eid) then
			call alertbox("ID号输入错误!",2)
		end if
		call fileloading("select id,classid from DH654_URL where " & sid & " <= id and id <= " & eid & " order by id desc",tid)
	elseif task = "mbd" then
		if stime = "" or etime = "" then
			call alertbox("日期不能为空!",2)
		end if
		call fileloading("select id,classid from DH654_URL where #" & stime & "# < addtime and addtime < #" & etime & "# order by id desc",tid)
	end if
end sub

function fileloading(xSQL,id)
	dim rs,allcount
	set rs = server.createobject(G_654_RS)
	rs.open xSQL,conn,1,1
	if rs.eof and rs.bof then
		rs.close:set rs = nothing
		LINE "<div align=""center"">系统没有找到指定数据!可能的原因如下:</div>"
		LINE "<div align=""center""><font color=""red"">①.栏目下无网址数据</font></div>"
		LINE "<div align=""center""><font color=""red"">②.没有相关网址数据</font></div>"
		LINE "<div align=""center""><font color=""red"">③.系统产生未知错误</font></div>"
		fileloading = false
		exit function
	else
		allcount = rs.recordcount
	end if
	LINE "<table align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" border=""0"">"
	LINE "<tr>"
	LINE "<td align=""center"" valign=""center"">"
	LINE "<table bgcolor=""#c0c0c0"" align=""center"" width=""100%"" cellpadding=""2"" cellspacing=""1"" class=""tbl"" id=tbl>"
	LINE "<tr>"
	LINE "<td bgcolor=""#ececec"" width=""100%"" align=""center"" height=""30""  class=""tbl_head"">转移网址</td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td height=""300"" bgcolor=""#ffffff"" align=""center"" valign=""top"">"
	LINE "<table style=""background:ThreeDFace;border:2px outset;-moz-border-left-colors:ThreeDLightShadow ThreeDHighLight;-moz-border-right-colors:ThreeDDarkShadow THreeDShadow;-moz-border-top-colors:ThreeDLightShadow ThreeDHighLight;-moz-border-bottom-colors:ThreeDDarkShadow ThreeDShadow;width:600px;height:auto;margin-top:30px;"" cellspacing=""0"" cellpadding=""0"" align=""center"" border=""0"">"
	LINE "<tr class=""tbl_top"">"
	LINE "<td valign=""top"">"
	LINE "<table cellspacing=""1"" cellpadding=""0"" width=""100%"" align=""center"" border=""0"">"
	LINE "<tr class=""tbl_top"">"
	LINE "<td style=""height:20px;vertical-align:top;text-align:left;"">"
	LINE "<div style=""padding:2px 0px 0px 5px;height:20px;""  class=""tbl_top"">"
	LINE "<span id=""ProgressBarTitle"">操作正在进行</span>"
	LINE "</div>"
	LINE "</td>"
	LINE "</tr>"
	LINE "<tr>"
	LINE "<td style=""text-align:center;padding-top:30px;"" class=""tbl_top"">"
	LINE "<div align=""center"">"
	LINE "<div style=""width:90%;height:20px;border:1px solid ThreeDShadow;background:window;overflow:hidden;text-align:left;padding:1px;font-size:0px;-moz-appearance:progressbar"">"
	LINE "<div id=""ProgressBar"" style=""width:1px;height:16px;position:relative;left:0px;background:HighLight;overflow:hidden;-moz-appearance:progresschunk;font-size:0px;""></div>"
	LINE "</div>"
	LINE "</div>"
	LINE "</td>"
	LINE "</tr>"
	LINE "</table>"
	LINE "</td>"
	LINE "</tr>"
	LINE "<tr  class=""tbl_head"">"
	LINE "<td style=""text-align:center;padding:30px 0px 30px 0px;"">"
	LINE "<div align=""center"">"
	LINE "<div style=""width:90%;text-align:left;vertical-align:middle;font:normal;color:buttontext;"">"
	LINE "<div>需要转移网址数:[ " & allcount & " ]</div>"
	LINE "<div id=""StaticFileResult"">正在转移网址,请稍后...</div>"
	LINE "<div id=""StaticFileViewer"" name=""StaticFileViewer""></div>"
	LINE "</div>"
	LINE "</div>"
	LINE "</td>"
	LINE "</tr>"
	LINE "</table>"
	LINE "</td>"
	LINE "</tr>"
	LINE "</table>"
	LINE "</td>"
	LINE "</tr>"
	LINE "</table>"
	LINE "<script>oMM=document.getElementById('StaticFileViewer');oResult=document.getElementById('StaticFileResult');oProgressBar=document.getElementById('ProgressBar');</script>"
	dim stime:stime = timer()
	dim i,percentnum
	for i = 1 to allcount
		if not response.isclientconnected then response.end
		conn.execute("update DH654_URL set classid=" & id & " where id=" & rs("id"))
		call DelFile(".." & site_html & getclasspath(rs("classid"),"DH654_Class") & "/",rs("id"))
		percentnum = formatnumber(i/allcount*100,0)
		if percentnum = "" then
			percentnum = 0
		end if
		response.write("<script>oMM.innerHTML=""系统转移进度百分比:[ " & percentnum & " % ]<br>正在转移第[ " & i & " ]条网址!"";oProgressBar.style.width=" & percentnum & "+'%';</script>")
		response.flush
		rs.movenext
	next
	rs.close:set rs = nothing
	fileloading = true
	dim etime:etime = timer()
	dim output:output = formatnumber((etime-stime)*1,3)
	response.write("<script>oResult.innerHTML=""成功转移网址数:[ " & i - 1 & " ]"";document.getElementById('ProgressBarTitle').innerHTML=""操作成功完成"";</script>")
	response.write("<p align=""center"">程序执行耗时: " & output & " 秒!</p>")
	response.write("<p align=""center""><font color=""red"">请稍等,勿刷新!3秒后系统自动返回!</font></p>")
	response.write("<script>setTimeout(""location.href='DH_Move.asp?do=default'"",3*1000);</script>")
	response.end()
end function
%>
<% LOADING_ADMIN_FOOT %>
