Skip to content
Snippets Groups Projects
Commit 96557f28 authored by S.Listl's avatar S.Listl
Browse files

libs documentation

parent 6df79b25
No related branches found
No related tags found
No related merge requests found
......@@ -143,7 +143,11 @@ BulkMailUtils.sendBulkMail = function (pBulkMailId, pTestRecipients)
};
}
/**
* opens a context to select a bulk mail to add recipients to
*
* @param {String[]} pContactIds recipients that should be added
*/
BulkMailUtils.openAddRecipientView = function (pContactIds)
{
var params = {
......@@ -216,6 +220,13 @@ BulkMailUtils.getBulkMailTemplate = function (pBulkMailId, pDocumentTemplateId)
return template;
}
/**
* checks if a contact is a recipient of a bulk mail
*
* @param {String} pBulkMailId bulkmail id
* @param {String} pContactId contact id
* @return {boolean} true, if the contact is a recipient
*/
BulkMailUtils.isRecipient = function (pBulkMailId, pContactId)
{
return db.cell(SqlCondition.begin()
......@@ -225,6 +236,11 @@ BulkMailUtils.isRecipient = function (pBulkMailId, pContactId)
) != "0";
}
/**
* opens the BulkMail context in new mode
*
* @param {String[]} [pRecipients] recipients that should be added after creation
*/
BulkMailUtils.newBulkMail = function (pRecipients)
{
var params = {
......@@ -233,6 +249,14 @@ BulkMailUtils.newBulkMail = function (pRecipients)
neon.openContext("BulkMail", "BulkMailEdit_view", null, neon.OPERATINGSTATE_NEW, params);
}
/**
* Filters the given contactIds if they can be added as new recipients.
* Checks if a contact is already a recipient or if there is a advertising ban.
*
* @param {String} pBulkMailId id of the bulk mail the contacts should be added to
* @param {String[]} pContactIds contacts to filter
* @return {String[]} contacts that can be added as recipients
*/
BulkMailUtils.filterNewRecipients = function (pBulkMailId, pContactIds)
{
var existsQuery = "not exists(select BULKMAILRECIPIENTID from BULKMAILRECIPIENT where BULKMAILRECIPIENT.CONTACT_ID = CONTACT.CONTACTID and # = ?)";
......@@ -245,6 +269,9 @@ BulkMailUtils.filterNewRecipients = function (pBulkMailId, pContactIds)
return db.array(db.COLUMN, query);
}
/**
* opens the given bulk mail
*/
BulkMailUtils.openBulkMail = function (pBulkMailId)
{
neon.openContext("BulkMail", "BulkMailMain_view", [pBulkMailId], neon.OPERATINGSTATE_VIEW, null);
......@@ -273,7 +300,11 @@ SerialLetterUtils.addRecipients = function (pSerialLetterId, pContactIds)
db.inserts(inserts);
}
/**
* opens a context to select a serial letter to add recipients to
*
* @param {String[]} pContactIds recipients that should be added
*/
SerialLetterUtils.openAddRecipientView = function (pContactIds)
{
var params = {
......@@ -297,6 +328,13 @@ SerialLetterUtils.buildSerialLetter = function (pSerialLetterId, pRecipientIds)
});
}
/**
* checks if a contact is a recipient of a serial letter
*
* @param {String} pSerialLetterId serial letter id
* @param {String} pContactId contact id
* @return {boolean} true, if the contact is a recipient
*/
SerialLetterUtils.isRecipient = function (pSerialLetterId, pContactId)
{
return db.cell(SqlCondition.begin()
......
......@@ -29,6 +29,13 @@ import("Email_lib");
var DocumentTemplate = (function ()
{
/**
* constructor for DocumentTemplate
*
* @param {String} pTemplateContent content, as base64 string (except for DocumentTemplate.types.PLAIN, then it's a normal string)
* @param {String} pType type of the template, use the DocumentTemplate.types constants here
* @param {String} [pFilename] file name of the template
*/
function DocumentTemplate (pTemplateContent, pType, pFilename)
{
this.content = pTemplateContent;
......@@ -36,6 +43,9 @@ function DocumentTemplate (pTemplateContent, pType, pFilename)
this.filename = pFilename;
}
/**
* @return {String} the text of the content
*/
DocumentTemplate.prototype.toString = function ()
{
if (this.type == DocumentTemplate.types.PLAIN)
......@@ -265,7 +275,7 @@ DocumentTemplate.prototype.getReplacedEmailsByContactIds = function (pContactIds
}
/**
* Provides functions for the DocumentTemplate object.
* Provides functions for the DocumentTemplate object that aren't accessible from outside
*/
function TemplateHelper () {}
/**
......@@ -505,6 +515,11 @@ TemplateHelper._getReplacedDOCX = function (pTemplate, pReplacements)
*/
function LetterUtils () {}
/**
* opens a new letter
*
* @param {String} pContactId id of the contact to fetch the data from
*/
LetterUtils.openNewLetter = function (pContactId)
{
var params = {
......
......@@ -20,7 +20,6 @@ function EmailWritingUtils () {}
* @param {String} pSenderContactId contactId of the sender. the standard mailadress of the contact is used as sender-address
* @param {String} [pTemplateId] if a document-template shall be used, give the templateId here
* @param {String} [pRecipientContactId] contactId of the recipient, required to fill placeholders
*
* @return {Array} the eml document as array with [filename, base64]
*/
EmailWritingUtils.openMailTemplate = function (pToRecipients, pSenderContactId, pTemplateId, pRecipientContactId)
......@@ -59,7 +58,6 @@ EmailWritingUtils.openNewMail = function (pToContactId, pToEmailAddress)
* @param {String} [pBody=null] mail body
* @param {Array} [pCcRecipients=[]] array of recipient cc addresses
* @param {Array} [pBccRecipients=[]] array of recipient bcc addresses
*
* @class
*/
function Email (pToRecipients, pSender, pSubject, pBody, pCcRecipients, pBccRecipients)
......@@ -76,7 +74,10 @@ function Email (pToRecipients, pSender, pSubject, pBody, pCcRecipients, pBccReci
}
/**
* makes an Email object from a RFC mail (base64 encoded)
* makes an Email object from a RFC
*
* @param {String} pBase64RFC the RFC mail, base64 encoded
* @return {Email} a new Email object
*/
Email.fromRFC = function (pBase64RFC)
{
......@@ -186,7 +187,6 @@ Email.prototype.getRFCmail = function ()
//X-Uniform-Type-Identifier: com.apple.mail-draft
//this could be added later if needed
var mailObj = mail.getCachedMail(mailId);
return mail.toRFC(mailObj);
}
......@@ -201,6 +201,8 @@ Email.prototype.openMail = function ()
/**
* ask for a download of the email
*
* @return {Array} array of [filename, EML (base64)]
*/
Email.prototype.downloadEML = function ()
{
......@@ -211,7 +213,7 @@ Email.prototype.downloadEML = function ()
}
/**
* returns a eml as (base64 encoded)
* @return {String} RFC mail (base64 encoded)
*/
Email.prototype.getEML = function()
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment