📄 vocationclass.asp
字号:
<% Option Explicit %>
<!--#include file="../../FS_Inc/Const.asp" -->
<!--#include file="../../FS_InterFace/MF_Function.asp" -->
<!--#include file="../../FS_Inc/Function.asp" -->
<!--#include file="../../FS_Inc/Func_page.asp" -->
<% 'Copyright (c) 2006 Foosun Inc. Code by awen
Dim Conn,User_Conn,VClass_Rs,VClass_Sql
Dim str_Url_Add,CheckStr
MF_Default_Conn
MF_User_Conn
MF_Session_TF
if not MF_Check_Pop_TF("ME_HY") then Err_Show
Dim int_RPP,int_Start,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo
int_RPP=15 '设置每页显示数目
int_showNumberLink_=10 '数字导航显示数目
showMorePageGo_Type_ = 1 '是下拉菜单还是输入值跳转,当多次调用时只能选1
str_nonLinkColor_="#999999" '非热链接颜色
toF_="<font face=webdings>9</font>" '首页
toP10_=" <font face=webdings>7</font>" '上十
toP1_=" <font face=webdings>3</font>" '上一
toN1_=" <font face=webdings>4</font>" '下一
toN10_=" <font face=webdings>8</font>" '下十
toL_="<font face=webdings>:</font>" '尾页
'******************************************************************
Sub DelClass()
if not MF_Check_Pop_TF("ME026") then Err_Show
Dim DelID,Str_Tmp,Str_Tmp1
DelID = request.Form("DelID")
if DelID = "" then
response.Redirect("../error.asp?ErrorUrl=&ErrCodes=<li>你必须选择一项再删除。</li>")
response.End()
end if
DelID = replace(DelID," ","")
Str_Tmp1 = DelID
''**********************
do while Str_Tmp1 <> ""
Str_Tmp1 = Get_VCID_VCID_TO_Del(Str_Tmp1)
Str_Tmp = Str_Tmp & Str_Tmp1
loop
if right(Str_Tmp,1) = "," then
Str_Tmp = Str_Tmp & DelID
elseif Str_Tmp<>"" then
Str_Tmp = Str_Tmp &","& DelID
else
Str_Tmp = DelID
end if
'response.Write(Str_Tmp)
''**********************
User_Conn.execute("delete from FS_ME_VocationClass where VCID in ("&Str_Tmp&")")
response.Redirect("../Success.asp?ErrorUrl=User/VocationClass.asp&ErrCodes=<li>恭喜,删除成功。</li>")
End Sub
Sub SaveClass()
if not MF_Check_Pop_TF("ME026") then Err_Show
call Say_Limit_Class("SaveMode")
Dim Edit_PartID,ii,Str_Req_Child,Str_Req_Tmp,Str_Biangeng_ParentID_ParentID,Err_info
VClass_Sql = "select VCID,vClassName,vClassName_En,ParentID from FS_ME_VocationClass"
if NoSqlHack(request.Form("ParID"))<>"" then
''新增
if CheckCardCF(NoSqlHack(Trim(request.Form("vClassName"))),request.Form("ParID"))<>"" then
response.Redirect("../Error.asp?ErrCodes=<li>同级别的类别: "&request.Form("vClassName")&" 已经存在。</li>")
response.End()
end if
VClass_Sql = VClass_Sql & " where VCID=0"
elseif NoSqlHack(request.Form("VCID"))<>"" then
''修改
VClass_Sql = VClass_Sql & " where VCID=" & NoSqlHack(request.Form("VCID"))
''**********************
''当行业类别要变更时判断当前级别加上其子级再加上要变更的类别一共是否在4级以内。若不在则返回。
for ii = 4 to 1 step -1
if request.Form("vclass"&ii)<>"" then Edit_PartID = request.Form("vclass"&ii) : exit for
next
''''''''''''''''''''''''''
if Edit_PartID = "[ChangeToTop]" then Edit_PartID = 0
if Edit_PartID > 0 then
''''''''''''''''
''Str_Biangeng_ParentID_ParentID准备变更到的父级类别和其本身的父级类别
Str_Req_Tmp = Edit_PartID
do while Str_Req_Tmp<>""
Str_Req_Tmp = Get_ParID_ParID_TO_Save(Str_Req_Tmp)
Str_Biangeng_ParentID_ParentID = Str_Biangeng_ParentID_ParentID & Str_Req_Tmp
loop
if right(Str_Biangeng_ParentID_ParentID,1) = "," then
Str_Biangeng_ParentID_ParentID = Str_Biangeng_ParentID_ParentID & Edit_PartID
elseif Str_Biangeng_ParentID_ParentID<>"" then
Str_Biangeng_ParentID_ParentID = Str_Biangeng_ParentID_ParentID &","& Edit_PartID
else
Str_Biangeng_ParentID_ParentID = Edit_PartID
end if
Err_info = Err_info & "<li>欲变更到的父级和其所有父级:"&Str_Biangeng_ParentID_ParentID&"</li>"
response.Write(Err_info)
'response.End()
''''''''''''''''''''''''''
''Str_Req_Child当前的类别和其子内
Str_Req_Tmp = request.Form("VCID")
do while Str_Req_Tmp <> ""
Str_Req_Tmp = Get_VCID_VCID_TO_Del(Str_Req_Tmp)
Str_Req_Child = Str_Req_Child & Str_Req_Tmp
loop
if right(Str_Req_Child,1) = "," then
Str_Req_Child = Str_Req_Child & request.Form("VCID")
elseif Str_Req_Child<>"" then
Str_Req_Child = Str_Req_Child &","& request.Form("VCID")
else
Str_Req_Child = request.Form("VCID")
end if
Err_info = Err_info & "<li>当前类别和其所有子类:"&Str_Req_Child&"</li>"
Err_info = Err_info & "<li>预料的总级数:"&ubound(split(Str_Biangeng_ParentID_ParentID & "," & Str_Req_Child,",")) + 1&"</li>"
response.Write(Err_info)
'response.End()
if ubound(split(Str_Biangeng_ParentID_ParentID & "," & Str_Req_Child,",")) + 1 > 4 then
Err_info = Err_info & "<li>抱歉,将要或已经超过四级!所有不能更改到该类下.</li>"
response.Redirect("../error.asp?ErrCodes="&Err_info&"")
response.End()
end if
'''''''''''''''
end if
''**********************
else
response.Redirect("../error.asp?ErrCodes=<li>必要的行业ID没有提供。</li>")
response.End()
end if
'response.Write(VClass_Sql)
'response.End()
Set VClass_Rs = CreateObject(G_FS_RS)
VClass_Rs.Open VClass_Sql,User_Conn,3,3
if NoSqlHack(request.Form("ParID"))<>"" then
VClass_Rs.AddNew
VClass_Rs("ParentID") = NoSqlHack(request.Form("ParID"))
VClass_Rs("vClassName") = NoSqlHack(Trim(request.Form("vClassName")))
VClass_Rs("vClassName_En") = NoSqlHack(Trim(request.Form("vClassName_En")))
VClass_Rs.update
VClass_Rs.close
response.Redirect("../Success.asp?ErrorUrl="&server.URLEncode( "User/VocationClass.asp?Act=Add&VCID="&NoSqlHack(request.Form("ParID"))&"&VCText="&NoSqlHack(request.Form("VCText")) )&"&ErrCodes=<li>恭喜,存盘成功。</li>")
end if
'''修改
if NoSqlHack(request.Form("VCID"))<>"" then
'response.Write("<br>VClass_Sql:"&VClass_Sql&"<br>Edit_PartID:"&Edit_PartID)
'response.End()
VClass_Rs("vClassName") = NoSqlHack(Trim(request.Form("vClassName")))
VClass_Rs("vClassName_En") = NoSqlHack(Trim(request.Form("vClassName_En")))
if Edit_PartID<>"" then VClass_Rs("ParentID") = Edit_PartID
VClass_Rs.update
if Edit_PartID<>"" then
Dim PartID_PartID_Rs
''取得变更后的父级ID的父级ID,并传给返回的VCID,以便显示父级ID同级别的所有类别
set PartID_PartID_Rs = User_Conn.execute("select ParentID from FS_ME_VocationClass where VCID="&Edit_PartID)
if not PartID_PartID_Rs.eof then Edit_PartID = PartID_PartID_Rs(0)
PartID_PartID_Rs.close
set PartID_PartID_Rs = nothing
else
Edit_PartID = VClass_Rs("ParentID")
end if
VClass_Rs.close
response.Redirect("../Success.asp?ErrorUrl="&server.URLEncode( "User/VocationClass.asp?Act=View&VCID="&Edit_PartID )&"&ErrCodes=<li>恭喜,存盘成功。</li>")
end if
End Sub
Function CheckCardCF(vClassName,ParentID)
''检查录入的是否重复,重复则返回vClassName,不重复则返回""
Dim CheckCardCF_Rs
set CheckCardCF_Rs = User_Conn.execute( "select Count(*) from FS_ME_VocationClass where vClassName='"&vClassName&"' and ParentID="&ParentID )
if CheckCardCF_Rs(0)>0 then
CheckCardCF = vClassName
else
CheckCardCF = ""
end if
CheckCardCF_Rs.close
End Function
Sub Say_Limit_Class(SownMode)
Dim Arr_Tmp,str_Session
str_Session = session("TopMenu_DaoHang_VCID_List")
select case SownMode
case "AddMode"
''============================
''行业类别最多四级的判断.
if str_Session <> "" then
if left(str_Session,1)="," then str_Session = mid(str_Session,2,len(str_Session))
if right(str_Session,1)="," then str_Session = mid(str_Session,1,len(str_Session) - 1)
Arr_Tmp = split(str_Session,",")
if ubound(Arr_Tmp)>2 then
''按扭
response.Write(" disabled title=""行业分类最多四级!当前等级:第"&cstr(ubound(Arr_Tmp) + 1)&"级."" ")
end if
end if
''============================
case "SaveMode"
''============================
''行业类别最多四级的判断.
if str_Session <> "" then
if left(str_Session,1)="," then str_Session = mid(str_Session,2,len(str_Session))
if right(str_Session,1)="," then str_Session = mid(str_Session,1,len(str_Session) - 1)
Arr_Tmp = split(str_Session,",")
if ubound(Arr_Tmp)>2 then
response.Redirect("../error.asp?ErrCodes=<li>行业类别不能超过四级。</li>")
response.End()
else
response.Write("行业分类最多四级!当前等级:第"&cstr(ubound(Arr_Tmp) + 1)&"级.")
end if
end if
''============================
case else
end select
End Sub
Function Get_VClass(vcid)
''递归调用显示分类
Dim Get_Html
VClass_Sql = "select VCID,vClassName,vClassName_En,ParentID from FS_ME_VocationClass"
if vcid<>"" and vcid>0 then
VClass_Sql = VClass_Sql &" where ParentID = "&vcid
else
VClass_Sql = VClass_Sql &" where ParentID = 0"
end if
Set VClass_Rs = CreateObject(G_FS_RS)
VClass_Rs.Open VClass_Sql,User_Conn,1,1
IF not VClass_Rs.eof THEN
VClass_Rs.PageSize=int_RPP
cPageNo=NoSqlHack(Request.QueryString("Page"))
If cPageNo="" Then cPageNo = 1
If not isnumeric(cPageNo) Then cPageNo = 1
cPageNo = Clng(cPageNo)
If cPageNo<=0 Then cPageNo=1
If cPageNo>VClass_Rs.PageCount Then cPageNo=VClass_Rs.PageCount
VClass_Rs.AbsolutePage=cPageNo
FOR int_Start=1 TO int_RPP
Get_Html = Get_Html & "<tr class=""hback"">" & vbcrlf
Get_Html = Get_Html & "<td align=""center""><a href=VocationClass.asp?Act=View&VCID="&VClass_Rs("VCID")&">"& VClass_Rs("vClassName") & "</a></td>" & vbcrlf
Get_Html = Get_Html & "<td align=""center"">"& VClass_Rs("vClassName_En") & "</td>" & vbcrlf
Get_Html = Get_Html & "<td align=""center""><a href=""VocationClass.asp?Act=Add&VCID="&VClass_Rs("VCID")&"&VCText="&VClass_Rs("vClassName")&""" class=""otherset"">新增</FONT></a></td>" & vbcrlf
Get_Html = Get_Html & "<td align=""center""><a href=""VocationClass.asp?Act=Edit&VCID="&VClass_Rs("VCID")&"&VCText="&VClass_Rs("vClassName")&""" class=""otherset"">设置</FONT></a></td>" & vbcrlf
Get_Html = Get_Html & "<td align=""center"" class=""ischeck""><input type=""checkbox"" "&CheckStr&" name=""DelID"" id=""DelID"" value="""&VClass_Rs("VCID")&""" /></td>" & vbcrlf
Get_Html = Get_Html & "</tr>" & vbcrlf
CheckStr = ""
VClass_Rs.MoveNext
if VClass_Rs.eof or VClass_Rs.bof then exit for
NEXT
END IF
Get_Html = Get_Html & "<tr class=""hback""><td colspan=20 align=""center"" class=""ischeck"">"& vbcrlf &"<table width=""100%"" border=0><tr><td height=30>" & vbcrlf
Get_Html = Get_Html & fPageCount(VClass_Rs,int_showNumberLink_,str_nonLinkColor_,toF_,toP10_,toP1_,toN1_,toN10_,toL_,showMorePageGo_Type_,cPageNo) & vbcrlf
Get_Html = Get_Html & "</td><td align=right><input type=""button"" name=""button1112"" value="" 新增同级栏目 "" onClick=""location='VocationClass.asp?Act=Add"& str_Url_Add &"'"">" & vbcrlf
Get_Html = Get_Html & "<input type=""submit"" name=""submit"" value="" 删除 "" onclick=""javascript:return confirm('确定要删除所选项目吗?');""></td>"& vbcrlf
Get_Html = Get_Html &"</tr></table>"&vbNewLine&"</td></tr>"
VClass_Rs.close
Get_VClass = Get_Html
End Function
Function Get_VCID_VCID_TO_Del(Req_VCID)
''循环调用,通过传入的VCID得到子级的VCID,并且组合起来,一起传给DelClass过程以删除所有相关类别。
Dim Str_Tmp,This_Fun_Sql
if Req_VCID="" or isnull(Req_VCID) or Req_VCID="," then Get_VCID_VCID_TO_Del="" : exit Function
This_Fun_Sql="select VCID from FS_ME_VocationClass where ParentID in ("&Req_VCID&")"
on error resume next
set VClass_Rs=User_Conn.execute(This_Fun_Sql)
do while not VClass_Rs.eof
Str_Tmp = Str_Tmp & VClass_Rs(0) & ","
VClass_Rs.movenext
loop
VClass_Rs.close
Get_VCID_VCID_TO_Del = Str_Tmp
'User_Conn.execute("delete from FS_ME_VocationClass where VCID in ("&Req_VCID&")")
'response.Redirect("../Success.asp?ErrorUrl=User/VocationClass.asp&ErrCodes=<li>恭喜,删除成功。</li>")
End Function
Function Get_ParID_ParID_TO_Save(Req_ParID)
''循环调用,通过传入的ParentID得到其上的所有ParentID,并且组合起来,一起传给SaveClass过程以判断是否超过4级.
Dim Str_Tmp,This_Fun_Sql
if Req_ParID="" or isnull(Req_ParID) or Req_ParID="," then Get_ParID_ParID_TO_Save="" : exit Function
This_Fun_Sql="select ParentID from FS_ME_VocationClass where VCID in ("&Req_ParID&")"
on error resume next
set VClass_Rs=User_Conn.execute(This_Fun_Sql)
do while not VClass_Rs.eof
if VClass_Rs(0)=0 then exit do : Get_ParID_ParID_TO_Save="" : exit Function
Str_Tmp = Str_Tmp & VClass_Rs(0) & ","
VClass_Rs.movenext
loop
VClass_Rs.close
Get_ParID_ParID_TO_Save = Str_Tmp
End Function
Function Get_PatID_TO_View(View_ID)
''导航作用,得到父级ID以便返回父级层查看
Dim This_Fun_Sql
if View_ID="" then Get_PatID_TO_View=0 : exit Function
This_Fun_Sql = "select ParentID from FS_ME_VocationClass where VCID="&NoSqlHack(View_ID)
Set VClass_Rs = User_Conn.execute(This_Fun_Sql)
if not VClass_Rs.eof then
Get_PatID_TO_View = VClass_Rs(0)
else
Get_PatID_TO_View = 0
end if
VClass_Rs.close
End Function
Function Get_PatTxt_TO_View(View_ID)
''导航作用,得到父级类目名称以便返回父级层查看,和上面对应
Dim VClass_Rs1,This_Fun_Sql
if View_ID="" then Get_PatTxt_TO_View="无" : exit Function
This_Fun_Sql = "select ParentID from FS_ME_VocationClass where VCID="&NoSqlHack(View_ID)
Set VClass_Rs = User_Conn.execute(This_Fun_Sql)
if not VClass_Rs.eof then
set VClass_Rs1 = User_Conn.execute( "select vClassName from FS_ME_VocationClass where VCID="&VClass_Rs(0) )
if not VClass_Rs1.eof then
Get_PatTxt_TO_View = VClass_Rs1(0)
else
Get_PatTxt_TO_View = "无"
end if
VClass_Rs1.close
set VClass_Rs1=nothing
else
Get_PatTxt_TO_View = "无"
end if
VClass_Rs.close
End Function
Function TopMenu_DaoHang()
''层层导航作用 session("TopMenu_DaoHang_VCID_List") = ',1,2,3,4,'
Dim str_Req_VCID,str_Session,Sql_Session,Per_ID_Session,Str_Tmp,Str_Remove,Arr_Tmp,This_Fun_Sql
if request.QueryString("VCID")="" or request.QueryString("VCID")="0" then
session("TopMenu_DaoHang_VCID_List")="" : TopMenu_DaoHang = "" : exit Function
end if
''**************
str_Req_VCID = NoSqlHack(request.QueryString("VCID"))
str_Req_VCID = ","&str_Req_VCID&","
'if session("TopMenu_DaoHang_VCID_List") = "" then session("TopMenu_DaoHang_VCID_List") = str_Req_VCID
str_Session = session("TopMenu_DaoHang_VCID_List")
if str_Session = "" or isEmpty(str_Session) then str_Session = str_Req_VCID
if left(str_Session,1)<>"," then str_Session = ","&str_Session
if right(str_Session,1)<>"," then str_Session = str_Session&","
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -