<%@ Page Language="C#" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Update" Codebehind="KS.Update.aspx.cs" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>

<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>
<link href='../../admin/images/style.CSS' rel='stylesheet'>
<script src='../../KS_Inc/Jquery.js'></script>
<script src='../../KS_Inc/Kesion.Common.js'></script>
<style type="text/css">
.listinfo li{height:23px;line-height:23px;background:url(images/37.gif) no-repeat 0px 7px;padding-left:10px}
.bborder{border:2px solid #cccccc }

#uptips{margin:10px}
.line{margin:0 auto;border-bottom:1px solid #efefef}
.c{background:#FBFDFF;border-top:2px solid #E1EEFF;
	height:28px;
	line-height:28px;
	letter-spacing:2px;
	font-weight:bold;
	border-bottom:1px solid #E1EEFF;
}
.line li{height:23px;line-height:23px}
.line .l{width:40%;float:left;}
.line .r{width:50%;float:left}
.clear{clear:both;height:1px;}


</style>
<script>
    function InnerHtml(i,msg) {
       eval("d"+i+".innerHTML = '"+msg+"';");
       document.getElementById('uptips').scrollTop = (i+1)*23;
    }
</script>
</head>
<body class="tdbg">
  
   <%if (KSCMS.S("action") == "begindown")
     {
         %>
       <div id="downstep1" style="font-size:20px;margin:40px;text-align:center;padding-top:70px;font-weight:bold;color:green;">
          <img src="../../sysimg/default/loading.gif" /> 正在初始化下载任务，请稍候......
       </div>
       <div id="downstep2" style="display:none;margin:40px;text-align:center;">
          <div style="font-size:16px;height:35px;line-height:35px;font-weight:bold" id="per">下载进度：0%</div> 
          <div style="margin:0 auto;width:700px;border:1px dashed #ccc;background:#fff;height:20px">
             <div id="bar" style="width:0px;height:20px;background:#0094ff"></div>
          </div>
           <div style="height:40px;font-size:16px;line-height:40px">
           补丁包大小：<span id="totalSize" style="color:brown;font-weight:bold">0</span> 当前已下载：<span id="currSize" style="color:brown;font-weight:bold">0</span>
           </div>
       </div> 
       
       <div style="text-align:center;display:none" id="downstep3">
        <input type='button' onclick="location.href='KS.Update.aspx?action=beginUpdate&id=<%=Utils.StrToInt(KSCMS.S("id"))%>';" value=" 立即更新 " class="button"/>
        <input type="button" value=" 暂不升级 " class="button" onclick="top.box.close();"/>
       </div>

        <script>
            function Start() {
               // $("#downstep2").show();
               // $("#downstep1").hide();
            }
            function SetProcess(data) {
                 $("#downstep2").show();
                $("#downstep1").hide();
                var arr = data.split('|');
                var total = "";
                var hasdown = "";
                if (arr[0] / 1024 > 1024) {
                    total = (arr[0] / 1024 / 1024).toFixed(2) + " M";
                } else {
                   total = (arr[0] / 1024).toFixed(0) + " KB";
                }
                if (arr[1] / 1024 > 1024) {
                    hasdown = (arr[1] / 1024 / 1024).toFixed(2) + " M";
                } else {
                    hasdown = (arr[1] / 1024).toFixed(0) + " KB";
                }
                $("#totalSize").html(total);
                $("#currSize").html(hasdown);
                var w = parseFloat(arr[1]) / parseFloat(arr[0]);
                if (w < 1) {
                    $("#per").html("下载进度：" + (w * 100).toFixed(2) + " %");
                } else {
                    $("#per").html("任务完成：100 %");
                }
                $("#bar").html('').width(w * 700);
            }
            function End() {
                $('#downstep3').show();
                $("#per").html("任务完成：100 %");
            }
            
        </script>
        <%
              
                dobegindown();

            }
            else if (KSCMS.S("action") == "beginUpdate")
            {
                beginUpdate();

            }else
            {%>
      <%=sb.ToString()%>
  <%} %>
</body>
</html>