<!--{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">
	
    <div class="oe_tools_bar clearfix">
      <span class="fr"><a class="icon-plus" href="<!--{$oefile}-->&c=<!--{$c}-->&a=add">添加一级地区</a></span>
    </div>

    <div class="oe_txtwrap">
	  <b>温馨提示：</b>地区最多支持四级，删除地区时会把子地区一起删除，请谨慎操作。
	</div>

    <table class="oe_table_list">
	  <tr>
	    <th width="10%">ID编号</th>
		<th width="20%">名称</th>
		<th width="10%">扩展名</th>
		<th width="10%">子地区</th>
		<th width="8%">排序</th>
		<th width="8%">状态</th>
		<th width="8%">推荐</th>
		<th>操作</th>
	  </tr>
	  <!--{if empty($area)}-->
	  <tr>
	    <td class="text_center" colspan="8"> No data!</td>
	  </tr>
	  <!--{else}-->

	  <!--{foreach $area as $volist}-->
	  <tr>
	    <td class="text_center"><!--{$volist.areaid}--></td>
		<td><b><!--{$volist.areaname}--></b></td>
		<td><!--{$volist.spread}--></td>
		<td class="text_center"><!--{$volist.nextchilds}--></td>
		<td class="text_center"><!--{$volist.orders}--></td>
		<td class="text_center">
		<!--{if $volist.flag=='0'}-->
			<input type="hidden" id="attr_flag<!--{$volist.areaid}-->" value="flagopen" />
			<img id="flag<!--{$volist.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('flag', '<!--{$volist.areaid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_flag<!--{$volist.areaid}-->" value="flagclose" />
			<img id="flag<!--{$volist.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('flag', '<!--{$volist.areaid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td class="text_center">
		<!--{if $volist.elite=='0'}-->
			<input type="hidden" id="attr_elite<!--{$volist.areaid}-->" value="eliteopen" />
			<img id="elite<!--{$volist.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('elite', '<!--{$volist.areaid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_elite<!--{$volist.areaid}-->" value="eliteclose" />
			<img id="elite<!--{$volist.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('elite', '<!--{$volist.areaid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td>
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.areaid}-->" class="oe_ico_blue">编辑</a>
		 <a href="javascript:;" onclick="oemarryDialogUrlDel('<!--{$oefile}-->&c=<!--{$c}-->&a=del&id=<!--{$volist.areaid}-->')" class="oe_ico_red">删除</a>
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add&parentid=<!--{$volist.areaid}-->" class="oe_ico_green">添加2级地区</a>
		</td>
	  </tr>

	  <!--{foreach $volist.child as $childval}-->
	  <tr>
	    <td class="text_center"><!--{$childval.areaid}--></td>
		<td>&nbsp;&nbsp;&nbsp;&nbsp;|-- <!--{$childval.areaname}--></td>
		<td><!--{$childval.spread}--></td>
		<td class="text_center"><!--{$childval.nextchilds}--></td>
		<td class="text_center"><!--{$childval.orders}--></td>
		<td class="text_center">
		<!--{if $childval.flag=='0'}-->
			<input type="hidden" id="attr_flag<!--{$childval.areaid}-->" value="flagopen" />
			<img id="flag<!--{$childval.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('flag', '<!--{$childval.areaid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_flag<!--{$childval.areaid}-->" value="flagclose" />
			<img id="flag<!--{$childval.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('flag', '<!--{$childval.areaid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td class="text_center">
		<!--{if $childval.elite=='0'}-->
			<input type="hidden" id="attr_elite<!--{$childval.areaid}-->" value="eliteopen" />
			<img id="elite<!--{$childval.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('elite', '<!--{$childval.areaid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_elite<!--{$childval.areaid}-->" value="eliteclose" />
			<img id="elite<!--{$childval.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('elite', '<!--{$childval.areaid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td>
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$childval.areaid}-->" class="oe_ico_blue">编辑</a>
		 <a href="javascript:;" onclick="oemarryDialogUrlDel('<!--{$oefile}-->&c=<!--{$c}-->&a=del&id=<!--{$childval.areaid}-->')" class="oe_ico_red">删除</a>
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add&parentid=<!--{$childval.areaid}-->" class="oe_ico_green">添加3级地区</a>
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=child&rootid=<!--{$childval.areaid}-->&from=child" class="oe_ico_orange">查看3级地区</a>
		</td>
	  </tr>
	  <!--{/foreach}-->
	  <!--{/foreach}-->
	  <!--{/if}-->
	</table>
	
	<div class="oe_page_box">记录：<!--{$total}--></div>
  </div>
</div>
<!--{/if}-->


<!--{if $a == "child"}-->
<div class="oemarry_layout">
  <div class="oe_top_nav"><i></i>地区管理->查看子地区</div>
  <div class="oe_content">
    
	<div class="oe_tools_bar clearfix">
	  <span class="fr"><a href="<!--{$oefile}-->&c=<!--{$c}-->">返回地区列表</a></span>
    </div>

    <div class="oe_txtwrap">
	  <b>温馨提示：</b>地区最多支持四级，删除地区时会把子地区一起删除，请谨慎操作。
	  【上级节点地区：<!--{hook mod='areacat' type='text' value=$rootid}-->】
	</div>

    <table class="oe_table_list">
	  <tr>
	    <th width="10%">ID编号</th>
		<th width="15%">上级</th>
		<th width="25%">名称</th>
		<th width="7%">扩展名</th>
		<th width="6%">子地区</th>
		<th width="6%">排序</th>
		<th width="6%">状态</th>
		<th width="6%">推荐</th>
		<th>操作</th>
	  </tr>
	  <!--{if empty($area)}-->
	  <tr>
	    <td class="text_center" colspan="8"> No data!</td>
	  </tr>
	  <!--{else}-->

	  <!--{foreach $area as $volist}-->
	  <tr>
	    <td class="text_center"><!--{$volist.areaid}--></td>
		<td><!--{hook mod='areacat' type='text' value=$rootid}--></td>
		<td><!--{$volist.areaname}--></td>
		<td><!--{$volist.spread}--></td>
		<td class="text_center"><!--{$volist.nextchilds}--></td>
		<td class="text_center"><!--{$volist.orders}--></td>
		<td class="text_center">
		<!--{if $volist.flag=='0'}-->
			<input type="hidden" id="attr_flag<!--{$volist.areaid}-->" value="flagopen" />
			<img id="flag<!--{$volist.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('flag', '<!--{$volist.areaid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_flag<!--{$volist.areaid}-->" value="flagclose" />
			<img id="flag<!--{$volist.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('flag', '<!--{$volist.areaid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td class="text_center">
		<!--{if $volist.elite=='0'}-->
			<input type="hidden" id="attr_elite<!--{$volist.areaid}-->" value="eliteopen" />
			<img id="elite<!--{$volist.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('elite', '<!--{$volist.areaid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_elite<!--{$volist.areaid}-->" value="eliteclose" />
			<img id="elite<!--{$volist.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('elite', '<!--{$volist.areaid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td>
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.areaid}-->&rootid=<!--{$rootid}-->" class="oe_ico_blue">编辑</a>
		 <a href="javascript:;" onclick="oemarryDialogUrlDel('<!--{$oefile}-->&c=<!--{$c}-->&a=del&id=<!--{$volist.areaid}-->&rootid=<!--{$rootid}-->')" class="oe_ico_red">删除</a>
		 <!--{if $volist.depth < '3'}-->
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add&rootid=<!--{$rootid}-->&parentid=<!--{$volist.areaid}-->" class="oe_ico_green">添加 4 级地区</a>
		 <!--{/if}-->
		</td>
	  </tr>

	  <!--{foreach $volist.child as $childval}-->
	  <tr>
	    <td class="text_center"><!--{$childval.areaid}--></td>
		<td></td>
		<td><font color="blue">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-- <!--{$childval.areaname}--></font></td>
		<td><!--{$childval.spread}--></td>
		<td class="text_center">~</td>
		<td class="text_center"><!--{$childval.orders}--></td>
		<td class="text_center">
		<!--{if $childval.flag=='0'}-->
			<input type="hidden" id="attr_flag<!--{$childval.areaid}-->" value="flagopen" />
			<img id="flag<!--{$childval.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('flag', '<!--{$childval.areaid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_flag<!--{$childval.areaid}-->" value="flagclose" />
			<img id="flag<!--{$childval.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('flag', '<!--{$childval.areaid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td class="text_center">
		<!--{if $childval.elite=='0'}-->
			<input type="hidden" id="attr_elite<!--{$childval.areaid}-->" value="eliteopen" />
			<img id="elite<!--{$childval.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('elite', '<!--{$childval.areaid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_elite<!--{$childval.areaid}-->" value="eliteclose" />
			<img id="elite<!--{$childval.areaid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('elite', '<!--{$childval.areaid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td>
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$childval.areaid}-->&rootid=<!--{$rootid}-->" class="oe_ico_blue">编辑</a>
		 <a href="javascript:;" onclick="oemarryDialogUrlDel('<!--{$oefile}-->&c=<!--{$c}-->&a=del&id=<!--{$childval.areaid}-->&rootid=<!--{$rootid}-->')" class="oe_ico_red">删除</a>
		</td>
	  </tr>
	  <!--{/foreach}-->

	  <!--{/foreach}-->
	  <!--{/if}-->
	</table>
	
	<div class="oe_page_box">记录：<!--{$total}--></div>
  </div>
</div>
<!--{/if}-->


<!--{if $a == 'add'}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>地区管理->添加
	
	<!--{if $rootid > 0}-->
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=child&rootid=<!--{$rootid}-->">&lt;&lt;返回列表</a></span>
	<!--{else}-->
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->">&lt;&lt;返回列表</a></span>
	<!--{/if}-->

  </div>
  <div class="oe_content">

    <div class="oe_txtwrap">
	  <b>温馨提示：</b>地区最多支持四级，删除地区时会把子地区一起删除，请谨慎操作。
	</div>
	
	<form action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post" id="myform">
	<input type="hidden" name="a" id="a" value="saveadd" />
    <h6>添加地区</h6>
	<table class='oe_table_wrap'>
	  <tr>
		<th>从属地区：</th>
		<td>
		  <!--{if $parentid == '0'}-->~~<!--{else}--><!--{hook mod='areacat' type='text' value=$parentid}--><!--{/if}-->
		  <input type="hidden" name="parentid" id="parentid" value="<!--{$parentid}-->" />
		</td>
	  </tr>
	  <tr>
		<th width="15%">地区名称：</th>
		<td width="85%"><input type="text" name="areaname" id="areaname" class="input-200"  /></td>
	  </tr>
	  <tr>
		<th>扩展名：</th>
		<td><input type="text" name="spread" id="spread" class="input-100" />（省、市、区、县、镇、街道等...）</td>
	  </tr>
	  <tr>
		<th>排序：</th>
		<td><input type="text" name="orders" id="orders" class="input-100" value="<!--{$orders}-->" /></td>
	  </tr>
	  <tr>
		<th>状 态：</th>
		<td>
		  <input type="radio" name="flag" id="flag" value="1" checked />开启，
		  <input type="radio" name="flag" id="flag" value="0" />关闭
		</td>
	  </tr>
	  <tr>
		<th>推 荐：</th>
		<td>
		  <input type="radio" name="elite" id="elite" value="1" />开启，
		  <input type="radio" name="elite" id="elite" value="0" checked />关闭
		</td>
	  </tr>
	  <tr>
	    <td></td>
		<td><input type="button" class="button_2" id="btn_save" value="添加保存" /> </td>
	  </tr>
	</table>
	</form>

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


<!--{if $a == "edit"}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>地区管理->编辑
	<!--{if $rootid > 0}-->
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=child&rootid=<!--{$rootid}-->">&lt;&lt;返回列表</a></span>
	<!--{else}-->
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->">&lt;&lt;返回列表</a></span>
	<!--{/if}-->
  </div>
  <div class="oe_content">

    <div class="oe_txtwrap">
	  <b>温馨提示：</b>地区最多支持四级，删除地区时会把子地区一起删除，请谨慎操作。
	</div>
	
	<form action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post" id="myform">
	<input type="hidden" name="a" id="a" value="saveedit" />
	<input type="hidden" name="id" id="id" value="<!--{$id}-->" />
    <h6>编辑地区</h6>
	<table class='oe_table_wrap'>
	  <tr>
		<th>从属地区：</th>
		<td>
		  <!--{if $area.parentid == '0'}-->~~<!--{else}--><!--{hook mod='areacat' type='text' value=$area.parentid}--><!--{/if}-->
		  <input type="hidden" name="parentid" id="parentid" value="<!--{$area.parentid}-->" />
		</td>
	  </tr>
	  <tr>
		<th width="15%">地区名称：</th>
		<td width="85%"><input type="text" name="areaname" id="areaname" class="input-200" value="<!--{$area.areaname}-->" /></td>
	  </tr>
	  <tr>
		<th>扩展名：</th>
		<td><input type="text" name="spread" id="spread" class="input-100" value="<!--{$area.spread}-->" />（省、市、区、县、镇、街道等...）</td>
	  </tr>
	  <tr>
		<th>排序：</th>
		<td><input type="text" name="orders" id="orders" class="input-100" value="<!--{$area.orders}-->" /></td>
	  </tr>
	  <tr>
		<th>状 态：</th>
		<td>
		  <input type="radio" name="flag" id="flag" value="1"<!--{if $area.flag == '1'}--> checked<!--{/if}--> />开启，
		  <input type="radio" name="flag" id="flag" value="0"<!--{if $area.flag == '0'}--> checked<!--{/if}--> />关闭
		</td>
	  </tr>
	  <tr>
		<th>推 荐：</th>
		<td>
		  <input type="radio" name="elite" id="elite" value="1"<!--{if $area.elite == '1'}--> checked<!--{/if}--> />开启，
		  <input type="radio" name="elite" id="elite" value="0"<!--{if $area.elite == '0'}--> checked<!--{/if}--> />关闭
		</td>
	  </tr>
	  <tr>
	    <td></td>
		<td><input type="button" class="button_2" id="btn_save" value="编辑保存" /> </td>
	  </tr>
	</table>
	</form>

  </div>
</div>
<!--{/if}-->
<script type="text/javascript">
$(function(){
	$("#btn_save").bind("click", function(){ //提交
		if ($("#areaname").val().length == 0) {
			ToastShow("请填写地区名称", "areaname");
			return false;
		}
		$("#myform").submit();
	});

});
</script>
</body>
</html>