AppliBuilder
Visual Mashup Builder

AppliBuilder User Documentation

Using Notifications

Each application can use framework support to send notification(s) to users of the application. 

Send Notification to User

You can send notification to any registered user/users of the application.

Example:

var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.sendNotification("username", "message to user", callbackFunction);

// OR
// ajaxdb.sendNotification("username", "message to user", callbackFunction, async);
// last argument is asynchronous or synchronous which is optional, default is async

function callbackFunction(params, error) {
// Notification was sent.
}

NOTE: You can pass list of username as opposed to one username.

CallbackFunction? will be passed with two arguments, the first one (params) is list of username's to whom the notification was successfully sent, the second one (error) which is Error instance if the notification failed.

Send Notification to User via email

You can send notification to any registered user/users of the application via email.

Example:

var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.sendEmailNotification("username", "message to user", callbackFunction);
...

This API is similar to sendNotification except that it sends notification to user email if user exist and is not blocked.

Customizing mail sent from application

Create file called "mailsettings.txt" using Application -> Manage Files

File format is similar to Java's Properties file. You can specify the following in it (Which overrides the default)

# Activation Mail Subject That Will be used
mail.activate.subject = ApplicationName Account Activation

# Activation Mail Message, ${user}, ${activationURL} will be replaced with appropriate values at runtime.
mail.activate.message = Hi ${user}, \n You can activate the application using the link: ${activateURL}

# Message format of mail, text or html, THIS WILL BE USED FOR ACTIVATION MAIL (MAIL SENT DURING REGISTRATION)
mail.activate.msgformat = text

# Message format of mail, text or html, THIS WILL BE USED WHEN NOTIFICATION IS SENT FROM APPLICATION
mail.message.format = text

Getting Notifications of User

You can get all the notifications associated with the user for the given application.

Example:

var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.getNotification("username", callbackFunction);

// OR
// ajaxdb.getNotification("username", callbackFunction, async);
// last argument is asynchronous or synchronous which is optional, default is async

function callbackFunction(notifications) {
// notifications is list of notification information instance

ajaxdb.renderNotification(notifications, document.body); // Utility function to display notification informations.
}

NotificationInfo?

The callback function of getNotification function will be passed on with list of NotificationInfo? instances.

Deleting Notification

You can delete the notification by its id.

Example:

var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.deleteNotification(notificationid, callbackFunction);

// OR
// ajaxdb.deleteNotification(notificationid, callbackFunction, async);
// last argument is asynchronous or synchronous which is optional, default is async

function callbackFunction(params, error) {
// Notification was deleted
}

You can delete list of notifications by its id.

CallbackFunction? will be passed with two arguments, the first one (params) is list of notification id's which were deleted, the second one (error) which is Error instance if the notification failed.

Example:

var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.deleteNotification([notificationid1, notificationid2...], callbackFunction);

Marking Notification

You can mark the notification with various flags/status. The function are supported by the NotificationInfo? instance.

Mark Flags used to identify the status of the Notification.

Example:

notificationInfo.markAsRead(callbackFunction); // Will mark the notification instance as read.
function callbackFunction() {
// Notification was marked as read
}

You can also set the status by using the notification id.

Example:

var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.markNotification(notificationid, "R", callbackFunction);

// OR
// ajaxdb.markNotification(notificationid, "R", callbackFunction, async);
// last argument is asynchronous or synchronous which is optional, default is async

function callbackFunction() {
// Notification was marked as read
}

You can mark set of notifications by its id.

CallbackFunction? will be passed with two arguments, the first one (params) is list of notification id's which were marked, the second one (error) which is Error instance if the notification failed.

Example:

var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.markNotification([notificationid1, notificationid2...], "R", callbackFunction);

Getting Notification based on Status

You can get the notification for the user with respect to the application along with status (mark flag) as shown below.

mark flag can be any one of ("R", "U", "I", "T") as described above.

Example:

var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.getNotificationByStatus(username, markFlag, callbackFunction, async);

// OR
// ajaxdb.getNotificationByStatus(username, markFlag, callbackFunction, async);

function callbackFunction(notifications, error) {
// notifications is the list of NotificationInfo instance
}




© 2006 Applibase, Inc.