<{include file="index/header.html"}> 
<style type="text/css"> 
a.file{ padding:6px 15px; margin-right:10px; overflow:hidden; position: relative; border:1px solid #179ED2; border-radius:0; background:#179ED2; font-size:12px; text-align:center; color:#fff; float:left; }
a.file input{ position:absolute; opacity: 0; right:0; left:0; } 
</style>
<div class="nav"><span>相册列表</span></div> 
<div class="filter">
	<a class="file" href="javascript:;" id="file">文件上传<input type="file" name="imgFile" class="img_file" id="imgFile"/></a> 
	<input type="submit" name="del" class="button" id="del_all" value="删除"/> 
	<{uqcms m="album" v="type_arr" c="path_type_cn"}> 
	<select name="type" class="select" id="album_type">
		<option value="" <{if $smarty.get.type == ''}>selected="selected"<{/if}>>全部图片</option>
		<{foreach item=i key=k from=$type_arr}> 
			<option value="<{$k}>" <{if $smarty.get.type === $k}>selected="selected"<{/if}>><{$i}></option>
		<{/foreach}> 
	</select>
</div>
<div class="main"> 
	<table class="ltable">
		<thead>
			<tr>
				<th width="30"><input type="checkbox" class="checked_all"/></th>
				<th width="80">类型</th>
				<th>图片</th>
				<th width="80">大小</th>
				<th width="70">操作</th>
				<th width="110">创建时间</th>
			</tr>
		</thead>
		<tbody>
		<{if $data.list}>
			<{foreach item=i from=$data.list}>
				<tr>
					<td><input type="checkbox" name="id[]" value="<{$i.id}>" class="checked_list"/></td> 
					<td><a href="javascript:;"><{$i.type}></a></td> 
					<td><a href="<{$__IMG__}><{$i.url}>" target="_blank"><img src="<{$__IMG__}><{$i.url|img_size:10000x50}>"></a></td>
					<td><{$i.size}></td>
					<td><a href="javascript:;" data-id="<{$i.id}>" class="del">删除</a></td>
					<td><{$i.addtime}></td>
				</tr>
			<{/foreach}> 
		<{else}>
			<tr><td colspan="6">还没有数据，赶快添加吧！</td></tr>
		<{/if}>
		</tbody>
	</table>
	<{if $data.page}><div class="page"><{$data.page}></div><{/if}>
</div>
<{include file="index/footer.html"}> 
<script type="text/javascript" src="<{$__PUBLIC__}>js/ajaxfileupload.js"></script>
<script type="text/javascript">
_delete('?m=album&a=del', '#del_all');
// 上传
$(function(){
	$(document).on('change','#imgFile',function(){ 
		var $this=$(this); 
		$("#upload_msg").ajaxStart(function(){ 
			$(this).show(); 
		});
		$.ajaxFileUpload({ 
			url:'?m=album&a=upload&path=temp',
			secureuri:false, 
			fileElementId:'imgFile',
			dataType: 'text',	//text json
			success: function(result){
				data = jQuery.parseJSON(result);
				if(data.error == '0'){
					parent.$.alert('保存成功');
					location.reload();
				}else{
					parent.alert(data.msg);
				} 
			}
		});
	});
});

// 下拉菜单
$("#album_type").change(function(){
	type_id = $(this).children('option:selected').val();  
	location.href="?m=album&type="+type_id;
});
</script>
