mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
CommonJS (research)
This commit is contained in:
parent
2fa2cd191e
commit
56607de87c
91 changed files with 20220 additions and 12933 deletions
|
|
@ -1,181 +1,199 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @param {Array} aViewModels
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
*/
|
||||
function AbstractSettings(aViewModels)
|
||||
{
|
||||
KnoinAbstractScreen.call(this, 'settings', aViewModels);
|
||||
|
||||
this.menu = ko.observableArray([]);
|
||||
(function (module) {
|
||||
|
||||
this.oCurrentSubScreen = null;
|
||||
this.oViewModelPlace = null;
|
||||
}
|
||||
'use strict';
|
||||
|
||||
_.extend(AbstractSettings.prototype, KnoinAbstractScreen.prototype);
|
||||
|
||||
AbstractSettings.prototype.onRoute = function (sSubName)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oSettingsScreen = null,
|
||||
RoutedSettingsViewModel = null,
|
||||
oViewModelPlace = null,
|
||||
oViewModelDom = null
|
||||
$ = require('./External/jquery.js'),
|
||||
_ = require('./External/underscore.js'),
|
||||
ko = require('./External/ko.js'),
|
||||
Globals = require('./Common/Globals.js'),
|
||||
Utils = require('./Common/Utils.js'),
|
||||
kn = require('./Knoin/Knoin.js'),
|
||||
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js')
|
||||
;
|
||||
|
||||
RoutedSettingsViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
sSubName === SettingsViewModel.__rlSettingsData.Route;
|
||||
});
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
/**
|
||||
* @param {Array} aViewModels
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
*/
|
||||
function AbstractSettings(aViewModels)
|
||||
{
|
||||
if (_.find(ViewModels['settings-removed'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel && _.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
KnoinAbstractScreen.call(this, 'settings', aViewModels);
|
||||
|
||||
this.menu = ko.observableArray([]);
|
||||
|
||||
this.oCurrentSubScreen = null;
|
||||
this.oViewModelPlace = null;
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
_.extend(AbstractSettings.prototype, KnoinAbstractScreen.prototype);
|
||||
|
||||
AbstractSettings.prototype.onRoute = function (sSubName)
|
||||
{
|
||||
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
|
||||
var
|
||||
self = this,
|
||||
oSettingsScreen = null,
|
||||
RoutedSettingsViewModel = null,
|
||||
oViewModelPlace = null,
|
||||
oViewModelDom = null
|
||||
;
|
||||
|
||||
RoutedSettingsViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
sSubName === SettingsViewModel.__rlSettingsData.Route;
|
||||
});
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
oSettingsScreen = RoutedSettingsViewModel.__vm;
|
||||
}
|
||||
else
|
||||
{
|
||||
oViewModelPlace = this.oViewModelPlace;
|
||||
if (oViewModelPlace && 1 === oViewModelPlace.length)
|
||||
if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = /** @type {?Function} */ RoutedSettingsViewModel;
|
||||
oSettingsScreen = new RoutedSettingsViewModel();
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
|
||||
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
|
||||
oViewModelDom.appendTo(oViewModelPlace);
|
||||
|
||||
oSettingsScreen.data = RL.data();
|
||||
oSettingsScreen.viewModelDom = oViewModelDom;
|
||||
|
||||
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
|
||||
|
||||
RoutedSettingsViewModel.__dom = oViewModelDom;
|
||||
RoutedSettingsViewModel.__builded = true;
|
||||
RoutedSettingsViewModel.__vm = oSettingsScreen;
|
||||
|
||||
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
|
||||
'i18nInit': true,
|
||||
'template': function () { return {'name': RoutedSettingsViewModel.__rlSettingsData.Template}; }
|
||||
}, oSettingsScreen);
|
||||
if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
}
|
||||
|
||||
Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
|
||||
{
|
||||
oSettingsScreen = RoutedSettingsViewModel.__vm;
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
|
||||
oViewModelPlace = this.oViewModelPlace;
|
||||
if (oViewModelPlace && 1 === oViewModelPlace.length)
|
||||
{
|
||||
RoutedSettingsViewModel = /** @type {?Function} */ RoutedSettingsViewModel;
|
||||
oSettingsScreen = new RoutedSettingsViewModel();
|
||||
|
||||
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
|
||||
oViewModelDom.appendTo(oViewModelPlace);
|
||||
|
||||
oSettingsScreen.data = RL.data(); // TODO cjs
|
||||
oSettingsScreen.viewModelDom = oViewModelDom;
|
||||
|
||||
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
|
||||
|
||||
RoutedSettingsViewModel.__dom = oViewModelDom;
|
||||
RoutedSettingsViewModel.__builded = true;
|
||||
RoutedSettingsViewModel.__vm = oSettingsScreen;
|
||||
|
||||
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
|
||||
'i18nInit': true,
|
||||
'template': function () { return {'name': RoutedSettingsViewModel.__rlSettingsData.Template}; }
|
||||
}, oSettingsScreen);
|
||||
|
||||
Utils.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
|
||||
}
|
||||
}
|
||||
|
||||
if (oSettingsScreen)
|
||||
{
|
||||
_.defer(function () {
|
||||
// hide
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onHide');
|
||||
self.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
// --
|
||||
|
||||
self.oCurrentSubScreen = oSettingsScreen;
|
||||
|
||||
// show
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
self.oCurrentSubScreen.viewModelDom.show();
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onShow');
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onFocus', [], 200);
|
||||
|
||||
_.each(self.menu(), function (oItem) {
|
||||
oItem.selected(oSettingsScreen && oSettingsScreen.__rlSettingsData && oItem.route === oSettingsScreen.__rlSettingsData.Route);
|
||||
});
|
||||
|
||||
$('#rl-content .b-settings .b-content .content').scrollTop(0);
|
||||
}
|
||||
// --
|
||||
|
||||
Utils.windowResize();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (oSettingsScreen)
|
||||
else
|
||||
{
|
||||
_.defer(function () {
|
||||
// hide
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onHide');
|
||||
self.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
// --
|
||||
|
||||
self.oCurrentSubScreen = oSettingsScreen;
|
||||
|
||||
// show
|
||||
if (self.oCurrentSubScreen)
|
||||
{
|
||||
self.oCurrentSubScreen.viewModelDom.show();
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onShow');
|
||||
Utils.delegateRun(self.oCurrentSubScreen, 'onFocus', [], 200);
|
||||
|
||||
_.each(self.menu(), function (oItem) {
|
||||
oItem.selected(oSettingsScreen && oSettingsScreen.__rlSettingsData && oItem.route === oSettingsScreen.__rlSettingsData.Route);
|
||||
});
|
||||
|
||||
$('#rl-content .b-settings .b-content .content').scrollTop(0);
|
||||
}
|
||||
// --
|
||||
|
||||
Utils.windowResize();
|
||||
});
|
||||
kn.setHash(RL.link().settings(), false, true); // TODO cjs
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
kn.setHash(RL.link().settings(), false, true);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
AbstractSettings.prototype.onHide = function ()
|
||||
{
|
||||
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
|
||||
AbstractSettings.prototype.onHide = function ()
|
||||
{
|
||||
Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
|
||||
this.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSettings.prototype.onBuild = function ()
|
||||
{
|
||||
_.each(ViewModels['settings'], function (SettingsViewModel) {
|
||||
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
!_.find(ViewModels['settings-removed'], function (RemoveSettingsViewModel) {
|
||||
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
|
||||
}))
|
||||
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
|
||||
{
|
||||
this.menu.push({
|
||||
'route': SettingsViewModel.__rlSettingsData.Route,
|
||||
'label': SettingsViewModel.__rlSettingsData.Label,
|
||||
'selected': ko.observable(false),
|
||||
'disabled': !!_.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
|
||||
})
|
||||
});
|
||||
Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
|
||||
this.oCurrentSubScreen.viewModelDom.hide();
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
|
||||
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
|
||||
};
|
||||
|
||||
AbstractSettings.prototype.routes = function ()
|
||||
{
|
||||
var
|
||||
DefaultViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
|
||||
}),
|
||||
sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
|
||||
oRules = {
|
||||
'subname': /^(.*)$/,
|
||||
'normalize_': function (oRequest, oVals) {
|
||||
oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
|
||||
return [oVals.subname];
|
||||
AbstractSettings.prototype.onBuild = function ()
|
||||
{
|
||||
_.each(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
!_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
|
||||
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
|
||||
}))
|
||||
{
|
||||
this.menu.push({
|
||||
'route': SettingsViewModel.__rlSettingsData.Route,
|
||||
'label': SettingsViewModel.__rlSettingsData.Label,
|
||||
'selected': ko.observable(false),
|
||||
'disabled': !!_.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
;
|
||||
}, this);
|
||||
|
||||
return [
|
||||
['{subname}/', oRules],
|
||||
['{subname}', oRules],
|
||||
['', oRules]
|
||||
];
|
||||
};
|
||||
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
|
||||
};
|
||||
|
||||
AbstractSettings.prototype.routes = function ()
|
||||
{
|
||||
var
|
||||
DefaultViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
|
||||
}),
|
||||
sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
|
||||
oRules = {
|
||||
'subname': /^(.*)$/,
|
||||
'normalize_': function (oRequest, oVals) {
|
||||
oVals.subname = Utils.isUnd(oVals.subname) ? sDefaultRoute : Utils.pString(oVals.subname);
|
||||
return [oVals.subname];
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
return [
|
||||
['{subname}/', oRules],
|
||||
['{subname}', oRules],
|
||||
['', oRules]
|
||||
];
|
||||
};
|
||||
|
||||
module.exports = AbstractSettings;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,17 +1,31 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
*/
|
||||
function AdminLoginScreen()
|
||||
{
|
||||
KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]);
|
||||
}
|
||||
(function (module) {
|
||||
|
||||
_.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
|
||||
'use strict';
|
||||
|
||||
AdminLoginScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle('');
|
||||
};
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js'),
|
||||
AdminLoginViewModel = require('./ViewModels/AdminLoginViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
*/
|
||||
function AdminLoginScreen()
|
||||
{
|
||||
KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]);
|
||||
}
|
||||
|
||||
_.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
|
||||
|
||||
AdminLoginScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle(''); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = AdminLoginScreen;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,20 +1,35 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
*/
|
||||
function AdminSettingsScreen()
|
||||
{
|
||||
AbstractSettings.call(this, [
|
||||
AdminMenuViewModel,
|
||||
AdminPaneViewModel
|
||||
]);
|
||||
}
|
||||
(function (module) {
|
||||
|
||||
_.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
|
||||
'use strict';
|
||||
|
||||
AdminSettingsScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle('');
|
||||
};
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
AbstractSettings = require('./Screens/AbstractSettings.js'),
|
||||
AdminMenuViewModel = require('./ViewModels/AdminMenuViewModel.js'),
|
||||
AdminPaneViewModel = require('./ViewModels/AdminPaneViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
*/
|
||||
function AdminSettingsScreen()
|
||||
{
|
||||
AbstractSettings.call(this, [
|
||||
AdminMenuViewModel,
|
||||
AdminPaneViewModel
|
||||
]);
|
||||
}
|
||||
|
||||
_.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
|
||||
|
||||
AdminSettingsScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle(''); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsScreen;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,17 +1,31 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
*/
|
||||
function LoginScreen()
|
||||
{
|
||||
KnoinAbstractScreen.call(this, 'login', [LoginViewModel]);
|
||||
}
|
||||
(function (module) {
|
||||
|
||||
_.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
|
||||
'use strict';
|
||||
|
||||
LoginScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle('');
|
||||
};
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js'),
|
||||
LoginViewModel = require('./ViewModels/LoginViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
*/
|
||||
function LoginScreen()
|
||||
{
|
||||
KnoinAbstractScreen.call(this, 'login', [LoginViewModel]);
|
||||
}
|
||||
|
||||
_.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
|
||||
|
||||
LoginScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle(''); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = LoginScreen;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,171 +1,191 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
*/
|
||||
function MailBoxScreen()
|
||||
{
|
||||
KnoinAbstractScreen.call(this, 'mailbox', [
|
||||
MailBoxSystemDropDownViewModel,
|
||||
MailBoxFolderListViewModel,
|
||||
MailBoxMessageListViewModel,
|
||||
MailBoxMessageViewViewModel
|
||||
]);
|
||||
(function (module) {
|
||||
|
||||
this.oLastRoute = {};
|
||||
}
|
||||
'use strict';
|
||||
|
||||
_.extend(MailBoxScreen.prototype, KnoinAbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
MailBoxScreen.prototype.oLastRoute = {};
|
||||
|
||||
MailBoxScreen.prototype.setNewTitle = function ()
|
||||
{
|
||||
var
|
||||
sEmail = RL.data().accountEmail(),
|
||||
ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount()
|
||||
_ = require('./External/underscore.js'),
|
||||
$html = require('./External/$html.js'),
|
||||
Enums = require('./Common/Enums.js'),
|
||||
Utils = require('./Common/Utils.js'),
|
||||
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js'),
|
||||
MailBoxSystemDropDownViewModel = require('./ViewModels/MailBoxSystemDropDownViewModel.js'),
|
||||
MailBoxFolderListViewModel = require('./ViewModels/MailBoxFolderListViewModel.js'),
|
||||
MailBoxMessageListViewModel = require('./ViewModels/MailBoxMessageListViewModel.js'),
|
||||
MailBoxMessageViewViewModel = require('./ViewModels/MailBoxMessageViewViewModel.js')
|
||||
;
|
||||
|
||||
RL.setTitle(('' === sEmail ? '' :
|
||||
(0 < ifoldersInboxUnreadCount ? '(' + ifoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
|
||||
};
|
||||
|
||||
MailBoxScreen.prototype.onShow = function ()
|
||||
{
|
||||
this.setNewTitle();
|
||||
RL.data().keyScope(Enums.KeyState.MessageList);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFolderHash
|
||||
* @param {number} iPage
|
||||
* @param {string} sSearch
|
||||
* @param {boolean=} bPreview = false
|
||||
*/
|
||||
MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPreview)
|
||||
{
|
||||
if (Utils.isUnd(bPreview) ? false : !!bPreview)
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
*/
|
||||
function MailBoxScreen()
|
||||
{
|
||||
if (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())
|
||||
{
|
||||
RL.historyBack();
|
||||
}
|
||||
KnoinAbstractScreen.call(this, 'mailbox', [
|
||||
MailBoxSystemDropDownViewModel,
|
||||
MailBoxFolderListViewModel,
|
||||
MailBoxMessageListViewModel,
|
||||
MailBoxMessageViewViewModel
|
||||
]);
|
||||
|
||||
this.oLastRoute = {};
|
||||
}
|
||||
else
|
||||
|
||||
_.extend(MailBoxScreen.prototype, KnoinAbstractScreen.prototype);
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
MailBoxScreen.prototype.oLastRoute = {};
|
||||
|
||||
MailBoxScreen.prototype.setNewTitle = function ()
|
||||
{
|
||||
var
|
||||
oData = RL.data(),
|
||||
sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),
|
||||
oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)
|
||||
sEmail = RL.data().accountEmail(), // TODO cjs
|
||||
ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount() // TODO cjs
|
||||
;
|
||||
// TODO cjs
|
||||
RL.setTitle(('' === sEmail ? '' :
|
||||
(0 < ifoldersInboxUnreadCount ? '(' + ifoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
|
||||
};
|
||||
|
||||
if (oFolder)
|
||||
MailBoxScreen.prototype.onShow = function ()
|
||||
{
|
||||
this.setNewTitle();
|
||||
RL.data().keyScope(Enums.KeyState.MessageList);// TODO cjs
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sFolderHash
|
||||
* @param {number} iPage
|
||||
* @param {string} sSearch
|
||||
* @param {boolean=} bPreview = false
|
||||
*/
|
||||
MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPreview)
|
||||
{
|
||||
if (Utils.isUnd(bPreview) ? false : !!bPreview)
|
||||
{
|
||||
oData
|
||||
.currentFolder(oFolder)
|
||||
.messageListPage(iPage)
|
||||
.messageListSearch(sSearch)
|
||||
if (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())// TODO cjs
|
||||
{
|
||||
RL.historyBack();// TODO cjs
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var
|
||||
oData = RL.data(),// TODO cjs
|
||||
sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),// TODO cjs
|
||||
oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)// TODO cjs
|
||||
;
|
||||
|
||||
if (Enums.Layout.NoPreview === oData.layout() && oData.message())
|
||||
if (oFolder)
|
||||
{
|
||||
oData.message(null);
|
||||
oData
|
||||
.currentFolder(oFolder)
|
||||
.messageListPage(iPage)
|
||||
.messageListSearch(sSearch)
|
||||
;
|
||||
|
||||
if (Enums.Layout.NoPreview === oData.layout() && oData.message())
|
||||
{
|
||||
oData.message(null);
|
||||
}
|
||||
|
||||
RL.reloadMessageList();// TODO cjs
|
||||
}
|
||||
|
||||
RL.reloadMessageList();
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
MailBoxScreen.prototype.onStart = function ()
|
||||
{
|
||||
var
|
||||
oData = RL.data(),
|
||||
fResizeFunction = function () {
|
||||
Utils.windowResize();
|
||||
}
|
||||
;
|
||||
|
||||
if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities))
|
||||
MailBoxScreen.prototype.onStart = function ()
|
||||
{
|
||||
RL.accountsAndIdentities();
|
||||
}
|
||||
var
|
||||
oData = RL.data(),// TODO cjs
|
||||
fResizeFunction = function () {
|
||||
Utils.windowResize();
|
||||
}
|
||||
;
|
||||
|
||||
_.delay(function () {
|
||||
if ('INBOX' !== oData.currentFolderFullNameRaw())
|
||||
if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities))// TODO cjs
|
||||
{
|
||||
RL.folderInformation('INBOX');
|
||||
RL.accountsAndIdentities();// TODO cjs
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
_.delay(function () {
|
||||
RL.quota();
|
||||
}, 5000);
|
||||
|
||||
_.delay(function () {
|
||||
RL.remote().appDelayStart(Utils.emptyFunction);
|
||||
}, 35000);
|
||||
|
||||
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout());
|
||||
|
||||
oData.folderList.subscribe(fResizeFunction);
|
||||
oData.messageList.subscribe(fResizeFunction);
|
||||
oData.message.subscribe(fResizeFunction);
|
||||
|
||||
oData.layout.subscribe(function (nValue) {
|
||||
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
|
||||
});
|
||||
|
||||
oData.foldersInboxUnreadCount.subscribe(function () {
|
||||
this.setNewTitle();
|
||||
}, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
*/
|
||||
MailBoxScreen.prototype.routes = function ()
|
||||
{
|
||||
var
|
||||
fNormP = function () {
|
||||
return ['Inbox', 1, '', true];
|
||||
},
|
||||
fNormS = function (oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pInt(oVals[1]);
|
||||
oVals[1] = 0 >= oVals[1] ? 1 : oVals[1];
|
||||
oVals[2] = Utils.pString(oVals[2]);
|
||||
|
||||
if ('' === oRequest)
|
||||
_.delay(function () {
|
||||
if ('INBOX' !== oData.currentFolderFullNameRaw())
|
||||
{
|
||||
oVals[0] = 'Inbox';
|
||||
oVals[1] = 1;
|
||||
RL.folderInformation('INBOX');// TODO cjs
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
return [decodeURI(oVals[0]), oVals[1], decodeURI(oVals[2]), false];
|
||||
},
|
||||
fNormD = function (oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pString(oVals[1]);
|
||||
_.delay(function () {
|
||||
RL.quota();// TODO cjs
|
||||
}, 5000);
|
||||
|
||||
if ('' === oRequest)
|
||||
{
|
||||
oVals[0] = 'Inbox';
|
||||
_.delay(function () {
|
||||
RL.remote().appDelayStart(Utils.emptyFunction);// TODO cjs
|
||||
}, 35000);
|
||||
|
||||
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout());
|
||||
|
||||
oData.folderList.subscribe(fResizeFunction);
|
||||
oData.messageList.subscribe(fResizeFunction);
|
||||
oData.message.subscribe(fResizeFunction);
|
||||
|
||||
oData.layout.subscribe(function (nValue) {
|
||||
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
|
||||
});
|
||||
|
||||
oData.foldersInboxUnreadCount.subscribe(function () {
|
||||
this.setNewTitle();
|
||||
}, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
*/
|
||||
MailBoxScreen.prototype.routes = function ()
|
||||
{
|
||||
var
|
||||
fNormP = function () {
|
||||
return ['Inbox', 1, '', true];
|
||||
},
|
||||
fNormS = function (oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pInt(oVals[1]);
|
||||
oVals[1] = 0 >= oVals[1] ? 1 : oVals[1];
|
||||
oVals[2] = Utils.pString(oVals[2]);
|
||||
|
||||
if ('' === oRequest)
|
||||
{
|
||||
oVals[0] = 'Inbox';
|
||||
oVals[1] = 1;
|
||||
}
|
||||
|
||||
return [decodeURI(oVals[0]), oVals[1], decodeURI(oVals[2]), false];
|
||||
},
|
||||
fNormD = function (oRequest, oVals) {
|
||||
oVals[0] = Utils.pString(oVals[0]);
|
||||
oVals[1] = Utils.pString(oVals[1]);
|
||||
|
||||
if ('' === oRequest)
|
||||
{
|
||||
oVals[0] = 'Inbox';
|
||||
}
|
||||
|
||||
return [decodeURI(oVals[0]), 1, decodeURI(oVals[1]), false];
|
||||
}
|
||||
;
|
||||
|
||||
return [decodeURI(oVals[0]), 1, decodeURI(oVals[1]), false];
|
||||
}
|
||||
;
|
||||
return [
|
||||
[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9]+)\/(.+)\/?$/, {'normalize_': fNormD}],
|
||||
[/^message-preview$/, {'normalize_': fNormP}],
|
||||
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
||||
];
|
||||
};
|
||||
|
||||
return [
|
||||
[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)\/(.+)\/?$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9]+)\/p([1-9][0-9]*)$/, {'normalize_': fNormS}],
|
||||
[/^([a-zA-Z0-9]+)\/(.+)\/?$/, {'normalize_': fNormD}],
|
||||
[/^message-preview$/, {'normalize_': fNormP}],
|
||||
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
||||
];
|
||||
};
|
||||
module.exports = MailBoxScreen;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,28 +1,46 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
*/
|
||||
function SettingsScreen()
|
||||
{
|
||||
AbstractSettings.call(this, [
|
||||
SettingsSystemDropDownViewModel,
|
||||
SettingsMenuViewModel,
|
||||
SettingsPaneViewModel
|
||||
]);
|
||||
(function (module) {
|
||||
|
||||
Utils.initOnStartOrLangChange(function () {
|
||||
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
|
||||
}, this, function () {
|
||||
RL.setTitle(this.sSettingsTitle);
|
||||
});
|
||||
}
|
||||
'use strict';
|
||||
|
||||
_.extend(SettingsScreen.prototype, AbstractSettings.prototype);
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
Enums = require('./Common/Enums.js'),
|
||||
Utils = require('./Common/Utils.js'),
|
||||
AbstractSettings = require('./Screens/AbstractSettings.js'),
|
||||
SettingsSystemDropDownViewModel = require('./ViewModels/SettingsSystemDropDownViewModel.js'),
|
||||
SettingsMenuViewModel = require('./ViewModels/SettingsMenuViewModel.js'),
|
||||
SettingsPaneViewModel = require('./ViewModels/SettingsPaneViewModel.js')
|
||||
;
|
||||
|
||||
SettingsScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle(this.sSettingsTitle);
|
||||
RL.data().keyScope(Enums.KeyState.Settings);
|
||||
};
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
*/
|
||||
function SettingsScreen()
|
||||
{
|
||||
AbstractSettings.call(this, [
|
||||
SettingsSystemDropDownViewModel,
|
||||
SettingsMenuViewModel,
|
||||
SettingsPaneViewModel
|
||||
]);
|
||||
|
||||
Utils.initOnStartOrLangChange(function () {
|
||||
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
|
||||
}, this, function () {
|
||||
RL.setTitle(this.sSettingsTitle); // TODO cjs
|
||||
});
|
||||
}
|
||||
|
||||
_.extend(SettingsScreen.prototype, AbstractSettings.prototype);
|
||||
|
||||
SettingsScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle(this.sSettingsTitle); // TODO cjs
|
||||
RL.data().keyScope(Enums.KeyState.Settings); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = SettingsScreen;
|
||||
|
||||
}(module));
|
||||
Loading…
Add table
Add a link
Reference in a new issue