{template "header.html"}
<div class="note note-danger">
    <p><a href="javascript:dr_update_cache();">{dr_lang('更改数据之后需要更新缓存之后才能生效')}</a></p>
</div>

<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <div class="portlet bordered light myfbody">
        <div class="portlet-title tabbable-line">
            <ul class="nav nav-tabs" style="float:left;">
                {loop $module $i $t}
                <li class="{if $page==$i}active{/if}">
                    <a href="#tab_{$i}" data-toggle="tab" onclick="$('#dr_page').val('{$i}')"> <i class="{dr_icon($t.icon)}"></i> {$t.name} </a>
                </li>
                {/loop}
            </ul>
        </div>
        <div class="portlet-body">
            <div class="tab-content">


                {loop $module $i $m}
                <div class="tab-pane {if $i == $page}active{/if}" id="tab_{$i}">
                    <div class="form-body">


                        <div class="form-group">
                            <label class="col-md-2 control-label" style="padding-top: 10px;">{dr_lang('搜索功能')}</label>
                            <div class="col-md-9">
                                <input type="checkbox" name="data[{$i}][use]" value="1" {if $m['setting']['search']['use']}checked{/if} data-on-text="{dr_lang('开启')}" data-off-text="{dr_lang('关闭')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">

                                <span class="help-block">{dr_lang('选择关闭将不能进行内容搜索')}</span>
                            </div>
                        </div>

                        <div class="form-group dr_search">
                            <label class="col-md-2 control-label">{dr_lang('集成栏目页')}</label>
                            <div class="col-md-9">
                                <input type="checkbox" name="data[{$i}][catsync]" value="1" {if $m['setting']['search']['catsync']}checked{/if} data-on-text="{dr_lang('开启')}" data-off-text="{dr_lang('关闭')}" data-on-color="success" data-off-color="danger" class="make-switch" data-size="small">
                                <span class="help-block">{dr_lang('开启之后访问栏目页会定向到搜索页面，使栏目模板无效')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_search">
                            <label class="col-md-2 control-label">{dr_lang('关键词匹配字段')}</label>
                            <div class="col-md-9">
                                <input class="form-control input-xlarge" type="text" name="data[{$i}][field]" value="{if $m['setting']['search']['field']}{$m['setting']['search']['field']}{else}title,keywords{/if}" >
                                <span class="help-block">{dr_lang('默认关键词匹配字段是title,keywords，只能设置主表字段，以逗号分隔')}</span>
                            </div>
                        </div>

                        <div class="form-group dr_search">
                            <label class="col-md-2 control-label">{dr_lang('最大搜索量')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control" type="text" name="data[{$i}][total]" value="{if isset($m['setting']['search']['total'])}{$m['setting']['search']['total']}{else}500{/if}" ></label>
                                <span class="help-block">{dr_lang('指搜索时最大显示的数据量，填写0表示全部显示（不建议填写0，一般用户只会看前几页）')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_search">
                            <label class="col-md-2 control-label">{dr_lang('最小关键字长度')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control" type="text" name="data[{$i}][length]" value="{if $m['setting']['search']['length']}{$m['setting']['search']['length']}{else}4{/if}" ></label>
                                <span class="help-block">{dr_lang('搜索关键字最小字符长度，一个汉字占两位')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_search">
                            <label class="col-md-2 control-label">{dr_lang('搜索参数连接符号')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control" type="text" name="data[{$i}][param_join]" value="{if $m['setting']['search']['param_join']}{$m['setting']['search']['param_join']}{else}-{/if}" ></label>
                                <span class="help-block">{dr_lang('用于伪静态时搜索参数的连接，默认-，例如: 字段1-值-字段2-值')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_search">
                            <label class="col-md-2 control-label">{dr_lang('搜索参数字符串规则')}</label>
                            <div class="col-md-9">
                                <div class="mt-radio-inline">
                                    <label class="mt-radio"><input onclick="$('.param_rule_{$i}_0').hide();$('.param_rule_{$i}_1').show()" type="radio" name="data[{$i}][param_rule]" value="1" {if $m['setting']['search']['param_rule']}checked{/if} /> {dr_lang('固定匹配')} <span></span></label>
                                    <label class="mt-radio"><input onclick="$('.param_rule_{$i}_0').show();$('.param_rule_{$i}_1').hide()" type="radio" name="data[{$i}][param_rule]" value="0" {if !$m['setting']['search']['param_rule']}checked{/if} /> {dr_lang('自由组合')} <span></span></label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group dr_search param_rule_{$i}_0" style="display: none;">
                            <label class="col-md-2 control-label">{dr_lang('自由组合字段映射关系')}</label>
                            <div class="col-md-9">
                                <textarea class="form-control" rows="7" name="data[{$i}][param_field]">{$m['setting']['search']['param_field']}</textarea>
                                <span class="help-block">{dr_lang('字段映射是指伪静态时将搜索字段重新命名，例如keyword|k: 意思是把k作为keyword，多个字段映射回车符号分隔')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_search param_rule_{$i}_1" style="display: none;">
                            <label class="col-md-2 control-label">{dr_lang('固定匹配字段参数设置')}</label>
                            <div class="col-md-9">
                                {php $c=0;}
                                {loop $m.search_field $k1 $f1}
                                <label><select name="data[{$i}][param_join_field][{$c}]" class="form-control">
                                    <option value="">-</option>
                                    {loop $m.search_field $k $f}
                                    <option value="{$k}" {if $k == $m['setting']['search']['param_join_field'][$c]} selected{/if}>{$f}</option>
                                    {/loop}
                                </select></label>
                                {php $c++;}
                                {/loop}
                                <span class="help-block">{dr_lang('由一组固定的字符串参数作为搜索变量，例如：栏目id-城市-分类-关键词-排序-分页.html')}</span>
                            </div>
                        </div>
                        <div class="form-group dr_search param_rule_{$i}_1" style="display: none;">
                            <label class="col-md-2 control-label">{dr_lang('匹配字段默认填充值')}</label>
                            <div class="col-md-9">
                                <label><input class="form-control" type="text" name="data[{$i}][param_join_default_value]" value="{if $m['setting']['search']['param_join_default_value']}{$m['setting']['search']['param_join_default_value']}{else}0{/if}" ></label>
                                <span class="help-block">{dr_lang('搜索变量为空时的填充值，例如：0-0-0-关键词-排序-分页.html')}</span>
                            </div>
                        </div>
                        <script>
                            $('.param_rule_{$i}_{intval($m['setting']['search']['param_rule'])}').show();
                        </script>

                    </div>
                </div>
                {/loop}





            </div>
        </div>
    </div>

    <div class="portlet-body form myfooter">
        <div class="form-actions text-center">
            <button type="button" onclick="dr_ajax_submit('{dr_now_url()}&page='+$('#dr_page').val(), 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存')}</button>
        </div>
    </div>
</form>



{template "footer.html"}