Uploading and preparing the repository to the dev version.

Original unminified source code (dev folder - js, css, less) (fixes #6)
Grunt build system
Multiple identities correction (fixes #9)
Compose html editor (fixes #12)
New general settings - Loading Description
New warning about default admin password
Split general and login screen settings
This commit is contained in:
RainLoop Team 2013-11-16 02:21:12 +04:00
parent afad45137e
commit 4cc2207513
846 changed files with 99453 additions and 2123 deletions

View file

@ -0,0 +1,178 @@
/* 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([]);
this.oCurrentSubScreen = null;
this.oViewModelPlace = null;
}
_.extend(AbstractSettings.prototype, KnoinAbstractScreen.prototype);
AbstractSettings.prototype.onRoute = function (sSubName)
{
var
self = this,
oSettingsScreen = null,
RoutedSettingsViewModel = null,
oViewModelPlace = null,
oViewModelDom = null
;
RoutedSettingsViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
sSubName === SettingsViewModel.__rlSettingsData.Route;
});
if (RoutedSettingsViewModel)
{
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;
}
}
if (RoutedSettingsViewModel)
{
if (RoutedSettingsViewModel.__builded && RoutedSettingsViewModel.__vm)
{
oSettingsScreen = RoutedSettingsViewModel.__vm;
}
else
{
oViewModelPlace = this.oViewModelPlace;
if (oViewModelPlace && 1 === oViewModelPlace.length)
{
RoutedSettingsViewModel = /** @type {?Function} */ RoutedSettingsViewModel;
oSettingsScreen = new RoutedSettingsViewModel();
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide().attr('data-bind',
'template: {name: "' + RoutedSettingsViewModel.__rlSettingsData.Template + '"}, i18nInit: true');
oViewModelDom.appendTo(oViewModelPlace);
oSettingsScreen.data = RL.data();
oSettingsScreen.viewModelDom = oViewModelDom;
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
RoutedSettingsViewModel.__dom = oViewModelDom;
RoutedSettingsViewModel.__builded = true;
RoutedSettingsViewModel.__vm = oSettingsScreen;
ko.applyBindings(oSettingsScreen, oViewModelDom[0]);
kn.delegateRun(oSettingsScreen, 'onBuild', [oViewModelDom]);
}
else
{
Utils.log('Cannot find sub settings view model position: SettingsSubScreen');
}
}
if (oSettingsScreen)
{
_.defer(function () {
// hide
if (self.oCurrentSubScreen)
{
kn.delegateRun(self.oCurrentSubScreen, 'onHide');
self.oCurrentSubScreen.viewModelDom.hide();
}
// --
self.oCurrentSubScreen = oSettingsScreen;
// show
if (self.oCurrentSubScreen)
{
self.oCurrentSubScreen.viewModelDom.show();
kn.delegateRun(self.oCurrentSubScreen, 'onShow');
_.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();
});
}
}
else
{
kn.setHash(RL.link().settings(), false, true);
}
};
AbstractSettings.prototype.onHide = function ()
{
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
{
kn.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;
}))
{
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;
})
});
}
}, 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];
}
}
;
return [
['{subname}/', oRules],
['{subname}', oRules],
['', oRules]
];
};

17
dev/Screens/AdminLogin.js Normal file
View file

@ -0,0 +1,17 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
* @extends KnoinAbstractScreen
*/
function AdminLoginScreen()
{
KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]);
}
_.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
AdminLoginScreen.prototype.onShow = function ()
{
RL.setTitle('');
};

View file

@ -0,0 +1,22 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
* @extends AbstractSettings
*/
function AdminSettingsScreen()
{
AbstractSettings.call(this, [
AdminMenuViewModel,
AdminPaneViewModel
]);
}
_.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
AdminSettingsScreen.prototype.onShow = function ()
{
// AbstractSettings.prototype.onShow.call(this);
RL.setTitle('');
};

17
dev/Screens/Login.js Normal file
View file

@ -0,0 +1,17 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
* @extends KnoinAbstractScreen
*/
function LoginScreen()
{
KnoinAbstractScreen.call(this, 'login', [LoginViewModel]);
}
_.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
LoginScreen.prototype.onShow = function ()
{
RL.setTitle(Utils.i18n('TITLES/LOGIN'));
};

165
dev/Screens/MailBox.js Normal file
View file

@ -0,0 +1,165 @@
/* 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
]);
this.oLastRoute = {};
}
_.extend(MailBoxScreen.prototype, KnoinAbstractScreen.prototype);
MailBoxScreen.prototype.oLastRoute = {};
MailBoxScreen.prototype.onShow = function ()
{
var sEmail = RL.data().accountEmail();
RL.setTitle(('' === sEmail ? '' : sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
};
MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch)
{
var
oData = RL.data(),
sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),
oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)
;
if (oFolder)
{
oData
.currentFolder(oFolder)
.messageListPage(iPage)
.messageListSearch(sSearch)
;
if (!oData.usePreviewPane() && oData.message())
{
oData.message(null);
}
RL.reloadMessageList();
}
};
MailBoxScreen.prototype.onStart = function ()
{
var
oData = RL.data(),
fResizeFunction = function () {
Utils.windowResize();
}
;
if (RL.settingsGet('AllowAdditionalAccounts') || RL.settingsGet('AllowIdentities'))
{
RL.accountsAndIdentities();
}
_.delay(function () {
RL.quota();
}, 1000 * 5);
_.delay(function () {
if ('INBOX' !== oData.currentFolderFullNameRaw())
{
RL.folderInformation('INBOX');
}
}, 1000);
_.delay(function () {
var sFolder = RL.data().spamFolder();
if (sFolder !== oData.currentFolderFullNameRaw())
{
RL.folderInformation(sFolder);
}
}, 1500);
_.delay(function () {
var sFolder = RL.data().draftFolder();
if (sFolder !== oData.currentFolderFullNameRaw())
{
RL.folderInformation(sFolder);
}
}, 2000);
_.delay(function () {
RL.remote().appDelayStart(Utils.emptyFunction);
}, 1000 * 35);
window.setInterval(function () {
RL.folderInformation('INBOX');
}, 1000 * 60 * 2);
window.setInterval(function () {
RL.quota();
}, 1000 * 60 * 5);
$html.toggleClass('rl-no-preview-pane', !oData.usePreviewPane());
oData.folderList.subscribe(fResizeFunction);
oData.messageList.subscribe(fResizeFunction);
oData.message.subscribe(fResizeFunction);
oData.usePreviewPane.subscribe(function (bValue) {
$html.toggleClass('rl-no-preview-pane', !bValue);
});
};
MailBoxScreen.prototype.onBuild = function ()
{
if (!Globals.bMobileDevice)
{
_.defer(function () {
Utils.initLayoutResizer('#rl-resizer-left', '#rl-resizer-right', '#rl-right',
350, 800, 350, 350, Enums.ClientSideKeyName.MailBoxListSize);
});
}
};
MailBoxScreen.prototype.routes = function ()
{
var
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])];
},
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])];
}
;
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}],
[/^([^\/]*)$/, {'normalize_': fNormS}]
];
};

29
dev/Screens/Settings.js Normal file
View file

@ -0,0 +1,29 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @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);
});
}
_.extend(SettingsScreen.prototype, AbstractSettings.prototype);
SettingsScreen.prototype.onShow = function ()
{
// AbstractSettings.prototype.onShow.call(this);
RL.setTitle(this.sSettingsTitle);
};