<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="createAllMinImg.aspx.cs" Inherits="ZYDN.Web.system.sysSetup.createAllMinImg" %>


<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>重新生成所有缩略图</title>
    <link rel="stylesheet" type="text/css" href="../skins/css/main.css" />
	<link rel="stylesheet" type="text/css" href="../skins/css/Sys.css" />
	<link rel="stylesheet" type="text/css" href="css/filesManage.css" />
    <script language="javascript" type="text/javascript" src="../js/JFramework.js"></script>
    <script language="javascript" type="text/javascript" src="../js/sys.js"></script>
    <script language="javascript" type="text/javascript" >
        var objAjax=new JAjax();
        var fileList=null;
        var i=0;
        var x=0;
        
        
        function loadPage(){
//            var objResponse=new JHttpResponse();
//		    objResponse.write("",idlist+"");
	    	var out=objAjax.getText("post","?type=readList",null,null);
	    	out=  comminute(out,c1,c2);
	    	fileList=out;
	    	infoDiv.innerHTML="有"+(out.length-1)+"个图片可以重新生成略图,你要这么作吗?"
	    	
        }
        
        function statCreateMimg(){
            if (i>=fileList.length-1){
                if (x==0){
                    alert("生成操作全部完成"); 
                }else{
                      alert("生成操作全部完成, \n但生成过程中发生"+x+"次错误"); 
                }
                return;
            }
            infoDiv.innerHTML="已经生成 "+(i+1)+" 个略图, 完成 "+parseInt((i+1)/(fileList.length-1)*100)+"%";
            var objResponse=new JHttpResponse();
		    objResponse.write("id",fileList[i][0]);
	    	var out=objAjax.getText("post","?type=create",objResponse,null);
	    	
            if (out!="1"){
                if (out.indexOf("文件读入失败")!=-1){
                   erDiv.innerHTML=erDiv.innerHTML+"<br>错误:"+ out;
                    
                }else{
                    erDiv.innerHTML=erDiv.innerHTML+"<br>错误:"+ out;
                }
                x++;
            }
            i++;   
            setTimeout("statCreateMimg()",100);
        }
        
        
        function setImg(){
            	parent.win.pCreate("p-imgSetup","","",true);
        }
    </script>
</head>
<body onload="loadPage()">
    <center>
        <br>
        <div id="infoDiv">
        </div>
        <input type="button" value="开始生成" onclick="statCreateMimg();"/>
        <input type="button" value="设置略图"  onclick="setImg();"/>
        <div id="erDiv" style="width:450px;height:250px; overflow:scroll;">
        </div>
    </center>
</body>
</html>
