barcodes and template tweaks for email

workspace
Brendan Howell 8 years ago
parent f11a1327c2
commit 831d27d71e

@ -16,12 +16,12 @@
}
#content {
float: left;
width: 63%;
width: 70%;
padding-right: 3%;
line-height: 0.9em;
}
#menu {
width: 30%;
width: 24%;
float: left;
padding-right: 3%;
}
@ -29,6 +29,9 @@
clear: both;
width: 100%;
}
.cmd img {
width: 12em;
}
</style>
</head>
<div id="container">
@ -44,12 +47,24 @@
${msg.content}
</div>
<div id="menu">
<div class="cmd">Mark as Unread</div>
<div class="cmd">Delete</div>
<div class="cmd">Mark as SPAM</div>
<div class="cmd">Reply</div>
<div class="cmd">Reply All</div>
<div class="cmd">Print a Copy</div>
<div class="cmd">Mark as Unread<br />
<img src="${msg.un_bc}" />
</div>
<div class="cmd">Delete<br />
<img src="${msg.d_bc}" />
</div>
<div class="cmd">Mark as SPAM<br />
<img src="${msg.sp_bc}" />
</div>
<div class="cmd">Reply<br />
<img src="${msg.re_bc}" />
</div>
<div class="cmd">Reply All<br />
<img src="${msg.rea_bc}" />
</div>
<div class="cmd">Print a Copy<br />
<img src="${msg.r_bc}" />
</div>
</div>
</div>
</div>

@ -1,7 +1,9 @@
import email
from email.header import decode_header, make_header
import imaplib
import os.path
import code128
import imapclient
from bureau import Bureau, add_command, add_api
@ -129,6 +131,26 @@ class MailRoom(Bureau):
msg.content = msg.content.replace(">", "&gt;")
msg.content = msg.content.replace("\n", "<br />")
# make action barcodes
barcode_png = os.path.join("/tmp", "POun." + msg.shortcode + ".png")
code128.image("POun." + shortcode).save(barcode_png)
msg.un_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POd." + msg.shortcode + ".png")
code128.image("POd." + shortcode).save(barcode_png)
msg.d_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POsp." + msg.shortcode + ".png")
code128.image("POsp." + shortcode).save(barcode_png)
msg.sp_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POre." + msg.shortcode + ".png")
code128.image("POre." + shortcode).save(barcode_png)
msg.re_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POrea." + msg.shortcode + ".png")
code128.image("POrea." + shortcode).save(barcode_png)
msg.rea_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POr." + msg.shortcode + ".png")
code128.image("POr." + shortcode).save(barcode_png)
msg.r_bc = str(barcode_png)
self.print_full("email.html", msg=msg, shortcode=shortcode)
@add_command("d", "Delete email")

Loading…
Cancel
Save