{template "install/header.html"}

<div class="portlet light">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-laptop font-green"></i>
            <span class="caption-subject font-green">正在安装数据结构</span>
        </div>
    </div>
    <div class="portlet-body " style="">
        <div class="scroller" style="height:300px" data-rail-visible="1">

            {if $error}
            <div class="scroller" style="height:300px;" data-rail-visible="1">
                {nl2br($error)}
            </div>
            {else}
			<div class="scroller" style="height:300px; font-size: 12px;" data-rail-visible="1" id="dr_check_html">
                <p>正在执行安装程序</p>
            </div>
            <script>
			$(function(){
				dr_ajax2ajax(1);
			});
			function dr_ajax2ajax(page) {
				$.ajax({
					type: "GET",
					dataType: "json",
					url: "{$do_url}&page="+page,
					success: function (json) {

						$('#dr_check_html').append("<p>"+json.msg+"</p>");
						document.getElementById('dr_check_html').scrollTop = document.getElementById('dr_check_html').scrollHeight;

						if (json.code == 0) {
                            $('#dr_check_html').append("<p style='color:red'>出现故障："+json.msg+"</p>");
                            return;
						} else {
							if (json.data.page == 99 ) {
								// 完成 
								var loading = layer.load(2, {
									shade: [0.3,'#fff'], //0.1透明度的白色背景
									time: 100000000
								});
								window.location.href = "{$next_url}";
							} else {
								dr_ajax2ajax(json.data.page);
							}
						}
					},
					error: function(HttpRequest, ajaxOptions, thrownError) {
						dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError);
                        $('#dr_check_html').append("<p style='color:red'>出现故障："+HttpRequest.responseText+"</p>");
					}
				});
			}
            
            </script>
            {/if}

    </div>
    </div>
    <div class="portlet-title" style="min-height: 18px;">
    </div>
    <div class="portlet-body text-center">
        {if $error}
        <a href="{$pre_url}" class="btn btn-success"> 返回上一步 </a>
        {/if}
    </div>
</div>
{template "install/footer.html"}