1 31 32 package org.opencms.notification; 33 34 import org.opencms.file.CmsObject; 35 import org.opencms.file.CmsUser; 36 import org.opencms.report.I_CmsReport; 37 38 import java.util.Iterator ; 39 import java.util.List ; 40 41 51 public class CmsPublishNotification extends A_CmsNotification { 52 53 54 public static final String NOTIFICATION_CONTENT = "/system/workplace/admin/notification/publish-notification"; 55 56 57 private I_CmsReport m_report; 58 59 66 public CmsPublishNotification(CmsObject cms, CmsUser receiver, I_CmsReport report) { 67 68 super(cms, receiver); 69 m_report = report; 70 } 71 72 75 protected String generateHtmlMsg() { 76 77 StringBuffer buffer = new StringBuffer (); 78 79 if (m_report.hasWarning()) { 81 buffer.append("<b>"); 82 buffer.append(Messages.get().getBundle().key(Messages.GUI_PUBLISH_WARNING_HEADER_0)); 83 buffer.append("</b><br/>\n"); 84 appendList(buffer, m_report.getWarnings()); 85 buffer.append("<br/>\n"); 86 } 87 88 if (m_report.hasError()) { 90 buffer.append("<b>"); 91 buffer.append(Messages.get().getBundle().key(Messages.GUI_PUBLISH_ERROR_HEADER_0)); 92 buffer.append("</b><br/>\n"); 93 appendList(buffer, m_report.getErrors()); 94 buffer.append("<br/>\n"); 95 } 96 97 return buffer.toString(); 98 } 99 100 103 protected String getNotificationContent() { 104 105 return NOTIFICATION_CONTENT; 106 } 107 108 114 private void appendList(StringBuffer buffer, List list) { 115 116 Iterator iter = list.iterator(); 117 while (iter.hasNext()) { 118 String entry = (String )iter.next(); 119 buffer.append(entry + "<br/>\n"); 120 } 121 } 122 123 } 124 | Popular Tags |