diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/AbstractPageHandler.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/AbstractPageHandler.java index 3cb19c96d..6aab54794 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/AbstractPageHandler.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/AbstractPageHandler.java @@ -25,6 +25,8 @@ import edu.cornell.mannlib.vitro.webapp.dao.VClassDao; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext; import edu.cornell.mannlib.vitro.webapp.dao.jena.OntModelSelector; +import edu.cornell.mannlib.vitro.webapp.i18n.I18n; +import edu.cornell.mannlib.vitro.webapp.i18n.I18nBundle; /** * A base class with some utility routines for page handler (created by @@ -39,6 +41,7 @@ public abstract class AbstractPageHandler { private static final Log log = LogFactory.getLog(AbstractPageHandler.class); protected final VitroRequest vreq; + protected final I18nBundle i18n; protected final ServletContext ctx; protected final OntModel userAccountsModel; protected final OntModel unionModel; @@ -50,6 +53,7 @@ public abstract class AbstractPageHandler { protected AbstractPageHandler(VitroRequest vreq) { this.vreq = vreq; + this.i18n = I18n.bundle(vreq); this.ctx = vreq.getSession().getServletContext(); OntModelSelector oms = ModelContext.getUnionOntModelSelector(ctx); @@ -154,7 +158,8 @@ public abstract class AbstractPageHandler { private static final String ATTRIBUTE = Message.class.getName(); public static void setMessage(HttpServletRequest req, Message message) { - log.debug("Added message to session: " + message.getMessageInfoMap()); + log.debug("Added message to session: " + + message.getMessageInfoMap()); req.getSession().setAttribute(ATTRIBUTE, message); } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsAddPageStrategy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsAddPageStrategy.java index 19b135bc3..caa52e38a 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsAddPageStrategy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsAddPageStrategy.java @@ -103,7 +103,7 @@ public abstract class UserAccountsAddPageStrategy extends UserAccountsPage { FreemarkerEmailMessage email = FreemarkerEmailFactory .createNewMessage(vreq); email.addRecipient(TO, page.getAddedAccount().getEmailAddress()); - email.setSubject("Your VIVO account has been created."); + email.setSubject(i18n.text("account_created_subject", getSiteName())); if (page.isExternalAuthOnly()) { email.setTemplate(EMAIL_TEMPLATE_NO_PASSWORD); } else { diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsDeleter.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsDeleter.java index b8484715a..012b9abc6 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsDeleter.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsDeleter.java @@ -2,6 +2,8 @@ package edu.cornell.mannlib.vitro.webapp.controller.accounts.admin; +import static edu.cornell.mannlib.vitro.webapp.controller.accounts.user.UserAccountsUserController.getBogusStandardMessage; + import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -15,7 +17,6 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageRoot import edu.cornell.mannlib.vitro.webapp.beans.UserAccount; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.accounts.UserAccountsPage; -import edu.cornell.mannlib.vitro.webapp.controller.accounts.user.UserAccountsUserController; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; /** @@ -51,7 +52,7 @@ public class UserAccountsDeleter extends UserAccountsPage { UserAccount loggedInAccount = LoginStatusBean.getCurrentUser(vreq); if (loggedInAccount == null) { log.warn("Trying to delete accounts while not logged in!"); - bogusMessage = UserAccountsUserController.BOGUS_STANDARD_MESSAGE; + bogusMessage = getBogusStandardMessage(vreq); return; } @@ -61,14 +62,14 @@ public class UserAccountsDeleter extends UserAccountsPage { if (u == null) { log.warn("Delete account for '" + uri + "' is bogus: no such user"); - bogusMessage = UserAccountsUserController.BOGUS_STANDARD_MESSAGE; + bogusMessage = getBogusStandardMessage(vreq); return; } if (u.getUri().equals(loggedInAccount.getUri())) { log.warn("'" + u.getUri() + "' is trying to delete his own account."); - bogusMessage = UserAccountsUserController.BOGUS_STANDARD_MESSAGE; + bogusMessage = getBogusStandardMessage(vreq); return; } @@ -78,7 +79,7 @@ public class UserAccountsDeleter extends UserAccountsPage { log.warn("Attempting to delete the root account, " + "but not authorized. Logged in as " + LoginStatusBean.getCurrentUser(vreq)); - bogusMessage = UserAccountsUserController.BOGUS_STANDARD_MESSAGE; + bogusMessage = getBogusStandardMessage(vreq); return; } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsEditPage.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsEditPage.java index 0b2e81045..f13c2eab3 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsEditPage.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/admin/UserAccountsEditPage.java @@ -2,6 +2,8 @@ package edu.cornell.mannlib.vitro.webapp.controller.accounts.admin; +import static edu.cornell.mannlib.vitro.webapp.controller.accounts.user.UserAccountsUserController.getBogusStandardMessage; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -20,7 +22,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.SelfEditingConfiguration; import edu.cornell.mannlib.vitro.webapp.beans.UserAccount; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.accounts.UserAccountsPage; -import edu.cornell.mannlib.vitro.webapp.controller.accounts.user.UserAccountsUserController; import edu.cornell.mannlib.vitro.webapp.controller.authenticate.Authenticator; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; @@ -116,7 +117,7 @@ public class UserAccountsEditPage extends UserAccountsPage { if (userAccount == null) { log.warn("Edit account for '" + userUri + "' is bogus: no such user"); - bogusMessage = UserAccountsUserController.BOGUS_STANDARD_MESSAGE; + bogusMessage = getBogusStandardMessage(vreq); return; } if (userAccount.isRootUser()) { @@ -125,7 +126,7 @@ public class UserAccountsEditPage extends UserAccountsPage { log.warn("User is attempting to edit the root account, " + "but is not authorized to do so. Logged in as: " + LoginStatusBean.getCurrentUser(vreq)); - bogusMessage = UserAccountsUserController.BOGUS_STANDARD_MESSAGE; + bogusMessage = getBogusStandardMessage(vreq); return; } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsCreatePasswordPage.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsCreatePasswordPage.java index b227a0728..3b6585e72 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsCreatePasswordPage.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsCreatePasswordPage.java @@ -46,14 +46,12 @@ public class UserAccountsCreatePasswordPage extends @Override protected String alreadyLoggedInMessage(String currentUserEmail) { - return "You may not activate the account for " + userEmail - + " while you are logged in as " + currentUserEmail - + ". Please log out and try again."; + return i18n.text("cant_activate_while_logged_in", userEmail, currentUserEmail); } @Override protected String passwordChangeNotPendingMessage() { - return "The account for " + userEmail + " has already been activated."; + return i18n.text("account_already_activated", userEmail); } @Override @@ -69,7 +67,7 @@ public class UserAccountsCreatePasswordPage extends FreemarkerEmailMessage email = FreemarkerEmailFactory .createNewMessage(vreq); email.addRecipient(TO, userAccount.getEmailAddress()); - email.setSubject("Password successfully created."); + email.setSubject(i18n.text("password_created_subject", getSiteName())); email.setTemplate(EMAIL_TEMPLATE); email.setBodyMap(body); email.processTemplate(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsFirstTimeExternalPage.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsFirstTimeExternalPage.java index 78ea1c7ec..9ac36f700 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsFirstTimeExternalPage.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsFirstTimeExternalPage.java @@ -115,18 +115,17 @@ public class UserAccountsFirstTimeExternalPage extends UserAccountsPage { private void validateExternalAuthId() { if (externalAuthId.isEmpty()) { - bogusMessage = "Login failed - External ID is not found."; + bogusMessage = i18n.text("external_id_not_provided"); return; } if (null != userAccountsDao .getUserAccountByExternalAuthId(externalAuthId)) { - bogusMessage = "User account already exists for '" + externalAuthId - + "'"; + bogusMessage = i18n.text("external_id_already_in_use", + externalAuthId); return; } if (!Authenticator.getInstance(vreq).isUserPermittedToLogin(null)) { - bogusMessage = "User logins are temporarily disabled " - + "while the system is being maintained."; + bogusMessage = i18n.text("logins_disabled_for_maintenance"); return; } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsFirstTimeExternalPageStrategy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsFirstTimeExternalPageStrategy.java index 79ee65e1d..ca1423ad3 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsFirstTimeExternalPageStrategy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsFirstTimeExternalPageStrategy.java @@ -73,7 +73,7 @@ public abstract class UserAccountsFirstTimeExternalPageStrategy extends FreemarkerEmailMessage email = FreemarkerEmailFactory .createNewMessage(vreq); email.addRecipient(TO, ua.getEmailAddress()); - email.setSubject("Your VIVO account has been created."); + email.setSubject(i18n.text("account_created_subject", getSiteName())); email.setTemplate(EMAIL_TEMPLATE); email.setBodyMap(body); email.processTemplate(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsMyAccountPageStrategy.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsMyAccountPageStrategy.java index 6d72a941e..b16094631 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsMyAccountPageStrategy.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsMyAccountPageStrategy.java @@ -178,7 +178,7 @@ public abstract class UserAccountsMyAccountPageStrategy extends FreemarkerEmailMessage email = FreemarkerEmailFactory .createNewMessage(vreq); email.addRecipient(TO, page.getUserAccount().getEmailAddress()); - email.setSubject("Your VIVO email account has been changed."); + email.setSubject(i18n.text("email_changed_subject")); email.setTemplate(EMAIL_TEMPLATE); email.setBodyMap(body); email.processTemplate(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsPasswordBasePage.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsPasswordBasePage.java index 1764c9e7a..78e78ce3f 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsPasswordBasePage.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsPasswordBasePage.java @@ -23,8 +23,6 @@ public abstract class UserAccountsPasswordBasePage extends UserAccountsPage { private static final Log log = LogFactory .getLog(UserAccountsPasswordBasePage.class); - public static final String BOGUS_MESSAGE_NO_SUCH_ACCOUNT = "The account you are trying to set a password on is no longer available. Please contact your system administrator if you think this is an error."; - private static final String PARAMETER_SUBMIT = "submit"; private static final String PARAMETER_USER = "user"; private static final String PARAMETER_KEY = "key"; @@ -79,7 +77,7 @@ public abstract class UserAccountsPasswordBasePage extends UserAccountsPage { if (userAccount == null) { log.warn("Password request for '" + userEmail + "' is bogus: no such user"); - bogusMessage = BOGUS_MESSAGE_NO_SUCH_ACCOUNT; + bogusMessage = i18n.text("account_no_longer_exists"); return; } @@ -170,9 +168,9 @@ public abstract class UserAccountsPasswordBasePage extends UserAccountsPage { public String getSuccessMessage() { if (loggedIn) { - return "Your password has been saved."; + return i18n.text("password_saved"); } else { - return "Your password has been saved. Please log in."; + return i18n.text("password_saved_please_login"); } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsResetPasswordPage.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsResetPasswordPage.java index e9b07ba36..9a42ab8c7 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsResetPasswordPage.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsResetPasswordPage.java @@ -46,14 +46,13 @@ public class UserAccountsResetPasswordPage extends UserAccountsPasswordBasePage @Override protected String alreadyLoggedInMessage(String currentUserEmail) { - return "You may not reset the password for " + userEmail - + " while you are logged in as " + currentUserEmail - + ". Please log out and try again."; + return i18n.text("cant_change_password_while_logged_in", userEmail, + currentUserEmail); } @Override protected String passwordChangeNotPendingMessage() { - return "The password for " + userEmail + " has already been reset."; + return i18n.text("password_change_not_pending", userEmail); } @Override @@ -69,7 +68,7 @@ public class UserAccountsResetPasswordPage extends UserAccountsPasswordBasePage FreemarkerEmailMessage email = FreemarkerEmailFactory .createNewMessage(vreq); email.addRecipient(TO, userAccount.getEmailAddress()); - email.setSubject("Password changed."); + email.setSubject(i18n.text("password_changed_subject")); email.setTemplate(EMAIL_TEMPLATE); email.setBodyMap(body); email.processTemplate(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsUserController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsUserController.java index e2f7a47e6..eb2d175fe 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsUserController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/accounts/user/UserAccountsUserController.java @@ -4,6 +4,8 @@ package edu.cornell.mannlib.vitro.webapp.controller.accounts.user; import static edu.cornell.mannlib.vedit.beans.LoginStatusBean.AuthenticationSource.EXTERNAL; +import javax.servlet.http.HttpServletRequest; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -18,6 +20,7 @@ import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LoginRedirector; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.RedirectResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; +import edu.cornell.mannlib.vitro.webapp.i18n.I18n; /** * Parcel out the different actions required of the UserAccounts GUI. @@ -26,8 +29,6 @@ public class UserAccountsUserController extends FreemarkerHttpServlet { private static final Log log = LogFactory .getLog(UserAccountsUserController.class); - public static final String BOGUS_STANDARD_MESSAGE = "Request failed. Please contact your system administrator."; - private static final String ACTION_CREATE_PASSWORD = "/createPassword"; private static final String ACTION_RESET_PASSWORD = "/resetPassword"; private static final String ACTION_MY_ACCOUNT = "/myAccount"; @@ -116,7 +117,7 @@ public class UserAccountsUserController extends FreemarkerHttpServlet { return showLoginRedirection(vreq, page.getAfterLoginUrl()); } catch (LoginNotPermitted e) { // This should have been anticipated by the page. - return showHomePage(vreq, BOGUS_STANDARD_MESSAGE); + return showHomePage(vreq, getBogusStandardMessage(vreq)); } } else { return page.showPage(); @@ -124,7 +125,7 @@ public class UserAccountsUserController extends FreemarkerHttpServlet { } private ResponseValues handleInvalidRequest(VitroRequest vreq) { - return showHomePage(vreq, BOGUS_STANDARD_MESSAGE); + return showHomePage(vreq, getBogusStandardMessage(vreq)); } private ResponseValues showHomePage(VitroRequest vreq, String message) { @@ -159,4 +160,8 @@ public class UserAccountsUserController extends FreemarkerHttpServlet { } return uri; } + + public static String getBogusStandardMessage(HttpServletRequest req) { + return I18n.bundle(req).text("request_failed"); + } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java index 842a6201d..dcbe01f07 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadController.java @@ -36,6 +36,7 @@ import edu.cornell.mannlib.vitro.webapp.filestorage.backend.FileStorageSetup; import edu.cornell.mannlib.vitro.webapp.filestorage.model.FileInfo; import edu.cornell.mannlib.vitro.webapp.filestorage.model.ImageInfo; import edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.FileUploadServletRequest; +import edu.cornell.mannlib.vitro.webapp.i18n.I18n; import edu.cornell.mannlib.vitro.webapp.web.images.PlaceholderUtil; /** @@ -48,6 +49,9 @@ public class ImageUploadController extends FreemarkerHttpServlet { private static final String ATTRIBUTE_REFERRING_PAGE = "ImageUploadController.referringPage"; + private static final String ERROR_CODE_UNRECOGNIZED_URI = "imageUpload.errorUnrecognizedURI"; + private static final String ERROR_CODE_NO_URI = "imageUpload.errorNoURI"; + /** Limit file size to 6 megabytes. */ public static final int MAXIMUM_FILE_SIZE = 6 * 1024 * 1024; @@ -97,6 +101,14 @@ public class ImageUploadController extends FreemarkerHttpServlet { private static final String URL_HERE = UrlBuilder.getUrl("/uploadImages"); + private static final String TEXT_BUNDLE = "imageUpload"; + private static final String TEXT_STRING_UPLOAD_TITLE = "upload_page_title"; + private static final String TEXT_STRING_UPLOAD_TITLE_WITH_NAME = "upload_page_title_with_name"; + private static final String TEXT_STRING_REPLACE_TITLE = "replace_page_title"; + private static final String TEXT_STRING_REPLACE_TITLE_WITH_NAME = "replace_page_title_with_name"; + private static final String TEXT_STRING_CROP_TITLE = "crop_page_title"; + private static final String TEXT_STRING_CROP_TITLE_WITH_NAME = "crop_page_title_with_name"; + private FileStorage fileStorage; /** @@ -218,7 +230,7 @@ public class ImageUploadController extends FreemarkerHttpServlet { } } catch (UserMistakeException e) { // Can't find the entity? Complain. - return showAddImagePageWithError(vreq, null, e.getMessage()); + return showAddImagePageWithError(vreq, null, e.formatMessage(vreq)); } catch (Exception e) { // We weren't expecting this - log it, and apologize to the user. return new ExceptionResponseValues(e); @@ -274,7 +286,7 @@ public class ImageUploadController extends FreemarkerHttpServlet { return showCropImagePage(vreq, entity, fileInfo.getBytestreamAliasUrl(), size); } catch (UserMistakeException e) { - return showErrorMessage(vreq, entity, e.getMessage()); + return showErrorMessage(vreq, entity, e.formatMessage(vreq)); } } @@ -284,6 +296,7 @@ public class ImageUploadController extends FreemarkerHttpServlet { */ private ResponseValues showErrorMessage(VitroRequest vreq, Individual entity, String message) { + ImageInfo imageInfo = ImageInfo.instanceFromEntityUri( vreq.getFullWebappDaoFactory(), entity); if (imageInfo == null) { @@ -313,7 +326,7 @@ public class ImageUploadController extends FreemarkerHttpServlet { return showExitPage(vreq, entity); } catch (UserMistakeException e) { - return showErrorMessage(vreq, entity, e.getMessage()); + return showErrorMessage(vreq, entity, e.formatMessage(vreq)); } } @@ -350,15 +363,14 @@ public class ImageUploadController extends FreemarkerHttpServlet { throws UserMistakeException { String entityUri = vreq.getParameter(PARAMETER_ENTITY_URI); if (entityUri == null) { - throw new UserMistakeException("No entity URI was provided"); + throw new UserMistakeException(ERROR_CODE_NO_URI); } Individual entity = vreq.getFullWebappDaoFactory().getIndividualDao() .getIndividualByURI(entityUri); if (entity == null) { - throw new UserMistakeException( - "This URI is not recognized as belonging to anyone: '" - + entityUri + "'"); + throw new UserMistakeException(ERROR_CODE_UNRECOGNIZED_URI, + entityUri); } return entity; } @@ -416,7 +428,7 @@ public class ImageUploadController extends FreemarkerHttpServlet { rv.put(BODY_THUMBNAIL_URL, placeholderUrl); rv.put(BODY_FORM_ACTION, formAction); rv.put(BODY_CANCEL_URL, cancelUrl); - rv.put(BODY_TITLE, "Upload image" + forName(entity)); + rv.put(BODY_TITLE, figureUploadPageTitle(vreq, entity)); rv.put(BODY_MAX_FILE_SIZE, MAXIMUM_FILE_SIZE / (1024 * 1024)); rv.put(BODY_THUMBNAIL_HEIGHT, THUMBNAIL_HEIGHT); rv.put(BODY_THUMBNAIL_WIDTH, THUMBNAIL_WIDTH); @@ -442,7 +454,7 @@ public class ImageUploadController extends FreemarkerHttpServlet { rv.put(BODY_DELETE_URL, formAction(entity.getURI(), ACTION_DELETE_EDIT)); rv.put(BODY_FORM_ACTION, formAction(entity.getURI(), ACTION_UPLOAD)); rv.put(BODY_CANCEL_URL, exitPageUrl(vreq, entity.getURI())); - rv.put(BODY_TITLE, "Replace image" + forName(entity)); + rv.put(BODY_TITLE, figureReplacePageTitle(vreq, entity)); rv.put(BODY_MAX_FILE_SIZE, MAXIMUM_FILE_SIZE / (1024 * 1024)); rv.put(BODY_THUMBNAIL_HEIGHT, THUMBNAIL_HEIGHT); rv.put(BODY_THUMBNAIL_WIDTH, THUMBNAIL_WIDTH); @@ -472,7 +484,7 @@ public class ImageUploadController extends FreemarkerHttpServlet { rv.put(BODY_MAIN_IMAGE_WIDTH, dimensions.width); rv.put(BODY_FORM_ACTION, formAction(entity.getURI(), ACTION_SAVE)); rv.put(BODY_CANCEL_URL, exitPageUrl(vreq, entity.getURI())); - rv.put(BODY_TITLE, "Crop Photo" + forName(entity)); + rv.put(BODY_TITLE, figureCropPageTitle(vreq, entity)); return rv; } @@ -522,24 +534,59 @@ public class ImageUploadController extends FreemarkerHttpServlet { } /** - * Format the entity's name for display as part of the page title. + * Format the title for the Upload page. */ - private String forName(Individual entity) { + private String figureUploadPageTitle(HttpServletRequest req, + Individual entity) { + return figurePageTitle(req, entity, TEXT_STRING_UPLOAD_TITLE, + TEXT_STRING_UPLOAD_TITLE_WITH_NAME); + } + + /** + * Format the title for the Replace page. + */ + private String figureReplacePageTitle(HttpServletRequest req, + Individual entity) { + return figurePageTitle(req, entity, TEXT_STRING_REPLACE_TITLE, + TEXT_STRING_REPLACE_TITLE_WITH_NAME); + } + + /** + * Format the title for the Crop page. + */ + private String figureCropPageTitle(HttpServletRequest req, Individual entity) { + return figurePageTitle(req, entity, TEXT_STRING_CROP_TITLE, + TEXT_STRING_CROP_TITLE_WITH_NAME); + } + + /** + * Format one of two page titles, depending on whether the entity has a + * name. + */ + private String figurePageTitle(HttpServletRequest req, Individual entity, + String noNameTitleKey, String nameTitleKey) { if (entity != null) { String name = entity.getName(); if (name != null) { - return " for " + name; + return I18n.text(req, TEXT_BUNDLE, nameTitleKey, name); } } - return ""; + return I18n.text(req, TEXT_BUNDLE, noNameTitleKey); } /** * Holds an error message to use as a complaint to the user. */ static class UserMistakeException extends Exception { - UserMistakeException(String message) { + private final Object[] parameters; + + UserMistakeException(String message, Object... parameters) { super(message); + this.parameters = parameters; + } + + public String formatMessage(HttpServletRequest req) { + return I18n.text(req, getMessage(), parameters); } } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadHelper.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadHelper.java index 656a0f0a7..e0052b7bd 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadHelper.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ImageUploadHelper.java @@ -49,6 +49,18 @@ import edu.cornell.mannlib.vitro.webapp.filestorage.uploadrequest.FileUploadServ public class ImageUploadHelper { private static final Log log = LogFactory.getLog(ImageUploadHelper.class); + /* + * Keys to text strings for error messages. + */ + private static final String ERROR_CODE_NO_IMAGE_TO_CROP = "imageUpload.errorNoImageForCropping"; + private static final String ERROR_CODE_IMAGE_TOO_SMALL = "imageUpload.errorImageTooSmall"; + private static final String ERROR_CODE_UNKNOWN = "imageUpload.errorUnknown"; + private static final String ERROR_CODE_FILE_TOO_BIG = "imageUpload.errorFileTooBig"; + private static final String ERROR_CODE_UNRECOGNIZED_FILE_TYPE = "imageUpload.errorUnrecognizedFileType"; + private static final String ERROR_CODE_NO_PHOTO_SELECTED = "imageUpload.errorNoPhotoSelected"; + private static final String ERROR_CODE_BAD_MULTIPART_REQUEST = "imageUpload.errorBadMultipartRequest"; + private static final String ERROR_CODE_FORM_FIELD_MISSING = "imageUpload.errorFormFieldMissing"; + /** * When they upload a new image, store it as this session attribute until * we're ready to attach it to the Individual. @@ -127,35 +139,31 @@ public class ImageUploadHelper { Object exception = request.getAttribute(FILE_UPLOAD_EXCEPTION); if (exception != null) { int limit = MAXIMUM_FILE_SIZE / (1024 * 1024); - throw new UserMistakeException( - "Please upload an image smaller than " + limit - + " megabytes"); + throw new UserMistakeException(ERROR_CODE_FILE_TOO_BIG, limit); } Map> map = (Map>) request .getAttribute(FILE_ITEM_MAP); if (map == null) { - throw new IllegalStateException("Failed to parse the " - + "multi-part request for uploading an image."); + throw new IllegalStateException(ERROR_CODE_BAD_MULTIPART_REQUEST); } List list = map.get(PARAMETER_UPLOADED_FILE); if ((list == null) || list.isEmpty()) { - throw new UserMistakeException("The form did not contain a '" - + PARAMETER_UPLOADED_FILE + "' field."); + throw new UserMistakeException(ERROR_CODE_FORM_FIELD_MISSING, + PARAMETER_UPLOADED_FILE); } FileItem file = list.get(0); if (file.getSize() == 0) { - throw new UserMistakeException("Please browse and select a photo."); + throw new UserMistakeException(ERROR_CODE_NO_PHOTO_SELECTED); } String filename = getSimpleFilename(file); String mimeType = getMimeType(file); if (!RECOGNIZED_FILE_TYPES.containsValue(mimeType)) { log.debug("Unrecognized MIME type: '" + mimeType + "'"); - throw new UserMistakeException("'" + filename - + "' is not a recognized image file type. " - + "Please upload JPEG, GIF, or PNG files only."); + throw new UserMistakeException(ERROR_CODE_UNRECOGNIZED_FILE_TYPE, + filename); } return file; @@ -221,10 +229,8 @@ public class ImageUploadHelper { if ((size.height < THUMBNAIL_HEIGHT) || (size.width < THUMBNAIL_WIDTH)) { - throw new UserMistakeException( - "The uploaded image should be at least " - + THUMBNAIL_HEIGHT + " pixels high and " - + THUMBNAIL_WIDTH + " pixels wide."); + throw new UserMistakeException(ERROR_CODE_IMAGE_TOO_SMALL, + THUMBNAIL_HEIGHT, THUMBNAIL_WIDTH); } return size; @@ -237,8 +243,7 @@ public class ImageUploadHelper { throw e; } catch (Exception e) { log.warn("Unexpected exception in image handling", e); - throw new UserMistakeException("Sorry, we were unable to process " - + "the photo you provided. Please try another photo."); + throw new UserMistakeException(ERROR_CODE_UNKNOWN); } finally { if (source != null) { try { @@ -261,8 +266,7 @@ public class ImageUploadHelper { ATTRIBUTE_TEMP_FILE); if (fileInfo == null) { - throw new UserMistakeException( - "There is no image file to be cropped."); + throw new UserMistakeException(ERROR_CODE_NO_IMAGE_TO_CROP); } return fileInfo; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/email/FreemarkerEmailFactory.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/email/FreemarkerEmailFactory.java index bedeab160..05e3c7a51 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/email/FreemarkerEmailFactory.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/email/FreemarkerEmailFactory.java @@ -61,8 +61,8 @@ public class FreemarkerEmailFactory { FreemarkerEmailFactory factory = getFactory(vreq); FreemarkerConfiguration fConfig = FreemarkerConfigurationLoader .getConfig(vreq); - return new FreemarkerEmailMessage(fConfig, factory.getEmailSession(), - factory.getReplyToAddress()); + return new FreemarkerEmailMessage(vreq, fConfig, + factory.getEmailSession(), factory.getReplyToAddress()); } /** diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/email/FreemarkerEmailMessage.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/email/FreemarkerEmailMessage.java index db7356ed4..6fab17daa 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/email/FreemarkerEmailMessage.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/email/FreemarkerEmailMessage.java @@ -27,8 +27,10 @@ import javax.mail.internet.MimeMultipart; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerConfiguration; import edu.cornell.mannlib.vitro.webapp.web.directives.EmailDirective; +import freemarker.core.Environment; import freemarker.template.Template; import freemarker.template.TemplateException; @@ -47,7 +49,8 @@ public class FreemarkerEmailMessage { private static final Log log = LogFactory .getLog(FreemarkerEmailMessage.class); - private final Session session; + private final VitroRequest vreq; + private final Session mailSession; private final FreemarkerConfiguration config; private final List recipients = new ArrayList(); @@ -63,9 +66,10 @@ public class FreemarkerEmailMessage { /** * Package access - should only be created by the factory. */ - FreemarkerEmailMessage(FreemarkerConfiguration fConfig, Session session, - InternetAddress replyToAddress) { - this.session = session; + FreemarkerEmailMessage(VitroRequest vreq, FreemarkerConfiguration fConfig, + Session mailSession, InternetAddress replyToAddress) { + this.vreq = vreq; + this.mailSession = mailSession; this.replyToAddress = replyToAddress; this.config = fConfig; } @@ -141,7 +145,13 @@ public class FreemarkerEmailMessage { try { Template template = config.getTemplate(templateName); - template.process(bodyMap, new StringWriter()); + + Environment env = template.createProcessingEnvironment(bodyMap, + new StringWriter()); + env.setCustomAttribute("request", vreq); + env.setCustomAttribute("context", vreq.getSession() + .getServletContext()); + env.process(); } catch (TemplateException e) { log.error(e, e); } catch (IOException e) { @@ -151,7 +161,7 @@ public class FreemarkerEmailMessage { public boolean send() { try { - MimeMessage msg = new MimeMessage(session); + MimeMessage msg = new MimeMessage(mailSession); msg.setReplyTo(new Address[] { replyToAddress }); if (fromAddress == null) { @@ -199,11 +209,11 @@ public class FreemarkerEmailMessage { bodyPart.setContent(textBody, type); content.addBodyPart(bodyPart); } - - public String getReplyToAddress() { - return replyToAddress.getAddress(); - } - + + public String getReplyToAddress() { + return replyToAddress.getAddress(); + } + private T nonNull(T value, T defaultValue) { return (value == null) ? defaultValue : value; } diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/I18nBundle.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/I18nBundle.java index 7ea5acc3d..44b930089 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/I18nBundle.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/I18nBundle.java @@ -39,8 +39,9 @@ public class I18nBundle { public I18nBundle(String bundleName, ResourceBundle resources) { this(bundleName, resources, MESSAGE_KEY_NOT_FOUND); } - - private I18nBundle(String bundleName, ResourceBundle resources, String notFoundMessage) { + + private I18nBundle(String bundleName, ResourceBundle resources, + String notFoundMessage) { if (bundleName == null) { throw new IllegalArgumentException("bundleName may not be null"); } @@ -49,20 +50,22 @@ public class I18nBundle { } if (resources == null) { throw new NullPointerException("resources may not be null."); - }if (notFoundMessage == null) { + } + if (notFoundMessage == null) { throw new NullPointerException("notFoundMessage may not be null."); } this.bundleName = bundleName; this.resources = resources; this.notFoundMessage = notFoundMessage; } - + public String text(String key, Object... parameters) { - log.debug("Asking for '" + key + "' from bundle '" + bundleName + "'"); String textString; if (resources.containsKey(key)) { textString = resources.getString(key); + log.debug("In '" + bundleName + "', " + key + "='" + textString + + "')"); return formatString(textString, parameters); } else { String message = MessageFormat.format(notFoundMessage, bundleName, diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/VitroResourceBundle.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/VitroResourceBundle.java index c9b2b2acb..3d0640f30 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/VitroResourceBundle.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/i18n/VitroResourceBundle.java @@ -60,7 +60,7 @@ public class VitroResourceBundle extends ResourceBundle { return new VitroResourceBundle(bundleName, ctx, appI18nPath, themeI18nPath, control); } catch (FileNotFoundException e) { - log.debug(e); + log.info(e.getMessage()); return null; } catch (Exception e) { log.warn(e, e); diff --git a/webapp/web/i18n/all.properties b/webapp/web/i18n/all.properties new file mode 100644 index 000000000..ad5ec0618 --- /dev/null +++ b/webapp/web/i18n/all.properties @@ -0,0 +1,218 @@ +# +# Text strings for the controllers and templates +# +# Default (English) +# +save_changes = Save changes +cancel_link = Cancel +cancel_title = cancel +required_fields = required fields +or = or +alt_error_alert = Error alert icon +alt_confirmation = Confirmation icon + +email_address = Email address +first_name = First name +last_name = Last name +roles = Roles +status = Status + +ascending_order = ascending order +descending_order = descending order +select_one = Select one + +type_more_characters = type more characters +no_match = no match + +request_failed = Request failed. Please contact your system administrator. + +# +# Image upload pages +# +upload_page_title = Upload image +upload_page_title_with_name = Upload image for {0} +upload_heading = Photo Upload + +replace_page_title = Replace image +replace_page_title_with_name = Replace image for {0} + +crop_page_title = Crop image +crop_page_title_with_name = Crop image for {0} + +current_photo = Current Photo +upload_photo = Upload a photo +replace_photo = Replace Photo +photo_types = (JPEG, GIF or PNG) +maximum_file_size = Maximum file size: {0} megabytes +minimum_image_dimensions = Minimum image dimensions: {0} x {1} pixels + +cropping_caption = Your profile photo will look like the image below. +cropping_note = To make adjustments, you can drag around and resize the photo to the right. \ + When you are happy with your photo click the "Save Photo" button. + +alt_thumbnail_photo = Individual photo +alt_image_to_crop = Image to be cropped +alt_preview_crop = Preview of photo cropped + +delete_link = Delete photo +submit_upload = Upload photo +submit_save = Save photo + +confirm_delete = Are you sure you want to delete this photo? + +imageUpload.errorNoURI = No entity URI was provided +imageUpload.errorUnrecognizedURI = This URI is not recognized as belonging to anyone: ''{0}'' +imageUpload.errorNoImageForCropping = There is no image file to be cropped. +imageUpload.errorImageTooSmall = The uploaded image should be at least {0} pixels high and {1} pixels wide. +imageUpload.errorUnknown = Sorry, we were unable to process the photo you provided. Please try another photo. +imageUpload.errorFileTooBig = Please upload an image smaller than {0} megabytes. +imageUpload.errorUnrecognizedFileType = ''{0}'' is not a recognized image file type. Please upload JPEG, GIF, or PNG files only. +imageUpload.errorNoPhotoSelected = Please browse and select a photo. +imageUpload.errorBadMultipartRequest = Failed to parse the multi-part request for uploading an image. +imageUpload.errorFormFieldMissing = The form did not contain a ''{0}'' field." + +# +# User Accounts pages +# +account_management = Account Management +user_accounts_link = User accounts +user_accounts_title = user accounts + +login_count = Login count +last_login = Last Login + +add_new_account = Add new account +edit_account = Edit account +external_auth_only = Externally Authenticated Only +reset_password = Reset password +reset_password_note = Note: Instructions for resetting the password will \ + be emailed to the address entered above. The password will not \ + be reset until the user follows the link provided in this email. +new_password = New password +confirm_password = Confirm new password +minimum_password_length = Minimum of {0} characters in length. +leave_password_unchanged = Leaving this blank means that the password will not be changed. +confirm_initial_password = Confirm initial password + +new_account_1 = A new account for +new_account_2 = was successfully created. +new_account_title = new account +new_account_notification = A notification email has been sent to {0} \ + with instructions for activating the account and creating a password. +updated_account_1 = The account for +updated_account_2 = has been updated. +updated_account_title = updated account +updated_account_notification = A confirmation email has been sent to {0} \ + with instructions for resetting a password. \ + The password will not be reset until the user follows the link provided in this email. +deleted_accounts = Deleted {0} {0, choice, 0#accounts |1#account |1 + + {1} + + +

+ {2} {3} +

+ +

+ Congratulations! +

+ +

+ We have created your new account on {0}, associated with {4}. +

+ +

+ If you did not request this new account you can safely ignore this email. + This request will expire if not acted upon for 30 days. +

+ +

+ Click the link below to create your password for your new account using our secure server. +

+ +

+ {5} +

+ +

+ If the link above doesn't work, you can copy and paste the link directly into your browser's address bar. +

+ +

+ Thanks! +

+ + diff --git a/webapp/web/i18n/files/accountCreatedEmail.txt b/webapp/web/i18n/files/accountCreatedEmail.txt new file mode 100644 index 000000000..4dcd900c8 --- /dev/null +++ b/webapp/web/i18n/files/accountCreatedEmail.txt @@ -0,0 +1,17 @@ +{2} {3} + +Congratulations! + +We have created your new account on {0}, +associated with {4}. + +If you did not request this new account you can safely ignore this email. +This request will expire if not acted upon for 30 days. + +Paste the link below into your browser's address bar to create your password +for your new account using our secure server. + +{5} + +Thanks! + diff --git a/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.html b/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.html new file mode 100644 index 000000000..164bf87ae --- /dev/null +++ b/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.html @@ -0,0 +1,22 @@ + + + ${1} + + +

+ ${2} ${3} +

+ +

+ Congratulations! +

+ +

+ We have created your new VIVO account associated with ${4}. +

+ +

+ Thanks! +

+ + diff --git a/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.txt b/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.txt new file mode 100644 index 000000000..c55cb3f9a --- /dev/null +++ b/webapp/web/i18n/files/accountCreatedExternalOnlyEmail.txt @@ -0,0 +1,9 @@ +${2} ${3} + +Congratulations! + +We have created your new VIVO account associated with +${4}. + +Thanks! + diff --git a/webapp/web/i18n/files/accountEmailChanged.html b/webapp/web/i18n/files/accountEmailChanged.html new file mode 100644 index 000000000..5a2e51e50 --- /dev/null +++ b/webapp/web/i18n/files/accountEmailChanged.html @@ -0,0 +1,19 @@ + + + {1} + + +

+ Hi, {2} ${3} +

+ +

+ You recently changed the email address associated with + ${2} ${3} +

+ +

+ Thank you. +

+ + diff --git a/webapp/web/i18n/files/accountEmailChanged.txt b/webapp/web/i18n/files/accountEmailChanged.txt new file mode 100644 index 000000000..5f560dca1 --- /dev/null +++ b/webapp/web/i18n/files/accountEmailChanged.txt @@ -0,0 +1,6 @@ +Hi, {2} {3} + +You recently changed the email address associated with +{2} {3} + +Thank you. diff --git a/webapp/web/i18n/files/accountFirstTimeExternal.html b/webapp/web/i18n/files/accountFirstTimeExternal.html new file mode 100644 index 000000000..61dca7f3c --- /dev/null +++ b/webapp/web/i18n/files/accountFirstTimeExternal.html @@ -0,0 +1,22 @@ + + + {1} + + +

+ {2} {3} +

+ +

+ Congratulations! +

+ +

+ We have created your new {0} account associated with {4}. +

+ +

+ Thanks! +

+ + diff --git a/webapp/web/i18n/files/accountFirstTimeExternal.txt b/webapp/web/i18n/files/accountFirstTimeExternal.txt new file mode 100644 index 000000000..1cb60552b --- /dev/null +++ b/webapp/web/i18n/files/accountFirstTimeExternal.txt @@ -0,0 +1,8 @@ +{2} {3} + +Congratulations! + +We have created your new {0} account associated with +{4} + +Thanks! diff --git a/webapp/web/i18n/files/passwordCreatedEmail.html b/webapp/web/i18n/files/passwordCreatedEmail.html new file mode 100644 index 000000000..15cf8bb0d --- /dev/null +++ b/webapp/web/i18n/files/passwordCreatedEmail.html @@ -0,0 +1,22 @@ + + + {1} + + +

+ {2} {3} +

+ +

+ Password successfully created. +

+ +

+ Your new password associated with {4} has been created. +

+ +

+ Thank you. +

+ + diff --git a/webapp/web/i18n/files/passwordCreatedEmail.txt b/webapp/web/i18n/files/passwordCreatedEmail.txt new file mode 100644 index 000000000..dbd9e9da0 --- /dev/null +++ b/webapp/web/i18n/files/passwordCreatedEmail.txt @@ -0,0 +1,8 @@ +{2} {3} + +Password successfully created. + +Your new password associated with {4} +has been created. + +Thank you. diff --git a/webapp/web/i18n/files/passwordRequestPending.html b/webapp/web/i18n/files/passwordRequestPending.html new file mode 100644 index 000000000..bd20cb392 --- /dev/null +++ b/webapp/web/i18n/files/passwordRequestPending.html @@ -0,0 +1,34 @@ + + + {1} + + +

+ Dear {2} {3}: +

+ +

+ We have received a request to reset the password for your {0} account ({4}). +

+ +

+ Please follow the instructions below to proceed with your password reset. +

+ +

+ If you did not request this new account you can safely ignore this email. + This request will expire if not acted upon within 30 days. +

+ +

+ Click on the link below or paste it into your browser's address bar to reset your password + using our secure server. +

+ +

+ {5} +

+ +

Thank you!

+ + diff --git a/webapp/web/i18n/files/passwordRequestPending.txt b/webapp/web/i18n/files/passwordRequestPending.txt new file mode 100644 index 000000000..e8c92b5f2 --- /dev/null +++ b/webapp/web/i18n/files/passwordRequestPending.txt @@ -0,0 +1,16 @@ +Dear {2} {3}: + +We have received a request to reset the password for your {0} account +({4}). + +Please follow the instructions below to proceed with your password reset. + +If you did not request this new account you can safely ignore this email. +This request will expire if not acted upon within 30 days. + +Paste the link below into your browser's address bar to reset your password +using our secure server. + +{5} + +Thank you! diff --git a/webapp/web/i18n/files/passwordResetComplete.html b/webapp/web/i18n/files/passwordResetComplete.html new file mode 100644 index 000000000..bfa756f15 --- /dev/null +++ b/webapp/web/i18n/files/passwordResetComplete.html @@ -0,0 +1,22 @@ + + + {1} + + +

+ {2} {3} +

+ +

+ Password successfully changed. +

+ +

+ Your new password associated with {4} has been changed. +

+ +

+ Thank you. +

+ + diff --git a/webapp/web/i18n/files/passwordResetComplete.txt b/webapp/web/i18n/files/passwordResetComplete.txt new file mode 100644 index 000000000..99503085c --- /dev/null +++ b/webapp/web/i18n/files/passwordResetComplete.txt @@ -0,0 +1,8 @@ +{2} {3} + +Password successfully changed. + +Your new password associated with {4} +has been changed. + +Thank you. diff --git a/webapp/web/i18n/files/passwordResetPending.html b/webapp/web/i18n/files/passwordResetPending.html new file mode 100644 index 000000000..bd20cb392 --- /dev/null +++ b/webapp/web/i18n/files/passwordResetPending.html @@ -0,0 +1,34 @@ + + + {1} + + +

+ Dear {2} {3}: +

+ +

+ We have received a request to reset the password for your {0} account ({4}). +

+ +

+ Please follow the instructions below to proceed with your password reset. +

+ +

+ If you did not request this new account you can safely ignore this email. + This request will expire if not acted upon within 30 days. +

+ +

+ Click on the link below or paste it into your browser's address bar to reset your password + using our secure server. +

+ +

+ {5} +

+ +

Thank you!

+ + diff --git a/webapp/web/i18n/files/passwordResetPending.txt b/webapp/web/i18n/files/passwordResetPending.txt new file mode 100644 index 000000000..5d34952f3 --- /dev/null +++ b/webapp/web/i18n/files/passwordResetPending.txt @@ -0,0 +1,16 @@ +Dear {2} {3}: + +We have received a request to reset the password for your {0} account +({4}). + +Please follow the instructions below to proceed with your password reset. + +If you did not request this new account you can safely ignore this email. +This request will expire if not acted upon within 30 days. + +Paste the link below into your browser's address bar to reset your password +using our secure server. + +{5} + +Thank you! \ No newline at end of file diff --git a/webapp/web/js/account/accountUtils.js b/webapp/web/js/account/accountUtils.js index 134009f61..26b0f75aa 100644 --- a/webapp/web/js/account/accountUtils.js +++ b/webapp/web/js/account/accountUtils.js @@ -45,7 +45,7 @@ $(document).ready(function(){ if (countAccount == 0){ return false; }else{ - var answer = confirm( 'Are you sure you want to delete ' + ((countAccount > 1) ? 'these accounts' : 'this account') +'?'); + var answer = confirm( ((countAccount > 1) ? confirm_delete_account_plural : confirm_delete_account_singular) +'?'); return answer; } }); diff --git a/webapp/web/js/imageUpload/imageUploadUtils.js b/webapp/web/js/imageUpload/imageUploadUtils.js index 0364689a1..2a2775d1c 100644 --- a/webapp/web/js/imageUpload/imageUploadUtils.js +++ b/webapp/web/js/imageUpload/imageUploadUtils.js @@ -4,7 +4,7 @@ $(document).ready(function(){ // Confirmation alert for photo deletion in image upload and individual templates $('#photoUploadDefaultImage a.thumbnail, a.delete-mainImage').click(function(){ - var answer = confirm('Are you sure you want to delete this photo?'); + var answer = confirm(i18n_confirmDelete); return answer; }); }); \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedEmail.ftl index 35bb89956..a855f13c8 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedEmail.ftl @@ -2,67 +2,22 @@ <#-- Confirmation that an account has been created. --> -<#assign subject = "Your ${siteName} account has been created." /> +<#assign strings = i18n() /> -<#assign html> - - - ${subject} - - -

- ${userAccount.firstName} ${userAccount.lastName} -

- -

- Congratulations! -

- -

- We have created your new account on ${siteName}, associated with ${userAccount.emailAddress}. -

- -

- If you did not request this new account you can safely ignore this email. - This request will expire if not acted upon for 30 days. -

- -

- Click the link below to create your password for your new account using our secure server. -

- -

- ${passwordLink} -

- -

- If the link above doesn't work, you can copy and paste the link directly into your browser's address bar. -

- -

- Thanks! -

- - - +<#assign subject = strings.account_created(siteName) /> -<#assign text> -${userAccount.firstName} ${userAccount.lastName} +<#assign html = strings.account_created_email_html(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress, + passwordLink) /> -Congratulations! - -We have created your new account on ${siteName}, -associated with ${userAccount.emailAddress}. - -If you did not request this new account you can safely ignore this email. -This request will expire if not acted upon for 30 days. - -Paste the link below into your browser's address bar to create your password -for your new account using our secure server. - -${passwordLink} - -Thanks! - +<#assign text = strings.account_created_email_text(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress, + passwordLink) /> <@email subject=subject html=html text=text /> \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedExternalOnlyEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedExternalOnlyEmail.ftl index df2959656..a6bc6f0e9 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedExternalOnlyEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-acctCreatedExternalOnlyEmail.ftl @@ -2,42 +2,18 @@ <#-- Confirmation that an account has been created. --> -<#assign subject = "Your ${siteName} account has been created." /> +<#assign subject = strings.account_created(siteName) /> -<#assign html> - - - ${subject} - - -

- ${userAccount.firstName} ${userAccount.lastName} -

- -

- Congratulations! -

- -

- We have created your new VIVO account associated with ${userAccount.emailAddress}. -

- -

- Thanks! -

- - - +<#assign html = strings.account_created_external_email_html(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress) /> -<#assign text> -${userAccount.firstName} ${userAccount.lastName} - -Congratulations! - -We have created your new VIVO account associated with -${userAccount.emailAddress}. - -Thanks! - +<#assign text = string.account_created_external_email_text(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress) /> <@email subject=subject html=html text=text /> \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-add.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-add.ftl index 26f1eee4a..9ec2e5a22 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-add.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-add.ftl @@ -2,71 +2,54 @@ <#-- Template for adding a user account --> -

> Add new account

+<#assign strings = i18n() /> +

> ${strings.add_new_account}

<#if errorEmailIsEmpty??> - <#assign errorMessage = "You must supply an email address." /> + <#assign errorMessage = strings.error_no_email /> + <#elseif errorEmailInUse??> + <#assign errorMessage = strings.error_email_already_exists /> + <#elseif errorEmailInvalidFormat??> + <#assign errorMessage = strings.error_invalid_email(emailAddress) /> + <#elseif errorExternalAuthIdInUse??> + <#assign errorMessage = strings.error_external_auth_already_exists /> + <#elseif errorFirstNameIsEmpty??> + <#assign errorMessage = strings.error_no_first_name /> + <#elseif errorLastNameIsEmpty??> + <#assign errorMessage = strings.error_no_last_name /> + <#elseif errorNoRoleSelected??> + <#assign errorMessage = strings.error_no_role /> + <#elseif errorPasswordIsEmpty??> + <#assign errorMessage = strings.error_no_password /> + <#elseif errorPasswordIsWrongLength??> + <#assign errorMessage = strings.error_password_length(minimumLength, maximumLength) /> + <#elseif errorPasswordsDontMatch??> + <#assign errorMessage = strings.error_password_mismatch /> - - <#if errorEmailInUse??> - <#assign errorMessage = "An account with that email address already exists." /> - - - <#if errorEmailInvalidFormat??> - <#assign errorMessage = "'${emailAddress}' is not a valid email address." /> - - - <#if errorExternalAuthIdInUse??> - <#assign errorMessage = "An account with that external authorization ID already exists." /> - - - <#if errorFirstNameIsEmpty??> - <#assign errorMessage = "You must supply a first name." /> - - - <#if errorLastNameIsEmpty??> - <#assign errorMessage = "You must supply a last name." /> - - - <#if errorNoRoleSelected??> - <#assign errorMessage = "You must select a role." /> - - - <#if errorPasswordIsEmpty??> - <#assign errorMessage = "No password supplied." /> - - - <#if errorPasswordIsWrongLength??> - <#assign errorMessage = "Password must be between ${minimumLength} and ${maximumLength} characters." /> - - - <#if errorPasswordsDontMatch??> - <#assign errorMessage = "Passwords do not match." /> - - + <#if errorMessage?has_content>
- + - + - + <#include "userAccounts-associateProfilePanel.ftl"> -

checked />Externally Authenticated Only

-

Roles *

+

checked />${strings.external_auth_only}

+

${strings.roles} *

<#list roles as role> @@ -74,25 +57,21 @@ <#if emailIsEnabled??> -

- Note: An email will be sent to the address entered above - notifying that an account has been created. - It will include instructions for activating the account and creating a password. -

+

${strings.new_account_note}

<#else>
- + -

Minimum of ${minimumLength} characters in length.

+

${strings.minimum_password_length}

- +
-

or Cancel

+

${strings.or} ${strings.cancel_link}

-

* required fields

+

* ${strings.required_fields}

diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-associateProfilePanel.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-associateProfilePanel.ftl index f75ef2856..3cf0bedff 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-associateProfilePanel.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-associateProfilePanel.ftl @@ -2,20 +2,22 @@ <#-- Template for setting the account reference field, which can also associate a profile with the user account --> +<#assign strings = i18n() /> + ${stylesheets.add('', '')}
<#if showAssociation??> - + - This Identifier is already in use. -

Can be used to associate the account with the user's profile via the matching property.

+ ${strings.auth_id_in_use} +

${strings.auth_id_explanation}

<#else> - + - This Identifier is already in use. + ${strings.auth_id_in_use}
@@ -24,10 +26,10 @@ ${stylesheets.add('

- + - (verify this match) - (change profile) + (${strings.verify_this_match}) + (${strings.change_profile})

@@ -37,16 +39,16 @@ ${stylesheets.add('

- +

-

- or -

+

- ${strings.or} -

- + - + -

Minimum of ${minimumLength} characters in length.

+

${strings.minimum_password_length(minimumLength)}

- + -

+

-

* required fields

+

* ${strings.required_fields}

diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl index e5b348fdc..a871b8090 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-edit.ftl @@ -2,75 +2,58 @@ <#-- Template for editing a user account --> -

> Edit account

+<#assign strings = i18n() /> +

> ${strings.edit_account}

<#if errorEmailIsEmpty??> - <#assign errorMessage = "You must supply an email address." /> - - - <#if errorEmailInUse??> - <#assign errorMessage = "An account with that email address already exists." /> - - - <#if errorEmailInvalidFormat??> - <#assign errorMessage = "'${emailAddress}' is not a valid email address." /> - - - <#if errorExternalAuthIdInUse??> - <#assign errorMessage = "An account with that external authorization ID already exists." /> - - - <#if errorFirstNameIsEmpty??> - <#assign errorMessage = "You must supply a first name." /> - - - <#if errorLastNameIsEmpty??> - <#assign errorMessage = "You must supply a last name." /> - - - <#if errorNoRoleSelected??> - <#assign errorMessage = "You must select a role." /> - - - <#if errorPasswordIsEmpty??> - <#assign errorMessage = "No password supplied." /> - - - <#if errorPasswordIsWrongLength??> - <#assign errorMessage = "Password must be between ${minimumLength} and ${maximumLength} characters." /> - - - <#if errorPasswordsDontMatch??> - <#assign errorMessage = "Passwords do not match." /> + <#assign errorMessage = strings.error_no_email /> + <#elseif errorEmailInUse??> + <#assign errorMessage = strings.error_email_already_exists /> + <#elseif errorEmailInvalidFormat??> + <#assign errorMessage = strings.error_invalid_email(emailAddress) /> + <#elseif errorExternalAuthIdInUse??> + <#assign errorMessage = strings.error_external_auth_already_exists /> + <#elseif errorFirstNameIsEmpty??> + <#assign errorMessage = strings.error_no_first_name /> + <#elseif errorLastNameIsEmpty??> + <#assign errorMessage = strings.error_no_last_name /> + <#elseif errorNoRoleSelected??> + <#assign errorMessage = strings.error_no_role /> + <#elseif errorPasswordIsEmpty??> + <#assign errorMessage = strings.error_no_password /> + <#elseif errorPasswordIsWrongLength??> + <#assign errorMessage = strings.error_password_length(minimumLength, maximumLength) /> + <#elseif errorPasswordsDontMatch??> + <#assign errorMessage = strings.error_password_mismatch /> <#if errorMessage?has_content>
- + - + - + <#if externalAuthPermitted??> <#include "userAccounts-associateProfilePanel.ftl"> -

checked />Externally Authenticated Only

+

checked />${strings.external_auth_only}

<#if roles?has_content> -

Roles *

+

${strings.roles} *

<#list roles as role> @@ -81,29 +64,25 @@ <#if emailIsEnabled??>
class="hidden" role="region"> checked /> - + -

- Note: Instructions for resetting the password will - be emailed to the address entered above. The password will not - be reset until the user follows the link provided in this email. -

+

${strings.reset_password_note}

<#else>
class="hidden" role="region"> - + -

Minimum of ${minimumLength} characters in length.
- Leaving this blank means that the password will not be changed.

+

${strings.minimum_password_length(minimumLength)}
+ ${strings.leave_password_unchanged}

- +
-

or Cancel

+

${strings.or} ${strings.cancel_link}

-

* required fields

+

* ${strings.required_fields}

diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternal.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternal.ftl index a1f725bca..96bdb70eb 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternal.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternal.ftl @@ -2,59 +2,55 @@ <#-- Template for creating an account for the first time an external user logs in. --> -

First time log in

+<#assign strings = i18n() /> + +

${strings.first_time_login}

<#if errorEmailIsEmpty??> - <#assign errorMessage = "You must supply an email address." /> + <#assign errorMessage = strings.error_no_email /> + <#elseif errorEmailInUse??> + <#assign errorMessage = strings.error_email_already_exists /> + <#elseif errorEmailInvalidFormat??> + <#assign errorMessage = strings.error_invalid_email(emailAddress) /> + <#elseif errorFirstNameIsEmpty??> + <#assign errorMessage = strings.error_no_first_name /> + <#elseif errorLastNameIsEmpty??> + <#assign errorMessage = strings.error_no_last_name /> - - <#if errorEmailInUse??> - <#assign errorMessage = "An account with that email address already exists." /> - - - <#if errorEmailInvalidFormat??> - <#assign errorMessage = "'${emailAddress}' is not a valid email address." /> - - - <#if errorFirstNameIsEmpty??> - <#assign errorMessage = "You must supply a first name." /> - - - <#if errorLastNameIsEmpty??> - <#assign errorMessage = "You must supply a last name." /> - - + <#if errorMessage?has_content>
-

Please provide your contact information to finish creating your account.

+

${strings.please_provide_contact_information}

- + - + - + <#if emailIsEnabled??> -

- Note: An email will be sent to the address entered above notifying - that an account has been created. -

+

${strings.first_time_login_note}

-

or Cancel

+

+ ${strings.or} + ${strings.cancel_link} +

+ +

* ${strings.required_fields}

diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternalEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternalEmail.ftl index a7b6cae83..247cc42b4 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternalEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-firstTimeExternalEmail.ftl @@ -2,42 +2,20 @@ <#-- Confirmation that an account has been created for an externally-authenticated user. --> -<#assign subject = "Your ${siteName} account has been created." /> +<#assign strings = i18n() /> -<#assign html> - - - ${subject} - - -

- ${userAccount.firstName} ${userAccount.lastName} -

- -

- Congratulations! -

- -

- We have created your new VIVO account associated with ${userAccount.emailAddress}. -

- -

- Thanks! -

- - - +<#assign subject = strings.account_created(siteName) /> -<#assign text> -${userAccount.firstName} ${userAccount.lastName} +<#assign html = strings.first_time_external_email_html(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress) /> -Congratulations! - -We have created your new VIVO account associated with -${userAccount.emailAddress}. - -Thanks! - +<#assign text = strings.first_time_external_email_text(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress) /> <@email subject=subject html=html text=text /> \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl index 70b9c3e60..d9c5aa06c 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-list.ftl @@ -4,20 +4,19 @@ <#import "userAccounts-accountsNav.ftl" as p> +<#assign strings = i18n() /> +
-

User accounts |

+

${strings.user_accounts_link} |

<#if newUserAccount?? > @@ -25,14 +24,10 @@ <#if updatedUserAccount?? > @@ -40,7 +35,7 @@ <#if deletedAccountCount?? > @@ -48,7 +43,7 @@
<#if roleFilterUri?has_content> - View all accounts + ${strings.view_all_accounts}
@@ -68,7 +63,7 @@
- + <#else> @@ -156,7 +151,7 @@ <#if account.editUrl != ""> - ${account.emailAddress} + ${account.emailAddress} <#else> ${account.emailAddress} @@ -185,5 +180,10 @@ <@p.accountsNav />
+ + ${stylesheets.add('')} ${scripts.add('')} \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-myAccount.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-myAccount.ftl index 27add004a..8f8c8bd00 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-myAccount.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-myAccount.ftl @@ -2,58 +2,48 @@ <#-- Template for editing a user account --> -

My account

+<#assign strings = i18n() /> + +

${strings.myAccount_heading}

<#if errorEmailIsEmpty??> - <#assign errorMessage = "You must supply an email address." /> + <#assign errorMessage = strings.error_no_email /> + <#elseif errorEmailInUse??> + <#assign errorMessage = strings.error_email_already_exists /> + <#elseif errorEmailInvalidFormat??> + <#assign errorMessage = strings.error_invalid_email(emailAddress) /> + <#elseif errorFirstNameIsEmpty??> + <#assign errorMessage = strings.error_no_first_name /> + <#elseif errorLastNameIsEmpty??> + <#assign errorMessage = strings.error_no_last_name /> + <#elseif errorNoRoleSelected??> + <#assign errorMessage = strings.error_no_role /> + <#elseif errorPasswordIsEmpty??> + <#assign errorMessage = strings.error_no_password /> + <#elseif errorPasswordIsWrongLength??> + <#assign errorMessage = strings.error_password_length(minimumLength, maximumLength) /> + <#elseif errorPasswordsDontMatch??> + <#assign errorMessage = strings.error_password_mismatch /> - - <#if errorEmailInUse??> - <#assign errorMessage = "An account with that email address already exists." /> - - - <#if errorEmailInvalidFormat??> - <#assign errorMessage = "'${emailAddress}' is not a valid email address." /> - - - <#if errorFirstNameIsEmpty??> - <#assign errorMessage = "You must supply a first name." /> - - - <#if errorLastNameIsEmpty??> - <#assign errorMessage = "You must supply a last name." /> - - - <#if errorPasswordIsEmpty??> - <#assign errorMessage = "No password supplied." /> - - - <#if errorPasswordIsWrongLength??> - <#assign errorMessage = "Password must be between ${minimumLength} and ${maximumLength} characters." /> - - - <#if errorPasswordsDontMatch??> - <#assign errorMessage = "Passwords do not match." /> - - + <#if errorMessage?has_content> <#if confirmChange??> - <#assign confirmMessage = "Your changes have been saved." /> + <#assign confirmMessage = strings.myAccount_confirm_changes /> <#if confirmEmailSent??> - <#assign confirmMessage = "Your changes have been saved. A confirmation email has been sent to ${emailAddress}." /> + <#assign confirmMessage = strings.myAccount_confirm_changes_plus_note(emailAddress) /> <#if confirmMessage?has_content> @@ -63,30 +53,34 @@ <#include "userAccounts-myProxiesPanel.ftl"> - + -

Note: if email changes, a confirmation email will
be sent to the new email address entered above.

+

${strings.email_change_will_be_confirmed}

- + - + <#if !externalAuth??> - + -

Minimum of ${minimumLength} characters in length.
If left blank, the password will not be changed.

+

${strings.minimum_password_length(minimumLength)}
${strings.leave_password_unchanged}

- + -

or Cancel

+

+ + ${strings.or} + ${strings.cancel_link} +

-

* required fields

+

* ${strings.required_fields}

diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-myProxiesPanel.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-myProxiesPanel.ftl index 8c27c659f..02edecc87 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-myProxiesPanel.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-myProxiesPanel.ftl @@ -2,15 +2,21 @@ <#-- Template for setting the account reference field, which can also associate a profile with the user account --> +<#assign strings = i18n() /> +
-

Who can edit my profile

+

${strings.who_can_edit_profile}

- - + + + -

 

+

+   +

${myAccountUri}

-

Selected editors:

+

${strings.selected_editors}:

<#-- Magic ul that holds all of the proxy data and the template that shows how to display it. -->
    @@ -35,7 +41,7 @@

    %label% | %classLabel%
    - Remove selection + ${strings.remove_selection}

    diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordCreatedEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordCreatedEmail.ftl index 4177027ab..1a4941549 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordCreatedEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordCreatedEmail.ftl @@ -2,42 +2,20 @@ <#-- Confirmation that an password has been created. --> -<#assign subject = "Your ${siteName} password has successfully been created." /> +<#assign strings = i18n() /> -<#assign html> - - - ${subject} - - -

    - ${userAccount.firstName} ${userAccount.lastName} -

    - -

    - Password successfully created. -

    - -

    - Your new password associated with ${userAccount.emailAddress} has been created. -

    - -

    - Thank you. -

    - - - +<#assign subject = strings.password_created_subject(siteName) /> -<#assign text> -${userAccount.firstName} ${userAccount.lastName} +<#assign html = strings.password_created_email_html(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress) /> -Password successfully created. - -Your new password associated with ${userAccount.emailAddress} -has been created. - -Thank you. - +<#assign text = strings.password_created_email_text(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress) /> <@email subject=subject html=html text=text /> \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetCompleteEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetCompleteEmail.ftl index 8fd529c79..8badf9f3b 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetCompleteEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetCompleteEmail.ftl @@ -2,42 +2,20 @@ <#-- Confirmation that a password has been reset. --> -<#assign subject = "Your ${siteName} password changed." /> +<#assign strings = i18n() /> -<#assign html> - - - ${subject} - - -

    - ${userAccount.firstName} ${userAccount.lastName} -

    - -

    - Password successfully changed. -

    - -

    - Your new password associated with ${userAccount.emailAddress} has been changed. -

    - -

    - Thank you. -

    - - - +<#assign subject = strings.password_reset_complete_subject(siteName) /> -<#assign text> -${userAccount.firstName} ${userAccount.lastName} +<#assign html = strings.password_reset_complete_email_html(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress) /> -Password successfully changed. - -Your new password associated with ${userAccount.emailAddress} -has been changed. - -Thank you. - +<#assign text = strings.password_reset_complete_email_text(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress) /> <@email subject=subject html=html text=text /> \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetPendingEmail.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetPendingEmail.ftl index d6fcc59a2..e02bdfd9a 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetPendingEmail.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-passwordResetPendingEmail.ftl @@ -2,60 +2,22 @@ <#-- Confirmation email for user account password reset --> -<#assign subject = "${siteName} reset password request" /> +<#assign strings = i18n() /> -<#assign html> - - - ${subject} - - -

    - Dear ${userAccount.firstName} ${userAccount.lastName}: -

    - -

    - We have received a request to reset the password for your ${siteName} account (${userAccount.emailAddress}). -

    - -

    - Please follow the instructions below to proceed with your password reset. -

    - -

    - If you did not request this new account you can safely ignore this email. - This request will expire if not acted upon within 30 days. -

    - -

    - Click on the link below or paste it into your browser's address bar to reset your password - using our secure server. -

    - -

    ${passwordLink}

    - -

    Thank you!

    - - - +<#assign subject = strings.password_reset_pending_subject(siteName) /> -<#assign text> -Dear ${userAccount.firstName} ${userAccount.lastName}: - -We have received a request to reset the password for your ${siteName} account -(${userAccount.emailAddress}). +<#assign html = strings.password_reset_pending_email_html(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress, + passwordLink) /> -Please follow the instructions below to proceed with your password reset. - -If you did not request this new account you can safely ignore this email. -This request will expire if not acted upon within 30 days. - -Paste the link below into your browser's address bar to reset your password -using our secure server. - -${passwordLink} - -Thank you! - +<#assign text = strings.password_reset_pending_email_text(siteName, + subject, + userAccount.firstName, + userAccount.lastName, + userAccount.emailAddress, + passwordLink) /> <@email subject=subject html=html text=text /> \ No newline at end of file diff --git a/webapp/web/templates/freemarker/body/accounts/userAccounts-resetPassword.ftl b/webapp/web/templates/freemarker/body/accounts/userAccounts-resetPassword.ftl index d7630d5fb..0ca4be7b6 100644 --- a/webapp/web/templates/freemarker/body/accounts/userAccounts-resetPassword.ftl +++ b/webapp/web/templates/freemarker/body/accounts/userAccounts-resetPassword.ftl @@ -2,45 +2,43 @@ <#-- Template for adding a user account --> -

    Reset your Password

    +<#assign strings = i18n() /> -

    Please enter your new password for ${userAccount.emailAddress}

    +

    ${strings.reset_your_password}

    - <#if errorPasswordIsEmpty??> - <#assign errorMessage = "No password supplied." /> - - - <#if errorPasswordIsWrongLength??> - <#assign errorMessage = "Password must be between ${minimumLength} and ${maximumLength} characters." /> - - - <#if errorPasswordsDontMatch??> - <#assign errorMessage = "Passwords do not match." /> - - - <#if errorMessage?has_content> - - +

    ${strings.enter_new_password(userAccount.emailAddress)}

    + +<#if errorPasswordIsEmpty??> + <#assign errorMessage = strings.error_no_password /> +<#elseif errorPasswordIsWrongLength??> + <#assign errorMessage = strings.error_password_length(minimumLength, maximumLength) /> +<#elseif errorPasswordsDontMatch??> + <#assign errorMessage = strings.error_password_mismatch /> + + +<#if errorMessage?has_content> + +
    - + -

    Minimum of ${minimumLength} characters in length.

    +

    ${strings.minimum_password_length(minimumLength)}

    - + -

    +

    -

    * required fields

    +

    * ${strings.required_fields}

    diff --git a/webapp/web/templates/freemarker/body/imageUpload/imageUpload-cropImage.ftl b/webapp/web/templates/freemarker/body/imageUpload/imageUpload-cropImage.ftl index 9f6f94ad0..bd8d7b5b0 100644 --- a/webapp/web/templates/freemarker/body/imageUpload/imageUpload-cropImage.ftl +++ b/webapp/web/templates/freemarker/body/imageUpload/imageUpload-cropImage.ftl @@ -21,20 +21,22 @@ ${stylesheets.add(' -

    Photo Upload

    +

    ${i18n.upload_heading}

    -

    Your profile photo will look like the image below.

    +

    ${i18n.cropping_caption}

    - Image to be cropped + ${i18n.alt_image_to_crop}
    -

    To make adjustments, you can drag around and resize the photo to the right. When you are happy with your photo click the "Save Photo" button.

    +

    ${i18n.cropping_note}

    @@ -43,15 +45,15 @@ ${stylesheets.add(' - + - or Cancel + ${i18n.or} ${i18n.cancel_link}
    - Preview of photo cropped + ${i18n.alt_preview_crop}
    diff --git a/webapp/web/templates/freemarker/body/imageUpload/imageUpload-newImage.ftl b/webapp/web/templates/freemarker/body/imageUpload/imageUpload-newImage.ftl index 675b63920..cf9a6b204 100644 --- a/webapp/web/templates/freemarker/body/imageUpload/imageUpload-newImage.ftl +++ b/webapp/web/templates/freemarker/body/imageUpload/imageUpload-newImage.ftl @@ -7,29 +7,35 @@ ${scripts.add(' diff --git a/webapp/web/templates/freemarker/body/imageUpload/imageUpload-replaceImage.ftl b/webapp/web/templates/freemarker/body/imageUpload/imageUpload-replaceImage.ftl index d8850d188..cc5a9b7bd 100644 --- a/webapp/web/templates/freemarker/body/imageUpload/imageUpload-replaceImage.ftl +++ b/webapp/web/templates/freemarker/body/imageUpload/imageUpload-replaceImage.ftl @@ -7,30 +7,36 @@ ${scripts.add(' diff --git a/webapp/web/templates/freemarker/body/individual/individual-vitro.ftl b/webapp/web/templates/freemarker/body/individual/individual-vitro.ftl index 8e13dd2d9..12bc8f92c 100644 --- a/webapp/web/templates/freemarker/body/individual/individual-vitro.ftl +++ b/webapp/web/templates/freemarker/body/individual/individual-vitro.ftl @@ -77,3 +77,7 @@ ${headScripts.add('', '')} + + diff --git a/webapp/web/templates/freemarker/page/partials/languageSelector.ftl b/webapp/web/templates/freemarker/page/partials/languageSelector.ftl index cddb02a9f..2109f1912 100644 --- a/webapp/web/templates/freemarker/page/partials/languageSelector.ftl +++ b/webapp/web/templates/freemarker/page/partials/languageSelector.ftl @@ -9,14 +9,12 @@ <#-- This is included by identity.ftl --> <#if selectLocale??>
  • -
    - <#list selectLocale.locales as locale> - - <#if locale_has_next>| - -
    + <#list selectLocale.locales as locale> + + ${locale.label} + + <#if locale_has_next>| +