diff --git a/webapp/build.xml b/webapp/build.xml index d7e0e94dc..ea71cf0b8 100644 --- a/webapp/build.xml +++ b/webapp/build.xml @@ -188,8 +188,17 @@ deploy - Deploy the application directly into the Tomcat webapps directory. set this property and they will be skipped. --> + + + + + + + diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java index 604187b23..b3dc0151b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/edit/Authenticate.java @@ -54,10 +54,10 @@ public class Authenticate extends FreeMarkerHttpServlet { private static final String PARAMETER_CONFIRM_PASSWORD = "confirmPassword"; /** If they are logging in, show them this form. */ - public static final String TEMPLATE_LOGIN = "login/login.ftl"; + public static final String TEMPLATE_LOGIN = "login-form.ftl"; /** If they are changing their password on first login, show them this form. */ - public static final String TEMPLATE_FORCE_PASSWORD_CHANGE = "login/forcedPasswordChange.ftl"; + public static final String TEMPLATE_FORCE_PASSWORD_CHANGE = "login-forcedPasswordChange.ftl"; public static final String BODY_LOGIN_NAME = "loginName"; public static final String BODY_FORM_ACTION = "formAction"; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ContactFormController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ContactFormController.java index cf07a8201..eb3ba9bfb 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ContactFormController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ContactFormController.java @@ -44,13 +44,13 @@ public class ContactFormController extends FreeMarkerHttpServlet { body.put("errorMessage", "This application has not yet been configured to send mail. " + "An smtp host has not been specified in the configuration properties file."); - bodyTemplate = "contactForm/error.ftl"; + bodyTemplate = "contactForm-error.ftl"; } else if (StringUtils.isEmpty(portal.getContactMail())) { body.put("errorMessage", "The site administrator has not configured an email address to receive the form submission."); - bodyTemplate = "contactForm/error.ftl"; + bodyTemplate = "contactForm-error.ftl"; } else { @@ -83,7 +83,7 @@ public class ContactFormController extends FreeMarkerHttpServlet { vreq.getSession().setAttribute("contactFormReferer",vreq.getHeader("Referer")); } - bodyTemplate = "contactForm/form.ftl"; + bodyTemplate = "contactForm-form.ftl"; } return mergeBodyToTemplate(bodyTemplate, body, config); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ContactMailController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ContactMailController.java index 3fb9682b4..5f972cac5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ContactMailController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/ContactMailController.java @@ -81,7 +81,7 @@ public class ContactMailController extends FreeMarkerHttpServlet { body.put("errorMessage", "This application has not yet been configured to send mail. " + "An smtp host has not been specified in the configuration properties file."); - bodyTemplate = "contactForm/error.ftl"; + bodyTemplate = "contactForm-error.ftl"; } else { @@ -97,7 +97,7 @@ public class ContactMailController extends FreeMarkerHttpServlet { // rjy7 We should reload the form, not go to the error page! body.put("errorMessage", "Invalid submission"); - bodyTemplate = "contactForm/error.ftl"; + bodyTemplate = "contactForm-error.ftl"; } else { @@ -204,10 +204,10 @@ public class ContactMailController extends FreeMarkerHttpServlet { // Message was sent successfully if (statusMsg == null && spamReason == null) { - bodyTemplate = "contactForm/confirmation.ftl"; + bodyTemplate = "contactForm-confirmation.ftl"; } else { body.put("errorMessage", statusMsg); - bodyTemplate = "contactForm/error.ftl"; + bodyTemplate = "contactForm-error.ftl"; } } } @@ -230,7 +230,7 @@ public class ContactMailController extends FreeMarkerHttpServlet { String originalReferer, String ipAddr, Configuration config) { Map email = new HashMap(); - String template = "contactForm/email.ftl"; + String template = "contactForm-email.ftl"; email.put("subject", deliveryfrom); email.put("name", webusername); @@ -248,7 +248,7 @@ public class ContactMailController extends FreeMarkerHttpServlet { String spamReason, Configuration config) { Map backup = new HashMap(); - String template = "contactForm/backup.ftl"; + String template = "contactForm-backup.ftl"; Calendar cal = Calendar.getInstance(); backup.put("datetime", cal.getTime().toString()); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerComponentGenerator.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerComponentGenerator.java index 2243aaad0..b6f337ab1 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerComponentGenerator.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerComponentGenerator.java @@ -43,8 +43,8 @@ public class FreeMarkerComponentGenerator extends FreeMarkerHttpServlet { } private String get(String templateName, Map root, Configuration config) { - String template = "page/partials/" + templateName + ".ftl"; - return mergeToTemplate(template, root, config).toString(); + templateName += ".ftl"; + return mergeToTemplate(templateName, root, config).toString(); } // RY We need the servlet context in getConfig(). For some reason using the method inherited from diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerHttpServlet.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerHttpServlet.java index f2d754e43..89ff3061c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerHttpServlet.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/freemarker/FreeMarkerHttpServlet.java @@ -385,22 +385,14 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet { } protected String mergeBodyToTemplate(String templateName, Map map, Configuration config) { - templateName = "body/" + templateName; // Remove once we flatten template directory - String body = mergeToTemplate(templateName, map, config).toString(); - return body; + return mergeToTemplate(templateName, map, config).toString(); } protected void writePage(Map root, Configuration config, HttpServletResponse response) { - String templateName = "page/" + getPageTemplateName(); // Remove the directory once we flatten template directory + String templateName = getPageTemplateName(); writeTemplate(templateName, root, config, response); } - // Remove this method once we flatten template directory - protected void ajaxWrite(String templateName, Map map, Configuration config, HttpServletResponse response) { - templateName = "ajax/" + templateName; - writeTemplate(templateName, map, config, response); - } - protected void writeTemplate(String templateName, Map map, Configuration config, HttpServletResponse response) { StringWriter sw = mergeToTemplate(templateName, map, config); write(sw, response); @@ -418,7 +410,7 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet { // Can be overridden by individual controllers to use a different basic page layout. protected String getPageTemplateName() { - return "default.ftl"; + return "page.ftl"; } // TEMPORARY method for transition from JSP to FreeMarker. 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 aabf1e6f6..871d3a76a 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 @@ -72,9 +72,9 @@ public class ImageUploadController extends FreeMarkerHttpServlet { public static final String BODY_FORM_ACTION = "formAction"; public static final String BODY_ERROR_MESSAGE = "errorMessage"; - public static final String TEMPLATE_NEW = "imageUpload/newImage.ftl"; - public static final String TEMPLATE_REPLACE = "imageUpload/replaceImage.ftl"; - public static final String TEMPLATE_CROP = "imageUpload/cropImage.ftl"; + public static final String TEMPLATE_NEW = "imageUpload-newImage.ftl"; + public static final String TEMPLATE_REPLACE = "imageUpload-replaceImage.ftl"; + public static final String TEMPLATE_CROP = "imageUpload-cropImage.ftl"; public static final String TEMPLATE_ERROR = "error.ftl"; private static final String URL_HERE = UrlBuilder.getUrl("/uploadImages"); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/login/LoginTemplateHelper.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/login/LoginTemplateHelper.java index 6bcda3b7b..640154935 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/login/LoginTemplateHelper.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/login/LoginTemplateHelper.java @@ -33,10 +33,10 @@ public class LoginTemplateHelper extends LoginTemplateHelperBase { private static final Log log = LogFactory.getLog(LoginTemplateHelper.class); /** If they are logging in, show them this form. */ - public static final String TEMPLATE_LOGIN = "login/login.ftl"; + public static final String TEMPLATE_LOGIN = "login-form.ftl"; /** If they are changing their password on first login, show them this form. */ - public static final String TEMPLATE_FORCE_PASSWORD_CHANGE = "login/forcedPasswordChange.ftl"; + public static final String TEMPLATE_FORCE_PASSWORD_CHANGE = "login-forcedPasswordChange.ftl"; public static final String BODY_LOGIN_NAME = "loginName"; public static final String BODY_FORM_ACTION = "formAction"; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java index a998eadea..8d96fda8b 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/controller/AutocompleteController.java @@ -96,7 +96,8 @@ public class AutocompleteController extends FreeMarkerHttpServlet implements Sea public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - String templateName = request.getServletPath().equals("/autocomplete") ? "autocompleteResults.ftl" : "selectResults.ftl"; + // String templateName = request.getServletPath().equals("/autocomplete") ? "autocompleteResults.ftl" : "selectResults.ftl"; + String templateName = "autocompleteResults.ftl"; Map map = new HashMap(); VitroRequest vreq = new VitroRequest(request); @@ -188,7 +189,7 @@ public class AutocompleteController extends FreeMarkerHttpServlet implements Sea Collections.sort(results); map.put("results", results); - ajaxWrite(templateName, map, config, response); + writeTemplate(templateName, map, config, response); } catch (Throwable e) { log.error("AutocompleteController(): " + e); @@ -411,17 +412,17 @@ public class AutocompleteController extends FreeMarkerHttpServlet implements Sea private void doNoQuery(String templateName, Map map, Configuration config, HttpServletResponse response) { - ajaxWrite(templateName, map, config, response); + writeTemplate(templateName, map, config, response); } private void doFailedSearch(String templateName, Map map, Configuration config, HttpServletResponse response) { - ajaxWrite(templateName, map, config, response); + writeTemplate(templateName, map, config, response); } private void doSearchError(String templateName, Map map, Configuration config, HttpServletResponse response) { // For now, we are not sending an error message back to the client because with the default autocomplete configuration it // chokes. - ajaxWrite(templateName, map, config, response); + writeTemplate(templateName, map, config, response); } public static final int MAX_QUERY_LENGTH = 500; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/ViewFinder.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/ViewFinder.java index 6a7b6b69a..9875d67f5 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/ViewFinder.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/ViewFinder.java @@ -26,13 +26,13 @@ public class ViewFinder { private static final Log log = LogFactory.getLog(ViewFinder.class.getName()); public enum ClassView { - DISPLAY("getCustomDisplayView", "/view/display"), + DISPLAY("getCustomDisplayView", "/view-display"), // NB this is not the value currently used for custom forms - we use the value on the object property FORM("getCustomEntryForm", "/form"), - SEARCH("getCustomSearchView", "/view/search"), - SHORT("getCustomShortView", "/view/short"); + SEARCH("getCustomSearchView", "/view-search"), + SHORT("getCustomShortView", "/view-short"); - private static String TEMPLATE_PATH = "/templates/freemarker/body/partials/class"; + private static String TEMPLATE_PATH = "/templates/freemarker"; private Method method = null; private String path = null; @@ -85,7 +85,7 @@ public class ViewFinder { try { String v = (String) method.invoke(vc); if (!StringUtils.isEmpty(v)) { - String pathToView = context.getRealPath(view.getPath() + "/" + v); + String pathToView = context.getRealPath(view.getPath() + "-" + v); File viewFile = new File(pathToView); if (viewFile.isFile() && viewFile.canRead()) { viewName = v; diff --git a/webapp/web/templates/freemarker/ajax/autocompleteResults.ftl b/webapp/web/templates/freemarker/ajax/autocompleteResults.ftl index bbf9262a7..c0ae2741d 100644 --- a/webapp/web/templates/freemarker/ajax/autocompleteResults.ftl +++ b/webapp/web/templates/freemarker/ajax/autocompleteResults.ftl @@ -3,7 +3,7 @@ <#-- Template for autocomplete results. --> <#-- -<#import "/lib/json.ftl" as json> +<#import "json.ftl" as json> <@json.array results /> --> diff --git a/webapp/web/templates/freemarker/body/contactForm/backup.ftl b/webapp/web/templates/freemarker/body/contactForm/contactForm-backup.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/contactForm/backup.ftl rename to webapp/web/templates/freemarker/body/contactForm/contactForm-backup.ftl diff --git a/webapp/web/templates/freemarker/body/contactForm/confirmation.ftl b/webapp/web/templates/freemarker/body/contactForm/contactForm-confirmation.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/contactForm/confirmation.ftl rename to webapp/web/templates/freemarker/body/contactForm/contactForm-confirmation.ftl diff --git a/webapp/web/templates/freemarker/body/contactForm/email.ftl b/webapp/web/templates/freemarker/body/contactForm/contactForm-email.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/contactForm/email.ftl rename to webapp/web/templates/freemarker/body/contactForm/contactForm-email.ftl diff --git a/webapp/web/templates/freemarker/body/contactForm/error.ftl b/webapp/web/templates/freemarker/body/contactForm/contactForm-error.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/contactForm/error.ftl rename to webapp/web/templates/freemarker/body/contactForm/contactForm-error.ftl diff --git a/webapp/web/templates/freemarker/body/contactForm/form.ftl b/webapp/web/templates/freemarker/body/contactForm/contactForm-form.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/contactForm/form.ftl rename to webapp/web/templates/freemarker/body/contactForm/contactForm-form.ftl diff --git a/webapp/web/templates/freemarker/body/imageUpload/cropImage.ftl b/webapp/web/templates/freemarker/body/imageUpload/imageUpload-cropImage.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/imageUpload/cropImage.ftl rename to webapp/web/templates/freemarker/body/imageUpload/imageUpload-cropImage.ftl diff --git a/webapp/web/templates/freemarker/body/imageUpload/newImage.ftl b/webapp/web/templates/freemarker/body/imageUpload/imageUpload-newImage.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/imageUpload/newImage.ftl rename to webapp/web/templates/freemarker/body/imageUpload/imageUpload-newImage.ftl diff --git a/webapp/web/templates/freemarker/body/imageUpload/replaceImage.ftl b/webapp/web/templates/freemarker/body/imageUpload/imageUpload-replaceImage.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/imageUpload/replaceImage.ftl rename to webapp/web/templates/freemarker/body/imageUpload/imageUpload-replaceImage.ftl diff --git a/webapp/web/templates/freemarker/body/individualList.ftl b/webapp/web/templates/freemarker/body/individualList.ftl index 2afa3fe05..0fd4419ac 100644 --- a/webapp/web/templates/freemarker/body/individualList.ftl +++ b/webapp/web/templates/freemarker/body/individualList.ftl @@ -16,7 +16,7 @@ <#list individuals as individual>
  • <#-- Currently we just use the search view here; there's no custom list view defined. --> - <#include "partials/class/view/search/${individual.searchView}"> + <#include "${individual.searchView}">
  • diff --git a/webapp/web/templates/freemarker/body/login/forcedPasswordChange.ftl b/webapp/web/templates/freemarker/body/login/login-forcedPasswordChange.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/login/forcedPasswordChange.ftl rename to webapp/web/templates/freemarker/body/login/login-forcedPasswordChange.ftl diff --git a/webapp/web/templates/freemarker/body/login/login.ftl b/webapp/web/templates/freemarker/body/login/login-form.ftl similarity index 100% rename from webapp/web/templates/freemarker/body/login/login.ftl rename to webapp/web/templates/freemarker/body/login/login-form.ftl diff --git a/webapp/web/templates/freemarker/body/partials/class/view/search/default.ftl b/webapp/web/templates/freemarker/body/partials/class/view/search/view-search-default.ftl similarity index 93% rename from webapp/web/templates/freemarker/body/partials/class/view/search/default.ftl rename to webapp/web/templates/freemarker/body/partials/class/view/search/view-search-default.ftl index cdd35fbc2..42a030730 100644 --- a/webapp/web/templates/freemarker/body/partials/class/view/search/default.ftl +++ b/webapp/web/templates/freemarker/body/partials/class/view/search/view-search-default.ftl @@ -2,7 +2,7 @@ <#-- Default individual search view --> -<#import "/lib/list.ftl" as l> +<#import "listMacros.ftl" as l> ${individual.name}
      diff --git a/webapp/web/templates/freemarker/lib/list.ftl b/webapp/web/templates/freemarker/lib/listMacros.ftl similarity index 100% rename from webapp/web/templates/freemarker/lib/list.ftl rename to webapp/web/templates/freemarker/lib/listMacros.ftl diff --git a/webapp/web/templates/freemarker/page/default.ftl b/webapp/web/templates/freemarker/page/page.ftl similarity index 77% rename from webapp/web/templates/freemarker/page/default.ftl rename to webapp/web/templates/freemarker/page/page.ftl index a9097e97d..9db1bcc2a 100644 --- a/webapp/web/templates/freemarker/page/default.ftl +++ b/webapp/web/templates/freemarker/page/page.ftl @@ -1,22 +1,22 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -<#include "partials/doctype.html"> +<#include "doctype.html"> -<#include "partials/head.ftl"> +<#include "head.ftl">
      @@ -29,11 +29,11 @@
      - <#include "partials/footer.ftl"> + <#include "footer.ftl"> - <#include "partials/scripts.ftl"> + <#include "scripts.ftl"> diff --git a/webapp/web/templates/freemarker/page/partials/footer.ftl b/webapp/web/templates/freemarker/page/partials/footer.ftl index 754aff654..db0c6db64 100644 --- a/webapp/web/templates/freemarker/page/partials/footer.ftl +++ b/webapp/web/templates/freemarker/page/partials/footer.ftl @@ -1,6 +1,6 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -<#import "/lib/list.ftl" as l> +<#import "listMacros.ftl" as l>