use of org.olat.core.util.mail.model.DBMailRecipient in project openolat by klemens.
the class MailController method getRecipients.
private String getRecipients() {
StringBuilder sb = new StringBuilder();
Set<String> groups = new HashSet<>();
int recipientsCounter = 0;
int groupCounter = 0;
sb.append("<ul class='list-inline'>");
for (DBMailRecipient recipient : mail.getRecipients()) {
if (recipient == null)
continue;
if (recipientsCounter >= maxRecipients && !showAllRecipients) {
sb.append("<li class='o_more'>").append(translate("recipients.more", (mail.getRecipients().size() - recipientsCounter) + "")).append("<span>");
break;
}
recipientsCounter++;
String group = recipient.getGroup();
if (StringHelper.containsNonWhitespace(group) && !groups.contains(group)) {
// recipient is the entire group
if (sb.length() > 0) {
sb.append("</ul>");
sb.append("<ul class='list-inline'>");
}
sb.append("<li class='o_group'><i class='o_icon o_icon_group o_icon-fw'> </i><span>");
sb.append(group);
sb.append("</span></li>");
groups.add(group);
groupCounter = 0;
}
if (showRecipientNames()) {
if (recipient.getRecipient() != null) {
sb.append("<li class='o_recipient'>");
if (groupCounter > 0)
sb.append(", ");
sb.append("<span>").append(getFullName(recipient)).append("</span>");
if (showMailAdresses()) {
sb.append(" <");
sb.append(UserManager.getInstance().getUserDisplayEmail(recipient.getRecipient(), getLocale()));
sb.append(">");
}
sb.append("</li>");
groupCounter++;
}
}
if (showMailAdresses()) {
if (recipient.getEmailAddress() != null) {
// recipient is not an OpenOLAT identity but an external email
sb.append("<li class='o_mail'>");
if (groupCounter > 0)
sb.append(", ");
sb.append("<");
sb.append(UserManager.getInstance().getUserDisplayEmail(recipient.getEmailAddress(), getLocale()));
sb.append("></li>");
groupCounter++;
}
}
}
sb.append("</ul>");
return sb.toString();
}
use of org.olat.core.util.mail.model.DBMailRecipient in project openolat by klemens.
the class MailController method getFrom.
private String getFrom() {
StringBuilder sb = new StringBuilder();
DBMailRecipient from = mail.getFrom();
sb.append("<ul class='list-inline'><li>");
if (from != null) {
sb.append(getFullName(from));
if (showMailAdresses()) {
Identity fromIdentity = from.getRecipient();
if (fromIdentity != null) {
sb.append(" <");
sb.append(UserManager.getInstance().getUserDisplayEmail(fromIdentity, getLocale()));
sb.append("> ");
}
}
}
sb.append("</li></ul>");
return sb.toString();
}
Aggregations