<extend name="Public/base" />

<block name="body">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<script type="text/javascript" src="__STATIC__/layer/layer.js"></script>
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
    
    
    <div class="cf main-place top_nav_list navtab_list">
        <h3 class="page_title">编辑友情链接</h3>
        <p class="description_text"></p>
    </div>
    
    <!-- 标签页导航 -->
<div class="tab-wrap">
    
    <div class="tab-content tabcon1711 tabcon17112">
    <!-- 表单 -->
    <form id="form" action="{:U('edit?id='.$data['id'])}" method="post" class="form-horizontal">
        <!-- 基础文档模型 -->
        <div id="tab1" class="tab-pane in tab1">
            <table  border="0" cellspacing="0" cellpadding="0">
                <tbody>
                <tr>
                    <td class="l"><i class="mustmark" style="margin-left:-7px">*</i>所属后台:</td>
                    <td class="r">
                        <select name="mark" id="mark">
                            <option value="0" <if condition="($data['mark'] eq 0)"> selected = "selected"</if>>媒体官网</option>
                           
                        </select>
                    </td>
                </tr>
                  <tr>
                    <td class="l"><i class="mustmark" style="margin-left:-7px">*</i>友链标题:</td>
                    <td class="r">
                       <input type="text" name='title' style="width:333px" value='{$data.title}'>
                    </td>
                    </tr>
                    <tr>
                    <td class="l"><i class="mustmark" style="margin-left:-7px">*</i>友链URL:</td>
                    <td class="r">
                       <input type="text" name='link_url' style="width:333px" value='{$data.link_url}'>
                    </td>
                    </tr>
                    <tr>
                    <td class="l">友链备注:</td>
                    <td class="r">
                        <textarea name="remark" class="txt_area1" >{$data.remark}</textarea>
                    </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="form-item cf">
            <button class=" submit_btn ajax-post mlspacing" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <a class="submit_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();" >
              返回
          </a>
        </div>
    </form>
    </div>
</div>


<div class="common_settings">
			<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
			<form class="addShortcutIcon">
				<input type="hidden" name="title" value="{$m_title}">
				<input type="hidden" name="url" value="Site/media">
			</form>
			<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
		</div>

</block>

<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Site/media')}');
$('#submit').click(function(){
    $('#form').submit();
});

$(function(){
    $("#game_name").val($("#game_id option:selected").text());
    
    $('.date').datetimepicker({
        format: 'yyyy-mm-dd',
        language:"zh-CN",
        minView:2,
        autoclose:true
    });
    $('.time').datetimepicker({
    language:"zh-CN",
     hour: 13,
       minute: 15
    });
    showTab();
    
});

/*获取游戏名称*/
$("#game_id").change(function() {
    $("#game_name").val($("#game_id option:selected").text());
});

/*获取区服名称*/
$("#server_id").change(function() {
    $("#server_name").val($("#server_id option:selected").text());
});
var url = "{:U('Giftbag/get_ajax_area_list')}";
$("#game_id").change(function(){
    fun_ajax($(this).val());
})

function fun_ajax(gid){
    $.ajax({
        type:"post",
        url:url,
        dataType:"json",
        data:{game_id:gid},
        success:function(data){
            fun_html(data);
            $("#server_name").val($("#server_id option:selected").text());
        },
        error:function(){
            layer.msg('服务器异常',{icon:5});
        }
    })
}



function fun_html(data){
    var area='';
    if(data == null){
        $("#area_id").html('<option value="">请选择区服</option>');
    }else{
        for (var i = 0; i<data.length; i++){
            area+='<option value="'+data[i]['id']+'">'+data[i]['server_name']+'</option>';
        }
        $("#server_id").html(area);
    }
}
</script>
</block>