scription:" Const L_ErrNote_Text = "Note:" Const L_ErrTitle_Text = "Internet Printing Error" Const L_ErrSource_Text = "The error occurred in %1" Const L_ErrOccurProc_Text = "

An error occurred processing your request.

" strHTML = "" strHTML = strHTML & "" strHTML = strHTML & "" strHTML = strHTML & "" strHTML = strHTML & "" & L_ErrTitle_Text & "" strHTML = strHTML & "" & DEF_BASEFONT_TAG strHTML = strHTML & L_ErrOccurProc_Text If strSource <> "" Then strHTML = strHTML & RepString1(L_ErrSource_Text, strSource) End If strHTML = strHTML & "" strHTML = strHTML & "" If strDscp <> "" Then strHTML = strHTML & "" End If If strNote <> "" Then strHTML = strHTML & "" End If strHTML = strHTML & "
" & L_ErrCode_Text & "" & (Hex (iCode)) & "
" & L_ErrDscp_Text & "" & strDscp & "
" & L_ErrNote_Text & "" & strNote & "
" GenErrorPage = strHTML End Function Sub ErrorHandler(strNotes) Dim strDscp, strSource Dim str401Error If Err.Number = 70 Or Err.Number = &H80070005 Then Const L_ErrTitle_Text = "Internet Printing Authentication Error" Const L_ErrTitle2_Text = "Authentication Failed" Const L_ErrLine1_Text = "The error indicates that the action you chose requires a higher privilege than what you have with your account." Const L_ErrLine2_Text = "Please contact your system administrator to verify that you have the privilege on the requested action." str401Error = "" &_ "" &_ "" &_ "" &_ "" & L_ErrTitle_Text & "" & "" &_ "" &_ DEF_FONT_TAG &_ "

" & L_ErrTitle2_Text & "

" &_ "

" & L_ErrLine1_Text &_ "
" &_ "
" & L_ErrLine2_Text & "

" &_ "" response.write (Write(str401Error)) response.status = UNAUTHORIZED_401 Else If Err.Number = &H80070709 Then Const L_ErrInvalidName_Text = "Printer not found on server, unable to connect." Err.Description = L_ErrInvalidName_Text End If response.write(Write(GenErrorPage (Err.Number, Err.Source, Err.Description, strCleanString(strNotes)))) End If response.Expires = 0 response.end End Sub Function bDHTMLSupported() On Error Resume Next Err.Clear Dim objBrowcap Set objBrowcap = server.CreateObject("MSWC.browsertype") If Not Err And objBrowcap.browser = "IE" And objBrowcap.majorver >= "4" Then bDHTMLSupported = True Else bDHTMLSupported = False End If End Function Sub CheckSession() ' check to see if the session has timed out If Session(COMPUTER) = "" Then response.redirect ("ipp_0003.asp") response.end End If End Sub Function strPrinterStatus(iStatus) Dim L_PrinterStatus_Text(24) Const L_Seperator_Text = " - " Const L_PrinterReady_Text = "Ready" L_PrinterStatus_Text(0) = "Paused" L_PrinterStatus_Text(1) = "Error" L_PrinterStatus_Text(2) = "Deleting" L_PrinterStatus_Text(3) = "Paper Jam" L_PrinterStatus_Text(4) = "Out of Paper" L_PrinterStatus_Text(5) = "Manual Feed Required" L_PrinterStatus_Text(6) = "Paper Problem" L_PrinterStatus_Text(7) = "Printer Offline" L_PrinterStatus_Text(8) = "IO Active" L_PrinterStatus_Text(9) = "Busy" L_PrinterStatus_Text(10) = "Printing" L_PrinterStatus_Text(11) = "Output Bin Full" L_PrinterStatus_Text(12) = "Not Available" L_PrinterStatus_Text(13) = "Waiting" L_PrinterStatus_Text(14) = "Processing" L_PrinterStatus_Text(15) = "Initializing" L_PrinterStatus_Text(16) = "Warming Up" L_PrinterStatus_Text(17) = "Toner Low" L_PrinterStatus_Text(18) = "No Toner" L_PrinterStatus_Text(19) = "Page Punt" L_PrinterStatus_Text(20) = "User Intervention Required" L_PrinterStatus_Text(21) = "Out of Memory" L_PrinterStatus_Text(22) = "Door Open" L_PrinterStatus_Text(23) = "Server Status Unknown" L_PrinterStatus_Text(24) = "Power Save Mode" Dim bit, i bit = 1 i = 0 Dim strHTML, bFirst bFirst = True strHTML = "" For i = 0 To 24 If iStatus And bit Then If Not bFirst Then strHTML = strHTML + L_Seperator_Text End If strHTML = strHTML + L_PrinterStatus_Text(i) bFirst = False End If bit = bit * 2 Next If bFirst Then strHTML = "" & L_PrinterReady_Text & "" Else strHTML = "" & strHTML & "" End If strPrinterStatus = strHTML End Function Function strFormatJobSize(iJobSize) Const L_Bytes_Text = "%1 bytes" Const L_KiloBytes_Text = "%1 Kb" Const L_MegaBytes_Text = "%1 Mb" If iJobSize < 1024 Then strFormatJobSize = RepString1(L_Bytes_Text, CStr(iJobSize) ) ElseIf iJobSize < 1048576 Then strFormatJobSize = RepString1(L_KiloBytes_Text, formatnumber(iJobSize / 1024, 1) ) Else strFormatJobSize = RepString1(L_MegaBytes_Text, formatnumber(iJobSize / (1024 * 1024), 1) ) End If End Function Function strFormatString(str) If str = "" Then strFormatString = " " Else strFormatString = str End If End Function Function strCleanString (str) Dim strClean, i, iLength, ch strClean = "" iLength = Len (str) For i = 1 To iLength ch = Mid (str, i, 1) Select Case ch Case "<" strClean = strClean & "<" Case ">" strClean = strClean & ">" Case """" strClean = strClean & """ Case "&" strClean = strClean & "&" Case Else strClean = strClean & ch End Select Next strCleanString = strClean End Function Function strCleanRequest (str) strCleanRequest = strCleanString (Request(str)) End Function Function JobEtaInfo (objPrinter) Dim strTime, iJobCount, iMinute Dim strHTML Const L_NoJobPending_Text = "    Waiting Time: 0
Pending Documents: 0 " Const L_ErrorNoJobCompletion_Text = "Error in printing " Const L_LongHour_Text = "> 8 hr" Const L_About_Text = "about " Const L_Hour_Text = " hr" Const L_Minute_Text = " min" Const L_QueueStatus_Text = "Printer Queue: " Const L_WaitingTime_Text = "      Waiting Time: " Const L_Unknown_Text = "Unknown" Const L_JobPending_Text = "Pending Documents: " Const L_AvgSize_Text = "      Average size: " Const L_Pages_Text = " page(s)" strHTML = L_QueueStatus_Text & strPrinterStatus (objPrinter.Status) & L_WaitingTime_Text objPrinter.CalcJobETA If ( objPrinter.Status And &H9F ) Then strHTML = strHTML & L_Unknown_Text 'End If 'If 1 Then Else If objPrinter.PendingJobCount = 0 Then strHTML = strHTML & "0" Else iMinute = objPrinter.JobCompletionMinute 'iMinute = 240 'For testing purpose If iMinute <> -1 Then If iMinute > 480 Then strTime = L_LongHour_Text Elseif iMinute > 60 Then strTime = L_About_Text & CStr (Int (iMinute / 60)) & L_Hour_Text Else strTime = L_About_Text & CStr (iMinute) & L_Minute_Text End If strHTML = strHTML & strTime Else strHTML = strHTML & L_Unknown_Text End If End If End If strHTML = strHTML & "
" iJobCount = objPrinter.PendingJobCount strHTML = strHTML & L_JobPending_Text & CStr (iJobCount) If iJobCount > 0 Then strHTML = strHTML & L_AvgSize_Text If ObjPrinter.AvgJobSizeUnit = 1 Then 'Page strHTML = strHTML & CStr (ObjPrinter.AvgJobSize) + L_Pages_Text Else strHTML = strHTML & strFormatJobSize(ObjPrinter.AvgJobSize) End If End If JobEtaInfo = "" & strHTML & "" End Function Function GetFriendlyName (strPrtName, strComputer) Dim lOffset, strServerName If Left (strPrtName, 2) = "\\" Then lOffset = InStr (3, strPrtName, "\") strServerName = Mid (strPrtName, 3, lOffset - 3) If strServerName = strComputer Then 'Cut the server name only if it is same as the computer name strPrtName = Mid (strPrtName, lOffset + 1) End If End If GetFriendlyName = strPrtName End Function %>