📄 ute_class_table.inc
字号:
<%
'---------------------------------------------------------------------------
'
' Project: UTE - (U)niversal ASP (T)able (E)ditor
'
' Module: UTE class - Table Functions
'
' Version: 3.00
'
' Comments: This module does the following things:
' 1. defines all functions being needed in
' table view mode
'
'---------------------------------------------------------------------------
'
' (c) in 2000-2003 by Tom Wellige
' http://www.wellige.com mailto:tom@wellige.com
'
' This project is released under the "GNU General Public License (GPL)"
' http://www.gnu.org/licenses/gpl.html
'
' and is maintained on SourceForge at
' http://sourceforge.net/projects/ute-asp/
'
' and can also be found on CodeProject at
' http://www.codeproject.com/asp/ute.asp
'
'---------------------------------------------------------------------------
''--------------------------------------------------------------------------
'' Name: InsertField
'' ===========
''
'' Returns HTML code for column header (i.e. field name)
''
'' Parameter:
'' Field field object
''
'' return value:
'' string
''
''--------------------------------------------------------------------------
Private Function InsertField ( Field )
Dim s
Dim sValue
Dim sOrderDir
Dim sOrderDescr
Dim sOrderPic
Dim bPicLink
Dim sLinkPrefix
Dim sLinkSuffix
Dim sImg
Dim sSort, sSortDir
sSort = m_SortFields(1)
sSortDir = m_SortFieldsOrder(1)
if (sSort <> Field.name) or (IsExcluded(Field.type)) then
sOrderDir = DEF_SORT_DIR
if sOrderDir = SORT_ASC then
sOrderDescr = STR_SORT_ASC
else
sOrderDescr = STR_SORT_DESC
end if
sOrderPic = m_sIMAGEDir & "sort_none.gif"
bPicLink = False
else
if sSortDir = SORT_ASC then
sOrderDir = SORT_DESC
sOrderDescr = STR_SORT_DESC
sOrderPic = m_sIMAGEDir & "sort_asc.gif"
else ' -> SORT_DESC
sOrderDir = SORT_ASC
sOrderDescr = STR_SORT_ASC
sOrderPic = m_sIMAGEDir & "sort_desc.gif"
end if
bPicLink = True
end if
sLinkPrefix = ""
sLinkSuffix = ""
if Not IsExcluded(Field.type) then
s = Request.QueryString
s = getLink(m_sUTEScript, s, sParamPage, "1") ' switch to page one !
s = getLink(m_sUTEScript, s, sParamSort & "1", Field.name)
s = getLink(m_sUTEScript, s, sParamSortDir & "1", sOrderDir)
s = RemoveCountedParameters(s, sParamSort, 2)
s = RemoveCountedParameters(s, sParamSortDir, 2)
sLinkPrefix = "<a href=""" & s & """ title=""" & sOrderDescr & """ class=""ute_link"">"
sLinkSuffix = "</a>"
end if
sValue = sLinkPrefix & Field.name & sLinkSuffix
if sOrderPic <> "" then
sImg = "<img src=""" & sOrderPic & """ border=""0"" alt=""" & sOrderDescr & """ " &_
"width=""10"" height=""9"">"
sValue = sValue & " " & sLinkPrefix & sImg & sLinkSuffix
end if
InsertField = sValue & vbCrLf
End Function
''--------------------------------------------------------------------------
'' Name: InsertFieldValue
'' ================
''
'' Returns HTML code for field value
''
'' Parameter:
'' Field field object
''
'' return value:
'' none
''
''--------------------------------------------------------------------------
Private Function InsertFieldValue ( Field )
Dim sField
Dim sValue
if IsExcluded(Field.type) then
sField = _
"<center>" & _
"<img src=""" & m_sIMAGEDir & "exclude.gif"" border=""0"" alt=""" & STR_NON_VIEW & """ " & _
"width=""16"" height=""16"">" & _
"</center>"
else
select case Field.type
case adBoolean
if CBool(Field.value) then
sValue = _
"<center>" & _
"<img src=""" & m_sIMAGEDir & "bool_true.gif"" border=""0"" alt=""" & CStr(True) & """ " & _
"width=""12"" height=""12"">" & _
"</center>"
else
sValue = _
"<center>" & _
"<img src=""" & m_sIMAGEDir & "bool_false.gif"" border=""0"" alt=""" & CStr(False) & """ " & _
"width=""12"" height=""12"">" & _
"</center>"
end if
case else
if IsNull(Field.value) then
sValue = "<NULL>"
else
sValue = CStr(Field.value)
if sValue = "" then sValue = " "
end if
end select
sField = sValue
end if
InsertFieldValue = sField
End Function
''--------------------------------------------------------------------------
'' Name: InsertFieldDefinition
'' =====================
''
'' Returns HTML code for field definition
''
'' Parameter:
'' Field field object
'' bIsPrimaryKey this is a primary key field
'' sStyle name of CSS style class
''
'' return value:
'' none
''
''--------------------------------------------------------------------------
Private Function InsertFieldDefinition ( Field, bIsPrimaryKey, sStyle )
Dim sReturn
sReturn = _
"<tr>" & vbCrLf & _
"<td class=""" & sStyle & """>"
if bIsPrimaryKey then sReturn = sReturn & "<i>"
sReturn = sReturn & field.name
if bIsPrimaryKey then sReturn = sReturn & "</i>"
sReturn = sReturn & "</td>" & vbCrLf & _
"<td class=""" & sStyle & """>" & GetTypeString(field.type) & "</td>" & vbCrLf & _
"<td class=""" & sStyle & """>" & CStr(field.definedsize) & "</td>" & vbCrLf & _
"<td class=""" & sStyle & """>" & CStr(field.precision) & "</td>" & vbCrLf & _
"<td class=""" & sStyle & """>" & GetAttributesString(field.attributes) & "</td>" & vbCrLf & _
"</tr>" & vbCrLf
InsertFieldDefinition = sReturn
End Function
''--------------------------------------------------------------------------
'' Name: getNavigation
'' =============
''
'' Returns HTML code for navigation within table.
''
'' Parameter:
'' none
''
'' return value:
'' string HTML code
''
''--------------------------------------------------------------------------
Private Function getNavigation
Dim sNavPage, sNavStatistic, sNavPageSize
Dim s, sValue
Dim i, nTo, nFrom, nColCount
Dim b10, b25, b50, bAll, bPrev, bNext, bCurrent
nColCount = UBound(m_PrimaryKeyFields) + UBound(m_StandardFields)
if not m_bReadOnly then nColCount = nColCount + 1
b10 = (m_nPageSize <> 10)
b25 = (m_nPageSize <> 25)
b50 = (m_nPageSize <> 50)
bAll = (m_nPageSize < m_RS.RecordCount)
bPrev = (m_nPage > 1)
bNext = (m_nPage < m_RS.PageCount)
nFrom = 0
if m_RS.RecordCount > 0 then nFrom = 1 + ((m_nPage - 1) * m_nPageSize)
nTo = m_nPageSize + ((m_nPage - 1) * m_nPageSize)
if nTo > m_RS.RecordCount then
nTo = m_RS.RecordCount
end if
' page navigation
sNavPage = _
"<table><tr>" & vbCrLf & _
"<td class=""ute_navigation"">" & STR_PAGES & "</td>" & vbCrLf & _
"<td class=""ute_navigation"">" & vbCrLf
s = Request.QueryString
if bPrev then
s = getLink(m_sUTEScript, s, sParamPage, CStr(m_nPage-1))
sNavPage = sNavPage & "<a href=""" & s & """ title=""" & STR_PREV_PAGE & """ " & _
"class=""ute_link""><<</a> " & vbCrLf
else
sNavPage = sNavPage & "<span class=""ute_navigation_passive""><<</span> " & vbCrLf
end if
sNavPage = sNavPage & "<select class=""ute_navigation"" name=""pages"" onChange=""jumpPage('parent', this, 0)"">" & vbCrLf
for i = 1 to m_RS.PageCount
bCurrent = (i = m_nPage)
s = getLink(m_sUTEScript, s, sParamPage, CStr(i))
if not bCurrent then
sNavPage = sNavPage & "<option value='" & s & "'>" & i & "</option>" & vbCrLf
else
sNavPage = sNavPage & "<option value='" & s & "' selected>" & i & "</option>" & vbCrLf
end if
next
sNavPage = sNavPage & "</select>" & vbCrLf
if bNext then
s = getLink(m_sUTEScript, s, sParamPage, CStr(m_nPage+1))
sNavPage = sNavPage & "<a href=""" & s & """ title=""" & STR_NEXT_PAGE & """ " & _
"class=""ute_link"">>></a>" & vbCrLf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -