Update of
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher
In directory james.mmbase.org:/tmp/cvs-serv16731/publisher
Modified Files:
NewsletterPublisher.java
Added Files:
OnlyText.java
Log Message:
CMSC-1146 Newsletter: add functionality to freeze and defrost a newsletter
edition remove the html-escaped of the static_html filed
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher
See also: http://www.mmbase.org/jira/browse/CMSC-1146
OnlyText.java is new
Index: NewsletterPublisher.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Portlets/portlets-newsletter/src/java/com/finalist/newsletter/publisher/NewsletterPublisher.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -b -r1.45 -r1.46
--- NewsletterPublisher.java 1 Dec 2008 16:24:58 -0000 1.45
+++ NewsletterPublisher.java 3 Dec 2008 09:00:31 -0000 1.46
@@ -26,7 +26,6 @@
import net.sf.mmapps.modules.cloudprovider.CloudProviderFactory;
-import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.mmbase.bridge.Cloud;
import org.mmbase.bridge.Node;
@@ -68,17 +67,24 @@
// if needed to prompt user this validate will be remove to Action
String originalBody = "";
String status =
newsletterEditionNode.getStringValue("process_status");
- String static_html =
newsletterEditionNode.getStringValue("static_html");
- static_html = StringEscapeUtils.unescapeHtml(static_html);
+ String static_html = null;
+ if (newsletterEditionNode.getValueWithoutProcess("static_html") !=
null)
+ static_html =
(String)newsletterEditionNode.getValueWithoutProcess("static_html");
if (EditionStatus.INITIAL.value().equals(status) &&
StringUtils.isEmpty(static_html)) {
originalBody = getBody(publication, subscription);
}
else {
+ if("text/plain".equals(subscription.getMimeType())){
+ OnlyText onlyText = new OnlyText();
+ originalBody = onlyText.html2Text(static_html);
+ }
+ else {
originalBody = static_html;
}
+ }
+
- //NewsletterService service = (NewsletterService)
ApplicationContextFactory.getBean("newsletterServices");
// Newsletter newsletter =
service.getNewsletterBySubscription(subscription.getId());
Newsletter newsletter = publication.getNewsletter();
String replyAddress = newsletter.getReplyAddress();
@@ -124,9 +130,9 @@
private void setBody(Publication publication, Subscription subscription,
Multipart multipart,String originalBody) {
MimeBodyPart mdp = new MimeBodyPart();
try {
- String type = subscription.getMimeType();
- log.debug("the content using type " + type + " will be send as: " +
originalBody + "\n");
- mdp.setContent(originalBody, type);
+ String type=subscription.getMimeType();
+ mdp.setContent(originalBody, type+";charset=utf-8");
+ mdp.addHeader("Content-Transfer-Encoding", "quoted-printable");
multipart.addBodyPart(mdp);
}
catch (MessagingException e) {
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs