93 | | # def htmlListPrinters(self, selected=[], mask="*") : |
94 | | # """Displays the printers multiple selection list.""" |
95 | | # printers = self.storage.getMatchingPrinters(mask) |
96 | | # selectednames = [p.Name for p in selected] |
97 | | # message = '<table><tr><td valign="top">%s :</td><td valign="top"><select name="printers" multiple="multiple">' % _("Printer") |
98 | | # for printer in printers : |
99 | | # if printer.Name in selectednames : |
100 | | # message += '<option value="%s" selected="selected">%s (%s)</option>' % (printer.Name, printer.Name, printer.Description) |
101 | | # else : |
102 | | # message += '<option value="%s">%s (%s)</option>' % (printer.Name, printer.Name, printer.Description) |
103 | | # message += '</select></td></tr></table>' |
104 | | # return message |
| 94 | def htmlListPrinters(self, selected=[], mask="*") : |
| 95 | """Displays the printers multiple selection list.""" |
| 96 | printers = self.storage.getMatchingPrinters(mask) |
| 97 | selectednames = [p.Name for p in selected] |
| 98 | message = '<table><tr><td valign="top">%s :</td><td valign="top"><select name="printers" multiple="multiple">' % _("Printer") |
| 99 | for printer in printers : |
| 100 | if printer.Name in selectednames : |
| 101 | message += '<option value="%s" selected="selected">%s (%s)</option>' % (printer.Name, printer.Name, printer.Description) |
| 102 | else : |
| 103 | message += '<option value="%s">%s (%s)</option>' % (printer.Name, printer.Name, printer.Description) |
| 104 | message += '</select></td></tr></table>' |
| 105 | return message |
119 | | #self.body += self.htmlListPrinters(printers or []) |
120 | | #self.body += "<br />" |
| 122 | self.body += self.htmlListPrinters(printers or []) |
| 123 | self.body += "<br />" |
| 124 | self.body += _("Filename") + " : " |
| 125 | self.body += '<input type="file" size="64" name="inputfile" />' |
| 126 | self.body += "<br />" |
| 127 | if inputfile : |
| 128 | try : |
| 129 | parser = PDLAnalyzer(cStringIO.StringIO(inputfile)) |
| 130 | jobsize = parser.getJobSize() |
| 131 | except PDLAnalyzerError, msg : |
| 132 | self.body += '<font color="red">%s</font>' % msg |
| 133 | else : |
| 134 | self.body += _("This file is %i pages long.") % jobsize |