<!--#include file="conn.asp"-->
<!--#include file="inc/cook2.asp"-->
<!--#include file="inc/dimflag.asp"-->
<!--#include file="top.asp"-->
<%
dim id,ClassNamecn,paixu
id=request.QueryString("id")
tid=request("tid")

action=request.QueryString("action")
select case action
case "cn1"
 call editbook("showin=0")
case "cn2"
 call editbook("showin=1")
end select

function editbook(b_name)
aid=request.QueryString("aid")
conn.execute("update com_class set "&b_name&" where id="&aid)
'response.Write "<script>location='?"&canshu2&"'</script->"
End Function
%>
<div id="container">
<div class="top_but">
 <li class="left"></li>
 <li><a href="#"><img src="images/but_1.gif" alt="添加" ></a></li>
 <li><a href="book_manage.asp?tid=<%=tid%>" onClick="parent.frmleft.bb(0,10,'b');"><img src="images/but_11.gif" alt="管理"></a></li>
 <li><img src="images/but_8.gif" alt="刷新" style="cursor:hand" onClick="window.location.reload(true);"></li>
 <li><img src="images/but_9.gif" alt="打印" style="cursor:hand;" onClick="window.print() "/></li>
 <li class="right"><select name="select" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" >
          <option >选择大类</option>
          <%set rs=server.createobject("adodb.recordset")
		rs.Open "select * from com_class where cid=0 and type="&tid&" order by pid asc,id desc",conn,1,1
		while not rs.eof %>
          <option value="?id=<%=rs("id")%>&tid=<%=tid%>" <%if rs("id")=cint(request.QueryString("id")) then %>selected<%end if%>>
		  <%=rs("ClassNamecn")%>
		  </option>
          <%rs.movenext
		wend
		rs.close
		set rs=nothing
		%>
        </select></li>
</div>

<div class="tableAll titlebgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:150px;"><%=language_cn%>小分类</li>
 <li style="width:50px;">首显</li>
<li style="width:150px;">分类广告图</li>
 <%if Const_webEn =1 then%><li style="width:150px;"><%=language_en%>小分类</li><%end if%>
 <%if Const_webUtf =1 then%><li style="width:150px;"><%=language_utf%>小分类</li><%end if%>
 <li style="width:50px;">排序</li>
 <li style="width:80px;">操作</li>
</div>

<%
if id="" then
response.Write ""
else
set rs=server.CreateObject("adodb.recordset")
rs.Open "select * from com_class where cid="&id&" and nid=0 order by pid asc,id desc",conn,1,1
if rs.EOF and rs.BOF then
response.Write "还没有小分类"
paixu=0
else
%>
<%while not rs.EOF%>
<form name="form<%=rs("id")%>" method="post" action="book_nclasssave.asp?action=edit&nid=<%=rs("id")%>&tid=<%=tid%>">

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:150px;"><input name="ClassNamecn" type="text" value="<%=trim(rs("ClassNamecn"))%>"> <input name="id" type="hidden" value="<%=request.QueryString("id")%>" id="Hidden1"></li>
 <li style="width:50px;"><%if rs("showin")=1 then%><a href="?action=cn1&aid=<%=rs("id")%>&id=<%=rs("cid")%>&tid=<%=tid%>" title="点击更改显示状态"><font color=green>√</font></a>
 <%else%><a href="?action=cn2&aid=<%=rs("id")%>&id=<%=rs("cid")%>&tid=<%=tid%>" title="点击更改显示状态"><font color=#999999>×</font></a><%end if%></li>
 
 <li style="width:150px;"><a href="book_class_sm.asp?id2=<%=id%>&id=<%=rs("id")%>&tid=<%=tid%>&cs=2">点击编辑分类图</a></li>
 <%if Const_webEn =1 then%><li style="width:150px;"><input name="ClassNameEn" type="text" value="<%=trim(rs("ClassNameEn"))%>"></li><%end if%>
 <%if Const_webUtf =1 then%><li style="width:150px;"><input name="ClassNameutf" type="text" value="<%=trim(rs("ClassNameutf"))%>"></li><%end if%>
 <li style="width:50px;"><input name="pid" type="text" size="2" value="<%=int(rs("pid"))%>"></li>
 <li style="width:80px;"><a href="javascript:form<%=rs("id")%>.submit();">修改</a>
          <a href="book_nclasssave.asp?nid=<%=int(rs("id"))%>&tid=<%=tid%>&action=del&id=<%=request.QueryString("id")%>" onClick="return confirm('此删除操作，会删除此分类下的所有资料！您确定进行删除操作吗？')">删除</a></li>
</div>

</form>
<%
rs.movenext
wend
paixu=rs.RecordCount
rs.close
set rs=nothing
end if
end if
%>
<form name="formadd" method="post" action="book_nclasssave.asp?action=add&anclass=<%=request.QueryString("ClassNamecn")%>&tid=<%=tid%>">
<div class="tableAll titlebgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:700px"><select name="select2" onChange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}" >
          <option >选择大类</option>
          <%set rs=server.createobject("adodb.recordset")
		rs.Open "select * from com_class where cid=0 and type="&tid&" and LevelID=0 order by pid asc,id desc",conn,1,1
		while not rs.eof %>
          <option value="?id=<%=rs("id")%>&tid=<%=tid%>" <%if rs("id")=cint(request.QueryString("id")) then %>selected<%end if%>>
		  <%=rs("ClassNamecn")%>
		  </option>
          <%rs.movenext
		wend
		rs.close
		set rs=nothing
		%>
        </select>&nbsp;请先选择大类后，再添加小分类(注意：小类名称不要含有非法字符)</li>
</div>

<div class="tableAll trbgcolor">
  <li style="width:30px;">&nbsp;</li>
 <li style="width:150px;"><input name="ClassNamecn2" type="text"> <input name="id" type="hidden" value="<%=request.QueryString("id")%>"></li>
 <%if Const_classsm =1 then%><li style="width:150px;"></li><%end if%>
 <%if Const_webEn =1 then%><li style="width:150px;"><input name="ClassNameEn2" type="text"></li><%end if%>
 <%if Const_webUtf =1 then%><li style="width:150px;"><input name="ClassNameutf2" type="text"></li><%end if%>
 <li style="width:50px;"><input name="pid2" type="text" id="pid2" size="2" value="<%=paixu+1%>"></li>
 <li style="width:80px;"><a href="javascript:formadd.submit();">添加</a></li>
</div>

</form>
</div>
<!--#include file="footer.asp"-->