📄 pcard_g.inc
字号:
<%
Function ListTableHeader()
ListTableHeader = _
"<table cellspacing=0 cellpadding=0 width=300 align=center class=tablelist>" & _
"<tr><td colspan=" & iCols & " bgcolor=""#0040a0"" align=center style=""color:white;font-weight:600"" height=20 >个人通讯录类别列表</td></tr>" & _
"<tr><td class=tdHead width=300> <img src=""../images/bg/ar-y.gif"" width=8 height=8> " & TableHeaderField(sFileName, "group_desp", "类别名称", sFormParams, iSort, iSorted) & "</td>" & _
"</tr>"
End Function
Function ListTableTailer()
ListTableTailer = "</table>"
End Function
Function ListTableRecords(sSQL, iCols, iRecordsPerPage, iTotalRecords, iCurrentPage, iTotalPages, sFileName, sFormParams, sSortParams)
dim sTemp : sTemp = "" ' 临时字符串变量
dim j ' 临时循环变量
' response.write sSQL : response.end
'------------------------------------
' 分页所需的变量定义
'------------------------------------
Dim iCounter : iCounter = 1
Dim iPrevPage, iNextPage
'------------------------------------
' 获取数据库连接
'------------------------------------
dim crs : set crs = New CRecordset
dim rs : set rs = crs.open(dbLocal,sSQL)
dim iCardGroupId, sCardGroupDesp
dim sColor
' 如果未到记录尾,将记录定位到你翻到的页面的第一个记录,否则显示空行
if Not rs.EOF then
rs.Move (iCurrentPage - 1) * iRecordsPerPage
end if
while not rs.EOF and iCounter <= iRecordsPerPage
iCardGroupId = crs.GetValue("group_id")
sCardGroupDesp = crs.GetValue("group_desp")
if sCardGroupDesp = sGroupDesp then '' 如果是选中的纪录,显示不同的颜色,这里指定红色
sColor = "red"
else
sColor = "black"
end if
sTemp = sTemp & "<tr bgcolor=white>" & _
"<td class=tdlist title=""" & sCardGroupDesp & """ style=""cursor:hand;color:" & sColor & """ onclick=""javascript:location.href='pcard_g.asp?group_id=" & iCardGroupId & "';""> <img src=""../images/bg/ar-g.gif"" width=8 height=8> " & Bref(sCardGroupDesp,18) & " </td>" & _
"</tr>"
iCounter = iCounter + 1
rs.movenext
wend
crs.Close()
' 填补空白行
sTemp = sTemp & WhiteRows(iCols, iCounter, iRecordsPerPage)
' 首页、前页、后页、尾页等分页信息
sTemp = sTemp & "<tr bgcolor=white><td class=tdlist colspan=" & iCols & " align=right>" & _
Paginate(sFileName, sFormParams, sSortParams, iCurrentPage, iTotalPages) & _
" </td></tr>"
ListTableRecords = sTemp
End Function
Function FormTable()
dim sTitle, sActionLinks
if IsEmpty(pGroupId) then
sTitle = "新增个人通讯录类别" '' 显示新增、取消的链接
sActionLinks = _
"<tr bgcolor=white height=30>" & vbLF & _
" <td colspan=8 align=center>" & vbLF & _
" <img border=0 src=""../images/button/add.gif"" onclick=""btnAdd_OnClick()"" style=""cursor:hand"">" & vbLF & _
" " & vbLF & _
" <img border=0 src=""../images/button/clear.gif"" onclick=""btnClear_OnClick()"" style=""cursor:hand"">" & vbLF & _
" </td>" & vbLF & _
"</tr>" & vbLF
else
sTitle = "重命名个人通讯录类别" '' 显示修改、删除、取消的链接
sActionLinks = _
"<tr bgcolor=white height=30>" & vbLF & _
" <td colspan=8 align=center>" & vbLF & _
" <img border=0 src=""../images/button/update.gif"" onclick=""btnUpdate_OnClick()"" style=""cursor:hand"">" & vbLF & _
" " & vbLF & _
" <img border=0 src=""../images/button/delete.gif"" onclick=""btnDelete_OnClick()"" style=""cursor:hand"">" & vbLF & _
" " & vbLF & _
" <img border=0 src=""../images/button/cancel.gif"" onclick=""btnCancel_OnClick()"" style=""cursor:hand"">" & vbLF & _
" </td>" & vbLF & _
"</tr>" & vbLF
end if
FormTable = _
"<table cellspacing=1 cellpadding=0 bgcolor=white border=0 width=300 height=""100%"">" & vbLF & _
"<form method=post name=frmGroupMgr action=""pcard_g.asp"">" & vbLF & _
"<input type=""hidden"" name=""FormAction"">" & vbLF & _
"<input type=""hidden"" name=""group_id"" value=""" & pGroupId & """>" & vbLF & _
"<tr height=20>" & vbLF & _
" <td colspan=2 background=""../images/bg/bnbg.gif"" style=""color:white;font-weight:600"" align=center>" & sTitle & "</td></tr>" & vbLF & _
"<tr height=20><td></td></tr>" & vbLF & _
"<tr bgcolor=""#FFFFFF"" height=60>" & vbLF & _
" <td width=80 align=right>类别名称:</td>" & _
" <td><input type=""text"" name=""group_desp"" value=""" & sGroupDesp & """ size=31 maxlength=10></td></tr>" & vbLF & _
sActionLinks & vbLF & _
"<tr height=166><td></td></tr>" & vbLF & _
"</form>" & _
"</table>" & vbLF & _
""
End Function
Function TableLink()
TableLink = _
"<table width=600 cellspacing=0 cellpadding=0 border=0 align=center>" & _
"<tr height=10>" & _
" <td width=600><img src=""../images/bg/line.gif"" width=600 height=3></td>" & _
"</tr>" & _
"<tr height=20>" & _
" <td width=600> " & _
" <img src=""../images/goto.gif""> <a href=""pcard_g.asp"">新增个人通讯录类别</a>" & _
" " & _
" <img src=""../images/goto.gif""> <a href=""pcard_e.asp"">新建联系人</a>" & _
" " & _
" <img src=""../images/goto.gif""> <a href=""pcard_l.asp"">我的个人通讯录</a>" & _
" " & _
" <img src=""../images/goto.gif""> <a href=""ccard_l.asp"">单位名录查询</a></td>" & _
"</tr>" & _
"</table>"
End Function
sub AddGroup()
dim sSQL, iRows
sGroupDesp = Trim(sGroupDesp)
'' 类别名称不能为空
if sGroupDesp = "" then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,请输入个人通讯录联系人类别名称"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
'' 检查是否存在重复的类别名称
iRows = DLookUp(dbLocal, "t_personalcardgroup", "count(*)", "emp_serial = " & ToSQL(iEmpSerial, "Number") & " and group_desp =" & ToSQL(sGroupDesp, "Text"))
if iRows > 0 then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,已经存在名称为“" & sGroupDesp & "”的类别,类别名称不能重复!"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
sSQL = "insert into t_personalcardgroup(emp_serial, group_desp) values(" & ToSQL(iEmpSerial, "Number") & ", " & ToSQL(sGroupDesp, "Text") & ")"
call ExecuteSQL(dbLocal, sSQL)
pGroupId = empty '' 重新置成新增状态
sGroupDesp = ""
end sub
sub UpdateGroup()
dim sSQL, iRows
sGroupDesp = Trim(sGroupDesp)
'' 类别名称不能为空
if sGroupDesp = "" then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,请输入个人通讯录联系人类别名称"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
'' 检查是否存在重复的类别名称
iRows = DLookUp(dbLocal, "t_personalcardgroup", "count(*)", "emp_serial = " & ToSQL(iEmpSerial, "Number") & " and group_desp=" & ToSQL(sGroupDesp, "Text") & " and group_id<>" & ToSQL(pGroupId,"Number"))
if iRows > 0 then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,类别名称不能重复!"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
sSQL = "update t_personalcardgroup set group_desp = " & ToSQL(sGroupDesp, "Text") & " where group_id = " & ToSQL(pGroupId, "Number")
call ExecuteSQL(dbLocal, sSQL)
pGroupId = empty
sGroupDesp = ""
end sub
sub DeleteGroup()
dim sSQL, iRows
'' 检查是否存在重复的类别名称
iRows = DLookUp(dbLocal, "t_personalcard", "count(*)", "card_group =" & ToSQL(pGroupId, "Number"))
if iRows > 0 then
Response.Write _
"<script language=""javascript"">" & vbLF & _
" alert(""对不起,您必须先删除所有属于“" & sGroupDesp & "”类别的个人通讯录联系人信息后才能删除该类别!"");" & vbLF & _
"</script>" & vbLF
exit sub
end if
sSQL = "delete from t_personalcardgroup where group_id = " & ToSQL(pGroupId, "Number")
call ExecuteSQL(dbLocal, sSQL)
pGroupId = empty '' 重新置成新增状态
sGroupDesp = ""
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -