<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="/WEB-INF/c.tld" prefix="c"%>
<%@page import="com.jh.xh.hibernate.pojo.InfoTab"%>
<%@ page import="com.jh.xh.hibernate.business.LanMuService"%>
<%@ page import="com.jh.xh.hibernate.business.AreaService"%>
<%@ page import="com.jh.xh.hibernate.pojo.ParentAreaTab"%>
<%@ page import="com.jh.xh.hibernate.pojo.ChildAreaTab"%>
<%@ page import="com.jh.xh.hibernate.pojo.ParentLanmuTab"%>
<%@ page import="com.jh.xh.hibernate.pojo.ChildLanmuTab"%>
<%@ page import="java.util.Iterator"%>
<%
InfoTab info = (InfoTab) request.getAttribute("info");
System.out.println("父地区 id " + info.getParentAreaId());
System.out.println("子地区 id " + info.getChildAreaId());
System.out.println("父栏目 id " + info.getParentLanMuId());
System.out.println("子栏目 id " + info.getChildLanMuId());
System.out.println("hidden= " + info.getHidden());
%>
<!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" />
<title>京华时报-京华网 分类信息</title>
<link href="css/global.css" rel="stylesheet" type="text/css" />
<link href="css/fenlei.css" rel="stylesheet" type="text/css" />
<script src="sortjavascript/Function.js"></script>
</head>
<body loadForm();">
<!--顶部开始-->
<!--顶部开始-->
<!--内容大框架-->
<c:import url="/head.jsp" charEncoding="GBK"></c:import>
<div style="width:940px;" class="he">
<div class="czhl_fenleisousuo he"></div>
<div class="czhl_fenleisousuo he">
<table width="100%" cellspacing="0">
<tr>
<td height="14" colspan="2"> 分类信息 >> 信息发布 </td>
</tr>
</table>
</div>
</div>
<div class="clear"></div>
<div class="he" style="width:940px; border:1px solid #ccc;">
<!--左边部分框架-->
<div class="czhl_liebiao">
<form name="theForm" id="theForm" method="post"
action="/ad/updateUserInfo.do?infoId=<%=info.getId()%>&hidden=<%=info.getHidden() %>"
onSubmit="return checkSubmit();">
<table width="630" align="center" cellspacing="7">
<tr>
<td><script language="JavaScript">
var onecount_area;
onecount_area=0;
subcat_area = new Array();
<%
int count_area = 0;
AreaService as=new AreaService();
Iterator it_area=as.findChildSelect();
while(it_area.hasNext())
{
ChildAreaTab ca=(ChildAreaTab)it_area.next();
%>
subcat_area[<%=count_area%>] = new Array("<%=ca.getName()%>","<%=ca.getParentId()%>","<%=ca.getId()%>");
<%
count_area = count_area + 1;
}
%>
onecount_area=<%=count_area%>;
function changelocation_area(id)
{
document.getElementById("childAreaId").length = 0;
var id=id;
var i;
document.getElementById("childAreaId").options[0] = new Option('二级分类','');
for (i=0;i < onecount_area; i++)
{
if (subcat_area[i][1] == id)
{
document.getElementById("childAreaId").options[document.getElementById("childAreaId").length] = new Option(subcat_area[i][0], subcat_area[i][2]);
}
}
}
</script>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20" align="right"> 地区: </td>
<td>
<select name="parentAreaId" id="parentAreaId"
onChange="changelocation_area(document.getElementById('parentAreaId').options[document.getElementById('parentAreaId').selectedIndex].value)"
size="1">
<option value="0" selected>一级地区</option>
<%
AreaService as1 = new AreaService();
Iterator it_area1 = as1.findParentSelect();
while (it_area1.hasNext()) {
ParentAreaTab pa = (ParentAreaTab) it_area1.next();
%>
<option value="<%=pa.getId()%>"
<%if(pa.getId().equals(info.getParentAreaId())){ out.println("selected");}%>
><%=pa.getName()%>
</option>
<%}%>
</select>
</td>
<td>
<select name="childAreaId" id="childAreaId">
<option value="0" selected> 二级地区 </option>
<%
AreaService _twoArea = new AreaService();
Iterator _childArea = _twoArea.findChildSelect(info.getParentLanMuId());
while (_childArea.hasNext()) {
ChildAreaTab _clll = (ChildAreaTab)_childArea.next();
System.out.println(_clll.getId());
%>
<option value="<%=_clll.getId()%>"
<%if(info.getChildAreaId().equals(_clll.getId())){ out.println("selected"); }%>
<%System.out.println("子地区 id= "+info.getChildAreaId());%>
><%=_clll.getName()%>
</option>
<%} %>
</select>
</td>
</tr>
<script LANGUAGE="JavaScript">
changelocation_area(document.getElementById("parentAreaId").options[document.getElementById("parentAreaId").selectedIndex].value);
</script>
</table></td>
<td>
<script language="JavaScript">
var onecount_lanmu;
onecount_lanmu=0;
subcat_lanmu = new Array();
<%
int count_lanmu = 0;
LanMuService parentLanMu=new LanMuService();
Iterator it_lanmu=parentLanMu.findChildSelect();
while(it_lanmu.hasNext())
{
ChildLanmuTab ca=(ChildLanmuTab)it_lanmu.next();
%>
subcat_lanmu[<%=count_lanmu%>] = new Array("<%=ca.getName()%>","<%=ca.getParentId()%>","<%=ca.getId()%>");
<%
count_lanmu = count_lanmu + 1;
}
%>
onecount_lanmu=<%=count_lanmu%>;
function changelocation_lanmu(id)
{
document.getElementById("childLanMuId").length = 0;
var id=id;
if(id==1)
{
document.getElementById("tt").innerHTML=document.getElementById("t01").innerHTML;
}
if(id==2)
{
document.getElementById("tt").innerHTML=document.getElementById("t02").innerHTML;
}
if(id==3)
{
document.getElementById("tt").innerHTML=document.getElementById("t03").innerHTML;
}
if(id==4)
{
document.getElementById("tt").innerHTML=document.getElementById("t02").innerHTML;
}
if(id==5)
{
document.getElementById("tt").innerHTML=document.getElementById("t02").innerHTML;
}
if(id==6)
{
document.getElementById("tt").innerHTML=document.getElementById("t05").innerHTML;
}
if(id==7)
{
document.getElementById("tt").innerHTML=document.getElementById("t02").innerHTML;
}
if(id==8)
{
document.getElementById("tt").innerHTML=document.getElementById("t04").innerHTML;
}
var i;
document.getElementById("childLanMuId").options[0] = new Option('二级分类','');
for (i=0;i < onecount_lanmu; i++)
{
if (subcat_lanmu[i][1] == id)
{
document.getElementById("childLanMuId").options[document.getElementById("childLanMuId").length] = new Option(subcat_lanmu[i][0], subcat_lanmu[i][2]);
}
}
}
</script>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20" align="right"> 分类: </td>
<td>
<select name="parentLanMuId" id="parentLanMuId"
onChange="changelocation_lanmu(document.getElementById('parentLanMuId').options[document.getElementById('parentLanMuId').selectedIndex].value)"
size="1">
<option value="0" selected>一级分类</option>
<%
LanMuService LanMu = new LanMuService();
Iterator it_lanmu1 = LanMu.findParentSelect();
while (it_lanmu1.hasNext()) {
ParentLanmuTab pl = (ParentLanmuTab) it_lanmu1.next();
%>
<option value="<%=pl.getId()%>"
<%if(pl.getId().equals(info.getParentLanMuId())){ out.println("selected"); }%>
><%=pl.getName()%>
</option>
<%
}
%>
</select>
</td>
<td>
<select name="childLanMuId" id="childLanMuId">
<option value="0" selected>二级分类</option>
<%
LanMuService _twoLanMu = new LanMuService();
Iterator _childLanMu = _twoLanMu.findChildSelect(info.getParentLanMuId());
while (_childLanMu.hasNext()) {
ChildLanmuTab _cll = (ChildLanmuTab)_childLanMu.next();
System.out.println(_cll.getId());
%>
<option value="<%=_cll.getId()%>"
<%if(info.getChildLanMuId().equals(_cll.getId())){ out.println("selected"); }%>
<%System.out.println("子栏目 id= "+info.getChildLanMuId());%>
><%=_cll.getName()%>
</option>
<%} %>
</select>
</td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><c:import url="/sortform/modifyInfo.jsp" charEncoding="GBK"></c:import>
</td>
</tr>
</table>
</form>
</div>
<div class="clear"></div>
</div>
<!--页脚-->
<c:import url="/foot.jsp" charEncoding="GBK"></c:import>
<!--页面加载时 调用相应表单 -->
<script type="text/javascript">
function loadForm()
{
changelocation_lanmu(<%=info.getParentLanMuId() %>);
changelocation_area(<%=info.getParentAreaId() %>);
document.getElementById('childAreaId').value='<%=info.getChildAreaId() %>';
document.getElementById('childLanMuId').value='<%=info.getChildLanMuId() %>';
}
</script>
</body>
</html>