{template header.html}
<script type="text/javascript">
    function dr_test() {
        $.ajax({
            type: "GET",
            url: "/rewrite-test.html",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.code) {
                    dr_tips(1, data.msg);
                } else {
                    alert('服务器不支持伪静态，首先需要确定服务器支持rewrite模块并开启了，其次需要正确配置上面的方法');
                }
            },
            error: function (msg) {
                alert('服务器不支持伪静态，首先需要确定服务器支持rewrite模块并开启了，其次需要正确配置上面的方法');
            }
        });
    }
    function dr_rewrite_config() {
        $('#dr_write').hide();
        $.ajax({
            type: "GET",
            url: "{dr_url('urlrule/rewrite_add')}",
            dataType: "json",
            success: function (data) {
                if (data.code) {
                    dr_tips(1, data.msg);
                    $('#dr_write').show();
                    $('#dr_code').val(data.data.code);
                    $('#dr_error').html(data.data.error);
                } else {
                    dr_tips(0, data.msg);
                }
            },
            error: function(HttpRequest, ajaxOptions, thrownError) {
                dr_ajax_alert_error(HttpRequest, ajaxOptions, thrownError)
            }
        });
    }
</script>


<div class="note note-danger">
    <p>{dr_lang('当前服务器是：<b>%s</b>', $name)}</p>
</div>

<div class="portlet light bordered">
    <div class="portlet-title">
        <div class="caption">
            <span class="caption-subject font-green sbold">{$name}</span>
        </div>
    </div>
    <div class="portlet-body">
        <p>{$note}</p>
        {if $code}
        <p><textarea class="form-control" style="width:90%; height:{php echo $count * 40;}px;">{$code}</textarea></p>
            {/if}
        <p>伪静态URL解析规则配置文件：/config/rewrite.php </p>
        <p>使用自定义URL之后必须要设置解析规则，否则是无法正常打开页面的</p>
        <p>
            <a href="javascript:;" class="btn red" onClick="dr_test()"> {dr_lang('环境检测')} </a>
            {if $rewrite_config}
            <a href="javascript:;" class="btn green" onClick="dr_rewrite_config()"> {dr_lang('生成解析规则')} </a>
            <a href="javascript:;" class="btn green" onClick="dr_help(642)"> {dr_lang('在线帮助')} </a>
            {/if}
        </p>
    </div>
</div>

<div class="portlet light bordered" id="dr_write" style="display: none">
    <div class="portlet-title">
        <div class="caption">
            <span class="caption-subject font-green sbold">生成结果</span>
        </div>
    </div>
    <div class="portlet-body" id="dr_error" style="color: red">

    </div>
    <div class="portlet-body">
        <textarea class="form-control" id="dr_code" style="width:100%; height:500px;"></textarea>
    </div>
</div>

{template footer.html}