{template "header.html"}
<script>
$(function () {
    if (top.$("body").hasClass('page-admin-min') == true) {
        $("#dr_tpl_tab").hide();
    }
    {if $is_scategory}
    dr_tid({intval($data.tid)});
    {else}
    dr_tid(1);
    {/if}
});

function dr_select_tpl(file, name) {
    $('.'+name).val(file);
}
function dr_tid(i) {
    $('.dr_tid_0').hide();
    $('.dr_tid_1').hide();
    $('.dr_tid_2').hide();
    $('.dr_tid_'+i).show();
}
    function dr_update_category_cache() {
        var index = layer.load(2, {
            shade: [0.3,'#fff'], //0.1透明度的白色背景
            time: 10000000
        });
        $.ajax({type: "GET",dataType:"json", url: admin_file+"?s=module&c=api&m=update_category_cache&mid={APP_DIR}",
            success: function(json) {
                layer.close(index);
                dr_cmf_tips(json.code, json.msg);
            },
            error: function(HttpRequest, ajaxOptions, thrownError) {
                layer.closeAll('loading');
                dr_tips(0, "{dr_lang('更新失败，请检查错误日志')}");
            }
        });
    }
</script>

{if !isset($_GET['isedit'])}
<div class="note note-danger">
    <p><a href="javascript:dr_update_category_cache();">{dr_lang('变更栏目属性之后，需要一键更新栏目配置信息')}</a></p>
</div>
{/if}


<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <input type="hidden" name="system[show]" value="{if $data['show']}1{else}0{/if}">
    <input type="hidden" name="system[setting][disabled]" value="{if $data['setting']['disabled']}1{else}0{/if}">
    <div class="myfbody">
    <div class="portlet bordered light ">
        {if !isset($_GET['isedit'])}
        <div class="portlet-title tabbable-line">
            <ul class="nav nav-tabs" style="float:left;">
                <li class="{if $page==0}active{/if}">
                    <a href="#tab_0" data-toggle="tab" onclick="$('#dr_page').val('0')"> <i class="fa fa-cog"></i> {dr_lang('基本设置')} </a>
                </li>
                {if $sysfield || $myfield || $diyfield}
                <li class="{if $page==1}active{/if}">
                    <a href="#tab_1" data-toggle="tab" onclick="$('#dr_page').val('1')"> <i class="fa fa-table"></i> {dr_lang('属性设置')} </a>
                </li>
                {/if}
                {if $is_seo}
                <li class="{if $page==3}active{/if}">
                    <a href="#tab_3" data-toggle="tab" onclick="$('#dr_page').val('3')"> <i class="fa fa-internet-explorer"></i> {dr_lang('SEO优化')} </a>
                </li>
                {/if}
                <li class="{if $page==4}active{/if}">
                    <a href="#tab_4" data-toggle="tab" onclick="$('#dr_page').val('4')"> <i class="fa fa-html5"></i> {dr_lang('模板设置')} </a>
                </li>
            </ul>
        </div>
        <div class="portlet-body">
        {else}
        <div class="portlet-body" style="margin-top: -30px;{if IS_PC}margin-left: -30px{/if}">
        {/if}
            <div class="tab-content">

                <div class="tab-pane {if $page==0}active{/if}" id="tab_0">
                    <div class="form-body">

                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('所属栏目')}</label>
                            <div class="col-md-9">
                                <label>{str_replace('data[', 'system[', $select)}</label>
                            </div>
                        </div>

                        {if $is_scategory}
                        <div class="form-group r1">
                            <label class="col-md-2 control-label">{dr_lang('栏目类型')}</label>
                            <div class="col-md-9">
                                <div class="mt-radio-inline">
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[tid]" value="0" onclick="dr_tid(0)" {if !$data.tid} checked{/if} /> {dr_lang('单网页')} <span></span></label>
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[tid]" value="1" onclick="dr_tid(1)" {if $data.tid==1} checked{/if} /> {dr_lang('内容模块')} <span></span></label>
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[tid]" value="2" onclick="dr_tid(2)" {if $data.tid==2} checked{/if} /> {dr_lang('外部地址')} <span></span></label>
                                </div>
                            </div>
                        </div>
                        {/if}
                        {if $module.share}
                        <div class="form-group dr_tid_1 " style="display: none">
                            <label class="col-md-2 control-label">{dr_lang('共享模块')}</label>
                            <div class="col-md-9">
                                <label>
                                    <select class="form-control" name="system[mid]">
                                    <option value=""> -- </option>
                                    {loop $module_share $t}
                                    {if $t.share}
                                    <option value="{$t.dirname}" {if $t.dirname==$data['mid']}selected{/if}> {dr_lang($t.name)} </option>
                                    {/if}
                                    {/loop}
                                    </select>
                                </label>
                                {if $ci->_is_admin_auth('module/module/index')}
                                <span class="help-block"><a href="{dr_url('module/module/index')}">{dr_lang('在这里可以创建更多的共享模块')}</a></span>
                                {/if}
                            </div>
                        </div>
                        {/if}
                        <div class="form-group " id="dr_row_name">
                            <label class="col-md-2 control-label">{dr_lang('栏目名称')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control input-large" type="text" name="system[name]" value="{htmlspecialchars((string)$data.name)}" id="dr_name" onblur="d_topinyin('dirname','name', 1);"></label>
                                <span class="help-block" id="dr_name_tips">{dr_lang('栏目的一个显示名称')}</span>
                            </div>
                        </div>
                        <div class="form-group " id="dr_row_dirname">
                            <label class="col-md-2 control-label">{dr_lang('目录名称')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control input-large" type="text" name="system[dirname]" id="dr_dirname" value="{htmlspecialchars((string)$data.dirname)}"></label>
                                <span class="help-block" id="dr_dirname_tips">{dr_lang('栏目目录确保唯一，用于url填充或者生成目录')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_tid_2 " style="display: none">
                            <label class="col-md-2 control-label">{dr_lang('外链地址')}</label>
                            <div class="col-md-9">
                                <input class="form-control" type="text" name="system[setting][linkurl]" value="{htmlspecialchars((string)$data['setting']['linkurl'])}">
                                <span class="help-block">{dr_lang('可跳转到指定地址（不允许发布内容）')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_tid_0 dr_tid_1">
                            <label class="col-md-2 control-label">{dr_lang('继承下级')}</label>
                            <div class="col-md-9">
                                <div class="mt-radio-inline">
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[setting][getchild]" value="1" {if $data['setting']['getchild']}checked{/if} /> {dr_lang('开启')} <span></span></label>
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[setting][getchild]" value="0" {if empty($data['setting']['getchild'])}checked{/if} /> {dr_lang('关闭')} <span></span></label>
                                </div>
                                <span class="help-block">{dr_lang('将下级第一个栏目数据作为当前的栏目，不对外链类型的栏目有效')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_tid_1">
                            <label class="col-md-2 control-label">{dr_lang('禁止修改')}</label>
                            <div class="col-md-9">
                                <div class="mt-radio-inline">
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[setting][notedit]" value="1" {if $data['setting']['notedit']}checked{/if} /> {dr_lang('开启')} <span></span></label>
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[setting][notedit]" value="0" {if empty($data['setting']['notedit'])}checked{/if} /> {dr_lang('关闭')} <span></span></label>
                                </div>
                                <span class="help-block">{dr_lang('内容发布之后将禁止修改栏目')}</span>
                            </div>
                        </div>

                    </div>
                </div>
                <div class="tab-pane {if $page==3}active{/if}" id="tab_3">
                    <div class="form-body">

                        {if $module.share}
                        {if dr_is_app('chtml')}
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('栏目生成静态')}</label>
                            <div class="col-md-9">
                                <div class="mt-radio-inline">
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[setting][html]" value="1" {if $data['setting']['html']}checked{/if} /> {dr_lang('开启')} <span></span></label>
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[setting][html]" value="0" {if empty($data['setting']['html'])}checked{/if} /> {dr_lang('关闭')} <span></span></label>
                                </div>
                                <span class="help-block">{dr_lang('开启生成静态时必须给它配置URL规则')}</span>
                            </div>
                        </div>        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('内容生成静态')}</label>
                            <div class="col-md-9">
                                <div class="mt-radio-inline">
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[setting][chtml]" value="1" {if $data['setting']['chtml']}checked{/if} /> {dr_lang('开启')} <span></span></label>
                                    <label class="mt-radio mt-radio-outline"><input type="radio" name="system[setting][chtml]" value="0" {if empty($data['setting']['chtml'])}checked{/if} /> {dr_lang('关闭')} <span></span></label>
                                </div>
                                <span class="help-block">{dr_lang('开启生成静态时必须给它配置URL规则')}</span>
                            </div>
                        </div>
                        {/if}
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('URL规则')}</label>
                            <div class="col-md-9">

                                <label>
                                    <select class="form-control" name="system[setting][urlrule]">
                                        <option value="0"> {dr_lang('动态地址')} </option>
                                        {list action=cache name=urlrule return=u}
                                        {if $u.type==3}<option value="{$u.id}" {if $u.id == $data['setting']['urlrule']}selected{/if}> {$u.name} </option>{/if}
                                        {/list}
                                    </select>
                                </label>
                                <label style="margin-left:20px;"><a href="{dr_url('module/urlrule/index', ['hide_menu' => 1])}" style="color:blue !important">{dr_lang('[URL规则管理]')}</a> </label>

                            </div>
                        </div>
                        {/if}

                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('SEO标题')}</label>
                            <div class="col-md-9">
                                <textarea class="form-control " style="height:90px" name="system[setting][seo][list_title]">{$data['setting']['seo']['list_title']}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('SEO关键字')}</label>
                            <div class="col-md-9">
                                <textarea class="form-control " style="height:90px" name="system[setting][seo][list_keywords]">{$data['setting']['seo']['list_keywords']}</textarea>

                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('SEO描述信息')}</label>
                            <div class="col-md-9">
                                <textarea class="form-control " style="height:90px" name="system[setting][seo][list_description]">{$data['setting']['seo']['list_description']}</textarea>

                            </div>
                        </div>
                        {if $id}
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('同步到其他栏目')}</label>
                            <div class="col-md-9">
                                <label><button onclick="dr_iframe('{dr_lang('复制')}', '{dr_url(APP_DIR.'/category/copy_edit')}&at=seo&catid={$id}')" type="button" class="btn green btn-sm"> <i class="fa fa-copy"></i> {dr_lang('同步SEO配置')}</button></label>
                                <label>{dr_lang('把本页的设置数据同步到其他栏目；需要保存之后再同步')}</label>
                            </div>
                        </div>
                        {/if}

                    </div>
                </div>
                <div class="tab-pane {if $page==4}active{/if}" id="tab_4">
                    <div class="form-body">
                        {php $catsync = \Phpcmf\Service::L('cache')->get('module-'.SITE_ID.'-'.$mid, 'setting', 'search', 'catsync');}
                        {if $catsync}
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('列表信息数')}</label>
                            <div class="col-md-9">
                                <label class="form-control-static">
                                    <span class="badge badge-warning badge-roundless"> {dr_lang('已开启搜索集成于栏目，此设置无效')} </span>
                                </label>
                            </div>
                        </div>
                        {else}
                        <div class="form-group dr_tid_1">
                            <label class="col-md-2 control-label">{dr_lang('电脑列表信息数')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control" type="text" value="{intval($data['setting']['template']['pagesize'])}" name="system[setting][template][pagesize]"></label>
                                <span class="help-block">{dr_lang('列表页面每页显示的信息数量，静态生成时调用此参数')}</span>
                            </div>
                        </div>
                        {if SITE_IS_MOBILE || $ci->site_info[SITE_ID]['SITE_AUTO']}
                        <div class="form-group dr_tid_1">
                            <label class="col-md-2 control-label">{dr_lang('手机列表信息数')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control " type="text" value="{intval($data['setting']['template']['mpagesize'])}" name="system[setting][template][mpagesize]"></label>
                                <span class="help-block">{dr_lang('列表页面每页显示的信息数量，静态生成时调用此参数')}</span>
                            </div>
                        </div>
                        {else}
                        <input type="hidden" value="{intval($data['setting']['template']['mpagesize'])}" name="system[setting][template][mpagesize]">
                        {/if}
                        {/if}
                        {if $is_scategory}
                        <div class="form-group dr_tid_0">
                            <label class="col-md-2 control-label">{dr_lang('单网页模板')}</label>
                            <div class="col-md-9">

                                <div class="input-group  input-large">
                                    <input class="form-control dr_page_tpl" type="text" value="{htmlspecialchars((string)$data['setting']['template']['page'])}" name="system[setting][template][page]">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn green dropdown-toggle" data-toggle="dropdown">{dr_lang('选择')}
                                            <i class="fa fa-angle-down"></i>
                                        </button>
                                        {dr_rp($select_tpl, '{name}', 'dr_page_tpl')}
                                    </div>
                                </div>
                                <span class="help-block">{dr_lang('单网页模板默认page.html')}</span>
                            </div>
                        </div>
                        {/if}

                        {if $catsync}

                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('内容列表页模板')}</label>
                            <div class="col-md-9">
                                <label class="form-control-static">
                                    <span class="badge badge-warning badge-roundless"> {dr_lang('已开启搜索集成于栏目，此模板无效')} </span>
                                </label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('内容栏目封面模板')}</label>
                            <div class="col-md-9">
                                <label class="form-control-static">
                                    <span class="badge badge-warning badge-roundless"> {dr_lang('已开启搜索集成于栏目，此模板无效')} </span>
                                </label>
                            </div>
                        </div>
                        {else}
                        <div class="form-group dr_tid_1">
                            <label class="col-md-2 control-label">{dr_lang('内容列表页模板')}</label>
                            <div class="col-md-9">
                                <div class="input-group  input-large">
                                    <input class="form-control dr_list_tpl" type="text" value="{htmlspecialchars((string)$data['setting']['template']['list'])}" name="system[setting][template][list]">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn green dropdown-toggle" data-toggle="dropdown">{dr_lang('选择')}
                                            <i class="fa fa-angle-down"></i>
                                        </button>
                                        {dr_rp($select_tpl, '{name}', 'dr_list_tpl')}
                                    </div>
                                </div>
                                <span class="help-block">{dr_lang('模块栏目列表默认list.html')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_tid_1">
                            <label class="col-md-2 control-label">{dr_lang('内容栏目封面模板')}</label>
                            <div class="col-md-9">

                                <div class="input-group  input-large">
                                    <input class="form-control dr_category_tpl" type="text" value="{htmlspecialchars((string)$data['setting']['template']['category'])}" name="system[setting][template][category]">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn green dropdown-toggle" data-toggle="dropdown">{dr_lang('选择')}
                                            <i class="fa fa-angle-down"></i>
                                        </button>
                                        {dr_rp($select_tpl, '{name}', 'dr_category_tpl')}
                                    </div>
                                </div>
                                <span class="help-block">{dr_lang('默认category.html')}</span>
                            </div>
                        </div>
                        {/if}
                        <div class="form-group dr_tid_1">
                            <label class="col-md-2 control-label">{dr_lang('内容搜索页模板')}</label>
                            <div class="col-md-9">
                                <div class="input-group  input-large">
                                    <input class="form-control dr_search_tpl" type="text" value="{php echo $data['setting']['template']['search'] ? htmlspecialchars($data['setting']['template']['search']) : 'search.html'}" name="system[setting][template][search]">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn green dropdown-toggle" data-toggle="dropdown">{dr_lang('选择')}
                                            <i class="fa fa-angle-down"></i>
                                        </button>
                                        {dr_rp($select_tpl, '{name}', 'dr_search_tpl')}
                                    </div>
                                </div>
                                    <span class="help-block">{dr_lang('默认search.html')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_tid_1">
                            <label class="col-md-2 control-label">{dr_lang('内容详细页模板')}</label>
                            <div class="col-md-9">

                                <div class="input-group  input-large">
                                    <input class="form-control dr_show_tpl" type="text" value="{htmlspecialchars((string)$data['setting']['template']['show'])}" name="system[setting][template][show]">
                                    <div class="input-group-btn">
                                        <button type="button" class="btn green dropdown-toggle" data-toggle="dropdown">{dr_lang('选择')}
                                            <i class="fa fa-angle-down"></i>
                                        </button>
                                        {dr_rp($select_tpl, '{name}', 'dr_show_tpl')}
                                    </div>
                                </div>
                                    <span class="help-block">{dr_lang('默认show.html')}</span>
                            </div>
                        </div>
                        {if $id}
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('同步到其他栏目')}</label>
                            <div class="col-md-9">
                                <label><button onclick="dr_iframe('{dr_lang('复制')}', '{dr_url(APP_DIR.'/category/copy_edit')}&at=tpl&catid={$id}')" type="button" class="btn green btn-sm"> <i class="fa fa-copy"></i> {dr_lang('同步模板配置')}</button></label>
                                <label>{dr_lang('把本页的设置数据同步到其他栏目；需要保存之后再同步')}</label>
                            </div>
                        </div>
                        {/if}
                    </div>
                </div>

                <div class="tab-pane {if $page==1}active{/if}" id="tab_1">
                    <div class="form-body">
                        {$sysfield}
                        {$myfield}
                        {$diyfield}
                    </div>
                </div>

            </div>
        </div>
    </div>
    </div>
        {if !isset($_GET['isedit'])}
    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">
            <label><button type="button" onclick="dr_ajax_submit('{dr_now_url()}&is_self=1&page='+$('#dr_page').val(), 'myform', '2000')" class="btn blue"> <i class="fa fa-save"></i> {dr_lang('保存内容')}</button></label>
            {if !isset($_GET['isedit'])}
            <label><button type="button" onclick="dr_ajax_submit('{dr_now_url()}&page='+$('#dr_page').val(), 'myform', '2000', '{dr_url(APP_DIR.'/category/add')}')" class="btn green"> <i class="fa fa-plus"></i> {dr_lang('保存再添加')}</button></label>
            <label><button type="button" onclick="dr_ajax_submit('{dr_now_url()}&page='+$('#dr_page').val(), 'myform', '2000', '{dr_url(APP_DIR.'/category/index')}')" class="btn yellow"> <i class="fa fa-mail-reply-all"></i> {dr_lang('保存并返回')}</button></label>
            {/if}
            {if $web_url}
            <label><a href="{$web_url}" target="_blank" class="btn dark"> <i class="fa fa-link"></i> {dr_lang('浏览')}</a></label>
            {/if}
        </div>
    </div>  {/if}
</form>

{template "footer.html"}