Krazo Theme integration

Jens Pelzetter 2020-12-23 21:48:31 +01:00
parent 8920bbb7c2
commit 7002ed7682
12 changed files with 199 additions and 6 deletions

View File

@ -31,6 +31,9 @@ public interface LoginConstants {
public static final String LOGIN_BUNDLE
= "com.arsdigita.ui.login.LoginResources";
public static final String LOGIN_UI_BUNDLE
= "org.libreccm.ui.LoginBundle";
public static final GlobalizedMessage SUBMIT = LoginHelper.getMessage(
"login.submit");
public static final GlobalizedMessage PRIMARY_EMAIL = LoginHelper

View File

@ -29,6 +29,7 @@ import org.eclipse.krazo.ext.freemarker.DefaultConfigurationProducer;
import org.libreccm.theming.Themes;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Alternative;
import javax.enterprise.inject.Specializes;
import javax.inject.Inject;
import javax.servlet.ServletContext;
@ -41,6 +42,8 @@ import javax.ws.rs.Produces;
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@ApplicationScoped
@Alternative
@Specializes
public class MvcFreemarkerConfigurationProducer
extends DefaultConfigurationProducer {
@ -52,6 +55,7 @@ public class MvcFreemarkerConfigurationProducer
@Produces
@ViewEngineConfig
@Alternative
@Specializes
@Override
public Configuration getConfiguration() {

View File

@ -91,8 +91,7 @@ public class ThemeManifest implements Serializable {
@XmlElement(name = "default-template", namespace = THEMES_XML_NS)
private String defaultTemplate;
@XmlElementWrapper(name = "mvcTemplates", namespace = THEMES_XML_NS)
@XmlElement(name = "template", namespace = THEME_MANIFEST_XML)
@XmlElement(name = "mvc-templates", namespace = THEMES_XML_NS)
private Map<String, Map<String, ThemeTemplate>> mvcTemplates;
public ThemeManifest() {

View File

@ -96,7 +96,7 @@ public class ThemesMvc {
return String.format(
"@themes/%s/%s/%s",
theme,
themeInfo.getName(),
Objects.toString(themeVersion),
themeTemplate.getPath()
);

View File

@ -60,7 +60,7 @@ public class LoginMessages extends AbstractMap<String, String>{
@PostConstruct
private void init() {
messages = ResourceBundle.getBundle(
LoginConstants.LOGIN_BUNDLE,
LoginConstants.LOGIN_UI_BUNDLE,
globalizationHelper.getNegotiatedLocale()
);
}

View File

@ -5,6 +5,10 @@
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
<alternatives>
<class>org.libreccm.mvc.freemarker.MvcFreemarkerConfigurationProducer</class>
</alternatives>
<interceptors>
<class>org.libreccm.security.AuthorizationInterceptor</class>
</interceptors>

View File

@ -0,0 +1,14 @@
login.submit=Login
login.primaryEmail=Email Address
login.screenname.label=User name
login.password.label=Password
login.screenname.help=Your user name
login.password.help=Your password
login.errors.failed=Login failed. Wrong username or password.
login.errors.failedToSendRecoverMessage=Failed to send password recover message.
login.title=Login
login.recover_password.title=Recover password
login.recover_password.submit=Recover password
login.password_recovered.title=Recover mail send
login.password_recovered.message=An email with instructions how to reset your password has been sent.

View File

@ -0,0 +1,14 @@
login.submit=Anmelden
login.primaryEmail=E-Mail-Addresse
login.screenname.label=Benutzername
login.password.label=Passwort
login.screenname.help=Ihr Benutzername
login.password.help=Ihr Passwort
login.errors.failed=Anmeldung fehlgeschlagen. Falscher Benutzername oder falsches Passwort.
login.errors.failedToSendRecoverMessage=Senden der Wiederherstellungsmail fehlgeschlagen.
login.title=Login
login.recover_password.title=Passwort zur\u00fccksetzen
login.recover_password.submit=Passwort zur\u00fccksetzen
login.password_recovered.title=Mail gesendet
login.password_recovered.message=Eine E-Mail mit Anweisungen zum Zur\u00fccksetzen Ihres Passworts wurde an Ihre E-Mail-Adresse geschickt.

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<title>Category page</title>
<link rel="stylesheet" href="${getContextPath()}/theming/ccm/style.css" />
</head>
<body>
<main>
<h1>${LoginMessages['login.title']}</h1>
<# if (loginFailed)>
<div class="alert-error">
${LoginMessages['login.errors.failed']}
</div>
</#if>
<form action="${mvc.url('LoginController#processLogin')}"
method="post">
<label for="login">${LoginMessages['login.screenname.label']}</label>
<input id="login" name="login" required="true" type="text" />
<label for="password">
${LoginMessages['login.password.label']}
</label>
<input id="password"
name="password"
required="true"
type="password" />
<button type="submit">
${LoginMessages['login.submit']}
</button>
</form>
</main>
<#include "footer.html.ftl">
</body>
</html>

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>Category page</title>
<link rel="stylesheet" href="${getContextPath()}/theming/ccm/style.css" />
</head>
<body>
<main>
<h1>${LoginMessages['login.password_recovered.title']}</h1>
<p>${LoginMessages['login.password_recovered.message']}</p>
</main>
<#include "footer.html.ftl">
</body>
</html>

View File

@ -0,0 +1,27 @@
<!DOCTYPE html>
<html>
<head>
<title>Category page</title>
<link rel="stylesheet" href="${getContextPath()}/theming/ccm/style.css" />
</head>
<body>
<main>
<h1>${LoginMessages['login.recover_password.title']}</h1>
<# if (failedToSendRecoverMessage)>
<div class="alert-error">
${LoginMessages['login.errors.failedToSendRecoverMessage']}
</div>
</#if>
<form action="${mvc.url('LoginController#recoverPassword')}"
method="post">
<label for="email">${LoginMessages['login.email.label']}</label>
<input id="email" name="email" required="true" type="text" />
<button type="submit">
${LoginMessages['login.recover_password.submit']}
</button>
</form>
</main>
<#include "footer.html.ftl">
</body>
</html>

View File

@ -2,5 +2,83 @@
"name": "ccm-freemarker",
"type": "freemarker",
"default-template": "category-page.html.ftl"
"default-template": "category-page.html.ftl",
"mvc-templates": {
"applications": {
"login-form": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Login Form"
}
]
}
},
"name": "Login Form",
"path": "login/login-form.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Login Form"
}
]
}
}
},
"login-recover-password": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Recover lost passwords"
}
]
}
},
"name": "login-recover-password",
"path": "login/login-recover-password.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Recover password"
}
]
}
}
},
"login-password-recovered": {
"description": {
"values": {
"value": [
{
"lang": "en",
"value": "Password recovered"
}
]
}
},
"name": "login-password-recovered",
"path": "login/login-password-recovered.html.ftl",
"title": {
"values": {
"value": [
{
"lang": "en",
"value": "Password recovered"
}
]
}
}
}
}
}
}