2014-08-25 15:10:51 +08:00
|
|
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
|
|
|
|
2014-09-05 06:49:03 +08:00
|
|
|
(function () {
|
2014-09-02 08:15:31 +08:00
|
|
|
|
2014-08-25 23:49:01 +08:00
|
|
|
'use strict';
|
2014-08-25 15:10:51 +08:00
|
|
|
|
|
|
|
var
|
2014-09-02 00:05:32 +08:00
|
|
|
window = require('window'),
|
2014-09-02 08:15:31 +08:00
|
|
|
|
2014-09-05 06:49:03 +08:00
|
|
|
Utils = require('Common/Utils')
|
2014-08-25 15:10:51 +08:00
|
|
|
;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @constructor
|
|
|
|
*/
|
2014-08-27 23:59:44 +08:00
|
|
|
function SettingsStorage()
|
2014-08-25 15:10:51 +08:00
|
|
|
{
|
2014-09-02 00:05:32 +08:00
|
|
|
this.oSettings = window['rainloopAppData'] || {};
|
2014-08-27 23:59:44 +08:00
|
|
|
this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
|
2014-08-25 15:10:51 +08:00
|
|
|
}
|
|
|
|
|
2014-08-27 23:59:44 +08:00
|
|
|
SettingsStorage.prototype.oSettings = null;
|
2014-08-25 15:10:51 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} sName
|
|
|
|
* @return {?}
|
|
|
|
*/
|
2014-08-27 23:59:44 +08:00
|
|
|
SettingsStorage.prototype.settingsGet = function (sName)
|
2014-08-25 15:10:51 +08:00
|
|
|
{
|
|
|
|
return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} sName
|
|
|
|
* @param {?} mValue
|
|
|
|
*/
|
2014-08-27 23:59:44 +08:00
|
|
|
SettingsStorage.prototype.settingsSet = function (sName, mValue)
|
2014-08-25 15:10:51 +08:00
|
|
|
{
|
|
|
|
this.oSettings[sName] = mValue;
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} sName
|
|
|
|
* @return {boolean}
|
|
|
|
*/
|
2014-08-27 23:59:44 +08:00
|
|
|
SettingsStorage.prototype.capa = function (sName)
|
2014-08-25 15:10:51 +08:00
|
|
|
{
|
|
|
|
var mCapa = this.settingsGet('Capa');
|
|
|
|
return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-08-27 23:59:44 +08:00
|
|
|
module.exports = new SettingsStorage();
|
2014-08-25 15:10:51 +08:00
|
|
|
|
2014-09-05 06:49:03 +08:00
|
|
|
}());
|