Source code of Windows XP (NT5)
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.

321 lines
10 KiB

  1. <%
  2. dim quote,isAdmin,disabletextstart,disableintstart,disabletextend
  3. dim bUpdateGlobal
  4. bUpdateGlobal = true
  5. quote=chr(34)
  6. disabletextstart= "<TABLE BORDER=1 BORDERCOLORLIGHT=" & quote & "#000000" & quote & " BORDERCOLORMEDIUM=" & quote & "#000000" & quote & " BORDERCOLORDARK=" & quote & "Gray" & quote & "><TR><TD BGCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLORLIGHT=" & quote & "#C0C0C0" & quote & " BORDERCOLORMEDIUM=" & quote & "#C0C0C0" & quote & " BORDERCOLORDARK=" & quote & "#C0C0C0" & quote & "WIDTH=300>"
  7. disableintstart= "<TABLE BORDER=1 BORDERCOLORLIGHT=" & quote & "#000000" & quote & " BORDERCOLORMEDIUM=" & quote & "#000000" & quote & " BORDERCOLORDARK=" & quote & "Gray" & quote & "><TR><TD BGCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLOR=" & quote & "#C0C0C0" & quote & " BORDERCOLORLIGHT=" & quote & "#C0C0C0" & quote & " BORDERCOLORMEDIUM=" & quote & "#C0C0C0" & quote & " BORDERCOLORDARK=" & quote & "#C0C0C0" & quote & "WIDTH=75>"
  8. disabletextend="</TD></TR></TABLE>"
  9. isAdmin=Session("isAdmin")
  10. function checkboxmask(fieldname, fieldmask, onclickproc, adminonly)
  11. On Error Resume Next
  12. Dim val
  13. if mid(fieldname,1,1)="!" then
  14. fieldname=mid(fieldname,2)
  15. val=not (currentobj.Get(fieldname) and fieldmask)
  16. else
  17. val=(currentobj.Get(fieldname) and fieldmask)
  18. end if
  19. checkboxmask = writeCheckboxVal(err, val, fieldname, fieldmask, onclickproc, adminonly)
  20. end function
  21. function checkbox(fieldname, onclickproc, adminonly)
  22. On Error Resume Next
  23. Dim val
  24. if mid(fieldname,1,1)="!" then
  25. fieldname=mid(fieldname,2)
  26. val=not currentobj.Get(fieldname)
  27. else
  28. val=currentobj.Get(fieldname)
  29. end if
  30. checkbox = checkboxVal(err,val,"chk" & fieldname,onclickproc,adminonly)
  31. end function
  32. function checkboxVal(err, val, fieldname, onclickproc, adminonly)
  33. On Error Resume Next
  34. checkboxVal = writeCheckboxVal(err, val, fieldname, "", onclickproc, adminonly)
  35. end function
  36. function writeCheckboxVal(err, val, fieldname,fieldmask, onclickproc, adminonly)
  37. On Error Resume Next
  38. Dim outputStr
  39. if err <> 0 then
  40. outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX'>"
  41. alertuser fieldname
  42. else
  43. if (not adminonly) or isAdmin then
  44. if val then
  45. outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' CHECKED"
  46. else
  47. outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' "
  48. end if
  49. if fieldmask <> "" then
  50. outputStr = outputStr & " VALUE=" & fieldmask
  51. end if
  52. outputStr = outputStr & " OnClick=" & quote
  53. if bUpdateGlobal then
  54. outputStr = outputStr & "top.title.Global.updated=true;"
  55. end if
  56. if onclickproc <> "" then
  57. outputStr = outputStr & onclickproc & quote & ">"
  58. else
  59. outputStr = outputStr & quote & ">"
  60. end if
  61. else
  62. if Session("hasDHTML") then
  63. if val then
  64. outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' CHECKED DISABLED>"
  65. else
  66. outputStr="<INPUT NAME='" & fieldname & "' TYPE='CHECKBOX' CHECKED DISABLED>"
  67. end if
  68. else
  69. if val then
  70. outputStr="<IMG ALIGN=middle SRC=" & quote & "images/checkon.gif" & quote & ">"
  71. else
  72. outputStr="<IMG ALIGN=middle SRC=" & quote & "images/checkoff.gif" & quote & ">"
  73. end if
  74. end if
  75. end if
  76. end if
  77. writeCheckboxVal = outputStr
  78. end function
  79. function printoption(selected, text, adminonly)
  80. 'On Error Resume Next
  81. if selected then
  82. printoption="<OPTION SELECTED>" & text
  83. else
  84. if (isadmin or not adminonly) then
  85. printoption="<OPTION>" & text
  86. end if
  87. end if
  88. end function
  89. function getoption(fieldname,value, adminonly)
  90. 'On Error Resume Next
  91. Dim val
  92. val=currentobj.Get(fieldname)
  93. if err <> 0 then
  94. val = False
  95. alertuser fieldname
  96. end if
  97. getoption = printoption((value=val),value,adminonly)
  98. end function
  99. function radio(fieldname,value, onclickproc, adminonly)
  100. On Error Resume Next
  101. Dim val
  102. val=currentobj.Get(fieldname)
  103. if err <> 0 then
  104. radio=(printradio(fieldname, False,onclickproc,adminonly))
  105. alertuser "rdo" & fieldname
  106. else
  107. if (typename(val)="Boolean") then
  108. output=printradio(fieldname, (val=value),onclickproc,adminonly)
  109. else
  110. if mid(value,1,1)="!" then
  111. output=printradio(fieldname, (val <> mid(value,2)),onclickproc,adminonly)
  112. else
  113. output=printradio(fieldname, (val=value),onclickproc,adminonly)
  114. end if
  115. end if
  116. radio=output
  117. end if
  118. end function
  119. function printradio(fieldname, checked, onclickproc,adminonly)
  120. Dim output, chkstr
  121. if checked then
  122. chkstr="CHECKED"
  123. else
  124. chkstr=""
  125. end if
  126. if ((not adminonly) or isAdmin) then
  127. output="<INPUT NAME=" & quote & "rdo" & fieldname & quote & " TYPE=" & quote & "RADIO" & quote & " " & chkstr
  128. output=output & " OnClick=" & quote
  129. if bUpdateGlobal then
  130. output = output & "top.title.Global.updated=true;"
  131. end if
  132. if onclickproc <> "" then
  133. printradio=output & onclickproc & quote & ">"
  134. else
  135. printradio=output & quote & ">"
  136. end if
  137. else
  138. if checked then
  139. printradio="<IMG SRC=" & quote & "images/radioon.gif" & quote & ">"
  140. else
  141. printradio="<IMG SRC=" & quote & "images/radiooff.gif" & quote & ">"
  142. end if
  143. end if
  144. end function
  145. function text(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
  146. On Error Resume Next
  147. Dim val
  148. val=currentobj.Get(fieldname)
  149. text=inputbox(err,"text",fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,false)
  150. end function
  151. function pword(fieldname,fieldsize,onchangeproc,onfocusproc, onblurproc,hidden,adminonly)
  152. On Error Resume Next
  153. Dim val
  154. val=currentobj.Get(fieldname)
  155. if ((not adminonly) or isAdmin) then
  156. pword=inputbox(err,"password",fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,false)
  157. else
  158. pword=disabletextstart & "*******" & disabletextend
  159. end if
  160. end function
  161. function writehidden(fieldname)
  162. On Error Resume Next
  163. writehidden=inputbox(0,"hidden",fieldname,currentobj.Get(fieldname),"","","","",false,false,false)
  164. end function
  165. function inputbox(err,fieldtype,fieldname,val,fieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly)
  166. inputbox = writeinputbox(err,fieldtype,fieldname,val,fieldsize,"",onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly,false)
  167. end function
  168. function inputboxfixed(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly)
  169. inputboxfixed = writeinputbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly,false)
  170. end function
  171. function disabledbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly)
  172. disabledbox = writeinputbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,false,true)
  173. end function
  174. function writeinputbox(err,fieldtype,fieldname,val,fieldsize,maxfieldsize,onchangeproc,onfocusproc,onblurproc,hidden,adminonly,readonly,disabled)
  175. On Error Resume Next
  176. Dim textstr
  177. if err <> 0 then
  178. textstr="<INPUT TYPE=" & quote & fieldtype & quote & " NAME=" & quote & fieldname & quote & " SIZE=" & fieldsize & ">"
  179. alertuser fieldname
  180. else
  181. if ((not adminonly) or isAdmin) then
  182. textstr="<INPUT TYPE=" & quote & fieldtype & quote
  183. textstr=textstr & " NAME=" & quote & fieldname & quote
  184. if fieldsize <> "" then
  185. textstr = textstr & " SIZE = " & (Session("BrowserTBScalePct") * fieldsize/100)
  186. else
  187. end if
  188. if maxfieldsize <> "" then
  189. textstr=textstr & " MAXLENGTH=" & maxfieldsize
  190. else
  191. end if
  192. textstr=textstr & " VALUE=" & quote & val & quote
  193. textstr=textstr & " OnChange=" & quote
  194. if bUpdateGlobal then
  195. textstr = textstr & "top.title.Global.updated=true;"
  196. end if
  197. if onchangeproc <> "" then
  198. textstr=textstr & onchangeproc & quote
  199. else
  200. textstr=textstr & quote
  201. end if
  202. if onfocusproc <> "" then
  203. textstr=textstr & " OnFocus=" & quote & onfocusproc & quote
  204. end if
  205. if onblurproc <> "" then
  206. textstr=textstr & " OnBlur=" & quote & onblurproc & quote
  207. end if
  208. if readonly then
  209. textstr=textstr & " READONLY"
  210. end if
  211. if disabled then
  212. textstr=textstr & " DISABLED"
  213. end if
  214. if Session("hasStyles") then
  215. textstr=textstr & Session("DEFINPUTSTYLE")
  216. end if
  217. textstr=textstr & ">"
  218. if hidden then
  219. textstr=textstr & " <INPUT TYPE=" & quote & "hidden" & quote & " NAME=" & quote & "hdn" & fieldname & quote & " VALUE=" & quote & val & quote & ">"
  220. end if
  221. else
  222. if Session("hasDHTML") then
  223. textstr="<INPUT TYPE=" & quote & fieldtype & quote & " NAME=" & quote & fieldname & quote & " SIZE=" & fieldsize & " VALUE='" & val & "' DISABLED FACE=" & quote & Session("FONTFACE") & quote & ">"
  224. else
  225. if val = "" then
  226. val = "&nbsp;"
  227. else
  228. if len(val) > 50 then
  229. val = Left(val,50) & "..."
  230. end if
  231. end if
  232. if fieldsize < 15 then
  233. textstr=disableintstart & "<FONT FACE='" & Session("FONTFACE") & "' SIZE='" & Session("FONTPOINT") & "'>"& val & "</FONT>" & disabletextend
  234. else
  235. textstr=disabletextstart & "<FONT FACE='" & Session("FONTFACE") & "' SIZE='" & Session("FONTPOINT") & "'>"& val & "</FONT>" & disabletextend
  236. end if
  237. end if
  238. end if
  239. end if
  240. writeinputbox=textstr
  241. end function
  242. function writeSelect(selName, size, onChange, isMultiSel)
  243. dim textstr
  244. textstr = "<SELECT NAME='" & selName & "'"
  245. if size <> "" then
  246. textstr = textstr & " Size='" & size & "'"
  247. end if
  248. if onChange <> "" then
  249. textstr = textstr & " OnChange='" & onChange & "'"
  250. end if
  251. if isMultiSel then
  252. textstr = textstr & " MULTIPLE"
  253. end if
  254. if Session("hasStyles") then
  255. textstr=textstr & Session("DEFINPUTSTYLE")
  256. end if
  257. textstr = textstr & ">"
  258. writeSelect = textstr
  259. end function
  260. function minVal(thisval, min)
  261. if thisval < min then
  262. thisval = min
  263. end if
  264. minVal = thisval
  265. end function
  266. Sub alertuser(fieldname)
  267. 'Response.Write "<SCRIPT>alert(" & quote & "Could not retrieve a value for " & fieldname & ". (" & err & ":" & err.description & ")" & quote & ");</SCRIPT>"
  268. Response.Write "<FONT COLOR=red><B>*</B></FONT>"
  269. End Sub
  270. %>