<!--#include file="Conn.asp" -->
<%
'=========================================================
' 文件：iXs_UpLoadProgress.asp
' 功能：显示上传进度
' 版本：爱雪儿图文管理系统 PAMS Version 1.1.0
' 时间：2006-01-05
' 作者：Guidy
' 版权：爱雪儿工作室 [iXuEr Studio]
'=========================================================
' Copyright (C) 2005-2008 iXuEr.Net All Rights Reserved .
' 官方网站：http://www.ixuer.net/
' 技术论坛：http://bbs.ixuer.net/
' 电子信箱：guidy@114xp.cn
'=========================================================
' 此页面不做模板
' 取消缓存
On Error Resume Next
Response.Buffer = True
Response.ExpiresAbsolute = Now() - 1
Response.Expires = 0
Response.CacheControl = "no-cache"
Dim UpLoadPID, i
Dim Files, FileList, FileNum

UpLoadPID = iXs.ReqStr("UpLoadPID", 0)

Dim FileUpObj, UpLoaddingUrl
FileUpObj = iXs.UpFileObject ' 上传组件类型

If FileUpObj = 0 Then
	UpLoaddingUrl = "UpLoadData/" & UpLoadPID & ".js?"
ElseIf FileUpObj = 1 Then
	UpLoaddingUrl = "iXs_UpLoadAspUp3.asp?UploadPID=" & UploadPID & "&"
End If

Files = Split(iXs.ReqStr("Files", 0), "|")
FileNum = 0
For i = 0 To UBound(Files)
	If Files(i) <> "" Then
		FileNum = FileNum + 1
		'FileList = FileList & "文件" & FileNum & "：" & Right(Files(i), Len(Files(i)) - InStrRev(Files(i), "\")) & "&#13;"
		FileList = FileList & "文件" & FileNum & "：" & Files(i) & "&#13;"
	End If
Next
' 去掉最后一个回车符
FileList = iXs.ReFilter("&#13;$", FileList, 1, "")
%>
<?xml version="1.0" encoding="gb2312"?>
<!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>阳光播秀视频上传管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css">
	body,td,th {
		color: #000000;
		font: 12px Tahoma, "宋体";
	}
	body {
		background-color:buttonface;
	}
	/*进度条边框样式*/
	#tdUpBar {
		height:20px;
		padding:1px;
		border:1px inset threedshadow;
	}
	/*进度条主体样式*/
	#imgUpBar {
		height:16px;
		background-color:appworkspace;
	}
</style>
</head>
<body onselectstart="return false;" ondragstart="return false;">
<table align="center" width="100%" border="0" cellspacing="4" cellpadding="4">
	<tr>
		<td><fieldset>
			<legend>上传进度</legend>
			<table align="center" width="100%" border="0" cellspacing="0" cellpadding="0" style="TABLE-LAYOUT: fixed;">
				<tr>
					<td rowspan="4" align="center" width="15%"><img src="images/Others/Up_Logo.gif" height="32" width="32" vspace="0" hspace="0" alt="" /></td>
					<td style="WORD-WRAP: break-word;">文件：<span title="<% = FileList %>">共 <font color="#FF0000">
						<% = FileNum %>
						</font> 个</span>　　总大小：<span id="FileTotalSize"></span>&nbsp;MB</td>
				</tr>
				<tr>
					<td width="85%" id="tdUpUsedTime" name="tdUpUsedTime" style="WORD-WRAP: break-word;">　</td>
				</tr>
				<tr>
					<td id="tdUpBar" style="WORD-WRAP: break-word;">　</td>
				</tr>
				<tr>
					<td id="tdUpLeftTime" style="WORD-WRAP: break-word;">　</td>
				</tr>
			</table>
			</fieldset>
			<hr align="center" size="1" />
			<div align="right" style="font: 12px Verdana, Arial, Helvetica, sans-serif, '宋体';"> 
				文件正在上传，稍后将带您进入编辑页面。。。。<span style="color: #123DB3">
				</span>&nbsp;</div></td>
	</tr>
</table>
<script id="downLoadControl" language="JavaScript" type="text/javascript"></script>
<script language="JavaScript1.2" type="text/javascript">
<!--
	var intTimeStep 	= 1000; // 刷新时间间隔
	var lngUsedTime 	= 0;
	var lngTotalSize 	= 0;
	var lngReadSize 	= 0;
	
	function downLoadData(url){
		try{
			downLoadControl.src = url;
		}
		catch(e){
			return false;
		}
	}
	function upLoadData(){
		upLoadding();
		return true;
	}
	function upLoadding(){
		downLoadData("<% = UpLoaddingUrl %>y=" + Math.random());
		// lngTotalSize lngReadSize
		var lngLeftSize = lngTotalSize - lngReadSize;
		var dblPercent = (lngTotalSize) ? lngReadSize * 100 / lngTotalSize : 0;
		var dblSpeed = (lngUsedTime>0) ? lngReadSize / (lngUsedTime*1.024) : 0;
		var lngLeftTime = (dblSpeed>0) ? lngLeftSize / dblSpeed : 0;
		lngUsedTime += intTimeStep;
		
		var strTemp = (lngUsedTime >= 60000)? fxFormat(lngUsedTime / 60000) + " 分" : lngUsedTime / 1000 + " 秒";
		var strTemp2 = (lngLeftTime > 60000)? fxFormat(lngLeftTime / 60000) + " 分" : fxFormat(lngLeftTime / 1000) + " 秒";
		document.getElementById("tdUpUsedTime").innerHTML = "已用时间：" + strTemp + "　剩余时间：" + strTemp2 + "　进度：<strong>" + fxFormat(dblPercent) + "</strong> %";
		document.getElementById("tdUpBar").innerHTML = "<img src=\"images/Others/Up_Bar.gif\" id=\"imgUpBar\" width=\""+fxFormat(dblPercent)+"%\" />";
		document.getElementById("tdUpLeftTime").innerHTML = "平均速度：" + fxFormat(dblSpeed) + " KB/秒　已经复制：" + fxFormat(lngReadSize / 1048576) + " MB";
		document.getElementById("FileTotalSize").innerHTML = fxFormat(lngTotalSize / 1048576);
		
		if(lngReadSize < lngTotalSize || !dblSpeed){
			var timeoutid = null;
			timeoutid = setTimeout("upLoadding()", intTimeStep);
		}else{
			//上传完成后关闭进度条对话框
			window.close();
		}
	}
	// 格式化数字 保留2位浮点
	function fxFormat(num){
		return Math.round(Number(num) * 100) / 100;
	}
	// 开始执行
	upLoadData();
//-->
</script>
</body>
</html>