<!-- #include file="include/admin_onlogin.asp" -->
<%
'****************************************************
' 阳光情缘 2006V3.0      Power by sdsun.com.cn
' Email: 27072320@qq.com  , sdsun163@163.com
' Web: http://www.sdsun.com.cn
' Copyright (C) 2006 sdsun.com.cn All Rights Reserved.
'****************************************************

dim n_data_name,n_on_power,n_on_omoney,ndim,nnum,cname,cremark,sname,ntit1,ntit2
n_on_power=false
n_on_omoney=false
index_url="nsort"
call admin_master(0,0)
call admin_cid_sid()
call admin_header(0,0)
nsort=""
ntit=tit
call joekoe_chk_dim()
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?nsort=<%response.write nsort%>'><%response.write ntit1&tit%></a></td>
  <td width=10></td>
  <td><a href='?nsort=<%response.write nsort%>&action=addc'>添加一级<%response.write ntit%></a></td>
  <td width=10></td>
  <td><a href='?nsort=<%response.write nsort%>&action=list' alt='在您发现<%response.write tit_fir%>排序等发生不正常时请点击，可进行有效的修覆'>重新排序</a></td>
  <td width=10></td>
  <td><a href='?jk_mod=data&nsort=<%response.write nsort%>'<%if jk_mod="data" then response.write " class=red"%>><%response.write ntit%>数据合并</a></td>
  <td width=10></td>
  <td><a href='?jk_mod=batch&nsort=<%response.write nsort%>&action=power'<%if jk_mod="batch" then response.write " class=red"%>><%response.write ntit1%>批量数据处理</a></td>
  <%call joekoe_is_js("&nsort="&nsort,ntit)%>
  </tr>
  </table>
</td></tr>
</table>
<%
call admin_table(1)
call admin_td(ntit)

if int(nnum)<0 then
  response.write vbcrlf&"<tr><td align=center height=100 colspan=2><font class=red>暂时没有栏目"&tit_fir&"可管理！</font><br><br>请先在 <a href='admin_menu.asp'>管理菜单</a> 里设置正确。</td></tr>"
else
  response.write vbcrlf&"<tr align=center valign=top><td>" & _
		 vbcrlf&"<table class=table2>" & _
		 vbcrlf&"<tr><td width=15></td><td></td></tr>"
  for i=0 to nnum
    if nsort=ndim(0,i) then
      response.write vbcrlf&"<tr><td width='20%' align=center>"&img_admin("s_left_sort","")&"</td><td><a href='?nsort="&ndim(0,i)&"' class=red2>"&ndim(1,i)&tit_fir&"</a></td></tr>"
    else
      response.write vbcrlf&"<tr><td width='20%' align=center>"&img_admin("s_nsort","")&"</td><td><a href='?nsort="&ndim(0,i)&"'>"&ndim(1,i)&tit_fir&"</a></td></tr>"
    end if
  next
  response.write vbcrlf&"</table>" & _
		 vbcrlf&"</td><td width='80%'>"
  select case jk_mod
  case "batch"
    call joekoe_chk_batch()
  case "data"
    call joekoe_chk_data()
  case else  
    select case action
    case "up","down"
     ntit2=tit_fir&"查看"
     call joekoe_chk_order()
    case "del"
     ntit2=tit_fir&"查看"
     call joekoe_chk_del()
    case "list"
     ntit2=tit_fir&"查看"
     call joekoe_chk_list()
    case "addc"
     ntit2="添加一级"&tit_fir
     call joekoe_chk_addc()
    case "adds"
     ntit2="添加二级"&tit_fir
     call joekoe_chk_adds()
    case "editc"
     ntit2="修改一级"&tit_fir
     call joekoe_chk_editc()
    case "edits"
     ntit2="修改二级"&tit_fir
     call joekoe_chk_edits()
    case "js"
     ntit2=tit_fir&"查看"
     call joekoe_chk_js()
    case else
     ntit2=tit_fir&"查看"
     call joekoe_chk_main()
    end select
  end select
  response.write vbcrlf&"</td></tr>"
end if

call joekoe_chk_erase()
call admin_ender(1)

sub joekoe_chk_batch()
  dim is_all,is_power,is_emoney,power,emoney
%>
<table border=0>
<tr><td colspan=2 align=center height=30><b><%response.write ntit1%>批量数据处理</b> (表：<%response.write n_data_name%>)</td></tr>
<%
  if chk() then
    is_all=false
    if trim(request.form("is_all"))="yes" then is_all=true
    csid=trim(request.form("c_id"))
    call chk_cid_sid()
    is_power=false
    if trim(request.form("is_power"))="yes" then is_power=true
    is_emoney=false
    if trim(request.form("is_emoney"))="yes" then is_emoney=true
    power=code_admin("power",1,50)
    power=replace(power," ","")
    power=replace(power,",",".")
    emoney=trim(request.form("emoney"))
    if is_all=false and cs_nd(csid)=false then
      call admin_error("请选择 "&ntit&" ！")
      response.write vbcrlf&"</table>"
      exit sub
    end if
    if is_power=false and is_emoney=false then
      call admin_error("请至少选择一项数据进行处理 ！")
      response.write vbcrlf&"</table>"
      exit sub
    end if
    sql="update "&n_data_name&" set "
    if is_emoney=true then sql=sql&"emoney="&emoney
    if is_power=true then
      if is_emoney=true then sql=sql&","
      sql=sql&"power='"&power&"'"
    end if
    if is_all=false then
      if int(sid)>0 then
        sql=sql&" where s_id="&sid
      else
        sql=sql&" where c_id="&cid
      end if
    end if
    call joekoe_cms.exec(sql,0)
    call admin_msg("已成功对"&ntit1&"数据进行了批量处理！","?jk_mod="&jk_mod&"&nsort="&nsort,1)
    response.write vbcrlf&"</table>"
    exit sub
  end if
  call form_first()
%>
<form action='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write nsort%>' method=post>
<input type=hidden name=chk value='yes'>
<tr><td colspan=2></td></tr>
<tr><td colspan=2>所有<%response.write tit_fir%>：<input type=checkbox name=is_all value='yes'>选择将对所有<%response.write ntit%>数据进行批量处理</td></tr>
<tr><td colspan=2><%response.write ntit%>：<%call chk_csid(nsort,cid,sid)%></td></tr>
<tr><td height=10></td></tr>
<%if n_on_omoney=true then%>
<tr><td colspan=2>是否修改<%response.write joekoe_cms.web_unit%>：<input type=checkbox name=is_emoney value='yes'>选择后对<%response.write joekoe_cms.web_unit%>的修改才会生效</td></tr>
<tr><td colspan=2>所需<%call chk_emoney(0)%></td></tr>
<tr><td height=10></td></tr>
<%end if%>
<%if n_on_power=true then%>
<tr><td colspan=2>是否修改权限：<input type=checkbox name=is_power value='yes'>选择后对权限的修改才会生效</td></tr>
<%call chk_power("配置","",1)%>
<tr><td height=10></td></tr>
<%end if%>
<tr><td colspan=2 align=center height=30><input type=submit value='进行<%response.write ntit1%>批量数据处理' onclick="javascript:return click_return('对<%response.write ntit1%>数据进行批量处理',0);"></td></tr>
</form>
</table>
<%
end sub

sub joekoe_chk_data()
%>
<table border=0>
<tr><td colspan=2 align=center height=30><b><%response.write ntit%>数据合并</b> (表：<%response.write n_data_name%>)</td></tr>
<%
  dim csid1,csid2,cid1,sid1,cid2,sid2
  if chk() then
    csid1=trim(request.form("c_id1"))
    csid2=trim(request.form("c_id2"))
    if data_cs_nd(csid1,1)=false or data_cs_nd(csid2,2)=false then
      call admin_error("请选择 "&ntit&"！")
      response.write vbcrlf&"</table>"
      exit sub
    end if
    call data_cid_sid(csid1)
    cid1=cid
    sid1=sid
    call data_cid_sid(csid2)
    cid2=cid
    sid2=sid
    sql="update "&n_data_name&" set c_id="&cid2&",s_id="&sid2&" where c_id="&cid1
    if int(sid1)>0 then sql=sql&" and s_id="&sid1
    call joekoe_cms.exec(sql,0)
    call admin_msg("已成功编辑了合并"&ntit&"数据！","?jk_mod="&jk_mod&"&nsort="&nsort,1)
    response.write vbcrlf&"</table>"
    exit sub
  end if
  call form_first()
%>
<form action='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write nsort%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td width='20%' width=>从<%response.write tit_fir%>：</td>
<td width='80%'><%call joekoe_chk_data_select(1)%></td>
</tr>
<tr>
<td>转换到<%response.write tit_fir%>：</td>
<td><%call joekoe_chk_data_select(2)%></td>
</tr>
<tr><td colspan=2 align=center height=30><input type=submit value='进行<%response.write ntit%>数据合并' onclick="javascript:return click_return('合并当前选择的<%response.write ntit%>数据',0);"></td></tr>
</form>
</table>
<%
end sub

sub data_cid_sid(dcsid)
  if isnumeric(dcsid) then
    cid=dcsid
    sid=0
  else
    cid=mid(dcsid,1,instr(dcsid,"_")-1)
    sid=mid(dcsid,instr(dcsid,"_")+1,len(dcsid))
  end if
end sub

function data_cs_nd(dc_var,dc_num)
  dim csnd
  data_cs_nd=true
  csnd=joekoe_cms.code_form("csnd"&dc_num)
  if len(dc_var)<1 then
    data_cs_nd=false
    exit function
  end if
  if csnd="yes" then
    if isnumeric(dc_var) then
      data_cs_nd=false
      exit function
    end if
  end if
end function

sub joekoe_chk_data_select(cc_var)
  dim sql2,rs2,sql3,rs3,csnd,now_id,n_id
  csnd="no"
  response.write "<select name=c_id"&cc_var&" size=1>"
  sql3="select c_id,c_name from jk_class where nsort='"&nsort&"' order by c_order,c_id"
  set rs3=joekoe_cms.exec(sql3,1)
  do while not rs3.eof
    n_id=int(rs3(0))
    response.write vbcrlf&"<option value='"&n_id&"' class=bg_2>"&rs3(1)&"</option>"
    sql2="select s_id,s_name from jk_sort where c_id="&n_id&" order by s_order,s_id"
    set rs2=joekoe_cms.exec(sql2,1)
    do while not rs2.eof
      now_id=int(rs2(0))
      csnd="yes"
      response.write vbcrlf&"<option value='"&n_id&"_"&now_id&"'>　"&rs2(1)&"</option>"
      rs2.movenext
    loop
    rs2.close
    set rs2=nothing
    rs3.movenext
  loop
  rs3.close
  set rs3=nothing
  response.write "</select><input type=hidden name=csnd"&cc_var&" value='"&csnd&"'>"&redx&"如有二级分类，请选择一个二级分类"
end sub

sub joekoe_chk_js()
  dim rs2,sql2,ncid,temp1,file_name,c_num
  file_name="style/data_sort_"&nsort&".asp"
  i=0
  ncid=0
  c_num=5
  sql="select count(c_id) from jk_class where nsort='"&nsort&"'"
  set rs=joekoe_cms.exec(sql,1)
  if not rs.eof then
    c_num=int(rs(0))-1
  end if
  rs.close
  temp1=temp1&"<"&"%" & _
      vbcrlf&"redim sort_dim("&c_num&")"
  sql="select c_id,c_name from jk_class where nsort='"&nsort&"' order by c_order,c_id"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    cid=rs(0)
    cname=rs("c_name")
    temp1=temp1&vbcrlf&"sort_dim("&i&")="""&code_fso(cname,1,1)&":"&cid
    sql2="select s_id,s_name from jk_sort where c_id="&cid&" order by s_order,s_id"
    set rs2=joekoe_cms.exec(sql2,1)
    do while not rs2.eof
      sid=rs2(0)
      sname=rs2(1)
      temp1=temp1&"|"&code_fso(sname,1,1)&":"&sid
      rs2.movenext
    loop
    rs2.close
    temp1=temp1&""""
    rs.movenext
    i=i+1
  loop
  rs.close
  if isobject(rs2) then set rs2=nothing
  temp1=temp1&vbcrlf&"%"&">"
  call create_file(file_name,temp1)
  call admin_event("更新"&ntit&"分类数据："&file_name,0,0)
  call admin_msg("已成功更新了"&ntit&"分类数据："&file_name,"?nsort="&nsort,1)
end sub

sub joekoe_chk_del()
  if int(cid)<1 and int(sid)<1 then
    call joekoe_chk_main()
    exit sub
  end if
  dim del_true
  del_true=false
  if int(cid)>0 then sid=0
  if int(sid)<1 then
    sql="select count(*) from "&n_data_name&" where c_id="&cid
    set rs=joekoe_cms.exec(sql,1)
    if rs(0)>0 then del_true=true
    rs.close
    if del_true=true then
      call admin_msg("删除一级"&tit_fir&"失败：一级"&ntit&"下有数据存在！\n\n请先进行"&tit_fir&"数据合并后再尝试删除。","?nsort="&nsort,1)
    else
      call joekoe_cms.exec("delete from jk_sort where c_id="&cid,0)
      call joekoe_cms.exec("delete from jk_class where c_id="&cid,0)
      call admin_event("删除一个一级"&ntit&"及其下面的二级"&tit_fir,0,0)
      call admin_msg("已成功删除一个一级"&ntit&"及其下面的二级"&tit_fir&"！","?nsort="&nsort,1)
    end if
  else
    sql="select count(*) from "&n_data_name&" where s_id="&sid
    set rs=joekoe_cms.exec(sql,1)
    if rs(0)>0 then del_true=true
    rs.close
    if del_true=true then
      call admin_msg("删除二级"&tit_fir&"失败：二级"&ntit&"下有数据存在！\n\n请先进行"&tit_fir&"数据合并后再尝试删除。","?nsort="&nsort,1)
    else
      call joekoe_cms.exec("delete from jk_sort where s_id="&sid,0)
      call admin_event("删除一个二级"&ntit,0,0)
      call admin_msg("已成功删除一个二级"&ntit&"！","?nsort="&nsort,1)
    end if
  end if
end sub

sub joekoe_chk_list()
  dim j,sql2,rs2
  i=1
  sql="select c_id from jk_class where nsort='"&nsort&"' order by c_order,c_id"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    cid=rs(0)
    j=1
    call joekoe_cms.exec("update jk_class set c_order="&i&" where c_id="&cid,0)
    sql2="select s_id from jk_sort where c_id="&cid&" order by s_order,s_id"
    set rs2=joekoe_cms.exec(sql2,1)
    do while not rs2.eof
      call joekoe_cms.exec("update jk_sort set s_order="&j&" where s_id="&rs2(0),0)
      rs2.movenext
      j=j+1
    loop
    rs2.close
    rs.movenext
    i=i+1
  loop
  rs.close
  if isobject(rs2) then set rs2=nothing
  call joekoe_chk_main()
end sub

sub joekoe_chk_order()
  dim nid,t1,t11,t2,t22
  if int(cid)<1 and int(sid)<1 then
    call joekoe_chk_main()
    exit sub
  end if
  if int(cid)>0 then sid=0
  if action="up" then sql_add=" desc"
  if int(sid)=0 then
    t1=int(cid)
    sql="select c_id,c_order from jk_class where nsort='"&nsort&"' order by c_order"&sql_add&",c_id"&sql_add
    set rs=joekoe_cms.exec(sql,1)
    do while not rs.eof
      nid=int(rs(0))
      if int(cid)=nid then
        t22=rs(1)
        rs.movenext
        if rs.eof then exit do
        t2=rs(0)
        t11=rs(1)
        call joekoe_cms.exec("update jk_class set c_order="&t11&" where c_id="&t1,0)
        call joekoe_cms.exec("update jk_class set c_order="&t22&" where c_id="&t2,0)
        exit do
      end if
      rs.movenext
    loop
    
rs.close
  else
    t1=int(sid)
    sql="select jk_sort.c_id from jk_class inner join jk_sort on jk_class.c_id=jk_sort.c_id where jk_sort.s_id="&sid
    set rs=joekoe_cms.exec(sql,1)
    if rs.eof then
      rs.close
      call joekoe_chk_main()
      exit sub
    end if
    cid=int(rs(0))
    
rs.close
    sql="select s_id,s_order from jk_sort where c_id="&cid&" order by s_order"&sql_add&",s_id"&sql_add
    set rs=joekoe_cms.exec(sql,1)
    do while not rs.eof
      nid=int(rs(0))
      if int(sid)=nid then
        t22=rs(1)
        rs.movenext
        if rs.eof then exit do
        t2=rs(0)
        t11=rs(1)
        call joekoe_cms.exec("update jk_sort set s_order="&t11&" where s_id="&t1,0)
        call joekoe_cms.exec("update jk_sort set s_order="&t22&" where s_id="&t2,0)
        exit do
      end if
      rs.movenext
    loop
    
rs.close
  end if
  call joekoe_chk_main()
end sub

sub joekoe_chk_edits()
  dim s_order,ncid
  sql="select top 1 c.c_name,s.s_name from jk_class c inner join jk_sort s on c.c_id=s.c_id where c.nsort='"&nsort&"' and s.s_id="&sid
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    rs.close
    call admin_msg("二级"&tit_fir&"ID（"&sid&"）不存在！","?nsort="&nsort,1)
    exit sub
  end if
  cname=rs(0)
  sname=rs(1)
  rs.close
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr>
<td class=td width='20%'></td>
<td class=td width='80%'><%response.write ntit&"（"&ntit2&"）"%></td>
</tr>
<%
  if chk() then
    sname=code_admin("s_name",1,16)
    if sname="" then
      call admin_error("二级"&tit_fir&"名称不能为空！")
      response.write "</table>"
      exit sub
    end if
    sql="update jk_sort set s_name='"&sname&"' where s_id="&sid
    call joekoe_cms.exec(sql,0)
    call admin_msg("成功修改二级"&tit_fir&"（"&sname&"）！","?nsort="&nsort,1)
    response.write "</table>"
    exit sub
  end if
  call form_first()
%>
<form action='?nsort=<%response.write nsort%>&action=edits&s_id=<%response.write sid%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td>一级<%response.write tit_fir%>名称：</td>
<td><font class=blue><b><%response.write cname%></b></font></td>
</tr>
<tr>
<td>二级<%response.write tit_fir%>名称：</td>
<td><input type=text name=s_name value='<%response.write sname%>' size=30 maxlength=16><%response.write redx%></td>
</tr>
<%
  call submit_edit()
  response.write "</table>"
end sub

sub joekoe_chk_adds()
  dim s_order,ncid
  sql="select top 1 c_name from jk_class where nsort='"&nsort&"' and c_id="&cid
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    rs.close
    call admin_msg("一级"&tit_fir&"ID（"&cid&"）不存在！","?nsort="&nsort,1)
    exit sub
  end if
  cname=rs(0)
  rs.close
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr>
<td class=td width='20%'></td>
<td class=td width='80%'><%response.write ntit&"（"&ntit2&"）"%></td>
</tr>
<%
  if chk() then
    sname=code_admin("s_name",1,16)
    if sname="" then
      call admin_error("二级"&tit_fir&"名称不能为空！")
      response.write "</table>"
      exit sub
    end if
    s_order=1
    sql="select top 1 s_order from jk_sort where c_id="&cid&" order by s_order desc"
    set rs=joekoe_cms.exec(sql,1)
    if not rs.eof then s_order=int(rs(0))+1
    rs.close
    sql="insert into jk_sort(c_id,s_name,s_order) values('"&cid&"','"&sname&"',"&s_order&")"
    call joekoe_cms.exec(sql,0)
    call admin_msg("成功添加二级"&tit_fir&"（"&sname&"）！","?nsort="&nsort,1)
    response.write "</table>"
    exit sub
  end if
  call form_first()
%>
<form action='?nsort=<%response.write nsort%>&action=adds&c_id=<%response.write cid%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td>一级<%response.write tit_fir%>名称：</td>
<td><font class=blue><b><%response.write cname%></b></font></td>
</tr>
<tr>
<td>二级<%response.write tit_fir%>名称：</td>
<td><input type=text name=s_name size=30 maxlength=16><%response.write redx%></td>
</tr>
<%
  call submit_add()
  response.write "</table>"
end sub

sub joekoe_chk_editc()
  sql="select top 1 c_name,c_remark from jk_class where nsort='"&nsort&"' and c_id="&cid
  set rs=joekoe_cms.exec(sql,1)
  if rs.eof then
    rs.close
    call admin_msg("一级"&tit_fir&"ID（"&cid&"）不存在！","?nsort="&nsort,1)
    exit sub
  end if
  cname=rs(0)
  cremark=rs(1)
  rs.close
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr>
<td class=td width='20%'></td>
<td class=td width='80%'><%response.write ntit&"（"&ntit2&"）"%></td>
</tr>
<%
  if chk() then
    cname=code_admin("c_name",1,16)
    if cname="" then
      call admin_error("一级"&tit_fir&"名称不能为空！")
      response.write "</table>"
      exit sub
    end if
	cremark=code_admin("c_remark",1,250)
    sql="update jk_class set c_name='"&cname&"',c_remark='"&cremark&"' where c_id="&cid
    call joekoe_cms.exec(sql,0)
    call admin_msg("成功编辑一级"&tit_fir&"（"&cname&"）！","?nsort="&nsort,1)
    response.write "</table>"
    exit sub
  end if
  call form_first()
%>
<form action='?nsort=<%response.write nsort%>&action=editc&c_id=<%response.write cid%>' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td>一级<%response.write tit_fir%>名称：</td>
<td><input type=text name=c_name value='<%response.write cname%>' size=30 maxlength=16><%response.write redx%></td>
</tr>
<% if nsort="flea" then %>
<tr>
<td>一级<%response.write tit_fir%>说明：</td>
<td class=gray><input type=text name=c_remark value='<%response.write cremark%>' size=50 maxlength=250><%response.write redx%>跳蚤市场专用</td>
</tr>
<%
 end if
  call submit_edit()
  response.write "</table>"
end sub

sub joekoe_chk_addc()
  dim c_order
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr>
<td class=td width='20%'></td>
<td class=td width='80%'><%response.write ntit&"（"&ntit2&"）"%></td>
</tr>
<%
  if joekoe_cms.chk() then
    cname=code_admin("c_name",1,16)
    if cname="" then
      call admin_error("一级"&tit_fir&"名称不能为空！")
      response.write "</table>"
      exit sub
    end if
    c_order=1
	cremark=code_admin("c_remark",1,250)
    sql="select top 1 c_order from jk_class where nsort='"&nsort&"' order by c_order desc"
    set rs=joekoe_cms.exec(sql,1)
    if not rs.eof then c_order=int(rs(0))+1
    rs.close
    sql="insert into jk_class(nsort,c_name,c_order,c_remark) values('"&nsort&"','"&cname&"',"&c_order&",'"&cremark&"')"
    call joekoe_cms.exec(sql,0)
    call admin_msg("成功添加一级"&tit_fir&"（"&cname&"）！","?nsort="&nsort,1)
    response.write "</table>"
    exit sub
  end if
  call form_first()
%>
<form name=add_frm action='?jk_mod=<%response.write jk_mod%>&nsort=<%response.write nsort%>&action=addc' method=post>
<input type=hidden name=chk value='yes'>
<tr>
<td>一级<%response.write tit_fir%>名称：</td>
<td><input type=text name=c_name size=30 maxlength=16><%response.write redx%></td>
</tr>
<% if nsort="flea" then %>
<tr>
<td>一级<%response.write tit_fir%>说明：</td>
<td class=gray><input type=text name=c_remark size=50 maxlength=250><%response.write redx%>跳蚤市场专用</td>
</tr>
<%
  end if
  call submit_add()
  response.write "</table>"
end sub

sub joekoe_chk_main()
  dim rs2,sql2
%>
<table cellspacing=1 cellpadding=3 class=table0>
<tr align=center>
<td class=td width='70%'><%response.write ntit%>名称及添加操作</td>
<td class=td width='30%'>相关操作</td>
</tr>
<%
  'sql="select c.c_id,s.s_id,c.c_name,s.s_name from jk_class c inner join jk_sort s on c.c_id=s.c_id where c.nsort='"&nsort&"' order by c.c_order,c.c_id,s.s_order,s.s_id"
  sql="select c_id,c_name,c_remark from jk_class where nsort='"&nsort&"' order by c_order,c_id"
  set rs=joekoe_cms.exec(sql,1)
  do while not rs.eof
    cid=rs(0)
    cname=rs("c_name")
%>
<tr>
<td>&nbsp;<%response.write img_admin("s_left","")%>&nbsp;<font class=red2><b><%response.write cname%></b></font>&nbsp;（<a href='?nsort=<%response.write nsort%>&action=adds&c_id=<%response.write cid%>'>添加二级分类</a>）</td>
<td>
&nbsp;<a href='?nsort=<%response.write nsort%>&c_id=<%response.write cid%>&action=editc'>编辑</a>
&nbsp;<a href='?nsort=<%response.write nsort%>&c_id=<%response.write cid%>&action=up'><%response.write img_admin("up_1","向上移动此主"&tit_fir)%></a>
&nbsp;<a href='?nsort=<%response.write nsort%>&c_id=<%response.write cid%>&action=down'><%response.write img_admin("down_1","向下移动此主"&tit_fir)%></a>
&nbsp;<a href='?nsort=<%response.write nsort%>&c_id=<%response.write cid%>&action=del' onclick="return del_nsort(<%response.write cid%>,'<%response.write cname%>','yes');">删除</a>
</td>
</tr>
<%
    sql2="select s_id,s_name from jk_sort where c_id="&cid&" order by s_order,s_id"
    set rs2=joekoe_cms.exec(sql2,1)
    do while not rs2.eof
      sid=rs2(0)
      sname=rs2(1)
%>
<tr>
<td>&nbsp;　<font class=blue><b><%response.write sname%></b></font></td>
<td>
&nbsp;<a href='?nsort=<%response.write nsort%>&s_id=<%response.write sid%>&action=edits'>修改</a>
&nbsp;<a href='?nsort=<%response.write nsort%>&s_id=<%response.write sid%>&action=up'><%response.write img_admin("up_2","向上移动此二级"&tit_fir)%></a>
&nbsp;<a href='?nsort=<%response.write nsort%>&s_id=<%response.write sid%>&action=down'><%response.write img_admin("down_2","向下移动此二级"&tit_fir)%></a>
&nbsp;<a href='?nsort=<%response.write nsort%>&s_id=<%response.write sid%>&action=del' onclick="return del_nsort(<%response.write sid%>,'<%response.write sname%>','no');">删除</a>
</td>
</tr>
<%
      rs2.movenext
    loop
    rs2.close
    rs.movenext
  loop
  rs.close
  if isobject(rs2) then set rs2=nothing
%>
</table>
<script language=javascript>
<!--
function del_nsort(t1,t2,t3)
{
  if (t3=="yes")
  {
    var cf=window.confirm("您确定要删除主<%response.write tit_fir%>（"+t2+"）吗？\n其下的二级<%response.write tit_fir%>也将一并删除！\n\n删除后将不可恢复！是否确定该操作？");
    if (cf)
    { return true; }
    else
    { return false; }
  }
  else
  {
    var cf1=window.confirm("您确定要删除二级<%response.write tit_fir%>（"+t2+"）吗？\n\n删除后将不可恢复！是否确定该操作？");
    if (cf1)
    { return true; }
    else
    { return false; }
  }
  return false;
}
-->
</script>
<%
end sub

sub joekoe_chk_dim()
  dim tmpsort
  tmpsort=trim(request.querystring("nsort"))
  nnum=-1
  sql="select m_nsort,m_tit_fir,m_data_name,m_on_power,m_on_emoney from admin_menu where m_is_master=1 and m_is_nsort=1"
  if jk_mod="batch" then
    sql=sql&" and (m_on_power=1 or m_on_emoney=1)"
  end if
  sql=sql&" order by m_id"
  call joekoe_cms.exec("",-1)
  rs.open sql,conn,1,1
  if not rs.eof then
    nnum=rs.recordcount-1
    redim ndim(4,nnum)
    for i=1 to nnum+1
      ndim(0,i-1)=rs(0)
      ndim(1,i-1)=rs(1)
      ndim(2,i-1)=rs(2)
      ndim(3,i-1)=rs(3)
      ndim(4,i-1)=rs(4)
      if tmpsort=ndim(0,i-1) then
        nsort=tmpsort
        ntit=ndim(1,i-1)
        n_data_name=ndim(2,i-1)
        n_on_power=ndim(3,i-1)
        n_on_omoney=ndim(4,i-1)
      end if
      rs.movenext
    next
    if nsort="" then
      nsort=ndim(0,0)
      ntit=ndim(1,0)
      n_data_name=ndim(2,0)
      n_on_power=ndim(3,0)
      n_on_omoney=ndim(4,0)
    end if
    ntit1=ntit
    ntit=ntit&tit_fir
  end if
  rs.close
end sub

sub joekoe_chk_erase()
  if isarray(ndim) then erase ndim
end sub
'****************************************************
' 阳光情缘 2006V3.0      Power by sdsun.com.cn
' Email: 27072320@qq.com  , sdsun163@163.com
' Web: http://www.sdsun.com.cn
' Copyright (C) 2006 sdsun.com.cn All Rights Reserved.
'****************************************************
%>
