<%@ CODEPAGE=65001 %> <% '------------------------------------------------------------ ' ' Microsoft Internet Printing Project ' ' Copyright (c) Microsoft Corporation. All rights reserved. ' ' Printer Job List ' '------------------------------------------------------------ Option Explicit %> <% Const CHECKED_TAG = " checked " Randomize CheckSession Response.Expires = 0 Const SelectedColor = "#c0c0c0" Const UnselectedColor = "#ffffff" Const iJobLength = 10 Const L_OpenQueue_Text = "Open Queue" Const L_GetJobs_Text = "Get Jobs" Dim strPrinter, strAction, strComputer, strJobid, objQueue, objJobs, objJob, iRes, bDHTML Dim objPrinter Dim iStart, iEnd Dim index index = -1 strPrinter = OleCvt.DecodeUnicodeName (request ("eprinter")) strAction = Request("action") strJobid = Request("jobid") strComputer = Session(COMPUTER) bDHTML = Session(DHTML_ENABLED) On Error Resume Next Err.Clear If Request("startid") = "" Or Request ("endid") = "" Then iStart = 1 iEnd = iStart+ iJobLength Else iStart = Int (Request ("startid")) iEnd = Int (Request ("endid")) End If Set objQueue = GetObject("WinNT://" & strComputer & "/" & strPrinter & ",PrintQueue") If Err Then ErrorHandler (L_OpenQueue_Text) Set objJobs = objQueue.PrintJobs If Err Then ErrorHandler (L_GetJobs_Text) Function strJobStatus(iStatus) Dim L_JobStatus_Text(11) Dim bit, i Dim strTemp, bFirst Const L_Seperator_Text = " - " L_JobStatus_Text(0) = "Paused" L_JobStatus_Text(1) = "Error" L_JobStatus_Text(2) = "Deleting" L_JobStatus_Text(3) = "Spooling" L_JobStatus_Text(4) = "Printing" L_JobStatus_Text(5) = "Offline" L_JobStatus_Text(6) = "Out of Paper" L_JobStatus_Text(7) = "Printed" L_JobStatus_Text(8) = "Deleted" L_JobStatus_Text(9) = "Blocked" L_JobStatus_Text(10) = "User Intervention Required" L_JobStatus_Text(11) = "Restarting" bit = 1 i = 0 bFirst = True strTemp = "" For i = 0 To 11 If iStatus And bit Then If Not bFirst Then strTemp = strTemp + L_Seperator_Text End If strTemp = strTemp + L_JobStatus_Text(i) bFirst = False End If bit = bit * 2 Next If strTemp = "" Then strTemp = " " strJobStatus = strTemp End Function Function GenQueueViewHead () Dim L_TableHeader1_Text, L_TableHeader2_Text, L_TableHeader3_Text Dim L_TableHeader4_Text, L_TableHeader5_Text, L_TableHeader6_Text L_TableHeader1_Text = "Document" L_TableHeader2_Text = "Status" L_TableHeader3_Text = "Owner" L_TableHeader4_Text = "Pages" L_TableHeader5_Text = "Size" L_TableHeader6_Text = "Submitted" GenQueueViewHead = "" & _ "" & MENU_FONT_TAG & L_TableHeader1_Text & END_FONT & "" &_ "" & MENU_FONT_TAG & L_TableHeader2_Text & END_FONT & "" &_ "" & MENU_FONT_TAG & L_TableHeader3_Text & END_FONT & "" &_ "" & MENU_FONT_TAG & L_TableHeader4_Text & END_FONT & "" &_ "" & MENU_FONT_TAG & L_TableHeader5_Text & END_FONT & "" &_ "" & MENU_FONT_TAG & L_TableHeader6_Text & END_FONT & "" &_ "" End Function Function GenQueueViewBody (objJob, i) Dim strHTML Dim TdStart, TdEnd TdStart = "" & DEF_FONT_TAG TdEnd = END_FONT & "" If objJob.Name = strJobid Then index = i End If strHTML = strHTML & "" &_ TdStart & " " &_ strCleanString (objjob.Description) & TdEnd &_ TdStart & strJobStatus(objJob.status) & TdEnd &_ TdStart & objJob.user & TdEnd If objJob.totalpages > 0 Then strHTML = strHTML & TdStart & objJob.totalpages & TdEnd Else strHTML = strHTML & TdStart & " " & TdEnd End If If objJob.size > 0 Then strHTML = strHTML & TdStart & strFormatJobSize (objJob.size) & TdEnd Else strHTML = strHTML & TdStart & " " & TdEnd End If strHTML = strHTML & TdStart & formatdatetime(objJob.timesubmitted, 3) & " " &_ formatdatetime(objJob.timesubmitted, 2) & TdEnd & "" GenQueueViewBody = strHTML End Function %> > <%=Write (L_DocumentList_Text)%>
<%if bDHTML then %>
<% end if%> <%= Write (GenQueueViewHead) %> <% Dim i Dim bShowNext bShowNext = FALSE i = 1 For Each objJob In objJobs If (i >= iEnd) Then bShowNext = TRUE Exit For End If If (i >= istart) Then Response.Write (Write (GenQueueViewBody (objJob, i))) 'Response.Write (GenQueueViewBody (objJob, i)) End If i = i + 1 Next %>
<% If i = 1 Then 'No job in the printer queue Const L_NoJob_Text = "

There is no document in the printer queue.
" Response.Write (Write(DEF_FONT_TAG & L_NoJob_Text & END_FONT)) End If Dim strUrl const L_Prev_Text = "Prev %1 documents" Const L_Next_Text = "Next %1 documents" strUrl = "" &_ RepString1(L_Prev_Text, CStr (iJobLength)) & "    " If iStart > 1 Then Response.Write ( Write(DEF_FONT_TAG & strUrl & END_FONT)) End If strUrl = "" &_ RepString1(L_Next_Text, CStr (iJobLength)) & "" If bShowNext Then Response.Write ( Write(DEF_FONT_TAG & strUrl & END_FONT)) End If %> <%if bDHTML then%>
<% end if %> <%if index > 0 then%> <%end if%>