01: package org.claros.mini.actions;
02:
03: import javax.servlet.http.HttpServletRequest;
04: import javax.servlet.http.HttpServletResponse;
05: import org.apache.struts.action.ActionForm;
06: import org.apache.struts.action.ActionForward;
07: import org.apache.struts.action.ActionMapping;
08:
09: import org.claros.commons.mail.models.Email;
10: import org.claros.mini.common.BaseLoggedAction;
11: import org.claros.mini.models.ComposeFormBean;
12:
13: /**
14: * @version 1.0
15: * @author Umut Gökbayrak
16: */
17: public class ReplyAllAction extends BaseLoggedAction {
18:
19: public ActionForward myExecute(ActionMapping mapping,
20: ActionForm form, HttpServletRequest request,
21: HttpServletResponse response) throws Exception {
22: // delete the previoue values
23: request.getSession().setAttribute("ComposeFormBean", null);
24: request.getSession().setAttribute("attachments", null);
25:
26: // now create a new one.
27: ComposeFormBean bean = new ComposeFormBean();
28: Email email = (Email) request.getSession()
29: .getAttribute("email");
30: String to = email.getBaseHeader().getFromShown();
31: if (email.getBaseHeader().getCc() != null
32: && !email.getBaseHeader().getCc().equals("")) {
33: to += ", " + email.getBaseHeader().getCcShown();
34: }
35: if (email.getBaseHeader().getToShown() != null
36: && !email.getBaseHeader().getToShown().equals("")) {
37: to += ", " + email.getBaseHeader().getToShown();
38: }
39: bean.setTo(to);
40:
41: bean.setSubject("Re: " + email.getBaseHeader().getSubject());
42:
43: String bd = email.getBodyText();
44: bd = "\n\n\nOn " + email.getBaseHeader().getDate().toString()
45: + ", " + email.getFrom() + " wrote\n" + bd;
46: bean.setMessageBody(bd);
47:
48: request.getSession().setAttribute("ComposeFormBean", bean);
49: request.getSession().setAttribute("attachments", null);
50:
51: return mapping.findForward("success");
52: }
53: }
|