Zimlet JavaScript API Reference - ZmSettings

Class ZmSettings


Extends ZmModel.

This class is a collection of various sorts of settings: config values, preferences, and COS features. Each setting has an ID which can be used to retrieve it.

Defined in: ZmSettings.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
ZmSettings(noInit)
Creates a collection of settings with default values.
Method Summary
Method Attributes Method Name and Description
 
Checks if the given ID was received from the server.
 
createFromJs(list, setDefault, skipNotify, skipImplicit)
Populates settings values.
 
get(id, key)
Gets the value of the given setting.
 
Gets the setting.
 
Gets the setting that is associated with the given server-side setting, if any.
 
Initializes the settings.
 
Loads the preference data.
 
loadUserSettings(callback, errorCallback, accountName, response, batchCommand)
Retrieves the preferences, COS settings, and metadata for the current user.
 
registerSetting(id, params)
Creates a new setting and adds it to the settings.
 
save(list, callback, batchCommand, account, isImplicit)
Saves one or more settings.
 
set(id, value, key, setDefault, skipNotify, skipImplicit)
Sets the value of the given setting.
 
setReportScriptErrorsSettings(AjxExceptionClassVar, handler)
sets AjxException static attributes.
 
Sets the user settings.
 
Returns a string representation of the object.
Methods borrowed from class ZmModel:
addChangeListener, removeAllChangeListeners, removeChangeListener
Class Detail
ZmSettings(noInit)
Creates a collection of settings with default values. If no app context is given, then this is a skeletal, non-live version of settings which can provide default settings and parse SOAP settings.
Author: Conrad Damon.
Parameters:
{Boolean} noInit
if true, skip initialization
Method Detail
{Boolean} attrExists(id)
Checks if the given ID was received from the server. Use this method to determine whether this ID is supported by a ZCS server. Currently used by ZDesktop since it can "talk" to both v5 and v6 ZCS.
Parameters:
{String} id
the setting ID
Returns:
{Boolean} true if the attribute is supported

createFromJs(list, setDefault, skipNotify, skipImplicit)
Populates settings values.
Parameters:
{Hash} list
a hash of preference or attribute values
setDefault
skipNotify
skipImplicit

{Object} get(id, key)
Gets the value of the given setting.
Parameters:
{String} id
the ID of the setting
{String} key
the key
Returns:
{Object} the value or null for none

{ZmSetting} getSetting(id)
Gets the setting.
Parameters:
{String} id
the ID of the setting
Returns:
{ZmSetting} the setting

{String} getSettingByName(name)
Gets the setting that is associated with the given server-side setting, if any.
Parameters:
{String} name
the server-side setting name (for example, "zimbraFeatureContactsEnabled")
Returns:
{String} the setting id

initialize()
Initializes the settings.

loadPreferenceData(callback)
Loads the preference data.
Parameters:
{AjxCallback} callback
the callback

loadUserSettings(callback, errorCallback, accountName, response, batchCommand)
Retrieves the preferences, COS settings, and metadata for the current user. All the data gets stored into the settings collection.
Parameters:
{AjxCallback} callback
the callback to run after response is received
{AjxCallback} errorCallback
the callback to run error is received
{String} accountName
the name of account to load settings for
{Object} response
the pre-determined JSON response object
{ZmBatchCommand} batchCommand
set if part of a batch request

registerSetting(id, params)
Creates a new setting and adds it to the settings.
Parameters:
{String} id
the unique ID of the setting
{Hash} params
a hash of parameters
{String} params.name
the name of the pref or attr on the server
{constant} params.type
config, pref, or COS
{constant} params.dataType
string, int, or boolean (defaults to string)
{Object} params.defaultValue
the default value

save(list, callback, batchCommand, account, isImplicit)
Saves one or more settings.
Parameters:
{Array} list
a list of {ZmSetting} objects
{AjxCallback} callback
the callback to run after response is received
{ZmBatchCommand} batchCommand
the batch command
{ZmZimbraAccount} account
the account to save under
{boolean} isImplicit
if true, we are saving implicit settings

set(id, value, key, setDefault, skipNotify, skipImplicit)
Sets the value of the given setting.
Parameters:
{String} id
the ID of the setting
{Object} value
the new value for the setting
{String} key
optional key for use by hash table data type
{Boolean} setDefault
if true, also set the default value
{Boolean} skipNotify
if true, do not notify listeners
{Boolean} skipImplicit
if true, do not check for change to implicit pref

setReportScriptErrorsSettings(AjxExceptionClassVar, handler)
sets AjxException static attributes. This is extracted so it can be called from ZmNewwindow as well. this is since the child window gets its own AjxException variable.
Parameters:
AjxExceptionClassVar
handler

setUserSettings(params)
Sets the user settings.
Parameters:
{hash} params
{object} params.info
The GetInfoResponse object.
{string} params.accountName Optional
The name of the account.
{boolean} params.setDefault Optional
Set default value
{boolean} params.skipNotify Optional
Skip change notification
{boolean} params.skipImplicit Optional
Skip implicit changes
{boolean} params.preInit Optional
Only init base settings for startup

{String} toString()
Returns a string representation of the object.
Returns:
{String} a string representation of the object

Documentation generated by JsDoc Toolkit 2.3.0 on Tue Jun 28 2016 21:01:39 GMT-0400 (EDT)