<?php defined('PHPNEW_STATIC_TPL') === false && exit(URL_HOST);?>
<style type="text/css">
    .mytable{}
    .mytable td{width: 20%;}
    .addcat{display: none;}
    input,textarea{color: gray;}
    #dialog {width:490px;height:auto;border:3px solid silver;text-align:center;display:none;position:absolute;z-index:10;background-color: #EAEFE0;}
    .hideid{display: none;}
    .d1{height: 48px; float: left; text-align: center; width: 90%; line-height: 48px; color: white;}
    .catid_news{background-color: #FF8040;}
</style>
<script type="text/javascript">
var jsondata = ($json_array);
var c_asc , c_name, c_tags, deles,c_tpl, i=0;
var catid = readom = 0;
$(function (){
    $('.d1').click(function (){
          if(readom == 0){
            catid = $(this).attr('title');
            if($('input[name="catid"]').val() != catid){
                 if(jsondata[catid]){
                    $('input[name="catid"]').val(jsondata[catid]['lid']);
                    $('input[name="ltitle"]').val(jsondata[catid]['ltitle']);
                    $('input[name="furl"]').val(jsondata[catid]['furl']);   
                        
                    $('textarea[name="lurl"]').val(jsondata[catid]['lurl']); 
                 }
                 $('.furl').show();
                 if(catid == 'news')
                  $('.furl').hide();
                 $('#dialog').hide('fast'); 
                 dialog('dialog');
                 $('input[name="catid"]').val(catid);
            }else{
                $('#dialog').hide('fast'); 
                $('input[name="catid"]').val('--');
            }
          }
    })
})

function dialog(container){
	showDiv($("#"+container));
	$("#shut").click(function(){//关闭弹窗
		$('#dialog').hide('fast'); 
        $('input[name="catid"]').val('--');
	});
}
function showDiv(obj){
    center(obj);
 $(obj).show('fast',function (){
    
     $(window).scroll(function(){
        center(obj);
     });
     $(window).resize(function(){
       center(obj);
     }); 
 });

}

function center(obj){
     var windowWidth = document.documentElement.clientWidth;   
     var windowHeight = document.documentElement.clientHeight;   
     var popupHeight = $(obj).height();   
     var popupWidth = $(obj).width();
     $(obj).css({   
      "position": "absolute",
      'top':((windowHeight-popupHeight)/2 + $(document).scrollTop()) +'px',
      'left':(windowWidth-popupWidth)/2 +'px'
     });   
}

function readoms(){
    if(readom === 0){
      readom = 1; 
    }else{
       readom = 0; 
    }
}

function catspost(obj){
    $.post($(obj).attr('action'), $(obj).serializeArray(), function (data){
        if(data == '1'){
            alert('操作已经成功');
            
        }
        js_header('./index.php?admincp=enlink.html');
    });
    return false;
}
</script>
<table class="mytable" style=" width: 100%; background-color: white;">
    <tr class="admin_list">
        <th colspan="5">栏目列表　<input type="checkbox" style="vertical-align: middle;" onclick="readoms();" /> 只读</th>
    </tr>
<!--{loop $new_arr $narr}-->
<tr class="listtr">
    <!--{loop $narr $val}-->
    <td>
        <div style="margin: 5px;background-color: #629DEE;  border: 1px solid #EBF9BF;">
            <div style="overflow: hidden;">
            <div style="float: left; width: 10%;line-height: 48px;height: 48px; background-color: #0080C0;"><a target="_blank" style="display: block; line-height: 48px;height: 48px;" title="点击链接" href="{$val[lurl]}">　</a></div>
            <div class="d1 catid_{$val[lid]}" title="{$val[lid]}">{$val[ltitle]}</div>
            </div>
            
            
            <div style="text-align: center; color: #F9F9F9; height: 22px; line-height: 22px; background-color: #7D949F;">{if $val[lid] !== 'news'}点击次数: $val[count]{else}-----{/if}</div>
        </div>
    </td>
    <!--{/loop}-->
</tr>
<!--{/loop}-->

    <tr>
    <td colspan="5" style="line-height: 20px; padding-left: 6px; border-top: 1px solid silver;"><strong>说明</strong>: <br />
    　1:　带次数计算的链接跳转功能<br />
    </td>
    </tr>
</table>

<br /><br />
<div id="dialog">
    <form onsubmit="return catspost(this);" action="{GET_URL}">
    <ul style="list-style:none; line-height: 20px; text-align: left; margin: 0; padding: 0;">
    <li style=" overflow: hidden;">
    <input name="catid" type="hidden" value="--" />
    <input name="randge" type="hidden" value="0" />
    <span style="display: block; margin: 3px; font-weight: bolder; float: left; width: 60%;">链接编辑: </span>
    <input style="float: right; margin: 3px; cursor: pointer;" type="button" value="关闭弹出窗" id="shut" />
    </li>
    <li class="order_mess" style="margin: 3px; height: auto; text-align: center; background-color: white;"><br />
    <div style="text-align: left; line-height: 3em; margin-left: 6px; margin-top: 6px;">
        链接名称: <input type="text" style="width: 180px;" name="ltitle" />　<br />
        链接地址: <textarea style="width: 380px; height: 60px; border: 1px solid silver;" name="lurl"></textarea>　<br />
        <span class="furl">分享链接: <input type="text" style="width: 380px;" name="furl" value="0" />　<br /></span>
        <input style="margin-left: 56px;" type="submit" value=" 编 辑 " /> <span class="furl"><input style="margin-left: 30px;" type="checkbox" name="deles" value="1" /> <span style="color: red;">删除</span></span>
        <br /><br />
    </div>
    </li>
    </ul>
    </form>
</div>