📄 admin_nsort.asp
字号:
<!-- #include file="include/admin_onlogin.asp" -->
<%
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -