| AppliBuilder
User Documentation |
AppliBuilder Framework supports managing user settings for the
application.
For example, A Wiki application can allow each user to set the value for a key "notifyOnPageChange" to either true/false.
Depending on this value the notification will be sent to the user on page change.
AppliBuilder Framework currently supports managing this basic user setting model.
The format is similar to Java's property file format, while parsing the comment field will be considered as the description field.
Example:
# Send Notification if Page Changes
notifyOnPageChange = false
This will be parsed as the following setting
description = Send Notification if Page Changes
key = notifyOnPageChange
value = false
NOTE:
var ajaxdb = new Applibase.db.AjaxDb();Where:
ajaxdb.saveSetting(key, value, description, callbackFunction, async);
key -- Setting key
value -- Setting value
description -- Description for the key (if not null will overwrite the previous value)
callbackFunction -- Function to be called back after the setting is saved.
async -- true if operation should be synchronous, false for asynchronous case (default) [OPTIONAL]
This setting will be saved using the logged in username for the application.
Example:
var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.saveSetting("notifyOnPageChange", "true", "Notify User On Page Change", callbackFunction);
function callbackFunction(settingid, error) {
if(error != null) { alert("Error happend while saving the setting: " +error.message); }
else { alert("Setting saved its id is: " + settingid); }
}
var ajaxdb = new Applibase.db.AjaxDb();Where:
ajaxdb.getSettings(username, callbackFunction, async);
username -- Name of the user whose settings are to be obtained.
callbackFunction -- Function to be called back after the setting is saved.
async -- true if operation should be synchronous, false for asynchronous case (default) [OPTIONAL]
Example:
var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.getSettings("username", callbackFunction);
function callbackFunction(settings, error) {
if(error != null) { alert("Error happend while saving the setting: " +error.message); }
else { ajaxdb.renderSettings(settings, document.body); } // Helper function to render the settings information as table
}
You can also get the settings value from the LoginInfo as shown below.
var ajaxdb = new Applibase.db.AjaxDb();
var loginInfo = ajaxdb.checkLogin();
var settings = null;
try {
settings = loginInfo.settings();
} catch(error) {
alert("Error getting Settings: " +error.message);
}
Here settings is list of Applibase.db.UserSettingsInfo instance.
var ajaxdb = new Applibase.db.AjaxDb();
ajaxdb.getSettingByKey(username, settingkey, callbackFunction);
function callbackFunction(settingInfo, error) {
// Use settingInfo instance if error is null.
}
var ajaxdb = new Applibase.db.AjaxDb();
var loginInfo = ajaxdb.checkLogin();
var settingInfo = loginInfo.settingInfo(settingkey);
| ©
2006 Applibase, Inc. |