diff --git a/.gitignore b/.gitignore index f039012..ecd7a51 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -data/triggers/*.d -ssl/*.pem angular_app/node_modules/ diff --git a/angular_app/event-info.html b/angular_app/event-info.html index 19c5e1b..43a02a3 100644 --- a/angular_app/event-info.html +++ b/angular_app/event-info.html @@ -41,7 +41,7 @@ # {{'Person' | translate}} {{'Name' | translate}} {{'Surname' | translate}} - {{'Attended' | translate}} + {{'Attended' | translate}} {{col.label | translate}} @@ -60,7 +60,7 @@ - + {{person[col.key]}} diff --git a/angular_app/js/i18n.js b/angular_app/js/i18n.js index f9fb7f0..fa669f4 100644 --- a/angular_app/js/i18n.js +++ b/angular_app/js/i18n.js @@ -10,7 +10,7 @@ eventManApp.config(['$translateProvider', function ($translateProvider) { }); $translateProvider.useSanitizeValueStrategy('escaped'); - //$translateProvider.preferredLanguage('it_IT'); + $translateProvider.preferredLanguage('it_IT'); //$translateProvider.fallbackLanguage('en_US'); }]); diff --git a/data/dump.zip b/data/dump.zip new file mode 100644 index 0000000..cfa534a Binary files /dev/null and b/data/dump.zip differ diff --git a/data/triggers/attends.d/CONCIBB_.TTF b/data/triggers/attends.d/CONCIBB_.TTF new file mode 100644 index 0000000..ebaa7d5 Binary files /dev/null and b/data/triggers/attends.d/CONCIBB_.TTF differ diff --git a/data/triggers/attends.d/CONCIBW_.TTF b/data/triggers/attends.d/CONCIBW_.TTF new file mode 100644 index 0000000..3095e07 Binary files /dev/null and b/data/triggers/attends.d/CONCIBW_.TTF differ diff --git a/data/triggers/attends.d/README.txt b/data/triggers/attends.d/README.txt new file mode 100644 index 0000000..be9312f --- /dev/null +++ b/data/triggers/attends.d/README.txt @@ -0,0 +1,4 @@ +Collection of useful triggers. + +Link them in the appropriate directory, if neeed. + diff --git a/data/triggers/attends.d/Ubuntu-C.ttf b/data/triggers/attends.d/Ubuntu-C.ttf new file mode 100644 index 0000000..8d3e867 Binary files /dev/null and b/data/triggers/attends.d/Ubuntu-C.ttf differ diff --git a/data/triggers/attends.d/free3of9.ttf b/data/triggers/attends.d/free3of9.ttf new file mode 100644 index 0000000..513afef Binary files /dev/null and b/data/triggers/attends.d/free3of9.ttf differ diff --git a/data/triggers/attends.d/print_label.py b/data/triggers/attends.d/print_label.py new file mode 100755 index 0000000..f6c46ba --- /dev/null +++ b/data/triggers/attends.d/print_label.py @@ -0,0 +1,95 @@ +#!/usr/bin/env python +"""print_label.py - print a label with the name, the company and the person_id (in a barcode) of an attendee + +Copyright 2015 Emiliano Mattioli + Davide Alberani + RaspiBO + +Licensed under the Apache License 2.0 +""" + +import os +import sys +import cups +import time +import tempfile +from PIL import Image, ImageFont, ImageDraw + +KEEP_IMG = True +LABEL_WIDTH = 6744 +LABEL_HEIGHT = 1872 + +FONT_TEXT = 'Ubuntu-C.ttf' +#FONT_TEXT = 'CONCIBB_.TTF' +FONT_TEXT_ENCODING = 'latin-1' +FONT_BARCODE = 'free3of9.ttf' + +PRINTER_NAME = None +PRINTER_NAME = 'DYMO_LabelWriter_450' + + +def debug(msg): + print '%s: %s' % (time.time(), msg) + + +def _get_resource(filename): + return os.path.join(os.path.dirname(sys.argv[0]), filename) + + +def build_label(w, h, barcode_text, line1, line2, font_text=FONT_TEXT, font_barcode=FONT_BARCODE): + debug('build_label start') + barcode_text = "*" + barcode_text + "*" + line1 = unicode(line1, 'utf-8').encode(FONT_TEXT_ENCODING, 'ignore') + line2 = unicode(line2, 'utf-8').encode(FONT_TEXT_ENCODING, 'ignore') + fontbar = ImageFont.truetype(_get_resource(font_barcode), 1000) + fontname = ImageFont.truetype(_get_resource(font_text), 550) + fontjob = ImageFont.truetype(_get_resource(font_text), 360) + debug('build_label font done') + image = Image.new('RGB', (w, h), (255, 255, 255)) + draw = ImageDraw.Draw(image) + wbar, hbar = draw.textsize(barcode_text, font=fontbar) + wnorm1, hnorm1 = draw.textsize(line1, font=fontname) + wnorm2, hnorm2 = draw.textsize(line2, font=fontjob) + debug('build_label height calc done') + draw.text(((w-wnorm1)/2, -670+(h-hnorm1)/2), line1, (0, 0, 0), font=fontname) + draw.text(((w-wnorm2)/2, -220+(h-hnorm2)/2), line2, (0, 0, 0), font=fontjob) + draw.text(((w-wbar)/2, 425+(h-hbar)/2), barcode_text, (0, 0, 0), font=fontbar) + debug('build_label draw text done') + if not KEEP_IMG: + tmpfile = tempfile.NamedTemporaryFile(prefix='eventman_print_label_', suffix='.png') + else: + tmpfile = tempfile.mktemp(prefix='eventman_print_label_', suffix='.png') + tmpfile = open(tmpfile, 'wb') + image.save(tmpfile, dpi=[600, 300], format='png') + debug('build_label end') + return tmpfile + + +def print_label(label_file, name): + debug('print_label start') + conn = cups.Connection() + printer = PRINTER_NAME or conn.getDefault() + debug('print_label connection done') + conn.printFile(printer, label_file.name, name, {}) + debug('print_label end') + + +def run(): + debug('run start') + # Always consume stdin. + sys.stdin.read() + name = ' '.join([os.environ.get('NAME') or '', os.environ.get('SURNAME') or '']) + company = os.environ.get('COMPANY') or '' + # Print the decimal value SEQ as an hex of at least 6 digits. + seq = os.environ.get('SEQ_HEX', '0') + label_file = build_label(LABEL_WIDTH, LABEL_HEIGHT, seq, name, company) + print_label(label_file, name) + debug('run end') + + +if __name__ == '__main__': + try: + run() + except Exception, e: + sys.stderr.write('print_label. Exception raised: %s\n' % e) + diff --git a/ssl/eventman_cert.pem b/ssl/eventman_cert.pem new file mode 100644 index 0000000..d46627b --- /dev/null +++ b/ssl/eventman_cert.pem @@ -0,0 +1,14 @@ +-----BEGIN CERTIFICATE----- +MIICHDCCAYWgAwIBAgIJAPj7tC6u7ZrZMA0GCSqGSIb3DQEBCwUAMCcxEDAOBgNV +BAoMB1Jhc3BpQk8xEzARBgNVBAMMCkV2ZW50e01hbn0wHhcNMTUwNDI2MDgyMDM5 +WhcNMjUwNDIzMDgyMDM5WjAnMRAwDgYDVQQKDAdSYXNwaUJPMRMwEQYDVQQDDApF +dmVudHtNYW59MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQClnfeRr+BYSvpj +xxRfzlpzKdTEzA4VoiqzbN6Bksaj10GuCqRZVOcR14FbFI6ukdFoGnKembNF84XY +XiOQSyaeP5H9x5q92eia+QwM8g3v9fnUy19qnSlL43UnmILyT54+wOyWuTtnLEM5 +AmLdVNyo5VEHKYnIeJAZ6Opy8szB8QIDAQABo1AwTjAdBgNVHQ4EFgQUQ8JSq3eE +nqT/aj349gdrVkVT/YcwHwYDVR0jBBgwFoAUQ8JSq3eEnqT/aj349gdrVkVT/Ycw +DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOBgQAw5rvqACQ7uraAwfEPvpwK +MV2LAf2fEYi05Bo+CDWQyaoVRdOZToGM96mYElkV1QXwQaOgo0oaJSZpuyMpx9Tu +8WtPpHb4p8vwlP92ypJSqYuDGn4zv1kn+InvIrLLaHOADC4dhAnmW4vUoL/9ZzJp +pcap/NCLkmWI2/1zayTGeQ== +-----END CERTIFICATE----- diff --git a/ssl/eventman_key.pem b/ssl/eventman_key.pem new file mode 100644 index 0000000..d92fddb --- /dev/null +++ b/ssl/eventman_key.pem @@ -0,0 +1,16 @@ +-----BEGIN PRIVATE KEY----- +MIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAKWd95Gv4FhK+mPH +FF/OWnMp1MTMDhWiKrNs3oGSxqPXQa4KpFlU5xHXgVsUjq6R0Wgacp6Zs0Xzhdhe +I5BLJp4/kf3Hmr3Z6Jr5DAzyDe/1+dTLX2qdKUvjdSeYgvJPnj7A7Ja5O2csQzkC +Yt1U3KjlUQcpich4kBno6nLyzMHxAgMBAAECgYEAoLJkE2JaBpHJ3qK+bC+np/LA +1qtAR1FwqWRLieJHB5bHzf3ZdixhgPhgNWX/A/fM/nwbFzT/tDIUftrpGwswTfBe +lXg5rL1lMPbx6crLW1zYZj7PYPSw8PGqFisrxQzhWj+Ibu2PghBdvldKhiAmkTrm +oN/ech0jh4dDoHRaj1kCQQDXBW+qPs2nGy1+Tb38ffvLEPrgcOdwTGCFI9UA0ZxO +pLLkxNCeBZ2jWbFyiOHpTTcRD+ZvJrH4cAcOIAJPBcjnAkEAxS4s1xzPXBt6bQUc +bsY0Zv3OG/WTF8raZrxHznGXOA/kmdb9kMsrc1nSdBw9rISHeVIHbZHV30Oigfw5 +W5ELZwJBALsT47+/vLYzkzVc9nuEMVrQfzZfhT3Tdfbg4iZAOTrDWVJpWwjh4fGJ +zDXWmpedsteJefgjNpzs+3Zyqw+N/OkCQQCr5ft1dUpZNCNg06nb8LNSbkW3Hjoj +7dbE5bN8CI8actCKRWE9T8ILh+zvCIfD1K3+WELdhNv9DguoYmjmqOZVAkBAGrt/ +DUQTmRhIcwhUmjDL7Qg3l9u8LuU56tk8rq5yU9mSc9U3JCWk4Wa+xOjPQLTwREBR +JHJK98DCPzY7eIHC +-----END PRIVATE KEY----- diff --git a/static/images/hackinbo_logo.png b/static/images/hackinbo_logo.png new file mode 100644 index 0000000..6e58290 Binary files /dev/null and b/static/images/hackinbo_logo.png differ