Changeset 2631
- Timestamp:
- 01/26/06 16:25:44 (19 years ago)
- Location:
- pykota/trunk
- Files:
-
- 8 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r2624 r2631 296 296 self.logdebug("Seen DENY command.") 297 297 action = "DENY" 298 elif line == "CANCEL" : 299 self.logdebug("Seen CANCEL command.") 300 action = "CANCEL" 298 301 elif line.startswith("USERNAME=") : 299 302 username = line.split("=", 1)[1].strip() … … 307 310 308 311 # now overwrite the job's ticket if new data was supplied 309 if action :312 if action == "DENY" : 310 313 self.Action = action 311 314 self.Reason = _("You are not allowed to print at this time.") 315 elif action == "CANCEL" : 316 self.Action = action 317 self.Reason = _("Print job cancelled.") 312 318 if username : 313 319 self.UserName = username … … 891 897 self.exportPhaseInfo("BEFORE") 892 898 893 if self.Action != "DENY":899 if self.Action not in ("DENY", "CANCEL") : 894 900 if self.Printer.MaxJobSize and (self.softwareJobSize > self.Printer.MaxJobSize) : 895 901 # This printer was set to refuse jobs this large. … … 900 906 self.Reason = _("You are not allowed to print so many pages on printer %s at this time.") % self.PrinterName 901 907 902 if self.Action != "DENY":908 if self.Action not in ("DENY", "CANCEL") : 903 909 if self.User.LimitBy == "noprint" : 904 910 self.printInfo(_("User %s is not allowed to print at this time.") % self.UserName, "warn") … … 906 912 self.Reason = _("Your account settings forbid you to print at this time.") 907 913 908 if self.Action != "DENY":914 if self.Action not in ("DENY", "CANCEL") : 909 915 # If printing is still allowed at this time, we 910 916 # need to extract the billing code information from the database. … … 913 919 self.getBillingCode() 914 920 915 if self.Action != "DENY":921 if self.Action not in ("DENY", "CANCEL") : 916 922 # If printing is still allowed at this time, we 917 923 # need to check if the job is a dupe or not, and what to do then. … … 920 926 self.checkIfDupe() 921 927 922 if self.Action != "DENY":928 if self.Action not in ("DENY", "CANCEL") : 923 929 # If printing is still allowed at this time, we 924 930 # need to check the user's print quota on the current printer. … … 962 968 if self.Action == "DENY" : 963 969 self.printInfo(_("Job denied, no accounting will be done.")) 970 elif self.Action == "CANCEL" : 971 self.printInfo(_("Job cancelled, no accounting will be done.")) 964 972 else : 965 973 self.printInfo(_("Job accounting begins.")) … … 990 998 if self.Action == "DENY" : 991 999 self.printInfo(_("Job denied, no accounting has been done.")) 1000 elif self.Action == "CANCEL" : 1001 self.printInfo(_("Job cancelled, no accounting has been done.")) 992 1002 else : 993 1003 self.deinstallSigTermHandler() … … 1020 1030 self.JobSize = 0 1021 1031 self.printInfo(_("Job size forced to 0 because printing is denied.")) 1032 elif self.Action == "CANCEL" : 1033 self.JobSize = 0 1034 self.printInfo(_("Job size forced to 0 because printing was cancelled.")) 1022 1035 else : 1023 1036 self.UserPQuota.resetDenyBannerCounter() … … 1028 1041 self.printInfo(_("Job size : %i") % self.JobSize) 1029 1042 1030 if (self.Action == "PROBLEM") and (onbackenderror == "NOCHARGE") : 1043 if ((self.Action == "PROBLEM") and (onbackenderror == "NOCHARGE")) or \ 1044 (self.Action in ("DENY", "CANCEL")) : 1031 1045 self.JobPrice = 0.0 1032 1046 elif (self.User.LimitBy == "nochange") or self.Printer.PassThrough : … … 1048 1062 1049 1063 if hasattr(self, "BillingCode") and self.BillingCode and self.BillingCode.Exists : 1050 if (self.Action != "PROBLEM") or (onbackenderror == "CHARGE") : 1064 if (self.Action in ("ALLOW", "WARN")) or \ 1065 ((self.Action == "PROBLEM") and (onbackenderror == "CHARGE")) : 1051 1066 self.BillingCode.consume(self.JobSize, self.JobPrice) 1052 1067 self.printInfo(_("Billing code %s was updated.") % self.BillingCode.BillingCode) -
pykota/trunk/bin/pkbanner
r2627 r2631 188 188 elif action == "WARN" : 189 189 action = _("Allowed with Warning") 190 elif action == "PROBLEM" : 191 # should never occur 192 action = _("Problem") 193 elif action == "CANCEL" : 194 # should never occur 195 action = _("Cancelled") 190 196 ypos -= self.printVar(c, xcenter, ypos, _("Result"), action, 14, savetoner) 191 197 -
pykota/trunk/cgi-bin/printquota.cgi
r2622 r2631 234 234 elif job.JobAction == "PROBLEM" : 235 235 oddevenclass = "problem" 236 elif job.JobAction == "CANCEL" : 237 oddevenclass = "cancel" 236 238 username_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "username" : job.UserName}), job.UserName) 237 239 printername_url = '<a href="%s?%s">%s</a>' % (os.environ.get("SCRIPT_NAME", ""), urllib.urlencode({"history" : 1, "printername" : job.PrinterName}), job.PrinterName) -
pykota/trunk/conf/pykota.conf.sample
r2622 r2631 346 346 # Should we launch a command to overwrite the job's ticket ? 347 347 # This allows a command to overwrite the username and/or the 348 # billing code used, or to deny the job.348 # billing code used, or to deny or cancel the job. 349 349 # If unset no command is launched and the job's username and 350 350 # billing code are used as they are received. … … 356 356 # BILLINGCODE=the_billingcode_we_want_to_overwrite_with 357 357 # DENY 358 # CANCEL 358 359 # 359 360 # NB : the output is entirely read, and the latest value … … 364 365 # If only BILLINGCODE= lines are printed, the username is 365 366 # used unchanged. 366 # If DENY is output, but is followed by new USERNAME= or367 # BILLINGCODE= lines, the job is not denied .367 # If DENY or CANCEL is output, but is followed by new USERNAME= or 368 # BILLINGCODE= lines, the job is not denied nor cancelled. 368 369 # 369 370 # This value can be set either globally or on a per printer basis … … 388 389 # If both are defined, the printer option has priority. 389 390 # 391 # unknown_billingcode : deny 392 # unknown_billingcode : deny(/path/to/some/script) 390 393 # unknown_billingcode : create 391 394 -
pykota/trunk/initscripts/ldap/pykota.schema
r2585 r2631 104 104 # pykotaAction 105 105 attributetype ( 1.3.6.1.4.1.16868.1.1.14 NAME 'pykotaAction' 106 DESC 'Was the job allowed, denied, or failed : ( "ALLOW" | "DENY" | "PROBLEM" )'106 DESC 'Was the job allowed, denied, warned, cancelled or failed : ( "ALLOW" | "DENY" | "WARN" | "CANCEL" | "PROBLEM" )' 107 107 EQUALITY caseExactIA5Match 108 108 SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE ) -
pykota/trunk/NEWS
r2627 r2631 22 22 PyKota NEWS : 23 23 24 - 1.24alpha8 : 25 26 - Now subprocesses launched through the overwrite_jobticket directive 27 can also output 'CANCEL', to represent the user's own choice to 28 cancel the print job. 29 24 30 - 1.24alpha7 : 25 31 -
pykota/trunk/pykota/version.py
r2622 r2631 22 22 # 23 23 24 __version__ = "1.24alpha 7_unofficial"24 __version__ = "1.24alpha8_unofficial" 25 25 26 26 __doc__ = "PyKota : a complete Printing Quota Solution for CUPS." -
pykota/trunk/stylesheets/pykota.css
r2622 r2631 44 44 } 45 45 46 .cancel { 47 background-color: #BEDBED; 48 } 49 46 50 .pykotacolsheader { 47 51 background-color: #AAAAAA;