<?php defined('PHPNEW_STATIC_TPL') === false && exit(URL_HOST);?>

<style type="text/css">
    .mytable td{line-height: 2em; color: #4D4A4F; padding-left: 6px;  border-bottom: 1px dotted #CCCBCD;}
    #dialog {width:952px;min-height:480px;border:3px #930 solid;text-align:center;display:none;position:absolute;left:50%;top:20%;margin-left:-480px;margin-top:20px;z-index:10;background-color: #EAEFE0;}
    #dialog img{max-width: 920px;}
</style>
<script type="text/javascript">
function dialog(container){
	showDiv($("#"+container));
	$("#shut").click(function(){//关闭弹窗
		$("#dialog").hide();
	});
}

function showDiv(obj){
 $(obj).show();
    center(obj);
 $(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 imgshow(keys){
    var type = $('.tr_'+keys+' td').eq(1).text();
    if(type.indexOf('.jpg')>0 || type.indexOf('.gif')>0 || type.indexOf('.png')>0){
        var size = $('.tr_'+keys+' td').eq(1).text();
        var imgpath = 'Data/cache_upload/'+$('.tr_'+keys+' td').eq(5).text();
        var time = $('.tr_'+keys+' td').eq(4).text();
        var htmldata = '<img src="'+imgpath+'" /><br />'+size+'; '+time;
        $('.order_mess').html(htmldata);
        dialog('dialog');
    }else{
        return false;
    }
}

</script>
<div>
<form method="post" enctype="multipart/form-data">

<table class="mytable">
<tr class="admin_list">
        <th colspan="7" style="width: 80px;">资源上传: (最大32M</th>
</tr>
    <tr>
    <td colspan="7" style="border-bottom: 2px solid #FF8040; line-height: 3em;"><input type="file" style="width: 320px;" name="upfile" value="" /> <input type="submit" value="Upload" /></td>
    </tr>
    <!--{loop $data $key $val}-->
    <tr class="tr_{$key}">
        <td style="width: 20px;"><input style="vertical-align: middle;" title="更新此文件" type="radio" name="update" value="{$key}" /></td>
        <td onclick="imgshow('{$key}')" style="color: #0080FF; cursor: pointer; width: 220px;">{$val[name]}</td>
        <td>{$val[size]}</td>
        <td><input style="width: 260px; border: none; padding: 2px; border-left: 6px solid #FF8040; color: gray;" value="{$val[md5file]}" /></td>
        <td>{$val[time]}</td>
        <td style="display: none;">{$val[md5file2]}</td>
        <td><a style="color: red;" href="./index.php?admincp=source&delete=$key.html" {GET_ALERT}>Del</a></td>
    </tr>
    <!--{/loop}-->
    <!--{if !$data}-->
        <tr>
            <td colspan="20">
                你还没有上传资源!
            </td>
        </tr>
    <!--{/if}-->   
    <!--{if $page_list}-->
    <tr>
        <td colspan="20" style="text-align: left;">{$page_list}</td>
    </tr>
    <!--{/if}-->
</table>
</form>
<div id="dialog">
    <ul style="list-style:none; line-height: 20px; text-align: left; margin: 0; padding: 0;">
    <li style=" overflow: hidden;">
        <span style="display: block;margin:10px; font-weight: bolder; float: left; line-height: 28px; height: 28px; width: 60%;">图片查看: </span>
        <input style="margin:10px; float: right; cursor: pointer;" type="button" value="关闭弹出窗" id="shut" />
    </li>
    <li class="order_mess" style="margin: 10px; margin-top: 0px;line-height: 2em;"></li>
    </ul>
</div>
</div>