Consolidated email
The consolidated email (consolidated_email template, @{notificationType} = CONSOLIDATED_EMAIL) groups several notifications of a recipient in a single email. Its template receives all the common variables, and the content of the email in @{vars}.
The server provides:
- flat lists, one per type of notification;
- pre-grouped lists, already grouped and sorted as the base theme displays them;
- the
liststool, to group, sort and truncate the elements differently.
Existing themes that use the flat lists keep working.
Top-level variables
| Variable | Description |
|---|---|
vars.username | User name of the recipient. |
vars.userfullname | Full name of the recipient. |
vars.domainname | Domain of the recipient. |
vars.login_url | Login link of the recipient. |
vars.imagesurl | Base URL of the web interface, used to load images. |
vars.theme | Web interface theme of the recipient. |
vars.solutionName | Name of the solution, same as @{solutionName}. |
vars.supportEmail | Support email address, same as @{supportEmail}. |
Flat lists
Each list contains the elements of one type of notification. A list without elements is empty.
| List | Elements | Notification |
|---|---|---|
vars.filesAvailable | File available | Files available in an inbox and in a community, together. This list is a sorted set (by sender full name, then file name). |
vars.filesAvailableNode | File available | file_available |
vars.filesAvailableCommunity | File available | file_available_comm |
vars.receptionsAcknowledged | File downloaded | reception_acknowledge |
vars.filesDeleted | File deleted | file_deleted |
vars.filesWillBeDeleted | File will be deleted | file_will_be_deleted |
vars.communitiesDeleted | Community deleted | community_deleted |
vars.communitiesWillBeDeleted | Community will be deleted | community_will_be_deleted |
vars.usersAddedToShare | Invitation to a share space | user_share |
vars.directAccessTokensAvailable | Direct access available | direct_access_available |
vars.accountsWillBeInactive | Account will be locked or deleted | account_will_be_inactive |
vars.accountsWillBeDeleted | Account will be locked or deleted | account_will_be_deleted |
@foreach{item : vars.filesDeleted}
@{item.filename}<br/>
@end{}Fields of the elements
The fields of each element (item.*) have the same meaning as the variables of the corresponding notification. See Variables by notification. A field that does not apply to an element is null, and MVEL would write it as null: test it with @if{item.field != empty} before displaying it. A list is tested the same way, for example @if{vars.filesDeleted != empty}. The fields that correspond to variables that carry the Version flag required badge in Variables by notification are empty until the Version 4.21 version flag is enabled.
The tables below list every field of each element.
File available
| Field | Description |
|---|---|
filename | Name of the file. |
sendername, sendershortname, senderfullname | Sender of the file. |
messagetorecipients | Message of the sender. |
sendermailaddress | Always empty for this notification. |
url, download_url, file_url | Links to the file. Empty when the recipient is a direct access. |
community, communitydescription | Name and description of the community (vars.filesAvailableCommunity and community files of vars.filesAvailable). |
type | node (inbox) or community. |
filePath, fileAbsolutePath, fileFullPath | Path of the file. |
fileSize | Size of the file. |
uploadInstant, formattedUploadDate | Upload date of the file. |
File downloaded
| Field | Description |
|---|---|
filename | Name of the file. |
recipient | Person who downloaded the file. |
recipientfullname | Name of the person who downloaded the file. |
community | Name of the community, if the file was sent to a community. |
url, download_url, file_url | Links to the file. |
fileRecipientType, fileRecipientName | Where the file had been sent. |
fileAbsolutePath, fileFullPath | Path of the file. |
filePath | Always empty: this notification does not provide it. |
downloadInstant, formattedDownloadDate | Download date of the file. |
File deleted
| Field | Description |
|---|---|
filename | Name of the file or directory. |
sendername, sendershortname, senderfullname | Sender of the file. |
sendermailaddress | Always empty for this notification. |
recipient | Recipient of the file. |
reason | Reason of the deletion. |
fileRecipientType, fileRecipientName | Where the file had been sent. |
filePath, fileAbsolutePath, fileFullPath | Path of the file or directory. |
fileType | FILE or FOLDER. |
numberOfFiles | Number of files deleted. |
deletionInstant, formattedDeletionDate | Deletion date. |
deletedBy | Full name of the person who deleted the file; an empty text when the file was deleted automatically. |
genericReason | true when reason only says that a community member or administrator deleted the file; false otherwise. |
File will be deleted
| Field | Description |
|---|---|
filename | Name of the file. |
expire | Number of days before the deletion. |
reason | Reason of the deletion. |
fileRecipientType, fileRecipientName | Where the file had been sent. |
filePath, fileAbsolutePath, fileFullPath | Path of the file. |
expirationInstant, formattedExpirationDate | Deletion date of the file. |
lastActivityInstant, formattedLastActivityDate | Date of the last access to the file. |
lastActivityDateAvailable in4.20.0 + | Deprecated. Same date in UTC. |
Community deleted
| Field | Description |
|---|---|
community | Name of the community. |
reason | Reason of the deletion. |
lastActivityInstant, formattedLastActivityDate | Last activity date of the community. |
lastActivityDateAvailable in4.20.0 + | Deprecated. Same date in UTC. |
numberOfFiles | Number of files deleted with the community. |
deletionInstant, formattedDeletionDate | Deletion date of the community. |
deletedBy | Name of the person who deleted the community; an empty text when the community was deleted automatically. |
genericReason | true when reason only says that deletedBy deleted the community; false otherwise. |
Community will be deleted
| Field | Description |
|---|---|
community | Name of the community. |
expire | Number of days before the deletion. |
reason | Reason of the deletion. |
lastActivityDateAvailable in4.20.0 + | Deprecated. Last activity date in UTC. |
lastActivityInstant, formattedLastActivityDate | Last activity date of the community. |
expirationInstant, formattedExpirationDate | Deletion date of the community. |
numberOfFiles | Number of files in the community. |
Invitation to a share space
| Field | Description |
|---|---|
inviter | Full name of the person who sent the invitation. |
community, communitydescription | Name and description of the share space. |
messagetorecipients | Message of the inviter. |
url | Login link of the recipient. |
password | Always empty: this notification does not provide it. |
Direct access available
| Field | Description |
|---|---|
directAccessCode | Code of the direct access token. |
sendername, sendershortname, senderfullname | Person who created the token. |
sendermailaddress | Email address of the person who created the token. |
messagetorecipients | Message of the person who created the token. |
community | Name of the share space that the token opens, if any. |
Account will be locked or deleted
| Field | Description |
|---|---|
expire | Number of days before the account is locked or deleted. |
reason | Reason: ADOPTION, EXPIRATION or INACTIVITY (same values as cleanupReason). |
expirationInstant, formattedExpirationDate | Date on which the account will be locked or deleted. |
lastActivityInstant, formattedLastActivityDate | Date of the last session of the account. |
lastActivityDateAvailable in4.20.0 + | Deprecated. Same date in UTC. |
adoptionInstant, formattedAdoptionDate | Adoption date of the account. |
accountEndInstant, formattedAccountEndDate | End date of the account. |
Pre-grouped lists
The template does not need to group, sort or truncate the elements itself: the server provides the lists already grouped and sorted as the base theme displays them.
New files: vars.filesAvailableListing
vars.filesAvailableListing gives the new files on three levels:
communities: one entry per community, sorted by name, withcommunity(the name),total(the number of files) andsenders;inbox: the senders of the files sent directly to the recipient's inbox, andinboxTotal, the number of these files;- a sender has
name,totalanduploads(its uploads, from the most recent to the oldest); - an upload has
message(the message of the sender, empty if there is none) andfiles. Each file hasfile(the file, withfilename,uploadInstant,fileSize,url…) andpath(its directory,/at the root). The files at the root come first, then those of each directory, sorted by name.
upload.head(n) gives the first n files of an upload (items) and the number of files left out (remaining).
@foreach{community : vars.filesAvailableListing.communities}
<h3>@{community.community} (@{community.total})</h3>
@foreach{sender : community.senders}
@foreach{upload : sender.uploads}
@code{shown = upload.head(3);}
@foreach{entry : shown.items}@{entry.path}@{entry.file.filename}<br/>@end{}
@if{shown.remaining > 0}and @{shown.remaining} more<br/>@end{}
@end{}
@end{}
@end{}Files by destination
vars.filesWillBeDeletedGroups, vars.receptionsAcknowledgedGroups and vars.filesDeletedGroups group the files according to where they had been sent: the communities first, then the recipient's inbox, the other users and the email addresses, each sorted by name.
- A group has
type(community,inbox,useroranonymous),nameanditems. - Each element of
itemshasitem(the file) andpath(its path in the community or the inbox).
The lists tool
The lists tool is available in all email templates, like dateFormatter. It is mainly used in the consolidated email:
lists.groupBy(list, key): the groups of elements that share a key, in the order of their first element. Each group haskey,itemsandhead(n).lists.sortBy(list, key)andlists.sortByDescending(list, key): the list sorted by the key, in ascending or descending order (most recent dates first). Texts are compared without regard to case, elements without a key come last, and elements with the same key keep their order.lists.head(list, n): the firstnelements (items) and the number of elements left out (remaining).
These tools accept lists and sets (vars.filesAvailable is a sorted set). The key can be written in two ways:
- an MVEL expression in quotes, evaluated on each element:
'senderfullname', or"community == null ? 'Inbox' : community"; - an MVEL function of the element:
def (file) { file.senderfullname }. A function only sees its parameter, not the other template variables. In a template, it does not accept the? :operator: useifandreturn, or an expression.
Examples
<!-- The 5 most recent files, and how many others -->
@code{recents = lists.head(lists.sortByDescending(vars.filesAvailable, 'uploadInstant'), 5);}
@foreach{file : recents.items}
@{file.fileFullPath} — @{file.formattedUploadDate}<br/>
@end{}
@if{recents.remaining > 0}and @{recents.remaining} more files@end{}
<!-- New files grouped by sender instead of by community, 3 files per sender -->
@foreach{group : lists.groupBy(lists.sortBy(vars.filesAvailable, 'senderfullname'), 'senderfullname')}
<h3>@{group.key} (@{group.items.size()})</h3>
@code{shown = group.head(3);}
@foreach{file : shown.items}@{file.fileFullPath}<br/>@end{}
@if{shown.remaining > 0}and @{shown.remaining} more@end{}
@end{}
<!-- A key computed by an expression -->
@foreach{group : lists.groupBy(vars.filesAvailable, "community == null ? 'Inbox' : community")}
@{group.key}: @{group.items.size()} files<br/>
@end{}
<!-- A key computed by a function -->
@foreach{group : lists.groupBy(vars.filesDeleted, def (file) { if (file.fileType == 'FOLDER') { return 'Directories'; } return 'Files'; })}
@{group.key}: @{group.items.size()}<br/>
@end{}
<!-- Communities that will soon be deleted, the closest to deletion first -->
@foreach{item : lists.sortBy(vars.communitiesWillBeDeleted, 'expirationInstant')}
@{item.community}: @{item.formattedExpirationDate}<br/>
@end{}