<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->
<!--{if $a == "run"}-->
<div class="oemarry_layout">
  <div class="oe_top_nav"><i></i>广告管理->广告版位</div>
  <div class="oe_content">
	
	<form id="serform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
	<div class="oe_txtwrap">
	  当前风格：<!--{$config.templet}-->&nbsp;&nbsp;
	  所属城市：<!--{hook mod='city' type='select' name='scityid' text='=请选择=' value=$scityid}-->&nbsp;
	  标识名：<input type="text" name="smark" id="smark" class="input-150" value="<!--{$smark}-->" />&nbsp;
	  版位名：<input type="text" name="sname" id="sname" class="input-150" value="<!--{$sname}-->" />&nbsp;
	  &nbsp;&nbsp;&nbsp;<input type="submit" name="btn_search" id="btn_search" class="button_2" value="搜索" />
	</div>
	</form>

    <div class="oe_tools_bar clearfix">
      <a class="icon-checkbox-unchecked" href="javascript:;" id="selAll" onclick="oemarrySelectAll(this, 'selall');">选择</a>
      <a class="icon-remove-2" onclick="oemarryDialogFormDel('myform');">删除</a>
      <span class="fr"><a class="icon-plus" href="<!--{$oefile}-->&c=<!--{$c}-->&a=add">添加</a></span>
    </div>
    
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&a=del" method="post">
    <table class="oe_table_list table_cs">
	  <tr>
	    <th width="8%">ID</th>
		<th width="10%">频道</th>
		<th width="10%">城市</th>
		<th width="15%">标识</th>
		<th width="15%">名称</th>
		<th width="15%">版位大小</th>
		<th width="13%">添加时间</th>
		<th>操作</th>
	  </tr>
	  <!--{if empty($zone)}-->
	  <tr>
	    <td class="text_center" colspan="8">No data!</td>
	  </tr>
	  <!--{else}-->
	  <!--{foreach $zone as $volist}-->
	  <tr>
	    <td class="text_center"><input type="checkbox" name="id[]" id="id[]" class="selall" value="<!--{$volist.zoneid}-->" /><!--{$volist.zoneid}--></td>
		<td><!--{$volist.channel}--></td>
		<td>
		<!--{if $volist.cityid == '0'}-->
		~~
		<!--{else}-->
		<!--{$volist.cityname}-->
		<!--{/if}-->
		</td>
		<td><!--{$volist.zonemark}--></td>
		<td><!--{$volist.zonename}--></td>
		<td class="text_center"><!--{$volist.zonewidth}-->*<!--{$volist.zoneheight}-->px</td>
		<td><!--{$volist.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
		<td class="text_center">
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.zoneid}-->&<!--{$comeurl}-->" class="oe_ico_blue">编辑</a>
		 <a href="javascript:;" onclick="oemarryDialogUrlDel('<!--{$oefile}-->&c=<!--{$c}-->&a=del&id[]=<!--{$volist.zoneid}-->&<!--{$comeurl}-->');" class="oe_ico_red">删除</a>
		</td>
	  </tr>
	  <!--{/foreach}-->
	  <!--{/if}-->
	</table>
	</form>

	<div class="oe_page_box"><!--{$showpage}--></div>

  </div>
</div>
<!--{/if}-->

<!--{if $a == 'add'}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>广告管理->广告版位->添加
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->">&lt;&lt;返回列表</a></span>
  </div>
  <div class="oe_content">
    <h6>添加广告版位</h6>
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
	<input type="hidden" name="a" id="a" value="saveadd" />
    <table class="oe_table_wrap">
	  <tr>
	    <th>所属频道：<span class="f_red"></span></th>
		<td>
		  <select name="channel" id="channel">
			<option value="">=请选择=</option>
			<option value="index">首页(index)</option>
			<option value="shop">商家(shop)</option>
			<option value="goods">商城(goods)</option>
			<option value="activity">活动(activity)</option>
			<option value="coupon">优惠券(coupon)</option>
			<option value="gallery">图库(gallery)</option>
			<option value="article">文章(article)</option>
		  </select>
		</td>
	  </tr>
	  <tr>
	    <th>所属城市：<span class="f_red"></span></th>
		<td><!--{hook mod="city" type="select" name="cityid" text="=不限="}--></td>
	  </tr>
	  <tr>
	    <th width="15%">广告版位：<span class="f_red">*</span></th>
		<td width="85%">
		  <input type="text" name="zonemark" id="zonemark" class="input-b" />
		  <span class="oe_trap">（由字母、数字、下横线组成）</span>
		</td>
	  </tr>
	  <tr>
	    <th>版位名称：<span class="f_red">*</span></th>
		<td><input type="text" name="zonename" id="zonename" class="input-b" /></td>
	  </tr>
	  <tr>
	    <th>版位宽：<span class="f_red">*</span></th>
		<td><input type="text" name="zonewidth" id="zonewidth" class="input-100" /></td>
	  </tr>
	  <tr>
	    <th>版位高：<span class="f_red">*</span></th>
		<td><input type="text" name="zoneheight" id="zoneheight" class="input-100" /></td>
	  </tr>
	  <tr>
	    <th>备注说明：</th>
		<td colspan="3"><textarea name="remark" id="remark" style="width:50%;height:60px;"></textarea></td>
	  </tr>
	  <tr>
	    <td></td>
		<td><input type="button" id="btn_save" class="button_2" value="添加保存" /></td>
	  </tr>
	</table>
	</form>
  </div>
</div>
<script type="text/javascript">
$(function(){

	$("#zonemark").bind("blur", function(){ //检测标识
		if ($(this).val().length > 0) {
			$.ajax({
				type: "POST",
				url: "<!--{$oefile}-->&c=<!--{$c}-->",
				cache: false,
				data: {a:"check", name:$(this).val(), r:get_rndnum(8)},
				dataType: "json",
				success: function(data) {
					$json = eval(data);
					$response = $json.response;
					$result = $json.result;
					if ($response == '1') {
						oemarryCheckOk("zonemark", "该标识可用");
					}
					else {
						if ($result.length == 0) {
							$result = "该标识已存在";
						}
						oemarryCheckError("zonemark", $result);
					}
				},
				error: function() {
					ToastShow("检测失败，请检查网络...");
				}
			});
		}
	});

	$("#btn_save").bind("click", function(){
		if ($("#zonemark").val().length == 0) {
			ToastShow("请填写标识", "zonemark");
			return false;
		}
		if ($("#zonename").val().length == 0) {
			ToastShow("请填写版位名称", "zonename");
			return false;
		}
		if ($("#zonewidth").val().length == 0) {
			ToastShow("请填写版位宽", "zonewidth");
			return false;
		}
		if ($("#zoneheight").val().length == 0) {
			ToastShow("请填写版位高", "zoneheight");
			return false;
		}
		$("#myform").submit();
	});

});
</script>

<!--{/if}-->


<!--{if $a == 'edit'}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>广告管理->广告版位->编辑
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->">&lt;&lt;返回列表</a></span>
  </div>
  <div class="oe_content">
    <h6>编辑广告版位</h6>
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post" />
	<input type="hidden" name="a" id="a" value="saveedit" />
	<input type="hidden" name="id" id="id" value="<!--{$id}-->" />
    <table class="oe_table_wrap">

	  <tr>
	    <th>所属频道：<span class="f_red"></span></th>
		<td>
		  <select name="channel" id="channel">
			<option value="">=请选择=</option>
			<option value="index"<!--{if $zone.channel == "index"}--> selected<!--{/if}-->>首页(index)</option>
			<option value="shop"<!--{if $zone.channel == "shop"}--> selected<!--{/if}-->>商家(shop)</option>
			<option value="goods"<!--{if $zone.channel == "goods"}--> selected<!--{/if}-->>商城(goods)</option>
			<option value="activity"<!--{if $zone.channel == "activity"}--> selected<!--{/if}-->>活动(activity)</option>
			<option value="coupon"<!--{if $zone.channel == "coupon"}--> selected<!--{/if}-->>优惠券(coupon)</option>
			<option value="gallery"<!--{if $zone.channel == "gallery"}--> selected<!--{/if}-->>图库(gallery)</option>
			<option value="article"<!--{if $zone.channel == "article"}--> selected<!--{/if}-->>文章(article)</option>
		  </select>
		</td>
	  </tr>

	  <tr>
	    <th>所属城市：<span class="f_red"></span></th>
		<td><!--{hook mod="city" type="select" name="cityid" text="=不限=" value=$zone.cityid}--></td>
	  </tr>

	  <tr>
	    <th width="15%">广告版位：<span class="f_red">*</span></th>
		<td width="85%">
		  <input type="text" name="zonemark" id="zonemark" class="input-b" value="<!--{$zone.zonemark}-->" />
		  <span class="oe_trap">（由字母、数字、下横线组成）</span>
		</td>
	  </tr>
	  <tr>
	    <th>版位名称：<span class="f_red">*</span></th>
		<td><input type="text" name="zonename" id="zonename" class="input-b" value="<!--{$zone.zonename}-->" /></td>
	  </tr>
	  <tr>
	    <th>版位宽：<span class="f_red">*</span></th>
		<td><input type="text" name="zonewidth" id="zonewidth" class="input-100" value="<!--{$zone.zonewidth}-->" />px</td>
	  </tr>
	  <tr>
	    <th>版位高：<span class="f_red">*</span></th>
		<td><input type="text" name="zoneheight" id="zoneheight" class="input-100" value="<!--{$zone.zoneheight}-->" />px</td>
	  </tr>
	  <tr>
	    <th>备注说明：</th>
		<td colspan="3"><textarea name="remark" id="remark" style="width:50%;height:60px;"><!--{$zone.remark}--></textarea></td>
	  </tr>
	  <tr>
	    <td></td>
		<td><input type="button" id="btn_save" class="button_2" value="编辑保存" /></td>
	  </tr>
	</table>
	</form>
  </div>
</div>
<script type="text/javascript">
$(function(){

	$("#zonemark").bind("blur", function(){ //检测标识
		if ($(this).val().length > 0) {
			$.ajax({
				type: "POST",
				url: "<!--{$oefile}-->&c=<!--{$c}-->",
				cache: false,
				data: {a:"check", zoneid:"<!--{$id}-->", name:$(this).val(), r:get_rndnum(8)},
				dataType: "json",
				success: function(data) {
					$json = eval(data);
					$response = $json.response;
					$result = $json.result;
					if ($response == '1') {
						oemarryCheckOk("zonemark", "该标识可用");
					}
					else {
						if ($result.length == 0) {
							$result = "该标识已存在";
						}
						oemarryCheckError("zonemark", $result);
					}
				},
				error: function() {
					ToastShow("检测失败，请检查网络...");
				}
			});
		}
	});

	$("#btn_save").bind("click", function(){
		if ($("#zonemark").val().length == 0) {
			ToastShow("请填写标识", "zonemark");
			return false;
		}
		if ($("#zonename").val().length == 0) {
			ToastShow("请填写版位名称", "zonename");
			return false;
		}
		if ($("#zonewidth").val().length == 0) {
			ToastShow("请填写版位宽", "zonewidth");
			return false;
		}
		if ($("#zoneheight").val().length == 0) {
			ToastShow("请填写版位高", "zoneheight");
			return false;
		}
		$("#myform").submit();
	});

});
</script>
<!--{/if}-->
</body>
</html>