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.

179 lines
5.4 KiB

  1. <%@ CODEPAGE=65001 %>
  2. <%
  3. '------------------------------------------------------------
  4. '
  5. ' Microsoft Internet Printing Project
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. '------------------------------------------------------------
  10. option explicit
  11. %>
  12. <!-- #include file = "ipp_util.inc" -->
  13. <%
  14. Const L_OpenPrinter_Text = "Open Printer"
  15. CheckSession
  16. Response.Expires = 0
  17. Dim strPrinter, strComputer, objQueue, objJobs, strAction, iRes
  18. Dim objPrinter
  19. On Error Resume Next
  20. Err.Clear
  21. strPrinter = OleCvt.DecodeUnicodeName (request ("eprinter"))
  22. strComputer = Session(COMPUTER)
  23. Set objQueue = GetObject("WinNT://" & strComputer & "/" & strPrinter & ",PrintQueue")
  24. Set objJobs = objQueue.PrintJobs
  25. Set objPrinter = Server.CreateObject(PROGID_HELPER)
  26. objPrinter.open "\\" & strComputer & "\" & strPrinter
  27. If Err Then
  28. Call ErrorHandler (L_OpenPrinter_Text)
  29. End If
  30. Function isSupported(bSupported)
  31. Const L_Supported_Text = "Supported"
  32. Const L_Unsupported_Text = "Not Supported"
  33. If bSupported = 1 Then
  34. isSupported = L_Supported_Text
  35. Else
  36. isSupported = L_Unsupported_Text
  37. End If
  38. End Function
  39. Dim strTitle
  40. Const L_Title_Text = "<title>Printer Property of %1 on %2</title>"
  41. strTitle = RepString2(L_Title_Text, strCleanString(strPrinter), session(LOCAL_SERVER))
  42. %>
  43. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  44. <html lang=<%=L_Language%>>
  45. <head>
  46. <Meta Http-equiv="Content-Type" Content="text/html; CHARSET=UTF-8">
  47. <meta http-equiv="refresh" content="30">
  48. <% =Write (strTitle) %>
  49. </head>
  50. <%
  51. Function GetString (str)
  52. If str = "" Then
  53. GetString = "&nbsp;"
  54. Else
  55. GetString = strCleanString (str)
  56. End If
  57. End Function
  58. Function GenPropertyTable (objQueue, objPrinter)
  59. Dim strHTML
  60. Dim strBgnCol1, strBgnCol2, strEndCol
  61. Dim strBgnRow, strEndRow
  62. Dim strTmp, strUnit
  63. Dim strUrl
  64. Dim i, arrayNameList, iUnit
  65. Const L_PrinterModel_Text = "Printer Model:"
  66. Const L_Status_Text = "Status:"
  67. Const L_Location_Text = "Location:"
  68. Const L_Comment_Text = "Comment:"
  69. Const L_Url_Text = "Network Name:"
  70. Const L_Jobs_Text = "Documents:"
  71. Const L_Speed_Text = "Speed:"
  72. Const L_BgnSpeed_Text = ""
  73. Const L_Duplex_Text = "Print on Both Sides:"
  74. Const L_Color_Text = "Color:"
  75. Const L_Resolution_Text = "Max Resolution:"
  76. strHTML = ""
  77. strBgnCol1 = "<tr><td width=""138"" valign=""top"">" & DEF_FONT_TAG & "<b>"
  78. strBgnCol2 = "</b>" & END_FONT & "</td><td>" & DEF_FONT_TAG
  79. strEndCol = END_FONT & "</td></tr>"
  80. strHTML = strHTML & strBgnCol1 & L_PrinterModel_Text & strBgnCol2 & GetString(objQueue.model) & strEndCol
  81. strHTML = strHTML & strBgnCol1 & L_Location_Text & strBgnCol2 & _
  82. GetString (objQueue.Location) & strEndCol
  83. strHTML = strHTML & strBgnCol1 & L_Comment_Text & strBgnCol2 & _
  84. GetString (objQueue.Description) & strEndCol
  85. If Request.ServerVariables("HTTPS") = "off" Then
  86. strUrl = "http://"
  87. Else
  88. strUrl = "https://"
  89. End If
  90. strUrl = GetString(strUrl & session(LOCAL_SERVER) & "/printers/" & GetFriendlyName (objQueue.Printerpath, strComputer) & "/.printer")
  91. strHTML = strHTML & strBgnCol1 & L_Url_Text & strBgnCol2 & strUrl & strEndCol
  92. strHTML = strHTML & strBgnCol1 & L_Jobs_Text & strBgnCol2 & objQueue.JobCount & strEndCol
  93. On Error Resume Next
  94. Err.Clear
  95. iUnit = objPrinter.PageRateUnit
  96. If Err.Number = 0 Then
  97. strTmp = objPrinter.PageRate
  98. If Err.Number = 0 And strTmp <> "0" Then
  99. Const L_PPM_Text = " PPM (Number of Pages Per Minute)"
  100. Const L_CPS_Text = " CPS (Number of Characters Per Second)"
  101. Const L_LPM_Text = " LPM (Number of Lines Per Minute)"
  102. Const L_IPM_Text = " IPM (Number of Inches Per Minute)"
  103. Select Case iUnit
  104. Case 1
  105. strUnit = L_PPM_Text
  106. Case 2
  107. strUnit = L_CPS_Text
  108. Case 3
  109. strUnit = L_LPM_Text
  110. Case 4
  111. strUnit = L_IPM_Text
  112. End Select
  113. strHTML = strHTML & strBgnCol1 & L_Speed_Text & L_BgnSpeed_Text & strBgnCol2 & strTmp & strUnit & strEndCol
  114. End If
  115. End If
  116. Err.Clear
  117. strTmp = objPrinter.Color
  118. If Err.Number = 0 Then
  119. strHTML = strHTML & strBgnCol1 & L_Color_Text & strBgnCol2 & isSupported (strTmp) & strEndCol
  120. End If
  121. Err.Clear
  122. strTmp = objPrinter.Duplex
  123. If Err.Number = 0 Then
  124. strHTML = strHTML & strBgnCol1 & L_Duplex_Text & strBgnCol2 & isSupported (strTmp) & strEndCol
  125. End If
  126. Err.Clear
  127. strTmp = objPrinter.MaximumResolution
  128. If Err.Number = 0 Then
  129. Const L_DPI_Text = " DPI (Dots Per Inch)"
  130. strHTML = strHTML & strBgnCol1 & L_Resolution_Text & strBgnCol2 & strTmp & L_DPI_Text & strEndCol
  131. End If
  132. GenPropertyTable = strHTML
  133. End Function
  134. %>
  135. <body bgcolor="#FFFFFF" text="#000000" link="#000000" vlink="#000000" alink="#000000"
  136. topmargin="0" leftmargin="0">
  137. <table border="0" cellpadding="2" cellspacing="0" width="100%">
  138. <%=Write (GenPropertyTable (objQueue, objPrinter))%>
  139. </table>
  140. <%
  141. objPrinter.close
  142. %>
  143. </body>
  144. </html>