Code refactoring (Translator, Stores, ko)

This commit is contained in:
RainLoop Team 2015-01-26 03:09:22 +04:00
parent 929bffccef
commit b42ce01e7e
102 changed files with 6775 additions and 6511 deletions

View file

@ -12,6 +12,7 @@
Utils = require('Common/Utils'),
Links = require('Common/Links'),
Events = require('Common/Events'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
@ -248,9 +249,7 @@
ko.components.register('Checkbox', require('Component/Checkbox'));
}
Utils.initOnStartOrLangChange(function () {
Utils.initNotificationLanguage();
}, null);
Translator.initOnStartOrLangChange(Translator.initNotificationLanguage, Translator);
_.delay(Utils.windowResizeCallback, 1000);

View file

@ -12,6 +12,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Links = require('Common/Links'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data'),
@ -215,14 +216,14 @@
Enums.Notification.LicensingExpired
]))
{
Data.licenseError(Utils.getNotification(Utils.pInt(oData.ErrorCode)));
Data.licenseError(Translator.getNotification(Utils.pInt(oData.ErrorCode)));
Data.licensing(true);
}
else
{
if (Enums.StorageResultType.Abort === sResult)
{
Data.licenseError(Utils.getNotification(Enums.Notification.LicensingServerIsUnavailable));
Data.licenseError(Translator.getNotification(Enums.Notification.LicensingServerIsUnavailable));
Data.licensing(true);
}
else

View file

@ -17,9 +17,13 @@
Utils = require('Common/Utils'),
Links = require('Common/Links'),
Events = require('Common/Events'),
Translator = require('Common/Translator'),
kn = require('Knoin/Knoin'),
SocialStore = require('Stores/Social'),
UserSettingsStore = require('Stores/UserSettings'),
Local = require('Storage/Local'),
Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'),
@ -154,7 +158,7 @@
{
var
self = this,
iOffset = (Data.messageListPage() - 1) * Data.messagesPerPage()
iOffset = (Data.messageListPage() - 1) * UserSettingsStore.messagesPerPage()
;
if (Utils.isUnd(bDropCurrenFolderCache) ? false : !!bDropCurrenFolderCache)
@ -187,16 +191,16 @@
Data.messageList([]);
Data.messageListLoading(false);
Data.messageListError(oData && oData.ErrorCode ?
Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST')
Translator.getNotification(oData.ErrorCode) : Translator.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST')
);
}
}, Data.currentFolderFullNameRaw(), iOffset, Data.messagesPerPage(), Data.messageListSearch());
}, Data.currentFolderFullNameRaw(), iOffset, UserSettingsStore.messagesPerPage(), Data.messageListSearch());
};
AppUser.prototype.recacheInboxMessageList = function ()
{
Remote.messageList(Utils.emptyFunction, Cache.getFolderInboxName(), 0, Data.messagesPerPage(), '', true);
Remote.messageList(Utils.emptyFunction, Cache.getFolderInboxName(), 0, UserSettingsStore.messagesPerPage(), '', true);
};
AppUser.prototype.reloadMessageListHelper = function (bEmptyList)
@ -302,7 +306,7 @@
if (oData && -1 < Utils.inArray(oData.ErrorCode,
[Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage]))
{
window.alert(Utils.getNotification(oData.ErrorCode));
window.alert(Translator.getNotification(oData.ErrorCode));
}
}
@ -372,7 +376,7 @@
else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType &&
(sFromFolderFullNameRaw === Data.spamFolder() || sFromFolderFullNameRaw === Data.trashFolder())))
{
kn.showScreenPopup(require('View/Popup/Ask'), [Utils.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () {
kn.showScreenPopup(require('View/Popup/Ask'), [Translator.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), function () {
self.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
Data.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove);
@ -581,8 +585,8 @@
Utils.isArray(oData.Result) && 1 < oData.Result.length &&
Utils.isPosNumeric(oData.Result[0], true) && Utils.isPosNumeric(oData.Result[1], true))
{
Data.userQuota(Utils.pInt(oData.Result[1]) * 1024);
Data.userUsageSize(Utils.pInt(oData.Result[0]) * 1024);
require('Stores/Quota').populateData(
Utils.pInt(oData.Result[1]), Utils.pInt(oData.Result[0]));
}
});
};
@ -822,53 +826,49 @@
*/
AppUser.prototype.socialUsers = function (bFireAllActions)
{
if (bFireAllActions)
if (true === bFireAllActions)
{
Data.googleActions(true);
Data.facebookActions(true);
Data.twitterActions(true);
SocialStore.google.loading(true);
SocialStore.facebook.loading(true);
SocialStore.twitter.loading(true);
}
Remote.socialUsers(function (sResult, oData) {
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
Data.googleUserName(oData.Result['Google'] || '');
Data.facebookUserName(oData.Result['Facebook'] || '');
Data.twitterUserName(oData.Result['Twitter'] || '');
SocialStore.google.userName(oData.Result['Google'] || '');
SocialStore.facebook.userName(oData.Result['Facebook'] || '');
SocialStore.twitter.userName(oData.Result['Twitter'] || '');
}
else
{
Data.googleUserName('');
Data.facebookUserName('');
Data.twitterUserName('');
SocialStore.google.userName('');
SocialStore.facebook.userName('');
SocialStore.twitter.userName('');
}
Data.googleLoggined('' !== Data.googleUserName());
Data.facebookLoggined('' !== Data.facebookUserName());
Data.twitterLoggined('' !== Data.twitterUserName());
Data.googleActions(false);
Data.facebookActions(false);
Data.twitterActions(false);
SocialStore.google.loading(false);
SocialStore.facebook.loading(false);
SocialStore.twitter.loading(false);
});
};
AppUser.prototype.googleDisconnect = function ()
{
Data.googleActions(true);
SocialStore.google.loading(true);
Remote.googleDisconnect(this.socialUsers);
};
AppUser.prototype.facebookDisconnect = function ()
{
Data.facebookActions(true);
SocialStore.facebook.loading(true);
Remote.facebookDisconnect(this.socialUsers);
};
AppUser.prototype.twitterDisconnect = function ()
{
Data.twitterActions(true);
SocialStore.twitter.loading(true);
Remote.twitterDisconnect(this.socialUsers);
};
@ -999,7 +999,7 @@
Data.messageListCount(iCount);
Data.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
Data.messageListPage(window.Math.ceil((iOffset / Data.messagesPerPage()) + 1));
Data.messageListPage(window.Math.ceil((iOffset / UserSettingsStore.messagesPerPage()) + 1));
Data.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
Data.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
Data.messageListEndPage(Data.messageListPage());
@ -1023,7 +1023,7 @@
{
Data.messageListCount(0);
Data.messageList([]);
Data.messageListError(Utils.getNotification(
Data.messageListError(Translator.getNotification(
oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantGetMessageList
));
}
@ -1408,7 +1408,7 @@
if (!!Settings.settingsGet('Auth'))
{
this.setTitle(Utils.i18n('TITLES/LOADING'));
this.setTitle(Translator.i18n('TITLES/LOADING'));
//require.ensure([], function() { // require code splitting
@ -1574,7 +1574,7 @@
if (bGoogle)
{
window['rl_' + sJsHash + '_google_service'] = function () {
Data.googleActions(true);
SocialStore.google.loading(true);
self.socialUsers();
};
}
@ -1582,7 +1582,7 @@
if (bFacebook)
{
window['rl_' + sJsHash + '_facebook_service'] = function () {
Data.facebookActions(true);
SocialStore.facebook.loading(true);
self.socialUsers();
};
}
@ -1590,7 +1590,7 @@
if (bTwitter)
{
window['rl_' + sJsHash + '_twitter_service'] = function () {
Data.twitterActions(true);
SocialStore.twitter.loading(true);
self.socialUsers();
};
}

View file

@ -208,7 +208,7 @@
/**
* @enum {number}
*/
Enums.DesktopNotifications = {
Enums.DesktopNotification = {
'Allowed': 0,
'NotAllowed': 1,
'Denied': 2,

View file

@ -40,11 +40,6 @@
*/
Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
/**
* @type {?}
*/
Globals.langChangeTrigger = ko.observable(true);
/**
* @type {boolean}
*/
@ -189,10 +184,6 @@
});
}
Globals.oI18N = window['rainloopI18N'] || {};
Globals.oNotificationI18N = {};
Globals.aBootstrapDropdowns = [];
Globals.aViewModels = {

View file

@ -4,6 +4,7 @@
'use strict';
var
window = require('window'),
Utils = require('Common/Utils')
;
@ -326,7 +327,7 @@
sPrefix = '';
}
return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png';
return sPrefix + 'themes/' + window.encodeURI(sTheme) + '/images/preview.png';
};
/**

306
dev/Common/Translator.js Normal file
View file

@ -0,0 +1,306 @@
(function () {
'use strict';
var
window = require('window'),
$ = require('$'),
_ = require('_'),
ko = require('ko'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals')
;
/**
* @constructor
*/
function Translator()
{
this.data = window['rainloopI18N'] || {};
this.notificationI18N = {};
this.trigger = ko.observable(false);
this.i18n = _.bind(this.i18n, this);
}
Translator.prototype.data = {};
Translator.prototype.notificationI18N = {};
/**
* @param {string} sKey
* @param {Object=} oValueList
* @param {string=} sDefaulValue
* @return {string}
*/
Translator.prototype.i18n = function (sKey, oValueList, sDefaulValue)
{
var
sValueName = '',
sResult = _.isUndefined(this.data[sKey]) ? (_.isUndefined(sDefaulValue) ? sKey : sDefaulValue) : this.data[sKey]
;
if (!_.isUndefined(oValueList) && !_.isNull(oValueList))
{
for (sValueName in oValueList)
{
if (_.has(oValueList, sValueName))
{
sResult = sResult.replace('%' + sValueName + '%', oValueList[sValueName]);
}
}
}
return sResult;
};
/**
* @param {Object} oElement
* @param {boolean=} bAnimate = false
*/
Translator.prototype.i18nToNode = function (oElement, bAnimate)
{
var self = this;
_.defer(function () {
$('.i18n', oElement).each(function () {
var
jqThis = $(this),
sKey = ''
;
sKey = jqThis.data('i18n-text');
if (sKey)
{
jqThis.text(self.i18n(sKey));
}
else
{
sKey = jqThis.data('i18n-html');
if (sKey)
{
jqThis.html(self.i18n(sKey));
}
sKey = jqThis.data('i18n-placeholder');
if (sKey)
{
jqThis.attr('placeholder', self.i18n(sKey));
}
sKey = jqThis.data('i18n-title');
if (sKey)
{
jqThis.attr('title', self.i18n(sKey));
}
}
});
if (bAnimate && Globals.bAnimationSupported)
{
$('.i18n-animation.i18n', oElement).letterfx({
'fx': 'fall fade', 'backwards': false, 'timing': 50, 'fx_duration': '50ms', 'letter_end': 'restore', 'element_end': 'restore'
});
}
});
};
Translator.prototype.reloadData = function ()
{
if (window['rainloopI18N'])
{
this.data = window['rainloopI18N'] || {};
this.i18nToNode($(window.document), true);
this.trigger(!this.trigger());
}
window['rainloopI18N'] = null;
};
Translator.prototype.initNotificationLanguage = function ()
{
var oN = this.notificationI18N || {};
oN[Enums.Notification.InvalidToken] = this.i18n('NOTIFICATIONS/INVALID_TOKEN');
oN[Enums.Notification.AuthError] = this.i18n('NOTIFICATIONS/AUTH_ERROR');
oN[Enums.Notification.AccessError] = this.i18n('NOTIFICATIONS/ACCESS_ERROR');
oN[Enums.Notification.ConnectionError] = this.i18n('NOTIFICATIONS/CONNECTION_ERROR');
oN[Enums.Notification.CaptchaError] = this.i18n('NOTIFICATIONS/CAPTCHA_ERROR');
oN[Enums.Notification.SocialFacebookLoginAccessDisable] = this.i18n('NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.SocialTwitterLoginAccessDisable] = this.i18n('NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.SocialGoogleLoginAccessDisable] = this.i18n('NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.DomainNotAllowed] = this.i18n('NOTIFICATIONS/DOMAIN_NOT_ALLOWED');
oN[Enums.Notification.AccountNotAllowed] = this.i18n('NOTIFICATIONS/ACCOUNT_NOT_ALLOWED');
oN[Enums.Notification.AccountTwoFactorAuthRequired] = this.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED');
oN[Enums.Notification.AccountTwoFactorAuthError] = this.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR');
oN[Enums.Notification.CouldNotSaveNewPassword] = this.i18n('NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD');
oN[Enums.Notification.CurrentPasswordIncorrect] = this.i18n('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT');
oN[Enums.Notification.NewPasswordShort] = this.i18n('NOTIFICATIONS/NEW_PASSWORD_SHORT');
oN[Enums.Notification.NewPasswordWeak] = this.i18n('NOTIFICATIONS/NEW_PASSWORD_WEAK');
oN[Enums.Notification.NewPasswordForbidden] = this.i18n('NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT');
oN[Enums.Notification.ContactsSyncError] = this.i18n('NOTIFICATIONS/CONTACTS_SYNC_ERROR');
oN[Enums.Notification.CantGetMessageList] = this.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST');
oN[Enums.Notification.CantGetMessage] = this.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
oN[Enums.Notification.CantDeleteMessage] = this.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
oN[Enums.Notification.CantMoveMessage] = this.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
oN[Enums.Notification.CantCopyMessage] = this.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
oN[Enums.Notification.CantSaveMessage] = this.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
oN[Enums.Notification.CantSendMessage] = this.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
oN[Enums.Notification.InvalidRecipients] = this.i18n('NOTIFICATIONS/INVALID_RECIPIENTS');
oN[Enums.Notification.CantSaveFilters] = this.i18n('NOTIFICATIONS/CANT_SAVE_FILTERS');
oN[Enums.Notification.FiltersAreNotCorrect] = this.i18n('NOTIFICATIONS/FILTERS_ARE_NOT_CORRECT');
oN[Enums.Notification.CantCreateFolder] = this.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER');
oN[Enums.Notification.CantRenameFolder] = this.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER');
oN[Enums.Notification.CantDeleteFolder] = this.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER');
oN[Enums.Notification.CantDeleteNonEmptyFolder] = this.i18n('NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER');
oN[Enums.Notification.CantSubscribeFolder] = this.i18n('NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER');
oN[Enums.Notification.CantUnsubscribeFolder] = this.i18n('NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER');
oN[Enums.Notification.CantSaveSettings] = this.i18n('NOTIFICATIONS/CANT_SAVE_SETTINGS');
oN[Enums.Notification.CantSavePluginSettings] = this.i18n('NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS');
oN[Enums.Notification.DomainAlreadyExists] = this.i18n('NOTIFICATIONS/DOMAIN_ALREADY_EXISTS');
oN[Enums.Notification.CantInstallPackage] = this.i18n('NOTIFICATIONS/CANT_INSTALL_PACKAGE');
oN[Enums.Notification.CantDeletePackage] = this.i18n('NOTIFICATIONS/CANT_DELETE_PACKAGE');
oN[Enums.Notification.InvalidPluginPackage] = this.i18n('NOTIFICATIONS/INVALID_PLUGIN_PACKAGE');
oN[Enums.Notification.UnsupportedPluginPackage] = this.i18n('NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE');
oN[Enums.Notification.LicensingServerIsUnavailable] = this.i18n('NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE');
oN[Enums.Notification.LicensingExpired] = this.i18n('NOTIFICATIONS/LICENSING_EXPIRED');
oN[Enums.Notification.LicensingBanned] = this.i18n('NOTIFICATIONS/LICENSING_BANNED');
oN[Enums.Notification.DemoSendMessageError] = this.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR');
oN[Enums.Notification.AccountAlreadyExists] = this.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS');
oN[Enums.Notification.AccountDoesNotExist] = this.i18n('NOTIFICATIONS/ACCOUNT_DOES_NOT_EXIST');
oN[Enums.Notification.MailServerError] = this.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR');
oN[Enums.Notification.InvalidInputArgument] = this.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT');
oN[Enums.Notification.UnknownNotification] = this.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
oN[Enums.Notification.UnknownError] = this.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
};
/**
* @param {Function} fCallback
* @param {Object} oScope
* @param {Function=} fLangCallback
*/
Translator.prototype.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
{
if (fCallback)
{
fCallback.call(oScope);
}
if (fLangCallback)
{
this.trigger.subscribe(function () {
if (fCallback)
{
fCallback.call(oScope);
}
fLangCallback.call(oScope);
});
}
else if (fCallback)
{
this.trigger.subscribe(fCallback, oScope);
}
};
/**
* @param {number} iCode
* @param {*=} mMessage = ''
* @return {string}
*/
Translator.prototype.getNotification = function (iCode, mMessage)
{
iCode = window.parseInt(iCode, 10) || 0;
if (Enums.Notification.ClientViewError === iCode && mMessage)
{
return mMessage;
}
return _.isUndefined(this.notificationI18N[iCode]) ? '' : this.notificationI18N[iCode];
};
/**
* @param {*} mCode
* @return {string}
*/
Translator.prototype.getUploadErrorDescByCode = function (mCode)
{
var sResult = '';
switch (window.parseInt(mCode, 10) || 0) {
case Enums.UploadErrorCode.FileIsTooBig:
sResult = this.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG');
break;
case Enums.UploadErrorCode.FilePartiallyUploaded:
sResult = this.i18n('UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED');
break;
case Enums.UploadErrorCode.FileNoUploaded:
sResult = this.i18n('UPLOAD/ERROR_NO_FILE_UPLOADED');
break;
case Enums.UploadErrorCode.MissingTempFolder:
sResult = this.i18n('UPLOAD/ERROR_MISSING_TEMP_FOLDER');
break;
case Enums.UploadErrorCode.FileOnSaveingError:
sResult = this.i18n('UPLOAD/ERROR_ON_SAVING_FILE');
break;
case Enums.UploadErrorCode.FileType:
sResult = this.i18n('UPLOAD/ERROR_FILE_TYPE');
break;
default:
sResult = this.i18n('UPLOAD/ERROR_UNKNOWN');
break;
}
return sResult;
};
/**
* @param {string} sLanguage
* @param {Function=} fDone
* @param {Function=} fFail
*/
Translator.prototype.reload = function (sLanguage, fDone, fFail)
{
var
self = this,
$html = $('html'),
fEmptyFunction = function () {},
iStart = (new Date()).getTime()
;
$html.addClass('rl-changing-language');
$.ajax({
'url': require('Common/Links').langLink(sLanguage),
'dataType': 'script',
'cache': true
})
.fail(fFail || fEmptyFunction)
.done(function () {
_.delay(function () {
self.reloadData();
(fDone || fEmptyFunction)();
$html.removeClass('rl-changing-language');
}, 500 < (new Date()).getTime() - iStart ? 1 : 500);
})
;
};
module.exports = new Translator();
}());

View file

@ -18,7 +18,6 @@
Mime = require('Common/Mime'),
Enums = require('Common/Enums'),
Consts = require('Common/Consts'),
Globals = require('Common/Globals')
;
@ -108,14 +107,6 @@
return Utils.isArray(aValue) && 0 < aValue.length;
};
/**
* @return {*|null}
*/
Utils.notificationClass = function ()
{
return window.Notification && window.Notification.requestPermission ? window.Notification : null;
};
/**
* @param {string} sQueryString
* @return {Object}
@ -380,125 +371,6 @@
return oObject && window.Object && window.Object.hasOwnProperty ? window.Object.hasOwnProperty.call(oObject, sProp) : false;
};
/**
* @param {string} sKey
* @param {Object=} oValueList
* @param {string=} sDefaulValue
* @return {string}
*/
Utils.i18n = function (sKey, oValueList, sDefaulValue)
{
var
sValueName = '',
sResult = Utils.isUnd(Globals.oI18N[sKey]) ? (Utils.isUnd(sDefaulValue) ? sKey : sDefaulValue) : Globals.oI18N[sKey]
;
if (!Utils.isUnd(oValueList) && !Utils.isNull(oValueList))
{
for (sValueName in oValueList)
{
if (Utils.hos(oValueList, sValueName))
{
sResult = sResult.replace('%' + sValueName + '%', oValueList[sValueName]);
}
}
}
return sResult;
};
/**
* @param {Object} oElement
* @param {boolean=} bAnimate = false
*/
Utils.i18nToNode = function (oElement, bAnimate)
{
_.defer(function () {
$('.i18n', oElement).each(function () {
var
jqThis = $(this),
sKey = ''
;
sKey = jqThis.data('i18n-text');
if (sKey)
{
jqThis.text(Utils.i18n(sKey));
}
else
{
sKey = jqThis.data('i18n-html');
if (sKey)
{
jqThis.html(Utils.i18n(sKey));
}
sKey = jqThis.data('i18n-placeholder');
if (sKey)
{
jqThis.attr('placeholder', Utils.i18n(sKey));
}
sKey = jqThis.data('i18n-title');
if (sKey)
{
jqThis.attr('title', Utils.i18n(sKey));
}
}
});
if (bAnimate && Globals.bAnimationSupported)
{
$('.i18n-animation.i18n', oElement).letterfx({
'fx': 'fall fade', 'backwards': false, 'timing': 50, 'fx_duration': '50ms', 'letter_end': 'restore', 'element_end': 'restore'
});
}
});
};
Utils.i18nReload = function ()
{
if (window['rainloopI18N'])
{
Globals.oI18N = window['rainloopI18N'] || {};
Utils.i18nToNode(Globals.$doc, true);
Globals.langChangeTrigger(!Globals.langChangeTrigger());
}
window['rainloopI18N'] = null;
};
/**
* @param {Function} fCallback
* @param {Object} oScope
* @param {Function=} fLangCallback
*/
Utils.initOnStartOrLangChange = function (fCallback, oScope, fLangCallback)
{
if (fCallback)
{
fCallback.call(oScope);
}
if (fLangCallback)
{
Globals.langChangeTrigger.subscribe(function () {
if (fCallback)
{
fCallback.call(oScope);
}
fLangCallback.call(oScope);
});
}
else if (fCallback)
{
Globals.langChangeTrigger.subscribe(fCallback, oScope);
}
};
/**
* @return {boolean}
*/
@ -649,126 +521,6 @@
}
};
/**
* @param {number} iCode
* @param {*=} mMessage = ''
* @return {string}
*/
Utils.getNotification = function (iCode, mMessage)
{
iCode = Utils.pInt(iCode);
if (Enums.Notification.ClientViewError === iCode && mMessage)
{
return mMessage;
}
return Utils.isUnd(Globals.oNotificationI18N[iCode]) ? '' : Globals.oNotificationI18N[iCode];
};
Utils.initNotificationLanguage = function ()
{
var oN = Globals.oNotificationI18N || {};
oN[Enums.Notification.InvalidToken] = Utils.i18n('NOTIFICATIONS/INVALID_TOKEN');
oN[Enums.Notification.AuthError] = Utils.i18n('NOTIFICATIONS/AUTH_ERROR');
oN[Enums.Notification.AccessError] = Utils.i18n('NOTIFICATIONS/ACCESS_ERROR');
oN[Enums.Notification.ConnectionError] = Utils.i18n('NOTIFICATIONS/CONNECTION_ERROR');
oN[Enums.Notification.CaptchaError] = Utils.i18n('NOTIFICATIONS/CAPTCHA_ERROR');
oN[Enums.Notification.SocialFacebookLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.SocialTwitterLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.SocialGoogleLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE');
oN[Enums.Notification.DomainNotAllowed] = Utils.i18n('NOTIFICATIONS/DOMAIN_NOT_ALLOWED');
oN[Enums.Notification.AccountNotAllowed] = Utils.i18n('NOTIFICATIONS/ACCOUNT_NOT_ALLOWED');
oN[Enums.Notification.AccountTwoFactorAuthRequired] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED');
oN[Enums.Notification.AccountTwoFactorAuthError] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR');
oN[Enums.Notification.CouldNotSaveNewPassword] = Utils.i18n('NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD');
oN[Enums.Notification.CurrentPasswordIncorrect] = Utils.i18n('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT');
oN[Enums.Notification.NewPasswordShort] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_SHORT');
oN[Enums.Notification.NewPasswordWeak] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_WEAK');
oN[Enums.Notification.NewPasswordForbidden] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT');
oN[Enums.Notification.ContactsSyncError] = Utils.i18n('NOTIFICATIONS/CONTACTS_SYNC_ERROR');
oN[Enums.Notification.CantGetMessageList] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST');
oN[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
oN[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
oN[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
oN[Enums.Notification.CantCopyMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
oN[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
oN[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
oN[Enums.Notification.InvalidRecipients] = Utils.i18n('NOTIFICATIONS/INVALID_RECIPIENTS');
oN[Enums.Notification.CantSaveFilters] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_FILTERS');
oN[Enums.Notification.FiltersAreNotCorrect] = Utils.i18n('NOTIFICATIONS/FILTERS_ARE_NOT_CORRECT');
oN[Enums.Notification.CantCreateFolder] = Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER');
oN[Enums.Notification.CantRenameFolder] = Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER');
oN[Enums.Notification.CantDeleteFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER');
oN[Enums.Notification.CantDeleteNonEmptyFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER');
oN[Enums.Notification.CantSubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER');
oN[Enums.Notification.CantUnsubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER');
oN[Enums.Notification.CantSaveSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_SETTINGS');
oN[Enums.Notification.CantSavePluginSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS');
oN[Enums.Notification.DomainAlreadyExists] = Utils.i18n('NOTIFICATIONS/DOMAIN_ALREADY_EXISTS');
oN[Enums.Notification.CantInstallPackage] = Utils.i18n('NOTIFICATIONS/CANT_INSTALL_PACKAGE');
oN[Enums.Notification.CantDeletePackage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_PACKAGE');
oN[Enums.Notification.InvalidPluginPackage] = Utils.i18n('NOTIFICATIONS/INVALID_PLUGIN_PACKAGE');
oN[Enums.Notification.UnsupportedPluginPackage] = Utils.i18n('NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE');
oN[Enums.Notification.LicensingServerIsUnavailable] = Utils.i18n('NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE');
oN[Enums.Notification.LicensingExpired] = Utils.i18n('NOTIFICATIONS/LICENSING_EXPIRED');
oN[Enums.Notification.LicensingBanned] = Utils.i18n('NOTIFICATIONS/LICENSING_BANNED');
oN[Enums.Notification.DemoSendMessageError] = Utils.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR');
oN[Enums.Notification.AccountAlreadyExists] = Utils.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS');
oN[Enums.Notification.AccountDoesNotExist] = Utils.i18n('NOTIFICATIONS/ACCOUNT_DOES_NOT_EXIST');
oN[Enums.Notification.MailServerError] = Utils.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR');
oN[Enums.Notification.InvalidInputArgument] = Utils.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT');
oN[Enums.Notification.UnknownNotification] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
oN[Enums.Notification.UnknownError] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
};
/**
* @param {*} mCode
* @return {string}
*/
Utils.getUploadErrorDescByCode = function (mCode)
{
var sResult = '';
switch (Utils.pInt(mCode)) {
case Enums.UploadErrorCode.FileIsTooBig:
sResult = Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG');
break;
case Enums.UploadErrorCode.FilePartiallyUploaded:
sResult = Utils.i18n('UPLOAD/ERROR_FILE_PARTIALLY_UPLOADED');
break;
case Enums.UploadErrorCode.FileNoUploaded:
sResult = Utils.i18n('UPLOAD/ERROR_NO_FILE_UPLOADED');
break;
case Enums.UploadErrorCode.MissingTempFolder:
sResult = Utils.i18n('UPLOAD/ERROR_MISSING_TEMP_FOLDER');
break;
case Enums.UploadErrorCode.FileOnSaveingError:
sResult = Utils.i18n('UPLOAD/ERROR_ON_SAVING_FILE');
break;
case Enums.UploadErrorCode.FileType:
sResult = Utils.i18n('UPLOAD/ERROR_FILE_TYPE');
break;
default:
sResult = Utils.i18n('UPLOAD/ERROR_UNKNOWN');
break;
}
return sResult;
};
/**
* @param {?} oObject
* @param {string} sMethodName
@ -876,7 +628,6 @@
*/
Utils.initDataConstructorBySettings = function (oData)
{
oData.editorDefaultType = ko.observable(Enums.EditorDefaultType.Html);
oData.showImages = ko.observable(false);
oData.contactsAutosave = ko.observable(false);
oData.interfaceAnimation = ko.observable(true);
@ -888,16 +639,10 @@
oData.useLocalProxyForExternalImages = ko.observable(false);
oData.desktopNotifications = ko.observable(false);
oData.useThreads = ko.observable(true);
oData.replySameFolder = ko.observable(true);
oData.useCheckboxesInList = ko.observable(true);
oData.layout = ko.observable(Enums.Layout.SidePreview);
oData.usePreviewPane = ko.computed(function () {
return Enums.Layout.NoPreview !== oData.layout();
});
oData.interfaceAnimation.subscribe(function (bValue) {
if (Globals.bMobileDevice || !bValue)
{
@ -911,146 +656,6 @@
oData.interfaceAnimation.valueHasMutated();
oData.desktopNotificationsPermisions = ko.computed(function () {
oData.desktopNotifications();
var
NotificationClass = Utils.notificationClass(),
iResult = Enums.DesktopNotifications.NotSupported
;
if (NotificationClass && NotificationClass.permission)
{
switch (NotificationClass.permission.toLowerCase())
{
case 'granted':
iResult = Enums.DesktopNotifications.Allowed;
break;
case 'denied':
iResult = Enums.DesktopNotifications.Denied;
break;
case 'default':
iResult = Enums.DesktopNotifications.NotAllowed;
break;
}
}
else if (window.webkitNotifications && window.webkitNotifications.checkPermission)
{
iResult = window.webkitNotifications.checkPermission();
}
return iResult;
});
oData.useDesktopNotifications = ko.computed({
'read': function () {
return oData.desktopNotifications() &&
Enums.DesktopNotifications.Allowed === oData.desktopNotificationsPermisions();
},
'write': function (bValue) {
if (bValue)
{
var
NotificationClass = Utils.notificationClass(),
iPermission = oData.desktopNotificationsPermisions()
;
if (NotificationClass && Enums.DesktopNotifications.Allowed === iPermission)
{
oData.desktopNotifications(true);
}
else if (NotificationClass && Enums.DesktopNotifications.NotAllowed === iPermission)
{
NotificationClass.requestPermission(function () {
oData.desktopNotifications.valueHasMutated();
if (Enums.DesktopNotifications.Allowed === oData.desktopNotificationsPermisions())
{
if (oData.desktopNotifications())
{
oData.desktopNotifications.valueHasMutated();
}
else
{
oData.desktopNotifications(true);
}
}
else
{
if (oData.desktopNotifications())
{
oData.desktopNotifications(false);
}
else
{
oData.desktopNotifications.valueHasMutated();
}
}
});
}
else
{
oData.desktopNotifications(false);
}
}
else
{
oData.desktopNotifications(false);
}
}
});
oData.language = ko.observable('');
oData.languages = ko.observableArray([]);
oData.mainLanguage = ko.computed({
'read': oData.language,
'write': function (sValue) {
if (sValue !== oData.language())
{
if (-1 < Utils.inArray(sValue, oData.languages()))
{
oData.language(sValue);
}
else if (0 < oData.languages().length)
{
oData.language(oData.languages()[0]);
}
}
else
{
oData.language.valueHasMutated();
}
}
});
oData.theme = ko.observable('');
oData.themes = ko.observableArray([]);
oData.themeBackgroundName = ko.observable('');
oData.themeBackgroundHash = ko.observable('');
oData.mainTheme = ko.computed({
'read': oData.theme,
'write': function (sValue) {
if (sValue !== oData.theme())
{
var aThemes = oData.themes();
if (-1 < Utils.inArray(sValue, aThemes))
{
oData.theme(sValue);
}
else if (0 < aThemes.length)
{
oData.theme(aThemes[0]);
}
}
else
{
oData.theme.valueHasMutated();
}
}
});
oData.capaAdditionalAccounts = ko.observable(false);
oData.capaAdditionalIdentities = ko.observable(false);
oData.capaGravatar = ko.observable(false);
@ -1061,54 +666,6 @@
oData.weakPassword = ko.observable(false);
oData.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage);//.extend({'throttle': 200});
oData.mainMessagesPerPage = oData.messagesPerPage;
oData.mainMessagesPerPage = ko.computed({
'read': oData.messagesPerPage,
'write': function (iValue) {
if (-1 < Utils.inArray(Utils.pInt(iValue), Consts.Defaults.MessagesPerPageArray))
{
if (iValue !== oData.messagesPerPage())
{
oData.messagesPerPage(iValue);
}
}
else
{
oData.messagesPerPage.valueHasMutated();
}
}
});
oData.facebookSupported = ko.observable(false);
oData.facebookEnable = ko.observable(false);
oData.facebookAppID = ko.observable('');
oData.facebookAppSecret = ko.observable('');
oData.twitterEnable = ko.observable(false);
oData.twitterConsumerKey = ko.observable('');
oData.twitterConsumerSecret = ko.observable('');
oData.googleEnable = ko.observable(false);
oData.googleEnable.auth = ko.observable(false);
oData.googleEnable.drive = ko.observable(false);
oData.googleEnable.preview = ko.observable(false);
oData.googleClientID = ko.observable('');
oData.googleClientSecret = ko.observable('');
oData.googleApiKey = ko.observable('');
oData.googleEnable.requireClientSettings = ko.computed(function () {
return oData.googleEnable() && (oData.googleEnable.auth() || oData.googleEnable.drive());
});
oData.googleEnable.requireApiKey = ko.computed(function () {
return oData.googleEnable() && oData.googleEnable.drive();
});
oData.dropboxEnable = ko.observable(false);
oData.dropboxApiKey = ko.observable('');
oData.contactsIsAllowed = ko.observable(false);
};
@ -1153,13 +710,13 @@
}
else if (oMomentNow.format('L') === oMoment.format('L'))
{
sResult = Utils.i18n('MESSAGE_LIST/TODAY_AT', {
sResult = require('Common/Translator').i18n('MESSAGE_LIST/TODAY_AT', {
'TIME': oMoment.format('LT')
});
}
else if (oMomentNow.clone().subtract('days', 1).format('L') === oMoment.format('L'))
{
sResult = Utils.i18n('MESSAGE_LIST/YESTERDAY_AT', {
sResult = require('Common/Translator').i18n('MESSAGE_LIST/YESTERDAY_AT', {
'TIME': oMoment.format('LT')
});
}
@ -1224,7 +781,7 @@
*/
Utils.convertLangName = function (sLanguage, bEng)
{
return Utils.i18n('LANGS_NAMES' + (true === bEng ? '_EN' : '') + '/LANG_' +
return require('Common/Translator').i18n('LANGS_NAMES' + (true === bEng ? '_EN' : '') + '/LANG_' +
sLanguage.toUpperCase().replace(/[^a-zA-Z0-9]+/g, '_'), null, sLanguage);
};
@ -1291,7 +848,7 @@
$('#rl-content', oBody).html(oTemplate.html());
$('html', oWin.document).addClass('external ' + $('html').attr('class'));
Utils.i18nToNode(oBody);
require('Common/Translator').i18nToNode(oBody);
if (oViewModel && $('#rl-content', oBody)[0])
{
@ -1985,33 +1542,6 @@
}
};
/**
* @param {string} sLanguage
* @param {Function=} fDone
* @param {Function=} fFail
*/
Utils.reloadLanguage = function (sLanguage, fDone, fFail)
{
var iStart = Utils.microtime();
Globals.$html.addClass('rl-changing-language');
$.ajax({
'url': require('Common/Links').langLink(sLanguage),
'dataType': 'script',
'cache': true
})
.fail(fFail || Utils.emptyFunction)
.done(function () {
_.delay(function () {
Utils.i18nReload();
(fDone || Utils.emptyFunction)();
Globals.$html.removeClass('rl-changing-language');
}, 500 < Utils.microtime() - iStart ? 1 : 500);
})
;
};
/**
* @param {Object} oParams
*/

View file

@ -50,7 +50,7 @@
{
oParams.element = $(oCmponentInfo.element);
Utils.i18nToNode(oParams.element);
require('Common/Translator').i18nToNode(oParams.element);
if (!Utils.isUnd(oParams.inline) && ko.unwrap(oParams.inline))
{

60
dev/External/ko.js vendored
View file

@ -41,7 +41,7 @@
sPlacement = '',
oSubscription = null,
Globals = require('Common/Globals'),
Utils = require('Common/Utils')
Translator = require('Common/Translator')
;
if (!Globals.bMobileDevice)
@ -63,7 +63,7 @@
'title': function () {
var sValue = bi18n ? ko.unwrap(fValueAccessor()) : fValueAccessor()();
return '' === sValue || $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' :
'<span class="tooltip-class ' + sClass + '">' + (bi18n ? Utils.i18n(sValue) : sValue) + '</span>';
'<span class="tooltip-class ' + sClass + '">' + (bi18n ? Translator.i18n(sValue) : sValue) + '</span>';
}
}).on('click.koTooltip', function () {
$oEl.tooltip('hide');
@ -286,16 +286,14 @@
ko.bindingHandlers.i18nInit = {
'init': function (oElement) {
var Utils = require('Common/Utils');
Utils.i18nToNode(oElement);
require('Common/Translator').i18nToNode(oElement);
}
};
ko.bindingHandlers.i18nUpdate = {
'update': function (oElement, fValueAccessor) {
var Utils = require('Common/Utils');
ko.unwrap(fValueAccessor());
Utils.i18nToNode(oElement);
require('Common/Translator').i18nToNode(oElement);
}
};
@ -788,6 +786,56 @@
return oResult;
};
ko.extenders.limitedList = function (oTarget, mList)
{
var
Utils = require('Common/Utils'),
oResult = ko.computed({
'read': oTarget,
'write': function (sNewValue) {
var
sCurrentValue = ko.unwrap(oTarget),
aList = ko.unwrap(mList)
;
if (Utils.isNonEmptyArray(aList))
{
if (-1 < Utils.inArray(sNewValue, aList))
{
oTarget(sNewValue);
}
else if (-1 < Utils.inArray(sCurrentValue, aList))
{
oTarget(sCurrentValue + ' ');
oTarget(sCurrentValue);
}
else
{
oTarget(aList[0] + ' ');
oTarget(aList[0]);
}
}
else
{
oTarget('');
}
}
})
;
oResult(oTarget());
if (!oResult.valueHasMutated)
{
oResult.valueHasMutated = function () {
oTarget.valueHasMutated();
};
}
return oResult;
};
ko.extenders.reversible = function (oTarget)
{
var mValue = oTarget();

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
AbstractModel = require('Knoin/AbstractModel')
;
@ -34,7 +35,7 @@
this.placeholderValue = ko.computed(function () {
var sPlaceholder = this.placeholder();
return sPlaceholder ? Utils.i18n(sPlaceholder) : '';
return sPlaceholder ? Translator.i18n(sPlaceholder) : '';
}, this);
this.largeValue = ko.computed(function () {

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Cache = require('Storage/User/Cache'),
@ -71,23 +72,23 @@
switch (this.actionType())
{
case Enums.FiltersAction.MoveTo:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_MOVE_TO', {
sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_MOVE_TO', {
'FOLDER': fGetRealFolderName(sActionValue)
});
break;
case Enums.FiltersAction.Forward:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_FORWARD_TO', {
sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_FORWARD_TO', {
'EMAIL': sActionValue
});
break;
case Enums.FiltersAction.Vacation:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_VACATION_MESSAGE');
sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_VACATION_MESSAGE');
break;
case Enums.FiltersAction.Reject:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_REJECT');
sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_REJECT');
break;
case Enums.FiltersAction.Discard:
sResult = Utils.i18n('SETTINGS_FILTERS/SUBNAME_DISCARD');
sResult = Translator.i18n('SETTINGS_FILTERS/SUBNAME_DISCARD');
break;
}

View file

@ -8,9 +8,9 @@
ko = require('ko'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Events = require('Common/Events'),
Translator = require('Common/Translator'),
Cache = require('Storage/User/Cache'),
@ -186,7 +186,7 @@
this.localName = ko.computed(function () {
Globals.langChangeTrigger();
Translator.trigger();
var
iType = this.type(),
@ -198,22 +198,22 @@
switch (iType)
{
case Enums.FolderType.Inbox:
sName = Utils.i18n('FOLDER_LIST/INBOX_NAME');
sName = Translator.i18n('FOLDER_LIST/INBOX_NAME');
break;
case Enums.FolderType.SentItems:
sName = Utils.i18n('FOLDER_LIST/SENT_NAME');
sName = Translator.i18n('FOLDER_LIST/SENT_NAME');
break;
case Enums.FolderType.Draft:
sName = Utils.i18n('FOLDER_LIST/DRAFTS_NAME');
sName = Translator.i18n('FOLDER_LIST/DRAFTS_NAME');
break;
case Enums.FolderType.Spam:
sName = Utils.i18n('FOLDER_LIST/SPAM_NAME');
sName = Translator.i18n('FOLDER_LIST/SPAM_NAME');
break;
case Enums.FolderType.Trash:
sName = Utils.i18n('FOLDER_LIST/TRASH_NAME');
sName = Translator.i18n('FOLDER_LIST/TRASH_NAME');
break;
case Enums.FolderType.Archive:
sName = Utils.i18n('FOLDER_LIST/ARCHIVE_NAME');
sName = Translator.i18n('FOLDER_LIST/ARCHIVE_NAME');
break;
}
}
@ -224,7 +224,7 @@
this.manageFolderSystemName = ko.computed(function () {
Globals.langChangeTrigger();
Translator.trigger();
var
sSuffix = '',
@ -237,22 +237,22 @@
switch (iType)
{
case Enums.FolderType.Inbox:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/INBOX_NAME') + ')';
sSuffix = '(' + Translator.i18n('FOLDER_LIST/INBOX_NAME') + ')';
break;
case Enums.FolderType.SentItems:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/SENT_NAME') + ')';
sSuffix = '(' + Translator.i18n('FOLDER_LIST/SENT_NAME') + ')';
break;
case Enums.FolderType.Draft:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/DRAFTS_NAME') + ')';
sSuffix = '(' + Translator.i18n('FOLDER_LIST/DRAFTS_NAME') + ')';
break;
case Enums.FolderType.Spam:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/SPAM_NAME') + ')';
sSuffix = '(' + Translator.i18n('FOLDER_LIST/SPAM_NAME') + ')';
break;
case Enums.FolderType.Trash:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/TRASH_NAME') + ')';
sSuffix = '(' + Translator.i18n('FOLDER_LIST/TRASH_NAME') + ')';
break;
case Enums.FolderType.Archive:
sSuffix = '(' + Utils.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')';
sSuffix = '(' + Translator.i18n('FOLDER_LIST/ARCHIVE_NAME') + ')';
break;
}
}

View file

@ -10,6 +10,9 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Events = require('Common/Events'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
Data = require('Storage/User/Data'),
Cache = require('Storage/User/Cache'),
@ -48,7 +51,8 @@
;
require('App/User').setTitle(('' === sEmail ? '' :
(0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
(0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') +
sEmail + ' - ') + Translator.i18n('TITLES/MAILBOX'));
};
MailBoxUserScreen.prototype.onShow = function ()
@ -67,7 +71,7 @@
{
if (Utils.isUnd(bPreview) ? false : !!bPreview)
{
if (Enums.Layout.NoPreview === Data.layout() && !Data.message())
if (Enums.Layout.NoPreview === UserSettingsStore.layout() && !Data.message())
{
require('App/User').historyBack();
}
@ -87,7 +91,7 @@
.messageListSearch(sSearch)
;
if (Enums.Layout.NoPreview === Data.layout() && Data.message())
if (Enums.Layout.NoPreview === UserSettingsStore.layout() && Data.message())
{
Data.message(null);
}
@ -103,7 +107,7 @@
Data.messageList.subscribe(Utils.windowResizeCallback);
Data.message.subscribe(Utils.windowResizeCallback);
Data.layout.subscribe(function (nValue) {
UserSettingsStore.layout.subscribe(function (nValue) {
Globals.$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
Globals.$html.toggleClass('rl-side-preview-pane', Enums.Layout.SidePreview === nValue);
@ -112,7 +116,7 @@
Events.pub('layout', [nValue]);
});
Data.layout.valueHasMutated();
UserSettingsStore.layout.valueHasMutated();
Events.sub('mailbox.inbox-unread-count', function (nCount) {
Data.foldersInboxUnreadCount(nCount);

View file

@ -7,8 +7,8 @@
_ = require('_'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Globals = require('Common/Globals'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
@ -29,8 +29,8 @@
require('View/User/Settings/Pane')
]);
Utils.initOnStartOrLangChange(function () {
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
Translator.initOnStartOrLangChange(function () {
this.sSettingsTitle = Translator.i18n('TITLES/SETTINGS');
}, this, function () {
this.setSettingsTitle();
});

View file

@ -11,6 +11,8 @@
Utils = require('Common/Utils'),
Links = require('Common/Links'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data')
;
@ -20,11 +22,10 @@
*/
function GeneralAdminSettings()
{
this.mainLanguage = Data.mainLanguage;
this.mainTheme = Data.mainTheme;
this.language = Data.language;
this.theme = Data.theme;
this.language = UserSettingsStore.language;
this.languages = UserSettingsStore.languages;
this.theme = UserSettingsStore.theme;
this.themes = UserSettingsStore.themes;
this.capaThemes = Data.capaThemes;
this.capaUserBackground = Data.capaUserBackground;
@ -44,16 +45,16 @@
].join('') : '';
this.themesOptions = ko.computed(function () {
return _.map(Data.themes(), function (sTheme) {
return _.map(this.themes(), function (sTheme) {
return {
'optValue': sTheme,
'optText': Utils.convertThemeName(sTheme)
};
});
});
}, this);
this.mainLanguageFullName = ko.computed(function () {
return Utils.convertLangName(this.mainLanguage());
this.languageFullName = ko.computed(function () {
return Utils.convertLangName(this.language());
}, this);
this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);

View file

@ -8,7 +8,7 @@
ko = require('ko'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/Admin/Data'),
Remote = require('Storage/Admin/Remote')
@ -61,11 +61,11 @@
{
if (oData && oData.ErrorCode)
{
self.packagesError(Utils.getNotification(oData.ErrorCode));
self.packagesError(Translator.getNotification(oData.ErrorCode));
}
else
{
self.packagesError(Utils.getNotification(
self.packagesError(Translator.getNotification(
bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
}
}

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data'),
@ -99,7 +100,7 @@
}
else
{
this.pluginsError(Utils.getNotification(oData.ErrorCode));
this.pluginsError(Translator.getNotification(oData.ErrorCode));
}
}
}

View file

@ -16,32 +16,42 @@
*/
function SocialAdminSettings()
{
var Data = require('Storage/Admin/Data');
var SocialStore = require('Stores/Social');
this.googleEnable = Data.googleEnable;
this.googleClientID = Data.googleClientID;
this.googleApiKey = Data.googleApiKey;
this.googleClientSecret = Data.googleClientSecret;
this.googleEnable = SocialStore.google.enabled;
this.googleEnableAuth = SocialStore.google.capa.auth;
this.googleEnableDrive = SocialStore.google.capa.drive;
this.googleEnablePreview = SocialStore.google.capa.preview;
this.googleEnableRequireClientSettings = SocialStore.google.require.clientSettings;
this.googleEnableRequireApiKey = SocialStore.google.require.apiKeySettings;
this.googleClientID = SocialStore.google.clientID;
this.googleClientSecret = SocialStore.google.clientSecret;
this.googleApiKey = SocialStore.google.apiKey;
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
this.facebookSupported = Data.facebookSupported;
this.facebookEnable = Data.facebookEnable;
this.facebookAppID = Data.facebookAppID;
this.facebookAppSecret = Data.facebookAppSecret;
this.facebookSupported = SocialStore.facebook.supported;
this.facebookEnable = SocialStore.facebook.enabled;
this.facebookAppID = SocialStore.facebook.appID;
this.facebookAppSecret = SocialStore.facebook.appSecret;
this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
this.twitterEnable = Data.twitterEnable;
this.twitterConsumerKey = Data.twitterConsumerKey;
this.twitterConsumerSecret = Data.twitterConsumerSecret;
this.twitterEnable = SocialStore.twitter.enabled;
this.twitterConsumerKey = SocialStore.twitter.consumerKey;
this.twitterConsumerSecret = SocialStore.twitter.consumerSecret;
this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
this.dropboxEnable = Data.dropboxEnable;
this.dropboxApiKey = Data.dropboxApiKey;
this.dropboxEnable = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
}
@ -116,19 +126,19 @@
});
});
self.googleEnable.auth.subscribe(function (bValue) {
self.googleEnableAuth.subscribe(function (bValue) {
Remote.saveAdminConfig(Utils.emptyFunction, {
'GoogleEnableAuth': bValue ? '1' : '0'
});
});
self.googleEnable.drive.subscribe(function (bValue) {
self.googleEnableDrive.subscribe(function (bValue) {
Remote.saveAdminConfig(Utils.emptyFunction, {
'GoogleEnableDrive': bValue ? '1' : '0'
});
});
self.googleEnable.preview.subscribe(function (bValue) {
self.googleEnablePreview.subscribe(function (bValue) {
Remote.saveAdminConfig(Utils.emptyFunction, {
'GoogleEnablePreview': bValue ? '1' : '0'
});

View file

@ -9,7 +9,7 @@
ko = require('ko'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Links = require('Common/Links'),
Data = require('Storage/User/Data'),
@ -24,7 +24,7 @@
this.accounts = Data.accounts;
this.processText = ko.computed(function () {
return Data.accountsLoading() ? Utils.i18n('SETTINGS_ACCOUNTS/LOADING_PROCESS') : '';
return Data.accountsLoading() ? Translator.i18n('SETTINGS_ACCOUNTS/LOADING_PROCESS') : '';
}, this);
this.visibility = ko.computed(function () {

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote')
;
@ -53,7 +54,7 @@
if (this.newPassword() !== this.newPassword2())
{
this.passwordMismatch(true);
this.errorDescription(Utils.i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
this.errorDescription(Translator.i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
}
else
{
@ -112,7 +113,7 @@
this.passwordUpdateError(true);
this.errorDescription(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) :
Utils.getNotification(Enums.Notification.CouldNotSaveNewPassword));
Translator.getNotification(Enums.Notification.CouldNotSaveNewPassword));
}
};

View file

@ -9,8 +9,9 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
FilterStore = require('Stores/Filter'),
Remote = require('Storage/User/Remote')
;
@ -22,6 +23,9 @@
{
var self = this;
this.modules = FilterStore.modules;
this.filters = FilterStore.collection;
this.haveChanges = ko.observable(false);
this.processText = ko.observable('');
@ -29,22 +33,16 @@
this.visibility = ko.observable(false);
this.modules = Data.filterModules;
this.filters = ko.observableArray([]);
this.filters.loading = ko.observable(false).extend({'throttle': 200});
this.filters.saving = ko.observable(false).extend({'throttle': 200});
this.filters.subscribe(Utils.windowResizeCallback);
this.filterRaw = ko.observable('');
this.filterRaw.capa = ko.observable('');
this.filterRaw = FilterStore.raw;
this.filterRaw.capa = FilterStore.capa;
this.filterRaw.active = ko.observable(false);
this.filterRaw.allow = ko.observable(false);
this.filterRaw.error = ko.observable(false);
this.processText = ko.computed(function () {
return this.filters.loading() ? Utils.i18n('SETTINGS_FILTERS/LOADING_PROCESS') : '';
return this.filters.loading() ? Translator.i18n('SETTINGS_FILTERS/LOADING_PROCESS') : '';
}, this);
this.visibility = ko.computed(function () {
@ -78,8 +76,8 @@
}
else
{
self.saveErrorText(oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) :
Utils.getNotification(Enums.Notification.CantSaveFilters));
self.saveErrorText(oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) :
Translator.getNotification(Enums.Notification.CantSaveFilters));
}
}, this.filters(), this.filterRaw(), this.filterRaw.active());
@ -173,7 +171,6 @@
require('Knoin/Knoin').showScreenPopup(
require('View/Popup/Filter'), [oNew, function () {
self.filters.push(oNew);
self.haveChanges(true);
self.filterRaw.active(false);
}, false]);
};

View file

@ -8,6 +8,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'),
@ -34,19 +35,19 @@
if (bCreating)
{
return Utils.i18n('SETTINGS_FOLDERS/CREATING_PROCESS');
return Translator.i18n('SETTINGS_FOLDERS/CREATING_PROCESS');
}
else if (bDeleting)
{
return Utils.i18n('SETTINGS_FOLDERS/DELETING_PROCESS');
return Translator.i18n('SETTINGS_FOLDERS/DELETING_PROCESS');
}
else if (bRenaming)
{
return Utils.i18n('SETTINGS_FOLDERS/RENAMING_PROCESS');
return Translator.i18n('SETTINGS_FOLDERS/RENAMING_PROCESS');
}
else if (bLoading)
{
return Utils.i18n('SETTINGS_FOLDERS/LOADING_PROCESS');
return Translator.i18n('SETTINGS_FOLDERS/LOADING_PROCESS');
}
return '';
@ -105,7 +106,7 @@
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{
Data.folderList.error(
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'));
oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) : Translator.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'));
}
require('App/User').folders();
@ -176,7 +177,7 @@
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{
Data.folderList.error(
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'));
oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) : Translator.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'));
}
require('App/User').folders();
@ -188,7 +189,7 @@
}
else if (0 < oFolderToRemove.privateMessageCountAll())
{
Data.folderList.error(Utils.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
Data.folderList.error(Translator.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
}
};

View file

@ -11,6 +11,10 @@
Consts = require('Common/Consts'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
NotificationSettingsStore = require('Stores/NotificationSettings'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote')
@ -21,31 +25,28 @@
*/
function GeneralUserSettings()
{
this.mainLanguage = Data.mainLanguage;
this.mainMessagesPerPage = Data.mainMessagesPerPage;
this.mainMessagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
this.editorDefaultType = Data.editorDefaultType;
this.language = UserSettingsStore.language;
this.messagesPerPage = UserSettingsStore.messagesPerPage;
this.messagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
this.editorDefaultType = UserSettingsStore.editorDefaultType;
this.layout = UserSettingsStore.layout;
this.usePreviewPane = UserSettingsStore.usePreviewPane;
this.showImages = Data.showImages;
this.useDesktopNotifications = Data.useDesktopNotifications;
this.enableDesktopNotification = NotificationSettingsStore.enableDesktopNotification;
this.isDesktopNotificationSupported = NotificationSettingsStore.isDesktopNotificationSupported;
this.isDesktopNotificationDenied = NotificationSettingsStore.isDesktopNotificationDenied;
this.threading = Data.threading;
this.useThreads = Data.useThreads;
this.replySameFolder = Data.replySameFolder;
this.layout = Data.layout;
this.usePreviewPane = Data.usePreviewPane;
this.useCheckboxesInList = Data.useCheckboxesInList;
this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;
this.isDesktopNotificationsSupported = ko.computed(function () {
return Enums.DesktopNotifications.NotSupported !== Data.desktopNotificationsPermisions();
});
this.isDesktopNotificationsDenied = ko.computed(function () {
return Enums.DesktopNotifications.NotSupported === Data.desktopNotificationsPermisions() ||
Enums.DesktopNotifications.Denied === Data.desktopNotificationsPermisions();
});
this.mainLanguageFullName = ko.computed(function () {
return Utils.convertLangName(this.mainLanguage());
this.languageFullName = ko.computed(function () {
return Utils.convertLangName(this.language());
}, this);
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
@ -57,21 +58,21 @@
this.isAnimationSupported = Globals.bAnimationSupported;
this.editorDefaultTypes = ko.computed(function () {
Globals.langChangeTrigger();
Translator.trigger();
return [
{'id': Enums.EditorDefaultType.Html, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
{'id': Enums.EditorDefaultType.Plain, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')},
{'id': Enums.EditorDefaultType.HtmlForced, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')},
{'id': Enums.EditorDefaultType.PlainForced, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')}
{'id': Enums.EditorDefaultType.Html, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
{'id': Enums.EditorDefaultType.Plain, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')},
{'id': Enums.EditorDefaultType.HtmlForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')},
{'id': Enums.EditorDefaultType.PlainForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')}
];
}, this);
this.layoutTypes = ko.computed(function () {
Globals.langChangeTrigger();
Translator.trigger();
return [
{'id': Enums.Layout.NoPreview, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
{'id': Enums.Layout.SidePreview, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')},
{'id': Enums.Layout.BottomPreview, 'name': Utils.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
{'id': Enums.Layout.NoPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
{'id': Enums.Layout.SidePreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')},
{'id': Enums.Layout.BottomPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
];
}, this);
}
@ -96,11 +97,11 @@
}
;
Data.language.subscribe(function (sValue) {
self.language.subscribe(function (sValue) {
self.languageTrigger(Enums.SaveSettingsStep.Animate);
Utils.reloadLanguage(sValue,
Translator.reload(sValue,
fReloadLanguageHelper(Enums.SaveSettingsStep.TrueResult),
fReloadLanguageHelper(Enums.SaveSettingsStep.FalseResult));
@ -109,13 +110,13 @@
});
});
Data.editorDefaultType.subscribe(function (sValue) {
self.editorDefaultType.subscribe(function (sValue) {
Remote.saveSettings(f0, {
'EditorDefaultType': sValue
});
});
Data.messagesPerPage.subscribe(function (iValue) {
self.messagesPerPage.subscribe(function (iValue) {
Remote.saveSettings(f1, {
'MPP': iValue
});
@ -127,7 +128,7 @@
});
});
Data.useDesktopNotifications.subscribe(function (bValue) {
self.enableDesktopNotification.subscribe(function (bValue) {
Utils.timeOutAction('SaveDesktopNotifications', function () {
Remote.saveSettings(null, {
'DesktopNotifications': bValue ? '1' : '0'
@ -152,7 +153,7 @@
});
});
Data.layout.subscribe(function (nValue) {
self.layout.subscribe(function (nValue) {
Data.messageList([]);
@ -172,7 +173,7 @@
GeneralUserSettings.prototype.onShow = function ()
{
Data.desktopNotifications.valueHasMutated();
this.enableDesktopNotification.valueHasMutated();
};
GeneralUserSettings.prototype.selectLanguage = function ()

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
HtmlEditor = require('Common/HtmlEditor'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote')
@ -74,7 +75,7 @@
}, this);
this.processText = ko.computed(function () {
return Data.identitiesLoading() ? Utils.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : '';
return Data.identitiesLoading() ? Translator.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : '';
}, this);
this.visibility = ko.computed(function () {

View file

@ -7,8 +7,8 @@
ko = require('ko'),
Enums = require('Common/Enums'),
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote')
;
@ -34,8 +34,8 @@
this.bFirst = true;
this.viewTwoFactorStatus = ko.computed(function () {
Globals.langChangeTrigger();
return Utils.i18n(
Translator.trigger();
return Translator.i18n(
this.twoFactorStatus() ?
'SETTINGS_SECURITY/TWO_FACTOR_SECRET_CONFIGURED_DESC' :
'SETTINGS_SECURITY/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'

View file

@ -10,26 +10,29 @@
{
var
Utils = require('Common/Utils'),
Data = require('Storage/User/Data')
SocialStore = require('Stores/Social')
;
this.googleEnable = Data.googleEnable;
this.googleEnable = SocialStore.google.enabled;
this.googleEnableAuth = SocialStore.google.capa.auth;
this.googleEnableDrive = SocialStore.google.capa.drive;
this.googleEnablePreview = SocialStore.google.capa.preview;
this.googleActions = Data.googleActions;
this.googleLoggined = Data.googleLoggined;
this.googleUserName = Data.googleUserName;
this.googleActions = SocialStore.google.loading;
this.googleLoggined = SocialStore.google.loggined;
this.googleUserName = SocialStore.google.userName;
this.facebookEnable = Data.facebookEnable;
this.facebookEnable = SocialStore.facebook.enabled;
this.facebookActions = Data.facebookActions;
this.facebookLoggined = Data.facebookLoggined;
this.facebookUserName = Data.facebookUserName;
this.facebookActions = SocialStore.facebook.loading;
this.facebookLoggined = SocialStore.facebook.loggined;
this.facebookUserName = SocialStore.facebook.userName;
this.twitterEnable = Data.twitterEnable;
this.twitterEnable = SocialStore.twitter.enabled;
this.twitterActions = Data.twitterActions;
this.twitterLoggined = Data.twitterLoggined;
this.twitterUserName = Data.twitterUserName;
this.twitterActions = SocialStore.twitter.loading;
this.twitterLoggined = SocialStore.twitter.loggined;
this.twitterUserName = SocialStore.twitter.userName;
this.connectGoogle = Utils.createCommand(this, function () {
if (!this.googleLoggined())

View file

@ -12,6 +12,9 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Links = require('Common/Links'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote')
@ -22,12 +25,13 @@
*/
function ThemesUserSettings()
{
this.mainTheme = Data.mainTheme;
this.theme = UserSettingsStore.theme;
this.themes = UserSettingsStore.themes;
this.themesObjects = ko.observableArray([]);
this.background = {};
this.background.name = Data.themeBackgroundName;
this.background.hash = Data.themeBackgroundHash;
this.background.name = UserSettingsStore.themeBackgroundName;
this.background.hash = UserSettingsStore.themeBackgroundHash;
this.background.uploaderButton = ko.observable(null);
this.background.loading = ko.observable(false);
this.background.error = ko.observable('');
@ -39,7 +43,7 @@
this.iTimer = 0;
this.oThemeAjaxRequest = null;
Data.theme.subscribe(function (sValue) {
this.theme.subscribe(function (sValue) {
_.each(this.themesObjects(), function (oTheme) {
oTheme.selected(sValue === oTheme.name);
@ -54,14 +58,14 @@
}, this);
this.background.hash.subscribe(function (sValue) {
Utils.changeTheme(Data.theme(), sValue, this.themeTrigger, Links);
Utils.changeTheme(this.theme(), sValue, this.themeTrigger, Links);
}, this);
}
ThemesUserSettings.prototype.onBuild = function ()
{
var sCurrentTheme = Data.theme();
this.themesObjects(_.map(Data.themes(), function (sTheme) {
var sCurrentTheme = this.theme();
this.themesObjects(_.map(this.themes(), function (sTheme) {
return {
'name': sTheme,
'nameDisplay': Utils.convertThemeName(sTheme),
@ -135,10 +139,10 @@
switch (oData.ErrorCode)
{
case Enums.UploadErrorCode.FileIsTooBig:
sError = Utils.i18n('SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG');
sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG');
break;
case Enums.UploadErrorCode.FileType:
sError = Utils.i18n('SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR');
sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR');
break;
}
}
@ -148,7 +152,7 @@
sError = oData.ErrorMessage;
}
this.background.error(sError || Utils.i18n('SETTINGS_THEMES/ERROR_UNKNOWN'));
this.background.error(sError || Translator.i18n('SETTINGS_THEMES/ERROR_UNKNOWN'));
}
return true;

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {
@ -21,27 +20,6 @@
AbstractDataStorate.prototype.populateDataOnStart = function()
{
var
mLayout = Utils.pInt(Settings.settingsGet('Layout')),
aLanguages = Settings.settingsGet('Languages'),
aThemes = Settings.settingsGet('Themes')
;
if (Utils.isArray(aLanguages))
{
this.languages(aLanguages);
}
if (Utils.isArray(aThemes))
{
this.themes(aThemes);
}
this.mainLanguage(Settings.settingsGet('Language'));
this.mainTheme(Settings.settingsGet('Theme'));
this.themeBackgroundName(Settings.settingsGet('UserBackgroundName'));
this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash'));
this.capaAdditionalAccounts(Settings.capa(Enums.Capa.AdditionalAccounts));
this.capaAdditionalIdentities(Settings.capa(Enums.Capa.AdditionalIdentities));
this.capaGravatar(Settings.capa(Enums.Capa.Gravatar));
@ -58,43 +36,17 @@
this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
this.showImages(!!Settings.settingsGet('ShowImages'));
this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
this.interfaceAnimation(!!Settings.settingsGet('InterfaceAnimation'));
this.mainMessagesPerPage(Settings.settingsGet('MPP'));
this.desktopNotifications(!!Settings.settingsGet('DesktopNotifications'));
this.useThreads(!!Settings.settingsGet('UseThreads'));
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
this.layout(Enums.Layout.SidePreview);
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
{
this.layout(mLayout);
}
this.facebookSupported(!!Settings.settingsGet('SupportedFacebookSocial'));
this.facebookEnable(!!Settings.settingsGet('AllowFacebookSocial'));
this.facebookAppID(Settings.settingsGet('FacebookAppID'));
this.facebookAppSecret(Settings.settingsGet('FacebookAppSecret'));
this.twitterEnable(!!Settings.settingsGet('AllowTwitterSocial'));
this.twitterConsumerKey(Settings.settingsGet('TwitterConsumerKey'));
this.twitterConsumerSecret(Settings.settingsGet('TwitterConsumerSecret'));
this.googleEnable(!!Settings.settingsGet('AllowGoogleSocial'));
this.googleEnable.auth(!!Settings.settingsGet('AllowGoogleSocialAuth'));
this.googleEnable.drive(!!Settings.settingsGet('AllowGoogleSocialDrive'));
this.googleEnable.preview(!!Settings.settingsGet('AllowGoogleSocialPreview'));
this.googleClientID(Settings.settingsGet('GoogleClientID'));
this.googleClientSecret(Settings.settingsGet('GoogleClientSecret'));
this.googleApiKey(Settings.settingsGet('GoogleApiKey'));
this.dropboxEnable(!!Settings.settingsGet('AllowDropboxSocial'));
this.dropboxApiKey(Settings.settingsGet('DropboxApiKey'));
require('Stores/Social').populate();
require('Stores/UserSettings').populate();
require('Stores/NotificationSettings').populate();
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
};

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {
@ -16,6 +15,7 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Links = require('Common/Links'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
Cache = require('Storage/User/Cache'),
@ -271,7 +271,8 @@
}, this);
this.messageListPageCount = ko.computed(function () {
var iPage = window.Math.ceil(this.messageListCount() / this.messagesPerPage());
var iPage = window.Math.ceil(this.messageListCount() /
require('Stores/UserSettings').messagesPerPage());
return 0 >= iPage ? 1 : iPage;
}, this);
@ -327,13 +328,13 @@
this.messageFullScreenMode(false);
this.hideMessageBodies();
if (Enums.Layout.NoPreview === this.layout() &&
if (Enums.Layout.NoPreview === require('Stores/UserSettings').layout() &&
-1 < window.location.hash.indexOf('message-preview'))
{
require('App/User').historyBack();
}
}
else if (Enums.Layout.NoPreview === this.layout())
else if (Enums.Layout.NoPreview === require('Stores/UserSettings').layout())
{
this.message.focused(true);
}
@ -347,7 +348,7 @@
}
else if (Enums.KeyState.MessageView === Globals.keyScope())
{
if (Enums.Layout.NoPreview === this.layout() && this.message())
if (Enums.Layout.NoPreview === require('Stores/UserSettings').layout() && this.message())
{
Globals.keyScope(Enums.KeyState.MessageView);
}
@ -430,22 +431,7 @@
return aList;
}, this);
// quota
this.userQuota = ko.observable(0);
this.userUsageSize = ko.observable(0);
this.userUsageProc = ko.computed(function () {
var
iQuota = this.userQuota(),
iUsed = this.userUsageSize()
;
return 0 < iQuota ? window.Math.ceil((iUsed / iQuota) * 100) : 0;
}, this);
// other
this.filterModules = ko.observable({});
this.composeInEdit = ko.observable(false);
this.capaOpenPGP = ko.observable(false);
this.openpgpkeys = ko.observableArray([]);
@ -460,21 +446,6 @@
return !!(oItem && oItem.isPrivate);
});
// google
this.googleActions = ko.observable(false);
this.googleLoggined = ko.observable(false);
this.googleUserName = ko.observable('');
// facebook
this.facebookActions = ko.observable(false);
this.facebookLoggined = ko.observable(false);
this.facebookUserName = ko.observable('');
// twitter
this.twitterActions = ko.observable(false);
this.twitterLoggined = ko.observable(false);
this.twitterUserName = ko.observable('');
this.customThemeType = ko.observable(Enums.CustomThemeType.Light);
this.purgeMessageBodyCacheThrottle = _.throttle(this.purgeMessageBodyCache, 1000 * 30);
@ -546,17 +517,17 @@
if (Utils.isArray(aNewMessages) && 0 < aNewMessages.length)
{
var
self = this,
iIndex = 0,
iLen = aNewMessages.length,
fNotificationHelper = function (sImageSrc, sTitle, sText)
{
var
NotificationClass = Utils.notificationClass(),
NotificationSettingsStore = require('Stores/NotificationSettings'),
NotificationClass = NotificationSettingsStore.notificationClass(),
oNotification = null
;
if (NotificationClass && self.useDesktopNotifications())
if (NotificationClass && NotificationSettingsStore.enableDesktopNotification())
{
oNotification = new NotificationClass(sTitle, {
'body': sText,
@ -596,7 +567,7 @@
fNotificationHelper(
Links.notificationMailIcon(),
this.accountEmail(),
Utils.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
Translator.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
'COUNT': iLen
})
);

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function () {

28
dev/Stores/Filter.js Normal file
View file

@ -0,0 +1,28 @@
(function () {
'use strict';
var
ko = require('ko')
;
/**
* @constructor
*/
function FilterStore()
{
this.capa = ko.observable('');
this.modules = ko.observable({});
this.collection = ko.observableArray([]);
this.collection.loading = ko.observable(false).extend({'throttle': 200});
this.collection.saving = ko.observable(false).extend({'throttle': 200});
this.raw = ko.observable('');
}
module.exports = new FilterStore();
}());

View file

@ -0,0 +1,152 @@
(function () {
'use strict';
var
window = require('window'),
ko = require('ko'),
Enums = require('Common/Enums'),
Settings = require('Storage/Settings')
;
/**
* @constructor
*/
function NotificationSettings()
{
var self = this;
this.allowDesktopNotification = ko.observable(false);
this.desktopNotificationPermisions = ko.computed(function () {
this.allowDesktopNotification();
var
NotificationClass = this.notificationClass(),
iResult = Enums.DesktopNotification.NotSupported
;
if (NotificationClass && NotificationClass.permission)
{
switch (NotificationClass.permission.toLowerCase())
{
case 'granted':
iResult = Enums.DesktopNotification.Allowed;
break;
case 'denied':
iResult = Enums.DesktopNotification.Denied;
break;
case 'default':
iResult = Enums.DesktopNotification.NotAllowed;
break;
}
}
else if (window.webkitNotifications && window.webkitNotifications.checkPermission)
{
iResult = window.webkitNotifications.checkPermission();
}
return iResult;
}, this);
this.enableDesktopNotification = ko.computed({
'owner': this,
'read': function () {
return this.allowDesktopNotification() &&
Enums.DesktopNotification.Allowed === this.desktopNotificationPermisions();
},
'write': function (bValue) {
if (bValue)
{
var
NotificationClass = this.notificationClass(),
iPermission = this.desktopNotificationPermisions()
;
if (NotificationClass && Enums.DesktopNotification.Allowed === iPermission)
{
this.allowDesktopNotification(true);
}
else if (NotificationClass && Enums.DesktopNotification.NotAllowed === iPermission)
{
NotificationClass.requestPermission(function () {
self.allowDesktopNotification.valueHasMutated();
if (Enums.DesktopNotification.Allowed === self.desktopNotificationPermisions())
{
if (self.allowDesktopNotification())
{
self.allowDesktopNotification.valueHasMutated();
}
else
{
self.allowDesktopNotification(true);
}
}
else
{
if (self.allowDesktopNotification())
{
self.allowDesktopNotification(false);
}
else
{
self.allowDesktopNotification.valueHasMutated();
}
}
});
}
else
{
this.allowDesktopNotification(false);
}
}
else
{
this.allowDesktopNotification(false);
}
}
});
if (!this.enableDesktopNotification.valueHasMutated)
{
this.enableDesktopNotification.valueHasMutated = function () {
self.allowDesktopNotification.valueHasMutated();
};
}
this.computedProperies();
}
NotificationSettings.prototype.computedProperies = function ()
{
this.isDesktopNotificationSupported = ko.computed(function () {
return Enums.DesktopNotification.NotSupported !== this.desktopNotificationPermisions();
}, this);
this.isDesktopNotificationDenied = ko.computed(function () {
return Enums.DesktopNotification.NotSupported === this.desktopNotificationPermisions() ||
Enums.DesktopNotification.Denied === this.desktopNotificationPermisions();
}, this);
};
NotificationSettings.prototype.populate = function ()
{
this.enableDesktopNotification(!!Settings.settingsGet('DesktopNotifications'));
};
/**
* @return {*|null}
*/
NotificationSettings.prototype.notificationClass = function ()
{
return window.Notification && window.Notification.requestPermission ? window.Notification : null;
};
module.exports = new NotificationSettings();
}());

43
dev/Stores/Quota.js Normal file
View file

@ -0,0 +1,43 @@
(function () {
'use strict';
var
window = require('window'),
ko = require('ko')
;
/**
* @constructor
*/
function QuotaStore()
{
this.quota = ko.observable(0);
this.usage = ko.observable(0);
this.percentage = ko.computed(function () {
var
iQuota = this.quota(),
iUsed = this.usage()
;
return 0 < iQuota ? window.Math.ceil((iUsed / iQuota) * 100) : 0;
}, this);
}
/**
* @param {number} iQuota
* @param {number} iUsage
*/
QuotaStore.prototype.populateData = function(iQuota, iUsage)
{
this.quota(iQuota * 1024);
this.usage(iUsage * 1024);
};
module.exports = new QuotaStore();
}());

110
dev/Stores/Social.js Normal file
View file

@ -0,0 +1,110 @@
(function () {
'use strict';
var
ko = require('ko')
;
/**
* @constructor
*/
function SocialStore()
{
// TODO
this.google = {};
this.twitter = {};
this.facebook = {};
this.dropbox = {};
// Google
this.google.enabled = ko.observable(false);
this.google.clientID = ko.observable('');
this.google.clientSecret = ko.observable('');
this.google.apiKey = ko.observable('');
this.google.loading = ko.observable(false);
this.google.userName = ko.observable('');
this.google.loggined = ko.computed(function () {
return '' !== this.google.userName();
}, this);
this.google.capa = {};
this.google.capa.auth = ko.observable(false);
this.google.capa.drive = ko.observable(false);
this.google.capa.preview = ko.observable(false);
this.google.require = {};
this.google.require.clientSettings = ko.computed(function () {
return this.google.enabled() && (this.google.capa.auth() || this.google.capa.drive());
}, this);
this.google.require.apiKeySettings = ko.computed(function () {
return this.google.enabled() && this.google.capa.drive();
}, this);
// Facebook
this.facebook.enabled = ko.observable(false);
this.facebook.appID = ko.observable('');
this.facebook.appSecret = ko.observable('');
this.facebook.loading = ko.observable(false);
this.facebook.userName = ko.observable('');
this.facebook.supported = ko.observable(false);
this.facebook.loggined = ko.computed(function () {
return '' !== this.facebook.userName();
}, this);
// Twitter
this.twitter.enabled = ko.observable(false);
this.twitter.consumerKey = ko.observable('');
this.twitter.consumerSecret = ko.observable('');
this.twitter.loading = ko.observable(false);
this.twitter.userName = ko.observable('');
this.twitter.loggined = ko.computed(function () {
return '' !== this.twitter.userName();
}, this);
// Dropbox
this.dropbox.enabled = ko.observable(false);
this.dropbox.apiKey = ko.observable('');
}
SocialStore.prototype.google = {};
SocialStore.prototype.twitter = {};
SocialStore.prototype.facebook = {};
SocialStore.prototype.dropbox = {};
SocialStore.prototype.populate = function ()
{
var Settings = require('Storage/Settings');
this.google.enabled(!!Settings.settingsGet('AllowGoogleSocial'));
this.google.clientID(Settings.settingsGet('GoogleClientID'));
this.google.clientSecret(Settings.settingsGet('GoogleClientSecret'));
this.google.apiKey(Settings.settingsGet('GoogleApiKey'));
this.google.capa.auth(!!Settings.settingsGet('AllowGoogleSocialAuth'));
this.google.capa.drive(!!Settings.settingsGet('AllowGoogleSocialDrive'));
this.google.capa.preview(!!Settings.settingsGet('AllowGoogleSocialPreview'));
this.facebook.enabled(!!Settings.settingsGet('AllowFacebookSocial'));
this.facebook.appID(Settings.settingsGet('FacebookAppID'));
this.facebook.appSecret(Settings.settingsGet('FacebookAppSecret'));
this.facebook.supported(!!Settings.settingsGet('SupportedFacebookSocial'));
this.twitter.enabled = ko.observable(!!Settings.settingsGet('AllowTwitterSocial'));
this.twitter.consumerKey = ko.observable(Settings.settingsGet('TwitterConsumerKey'));
this.twitter.consumerSecret = ko.observable(Settings.settingsGet('TwitterConsumerSecret'));
this.dropbox.enabled(!!Settings.settingsGet('AllowDropboxSocial'));
this.dropbox.apiKey(Settings.settingsGet('DropboxApiKey'));
};
module.exports = new SocialStore();
}());

View file

@ -0,0 +1,80 @@
(function () {
'use strict';
var
ko = require('ko'),
Consts = require('Common/Consts'),
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Settings = require('Storage/Settings')
;
/**
* @constructor
*/
function UserSettingsStore()
{
this.layout = ko.observable(Enums.Layout.SidePreview)
.extend({'limitedList': [
Enums.Layout.SidePreview, Enums.Layout.BottomPreview, Enums.Layout.NoPreview
]});
this.editorDefaultType = ko.observable(Enums.EditorDefaultType.Html)
.extend({'limitedList': [
Enums.EditorDefaultType.Html, Enums.EditorDefaultType.Plain,
Enums.EditorDefaultType.HtmlForced, Enums.EditorDefaultType.PlainForced
]});
this.languages = ko.observableArray([]);
this.language = ko.observable('')
.extend({'limitedList': this.languages});
this.themes = ko.observableArray([]);
this.themeBackgroundName = ko.observable('');
this.themeBackgroundHash = ko.observable('');
this.theme = ko.observable('')
.extend({'limitedList': this.themes});
this.messagesPerPage = ko.observable(Consts.Defaults.MessagesPerPage)
.extend({'limitedList': Consts.Defaults.MessagesPerPageArray});
this.computedProperies();
}
UserSettingsStore.prototype.computedProperies = function ()
{
this.usePreviewPane = ko.computed(function () {
return Enums.Layout.NoPreview !== this.layout();
}, this);
};
UserSettingsStore.prototype.populate = function ()
{
var
aLanguages = Settings.settingsGet('Languages'),
aThemes = Settings.settingsGet('Themes')
;
this.layout(Utils.pInt(Settings.settingsGet('Layout')));
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
this.languages(Utils.isArray(aLanguages) ? aLanguages : []);
this.language(Settings.settingsGet('Language'));
this.themes(Utils.isArray(aThemes) ? aThemes : []);
this.theme(Settings.settingsGet('Theme'));
this.themeBackgroundName(Settings.settingsGet('UserBackgroundName'));
this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash'));
this.messagesPerPage(Settings.settingsGet('MPP'));
};
module.exports = new UserSettingsStore();
}());

View file

@ -1,4 +1,3 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
@import "../../vendors/bootstrap/less/variables.less";
@import "../../vendors/bootstrap/less/mixins.less";

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
Remote = require('Storage/Admin/Remote'),
@ -71,13 +72,13 @@
else if (oData.ErrorCode)
{
this.submitRequest(false);
this.submitError(Utils.getNotification(oData.ErrorCode));
this.submitError(Translator.getNotification(oData.ErrorCode));
}
}
else
{
this.submitRequest(false);
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
}
}, this), this.login(), this.password());

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data'),
@ -76,13 +77,13 @@
}
else if (oData.ErrorCode)
{
self.activateText(Utils.getNotification(oData.ErrorCode));
self.activateText(Translator.getNotification(oData.ErrorCode));
self.activateText.isError(true);
self.key.focus(true);
}
else
{
self.activateText(Utils.getNotification(Enums.Notification.UnknownError));
self.activateText(Translator.getNotification(Enums.Notification.UnknownError));
self.activateText.isError(true);
self.key.focus(true);
}

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote'),
@ -69,12 +70,12 @@
}
else if (oData.ErrorCode)
{
this.submitError(Utils.getNotification(oData.ErrorCode));
this.submitError(Translator.getNotification(oData.ErrorCode));
}
}
else
{
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
}
}, this), this.email(), this.password(), this.isNew());

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
@ -46,8 +47,8 @@
AskPopupView.prototype.clearPopup = function ()
{
this.askDesc('');
this.yesButton(Utils.i18n('POPUPS_ASK/BUTTON_YES'));
this.noButton(Utils.i18n('POPUPS_ASK/BUTTON_NO'));
this.yesButton(Translator.i18n('POPUPS_ASK/BUTTON_YES'));
this.noButton(Translator.i18n('POPUPS_ASK/BUTTON_NO'));
this.yesFocus(false);
this.noFocus(false);

View file

@ -19,6 +19,10 @@
Events = require('Common/Events'),
Links = require('Common/Links'),
HtmlEditor = require('Common/HtmlEditor'),
Translator = require('Common/Translator'),
SocialStore = require('Stores/Social'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'),
@ -61,6 +65,7 @@
this.bSkipNextHide = false;
this.composeInEdit = Data.composeInEdit;
this.editorDefaultType = UserSettingsStore.editorDefaultType;
this.capaOpenPGP = Data.capaOpenPGP;
@ -419,7 +424,8 @@
this.triggerForResize();
}, this);
this.dropboxEnabled = ko.observable(!!Settings.settingsGet('DropboxApiKey'));
this.dropboxEnabled = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
this.dropboxCommand = Utils.createCommand(this, function () {
@ -659,15 +665,15 @@
if (oData && Enums.Notification.CantSaveMessage === oData.ErrorCode)
{
this.sendSuccessButSaveError(true);
window.alert(Utils.trim(Utils.i18n('COMPOSE/SAVED_ERROR_ON_SEND')));
window.alert(Utils.trim(Translator.i18n('COMPOSE/SAVED_ERROR_ON_SEND')));
}
else
{
sMessage = Utils.getNotification(oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantSendMessage,
sMessage = Translator.getNotification(oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantSendMessage,
oData && oData.ErrorMessage ? oData.ErrorMessage : '');
this.sendError(true);
window.alert(sMessage || Utils.getNotification(Enums.Notification.CantSendMessage));
window.alert(sMessage || Translator.getNotification(Enums.Notification.CantSendMessage));
}
}
@ -704,7 +710,7 @@
this.savedTime(window.Math.round((new window.Date()).getTime() / 1000));
this.savedOrSendingText(
0 < this.savedTime() ? Utils.i18n('COMPOSE/SAVED_TIME', {
0 < this.savedTime() ? Translator.i18n('COMPOSE/SAVED_TIME', {
'TIME': moment.unix(this.savedTime() - 1).format('LT')
}) : ''
);
@ -719,7 +725,7 @@
if (!bResult)
{
this.savedError(true);
this.savedOrSendingText(Utils.getNotification(Enums.Notification.CantSaveMessage));
this.savedOrSendingText(Translator.getNotification(Enums.Notification.CantSaveMessage));
}
this.reloadDraftFolder();
@ -848,7 +854,7 @@
if (Enums.ComposeType.Empty !== sType)
{
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('COMPOSE/DISCARD_UNSAVED_DATA'), function () {
kn.showScreenPopup(PopupsAskViewModel, [Translator.i18n('COMPOSE/DISCARD_UNSAVED_DATA'), function () {
self.initOnShow(sType, oMessageOrArray, aToEmails, sCustomSubject, sCustomPlainText);
}, null, null, null, false]);
}
@ -1052,7 +1058,7 @@
case Enums.ComposeType.Reply:
case Enums.ComposeType.ReplyAll:
sFrom = oMessage.fromToLine(false, true);
sReplyTitle = Utils.i18n('COMPOSE/REPLY_MESSAGE_TITLE', {
sReplyTitle = Translator.i18n('COMPOSE/REPLY_MESSAGE_TITLE', {
'DATETIME': sDate,
'EMAIL': sFrom
});
@ -1066,12 +1072,12 @@
sFrom = oMessage.fromToLine(false, true);
sTo = oMessage.toToLine(false, true);
sCc = oMessage.ccToLine(false, true);
sText = '<br /><br /><br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_FROM') + ': ' + sFrom +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') + ': ' + sTo +
(0 < sCc.length ? '<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') + ': ' + Utils.encodeHtml(sDate) +
'<br />' + Utils.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT') + ': ' + Utils.encodeHtml(sSubject) +
sText = '<br /><br /><br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TITLE') +
'<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_FROM') + ': ' + sFrom +
'<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_TO') + ': ' + sTo +
(0 < sCc.length ? '<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_CC') + ': ' + sCc : '') +
'<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SENT') + ': ' + Utils.encodeHtml(sDate) +
'<br />' + Translator.i18n('COMPOSE/FORWARD_MESSAGE_TOP_SUBJECT') + ': ' + Utils.encodeHtml(sSubject) +
'<br /><br />' + sText;
break;
case Enums.ComposeType.ForwardAsAttachment:
@ -1087,8 +1093,8 @@
this.editor(function (oEditor) {
oEditor.setHtml(sText, false);
if (Enums.EditorDefaultType.PlainForced === Data.editorDefaultType() ||
(!oMessage.isHtml() && Enums.EditorDefaultType.HtmlForced !== Data.editorDefaultType()))
if (Enums.EditorDefaultType.PlainForced === self.editorDefaultType() ||
(!oMessage.isHtml() && Enums.EditorDefaultType.HtmlForced !== self.editorDefaultType()))
{
oEditor.modeToggle(false);
}
@ -1107,8 +1113,8 @@
this.editor(function (oEditor) {
oEditor.setHtml(sText, false);
if (Enums.EditorDefaultType.Html !== Data.editorDefaultType() &&
Enums.EditorDefaultType.HtmlForced !== Data.editorDefaultType())
if (Enums.EditorDefaultType.Html !== self.editorDefaultType() &&
Enums.EditorDefaultType.HtmlForced !== self.editorDefaultType())
{
oEditor.modeToggle(false);
}
@ -1197,7 +1203,7 @@
}
else
{
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
kn.showScreenPopup(PopupsAskViewModel, [Translator.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
if (self.modalVisibility())
{
Utils.delegateRun(self, 'closeCommand');
@ -1251,7 +1257,7 @@
oScript = window.document.createElement('script');
oScript.type = 'text/javascript';
oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js';
$(oScript).attr('id', 'dropboxjs').attr('data-app-key', Settings.settingsGet('DropboxApiKey'));
$(oScript).attr('id', 'dropboxjs').attr('data-app-key', self.dropboxApiKey());
window.document.body.appendChild(oScript);
}
@ -1538,7 +1544,7 @@
{
oAttachment
.waiting(false).uploading(true).complete(true)
.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
.error(Translator.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
return false;
}
@ -1585,11 +1591,11 @@
if (null !== mErrorCode)
{
sError = Utils.getUploadErrorDescByCode(mErrorCode);
sError = Translator.getUploadErrorDescByCode(mErrorCode);
}
else if (!oAttachmentJson)
{
sError = Utils.i18n('UPLOAD/ERROR_UNKNOWN');
sError = Translator.i18n('UPLOAD/ERROR_UNKNOWN');
}
if (oAttachment)
@ -1711,7 +1717,7 @@
if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
{
oAttachment.uploading(false).complete(true);
oAttachment.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
oAttachment.error(Translator.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
return false;
}
@ -1731,7 +1737,7 @@
if (!bResult)
{
oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
oAttachment.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
}
}, [oDropboxFile['link']]);
@ -1767,7 +1773,7 @@
if (0 < mSize && 0 < iAttachmentSizeLimit && iAttachmentSizeLimit < mSize)
{
oAttachment.uploading(false).complete(true);
oAttachment.error(Utils.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
oAttachment.error(Translator.i18n('UPLOAD/ERROR_FILE_IS_TOO_BIG'));
return false;
}
@ -1788,7 +1794,7 @@
if (!bResult)
{
oAttachment.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
oAttachment.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded));
}
}, oDriveFile['downloadUrl'], sAccessToken);
@ -1877,7 +1883,7 @@
.waiting(false)
.uploading(false)
.complete(true)
.error(Utils.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded))
.error(Translator.getUploadErrorDescByCode(Enums.UploadErrorCode.FileNoUploaded))
;
}
}, this);

View file

@ -10,6 +10,7 @@
Utils = require('Common/Utils'),
Enums = require('Common/Enums'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
@ -58,7 +59,7 @@
if (bResult && this.sign() && '' === this.from())
{
this.notification(Utils.i18n('PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL'));
this.notification(Translator.i18n('PGP_NOTIFICATIONS/SPECIFY_FROM_EMAIL'));
bResult = false;
}
@ -67,7 +68,7 @@
oPrivateKey = Data.findPrivateKeyByEmail(this.from(), this.password());
if (!oPrivateKey)
{
this.notification(Utils.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
this.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
'EMAIL': this.from()
}));
@ -77,7 +78,7 @@
if (bResult && this.encrypt() && 0 === this.to().length)
{
this.notification(Utils.i18n('PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT'));
this.notification(Translator.i18n('PGP_NOTIFICATIONS/SPECIFY_AT_LEAST_ONE_RECIPIENT'));
bResult = false;
}
@ -88,7 +89,7 @@
var aKeys = Data.findPublicKeysByEmail(sEmail);
if (0 === aKeys.length && bResult)
{
self.notification(Utils.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
self.notification(Translator.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
'EMAIL': sEmail
}));
@ -131,7 +132,7 @@
}
catch (e)
{
self.notification(Utils.i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
self.notification(Translator.i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
'ERROR': '' + e
}));

View file

@ -16,6 +16,7 @@
Utils = require('Common/Utils'),
Selector = require('Common/Selector'),
Links = require('Common/Links'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote'),
@ -338,7 +339,7 @@
require('App/User').contactsSync(function (sResult, oData) {
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{
window.alert(Utils.getNotification(
window.alert(Translator.getNotification(
oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.ContactsSyncError));
}
@ -488,7 +489,7 @@
if (!sId || !bResult || !oData || !oData.Result)
{
window.alert(Utils.i18n('CONTACTS/ERROR_IMPORT_FILE'));
window.alert(Translator.i18n('CONTACTS/ERROR_IMPORT_FILE'));
}
}, this))

View file

@ -9,9 +9,12 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
FilterStore = require('Stores/Filter'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
;
@ -26,10 +29,11 @@
this.isNew = ko.observable(true);
this.modules = FilterStore.modules;
this.fTrueCallback = null;
this.filter = ko.observable(null);
this.modules = Data.filterModules;
this.allowMarkAsRead = ko.observable(false);
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
@ -71,11 +75,11 @@
return true;
});
this.actionTypeOptions = [];
this.fieldOptions = [];
this.typeOptions = [];
this.actionTypeOptions = ko.observableArray([]);
this.fieldOptions = ko.observableArray([]);
this.typeOptions = ko.observableArray([]);
this.populateOptions();
Translator.initOnStartOrLangChange(this.populateOptions, this);
this.modules.subscribe(this.populateOptions, this);
@ -87,9 +91,10 @@
FilterPopupView.prototype.populateOptions = function ()
{
this.actionTypeOptions = [];
this.actionTypeOptions([]);
// this.actionTypeOptions.push({'id': Enums.FiltersAction.None,
// 'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_NONE')});
// 'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_NONE')});
var oModules = this.modules();
if (oModules)
@ -102,44 +107,44 @@
if (oModules.moveto)
{
this.actionTypeOptions.push({'id': Enums.FiltersAction.MoveTo,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')});
'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')});
}
if (oModules.redirect)
{
this.actionTypeOptions.push({'id': Enums.FiltersAction.Forward,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')});
'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')});
}
if (oModules.reject)
{
this.actionTypeOptions.push({'id': Enums.FiltersAction.Reject,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_REJECT')});
'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_REJECT')});
}
if (oModules.vacation)
{
this.actionTypeOptions.push({'id': Enums.FiltersAction.Vacation,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')});
'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')});
}
}
this.actionTypeOptions.push({'id': Enums.FiltersAction.Discard,
'name': Utils.i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD')});
'name': Translator.i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD')});
this.fieldOptions = [
{'id': Enums.FilterConditionField.From, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_FROM')},
{'id': Enums.FilterConditionField.Recipient, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS')},
{'id': Enums.FilterConditionField.Subject, 'name': Utils.i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT')}
];
this.fieldOptions([
{'id': Enums.FilterConditionField.From, 'name': Translator.i18n('POPUPS_FILTER/SELECT_FIELD_FROM')},
{'id': Enums.FilterConditionField.Recipient, 'name': Translator.i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS')},
{'id': Enums.FilterConditionField.Subject, 'name': Translator.i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT')}
]);
this.typeOptions = [
{'id': Enums.FilterConditionType.Contains, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS')},
{'id': Enums.FilterConditionType.NotContains, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS')},
{'id': Enums.FilterConditionType.EqualTo, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO')},
{'id': Enums.FilterConditionType.NotEqualTo, 'name': Utils.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO')}
];
this.typeOptions([
{'id': Enums.FilterConditionType.Contains, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS')},
{'id': Enums.FilterConditionType.NotContains, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS')},
{'id': Enums.FilterConditionType.EqualTo, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO')},
{'id': Enums.FilterConditionType.NotEqualTo, 'name': Translator.i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO')}
]);
};

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
Cache = require('Storage/User/Cache'),
@ -41,7 +42,7 @@
}, this);
this.dangerDescHtml = ko.computed(function () {
return Utils.i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', {
return Translator.i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', {
'FOLDER': this.folderNameForClear()
});
}, this);
@ -77,11 +78,11 @@
{
if (oData && oData.ErrorCode)
{
self.clearingError(Utils.getNotification(oData.ErrorCode));
self.clearingError(Translator.getNotification(oData.ErrorCode));
}
else
{
self.clearingError(Utils.getNotification(Enums.Notification.MailServerError));
self.clearingError(Translator.getNotification(Enums.Notification.MailServerError));
}
}
}, oFolderToClear.fullNameRaw);

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'),
Consts = require('Common/Consts'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote'),
@ -26,8 +27,8 @@
{
AbstractView.call(this, 'Popups', 'PopupsFolderCreate');
Utils.initOnStartOrLangChange(function () {
this.sNoParentText = Utils.i18n('POPUPS_CREATE_FOLDER/SELECT_NO_PARENT');
Translator.initOnStartOrLangChange(function () {
this.sNoParentText = Translator.i18n('POPUPS_CREATE_FOLDER/SELECT_NO_PARENT');
}, this);
this.folderName = ko.observable('');
@ -84,7 +85,7 @@
else
{
Data.folderList.error(
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER'));
oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) : Translator.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER'));
}
}, this.folderName(), sParentFolderName);

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'),
Consts = require('Common/Consts'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'),
@ -27,9 +28,9 @@
{
AbstractView.call(this, 'Popups', 'PopupsFolderSystem');
Utils.initOnStartOrLangChange(function () {
this.sChooseOnText = Utils.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE');
this.sUnuseText = Utils.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME');
Translator.initOnStartOrLangChange(function () {
this.sChooseOnText = Translator.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_CHOOSE_ONE');
this.sUnuseText = Translator.i18n('POPUPS_SYSTEM_FOLDERS/SELECT_UNUSE_NAME');
}, this);
this.notification = ko.observable('');
@ -112,19 +113,19 @@
switch (iNotificationType)
{
case Enums.SetSystemFoldersNotification.Sent:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT');
sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT');
break;
case Enums.SetSystemFoldersNotification.Draft:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS');
sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_DRAFTS');
break;
case Enums.SetSystemFoldersNotification.Spam:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM');
sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SPAM');
break;
case Enums.SetSystemFoldersNotification.Trash:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH');
sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_TRASH');
break;
case Enums.SetSystemFoldersNotification.Archive:
sNotification = Utils.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE');
sNotification = Translator.i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_ARCHIVE');
break;
}

View file

@ -9,6 +9,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/User/Remote'),
Data = require('Storage/User/Data'),
@ -88,12 +89,12 @@
}
else if (oData.ErrorCode)
{
this.submitError(Utils.getNotification(oData.ErrorCode));
this.submitError(Translator.getNotification(oData.ErrorCode));
}
}
else
{
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
}
}, this), this.id, this.email(), this.name(), this.replyTo(), this.bcc());

View file

@ -8,7 +8,6 @@
ko = require('ko'),
Utils = require('Common/Utils'),
Globals = require('Common/Globals'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
@ -22,12 +21,12 @@
{
AbstractView.call(this, 'Popups', 'PopupsLanguages');
this.Data = Globals.__APP__.data(); // TODO
this.UserSettingsStore = require('Stores/UserSettings');
this.exp = ko.observable(false);
this.languages = ko.computed(function () {
return _.map(this.Data.languages(), function (sLanguage) {
return _.map(this.UserSettingsStore.languages(), function (sLanguage) {
return {
'key': sLanguage,
'selected': ko.observable(false),
@ -36,7 +35,7 @@
});
}, this);
this.Data.mainLanguage.subscribe(function () {
this.UserSettingsStore.language.subscribe(function () {
this.resetMainLanguage();
}, this);
@ -54,7 +53,7 @@
LanguagesPopupView.prototype.resetMainLanguage = function ()
{
var sCurrent = this.Data.mainLanguage();
var sCurrent = this.UserSettingsStore.language();
_.each(this.languages(), function (oItem) {
oItem['selected'](oItem['key'] === sCurrent);
});
@ -74,7 +73,7 @@
LanguagesPopupView.prototype.changeLanguage = function (sLang)
{
this.Data.mainLanguage(sLang);
this.UserSettingsStore.language(sLang);
this.cancelCommand();
};

View file

@ -10,6 +10,7 @@
Enums = require('Common/Enums'),
Utils = require('Common/Utils'),
Translator = require('Common/Translator'),
Remote = require('Storage/Admin/Remote'),
@ -99,11 +100,11 @@
this.saveError('');
if (oData && oData.ErrorCode)
{
this.saveError(Utils.getNotification(oData.ErrorCode));
this.saveError(Translator.getNotification(oData.ErrorCode));
}
else
{
this.saveError(Utils.getNotification(Enums.Notification.CantSavePluginSettings));
this.saveError(Translator.getNotification(Enums.Notification.CantSavePluginSettings));
}
}
};
@ -146,7 +147,7 @@
if (!kn.isPopupVisible(PopupsAskViewModel))
{
kn.showScreenPopup(PopupsAskViewModel, [Utils.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
kn.showScreenPopup(PopupsAskViewModel, [Translator.i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), function () {
if (self.modalVisibility())
{
Utils.delegateRun(self, 'cancelCommand');

View file

@ -13,8 +13,12 @@
Utils = require('Common/Utils'),
Links = require('Common/Links'),
Translator = require('Common/Translator'),
Plugins = require('Common/Plugins'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'),
Data = require('Storage/User/Data'),
Remote = require('Storage/User/Remote'),
@ -87,11 +91,12 @@
this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
this.langRequest = ko.observable(false);
this.mainLanguage = Data.mainLanguage;
this.language = UserSettingsStore.language;
this.bSendLanguage = false;
this.mainLanguageFullName = ko.computed(function () {
return Utils.convertLangName(this.mainLanguage());
this.languageFullName = ko.computed(function () {
return Utils.convertLangName(this.language());
}, this);
this.signMeType = ko.observable(Enums.LoginSignMeType.Unused);
@ -133,7 +138,7 @@
Plugins.runHook('user-login-submit', [fSubmitResult]);
if (0 < iPluginResultCode)
{
this.submitError(Utils.getNotification(iPluginResultCode));
this.submitError(Translator.getNotification(iPluginResultCode));
return false;
}
else if ('' !== sPluginResultMessage)
@ -180,11 +185,11 @@
oData.ErrorCode = Enums.Notification.AuthError;
}
this.submitError(Utils.getNotification(oData.ErrorCode));
this.submitError(Translator.getNotification(oData.ErrorCode));
if ('' === this.submitError())
{
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
}
else
{
@ -202,11 +207,11 @@
else
{
this.submitRequest(false);
this.submitError(Utils.getNotification(Enums.Notification.UnknownError));
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
}
}, this), this.email(), '', sPassword, !!this.signMe(),
this.bSendLanguage ? this.mainLanguage() : '',
this.bSendLanguage ? this.language() : '',
this.additionalCode.visibility() ? this.additionalCode() : '',
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
);
@ -302,7 +307,7 @@
if (Settings.settingsGet('UserLanguage'))
{
$.cookie('rllang', Data.language(), {'expires': 30});
$.cookie('rllang', UserSettingsStore.language(), {'expires': 30});
}
}, this), 100);
@ -328,7 +333,7 @@
}
else
{
self.submitError(Utils.getNotification(iErrorCode));
self.submitError(Translator.getNotification(iErrorCode));
}
}
;
@ -371,11 +376,11 @@
}
_.delay(function () {
Data.language.subscribe(function (sValue) {
UserSettingsStore.language.subscribe(function (sValue) {
self.langRequest(true);
Utils.reloadLanguage(sValue, function() {
Translator.reload(sValue, function() {
self.langRequest(false);
self.bSendLanguage = true;
$.cookie('rllang', sValue, {'expires': 30});

View file

@ -15,6 +15,8 @@
Globals = require('Common/Globals'),
Links = require('Common/Links'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'),
Cache = require('Storage/User/Cache'),
Data = require('Storage/User/Data'),
@ -88,7 +90,7 @@
if (oFolder)
{
if (Enums.Layout.NoPreview === Data.layout())
if (Enums.Layout.NoPreview === UserSettingsStore.layout())
{
Data.message(null);
}

View file

@ -18,6 +18,10 @@
Links = require('Common/Links'),
Events = require('Common/Events'),
Selector = require('Common/Selector'),
Translator = require('Common/Translator'),
QuotaStore = require('Stores/Quota'),
UserSettingsStore = require('Stores/UserSettings'),
Settings = require('Storage/Settings'),
Cache = require('Storage/User/Cache'),
@ -63,13 +67,13 @@
this.messageListCheckedOrSelectedUidsWithSubMails = Data.messageListCheckedOrSelectedUidsWithSubMails;
this.messageListCompleteLoadingThrottle = Data.messageListCompleteLoadingThrottle;
Utils.initOnStartOrLangChange(function () {
this.emptySubjectValue = Utils.i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT');
Translator.initOnStartOrLangChange(function () {
this.emptySubjectValue = Translator.i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT');
}, this);
this.userQuota = Data.userQuota;
this.userUsageSize = Data.userUsageSize;
this.userUsageProc = Data.userUsageProc;
this.userQuota = QuotaStore.quota;
this.userUsageSize = QuotaStore.usage;
this.userUsageProc = QuotaStore.percentage;
this.moveDropdownTrigger = ko.observable(false);
this.moreDropdownTrigger = ko.observable(false);
@ -81,13 +85,13 @@
this.dragOverBodyArea = ko.observable(null);
this.messageListItemTemplate = ko.computed(function () {
return Enums.Layout.SidePreview === Data.layout() ?
return Enums.Layout.SidePreview === UserSettingsStore.layout() ?
'MailMessageListItem' : 'MailMessageListItemNoPreviewPane';
});
this.messageListSearchDesc = ko.computed(function () {
var sValue = Data.messageListEndSearch();
return '' === sValue ? '' : Utils.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue});
return '' === sValue ? '' : Translator.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue});
});
this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(Data.messageListPage, Data.messageListPageCount));
@ -227,7 +231,7 @@
Data.message(Data.staticMessageList.populateByMessageListItem(oMessage));
this.populateMessageBody(Data.message());
if (Enums.Layout.NoPreview === Data.layout())
if (Enums.Layout.NoPreview === UserSettingsStore.layout())
{
kn.setHash(Links.messagePreview(), true);
Data.message.focused(true);
@ -247,11 +251,11 @@
this.selector.scrollToTop();
}, this);
Data.layout.subscribe(function (mValue) {
UserSettingsStore.layout.subscribe(function (mValue) {
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
}, this);
Data.layout.valueHasMutated();
UserSettingsStore.layout.valueHasMutated();
Events
.sub('mailbox.message-list.selector.go-down', function () {
@ -360,8 +364,8 @@
{
Data.message(null);
Data.messageError((oData && oData.ErrorCode ?
Utils.getNotification(oData.ErrorCode) :
Utils.getNotification(Enums.Notification.UnknownError)));
Translator.getNotification(oData.ErrorCode) :
Translator.getNotification(Enums.Notification.UnknownError)));
}
};
@ -869,7 +873,7 @@
MessageListMailBoxUserView.prototype.quotaTooltip = function ()
{
return Utils.i18n('MESSAGE_LIST/QUOTA_SIZE', {
return Translator.i18n('MESSAGE_LIST/QUOTA_SIZE', {
'SIZE': Utils.friendlySize(this.userUsageSize()),
'PROC': this.userUsageProc(),
'LIMIT': Utils.friendlySize(this.userQuota())

View file

@ -17,6 +17,9 @@
Globals = require('Common/Globals'),
Utils = require('Common/Utils'),
Events = require('Common/Events'),
Translator = require('Common/Translator'),
UserSettingsStore = require('Stores/UserSettings'),
Local = require('Storage/Local'),
Cache = require('Storage/User/Cache'),
@ -61,8 +64,8 @@
this.messagesBodiesDom = Data.messagesBodiesDom;
this.useThreads = Data.useThreads;
this.replySameFolder = Data.replySameFolder;
this.layout = Data.layout;
this.usePreviewPane = Data.usePreviewPane;
this.layout = UserSettingsStore.layout;
this.usePreviewPane = UserSettingsStore.usePreviewPane;
this.isMessageSelected = Data.isMessageSelected;
this.messageActiveDom = Data.messageActiveDom;
this.messageError = Data.messageError;
@ -329,19 +332,19 @@
switch (this.viewPgpSignedVerifyStatus())
{
case Enums.SignedVerifyStatus.UnknownPublicKeys:
sResult = Utils.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND');
sResult = Translator.i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND');
break;
case Enums.SignedVerifyStatus.UnknownPrivateKey:
sResult = Utils.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND');
sResult = Translator.i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND');
break;
case Enums.SignedVerifyStatus.Unverified:
sResult = Utils.i18n('PGP_NOTIFICATIONS/UNVERIFIRED_SIGNATURE');
sResult = Translator.i18n('PGP_NOTIFICATIONS/UNVERIFIRED_SIGNATURE');
break;
case Enums.SignedVerifyStatus.Error:
sResult = Utils.i18n('PGP_NOTIFICATIONS/DECRYPTION_ERROR');
sResult = Translator.i18n('PGP_NOTIFICATIONS/DECRYPTION_ERROR');
break;
case Enums.SignedVerifyStatus.Success:
sResult = Utils.i18n('PGP_NOTIFICATIONS/GOOD_SIGNATURE', {
sResult = Translator.i18n('PGP_NOTIFICATIONS/GOOD_SIGNATURE', {
'USER': this.viewPgpSignedVerifyUser()
});
break;
@ -382,7 +385,7 @@
{
var
self = this,
sErrorMessage = Utils.i18n('PREVIEW_POPUP/IMAGE_ERROR'),
sErrorMessage = Translator.i18n('PREVIEW_POPUP/IMAGE_ERROR'),
fCheckHeaderHeight = function () {
if (self.oHeaderDom)
{
@ -561,7 +564,7 @@
{
this.fullScreenMode(false);
}
else if (Enums.Layout.NoPreview === Data.layout())
else if (Enums.Layout.NoPreview === this.layout())
{
this.message(null);
}
@ -590,7 +593,7 @@
});
key('enter', Enums.KeyState.MessageList, function () {
if (Enums.Layout.NoPreview !== Data.layout() && self.message())
if (Enums.Layout.NoPreview !== self.layout() && self.message())
{
self.toggleFullScreen();
return false;
@ -681,7 +684,7 @@
// change focused state
key('tab, shift+tab, left', Enums.KeyState.MessageView, function (event, handler) {
if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== Data.layout())
if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== self.layout())
{
if (event && handler && 'left' === handler.shortcut)
{
@ -697,7 +700,7 @@
self.message.focused(false);
}
}
else if (self.message() && Enums.Layout.NoPreview === Data.layout() && event && handler && 'left' === handler.shortcut)
else if (self.message() && Enums.Layout.NoPreview === self.layout() && event && handler && 'left' === handler.shortcut)
{
return true;
}
@ -856,8 +859,8 @@
{
Remote.sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
oMessage.readReceipt(),
Utils.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}),
Utils.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': Data.accountEmail()}));
Translator.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}),
Translator.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': Data.accountEmail()}));
oMessage.isReadReceipt(true);

3
dev/bootstrap.js vendored
View file

@ -14,6 +14,7 @@
Plugins = require('Common/Plugins'),
Utils = require('Common/Utils'),
Enums = require('Common/Enums'),
Translator = require('Common/Translator'),
EmailModel = require('Model/Email')
;
@ -37,12 +38,12 @@
// export
window['rl'] = window['rl'] || {};
window['rl']['i18n'] = _.bind(Translator.i18n, Translator);
window['rl']['addHook'] = _.bind(Plugins.addHook, Plugins);
window['rl']['settingsGet'] = _.bind(Plugins.mainSettingsGet, Plugins);
window['rl']['remoteRequest'] = _.bind(Plugins.remoteRequest, Plugins);
window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins);
window['rl']['createCommand'] = Utils.createCommand;
window['rl']['i18n'] = Utils.i18n;
window['rl']['EmailModel'] = EmailModel;
window['rl']['Enums'] = Enums;

View file

@ -1233,6 +1233,7 @@ class Actions
$aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false);
$aResult['DropboxApiKey'] = \trim($oConfig->Get('social', 'dropbox_api_key', ''));
if (!$aResult['AllowDropboxSocial'])
{
$aResult['DropboxApiKey'] = '';
@ -1288,7 +1289,6 @@ class Actions
$aResult['TwitterConsumerKey'] = (string) $oConfig->Get('social', 'twitter_consumer_key', '');
$aResult['TwitterConsumerSecret'] = (string) $oConfig->Get('social', 'twitter_consumer_secret', '');
$aResult['AllowDropboxSocial'] = (bool) $oConfig->Get('social', 'dropbox_enable', false);
$aResult['DropboxApiKey'] = (string) $oConfig->Get('social', 'dropbox_api_key', '');

View file

@ -20,9 +20,9 @@
<div class="controls">
<div class="flag-selector">
<span class="flag-wrapper">
<span data-bind="css: 'flag flag-' + mainLanguage()" style=""></span>
<span data-bind="css: 'flag flag-' + language()" style=""></span>
</span>
<span class="flag-name" data-bind="text: mainLanguageFullName, click: selectLanguage"></span>
<span class="flag-name" data-bind="text: languageFullName, click: selectLanguage"></span>
&nbsp;&nbsp;
<div data-bind="component: {
name: 'SaveTrigger',
@ -40,7 +40,7 @@
name: 'Select',
params: {
options: themesOptions,
value: mainTheme,
value: theme,
trigger: themeTrigger,
optionsText: 'optText',
optionsValue: 'optValue',

View file

@ -21,22 +21,22 @@
<div data-bind="component: {
name: 'Checkbox',
params: {
value: googleEnable.auth,
value: googleEnableAuth,
label: 'Authentication'
}
}"></div>
<div data-bind="component: {
name: 'Checkbox',
params: {
value: googleEnable.drive,
value: googleEnableDrive,
label: 'Google Drive Integration (Compose view)'
}
}"></div>
<div data-bind="component: {
name: 'Checkbox',
params: {
value: googleEnable.preview,
label: 'Google Viewer Integration (Preview Microsoft Word, Excel and PowerPoint files)'
value: googleEnablePreview,
label: 'Google Viewer Integration (Preview for Microsoft Word, Excel and PowerPoint files)'
}
}"></div>
</blockquote>
@ -54,7 +54,7 @@
name: 'xx',
value: googleClientID,
trigger: googleTrigger1,
enable: googleEnable.requireClientSettings,
enable: googleEnableRequireClientSettings,
size: 5
}
}"></div>
@ -70,7 +70,7 @@
params: {
value: googleClientSecret,
trigger: googleTrigger2,
enable: googleEnable.requireClientSettings,
enable: googleEnableRequireClientSettings,
size: 5
}
}"></div>
@ -88,7 +88,7 @@
value: googleApiKey,
trigger: googleTrigger3,
size: 5,
enable: googleEnable.requireApiKey
enable: googleEnableRequireApiKey
}
}"></div>
<blockquote style="margin-top: 10px; margin-bottom: 0">

View file

@ -106,7 +106,7 @@
<label class="flag-selector">
<i data-bind="css: langRequest() ? 'icon-spinner animated' : 'icon-world'"></i>
&nbsp;
<span class="flag-name" data-bind="text: mainLanguageFullName, click: selectLanguage"></span>
<span class="flag-name" data-bind="text: languageFullName, click: selectLanguage"></span>
</label>
</div>
</div>

View file

@ -10,9 +10,9 @@
<div class="controls">
<div class="flag-selector">
<span class="flag-wrapper">
<span data-bind="css: 'flag flag-' + mainLanguage()" style=""></span>
<span data-bind="css: 'flag flag-' + language()" style=""></span>
</span>
<span class="flag-name" data-bind="text: mainLanguageFullName, click: selectLanguage"></span>
<span class="flag-name" data-bind="text: languageFullName, click: selectLanguage"></span>
&nbsp;&nbsp;
<div data-bind="component: {
name: 'SaveTrigger',
@ -66,8 +66,8 @@
name: 'Select',
params: {
label: 'SETTINGS_GENERAL/LABEL_MESSAGE_PER_PAGE',
options: mainMessagesPerPageArray,
value: mainMessagesPerPage,
options: messagesPerPageArray,
value: messagesPerPage,
trigger: mppTrigger,
size: 2,
width: 70
@ -108,24 +108,24 @@
</div>
</div>
</div>
<div class="form-horizontal" data-bind="visible: isDesktopNotificationsSupported()">
<div class="form-horizontal" data-bind="visible: isDesktopNotificationSupported">
<div class="legend">
<span class="i18n i18n-animation" data-i18n-text="SETTINGS_GENERAL/LABEL_CHROME_NOTIFICATION"></span>
</div>
<div class="control-group">
<div class="controls">
<div data-bind="visible: isDesktopNotificationsSupported">
<div data-bind="visible: isDesktopNotificationSupported">
<div data-bind="component: {
name: 'Checkbox',
params: {
label: 'SETTINGS_GENERAL/LABEL_CHROME_NOTIFICATION_DESC',
value: useDesktopNotifications,
disable: isDesktopNotificationsDenied,
value: enableDesktopNotification,
disable: isDesktopNotificationDenied,
inline: true
}
}"></div>
&nbsp;
<span data-bind="visible: isDesktopNotificationsDenied">
<span data-bind="visible: isDesktopNotificationDenied">
<span class="i18n" style="color: #999" data-i18n-text="SETTINGS_GENERAL/LABEL_CHROME_NOTIFICATION_DESC_DENIED"></span>
</span>
</div>

View file

@ -1,5 +1,5 @@
<div class="b-settings-social g-ui-user-select-none">
<div class="form-horizontal" data-bind="visible: googleEnable() && googleEnable.auth()">
<div class="form-horizontal" data-bind="visible: googleEnable() && googleEnableAuth()">
<div class="legend">
<span class="i18n" data-i18n-text="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span>
</div>

View file

@ -10,7 +10,7 @@
</div>
</div>
<div class="b-themes-list" data-bind="foreach: themesObjects">
<div class="e-item" data-bind="click: function () { $root.mainTheme(name); }, css: { 'selected': selected }">
<div class="e-item" data-bind="click: function () { $root.theme(name); }, css: { 'selected': selected }">
<div class="e-name" data-bind="text: nameDisplay"></div>
<img class="e-image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB/AAffA0nNPuCLAAAAAElFTkSuQmCC" data-bind="attr: { 'src': themePreviewSrc }" />
</div>