CommonJS (research/3)

This commit is contained in:
RainLoop Team 2014-08-22 19:08:56 +04:00
parent 586abbb802
commit 06bb124379
99 changed files with 51037 additions and 42961 deletions

View file

@ -14,8 +14,15 @@
Utils = require('../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
PopupsKeyboardShortcutsHelpViewModel = require('../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js'),
PopupsAddAccountViewModel = require('../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
;
@ -28,15 +35,13 @@
{
KnoinAbstractViewModel.call(this, 'Right', 'SystemDropDown');
var oData = RL.data();
this.accounts = oData.accounts;
this.accountEmail = oData.accountEmail;
this.accountsLoading = oData.accountsLoading;
this.accounts = Data.accounts;
this.accountEmail = Data.accountEmail;
this.accountsLoading = Data.accountsLoading;
this.accountMenuDropdownTrigger = ko.observable(false);
this.capaAdditionalAccounts = RL.capa(Enums.Capa.AdditionalAccounts);
this.capaAdditionalAccounts = AppSettings.capa(Enums.Capa.AdditionalAccounts);
this.loading = ko.computed(function () {
return this.accountsLoading();
@ -63,7 +68,7 @@
AbstractSystemDropDownViewModel.prototype.emailTitle = function ()
{
return RL.data().accountEmail();
return Data.accountEmail();
};
AbstractSystemDropDownViewModel.prototype.settingsClick = function ()
@ -92,7 +97,7 @@
window.__rlah_clear();
}
RL.loginAndLogoutReload(true, RL.settingsGet('ParentEmail') && 0 < RL.settingsGet('ParentEmail').length);
RL.loginAndLogoutReload(true, AppSettings.settingsGet('ParentEmail') && 0 < AppSettings.settingsGet('ParentEmail').length);
});
};
@ -116,6 +121,6 @@
});
};
module.exports = new AbstractSystemDropDownViewModel();
module.exports = AbstractSystemDropDownViewModel;
}(module));

View file

@ -12,6 +12,8 @@
Utils = require('../Common/Utils.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
RL = require('../Boots/AdminApp.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
@ -116,6 +118,6 @@
this.submitCommand();
};
module.exports = new AdminLoginViewModel();
module.exports = AdminLoginViewModel;
}(module));

View file

@ -5,7 +5,8 @@
'use strict';
var
kn = require('../External/kn.js'),
kn = require('../Knoin/Knoin.js'),
Globals = require('../Common/Globals.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
;
@ -19,7 +20,7 @@
{
KnoinAbstractViewModel.call(this, 'Left', 'AdminMenu');
this.leftPanelDisabled = RL.data().leftPanelDisabled;
this.leftPanelDisabled = Globals.leftPanelDisabled;
this.menu = oScreen.menu;
@ -33,6 +34,6 @@
return '#/' + sRoute;
};
module.exports = new AdminMenuViewModel();
module.exports = AdminMenuViewModel;
}(module));

View file

@ -7,7 +7,11 @@
var
ko = require('../External/ko.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/AdminDataStorage.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
RL = require('../Boots/AdminApp.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
@ -21,10 +25,10 @@
{
KnoinAbstractViewModel.call(this, 'Right', 'AdminPane');
this.adminDomain = ko.observable(RL.settingsGet('AdminDomain'));
this.version = ko.observable(RL.settingsGet('Version'));
this.adminDomain = ko.observable(AppSettings.settingsGet('AdminDomain'));
this.version = ko.observable(AppSettings.settingsGet('Version'));
this.adminManLoadingVisibility = RL.data().adminManLoadingVisibility;
this.adminManLoadingVisibility = Data.adminManLoadingVisibility;
kn.constructorEnd(this);
}
@ -38,6 +42,6 @@
});
};
module.exports = new AdminPaneViewModel();
module.exports = AdminPaneViewModel;
}(module));

View file

@ -14,10 +14,16 @@
Enums = require('../Common/Enums.js'),
LinkBuilder = require('../Common/LinkBuilder.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js'),
PopupsLanguagesViewModel = require('../ViewModels/Popups/PopupsLanguagesViewModel.js')
;
/**
@ -28,8 +34,6 @@
{
KnoinAbstractViewModel.call(this, 'Center', 'Login');
var oData = RL.data();
this.email = ko.observable('');
this.password = ko.observable('');
this.signMe = ko.observable(false);
@ -40,9 +44,9 @@
this.additionalCode.visibility = ko.observable(false);
this.additionalCodeSignMe = ko.observable(false);
this.logoImg = Utils.trim(RL.settingsGet('LoginLogo'));
this.loginDescription = Utils.trim(RL.settingsGet('LoginDescription'));
this.logoCss = Utils.trim(RL.settingsGet('LoginCss'));
this.logoImg = Utils.trim(AppSettings.settingsGet('LoginLogo'));
this.loginDescription = Utils.trim(AppSettings.settingsGet('LoginDescription'));
this.logoCss = Utils.trim(AppSettings.settingsGet('LoginCss'));
this.emailError = ko.observable(false);
this.passwordError = ko.observable(false);
@ -71,10 +75,10 @@
this.submitRequest = ko.observable(false);
this.submitError = ko.observable('');
this.allowLanguagesOnLogin = oData.allowLanguagesOnLogin;
this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
this.langRequest = ko.observable(false);
this.mainLanguage = oData.mainLanguage;
this.mainLanguage = Data.mainLanguage;
this.bSendLanguage = false;
this.mainLanguageFullName = ko.computed(function () {
@ -164,7 +168,7 @@
}, this)
;
if (!!RL.settingsGet('UseRsaEncryption') && Utils.rsaEncode.supported)
if (!!AppSettings.settingsGet('UseRsaEncryption') && Utils.rsaEncode.supported)
{
Remote.getPublicKey(_.bind(function (sResult, oData) {
@ -203,7 +207,8 @@
this.facebookCommand = Utils.createCommand(this, function () {
window.open(LinkBuilder.socialFacebook(), 'Facebook', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
window.open(LinkBuilder.socialFacebook(), 'Facebook',
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true;
}, function () {
@ -214,7 +219,8 @@
this.googleCommand = Utils.createCommand(this, function () {
window.open(LinkBuilder.socialGoogle(), 'Google', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
window.open(LinkBuilder.socialGoogle(), 'Google',
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true;
}, function () {
@ -225,7 +231,8 @@
this.twitterCommand = Utils.createCommand(this, function () {
window.open(LinkBuilder.socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
window.open(LinkBuilder.socialTwitter(), 'Twitter',
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true;
}, function () {
@ -262,9 +269,9 @@
this.emailFocus(true);
}
if (RL.settingsGet('UserLanguage'))
if (AppSettings.settingsGet('UserLanguage'))
{
$.cookie('rllang', RL.data().language(), {'expires': 30});
$.cookie('rllang', Data.language(), {'expires': 30});
}
}, this), 100);
@ -280,7 +287,7 @@
{
var
self = this,
sJsHash = RL.settingsGet('JsHash'),
sJsHash = AppSettings.settingsGet('JsHash'),
fSocial = function (iErrorCode) {
iErrorCode = Utils.pInt(iErrorCode);
if (0 === iErrorCode)
@ -295,11 +302,11 @@
}
;
this.facebookLoginEnabled(!!RL.settingsGet('AllowFacebookSocial'));
this.twitterLoginEnabled(!!RL.settingsGet('AllowTwitterSocial'));
this.googleLoginEnabled(!!RL.settingsGet('AllowGoogleSocial'));
this.facebookLoginEnabled(!!AppSettings.settingsGet('AllowFacebookSocial'));
this.twitterLoginEnabled(!!AppSettings.settingsGet('AllowTwitterSocial'));
this.googleLoginEnabled(!!AppSettings.settingsGet('AllowGoogleSocial'));
switch ((RL.settingsGet('SignMe') || 'unused').toLowerCase())
switch ((AppSettings.settingsGet('SignMe') || 'unused').toLowerCase())
{
case Enums.LoginSignMeTypeAsString.DefaultOff:
this.signMeType(Enums.LoginSignMeType.DefaultOff);
@ -313,8 +320,8 @@
break;
}
this.email(RL.data().devEmail);
this.password(RL.data().devPassword);
this.email(Data.devEmail);
this.password(Data.devPassword);
if (this.googleLoginEnabled())
{
@ -332,7 +339,7 @@
}
_.delay(function () {
RL.data().language.subscribe(function (sValue) {
Data.language.subscribe(function (sValue) {
self.langRequest(true);
$.ajax({
'url': LinkBuilder.langLink(sValue),
@ -341,7 +348,7 @@
}).done(function() {
self.bSendLanguage = true;
Utils.i18nReload();
$.cookie('rllang', RL.data().language(), {'expires': 30});
$.cookie('rllang', Data.language(), {'expires': 30});
}).always(function() {
self.langRequest(false);
});
@ -361,6 +368,6 @@
kn.showScreenPopup(PopupsLanguagesViewModel);
};
module.exports = new LoginViewModel();
module.exports = LoginViewModel;
}(module));

View file

@ -13,9 +13,18 @@
Utils = require('../Common/Utils.js'),
Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'),
LinkBuilder = require('../Common/LinkBuilder.js'),
AppSettings = require('../Storages/AppSettings.js'),
Cache = require('../Storages/WebMailCacheStorage.js'),
Data = require('../Storages/WebMailDataStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
PopupsComposeViewModel = require('./Popups/PopupsComposeViewModel.js'),
PopupsFolderCreateViewModel = require('./Popups/PopupsFolderCreateViewModel.js'),
PopupsContactsViewModel = require('./Popups/PopupsContactsViewModel.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
@ -29,21 +38,19 @@
{
KnoinAbstractViewModel.call(this, 'Left', 'MailFolderList');
var oData = RL.data();
this.oContentVisible = null;
this.oContentScrollable = null;
this.messageList = oData.messageList;
this.folderList = oData.folderList;
this.folderListSystem = oData.folderListSystem;
this.foldersChanging = oData.foldersChanging;
this.messageList = Data.messageList;
this.folderList = Data.folderList;
this.folderListSystem = Data.folderListSystem;
this.foldersChanging = Data.foldersChanging;
this.leftPanelDisabled = oData.leftPanelDisabled;
this.leftPanelDisabled = Globals.leftPanelDisabled;
this.iDropOverTimer = 0;
this.allowContacts = !!RL.settingsGet('ContactsIsAllowed');
this.allowContacts = !!AppSettings.settingsGet('ContactsIsAllowed');
kn.constructorEnd(this);
}
@ -68,7 +75,7 @@
if (oFolder && oEvent)
{
bCollapsed = oFolder.collapsed();
Utils.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
RL.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
oFolder.collapsed(!bCollapsed);
oEvent.preventDefault();
@ -80,18 +87,17 @@
oEvent.preventDefault();
var
oData = RL.data(),
oFolder = ko.dataFor(this)
;
if (oFolder)
{
if (Enums.Layout.NoPreview === oData.layout())
if (Enums.Layout.NoPreview === Data.layout())
{
oData.message(null);
Data.message(null);
}
if (oFolder.fullNameRaw === oData.currentFolderFullNameRaw())
if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw())
{
Cache.setFolderHash(oFolder.fullNameRaw, '');
}
@ -152,7 +158,7 @@
if (oFolder)
{
bCollapsed = oFolder.collapsed();
Utils.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
RL.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
oFolder.collapsed(!bCollapsed);
}
}
@ -181,7 +187,7 @@
{
this.iDropOverTimer = window.setTimeout(function () {
oFolder.collapsed(false);
Utils.setExpandedFolder(oFolder.fullNameHash, true);
RL.setExpandedFolder(oFolder.fullNameHash, true);
Utils.windowResize();
}, 500);
}
@ -269,6 +275,6 @@
}
};
module.exports = new MailBoxFolderListViewModel();
module.exports = MailBoxFolderListViewModel;
}(module));

View file

@ -17,10 +17,16 @@
Consts = require('../Common/Consts.js'),
Globals = require('../Common/Globals.js'),
LinkBuilder = require('../Common/LinkBuilder.js'),
Events = require('../Common/Events.js'),
Selector = require('../Common/Selector.js'),
AppSettings = require('../Storages/AppSettings.js'),
Cache = require('../Storages/WebMailCacheStorage.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js'),
@ -39,38 +45,36 @@
this.bPrefetch = false;
this.emptySubjectValue = '';
this.hideDangerousActions = !!RL.settingsGet('HideDangerousActions');
this.hideDangerousActions = !!AppSettings.settingsGet('HideDangerousActions');
var oData = RL.data();
this.popupVisibility = Globals.popupVisibility;
this.popupVisibility = RL.popupVisibility;
this.message = Data.message;
this.messageList = Data.messageList;
this.folderList = Data.folderList;
this.currentMessage = Data.currentMessage;
this.isMessageSelected = Data.isMessageSelected;
this.messageListSearch = Data.messageListSearch;
this.messageListError = Data.messageListError;
this.folderMenuForMove = Data.folderMenuForMove;
this.message = oData.message;
this.messageList = oData.messageList;
this.folderList = oData.folderList;
this.currentMessage = oData.currentMessage;
this.isMessageSelected = oData.isMessageSelected;
this.messageListSearch = oData.messageListSearch;
this.messageListError = oData.messageListError;
this.folderMenuForMove = oData.folderMenuForMove;
this.useCheckboxesInList = Data.useCheckboxesInList;
this.useCheckboxesInList = oData.useCheckboxesInList;
this.mainMessageListSearch = Data.mainMessageListSearch;
this.messageListEndFolder = Data.messageListEndFolder;
this.mainMessageListSearch = oData.mainMessageListSearch;
this.messageListEndFolder = oData.messageListEndFolder;
this.messageListChecked = oData.messageListChecked;
this.messageListCheckedOrSelected = oData.messageListCheckedOrSelected;
this.messageListCheckedOrSelectedUidsWithSubMails = oData.messageListCheckedOrSelectedUidsWithSubMails;
this.messageListCompleteLoadingThrottle = oData.messageListCompleteLoadingThrottle;
this.messageListChecked = Data.messageListChecked;
this.messageListCheckedOrSelected = Data.messageListCheckedOrSelected;
this.messageListCheckedOrSelectedUidsWithSubMails = Data.messageListCheckedOrSelectedUidsWithSubMails;
this.messageListCompleteLoadingThrottle = Data.messageListCompleteLoadingThrottle;
Utils.initOnStartOrLangChange(function () {
this.emptySubjectValue = Utils.i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT');
}, this);
this.userQuota = oData.userQuota;
this.userUsageSize = oData.userUsageSize;
this.userUsageProc = oData.userUsageProc;
this.userQuota = Data.userQuota;
this.userUsageSize = Data.userUsageSize;
this.userUsageProc = Data.userUsageProc;
this.moveDropdownTrigger = ko.observable(false);
this.moreDropdownTrigger = ko.observable(false);
@ -82,25 +86,25 @@
this.dragOverBodyArea = ko.observable(null);
this.messageListItemTemplate = ko.computed(function () {
return Enums.Layout.NoPreview !== oData.layout() ?
return Enums.Layout.NoPreview !== Data.layout() ?
'MailMessageListItem' : 'MailMessageListItemNoPreviewPane';
});
this.messageListSearchDesc = ko.computed(function () {
var sValue = oData.messageListEndSearch();
var sValue = Data.messageListEndSearch();
return '' === sValue ? '' : Utils.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue});
});
this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(oData.messageListPage, oData.messageListPageCount));
this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(Data.messageListPage, Data.messageListPageCount));
this.checkAll = ko.computed({
'read': function () {
return 0 < RL.data().messageListChecked().length;
return 0 < Data.messageListChecked().length;
},
'write': function (bValue) {
bValue = !!bValue;
_.each(RL.data().messageList(), function (oMessage) {
_.each(Data.messageList(), function (oMessage) {
oMessage.checked(bValue);
});
}
@ -119,8 +123,8 @@
this.isIncompleteChecked = ko.computed(function () {
var
iM = RL.data().messageList().length,
iC = RL.data().messageListChecked().length
iM = Data.messageList().length,
iC = Data.messageListChecked().length
;
return 0 < iM && 0 < iC && iM > iC;
}, this);
@ -134,82 +138,82 @@
}, this);
this.isSpamFolder = ko.computed(function () {
return oData.spamFolder() === this.messageListEndFolder() &&
'' !== oData.spamFolder();
return Data.spamFolder() === this.messageListEndFolder() &&
'' !== Data.spamFolder();
}, this);
this.isSpamDisabled = ko.computed(function () {
return Consts.Values.UnuseOptionValue === oData.spamFolder();
return Consts.Values.UnuseOptionValue === Data.spamFolder();
}, this);
this.isTrashFolder = ko.computed(function () {
return oData.trashFolder() === this.messageListEndFolder() &&
'' !== oData.trashFolder();
return Data.trashFolder() === this.messageListEndFolder() &&
'' !== Data.trashFolder();
}, this);
this.isDraftFolder = ko.computed(function () {
return oData.draftFolder() === this.messageListEndFolder() &&
'' !== oData.draftFolder();
return Data.draftFolder() === this.messageListEndFolder() &&
'' !== Data.draftFolder();
}, this);
this.isSentFolder = ko.computed(function () {
return oData.sentFolder() === this.messageListEndFolder() &&
'' !== oData.sentFolder();
return Data.sentFolder() === this.messageListEndFolder() &&
'' !== Data.sentFolder();
}, this);
this.isArchiveFolder = ko.computed(function () {
return oData.archiveFolder() === this.messageListEndFolder() &&
'' !== oData.archiveFolder();
return Data.archiveFolder() === this.messageListEndFolder() &&
'' !== Data.archiveFolder();
}, this);
this.isArchiveDisabled = ko.computed(function () {
return Consts.Values.UnuseOptionValue === RL.data().archiveFolder();
return Consts.Values.UnuseOptionValue === Data.archiveFolder();
}, this);
this.canBeMoved = this.hasCheckedOrSelectedLines;
this.clearCommand = Utils.createCommand(this, function () {
kn.showScreenPopup(PopupsFolderClearViewModel, [RL.data().currentFolder()]);
kn.showScreenPopup(PopupsFolderClearViewModel, [Data.currentFolder()]);
});
this.multyForwardCommand = Utils.createCommand(this, function () {
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.ForwardAsAttachment, RL.data().messageListCheckedOrSelected()]);
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.ForwardAsAttachment, Data.messageListCheckedOrSelected()]);
}, this.canBeMoved);
this.deleteWithoutMoveCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
RL.data().currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), false);
Data.currentFolderFullNameRaw(),
Data.messageListCheckedOrSelectedUidsWithSubMails(), false);
}, this.canBeMoved);
this.deleteCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
RL.data().currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
Data.currentFolderFullNameRaw(),
Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved);
this.archiveCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Archive,
RL.data().currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
Data.currentFolderFullNameRaw(),
Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved);
this.spamCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Spam,
RL.data().currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
Data.currentFolderFullNameRaw(),
Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved);
this.notSpamCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.NotSpam,
RL.data().currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true);
Data.currentFolderFullNameRaw(),
Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved);
this.moveCommand = Utils.createCommand(this, Utils.emptyFunction, this.canBeMoved);
this.reloadCommand = Utils.createCommand(this, function () {
if (!RL.data().messageListCompleteLoadingThrottle())
if (!Data.messageListCompleteLoadingThrottle())
{
RL.reloadMessageList(false, true);
}
@ -224,18 +228,18 @@
this.selector.on('onItemSelect', _.bind(function (oMessage) {
if (oMessage)
{
oData.message(oData.staticMessageList.populateByMessageListItem(oMessage));
this.populateMessageBody(oData.message());
Data.message(Data.staticMessageList.populateByMessageListItem(oMessage));
this.populateMessageBody(Data.message());
if (Enums.Layout.NoPreview === oData.layout())
if (Enums.Layout.NoPreview === Data.layout())
{
kn.setHash(LinkBuilder.messagePreview(), true);
oData.message.focused(true);
Data.message.focused(true);
}
}
else
{
oData.message(null);
Data.message(null);
}
}, this));
@ -243,17 +247,17 @@
return oMessage ? oMessage.generateUid() : '';
});
oData.messageListEndHash.subscribe(function () {
Data.messageListEndHash.subscribe(function () {
this.selector.scrollToTop();
}, this);
oData.layout.subscribe(function (mValue) {
Data.layout.subscribe(function (mValue) {
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
}, this);
oData.layout.valueHasMutated();
Data.layout.valueHasMutated();
RL
Events
.sub('mailbox.message-list.selector.go-down', function () {
this.selector.goDown(true);
}, this)
@ -302,8 +306,8 @@
if (this.canBeMoved())
{
RL.moveMessagesToFolder(
RL.data().currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), sToFolderFullNameRaw, bCopy);
Data.currentFolderFullNameRaw(),
Data.messageListCheckedOrSelectedUidsWithSubMails(), sToFolderFullNameRaw, bCopy);
}
return false;
@ -318,15 +322,15 @@
var
oEl = Utils.draggeblePlace(),
aUids = RL.data().messageListCheckedOrSelectedUidsWithSubMails()
aUids = Data.messageListCheckedOrSelectedUidsWithSubMails()
;
oEl.data('rl-folder', RL.data().currentFolderFullNameRaw());
oEl.data('rl-folder', Data.currentFolderFullNameRaw());
oEl.data('rl-uids', aUids);
oEl.find('.text').text('' + aUids.length);
_.defer(function () {
var aUids = RL.data().messageListCheckedOrSelectedUidsWithSubMails();
var aUids = Data.messageListCheckedOrSelectedUidsWithSubMails();
oEl.data('rl-uids', aUids);
oEl.find('.text').text('' + aUids.length);
@ -342,24 +346,22 @@
*/
MailBoxMessageListViewModel.prototype.onMessageResponse = function (sResult, oData, bCached)
{
var oRainLoopData = RL.data();
oRainLoopData.hideMessageBodies();
oRainLoopData.messageLoading(false);
Data.hideMessageBodies();
Data.messageLoading(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
oRainLoopData.setMessage(oData, bCached);
Data.setMessage(oData, bCached);
}
else if (Enums.StorageResultType.Unload === sResult)
{
oRainLoopData.message(null);
oRainLoopData.messageError('');
Data.message(null);
Data.messageError('');
}
else if (Enums.StorageResultType.Abort !== sResult)
{
oRainLoopData.message(null);
oRainLoopData.messageError((oData && oData.ErrorCode ?
Data.message(null);
Data.messageError((oData && oData.ErrorCode ?
Utils.getNotification(oData.ErrorCode) :
Utils.getNotification(Enums.Notification.UnknownError)));
}
@ -371,7 +373,7 @@
{
if (Remote.message(this.onMessageResponse, oMessage.folderFullNameRaw, oMessage.uid))
{
RL.data().messageLoading(true);
Data.messageLoading(true);
}
else
{
@ -395,7 +397,7 @@
if (Utils.isUnd(aMessages))
{
aMessages = RL.data().messageListChecked();
aMessages = Data.messageListChecked();
}
aUids = _.map(aMessages, function (oMessage) {
@ -470,7 +472,7 @@
{
var
oFolder = null,
aMessages = RL.data().messageList()
aMessages = Data.messageList()
;
if ('' !== sFolderFullNameRaw)
@ -516,27 +518,27 @@
MailBoxMessageListViewModel.prototype.listSetSeen = function ()
{
this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen, RL.data().messageListCheckedOrSelected());
this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen, Data.messageListCheckedOrSelected());
};
MailBoxMessageListViewModel.prototype.listSetAllSeen = function ()
{
this.setActionForAll(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen);
this.setActionForAll(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen);
};
MailBoxMessageListViewModel.prototype.listUnsetSeen = function ()
{
this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetSeen, RL.data().messageListCheckedOrSelected());
this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetSeen, Data.messageListCheckedOrSelected());
};
MailBoxMessageListViewModel.prototype.listSetFlags = function ()
{
this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.SetFlag, RL.data().messageListCheckedOrSelected());
this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.SetFlag, Data.messageListCheckedOrSelected());
};
MailBoxMessageListViewModel.prototype.listUnsetFlags = function ()
{
this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetFlag, RL.data().messageListCheckedOrSelected());
this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetFlag, Data.messageListCheckedOrSelected());
};
MailBoxMessageListViewModel.prototype.flagMessages = function (oCurrentMessage)
@ -623,8 +625,7 @@
MailBoxMessageListViewModel.prototype.onBuild = function (oDom)
{
var
self = this,
oData = RL.data()
self = this
;
this.oContentVisible = $('.b-content', oDom);
@ -638,9 +639,9 @@
if (oMessage && !oMessage.lastInCollapsedThreadLoading())
{
RL.data().messageListThreadFolder(oMessage.folderFullNameRaw);
Data.messageListThreadFolder(oMessage.folderFullNameRaw);
aList = RL.data().messageListThreadUids();
aList = Data.messageListThreadUids();
if (oMessage.lastInCollapsedThread())
{
@ -651,7 +652,7 @@
aList = _.without(aList, 0 < oMessage.parentUid() ? oMessage.parentUid() : oMessage.uid);
}
RL.data().messageListThreadUids(_.uniq(aList));
Data.messageListThreadUids(_.uniq(aList));
oMessage.lastInCollapsedThreadLoading(true);
oMessage.lastInCollapsedThread(!oMessage.lastInCollapsedThread());
@ -675,9 +676,9 @@
if (oPage)
{
kn.setHash(LinkBuilder.mailBox(
oData.currentFolderFullNameHash(),
Data.currentFolderFullNameHash(),
oPage.value,
oData.messageListSearch()
Data.messageListSearch()
));
}
})
@ -692,7 +693,7 @@
this.initUploaderForAppend();
this.initShortcuts();
if (!Globals.bMobileDevice && RL.capa(Enums.Capa.Prefetch) && ifvisible)
if (!Globals.bMobileDevice && AppSettings.capa(Enums.Capa.Prefetch) && ifvisible)
{
ifvisible.setIdleDuration(10);
@ -721,7 +722,7 @@
key('delete, shift+delete, shift+3', Enums.KeyState.MessageList, function (event, handler) {
if (event)
{
if (0 < RL.data().messageListCheckedOrSelected().length)
if (0 < Data.messageListCheckedOrSelected().length)
{
if (handler && 'shift+delete' === handler.shortcut)
{
@ -880,7 +881,7 @@
MailBoxMessageListViewModel.prototype.initUploaderForAppend = function ()
{
if (!RL.settingsGet('AllowAppendMessage') || !this.dragOverArea())
if (!AppSettings.settingsGet('AllowAppendMessage') || !this.dragOverArea())
{
return false;
}
@ -893,7 +894,7 @@
'disableFolderDragAndDrop': true,
'hidden': {
'Folder': function () {
return RL.data().currentFolderFullNameRaw();
return Data.currentFolderFullNameRaw();
}
},
'dragAndDropElement': this.dragOverArea(),
@ -916,7 +917,7 @@
.on('onSelect', _.bind(function (sUid, oData) {
if (sUid && oData && 'message/rfc822' === oData['Type'])
{
RL.data().messageListLoading(true);
Data.messageListLoading(true);
return true;
}
@ -930,6 +931,6 @@
return !!oJua;
};
module.exports = new MailBoxMessageListViewModel();
module.exports = MailBoxMessageListViewModel;
}(module));

View file

@ -5,16 +5,22 @@
'use strict';
var
$ = require('../External/jquery.js'),
ko = require('../External/ko.js'),
key = require('../External/key.js'),
$html = require('../External/$html.js'),
Consts = require('../Common/Consts.js'),
Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js'),
Events = require('../Common/Events.js'),
Cache = require('../Storages/WebMailCacheStorage.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
@ -31,7 +37,6 @@
var
self = this,
sLastEmail = '',
oData = RL.data(),
createCommandHelper = function (sType) {
return Utils.createCommand(self, function () {
this.replyOrforward(sType);
@ -41,24 +46,23 @@
this.oMessageScrollerDom = null;
this.keyScope = oData.keyScope;
this.message = oData.message;
this.currentMessage = oData.currentMessage;
this.messageListChecked = oData.messageListChecked;
this.hasCheckedMessages = oData.hasCheckedMessages;
this.messageListCheckedOrSelectedUidsWithSubMails = oData.messageListCheckedOrSelectedUidsWithSubMails;
this.messageLoading = oData.messageLoading;
this.messageLoadingThrottle = oData.messageLoadingThrottle;
this.messagesBodiesDom = oData.messagesBodiesDom;
this.useThreads = oData.useThreads;
this.replySameFolder = oData.replySameFolder;
this.layout = oData.layout;
this.usePreviewPane = oData.usePreviewPane;
this.isMessageSelected = oData.isMessageSelected;
this.messageActiveDom = oData.messageActiveDom;
this.messageError = oData.messageError;
this.message = Data.message;
this.currentMessage = Data.currentMessage;
this.messageListChecked = Data.messageListChecked;
this.hasCheckedMessages = Data.hasCheckedMessages;
this.messageListCheckedOrSelectedUidsWithSubMails = Data.messageListCheckedOrSelectedUidsWithSubMails;
this.messageLoading = Data.messageLoading;
this.messageLoadingThrottle = Data.messageLoadingThrottle;
this.messagesBodiesDom = Data.messagesBodiesDom;
this.useThreads = Data.useThreads;
this.replySameFolder = Data.replySameFolder;
this.layout = Data.layout;
this.usePreviewPane = Data.usePreviewPane;
this.isMessageSelected = Data.isMessageSelected;
this.messageActiveDom = Data.messageActiveDom;
this.messageError = Data.messageError;
this.fullScreenMode = oData.messageFullScreenMode;
this.fullScreenMode = Data.messageFullScreenMode;
this.showFullInfo = ko.observable(false);
this.moreDropdownTrigger = ko.observable(false);
@ -79,7 +83,7 @@
// commands
this.closeMessage = Utils.createCommand(this, function () {
oData.message(null);
Data.message(null);
});
this.replyCommand = createCommandHelper(Enums.ComposeType.Reply);
@ -107,7 +111,7 @@
if (this.message())
{
RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
RL.data().currentFolderFullNameRaw(),
Data.currentFolderFullNameRaw(),
[this.message().uid], false);
}
}, this.messageVisibility);
@ -235,11 +239,11 @@
});
this.goUpCommand = Utils.createCommand(this, function () {
RL.pub('mailbox.message-list.selector.go-up');
Events.pub('mailbox.message-list.selector.go-up');
});
this.goDownCommand = Utils.createCommand(this, function () {
RL.pub('mailbox.message-list.selector.go-down');
Events.pub('mailbox.message-list.selector.go-down');
});
kn.constructorEnd(this);
@ -331,14 +335,13 @@
*/
MailBoxMessageViewViewModel.prototype.replyOrforward = function (sType)
{
kn.showScreenPopup(PopupsComposeViewModel, [sType, RL.data().message()]);
kn.showScreenPopup(PopupsComposeViewModel, [sType, Data.message()]);
};
MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
{
var
self = this,
oData = RL.data()
self = this
;
this.fullScreenMode.subscribe(function (bValue) {
@ -358,10 +361,10 @@
},
'callbacks': {
'open': function() {
oData.useKeyboardShortcuts(false);
Globals.useKeyboardShortcuts(false);
},
'close': function() {
oData.useKeyboardShortcuts(true);
Globals.useKeyboardShortcuts(true);
}
},
'mainClass': 'mfp-fade',
@ -370,7 +373,7 @@
oDom
.on('click', '.messageView .messageItem .messageItemHeader', function () {
if (oData.useKeyboardShortcuts() && self.message())
if (Globals.useKeyboardShortcuts() && self.message())
{
self.message.focused(true);
}
@ -407,13 +410,13 @@
}, this);
this.messageDomFocused.subscribe(function (bValue) {
if (!bValue && Enums.KeyState.MessageView === this.keyScope())
if (!bValue && Enums.KeyState.MessageView === Globals.keyScope())
{
this.message.focused(false);
}
}, this);
this.keyScope.subscribe(function (sValue) {
Globals.keyScope.subscribe(function (sValue) {
if (Enums.KeyState.MessageView === sValue && this.message.focused())
{
this.messageDomFocused(true);
@ -437,7 +440,7 @@
{
this.fullScreenMode(false);
}
else if (Enums.Layout.NoPreview === RL.data().layout())
else if (Enums.Layout.NoPreview === Data.layout())
{
this.message(null);
}
@ -453,8 +456,7 @@
MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
{
var
self = this,
oData = RL.data()
self = this
;
// exit fullscreen, back
@ -467,7 +469,7 @@
});
key('enter', Enums.KeyState.MessageList, function () {
if (Enums.Layout.NoPreview !== oData.layout() && self.message())
if (Enums.Layout.NoPreview !== Data.layout() && self.message())
{
self.toggleFullScreen();
return false;
@ -482,7 +484,7 @@
// reply
key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (oData.message())
if (Data.message())
{
self.replyCommand();
return false;
@ -491,7 +493,7 @@
// replaAll
key('a', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (oData.message())
if (Data.message())
{
self.replyAllCommand();
return false;
@ -500,7 +502,7 @@
// forward
key('f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (oData.message())
if (Data.message())
{
self.forwardCommand();
return false;
@ -518,9 +520,9 @@
// toggle message blockquotes
key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (oData.message() && oData.message().body)
if (Data.message() && Data.message().body)
{
Utils.toggleMessageBlockquote(oData.message().body);
Utils.toggleMessageBlockquote(Data.message().body);
return false;
}
});
@ -564,7 +566,7 @@
// change focused state
key('tab, shift+tab, left', Enums.KeyState.MessageView, function () {
if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== oData.layout())
if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== Data.layout())
{
self.message.focused(false);
}
@ -578,7 +580,7 @@
*/
MailBoxMessageViewViewModel.prototype.isDraftFolder = function ()
{
return RL.data().message() && RL.data().draftFolder() === RL.data().message().folderFullNameRaw;
return Data.message() && Data.draftFolder() === Data.message().folderFullNameRaw;
};
/**
@ -586,7 +588,7 @@
*/
MailBoxMessageViewViewModel.prototype.isSentFolder = function ()
{
return RL.data().message() && RL.data().sentFolder() === RL.data().message().folderFullNameRaw;
return Data.message() && Data.sentFolder() === Data.message().folderFullNameRaw;
};
/**
@ -594,7 +596,7 @@
*/
MailBoxMessageViewViewModel.prototype.isSpamFolder = function ()
{
return RL.data().message() && RL.data().spamFolder() === RL.data().message().folderFullNameRaw;
return Data.message() && Data.spamFolder() === Data.message().folderFullNameRaw;
};
/**
@ -602,7 +604,7 @@
*/
MailBoxMessageViewViewModel.prototype.isSpamDisabled = function ()
{
return RL.data().message() && RL.data().spamFolder() === Consts.Values.UnuseOptionValue;
return Data.message() && Data.spamFolder() === Consts.Values.UnuseOptionValue;
};
/**
@ -610,7 +612,7 @@
*/
MailBoxMessageViewViewModel.prototype.isArchiveFolder = function ()
{
return RL.data().message() && RL.data().archiveFolder() === RL.data().message().folderFullNameRaw;
return Data.message() && Data.archiveFolder() === Data.message().folderFullNameRaw;
};
/**
@ -618,7 +620,7 @@
*/
MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function ()
{
return RL.data().message() && RL.data().archiveFolder() === Consts.Values.UnuseOptionValue;
return Data.message() && Data.archiveFolder() === Consts.Values.UnuseOptionValue;
};
/**
@ -636,9 +638,9 @@
MailBoxMessageViewViewModel.prototype.editMessage = function ()
{
if (RL.data().message())
if (Data.message())
{
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Draft, RL.data().message()]);
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Draft, Data.message()]);
}
};
@ -703,7 +705,7 @@
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': RL.data().accountEmail()}));
Utils.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': Data.accountEmail()}));
oMessage.isReadReceipt(true);

View file

@ -9,6 +9,7 @@
Enums = require('../../Common/Enums.js'),
Utils = require('../../Common/Utils.js'),
AppSettings = require('../../Storages/AppSettings.js'),
Data = require('../../Storages/AdminDataStorage.js'),
Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
@ -106,7 +107,7 @@
PopupsActivateViewModel.prototype.onShow = function ()
{
this.domain(RL.settingsGet('AdminDomain'));
this.domain(AppSettings.settingsGet('AdminDomain'));
if (!this.activateProcess())
{
this.key('');
@ -133,6 +134,6 @@
return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
};
module.exports = new PopupsActivateViewModel();
module.exports = PopupsActivateViewModel;
}(module));

View file

@ -11,6 +11,8 @@
Utils = require('../../Common/Utils.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
@ -110,6 +112,6 @@
this.emailFocus(true);
};
module.exports = new PopupsAddAccountViewModel();
module.exports = PopupsAddAccountViewModel;
}(module));

View file

@ -11,6 +11,8 @@
Data = require('../../Storages/WebMailDataStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
;
@ -104,6 +106,6 @@
this.key.focus(true);
};
module.exports = new PopupsAddOpenPgpKeyViewModel();
module.exports = PopupsAddOpenPgpKeyViewModel;
}(module));

View file

@ -152,6 +152,6 @@
this.fromFocus(true);
};
module.exports = new PopupsAdvancedSearchViewModel();
module.exports = PopupsAdvancedSearchViewModel;
}(module));

View file

@ -123,6 +123,6 @@
}, this));
};
module.exports = new PopupsAskViewModel();
module.exports = PopupsAskViewModel;
}(module));

View file

@ -257,6 +257,6 @@
this.text(sText);
};
module.exports = new PopupsComposeOpenPgpViewModel();
module.exports = PopupsComposeOpenPgpViewModel;
}(module));

View file

@ -5,6 +5,7 @@
'use strict';
var
window = require('../../External/window.js'),
$ = require('../../External/jquery.js'),
_ = require('../../External/underscore.js'),
ko = require('../../External/ko.js'),
@ -13,12 +14,20 @@
Enums = require('../../Common/Enums.js'),
Consts = require('../../Common/Consts.js'),
Utils = require('../../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'),
Globals = require('../../Common/Globals.js'),
LinkBuilder = require('../../Common/LinkBuilder.js'),
Events = require('../../Common/Events.js'),
NewHtmlEditorWrapper = require('../../Common/NewHtmlEditorWrapper.js'),
AppSettings = require('../../Storages/AppSettings.js'),
Data = require('../../Storages/WebMailDataStorage.js'),
Cache = require('../../Storages/WebMailCacheStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
PopupsComposeOpenPgpViewModel = require('./PopupsComposeOpenPgpViewModel.js'),
kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
;
@ -38,7 +47,7 @@
this.bSkipNext = false;
this.sReferences = '';
this.bCapaAdditionalIdentities = RL.capa(Enums.Capa.AdditionalIdentities);
this.bCapaAdditionalIdentities = AppSettings.capa(Enums.Capa.AdditionalIdentities);
var
self = this,
@ -330,7 +339,7 @@
}, this.canBeSendedOrSaved);
RL.sub('interval.1m', function () {
Events.sub('interval.1m', function () {
if (this.modalVisibility() && !Data.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
!this.bSkipNext && !this.saving() && !this.sending() && !this.savedError())
{
@ -343,7 +352,7 @@
this.triggerForResize();
}, this);
this.dropboxEnabled = ko.observable(!!RL.settingsGet('DropboxApiKey'));
this.dropboxEnabled = ko.observable(!!AppSettings.settingsGet('DropboxApiKey'));
this.dropboxCommand = Utils.createCommand(this, function () {
@ -370,7 +379,7 @@
});
this.driveEnabled = ko.observable(Globals.bXMLHttpRequestSupported &&
!!RL.settingsGet('GoogleClientID') && !!RL.settingsGet('GoogleApiKey'));
!!AppSettings.settingsGet('GoogleClientID') && !!AppSettings.settingsGet('GoogleApiKey'));
this.driveVisible = ko.observable(false);
@ -390,11 +399,22 @@
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200);
this.emailsSource = _.bind(this.emailsSource, this);
kn.constructorEnd(this);
}
kn.extendAsViewModel('PopupsComposeViewModel', PopupsComposeViewModel);
PopupsComposeViewModel.prototype.emailsSource = function (oData, fResponse)
{
RL.getAutocomplete(oData.term, function (aData) {
fResponse(_.map(aData, function (oEmailItem) {
return oEmailItem.toLine(false);
}));
});
};
PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
{
if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml())
@ -1037,7 +1057,7 @@
oScript = 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', RL.settingsGet('DropboxApiKey'));
$(oScript).attr('id', 'dropboxjs').attr('data-app-key', AppSettings.settingsGet('DropboxApiKey'));
document.body.appendChild(oScript);
}
@ -1136,7 +1156,7 @@
new window.google.picker.DocsView()
.setIncludeFolders(true)
)
.setAppId(RL.settingsGet('GoogleClientID'))
.setAppId(AppSettings.settingsGet('GoogleClientID'))
.setOAuthToken(oOauthToken.access_token)
.setCallback(_.bind(self.driveCallback, self, oOauthToken.access_token))
.enableFeature(window.google.picker.Feature.NAV_HIDDEN)
@ -1161,7 +1181,7 @@
if (!oAuthToken)
{
window.gapi.auth.authorize({
'client_id': RL.settingsGet('GoogleClientID'),
'client_id': AppSettings.settingsGet('GoogleClientID'),
'scope': 'https://www.googleapis.com/auth/drive.readonly',
'immediate': true
}, function (oAuthResult) {
@ -1176,7 +1196,7 @@
else
{
window.gapi.auth.authorize({
'client_id': RL.settingsGet('GoogleClientID'),
'client_id': AppSettings.settingsGet('GoogleClientID'),
'scope': 'https://www.googleapis.com/auth/drive.readonly',
'immediate': false
}, function (oAuthResult) {
@ -1229,7 +1249,7 @@
{
var
oUploadCache = {},
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
iAttachmentSizeLimit = Utils.pInt(AppSettings.settingsGet('AttachmentLimit')),
oJua = new Jua({
'action': LinkBuilder.upload(),
'name': 'uploader',
@ -1478,7 +1498,7 @@
});
};
},
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
iAttachmentSizeLimit = Utils.pInt(AppSettings.settingsGet('AttachmentLimit')),
mSize = oDropboxFile['bytes']
;
@ -1539,7 +1559,7 @@
});
};
},
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')),
iAttachmentSizeLimit = Utils.pInt(AppSettings.settingsGet('AttachmentLimit')),
oAttachment = null,
mSize = oDriveFile['fileSize'] ? Utils.pInt(oDriveFile['fileSize']) : 0
;
@ -1751,6 +1771,6 @@
this.editorResizeThrottle();
};
module.exports = new PopupsComposeViewModel();
module.exports = PopupsComposeViewModel;
}(module));

View file

@ -15,11 +15,14 @@
Consts = require('../../Common/Consts.js'),
Globals = require('../../Common/Globals.js'),
Utils = require('../../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'),
LinkBuilder = require('../../Common/LinkBuilder.js'),
Selector = require('../../Common/Selector.js'),
Data = require('../../Storages/WebMailDataStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
;
@ -380,11 +383,22 @@
this.sDefaultKeyScope = Enums.KeyState.ContactList;
this.contactTagsSource = _.bind(this.contactTagsSource, this);
kn.constructorEnd(this);
}
kn.extendAsViewModel('PopupsContactsViewModel', PopupsContactsViewModel);
PopupsContactsViewModel.prototype.contactTagsSource = function (oData, fResponse)
{
RL.getContactTagsAutocomplete(oData.term, function (aData) {
fResponse(_.map(aData, function (oTagItem) {
return oTagItem.toLine(false);
}));
});
};
PopupsContactsViewModel.prototype.getPropertyPlceholder = function (sType)
{
var sResult = '';
@ -763,6 +777,6 @@
this.contacts([]);
};
module.exports = new PopupsContactsViewModel();
module.exports = PopupsContactsViewModel;
}(module));

View file

@ -13,6 +13,8 @@
Utils = require('../../Common/Utils.js'),
Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
RL = require('../../Boots/AdminApp.js'),
kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
@ -313,6 +315,6 @@
this.whiteList('');
};
module.exports = new PopupsDomainViewModel();
module.exports = PopupsDomainViewModel;
}(module));

View file

@ -47,11 +47,6 @@
this.filter(oFilter);
};
// PopupsFilterViewModel.prototype.onFocus = function ()
// {
//
// };
module.exports = new PopupsFilterViewModel();
module.exports = PopupsFilterViewModel;
}(module));

View file

@ -15,6 +15,8 @@
Cache = require('../../Storages/WebMailCacheStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
;
@ -115,6 +117,6 @@
}
};
module.exports = new PopupsFolderClearViewModel();
module.exports = PopupsFolderClearViewModel;
}(module));

View file

@ -14,6 +14,8 @@
Data = require('../../Storages/WebMailDataStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
;
@ -57,7 +59,7 @@
};
}
return RL.folderListOptionsBuilder([], aList, [], aTop, null, fDisableCallback, fVisibleCallback, fRenameCallback);
return Utils.folderListOptionsBuilder([], aList, [], aTop, null, fDisableCallback, fVisibleCallback, fRenameCallback);
}, this);
@ -123,6 +125,6 @@
this.folderName.focused(true);
};
module.exports = new PopupsFolderCreateViewModel();
module.exports = PopupsFolderCreateViewModel;
}(module));

View file

@ -11,9 +11,12 @@
Consts = require('../../Common/Consts.js'),
Utils = require('../../Common/Utils.js'),
AppSettings = require('../../Storages/AppSettings.js'),
Data = require('../../Storages/WebMailDataStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
;
@ -34,7 +37,7 @@
this.notification = ko.observable('');
this.folderSelectList = ko.computed(function () {
return RL.folderListOptionsBuilder([], Data.folderList(), Data.folderListSystemNames(), [
return Utils.folderListOptionsBuilder([], Data.folderList(), Data.folderListSystemNames(), [
['', this.sChooseOnText],
[Consts.Values.UnuseOptionValue, this.sUnuseText]
]);
@ -54,11 +57,11 @@
fSaveSystemFolders = _.debounce(function () {
RL.settingsSet('SentFolder', self.sentFolder());
RL.settingsSet('DraftFolder', self.draftFolder());
RL.settingsSet('SpamFolder', self.spamFolder());
RL.settingsSet('TrashFolder', self.trashFolder());
RL.settingsSet('ArchiveFolder', self.archiveFolder());
AppSettings.settingsSet('SentFolder', self.sentFolder());
AppSettings.settingsSet('DraftFolder', self.draftFolder());
AppSettings.settingsSet('SpamFolder', self.spamFolder());
AppSettings.settingsSet('TrashFolder', self.trashFolder());
AppSettings.settingsSet('ArchiveFolder', self.archiveFolder());
Remote.saveSystemFolders(Utils.emptyFunction, {
'SentFolder': self.sentFolder(),
@ -73,11 +76,11 @@
fCallback = function () {
RL.settingsSet('SentFolder', self.sentFolder());
RL.settingsSet('DraftFolder', self.draftFolder());
RL.settingsSet('SpamFolder', self.spamFolder());
RL.settingsSet('TrashFolder', self.trashFolder());
RL.settingsSet('ArchiveFolder', self.archiveFolder());
AppSettings.settingsSet('SentFolder', self.sentFolder());
AppSettings.settingsSet('DraftFolder', self.draftFolder());
AppSettings.settingsSet('SpamFolder', self.spamFolder());
AppSettings.settingsSet('TrashFolder', self.trashFolder());
AppSettings.settingsSet('ArchiveFolder', self.archiveFolder());
fSaveSystemFolders();
};
@ -129,6 +132,6 @@
this.notification(sNotification);
};
module.exports = new PopupsFolderSystemViewModel();
module.exports = PopupsFolderSystemViewModel;
}(module));

View file

@ -12,6 +12,8 @@
Data = require('../../Storages/WebMailDataStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
;
@ -110,6 +112,6 @@
this.email.focus(true);
};
module.exports = new PopupsGenerateNewOpenPgpKeyViewModel();
module.exports = PopupsGenerateNewOpenPgpKeyViewModel;
}(module));

View file

@ -14,6 +14,8 @@
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
Data = require('../../Storages/WebMailDataStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
;
@ -165,6 +167,6 @@
}
};
module.exports = new PopupsIdentityViewModel();
module.exports = PopupsIdentityViewModel;
}(module));

View file

@ -58,6 +58,6 @@
}, this));
};
module.exports = new AdminPaneViewModel();
module.exports = PopupsKeyboardShortcutsHelpViewModel;
}(module));

View file

@ -76,6 +76,6 @@
this.cancelCommand();
};
module.exports = new PopupsLanguagesViewModel();
module.exports = PopupsLanguagesViewModel;
}(module));

View file

@ -160,6 +160,6 @@
}, this));
};
module.exports = new PopupsPluginViewModel();
module.exports = PopupsPluginViewModel;
}(module));

View file

@ -70,6 +70,6 @@
this.code.focused(true);
};
module.exports = new PopupsTwoFactorTestViewModel();
module.exports = PopupsTwoFactorTestViewModel;
}(module));

View file

@ -51,6 +51,6 @@
}
};
module.exports = new PopupsViewOpenPgpKeyViewModel();
module.exports = PopupsViewOpenPgpKeyViewModel;
}(module));

View file

@ -6,9 +6,8 @@
var
LinkBuilder = require('../Common/LinkBuilder.js'),
Globals = require('../Common/Globals.js'),
Data = require('../Storages/WebMailDataStorage.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
;
@ -23,7 +22,7 @@
{
KnoinAbstractViewModel.call(this, 'Left', 'SettingsMenu');
this.leftPanelDisabled = Data.leftPanelDisabled;
this.leftPanelDisabled = Globals.leftPanelDisabled;
this.menu = oScreen.menu;

View file

@ -5,7 +5,7 @@
'use strict';
var
kn = require('./Knoin/Knoin.js'),
kn = require('../Knoin/Knoin.js'),
AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js')
;