{:tpl head}
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>地区管理</caption>
  <tr>
   <td>
    <strong>管理选项：</strong>
    <a href="?c=area&a=add">添加地区</a> |
    <a href="?c=area">管理地区</a>
   </td>
  </tr>
</table>
<!--{:if $a == 'add' || $a == 'edit'}-->
<table cellpadding="0" cellspacing="1" class="table_form">
 <caption>{:if $a == 'add'}添加{:else}编辑{:/if}地区</caption>
 <form name="myform" action="?c=area&a={:$a}" method="post">
 <input type="hidden" name="info[areaid]" id="areaid" value="{:$data['areaid']}" />
 <input type="hidden" name="forward" value="{:$referer}" />
 <tr>
   <td align="right" width="25%">所属地区：</td>
   <td><input type="hidden" name="info[pid]" id="pid" value="{:$data['pid']}" /></td>
 </tr>
 <tr>
   <td align="right">地区名称：</td>
   <td>
    <input type="text" name="info[name]" value="{:$data['name']}"> <span class="fred">*</span>
   </td>
 </tr>
 <tr>
   <td align="right">唯一标识：</td>
   <td>
	<input type="text" name="info[sign]" value="{:$data['sign']}" id="sign"> <span class="fblue">* 拼音或拼音首字母</span>
   </td>
 </tr>
 <tr>
   <td align="right">字符选项：</td>
   <td>
	<select name='info[color]' onchange="set_background(this)">
    <option value="">颜色</option>
{:Tag::option('#000000|#FFFFFF|#008000|#800000|#808000|#000080|#800080|#808080|#FFFF00|#00FF00|#00FFFF|#FF00FF|#FF0000|#0000FF|#008080',$data['color'],'<option value=\"$id\" style=\"background-color:$id\"$selected></option>')}
   </select>&nbsp;
	<input type="checkbox" name="info[strong]" value="1"{:Tag::checked($data['strong'],1)}>加粗
   </td>
 </tr>
 <tr>
  <td height="30" colspan="2" align="center">
  <button type="submit" name="submit">提交</button>
  </td>
 </tr>
 </form>
</table>
<script type="text/javascript" src="../../statics/js/jquery.jxselect.js"></script>
<script type="text/javascript">
$(function(){
	$('#pid').jxselect();
	$('#sign').blur(function(){
		var sign = $(this).val(), areaid = $('#areaid').val();
		if (sign) {
			$.get('?c=area&a=check&sign='+sign+'&areaid='+areaid+'&rand='+Math.random()*5, function(data){
				if (data) {
					$.jxbox.tip('错误，唯一标识已经存在！', 2, { focus:'sign' });
				}
			});
		}
	});
});
</script>
<!--{:elseif $a == 'defaults'}-->
<form name="myform" method="post" action="">
<input type="hidden" name="selids" value="">
<table cellpadding="0" cellspacing="1" class="table_list">
 <caption>管理地区</caption>
 <tr align="center">
  <th width="5%"><input name="checkbox" type="checkbox" onclick="checkorno(this,this.form.ids)" /></th>
  <th>名称</th>
  <th width="15%">ID</th>
  <th width="15%">标识</th>
  <th width="15%">排序</th>
  <th width="20%">管理操作</th>
 </tr>
 {:loop $data $v}
 <tr align="center">
  <td><input name="ids" type="checkbox" value="{:$v['areaid']}"></td>
  <td>{:$v['name']}</td>
  <td>{:$v['areaid']}</td>
  <td>{:$v['sign']}</td>
  <td><input name="orderid[{:$v['areaid']}]" type="text" size="2" value="{:$v['orderid']}"></td>
  <td>
   {:if $area[$v['areaid']]['subnum']}<a href="?c=area&pid={:$v['areaid']}" title="查看子地区">子地区</a>{:else}<span class="fgray">子地区</span>{:/if} | 
   <a href="?c=area&a=add&pid={:$v['areaid']}" title="添加子地区">添加</a> | 
   <a href="?c=area&a=edit&areaid={:$v['areaid']}">修改</a> | 
   <a href="?c=area&a=del&selids={:$v['areaid']}">删除</a>
  </td>
 </tr>
 {:/loop}
 <tr>
  <td height="20" colspan="6" align="center">
   <button name="select1" onClick="selAll(this.form.ids)" type="button">全选</button>
   <button name="select2" onClick="noSelAll(this.form.ids)" type="button">反选</button>
   <button name="submitdel" type="button" onClick="subform(this.form,this.form.ids,'?c=area&a=del','确认删除吗？此操作不可恢复。')">删除</button>
   <button name="order" type="button" onClick="subform(this.form,this.form.ids,'?c=area&a=order','')">排序</button>
   <button name="reset" type="reset">重置</button>
   <!--{:if $pid}-->
   <button name="back" type="button" onclick="redirect('?c=area&pid={:$area[$pid]['pid']}')">返回上级</button>
   <!--{:/if}-->
  </td>
 </tr>
</table>
</form>
{:if $pages}<div class="pages">{:$pages}</div>{:/if}
<!--{:/if}-->
{:tpl foot}