Skip to content
Snippets Groups Projects
Commit df2dde50 authored by uhensler's avatar uhensler
Browse files

OO-4035: Check if a PDF service is enabled when uploading a certificate template

parent d6abf164
No related branches found
No related tags found
No related merge requests found
...@@ -259,6 +259,10 @@ public class CertificatesManagerImpl implements CertificatesManager, MessageList ...@@ -259,6 +259,10 @@ public class CertificatesManagerImpl implements CertificatesManager, MessageList
@Override @Override
public boolean isHTMLTemplateAllowed() { public boolean isHTMLTemplateAllowed() {
return pdfModule.isEnabled() || isPhantomAvailable();
}
private boolean isPhantomAvailable() {
if(phantomAvailable == null) { if(phantomAvailable == null) {
phantomAvailable = CertificatePhantomWorker.checkPhantomJSAvailabilty(); phantomAvailable = CertificatePhantomWorker.checkPhantomJSAvailabilty();
} }
...@@ -988,6 +992,7 @@ public class CertificatesManagerImpl implements CertificatesManager, MessageList ...@@ -988,6 +992,7 @@ public class CertificatesManagerImpl implements CertificatesManager, MessageList
.getResultList(); .getResultList();
} }
@Override
public CertificateTemplate getTemplateById(Long key) { public CertificateTemplate getTemplateById(Long key) {
String sb = "select template from certificatetemplate template where template.key=:templateKey"; String sb = "select template from certificatetemplate template where template.key=:templateKey";
List<CertificateTemplate> templates = dbInstance.getCurrentEntityManager() List<CertificateTemplate> templates = dbInstance.getCurrentEntityManager()
...@@ -1126,6 +1131,7 @@ public class CertificatesManagerImpl implements CertificatesManager, MessageList ...@@ -1126,6 +1131,7 @@ public class CertificatesManagerImpl implements CertificatesManager, MessageList
return templateItem instanceof VFSLeaf ? (VFSLeaf)templateItem : null; return templateItem instanceof VFSLeaf ? (VFSLeaf)templateItem : null;
} }
@Override
public InputStream getDefaultTemplate() { public InputStream getDefaultTemplate() {
return CertificatesManager.class.getResourceAsStream("template.pdf"); return CertificatesManager.class.getResourceAsStream("template.pdf");
} }
......
...@@ -196,7 +196,7 @@ public class UploadCertificateController extends FormBasicController { ...@@ -196,7 +196,7 @@ public class UploadCertificateController extends FormBasicController {
formatEl.setVisible(allOk); formatEl.setVisible(allOk);
orientationEl.setVisible(allOk); orientationEl.setVisible(allOk);
} else { } else {
fileEl.setErrorKey("upload.error.no.phantomjs", null); fileEl.setErrorKey("upload.error.no.html.templates", null);
allOk &= false; allOk &= false;
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -51,7 +51,7 @@ upload.error.encrypted=Die Vorlage darf nicht verschl\u00FCsselt sein. ...@@ -51,7 +51,7 @@ upload.error.encrypted=Die Vorlage darf nicht verschl\u00FCsselt sein.
upload.unkown.error=Die Vorlage kann nicht gelesen werden. upload.unkown.error=Die Vorlage kann nicht gelesen werden.
upload.error.noindex=Die ZIP-Datei enth\u00E4lt keine "index.html" Datei. upload.error.noindex=Die ZIP-Datei enth\u00E4lt keine "index.html" Datei.
upload.error.simplefonts=Der in den Feldern verwendete Font konnte nicht gefunden werden. Bitte benutzen Sie Standardfonts wie z.B. Helvetica, sowie die Acrobat Pro Software, um die Formularfelder zu erstellen. upload.error.simplefonts=Der in den Feldern verwendete Font konnte nicht gefunden werden. Bitte benutzen Sie Standardfonts wie z.B. Helvetica, sowie die Acrobat Pro Software, um die Formularfelder zu erstellen.
upload.error.no.phantomjs=PhantomJS ist nicht verf\u00FCgbar in PATH. HTML template k\u00F6nnen nicht benutzt werden. upload.error.no.html.templates=Es ist kein PDF Dienst aktiviert. HTML Vorlagen k\u00F6nnen deshalb nicht verwendet werden.
upload.wrong.mimetype=Vorlagen k\u00F6nnen nur als ZIP-Datei oder im PDF-Vorlagenformat hochgeladen werden upload.wrong.mimetype=Vorlagen k\u00F6nnen nur als ZIP-Datei oder im PDF-Vorlagenformat hochgeladen werden
notifications.title=Neue Zertifikate in Kurs "{0}" notifications.title=Neue Zertifikate in Kurs "{0}"
notifications.desc={0} hat ein neues Zertifikat erhalten. notifications.desc={0} hat ein neues Zertifikat erhalten.
......
...@@ -63,7 +63,7 @@ template.name=Name ...@@ -63,7 +63,7 @@ template.name=Name
timelapse.after=after timelapse.after=after
upload=Upload template upload=Upload template
upload.error.encrypted=The template cannot be encrypted. upload.error.encrypted=The template cannot be encrypted.
upload.error.no.phantomjs=PhantomJS is not in PATH. You cannot use HTML templates. upload.error.no.html.templates=No PDF service is enabled. Therefore you cannot use HTML templates.
upload.error.noindex=The ZIP file doesn't include a "index.html" file. upload.error.noindex=The ZIP file doesn't include a "index.html" file.
upload.error.simplefonts=The font(s) used in the form fields could not be found. Please use standard fonts such as e.g. Helvetica, as well as the Acrobat Pro Software in order to create the form fields. upload.error.simplefonts=The font(s) used in the form fields could not be found. Please use standard fonts such as e.g. Helvetica, as well as the Acrobat Pro Software in order to create the form fields.
upload.wrong.mimetype=Templates may only be uploaded as either .zip file or in the correct PDF template format. upload.wrong.mimetype=Templates may only be uploaded as either .zip file or in the correct PDF template format.
......
...@@ -62,7 +62,6 @@ template.name=Nom ...@@ -62,7 +62,6 @@ template.name=Nom
timelapse.after=apr\u00E8s timelapse.after=apr\u00E8s
upload=T\u00E9l\u00E9charger vers l'amont le mod\u00E8le upload=T\u00E9l\u00E9charger vers l'amont le mod\u00E8le
upload.error.encrypted=Le mod\u00E8le ne peut pas \u00EAtre chiffr\u00E9 ou prot\u00E9g\u00E9 par un mot de passe upload.error.encrypted=Le mod\u00E8le ne peut pas \u00EAtre chiffr\u00E9 ou prot\u00E9g\u00E9 par un mot de passe
upload.error.no.phantomjs=PhantomJS n'est pas disponible dans le "PATH". Les mod\u00E8les HTML ne seront donc pas disponible.
upload.error.noindex=Le fichier ZIP ne contient pas de fichier "index.html". upload.error.noindex=Le fichier ZIP ne contient pas de fichier "index.html".
upload.error.simplefonts=Les polices d'\u00E9criture des champs de texte n'ont pas u \u00EAtre trouv\u00E9es. Utilisez s'il vous pla\u00EEt des polices standards comme Helvetica et Acrobat Pro pour cr\u00E9er les champs de texte. upload.error.simplefonts=Les polices d'\u00E9criture des champs de texte n'ont pas u \u00EAtre trouv\u00E9es. Utilisez s'il vous pla\u00EEt des polices standards comme Helvetica et Acrobat Pro pour cr\u00E9er les champs de texte.
upload.title=T\u00E9l\u00E9charger vers l'amont le mod\u00E8le upload.title=T\u00E9l\u00E9charger vers l'amont le mod\u00E8le
......
...@@ -62,7 +62,6 @@ template.name=Nome ...@@ -62,7 +62,6 @@ template.name=Nome
timelapse.after=dopo timelapse.after=dopo
upload=Caricare un modello upload=Caricare un modello
upload.error.encrypted=Il modello non pu\u00F2 essere crittografato. upload.error.encrypted=Il modello non pu\u00F2 essere crittografato.
upload.error.no.phantomjs=PhantomJS non \u00E8 nel PATH. Non puoi utilizzare modelli HTML.
upload.error.noindex=L'archivio ZIP non contiene un file "index.html". upload.error.noindex=L'archivio ZIP non contiene un file "index.html".
upload.error.simplefonts=Impossibile trovare i font utilizzati nei campi del modulo. Utilizzare font standard come Helvetica e utilizzare il software Acrobat Pro per creare i campi di testo. upload.error.simplefonts=Impossibile trovare i font utilizzati nei campi del modulo. Utilizzare font standard come Helvetica e utilizzare il software Acrobat Pro per creare i campi di testo.
upload.title=Caricare modello upload.title=Caricare modello
......
...@@ -62,7 +62,6 @@ template.name=Nome ...@@ -62,7 +62,6 @@ template.name=Nome
timelapse.after=ap\u00F3s timelapse.after=ap\u00F3s
upload=Enviar modelo upload=Enviar modelo
upload.error.encrypted=O modelo n\u00E3o pode ser criptografado upload.error.encrypted=O modelo n\u00E3o pode ser criptografado
upload.error.no.phantomjs=PhantomJS n\u00E3o est\u00E1 no PATH. Voc\u00EA n\u00E3o pode usar modelos HTML.
upload.error.noindex=O arquivo ZIP n\u00E3o inclui um arquivo "index.html". upload.error.noindex=O arquivo ZIP n\u00E3o inclui um arquivo "index.html".
upload.error.simplefonts=A fonte usada nos campos n\u00E3o p\u00F4de ser encontrada. Por favor, use fontes padr\u00E3o, como Helvetica e o software Acrobat Pro para criar os campos do formul\u00E1rio. upload.error.simplefonts=A fonte usada nos campos n\u00E3o p\u00F4de ser encontrada. Por favor, use fontes padr\u00E3o, como Helvetica e o software Acrobat Pro para criar os campos do formul\u00E1rio.
upload.title=Enviar modelo upload.title=Enviar modelo
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment