{template "header.html"}

<div class="note note-danger">
    <p>{dr_lang('添加快捷菜单可以出现在后台首页之中，方便快速进入管理')}</p>
</div>

<form action="" class="form-horizontal" method="post" name="myform" id="myform">
    {dr_form_hidden()}
    <input type="hidden" id="dr_color" name="data[color]" value="{$admin.color}">
    <div class="row myfbody">
        <div class="col-md-12">

            <div class="portlet light bordered">
                <div class="portlet-title">
                    <div class="caption">
                        <span class="caption-subject font-green">{dr_lang('资料修改')}</span>
                    </div>
                </div>
                <div class="portlet-body form">

                    <div class="form-body">

                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('账号')}</label>
                            <div class="col-md-9">
                                <label class="form-control-static">{$admin.username}</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">
                                    {if $is_post_user}<span class="label label-danger">{dr_lang('投稿者')}</span>{else}<span class="label label-success">{dr_lang('管理者')}</span>{/if}
                                </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">
                                    {loop $admin.role $t}
                                    <span class="label label-success"> {$t} </span>&nbsp;
                                    {/loop}
                                </label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('登录密码')}</label>
                            <div class="col-md-9">
                                <label><input type="text" class="form-control input-large" name="password"></label>
                                <span class="help-block"> {dr_lang('留空表示不修改密码')} </span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('快捷链接')}</label>
                            <div class="col-md-9">
                                <div class="form-control-static">
                                    <a class="btn green btn-xs" title="{dr_lang('添加')}" href="javascript:;" onClick="add_menu()"> <i class="fa fa-plus"></i> </a>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div class="col-md-offset-2 col-md-10">
                                <div id="menu_body">
                                    {if !empty($admin['usermenu'])}
                                    {loop $admin['usermenu'] $k $t}
                                    <div class="menu-sort">
                                        <label><i class="fa fa-arrows"></i></label><label><input class="form-control" type="text" name="data[usermenu][name][{$k}]" value="{htmlspecialchars($t['name'])}" /></label><label><select class="form-control" name="data[usermenu][color][{$k}]">
                                                {loop $color $tt}
                                                <option value="{$tt}" {if $tt == $t['color']} selected{/if}> {$tt} </option>
                                                {/loop}
                                            </select></label><label><select class="form-control" name="data[usermenu][target][{$k}]">
                                        {loop $target $ii $tt}
                                        <option value="{$ii}" {if $ii == $t['target']} selected{/if}> {$tt} </option>
                                        {/loop}
                                    </select></label><label><input class="form-control input-large" type="text" name="data[usermenu][url][{$k}]" value="{htmlspecialchars($t['url'])}" /></label><label><a class="btn red btn-xs" title="{dr_lang('删除')}" href="javascript:;" onClick="remove_menu(this)"> <i class="fa fa-trash"></i> </a></label>
                                    </div>
                                    {/loop}
                                    {/if}
                                </div>
                            </div>
                        </div>
                        {if $oauth_data}
                        <div class="form-group">
                            <label class="col-md-2 control-label">{dr_lang('快捷登录')}</label>
                            <div class="col-md-4">
                                <ul class="list-group">
                                {loop $oauth_data $name}
                                <li class="list-group-item">
                                    <img src="{THEME_PATH}assets/oauth/{$name}.png">
                                    {dr_html2emoji($oauth_list[$name]['nickname'])}
                                    {if $oauth_list[$name]}
                                    <a style="margin-top: 5px;" target="_blank" href="{dr_url('api/alogin', ['id' => $admin.uid, 'url' => dr_member_url('account/oauth')])}" class="badge badge-danger"> <i class="fa fa-user-times"></i> 解绑</a>
                                    {else}
                                    <a style="margin-top: 5px;"  target="_blank" href="{dr_url('api/alogin', ['id' => $admin.uid, 'url' => dr_member_url('account/oauth')])}" class="badge badge-success"> <i class="fa fa-user-plus"></i> 绑定</a>
                                    {/if}
                                </li>
                                {/loop}
                                </ul>
                            </div>
                        </div>
                        {/if}

                        <div class="form-group" id="dr_row_code">
                            <label class="col-md-2 control-label">{dr_lang('验证码')}</label>
                            <div class="col-md-4">
                                <div class="input-group" style="width:300px;">
                                    <div class="input-icon">
                                        <input style="padding-left: 5px !important;"type="text" class="form-control placeholder-no-fix" autocomplete="off" placeholder="{dr_lang('验证码')}" name="code" id="dr_code" >
                                    </div>
                                    <div class="input-group-btn fc-code" style="border-radius: 0 4px 0 0;">
                                        {dr_code(120, 35)}
                                    </div>
                                </div>
                            </div>
                        </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()}', 'myform', '2000')" class="btn green"> <i class="fa fa-save"></i> {dr_lang('保存内容')}</button>
        </div>
    </div>
</form>

<script type="text/javascript">
    function add_menu() {
        var color = '{$select_color}';
        var target = '{$select_target}';
        var data = '<div class="menu-sort"><label><i class="fa fa-arrows"></i></label><label><input class="form-control" placeholder="{dr_lang('名称')}" type="text" name="data[usermenu][name][]" /></label><label><select class="form-control" name="data[usermenu][color][]">'+color+'</select></label><label><select class="form-control" name="data[usermenu][target][]">'+target+'</select></label><label><input placeholder="{dr_lang('URL')}" class="form-control  input-large" type="text" name="data[usermenu][url][]" /></label><label><a class="btn red btn-xs" title="{dr_lang('删除')}" href="javascript:;" onClick="remove_menu(this)"> <i class="fa fa-trash"></i> </a></label></div>';
        $('#menu_body').append(data);
    }
    function remove_menu(_this) {
        $(_this).parent().parent().remove();
    }
    $("#menu_body").sortable({
        items: "div"
    });
</script>
{template "footer.html"}