{template nheader.html}
<script type="text/javascript">
    $(function() {
        dr_set_type(0);
    });
    function dr_set_type(id) {
        {loop $ci->app $i $n}
        $('.dr_app_{$i}').hide();
        {/loop}
        $('.dr_app_'+id).show();
    }
    function dr_save_add_data() {
        $.ajax({
            type: "POST",
            dataType:"json",
            url: '{dr_url("syscontroller/add")}&post=1',
            data: $("#myform").serialize(),
            success: function(data) {
                if (data.status == 1) {
                    dr_tips(data.code, 3, 1);
                   window.location.href = "{dr_url('syscontroller/edit')}&id="+data.id;
                } else {
                    dr_tips(data.code);
                    return;
                }
            },
            error: function(HttpRequest, ajaxOptions, thrownError) { }
        });
    }
</script>
<div class="page-bar">
    <ul class="page-breadcrumb mylink">
        {$menu.link}

    </ul>
    <ul class="page-breadcrumb myname">
        {$menu.name}
    </ul>
    <div class="page-toolbar">
        <div class="btn-group pull-right">
            <button type="button" class="btn green btn-sm btn-outline dropdown-toggle" data-toggle="dropdown" aria-expanded="false" data-hover="dropdown"> {fc_lang('操作菜单')}
                <i class="fa fa-angle-down"></i>
            </button>
            <ul class="dropdown-menu pull-right" role="menu">
                {loop $menu.quick $t}
                <li>
                    <a href="{$t.url}">{$t.icon} {$t.name}</a>
                </li>
                {/loop}
                <li class="divider"> </li>
                <li>
                    <a href="javascript:window.location.reload();">
                        <i class="icon-refresh"></i> {fc_lang('刷新页面')}</a>
                </li>
            </ul>
        </div>
    </div>
</div>
<h3 class="page-title">
    <small>{fc_lang('开发者可以在这里快速定义控制器，再按自己的需求完善控制器内容')}</small>
</h3>


<form class="form-horizontal" action="" method="post" id="myform" name="myform">
    <div class="portlet light bordered myfbody">
        <div class="portlet-title">
            <div class="caption">
                <span class="caption-subject font-green sbold uppercase">{fc_lang('自定义控制器')}</span>
            </div>
        </div>
        <div class="portlet-body">
            <div class="portlet-body form">
                <div class="form-body">

                    <div class="form-group">
                        <label class="col-md-2 control-label">{fc_lang('名称')}：</label>
                        <div class="col-md-9">
                            <label><input type="text" class="form-control" onblur="d_topinyin('cname','name');" id="dr_name" name="data[name]" value="{$data['name']}"></label>
                            <span class="help-block">{fc_lang('给它一个描述名称')}</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">{fc_lang('控制器名')}：</label>
                        <div class="col-md-9">
                            <label><input type="text" class="form-control" id="dr_cname" name="data[cname]" value="{$data['cname']}"></label>
                            <span class="help-block">{fc_lang('只能由英文字母、数字组成')}</span>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">{fc_lang('类型')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">
                                {loop $ci->app $i $n}
                                <label class="radio-inline"><input type="radio" name="app" onclick="dr_set_type({$i})" value="{$i}" {if $i == 0}checked{/if} /> {$n}</label>
                                {/loop}
                            </div>
                        </div>
                    </div>
                    <div class="form-group dr_app_0" style="display: none">
                        <label class="col-md-2 control-label">{fc_lang('文件')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">
                                <label class="radio-inline"><input type="radio" name="data[type][0]" value="0" /> {fc_lang('前台')}</label>
                                <label class="radio-inline"><input type="radio" name="data[type][0]" value="2" /> {fc_lang('后台')}</label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group dr_app_1" style="display: none">
                        <label class="col-md-2 control-label">{fc_lang('文件')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">
                                <label class="radio-inline"><input type="radio" name="data[type][1]" value="1" /> {fc_lang('会员')}</label>
                                <label class="radio-inline"><input type="radio" name="data[type][1]" value="2" /> {fc_lang('后台')}</label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group dr_app_2" style="display: none">
                        <label class="col-md-2 control-label">{fc_lang('模块')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">
                                {loop $dir $n}
                                <label class="radio-inline"><input type="radio" id="dir" name="dir" value="{$n}" /> {$n}</label>
                                {/loop}
                            </div>
                        </div>
                    </div>
                    <div class="form-group dr_app_2" style="display: none">
                        <label class="col-md-2 control-label">{fc_lang('文件')}：</label>
                        <div class="col-md-9">
                            <div class="radio-list">
                                <label class="radio-inline"><input type="radio" name="data[type][2]" value="0" /> {fc_lang('前台')}</label>
                                <label class="radio-inline"><input type="radio" name="data[type][2]" value="1" /> {fc_lang('会员')}</label>
                                <label class="radio-inline"><input type="radio" name="data[type][2]" value="2" /> {fc_lang('后台')}</label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">{fc_lang('SEO标题')}：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control"  name="data[meta_title]" value="{$data['meta_title']}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">{fc_lang('SEO关键字')}：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control"  name="data[meta_keywords]" value="{$data['meta_keywords']}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-md-2 control-label">{fc_lang('SEO描述信息')}：</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control"  name="data[meta_description]" value="{$data['meta_description']}">
                        </div>
                    </div>


                </div>
            </div>

        </div>
    </div>

    <div class="myfooter">
        <div class="row">
            <div class="portlet-body form">
                <div class="form-body">
                    <div class="form-actions">
                        <div class="row">
                            <div class="col-md-12 text-center">
                                <button type="button" onclick="dr_save_add_data()" class="btn green"> <i class="fa fa-save"></i> {fc_lang('保存')}</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
{template nfooter.html}