Welcome page branding option

This commit is contained in:
RainLoop Team 2015-04-10 02:05:49 +04:00
parent acb013fbb5
commit 351c12c002
50 changed files with 531 additions and 160 deletions

View file

@ -1219,6 +1219,11 @@
kn.showScreenPopup(require('View/Popup/TwoFactorConfiguration'), [true]);
};
AppUser.prototype.bootstartWelcomePopup = function (sUrl)
{
kn.showScreenPopup(require('View/Popup/WelcomePage'), [sUrl]);
};
AppUser.prototype.bootstartLoginScreen = function ()
{
Globals.$html.removeClass('rl-user-auth').addClass('rl-user-no-auth');
@ -1416,6 +1421,13 @@
Plugins.runHook('rl-start-user-screens');
Events.pub('rl.bootstart-user-screens');
if (Settings.settingsGet('WelcomePageUrl'))
{
_.delay(function () {
self.bootstartWelcomePopup(Settings.settingsGet('WelcomePageUrl'));
}, 1000);
}
if (!!Settings.settingsGet('AccountSignMe') && window.navigator.registerProtocolHandler)
{
_.delay(function () {

View file

@ -5,6 +5,7 @@
var
_ = require('_'),
$ = require('$'),
AbstractComponent = require('Component/Abstract')
;
@ -20,13 +21,26 @@
{
AbstractComponent.call(this);
if (oParams.component && oParams.component.templateNodes && oParams.element)
if (oParams.component && oParams.component.templateNodes && oParams.element &&
oParams.element[0] && oParams.element[0].outerHTML)
{
oParams.element.text('');
if (oParams.component.templateNodes[0] && oParams.component.templateNodes[0].nodeValue)
var sScript = oParams.element[0].outerHTML;
sScript = sScript
.replace(/<x-script/i, '<script')
.replace(/<b><\/b><\/x-script>/i, '</script>')
;
if (sScript)
{
oParams.element.text('');
oParams.element.replaceWith(
$('<script></script>').text(oParams.component.templateNodes[0].nodeValue));
$(sScript).text(oParams.component.templateNodes[0] &&
oParams.component.templateNodes[0].nodeValue ?
oParams.component.templateNodes[0].nodeValue : ''));
}
else
{
oParams.element.remove();
}
}
}

42
dev/External/ko.js vendored
View file

@ -57,16 +57,16 @@
'init': function (oElement, fValueAccessor) {
var
$oEl = null,
bi18n = true,
sValue = '',
Translator = null,
$oEl = $(oElement),
bMobile = 'on' === ($oEl.data('tooltip-mobile') || 'off'),
Globals = require('Common/Globals')
;
if (!Globals.bMobileDevice)
if (!Globals.bMobileDevice || bMobile)
{
$oEl = $(oElement);
bi18n = 'on' === ($oEl.data('tooltip-i18n') || 'on');
sValue = bi18n ? ko.unwrap(fValueAccessor()) : fValueAccessor()();
@ -74,6 +74,7 @@
{
oElement.__opentip = new Opentip(oElement, {
'style': 'rainloopTip',
'showOn': 'mouseover click',
'element': oElement,
'tipJoint': $oEl.data('tooltip-join') || 'bottom'
});
@ -120,12 +121,14 @@
var
bi18n = true,
sValue = '',
$oEl = $(oElement),
bMobile = 'on' === ($oEl.data('tooltip-mobile') || 'off'),
Globals = require('Common/Globals')
;
if (!Globals.bMobileDevice && oElement.__opentip)
if ((!Globals.bMobileDevice || bMobile) && oElement.__opentip)
{
bi18n = 'on' === ($(oElement).data('tooltip-i18n') || 'on');
bi18n = 'on' === ($oEl.data('tooltip-i18n') || 'on');
sValue = bi18n ? ko.unwrap(fValueAccessor()) : fValueAccessor()();
if (sValue)
@ -150,6 +153,8 @@
oElement.__opentip = new Opentip(oElement, {
'style': 'rainloopTestTip',
'showOn': 'mouseover click',
'hideOn': 'mouseout click',
'element': oElement,
'tipJoint': $oEl.data('tooltip-join') || 'top'
});
@ -183,21 +188,20 @@
}
else
{
if ($oEl.is(':visible'))
{
oOpenTips.activate();
oOpenTips.setContent(sValue);
_.delay(function () {
_.delay(function () {
if ($oEl.is(':visible'))
{
oOpenTips.activate();
oOpenTips.setContent(sValue);
oOpenTips.show();
}, 100);
}
else
{
oOpenTips.hide();
oOpenTips.setContent('');
oOpenTips.deactivate();
}
}
else
{
oOpenTips.hide();
oOpenTips.setContent('');
oOpenTips.deactivate();
}
}, 100);
}
}
}

View file

@ -89,7 +89,6 @@
}, 500);
};
UserAjaxUserPromises.prototype.folderDelete = function (sFolderFullNameRaw, fTrigger)
{
return this.postRequest('FolderDelete', fTrigger, {
@ -113,6 +112,11 @@
});
};
UserAjaxUserPromises.prototype.welcomeClose = function ()
{
return this.postRequest('WelcomeClose');
};
// UserAjaxUserPromises.prototype.messageList = function (sFolderFullNameRaw, iOffset, iLimit, sSearch, fTrigger)
// {
// sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);

View file

@ -7,7 +7,8 @@
_ = require('_'),
ko = require('ko'),
Utils = require('Common/Utils')
Utils = require('Common/Utils'),
Translator = require('Common/Translator')
;
/**
@ -47,6 +48,21 @@
this.userCss = ko.observable(Settings.settingsGet('UserCss'));
this.userCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.welcomePageUrl = ko.observable(Settings.settingsGet('WelcomePageUrl'));
this.welcomePageUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.welcomePageDisplay = ko.observable(Settings.settingsGet('WelcomePageDisplay'));
this.welcomePageDisplay.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.welcomePageDisplay.options = ko.computed(function () {
Translator.trigger();
return [
{'optValue': 'none', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
{'optValue': 'once', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
{'optValue': 'always', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
];
});
this.loginPowered = ko.observable(!!Settings.settingsGet('LoginPowered'));
}
@ -69,7 +85,9 @@
f5 = Utils.settingsSaveHelperSimpleFunction(self.loginCss.trigger, self),
f6 = Utils.settingsSaveHelperSimpleFunction(self.userLogo.trigger, self),
f7 = Utils.settingsSaveHelperSimpleFunction(self.loginBackground.trigger, self),
f8 = Utils.settingsSaveHelperSimpleFunction(self.userCss.trigger, self)
f8 = Utils.settingsSaveHelperSimpleFunction(self.userCss.trigger, self),
f9 = Utils.settingsSaveHelperSimpleFunction(self.welcomePageUrl.trigger, self),
f10 = Utils.settingsSaveHelperSimpleFunction(self.welcomePageDisplay.trigger, self)
;
self.title.subscribe(function (sValue) {
@ -120,6 +138,18 @@
});
});
self.welcomePageUrl.subscribe(function (sValue) {
Remote.saveAdminConfig(f9, {
'WelcomePageUrl': Utils.trim(sValue)
});
});
self.welcomePageDisplay.subscribe(function (sValue) {
Remote.saveAdminConfig(f10, {
'WelcomePageDisplay': Utils.trim(sValue)
});
});
self.loginPowered.subscribe(function (bValue) {
Remote.saveAdminConfig(null, {
'LoginPowered': bValue ? '1' : '0'

View file

@ -16,6 +16,7 @@
{
this.oSettings = window['rainloopAppData'] || {};
this.oSettings = Utils.isNormal(this.oSettings) ? this.oSettings : {};
// window.console.log(this.oSettings);
}
SettingsStorage.prototype.oSettings = null;

View file

@ -54,6 +54,7 @@
@import "Components.less";
@import "SystemDropDown.less";
@import "Login.less";
@import "WelcomPage.less";
@import "Ask.less";
@import "Shortcuts.less";
@import "FolderList.less";

View file

@ -103,5 +103,9 @@
.legend {
width: 670px;
}
.nav-tabs {
width: 670px;
}
}
}

View file

@ -0,0 +1,9 @@
.popups {
.b-welcom-page-content {
.modal-header {
background-color: #fff;
}
}
}

View file

@ -162,6 +162,7 @@
this.testingDone(false);
this.testingImapError(false);
this.testingSieveError(false);
this.testingSmtpError(false);
this.testing(true);
@ -295,26 +296,29 @@
this.testingDone(true);
this.testingImapError(true !== oData.Result.Imap);
this.testingSmtpError(true !== oData.Result.Smtp);
this.testingSieveError(true !== oData.Result.Sieve);
this.testingSmtpError(true !== oData.Result.Smtp);
if (this.testingImapError() && oData.Result.Imap)
{
bImap = true;
this.testingImapErrorDesc('');
this.testingImapErrorDesc(oData.Result.Imap);
}
if (this.testingSmtpError() && oData.Result.Smtp)
{
this.testingSmtpErrorDesc(oData.Result.Smtp);
}
if (this.testingSieveError() && oData.Result.Sieve)
{
bSieve = true;
this.testingSieveErrorDesc('');
this.testingSieveErrorDesc(oData.Result.Sieve);
}
if (this.testingSmtpError() && oData.Result.Smtp)
{
this.testingSmtpErrorDesc('');
this.testingSmtpErrorDesc(oData.Result.Smtp);
}
if (this.sieveSettings())
{
if (!bSieve && bImap)
@ -333,8 +337,8 @@
else
{
this.testingImapError(true);
this.testingSmtpError(true);
this.testingSieveError(true);
this.testingSmtpError(true);
this.sieveSettings(false);
}
};
@ -365,8 +369,8 @@
this.testing(false);
this.testingDone(false);
this.testingImapError(false);
this.testingSmtpError(false);
this.testingSieveError(false);
this.testingSmtpError(false);
};
DomainPopupView.prototype.onHide = function ()

View file

@ -0,0 +1,62 @@
(function () {
'use strict';
var
_ = require('_'),
ko = require('ko'),
Promises = require('Promises/User/Ajax'),
kn = require('Knoin/Knoin'),
AbstractView = require('Knoin/AbstractView')
;
/**
* @constructor
* @extends AbstractView
*/
function WelcomePagePopupView()
{
AbstractView.call(this, 'Popups', 'PopupsWelcomePage');
this.welcomePageURL = ko.observable('');
this.closeFocused = ko.observable(false);
kn.constructorEnd(this);
}
kn.extendAsViewModel(['View/Popup/WelcomePage', 'WelcomePagePopupViewModel'], WelcomePagePopupView);
_.extend(WelcomePagePopupView.prototype, AbstractView.prototype);
WelcomePagePopupView.prototype.clearPopup = function ()
{
this.welcomePageURL('');
this.closeFocused(false);
};
/**
* @param {string} sUrl
*/
WelcomePagePopupView.prototype.onShow = function (sUrl)
{
this.clearPopup();
this.welcomePageURL(sUrl);
};
WelcomePagePopupView.prototype.onShowWithDelay = function ()
{
this.closeFocused(true);
};
WelcomePagePopupView.prototype.onHide = function ()
{
Promises.welcomeClose();
};
module.exports = WelcomePagePopupView;
}());

View file

@ -843,7 +843,7 @@
;
// exit fullscreen, back
key('esc', Enums.KeyState.MessageView, _.bind(this.escShortcuts, this));
key('esc, backspace', Enums.KeyState.MessageView, _.bind(this.escShortcuts, this));
// fullscreen
key('enter', Enums.KeyState.MessageView, function () {