{include "header.inc.html"}
<div class="content_box">
	<div class="toolbar_box">
		<div class="toolbar"> <span> <strong>{$lang.admin.adplace.name}</strong><br />
		<span class="english">{$lang.admin.adplace.name_en}</span> </span> </div>
	</div>
<div class="tool">
{if $smarty.get.act=="list" || $smarty.get.act==""}<a id="deleteChecked" class="ui-btn">删除所选</a>{/if}
	</div>
	<div class="adplaceForm">
<form class="form" action="" method="post">
 {if $smarty.get.act=="edit" || $smarty.get.act=="add"}
<input type="hidden" name="act" value="{$smarty.get.act}" />
{if $smarty.get.act=="edit"}
<input type="hidden" name="id" value="{$smarty.get.id}" />
{/if}
<div class="form-line">
<label class="label">广告位名称：</label><div class="element"><input type="text" class="text w200" name="name" value="{$adplaceInfo.name}" /></div>
</div>
<div class="form-line"><label class="label">宽度：</label><div class="element"><input type="text" class="text w50" name="width" value="{$adplaceInfo.width}" /> 像素(px)</div></div>
<div class="form-line"><label class="label">高度：</label><div class="element"><input type="text" class="text w50" name="height" value="{$adplaceInfo.height}" /> 像素(px)</div></div>
<div class="form-line">
<label class="label">排序：</label><div class="element"><input type="text" class="text w200" name="sortId" value="{$adplaceInfo.sortId|default:50}" /></div>
</div>
<div class="form-line">
<label class="label"></label><div class="element"><input class="btn_sub" type="submit" value="{$lang.form.submit}"></div>
</div>
</form>
</div>
 {else}
 <table class="table-ca table_1" id="tInfo">
 <tr>
<th class="w30"><input type="checkbox" value="1" name="allid" id="checkall" /></th><th class="w60">编号</th><th>广告位名称</th><th class="w200">大小</th><th class="w50">排序</th><th class="w100">添加时间</th><th class="w100">操作</th>
 </tr>
{adplace limit="false"}
<tr sid="{$item.id}">
<td><input type="checkbox" name="id[]" value="{$item.id}" /></td>
<td>{$item.id}</td><td>{$item.name}</td><td>{$item.width} x {$item.height} px</td><td>{$item.sortId}</td><td>{$item.posttime|date_format:"Y-m-d"}</td><td><a href="{$adminUrl}adplace/act/edit/id/{$item.id}" title="{$item.edit}" class="modBtn">{$item.edit}</a> <a href="javascript:void(0)" class="delBtn" title="{$lang.del}" sid="{$item.id}">{$lang.del}</a></td>
</tr>
{/adplace}
</table>
{/if}
</div><!--content_box-->
<script type="text/javascript">
$(function(){
	$(".delBtn").click(function(){
		if(!confirm(lang[4])){ return false; }
		var id = $(this).attr("sid");
		if(id!=''){
			var tr = $(this).parent("td").parent("tr");
			$.ajax({
				type:"POST",
				url:"{$adminUrl}adplace",
				data:"inajax=1&act=del&id="+id,
				dataType:'json',
				success:function(json){
					if(json.success){
						tr.remove();
					}else{
						alert(json.message)
					}
				}
			});
		}
	})
	$("a#deleteChecked").button().click(function(){
		if(!confirm(lang[4])){ return false; }		
		var id = [];
		$("input[name='id[]']:checkbox:checked").each(function(index){
			id[index] = $(this).val();
			var sid = $(this).val();
			if(sid){
				var tr = $(this).parent("td").parent("tr");
				var sdata = "inajax=1&act=del&id="+sid;
				$.ajax({
					type:"POST",
					url:"{$adminUrl}adplace",
					data:sdata,
					dataType:"json",
					success:function(data){
						if(data.success){
							tr.fadeOut("slow").remove();
						}else{
							alert(data.message);
						}
					}
				});			
			}
		});
		
	});
});
</script>
{include "footer.inc.html"}