<?php
	!defined('IN_MANAGE') && exit('Access Denied!');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<link href="admin/template/images/tm_right.css" type="text/css" rel="stylesheet" />
<link href="statics/ui-jquery/jquery-ui.css" type="text/css" rel="stylesheet" />
<title>网站后台管理</title>
<script language="javascript" src="statics/ui-jquery/jquery-1.8.3.js"></script>
<script language="javascript" src="statics/ui-jquery/jquery-ui.js"></script>
<script language="javascript" src="admin/template/images/tm-core.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#province").val('<?php echo $province;?>');
$("#city").val('<?php echo $city;?>');
$("#district").val('<?php echo $district;?>');
});
</script>
</head>

<body>
	<div class="top-tips">
		<div class="tips-wrap">
			<div class="title">区域设置</div>
			添加，编辑或删除操作后需要点击“提交”按钮才生效。<a href="<?php echo IN_SYS;?>" target="_blank" style="color:#FF0000">获取帮助</a>
		</div>
	</div>
	<div class="manage-tips">
	<a href="javascript:void(0);" onclick="$('#addchild').append($('#addhtml').html())" class="add">添加区域</a>
	&nbsp;
	选择地区：
	<select id="province" onchange="self.location.href='<?php echo $LA['admin_file'];?>?mod=config&file=config&action=area&parentid='+this.value+'&province='+this.value"><option value="0">-省份-</option>
	<?php 
	$arealist1=$areaobj->areadata(0,1);
	foreach($arealist1 as $r){?>
	<option value="<?php echo $r['id'];?>"><?php echo $r['name'];?></option>
	<?php }?>
	</select>  
	<select id="city" onchange="self.location.href='<?php echo $LA['admin_file'];?>?mod=config&file=config&action=area&province=<?php echo $province;?>&city='+this.value+'&parentid='+this.value">
	<option value="0">-城市-</option>
	<?php 
	$arealist1=$areaobj->areadata($province,2);
	foreach($arealist1 as $r){?>
	<option value="<?php echo $r['id'];?>"><?php echo $r['name'];?></option>
	<?php }?>
	</select>  
	<select id="district" onchange="self.location.href='<?php echo $LA['admin_file'];?>?mod=config&file=config&action=area&province=<?php echo $province;?>&city=<?php echo $city;?>&parentid='+this.value+'&district='+this.value"><option value="0">-州县-</option>
	<?php 
	$arealist1=$areaobj->areadata($city,3);
	foreach($arealist1 as $r){?>
	<option value="<?php echo $r['id'];?>"><?php echo $r['name'];?></option>
	<?php }?>
	</select>
	</div>
	<form action="" method="post" name="myform" enctype="multipart/form-data">
	<input type="hidden" name="do_submit" value="1" />
	<input type="hidden" name="parentid" value="<?php echo $parentid;?>" />
	<input type="hidden" name="m" value="<?php echo $parentid?$areaobj->m($parentid)+1:$m;?>" />
	<table class="table-list" cellpadding="1" cellspacing="1">
		<tr>
			<th>显示顺序</th>
			<th>名称</th>
			<th>拼音</th>
			<th>简拼</th>
			<th>热门城市</th>
			<th>操作</th>
		</tr>
		<?php if($arealist){?>
		<?php foreach($arealist as $no => $r){?>
			<input type="hidden" name="id[<?php echo $r['id'];?>]" value="<?php echo $r['id'];?>" />
		<tr id="tr_<?php echo $r['id'];?>" <?php echo ($no%2)?'':'class="light"';?>>
			<td><input type="text" class="input-txt" name="orderby[<?php echo $r['id'];?>]" value="<?php echo $r['orderby'];?>" size="4" /></a></td>
			<td><input type="text" class="input-txt" name="name[<?php echo $r['id'];?>]" value="<?php echo $r['name'];?>" size="24" /></td>
			<td><input type="text" class="input-txt" name="spell[<?php echo $r['id'];?>]" value="<?php echo $r['spell'];?>" size="6" /></td>
			<td><input type="text" class="input-txt" name="simplespell[<?php echo $r['id'];?>]" value="<?php echo $r['simplespell'];?>" size="4" /></td>
			<td><select name="ishot[<?php echo $r['id'];?>]">
			<option value="0"<?php echo !$r['ishot']?' selected="selected"':'';?>>非热门</option>
			<option value="1"<?php echo $r['ishot']?' selected="selected"':'';?>>热门</option>
			</select></td>
			<td><?php if($r['m']<=3){?><a href="<?php echo $LA['admin_file'];?>?mod=config&file=config&action=area&parentid=<?php echo $r['id'];?>&m=<?php echo $r['m']+1;?>">下级区域</a> | <?php }?><a href="javascript:void(0);" onclick="$('#tr_<?php echo $r['id'];?>').remove();">删除</a></td>
		</tr>
		<?php }?>
		<?php }else{echo '<tr class="light"><td colspan="6">暂无区域数据</td></tr>';}?>
		<tbody id="addchild"></tbody>
		<tr class="light">
			<td colspan="56" class="save-td" ><input type="submit" class="save-btn-small" value="提交" /></td>
		</tr>
		</form>
		<tbody style="display:none" id="addhtml">
		<tr class="light">
			<td><input type="text" class="input-txt" name="neworderby[]" size="4" /></td>
			<td><input type="text" class="input-txt" name="newname[]" size="24" /></td>
			<td><input type="text" class="input-txt" name="newspell[]" size="6" /></td>
			<td><input type="text" class="input-txt" name="newsimplespell[]" size="4" /></td>
			<td><select name="newishot[]">
			<option value="0">非热门</option>
			<option value="1">热门</option>
			</select></td>
			<td>-</td>
		</tr>
		</tbody>
	</table>
</body>
</html>
