{template "install/header.html"}

<div class="portlet light">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-edit font-green"></i>
            <span class="caption-subject font-green">网站信息</span>
        </div>
    </div>
    <div class="portlet-body ">
        <div class="scroller" style="height:300px" data-rail-visible="1">
            <form action="#" id="myform" class="form-horizontal form-bordered ">
                {dr_form_hidden()}
                <div class="form-body">
                    <div class="form-group">
                        <label class="control-label col-md-3">网站名称</label>
                        <div class="col-md-7">
                            <input type="text" name="data[name]" value="我的网站" class="form-control" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">创始人邮箱</label>
                        <div class="col-md-7">
                            <input type="text" name="data[email]" value="admin@admin.com" class="form-control" placeholder="此项必填">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">创始人账号</label>
                        <div class="col-md-7">
                            <input type="text" name="data[username]" value="admin" class="form-control" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">创始人密码</label>
                        <div class="col-md-7">
                            <input type="text" name="data[password]" value="admin" class="form-control" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">数据库地址</label>
                        <div class="col-md-7">
                            <input type="text" name="data[db_host]" value="127.0.0.1" class="form-control" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">数据库账号</label>
                        <div class="col-md-7">
                            <input type="text" name="data[db_user]" value="" class="form-control" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">数据库密码</label>
                        <div class="col-md-7">
                            <input type="text" name="data[db_pass]" value="" class="form-control" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">数据库名称</label>
                        <div class="col-md-7">
                            <input type="text" name="data[db_name]" value="" class="form-control" placeholder="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-3">数据表前缀</label>
                        <div class="col-md-7">
                            <input type="text" name="data[db_prefix]" value="dr_" class="form-control" placeholder="">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="control-label col-md-3">安装测试数据</label>
                        <div class="col-md-7">
                            <div class="mt-radio-inline">
                                <label class="mt-radio">
                                    <input type="radio" name="is_install_db" value="1" checked=""> 安装
                                    <span></span>
                                </label>
                                <label class="mt-radio">
                                    <input type="radio" name="is_install_db" value="0"> 不安装
                                    <span></span>
                                </label>
                            </div>
                            <p class="help-block"> 新手建议选择安装测试数据，方便快速入门 </p>
                        </div>
                    </div>

                </div>

            </form>
        </div>
    </div>
    <div class="portlet-title" style="min-height: 18px;"></div>
    <div class="portlet-body text-center">
        <a href="javascript:dr_next_install();" type='submit' class="btn btn-success"> 下一步安装 </a>
    </div>
    <div class="portlet-body text-center" id="dr_loading" style="display: none; color:blue;">
        正在安装中（这个过程一般不超过30秒）...
    </div>
</div>
<script>
    function dr_next_install() {
        var loading = layer.load(2, {
            shade: [0.3,'#fff'], //0.1透明度的白色背景
            time: 100000000
        });
        $('#dr_loading').show();
        $.ajax({type: "POST",dataType:"json", url: '{dr_now_url()}', data: $("#myform").serialize(),
            success: function(json) {
                if (json.code == 1) {
                    window.location.href = json.msg;
                } else {
                    layer.close(loading);
                    layer.alert(json.msg);
					$('#dr_loading').hide();
                }
            },
            error: function(HttpRequest, ajaxOptions, thrownError) {
                layer.closeAll('loading');
                $('#dr_loading').hide();
                layer.open({
                    type: 1,
                    title: "系统故障",
                    fix:true,
                    shadeClose: true,
                    shade: 0,
                    area: ['50%', '50%'],
                    content: "<div style=\"padding:10px;\">"+HttpRequest.responseText+"</div>"
                });
            }
        });
    }
</script>
{template "install/footer.html"}