Tweaks to: adding stylesheets from freemarker templates; contact form styles. Add sender's name to sender address on contact form email notification.
This commit is contained in:
parent
bda278e59b
commit
197aa2f4f9
6 changed files with 22 additions and 22 deletions
|
@ -5,6 +5,7 @@ package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
|||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -30,8 +31,6 @@ public class ContactMailController extends FreeMarkerHttpServlet {
|
|||
private static final long serialVersionUID = 1L;
|
||||
private static final Logger LOG = Logger.getLogger(ContactMailController.class);
|
||||
|
||||
private final static String CONFIRM_PAGE = "/thankyou.jsp";
|
||||
private final static String ERR_PAGE = "/contact_err.jsp";
|
||||
private final static String SPAM_MESSAGE = "Your message was flagged as spam.";
|
||||
private final static String EMAIL_BACKUP_FILE_PATH = "/WEB-INF/LatestMessage.html";
|
||||
|
||||
|
@ -185,7 +184,7 @@ public class ContactMailController extends FreeMarkerHttpServlet {
|
|||
try {
|
||||
|
||||
if (spamReason == null) {
|
||||
sendMessage(s, webuseremail, deliverToArray, deliveryfrom,
|
||||
sendMessage(s, webuseremail, webusername, deliverToArray, deliveryfrom,
|
||||
recipientCount, msgText);
|
||||
}
|
||||
|
||||
|
@ -272,7 +271,7 @@ public class ContactMailController extends FreeMarkerHttpServlet {
|
|||
// outFile.close();
|
||||
}
|
||||
|
||||
private void sendMessage(Session s, String webuseremail,
|
||||
private void sendMessage(Session s, String webuseremail, String webusername,
|
||||
String[] deliverToArray, String deliveryfrom, int recipientCount,
|
||||
String msgText)
|
||||
throws AddressException, SendFailedException, MessagingException {
|
||||
|
@ -281,7 +280,12 @@ public class ContactMailController extends FreeMarkerHttpServlet {
|
|||
//System.out.println("trying to send message from servlet");
|
||||
|
||||
// Set the from address
|
||||
msg.setFrom( new InternetAddress( webuseremail ));
|
||||
try {
|
||||
msg.setFrom( new InternetAddress( webuseremail, webusername ));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
LOG.error("Can't set message sender with personal name " + webusername + " due to UnsupportedEncodingException");
|
||||
msg.setFrom( new InternetAddress( webuseremail ) );
|
||||
}
|
||||
|
||||
// Set the recipient address
|
||||
|
||||
|
|
|
@ -291,14 +291,17 @@ public class FreeMarkerHttpServlet extends VitroHttpServlet {
|
|||
|
||||
private final void setThemeInfo(String themeDir) {
|
||||
|
||||
themeDir = getUrl(themeDir);
|
||||
setSharedVariable("themeDir", themeDir);
|
||||
|
||||
// We'll need to separate theme-general and theme-specific stylesheet
|
||||
// dirs, so we need either two attributes or a list.
|
||||
// This value will be available to any template as a path for adding a new stylesheet.
|
||||
// It does not contain the context path, because the methods to generate the href
|
||||
// attribute from the string passed in by the template automatically add the context path.
|
||||
setSharedVariable("stylesheetDir", themeDir + "/css");
|
||||
|
||||
setSharedVariable("siteIconDir", themeDir + "/site_icons");
|
||||
String themeDirWithContext = getUrl(themeDir);
|
||||
|
||||
// This value is used only in stylesheets.ftl and already contains the context path.
|
||||
root.put("stylesheetPath", themeDirWithContext + "/css");
|
||||
|
||||
setSharedVariable("siteIconPath", themeDirWithContext + "/site_icons");
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue