Show
Ignore:
Timestamp:
06/06/04 23:07:55 (20 years ago)
Author:
jalet
Message:

Improved CGI script to allow history on printers and hostnames.
Better (?) colors in stylesheet.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/cgi-bin/printquota.cgi

    r1524 r1525  
    2323# 
    2424# $Log$ 
     25# Revision 1.29  2004/06/06 21:07:55  jalet 
     26# Improved CGI script to allow history on printers and hostnames. 
     27# Better (?) colors in stylesheet. 
     28# 
    2529# Revision 1.28  2004/06/05 22:42:41  jalet 
    2630# Improved web history reports 
     
    266270            else :     
    267271                datelimit = None 
     272            if self.form.has_key("hostname") :     
     273                hostname = self.form["hostname"].value 
     274            else :     
     275                hostname = None 
    268276            self.report = ["<h2>History</h2>"]     
    269             history = self.storage.retrieveHistory(user, printer, datelimit) 
     277            history = self.storage.retrieveHistory(user, printer, datelimit, hostname) 
    270278            if not history : 
    271279                self.report.append("<h3>Empty</h3>") 
     
    285293                    elif job.JobAction == "WARN" :     
    286294                        oddevenclass = "warn" 
    287                     username = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "username" : job.UserName}), job.UserName) 
    288                     self.report.append('<tr class="%s">%s</tr>' % (oddevenclass, "".join(["<td>%s</td>" % (h or "&nbsp;") for h in (job.JobDate[:19], job.JobAction, username, job.PrinterName, job.JobHostName, job.JobId, job.JobSize, job.JobPrice, job.JobCopies, job.JobSizeBytes, job.PrinterPageCounter, job.JobTitle, job.JobFileName, job.JobOptions)]))) 
     295                    username_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "username" : job.UserName}), job.UserName) 
     296                    printername_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "printername" : job.PrinterName}), job.PrinterName) 
     297                    if job.JobHostName : 
     298                        hostname_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "hostname" : job.JobHostName}), job.JobHostName) 
     299                    else :     
     300                        hostname_url = None 
     301                    self.report.append('<tr class="%s">%s</tr>' % (oddevenclass, "".join(["<td>%s</td>" % (h or "&nbsp;") for h in (job.JobDate[:19], job.JobAction, username_url, printername_url, hostname_url, job.JobId, job.JobSize, job.JobPrice, job.JobCopies, job.JobSizeBytes, job.PrinterPageCounter, job.JobTitle, job.JobFileName, job.JobOptions)]))) 
    289302                self.report.append('</table>') 
    290303                dico = { "history" : 1, 
     
    295308                if printer and printer.Exists : 
    296309                    dico.update({ "printername" : printer.Name }) 
     310                if hostname :     
     311                    dico.update({ "hostname" : hostname }) 
    297312                prevurl = "%s?%s" % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode(dico)) 
    298313                self.report.append('<a href="%s">Previous page</a>' % prevurl)