{template "header.html"}
<div class="note note-danger">
    <p>1、自定义菜单最多包括3个一级菜单，每个一级菜单最多包含5个二级菜单。</p>
    <p>2、一级菜单最多4个汉字，二级菜单最多7个汉字，多出来的部分将会以“...”代替。</p>
</div>

<script src="{THEME_PATH}assets/js/jquery.insert.js" type="text/javascript"></script>
<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {$form}
    <div class="portlet bordered light myfbody">
        <div class="portlet-title">

            <div class="caption">
                <span class="caption-subject font-green "><i class="fa fa-list"></i> 自定义菜单</span>
            </div>
        </div>
        <div class="portlet-body">
            <div class="tab-content">
                <div class="form-body">

                    <div class="form-group" id="dr_row_pid">
                        <label class="col-xs-2 control-label">{dr_lang('菜单级别')}</label>
                        <div class="col-xs-8">
                            <div class="input-group input-xlarge">
                                <label><select name="data[pid]" class="form-control">
                                    <option value="0"> 一级菜单</option>
                                    {loop $menu_top $t}
                                    <option value="{$t.id}" {if $pid== $t.id} selected {/if}> {dr_html2emoji($t.name)}</option>
                                    {/loop}
                                </select></label>
                            </div>
                        </div>
                    </div>
                    <div class="form-group" id="dr_row_name">
                        <label class="col-xs-2 control-label">{dr_lang('菜单名称')}</label>
                        <div class="col-xs-8">
                            <div class="input-group input-xlarge">
                                <input type="text" class="form-control" name="data[name]" value="{dr_html2emoji($name)}" id="dr_name" />
                                <span class="input-group-btn">
                                    <button class="btn green" type="button"  onclick="dr_insert_emoji('name')"> <i class="fa fa-smile-o"></i> 表情</button>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">动作类型</label>
                        <div class="col-xs-8">
                        <div class=" mt-radio-inline">
                            {loop $menu_type $n $v}
                            <label class="mt-radio mt-radio-outline"> {$v}
                                <input type="radio" onclick="dr_menu_type('{$n}')" value="{$n}" {if $type==$n} checked{/if} name="data[type]">
                                <span></span>
                            </label>
                            {/loop}
                        </div>
                        </div>
                    </div>
                    <div class="mytype form-group type_view" style="display: none">
                        <label class="col-md-2 control-label">网页地址</label>
                        <div class="col-md-9">
                            <div class="input-group">
                                <input type="text" class="form-control" name="value_view" value="{$value}" id="dr_value_view" />
                                <div class="input-group-btn dropup">
                                    <button type="button" class="btn green dropdown-toggle" data-toggle="dropdown" tabindex="-1" aria-expanded="false">
                                        <i class="fa fa-angle-up"></i>
                                    </button>
                                    <ul class="dropdown-menu pull-right" role="menu">
                                        {loop $view_url $t}
                                        <li>
                                            <a href="javascript:;" onclick="$('#dr_value_view').val('{$t.value}')"> {$t.name} </a>
                                        </li>
                                        {/loop}
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="mytype form-group type_article_view_limited" style="display: none">
                        <label class="col-md-2 control-label">图文素材</label>
                        <div class="col-md-9">
                            <label><select name="value_article_view_limited" class="form-control">
                                <option value="0"> --</option>
                                {loop $twsc $t}
                                <option value="{$t.article_id}" {if $value== $t.article_id} selected {/if}> {$t.title}</option>
                                {/loop}
                            </select></label>
                            <span class="help-block">只显示已经同步成功的图文素材</span>
                        </div>
                    </div>
                    <div class="mytype form-group type_click" style="display: none">
                        <label class="col-md-2 control-label">小插件</label>
                        <div class="col-md-9">
                            <div class="input-group input-xlarge">
                                <input type="text" class="form-control" name="value_click" value="{$value}" id="dr_value_click" />
                                <div class="input-group-btn dropup">
                                    <button type="button" class="btn green dropdown-toggle" data-toggle="dropdown" tabindex="-1" aria-expanded="false">
                                        <i class="fa fa-angle-up"></i>
                                    </button>
                                    <ul class="dropdown-menu pull-right" role="menu">
                                        {loop $plugin $t}
                                        <li>
                                            <a href="javascript:;" onclick="$('#dr_value_click').val('{$t.value}')"> {$t.name} </a>
                                        </li>
                                        {/loop}
                                    </ul>
                                </div>
                            </div>
                            <div class="alert alert-info input-xlarge margin-top-20">
                                自定义小插件目录为./Plugins/程序名/Run.php
                            </div>
                        </div>
                    </div>

                    <div class="mytype form-group type_login" style="display: none">
                        <label class="col-md-2 control-label">跳转地址</label>
                        <div class="col-md-9">
                                <input type="text" class="form-control" name="value_login" value="{$value}" />
                            <span class="help-block">弹出登录授权之后再跳转的地址，例如会员中心的功能</span>
                        </div>
                    </div>

                    <div class="mytype form-group type_miniprogram" style="display: none">
                        <label class="col-md-2 control-label">小程序appid</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" name="value_miniprogram[appid]" value="{php echo is_array($value) ? $value.appid : '';}" />
                            <span class="help-block">小程序的APPID</span>
                        </div>
                    </div>

                    <div class="mytype form-group type_miniprogram" style="display: none">
                        <label class="col-md-2 control-label">小程序路径</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" name="value_miniprogram[path]" value="{php echo is_array($value) ? $value.path : '';}" />
                            <span class="help-block">例如：pages/lunar/index</span>
                        </div>
                    </div>

                    <div class="mytype form-group type_miniprogram" style="display: none">
                        <label class="col-md-2 control-label">小程序url</label>
                        <div class="col-md-9">
                            <input type="text" class="form-control" name="value_miniprogram[url]" value="{php echo is_array($value) ? $value.url : '';}" />
                            <span class="help-block">不支持小程序的老版本客户端将打开本url。</span>
                        </div>
                    </div>

                </div>
            </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', '{$reply_url}')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存')}</button>
        </div>
    </div>
</form>
<script type="text/javascript">
    $(function(){
        dr_menu_type('{$type}');
    });
    function dr_menu_type(i) {
        $('.mytype').hide();
        $('.type_'+i).show();
    }
</script>
{template "footer.html"}