Predavanja update.

This commit is contained in:
msinkec 2021-05-25 14:51:40 +02:00
parent c0cc2651bc
commit af946662d0
5 changed files with 20 additions and 6 deletions

10
app.py
View File

@ -44,6 +44,8 @@ MAX_FILES_PER_UPLOAD = int(config['MAX_FILES_PER_UPLOAD'])
CONTRACT_CLIENT_CONTACT = config['CONTRACT_CLIENT_CONTACT'] CONTRACT_CLIENT_CONTACT = config['CONTRACT_CLIENT_CONTACT']
MAIL_SUBJECT = config['MAIL_SUBJECT'] MAIL_SUBJECT = config['MAIL_SUBJECT']
MAIL_BODY = config['MAIL_BODY'] MAIL_BODY = config['MAIL_BODY']
MAIL_SUBJECT = config['MAIL_SUBJECT_PREDAVANJA']
MAIL_BODY = config['MAIL_BODY_PREDAVANJA']
SQL_CONN_STR = config['SQL_CONN_STR'] SQL_CONN_STR = config['SQL_CONN_STR']
DESC_PREVODI = config['DESC_PREVODI'] DESC_PREVODI = config['DESC_PREVODI']
DESC_GIGAFIDA = config['DESC_GIGAFIDA'] DESC_GIGAFIDA = config['DESC_GIGAFIDA']
@ -81,6 +83,10 @@ if 'PORTALDS4DS1_MAIL_SUBJECT' in os.environ:
MAIL_SUBJECT = os.environ['PORTALDS4DS1_MAIL_SUBJECT'] MAIL_SUBJECT = os.environ['PORTALDS4DS1_MAIL_SUBJECT']
if 'PORTALDS4DS1_MAIL_BODY' in os.environ: if 'PORTALDS4DS1_MAIL_BODY' in os.environ:
MAIL_BODY = os.environ['PORTALDS4DS1_MAIL_BODY'] MAIL_BODY = os.environ['PORTALDS4DS1_MAIL_BODY']
if 'PORTALDS4DS1_MAIL_SUBJECT_PREDAVANJA' in os.environ:
MAIL_SUBJECT_PREDAVANJA = os.environ['PORTALDS4DS1_MAIL_SUBJECT_PREDAVANJA']
if 'PORTALDS4DS1_MAIL_BODY_PREDAVANJA' in os.environ:
MAIL_BODY_PREDAVANJA = os.environ['PORTALDS4DS1_MAIL_BODY_PREDAVANJA']
if 'PORTALDS4DS1_SQL_CONN_STR' in os.environ: if 'PORTALDS4DS1_SQL_CONN_STR' in os.environ:
SQL_CONN_STR = os.environ['PORTALDS4DS1_SQL_CONN_STR'] SQL_CONN_STR = os.environ['PORTALDS4DS1_SQL_CONN_STR']
if 'PORTALDS4DS1_DESC_PREVODI' in os.environ: if 'PORTALDS4DS1_DESC_PREVODI' in os.environ:
@ -148,8 +154,8 @@ upload_handler_predavanja = portal.predavanja.UploadHandlerPredavanja(
MAIL_PASS=MAIL_PASS, MAIL_PASS=MAIL_PASS,
SMTP_PORT=SMTP_PORT, SMTP_PORT=SMTP_PORT,
IMAP_PORT=IMAP_PORT, IMAP_PORT=IMAP_PORT,
MAIL_SUBJECT=MAIL_SUBJECT, MAIL_SUBJECT=MAIL_SUBJECT_PREDAVANJA,
MAIL_BODY=MAIL_BODY, MAIL_BODY=MAIL_BODY_PREDAVANJA,
CONTRACT_CLIENT_CONTACT=CONTRACT_CLIENT_CONTACT, CONTRACT_CLIENT_CONTACT=CONTRACT_CLIENT_CONTACT,
MAX_FILES_PER_UPLOAD=MAX_FILES_PER_UPLOAD MAX_FILES_PER_UPLOAD=MAX_FILES_PER_UPLOAD
) )

View File

@ -19,3 +19,8 @@ MAIL_BODY=Hvala, ker ste prispevali besedila in na ta način pomagali pri razvoj
Lep pozdrav, Lep pozdrav,
ekipa RSDO ekipa RSDO
MAIL_SUBJECT_PREDAVANJA=Projekt ON ({upload_id})
MAIL_BODY_PREDAVANJA=Spoštovani, sodelavci projekta ON se vam zahvaljujemo za prispevek in sodelovanje. Morebitna vprašanja pošljite na naslov predavajalnik@cjvt.si.
Hvala in lep pozdrav,
ekipa CJVT UL

View File

@ -22,7 +22,6 @@ from jinja2 import Environment, FileSystemLoader
from . model import db, UploadRegular, UploadSolar, RegisteredUser, CorpusAccess, Institution from . model import db, UploadRegular, UploadSolar, RegisteredUser, CorpusAccess, Institution
ENABLED_FILETYPES = ['txt', 'csv', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'xml', 'mxliff', 'tmx']
REGEX_EMAIL = re.compile('^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$') REGEX_EMAIL = re.compile('^[a-z0-9]+[\._]?[a-z0-9]+[@]\w+[.]\w{2,3}$')
MAX_FNAME_LEN = 100 MAX_FNAME_LEN = 100
@ -62,6 +61,8 @@ class ContractCreator:
class UploadHandler: class UploadHandler:
ENABLED_FILETYPES = ['txt', 'csv', 'pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'xml', 'mxliff', 'tmx']
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.config = kwargs self.config = kwargs
@ -199,7 +200,7 @@ class UploadHandler:
for key, f in files.items(): for key, f in files.items():
if key.startswith('file'): if key.startswith('file'):
suffix = f.filename.split('.')[-1] suffix = f.filename.split('.')[-1]
if suffix not in ENABLED_FILETYPES: if ENABLED_FILETYPES and suffix not in ENABLED_FILETYPES:
return 'Datoteka "{}" ni pravilnega formata.'.format(f.filename) return 'Datoteka "{}" ni pravilnega formata.'.format(f.filename)
return None return None

View File

@ -12,6 +12,8 @@ MAXLEN_FORM = 150
class UploadHandlerPredavanja(UploadHandler): class UploadHandlerPredavanja(UploadHandler):
ENABLED_FILETYPES = None # None means all filetypes
def __init__(self, **kwargs): def __init__(self, **kwargs):
super().__init__(**kwargs) super().__init__(**kwargs)
self.contract_creator = ContractCreator(base_path=self.get_uploads_subdir('contracts'), self.contract_creator = ContractCreator(base_path=self.get_uploads_subdir('contracts'),

View File

@ -105,8 +105,8 @@
uploadMultiple: true, uploadMultiple: true,
parallelUploads: {{max_files}}, parallelUploads: {{max_files}},
paramName: "file", // The name that will be used to transfer the file paramName: "file", // The name that will be used to transfer the file
maxFilesize: 1000, // MB maxFilesize: 10000, // MB
acceptedFiles: ".txt, .csv, .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx", //acceptedFiles: ".txt, .csv, .pdf, .doc, .docx, .xls, .xlsx, .ppt, .pptx",
maxFiles: {{max_files}}, maxFiles: {{max_files}},
dictDefaultMessage: `Kliknite ali odložite datoteke sem.`, dictDefaultMessage: `Kliknite ali odložite datoteke sem.`,
dictFallbackMessage: "Vaš brskalnik ne podpira izbiranje datotek z odlaganjem (\"drag & drop\").", dictFallbackMessage: "Vaš brskalnik ne podpira izbiranje datotek z odlaganjem (\"drag & drop\").",