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

90
dev/Admin/Domains.js Normal file
View file

@ -0,0 +1,90 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function AdminDomains()
{
var oData = RL.data();
this.domains = oData.domains;
this.domainsLoading = oData.domainsLoading;
this.iDomainForDeletionTimeout = 0;
this.visibility = ko.computed(function () {
return oData.domainsLoading() ? 'visible' : 'hidden';
}, this);
this.domainForDeletion = ko.observable(null).extend({'toggleSubscribe': [this,
function (oPrev) {
if (oPrev)
{
oPrev.deleteAccess(false);
}
}, function (oNext) {
if (oNext)
{
oNext.deleteAccess(true);
this.startDomainForDeletionTimeout();
}
}
]});
}
Utils.addSettingsViewModel(AdminDomains, 'AdminSettingsDomains', 'Domains', 'domains');
AdminDomains.prototype.startDomainForDeletionTimeout = function ()
{
var self = this;
window.clearInterval(this.iDomainForDeletionTimeout);
this.iDomainForDeletionTimeout = window.setTimeout(function () {
self.domainForDeletion(null);
}, 1000 * 3);
};
AdminDomains.prototype.createDomain = function ()
{
kn.showScreenPopup(PopupsDomainViewModel);
};
AdminDomains.prototype.deleteDomain = function (oDomain)
{
this.domains.remove(oDomain);
RL.remote().domainDelete(_.bind(this.onDomainListChangeRequest, this), oDomain.name);
};
AdminDomains.prototype.disableDomain = function (oDomain)
{
oDomain.disabled(!oDomain.disabled());
RL.remote().domainDisable(_.bind(this.onDomainListChangeRequest, this), oDomain.name, oDomain.disabled());
};
AdminDomains.prototype.onBuild = function (oDom)
{
var self = this;
oDom
.on('click', '.b-admin-domains-list-table .e-item .e-action', function () {
var oDomainItem = ko.dataFor(this);
if (oDomainItem)
{
RL.remote().domain(_.bind(self.onDomainLoadRequest, self), oDomainItem.name);
}
})
;
RL.reloadDomainList();
};
AdminDomains.prototype.onDomainLoadRequest = function (sResult, oData)
{
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
kn.showScreenPopup(PopupsDomainViewModel, [oData.Result]);
}
};
AdminDomains.prototype.onDomainListChangeRequest = function ()
{
RL.reloadDomainList();
};

122
dev/Admin/General.js Normal file
View file

@ -0,0 +1,122 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function AdminGeneral()
{
var oData = RL.data();
this.mainLanguage = oData.mainLanguage;
this.mainTheme = oData.mainTheme;
this.language = oData.language;
this.theme = oData.theme;
this.allowThemes = oData.allowThemes;
this.allowCustomTheme = oData.allowCustomTheme;
this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings;
this.allowAdditionalAccounts = oData.allowAdditionalAccounts;
this.allowIdentities = oData.allowIdentities;
this.title = ko.observable(RL.settingsGet('Title'));
this.loadingDesc = ko.observable(RL.settingsGet('LoadingDescription'));
this.themesOptions = ko.computed(function () {
return _.map(oData.themes(), function (sTheme) {
return {
'optValue': sTheme,
'optText': Utils.convertThemeName(sTheme)
};
});
});
this.languagesOptions = ko.computed(function () {
return _.map(oData.languages(), function (sLanguage) {
return {
'optValue': sLanguage,
'optText': Utils.convertLangName(sLanguage)
};
});
});
this.contactsSupported = RL.settingsGet('ContactsIsSupported');
this.contactsIsAllowed = RL.settingsGet('ContactsIsAllowed');
this.weakPassword = !!RL.settingsGet('WeakPassword');
this.titleTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.loadingDescTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
}
Utils.addSettingsViewModel(AdminGeneral, 'AdminSettingsGeneral', 'General', 'general', true);
AdminGeneral.prototype.onBuild = function ()
{
var self = this;
_.delay(function () {
var
f1 = Utils.settingsSaveHelperSimpleFunction(self.titleTrigger, self),
f2 = Utils.settingsSaveHelperSimpleFunction(self.languageTrigger, self),
f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self),
f4 = Utils.settingsSaveHelperSimpleFunction(self.loadingDescTrigger, self)
;
self.title.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f1, {
'Title': Utils.trim(sValue)
});
});
self.loadingDesc.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f4, {
'LoadingDescription': Utils.trim(sValue)
});
});
self.language.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f2, {
'Language': Utils.trim(sValue)
});
});
self.theme.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f3, {
'Theme': Utils.trim(sValue)
});
});
self.allowCustomTheme.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowCustomTheme': bValue ? '1' : '0'
});
});
self.allowAdditionalAccounts.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowAdditionalAccounts': bValue ? '1' : '0'
});
});
self.allowIdentities.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowIdentities': bValue ? '1' : '0'
});
});
self.allowThemes.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowThemes': bValue ? '1' : '0'
});
});
self.allowLanguagesOnSettings.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowLanguagesOnSettings': bValue ? '1' : '0'
});
});
}, 50);
};

53
dev/Admin/Licensing.js Normal file
View file

@ -0,0 +1,53 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function AdminLicensing()
{
this.licensing = RL.data().licensing;
this.licensingProcess = RL.data().licensingProcess;
this.licenseValid = RL.data().licenseValid;
this.licenseExpired = RL.data().licenseExpired;
this.licenseError = RL.data().licenseError;
this.licenseTrigger = RL.data().licenseTrigger;
this.adminDomain = ko.observable('');
this.subscriptionEnabled = ko.observable(!!RL.settingsGet('SubscriptionEnabled'));
this.licenseTrigger.subscribe(function () {
if (this.subscriptionEnabled())
{
RL.reloadLicensing(true);
}
}, this);
}
Utils.addSettingsViewModel(AdminLicensing, 'AdminSettingsLicensing', 'Licensing', 'licensing');
AdminLicensing.prototype.onBuild = function ()
{
if (this.subscriptionEnabled())
{
RL.reloadLicensing(false);
}
};
AdminLicensing.prototype.onShow = function ()
{
this.adminDomain(RL.settingsGet('AdminDomain'));
};
AdminLicensing.prototype.showActivationForm = function ()
{
kn.showScreenPopup(PopupsActivateViewModel);
};
/**
* @returns {string}
*/
AdminLicensing.prototype.licenseExpiredMomentValue = function ()
{
var oDate = moment.unix(this.licenseExpired());
return oDate.format('LL') + ' (' + oDate.from(moment()) + ')';
};

53
dev/Admin/Login.js Normal file
View file

@ -0,0 +1,53 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function AdminLogin()
{
var oData = RL.data();
this.allowCustomLogin = oData.allowCustomLogin;
this.determineUserLanguage = oData.determineUserLanguage;
this.defaultDomain = ko.observable(RL.settingsGet('LoginDefaultDomain'));
this.allowLanguagesOnLogin = oData.allowLanguagesOnLogin;
this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
}
Utils.addSettingsViewModel(AdminLogin, 'AdminSettingsLogin', 'Login', 'login');
AdminLogin.prototype.onBuild = function ()
{
var self = this;
_.delay(function () {
var f1 = Utils.settingsSaveHelperSimpleFunction(self.defaultDomainTrigger, self);
self.determineUserLanguage.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'DetermineUserLanguage': bValue ? '1' : '0'
});
});
self.allowCustomLogin.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowCustomLogin': bValue ? '1' : '0'
});
});
self.allowLanguagesOnLogin.subscribe(function (bValue) {
RL.remote().saveAdminConfig(null, {
'AllowLanguagesOnLogin': bValue ? '1' : '0'
});
});
self.defaultDomain.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f1, {
'LoginDefaultDomain': Utils.trim(sValue)
});
});
}, 50);
};

105
dev/Admin/Packages.js Normal file
View file

@ -0,0 +1,105 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function AdminPackages()
{
var oData = RL.data();
this.packagesError = ko.observable('');
this.packages = oData.packages;
this.packagesLoading = oData.packagesLoading;
this.packagesReal = oData.packagesReal;
this.packagesMainUpdatable = oData.packagesMainUpdatable;
this.packagesCurrent = ko.computed(function () {
return _.filter(this.packages(), function (oItem) {
return oItem && '' !== oItem['installed'] && !oItem['compare'];
});
}, this);
this.packagesAvailableForUpdate = ko.computed(function () {
return _.filter(this.packages(), function (oItem) {
return oItem && '' !== oItem['installed'] && !!oItem['compare'];
});
}, this);
this.packagesAvailableForInstallation = ko.computed(function () {
return _.filter(this.packages(), function (oItem) {
return oItem && '' === oItem['installed'];
});
}, this);
this.visibility = ko.computed(function () {
return oData.packagesLoading() ? 'visible' : 'hidden';
}, this);
}
Utils.addSettingsViewModel(AdminPackages, 'AdminSettingsPackages', 'Packages', 'packages');
AdminPackages.prototype.onShow = function ()
{
this.packagesError('');
};
AdminPackages.prototype.onBuild = function ()
{
RL.reloadPackagesList();
};
AdminPackages.prototype.requestHelper = function (oPackage, bInstall)
{
var self = this;
return function (sResult, oData) {
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{
if (oData && oData.ErrorCode)
{
self.packagesError(Utils.getNotification(oData.ErrorCode));
}
else
{
self.packagesError(Utils.getNotification(
bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
}
}
_.each(RL.data().packages(), function (oItem) {
if (oItem && oPackage && oItem['loading']() && oPackage['file'] === oItem['file'])
{
oPackage['loading'](false);
oItem['loading'](false);
}
});
if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result['Reload'])
{
window.location.reload();
}
else
{
RL.reloadPackagesList();
}
};
};
AdminPackages.prototype.deletePackage = function (oPackage)
{
if (oPackage)
{
oPackage['loading'](true);
RL.remote().packageDelete(this.requestHelper(oPackage, false), oPackage);
}
};
AdminPackages.prototype.installPackage = function (oPackage)
{
if (oPackage)
{
oPackage['loading'](true);
RL.remote().packageInstall(this.requestHelper(oPackage, true), oPackage);
}
};

79
dev/Admin/Plugins.js Normal file
View file

@ -0,0 +1,79 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function AdminPlugins()
{
var oData = RL.data();
this.enabledPlugins = ko.observable(!!RL.settingsGet('EnabledPlugins'));
this.pluginsError = ko.observable('');
this.plugins = oData.plugins;
this.pluginsLoading = oData.pluginsLoading;
this.visibility = ko.computed(function () {
return oData.pluginsLoading() ? 'visible' : 'hidden';
}, this);
this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
}
Utils.addSettingsViewModel(AdminPlugins, 'AdminSettingsPlugins', 'Plugins', 'plugins');
AdminPlugins.prototype.disablePlugin = function (oPlugin)
{
oPlugin.disabled(!oPlugin.disabled());
RL.remote().pluginDisable(this.onPluginDisableRequest, oPlugin.name, oPlugin.disabled());
};
AdminPlugins.prototype.configurePlugin = function (oPlugin)
{
RL.remote().plugin(this.onPluginLoadRequest, oPlugin.name);
};
AdminPlugins.prototype.onBuild = function ()
{
this.enabledPlugins.subscribe(function (bValue) {
RL.remote().saveAdminConfig(Utils.emptyFunction, {
'EnabledPlugins': bValue ? '1' : '0'
});
});
};
AdminPlugins.prototype.onShow = function ()
{
this.pluginsError('');
RL.reloadPluginList();
};
AdminPlugins.prototype.onPluginLoadRequest = function (sResult, oData)
{
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
kn.showScreenPopup(PopupsPluginViewModel, [oData.Result]);
}
};
AdminPlugins.prototype.onPluginDisableRequest = function (sResult, oData)
{
if (Enums.StorageResultType.Success === sResult && oData)
{
if (!oData.Result && oData.ErrorCode)
{
if (Enums.Notification.UnsupportedPluginPackage === oData.ErrorCode && oData.ErrorMessage && '' !== oData.ErrorMessage)
{
this.pluginsError(oData.ErrorMessage);
}
else
{
this.pluginsError(Utils.getNotification(oData.ErrorCode));
}
}
}
RL.reloadPluginList();
};

89
dev/Admin/Security.js Normal file
View file

@ -0,0 +1,89 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function AdminSecurity()
{
this.csrfProtection = ko.observable(!!RL.settingsGet('UseTokenProtection'));
this.usageStatistics = ko.observable(!!RL.settingsGet('UsageStatistics'));
this.adminLogin = ko.observable(RL.settingsGet('AdminLogin'));
this.adminPassword = ko.observable('');
this.adminPasswordNew = ko.observable('');
this.adminPasswordUpdateError = ko.observable(false);
this.adminPasswordUpdateSuccess = ko.observable(false);
this.adminPassword.subscribe(function () {
this.adminPasswordUpdateError(false);
this.adminPasswordUpdateSuccess(false);
}, this);
this.adminPasswordNew.subscribe(function () {
this.adminPasswordUpdateError(false);
this.adminPasswordUpdateSuccess(false);
}, this);
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
this.saveNewAdminPasswordCommand = Utils.createCommand(this, function () {
this.adminPasswordUpdateError(false);
this.adminPasswordUpdateSuccess(false);
RL.remote().saveNewAdminPassword(this.onNewAdminPasswordResponse, {
'Password': this.adminPassword(),
'NewPassword': this.adminPasswordNew()
});
}, function () {
return '' !== this.adminPassword() && '' !== this.adminPasswordNew();
});
}
Utils.addSettingsViewModel(AdminSecurity, 'AdminSettingsSecurity', 'Security', 'security');
AdminSecurity.prototype.onNewAdminPasswordResponse = function (sResult, oData)
{
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{
this.adminPassword('');
this.adminPasswordNew('');
this.adminPasswordUpdateSuccess(true);
}
else
{
this.adminPasswordUpdateError(true);
}
};
AdminSecurity.prototype.onBuild = function ()
{
this.csrfProtection.subscribe(function (bValue) {
RL.remote().saveAdminConfig(Utils.emptyFunction, {
'TokenProtection': bValue ? '1' : '0'
});
});
this.usageStatistics.subscribe(function (bValue) {
RL.remote().saveAdminConfig(Utils.emptyFunction, {
'UsageStatistics': bValue ? '1' : '0'
});
});
};
AdminSecurity.prototype.onHide = function ()
{
this.adminPassword('');
this.adminPasswordNew('');
};
/**
* @return {string}
*/
AdminSecurity.prototype.phpInfoLink = function ()
{
return RL.link().phpInfo();
};

117
dev/Admin/Social.js Normal file
View file

@ -0,0 +1,117 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function AdminSocial()
{
var oData = RL.data();
this.googleEnable = oData.googleEnable;
this.googleClientID = oData.googleClientID;
this.googleClientSecret = oData.googleClientSecret;
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
this.facebookEnable = oData.facebookEnable;
this.facebookAppID = oData.facebookAppID;
this.facebookAppSecret = oData.facebookAppSecret;
this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
this.twitterEnable = oData.twitterEnable;
this.twitterConsumerKey = oData.twitterConsumerKey;
this.twitterConsumerSecret = oData.twitterConsumerSecret;
this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
this.dropboxEnable = oData.dropboxEnable;
this.dropboxApiKey = oData.dropboxApiKey;
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
}
Utils.addSettingsViewModel(AdminSocial, 'AdminSettingsSocial', 'Social', 'social');
AdminSocial.prototype.onBuild = function ()
{
var self = this;
_.delay(function () {
var
f1 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger1, self),
f2 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger2, self),
f3 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger1, self),
f4 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger2, self),
f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
f7 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self)
;
self.facebookEnable.subscribe(function (bValue) {
RL.remote().saveAdminConfig(Utils.emptyFunction, {
'FacebookEnable': bValue ? '1' : '0'
});
});
self.facebookAppID.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f1, {
'FacebookAppID': Utils.trim(sValue)
});
});
self.facebookAppSecret.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f2, {
'FacebookAppSecret': Utils.trim(sValue)
});
});
self.twitterEnable.subscribe(function (bValue) {
RL.remote().saveAdminConfig(Utils.emptyFunction, {
'TwitterEnable': bValue ? '1' : '0'
});
});
self.twitterConsumerKey.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f3, {
'TwitterConsumerKey': Utils.trim(sValue)
});
});
self.twitterConsumerSecret.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f4, {
'TwitterConsumerSecret': Utils.trim(sValue)
});
});
self.googleEnable.subscribe(function (bValue) {
RL.remote().saveAdminConfig(Utils.emptyFunction, {
'GoogleEnable': bValue ? '1' : '0'
});
});
self.googleClientID.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f5, {
'GoogleClientID': Utils.trim(sValue)
});
});
self.googleClientSecret.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f6, {
'GoogleClientSecret': Utils.trim(sValue)
});
});
self.dropboxEnable.subscribe(function (bValue) {
RL.remote().saveAdminConfig(Utils.emptyFunction, {
'DropboxEnable': bValue ? '1' : '0'
});
});
self.dropboxApiKey.subscribe(function (sValue) {
RL.remote().saveAdminConfig(f7, {
'DropboxApiKey': Utils.trim(sValue)
});
});
}, 50);
};