Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

279 lines
7.1 KiB

  1. <% '==================================================
  2. ' Module: ots_column.asp
  3. '
  4. ' Synopsis: Object Task Selector Column Formatting Functions
  5. '
  6. ' Copyright (c) Microsoft Corporation. All rights reserved.
  7. '================================================== %>
  8. <%
  9. '
  10. ' --------------------------------------------------------------
  11. ' C O L U M N O B J E C T
  12. ' --------------------------------------------------------------
  13. '
  14. Const OTS_COL_DIM = 6
  15. Const OTS_COL_OBJECT = 0
  16. Const OTS_COL_TYPE = 1
  17. Const OTS_COL_HEADING = 2
  18. Const OTS_COL_ALIGN = 3
  19. Const OTS_COL_FLAGS = 4
  20. Const OTS_COL_WIDTH = 5
  21. Const OTS_COL_TYPE_ALIGN_STYLE = 0
  22. Const OTS_COL_OBJECT_ID = "Col" ' Note: DO NOT LOCALIZE
  23. Const OTS_COL_FLAG_HIDDEN = 1
  24. Const OTS_COL_HIDDEN = 1
  25. Const OTS_COL_FLAG_KEY = 2
  26. Const OTS_COL_KEY = 2
  27. Const OTS_COL_FLAG_SORT = 4
  28. Const OTS_COL_SORT = 4
  29. Const OTS_COL_FLAG_SEARCH = 8
  30. Const OTS_COL_SEARCH = 8
  31. ' --------------------------------------------------------------
  32. '
  33. ' Function: OTS_CreateColumn
  34. '
  35. ' Synopsis: Create a column object
  36. '
  37. ' Arguments: colHeading - Heading string
  38. ' colData - Array of data
  39. ' colAlign - Alignment attribute for column {left,center,right}
  40. ' colFlags - Column flags
  41. ' (OTS_COL_FLAG_HIDDEN | OTS_COL_FLAG_KEY)
  42. '
  43. ' --------------------------------------------------------------
  44. Public Function OTS_CreateColumn(ByVal colHeading, ByVal colAlign, ByVal colFlags)
  45. OTS_CreateColumn = OTS_CreateColumnEx(colHeading, colAlign, colFlags, 0)
  46. End Function
  47. Public Function OTS_CreateColumnEx(ByVal colHeading, ByVal colAlign, ByVal colFlags, ByVal iColWidth)
  48. Dim Column()
  49. ReDim Column(OTS_COL_DIM)
  50. Column(OTS_COL_OBJECT) = OTS_COL_OBJECT_ID
  51. Column(OTS_COL_TYPE) = OTS_COL_TYPE_ALIGN_STYLE
  52. Column(OTS_COL_HEADING) = colHeading
  53. Column(OTS_COL_ALIGN) = colAlign
  54. Column(OTS_COL_FLAGS) = colFlags
  55. Column(OTS_COL_WIDTH) = iColWidth
  56. OTS_CreateColumnEx = Column
  57. End Function
  58. Public Function OTS_IsColumnWidthDynamic(ByVal Column)
  59. OTS_IsColumnWidthDynamic = FALSE
  60. SA_ClearError()
  61. If (OTS_IsValidColumn(Column) ) Then
  62. If ( Column(OTS_COL_WIDTH) > 0 ) Then
  63. OTS_IsColumnWidthDynamic = TRUE
  64. Else
  65. OTS_IsColumnWidthDynamic = FALSE
  66. End If
  67. Else
  68. Call SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_IsColumnWidthDynamic")
  69. End If
  70. End Function
  71. Public Function OTS_GetColumnWidth(ByVal Column, byRef iWidth)
  72. OTS_GetColumnWidth = gc_ERR_SUCCESS
  73. SA_ClearError()
  74. If (OTS_IsValidColumn(Column) ) Then
  75. iWidth = Column(OTS_COL_WIDTH)
  76. Else
  77. OTS_GetColumnWidth = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_GetColumnWidth")
  78. End If
  79. End Function
  80. ' --------------------------------------------------------------
  81. '
  82. ' Function: OTS_IsValidColumn
  83. '
  84. ' Synopsis: Verify that the reference object is a valid column. To
  85. ' be valid it must be an array, of the correct size,
  86. ' which has COL_OBJECT_ID as the first element
  87. '
  88. ' --------------------------------------------------------------
  89. Private Function OTS_IsValidColumn(ByRef Column)
  90. If (IsArray(Column) ) Then
  91. If ( UBound(Column) >= OTS_COL_DIM ) Then
  92. Dim colObject
  93. colObject = Column(OTS_COL_OBJECT)
  94. If (colObject = OTS_COL_OBJECT_ID) Then
  95. OTS_IsValidColumn = true
  96. Exit Function
  97. Else
  98. SA_TraceOut "OTS_IsValidColumn", "(colObject <> OTS_COL_OBJECT_ID)"
  99. End If
  100. Else
  101. SA_TraceOut "OTS_IsValidColumn", "(UBound(Column) >= OTS_COL_DIM)"
  102. End If
  103. Else
  104. SA_TraceOut "OTS_IsValidColumn", "(IsArray(Column))"
  105. End If
  106. OTS_IsValidColumn = false
  107. End Function
  108. ' --------------------------------------------------------------
  109. '
  110. ' Function: OTS_GetColumnHeading
  111. '
  112. ' Synopsis: Get the heading for the specified column
  113. '
  114. ' --------------------------------------------------------------
  115. Public Function OTS_GetColumnHeading(ByRef Column, ByRef HeadingOut)
  116. Dim rc
  117. rc = gc_ERR_SUCCESS
  118. SA_ClearError()
  119. If (OTS_IsValidColumn(Column) ) Then
  120. HeadingOut = Column(OTS_COL_HEADING)
  121. Else
  122. rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_GetColumnHeading")
  123. End If
  124. OTS_GetColumnHeading = rc
  125. End Function
  126. ' --------------------------------------------------------------
  127. '
  128. ' Function: OTS_GetColumnAlign
  129. '
  130. ' Synopsis: Get the alignment specified for this column
  131. '
  132. ' --------------------------------------------------------------
  133. Public Function OTS_GetColumnAlign(ByRef Column, ByRef AlignOut)
  134. Dim rc
  135. rc = gc_ERR_SUCCESS
  136. SA_ClearError()
  137. If (OTS_IsValidColumn(Column) ) Then
  138. AlignOut = Column(OTS_COL_ALIGN)
  139. Else
  140. rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_GetColumnAlign")
  141. End If
  142. OTS_GetColumnAlign = rc
  143. End Function
  144. ' --------------------------------------------------------------
  145. '
  146. ' Function: OTS_GetColumnFlags
  147. '
  148. ' Synopsis: Check to see if the column is hidden
  149. '
  150. ' --------------------------------------------------------------
  151. Public Function OTS_GetColumnFlags(ByRef Column, ByRef FlagsOut)
  152. Dim rc
  153. rc = gc_ERR_SUCCESS
  154. SA_ClearError()
  155. If (OTS_IsValidColumn(Column) ) Then
  156. FlagsOut = Column(OTS_COL_FLAGS)
  157. Else
  158. rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_GetColumnFlags")
  159. End If
  160. OTS_GetColumnFlags = rc
  161. End Function
  162. ' --------------------------------------------------------------
  163. '
  164. ' Function: OTS_IsColumnHidden
  165. '
  166. ' Synopsis: Check to see if the column is hidden
  167. '
  168. ' --------------------------------------------------------------
  169. Public Function OTS_IsColumnHidden(ByRef Column, ByRef HiddenOut)
  170. Dim rc
  171. rc = gc_ERR_SUCCESS
  172. SA_ClearError()
  173. If (OTS_IsValidColumn(Column) ) Then
  174. If (Column(OTS_COL_FLAGS) AND OTS_COL_FLAG_HIDDEN) Then
  175. HiddenOut = true
  176. Else
  177. HiddenOut = false
  178. End If
  179. Else
  180. rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_IsColumnHidden")
  181. End If
  182. OTS_IsColumnHidden = rc
  183. End Function
  184. ' --------------------------------------------------------------
  185. '
  186. ' Function: OTS_IsColumnKey
  187. '
  188. ' Synopsis: Check to see if the column is a key column
  189. '
  190. ' --------------------------------------------------------------
  191. Public Function OTS_IsColumnKey(ByRef Column, ByRef KeyOut)
  192. Dim rc
  193. rc = gc_ERR_SUCCESS
  194. SA_ClearError()
  195. If (OTS_IsValidColumn(Column) ) Then
  196. If (Column(OTS_COL_FLAGS) AND OTS_COL_FLAG_KEY) Then
  197. KeyOut = true
  198. Else
  199. KeyOut = false
  200. End If
  201. Else
  202. rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_IsColumnKey")
  203. End If
  204. OTS_IsColumnKey = rc
  205. End Function
  206. ' --------------------------------------------------------------
  207. '
  208. ' Function: OTS_IsColumnSort
  209. '
  210. ' Synopsis: Check to see if the column is the sort column
  211. '
  212. ' --------------------------------------------------------------
  213. Public Function OTS_IsColumnSort(ByRef Column, ByRef SortOut)
  214. Dim rc
  215. rc = gc_ERR_SUCCESS
  216. SA_ClearError()
  217. If (OTS_IsValidColumn(Column) ) Then
  218. If (Column(OTS_COL_FLAGS) AND OTS_COL_FLAG_SORT) Then
  219. SortOut = true
  220. Else
  221. SortOut = false
  222. End If
  223. Else
  224. rc = SA_SetLastError(OTS_ERR_INVALID_COLUMN, "OTS_IsColumnSort")
  225. End If
  226. OTS_IsColumnSort = rc
  227. End Function
  228. %>