"Use preview pane" settings refactoring (Layout)

This commit is contained in:
RainLoop Team 2014-02-04 00:06:35 +04:00
parent 6928fcc48e
commit 74ad0e2ca1
15 changed files with 284 additions and 246 deletions

View file

@ -750,9 +750,12 @@ Utils.initDataConstructorBySettings = function (oData)
oData.desktopNotifications = ko.observable(false);
oData.useThreads = ko.observable(true);
oData.replySameFolder = ko.observable(true);
oData.usePreviewPane = ko.observable(true);
oData.layout = ko.observable(Enums.Layout.SidePreview);
oData.useCheckboxesInList = ko.observable(true);
oData.layout = ko.observable(Enums.Layout.SidePreview);
oData.usePreviewPane = ko.computed(function () {
return Enums.Layout.NoPreview !== oData.layout();
});
oData.interfaceAnimation.subscribe(function (sValue) {
if (Globals.bMobileDevice || sValue === Enums.InterfaceAnimation.None)

View file

@ -49,7 +49,7 @@ MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPrevie
{
if (Utils.isUnd(bPreview) ? false : !!bPreview)
{
if (!RL.data().usePreviewPane() && !RL.data().message())
if (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())
{
RL.historyBack();
}
@ -70,7 +70,7 @@ MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPrevie
.messageListSearch(sSearch)
;
if (!oData.usePreviewPane() && oData.message())
if (Enums.Layout.NoPreview === oData.layout() && oData.message())
{
oData.message(null);
oData.messageFullScreenMode(false);
@ -110,14 +110,14 @@ MailBoxScreen.prototype.onStart = function ()
RL.remote().appDelayStart(Utils.emptyFunction);
}, 35000);
$html.toggleClass('rl-no-preview-pane', !oData.usePreviewPane());
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout());
oData.folderList.subscribe(fResizeFunction);
oData.messageList.subscribe(fResizeFunction);
oData.message.subscribe(fResizeFunction);
oData.usePreviewPane.subscribe(function (bValue) {
$html.toggleClass('rl-no-preview-pane', !bValue);
oData.layout.subscribe(function (nValue) {
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
});
oData.foldersInboxUnreadCount.subscribe(function () {

View file

@ -17,8 +17,8 @@ function SettingsGeneral()
this.threading = oData.threading;
this.useThreads = oData.useThreads;
this.replySameFolder = oData.replySameFolder;
this.usePreviewPane = oData.usePreviewPane;
this.layout = oData.layout;
this.usePreviewPane = oData.usePreviewPane;
this.useCheckboxesInList = oData.useCheckboxesInList;
this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings;
@ -43,6 +43,11 @@ function SettingsGeneral()
Utils.addSettingsViewModel(SettingsGeneral, 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
SettingsGeneral.prototype.toggleLayout = function ()
{
this.layout(Enums.Layout.NoPreview === this.layout() ? Enums.Layout.SidePreview : Enums.Layout.NoPreview);
};
SettingsGeneral.prototype.onBuild = function ()
{
var self = this;
@ -127,15 +132,6 @@ SettingsGeneral.prototype.onBuild = function ()
});
});
oData.usePreviewPane.subscribe(function (bValue) {
oData.messageList([]);
RL.remote().saveSettings(Utils.emptyFunction, {
'UsePreviewPane': bValue ? '1' : '0'
});
});
oData.layout.subscribe(function (nValue) {
oData.messageList([]);

View file

@ -11,6 +11,7 @@ function AbstractData()
AbstractData.prototype.populateDataOnStart = function()
{
var
mLayout = Utils.pInt(RL.settingsGet('Layout')),
aLanguages = RL.settingsGet('Languages'),
aThemes = RL.settingsGet('Themes')
;
@ -48,9 +49,13 @@ AbstractData.prototype.populateDataOnStart = function()
this.desktopNotifications(!!RL.settingsGet('DesktopNotifications'));
this.useThreads(!!RL.settingsGet('UseThreads'));
this.replySameFolder(!!RL.settingsGet('ReplySameFolder'));
this.usePreviewPane(!!RL.settingsGet('UsePreviewPane'));
this.layout(!!RL.settingsGet('UsePreviewPane') ? Enums.Layout.SidePreview : Enums.Layout.NoPreview); // TODO
this.useCheckboxesInList(!!RL.settingsGet('UseCheckboxesInList'));
this.layout(Enums.Layout.SidePreview);
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
{
this.layout(mLayout);
}
this.facebookEnable(!!RL.settingsGet('AllowFacebookSocial'));
this.facebookAppID(RL.settingsGet('FacebookAppID'));

View file

@ -42,15 +42,19 @@ MailBoxFolderListViewModel.prototype.onBuild = function (oDom)
oEvent.preventDefault();
var oFolder = ko.dataFor(this);
var
oData = RL.data(),
oFolder = ko.dataFor(this)
;
if (oFolder)
{
if (!RL.data().usePreviewPane())
if (Enums.Layout.NoPreview === oData.layout())
{
RL.data().message(null);
oData.message(null);
}
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
if (oFolder.fullNameRaw === oData.currentFolderFullNameRaw())
{
RL.cache().setFolderHash(oFolder.fullNameRaw, '');
}

View file

@ -28,6 +28,7 @@ function MailBoxMessageViewViewModel()
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;

View file

@ -1104,7 +1104,7 @@ class Actions
$aResult['DesktopNotifications'] = false;
$aResult['UseThreads'] = false;
$aResult['ReplySameFolder'] = false;
$aResult['UsePreviewPane'] = (bool) $oConfig->Get('webmail', 'use_preview_pane', true);
$aResult['Layout'] = \RainLoop\Enumerations\Layout::SIDE_PREVIEW;
$aResult['UseCheckboxesInList'] = true;
$aResult['DisplayName'] = '';
$aResult['ReplyTo'] = '';
@ -1139,7 +1139,7 @@ class Actions
$aResult['DesktopNotifications'] = (bool) $oSettings->GetConf('DesktopNotifications', $aResult['DesktopNotifications']);
$aResult['UseThreads'] = (bool) $oSettings->GetConf('UseThreads', $aResult['UseThreads']);
$aResult['ReplySameFolder'] = (bool) $oSettings->GetConf('ReplySameFolder', $aResult['ReplySameFolder']);
$aResult['UsePreviewPane'] = (bool) $oSettings->GetConf('UsePreviewPane', $aResult['UsePreviewPane']);
$aResult['Layout'] = (int) $oSettings->GetConf('Layout', $aResult['Layout']);
$aResult['UseCheckboxesInList'] = (bool) $oSettings->GetConf('UseCheckboxesInList', $aResult['UseCheckboxesInList']);
$aResult['InterfaceAnimation'] = (string) $oSettings->GetConf('InterfaceAnimation', $aResult['InterfaceAnimation']);
$aResult['CustomThemeType'] = (string) $oSettings->GetConf('CustomThemeType', $aResult['CustomThemeType']);
@ -3070,6 +3070,12 @@ class Actions
$this->setSettingsFromParams($oSettings, 'MPP', 'int', function ($iValue) {
return (int) (\in_array($iValue, array(10, 20, 30, 50, 100, 150, 200, 300)) ? $iValue : 20);
});
$this->setSettingsFromParams($oSettings, 'Layout', 'int', function ($iValue) {
return (int) (\in_array((int) $iValue, array(\RainLoop\Enumerations\Layout::NO_PREVIW,
\RainLoop\Enumerations\Layout::SIDE_PREVIEW, \RainLoop\Enumerations\Layout::BOTTOM_PREVIEW)) ?
$iValue : \RainLoop\Enumerations\Layout::SIDE_PREVIEW);
});
$this->setSettingsFromParams($oSettings, 'EditorDefaultType', 'string');
$this->setSettingsFromParams($oSettings, 'ShowImages', 'bool');
@ -3084,8 +3090,6 @@ class Actions
$this->setSettingsFromParams($oSettings, 'DesktopNotifications', 'bool');
$this->setSettingsFromParams($oSettings, 'UseThreads', 'bool');
$this->setSettingsFromParams($oSettings, 'ReplySameFolder', 'bool');
$this->setSettingsFromParams($oSettings, 'UsePreviewPane', 'bool');
$this->setSettingsFromParams($oSettings, 'UseCheckboxesInList', 'bool');
$this->setSettingsFromParams($oSettings, 'DisplayName', 'string');

View file

@ -70,8 +70,6 @@ class Application extends \RainLoop\Config\AbstractConfig
'allow_additional_accounts' => array(true, ''),
'allow_identities' => array(true, ''),
'use_preview_pane' => array(true, 'Whether message preview pane should be used'),
'messages_per_page' => array(20, ' Number of messages displayed on page by default'),
'editor_default_type' => array('Html', 'Editor mode used by default (Html or Plain)'),

View file

@ -0,0 +1,10 @@
<?php
namespace RainLoop\Enumerations;
class Layout
{
const NO_PREVIW = 0;
const SIDE_PREVIEW = 1;
const BOTTOM_PREVIEW = 2;
}

View file

@ -87,7 +87,7 @@
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="SETTINGS_GENERAL/LABEL_USE_CHECKBOXES_IN_LIST"></span>
</label>
<label data-bind="click: function () { usePreviewPane(!usePreviewPane()); }">
<label data-bind="click: toggleLayout">
<i data-bind="css: usePreviewPane() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n-text="SETTINGS_GENERAL/LABEL_USE_PREVIEW_PANE"></span>

View file

@ -637,7 +637,7 @@
border-radius: 8px;
}
/*! normalize.css 2012-03-11T12:53 UTC - http://github.com/necolas/normalize.css */
/* =============================================================================
@ -1142,7 +1142,7 @@ table {
border-collapse: collapse;
border-spacing: 0;
}
@charset "UTF-8";
@font-face {
@ -1474,7 +1474,7 @@ table {
.icon-mail:before {
content: "\e062";
}
/** initial setup **/
.nano {
/*
@ -1591,7 +1591,7 @@ table {
.nano > .pane2:hover > .slider2, .nano > .pane2.active > .slider2 {
background-color: rgba(0, 0, 0, 0.4);
}
/* Magnific Popup CSS */
.mfp-bg {
top: 0;
@ -1956,7 +1956,7 @@ img.mfp-img {
right: 0;
padding-top: 0; }
/* overlay at start */
.mfp-fade.mfp-bg {
@ -2002,7 +2002,7 @@ img.mfp-img {
-moz-transform: translateX(50px);
transform: translateX(50px);
}
.simple-pace {
-webkit-pointer-events: none;
pointer-events: none;
@ -2073,7 +2073,7 @@ img.mfp-img {
@keyframes simple-pace-stripe-animation {
0% { transform: none; transform: none; }
100% { transform: translate(-32px, 0); transform: translate(-32px, 0); }
}
}
.inputosaurus-container {
background-color:#fff;
border:1px solid #bcbec0;
@ -2141,7 +2141,7 @@ img.mfp-img {
box-shadow:none;
}
.inputosaurus-input-hidden { display:none; }
.flag-wrapper {
width: 24px;
height: 16px;
@ -2182,7 +2182,7 @@ img.mfp-img {
.flag.flag-pt-br {background-position: -192px -11px}
.flag.flag-cn, .flag.flag-zh-tw, .flag.flag-zh-cn, .flag.flag-zh-hk {background-position: -208px -22px}
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
.clearfix {
*zoom: 1;

View file

@ -1,5 +1,5 @@
/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, _) {
/*! RainLoop Webmail Admin Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, _) {
'use strict';
@ -70,14 +70,14 @@ var
$document = $(window.document),
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
;
;
/*jshint onevar: false*/
/**
* @type {?AdminApp}
*/
var RL = null;
/*jshint onevar: true*/
/**
* @type {?}
*/
@ -164,7 +164,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
return oType && 'application/pdf' === oType.type;
});
}
Consts.Defaults = {};
Consts.Values = {};
Consts.DataImages = {};
@ -282,7 +282,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
* @type {string}
*/
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
/**
* @enum {string}
*/
@ -626,7 +626,7 @@ Enums.Notification = {
'UnknownNotification': 999,
'UnknownError': 999
};
Utils.trim = $.trim;
Utils.inArray = $.inArray;
Utils.isArray = _.isArray;
@ -1377,9 +1377,12 @@ Utils.initDataConstructorBySettings = function (oData)
oData.desktopNotifications = ko.observable(false);
oData.useThreads = ko.observable(true);
oData.replySameFolder = ko.observable(true);
oData.usePreviewPane = ko.observable(true);
oData.layout = ko.observable(Enums.Layout.SidePreview);
oData.useCheckboxesInList = ko.observable(true);
oData.layout = ko.observable(Enums.Layout.SidePreview);
oData.usePreviewPane = ko.computed(function () {
return Enums.Layout.NoPreview !== oData.layout();
});
oData.interfaceAnimation.subscribe(function (sValue) {
if (Globals.bMobileDevice || sValue === Enums.InterfaceAnimation.None)
@ -2193,7 +2196,7 @@ Utils.computedPagenatorHelper = function (koCurrentPage, koPageCount)
return aResult;
};
};
// Base64 encode / decode
// http://www.webtoolkit.info/
@ -2356,7 +2359,7 @@ Base64 = {
}
};
/*jslint bitwise: false*/
/*jslint bitwise: false*/
ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) {
if (!Globals.bMobileDevice)
@ -2978,7 +2981,7 @@ ko.observable.fn.validateFunc = function (fFunc)
return this;
};
/**
* @constructor
*/
@ -3276,7 +3279,7 @@ LinkBuilder.prototype.socialFacebook = function ()
{
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
};
/**
* @type {Object}
*/
@ -3370,7 +3373,7 @@ Plugins.settingsGet = function (sPluginSection, sName)
};
/**
* @constructor
*/
@ -3444,7 +3447,7 @@ CookieDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -3516,7 +3519,7 @@ LocalStorageDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -3559,7 +3562,7 @@ LocalStorage.prototype.get = function (iKey)
{
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
};
/**
* @constructor
*/
@ -3572,7 +3575,7 @@ KnoinAbstractBoot.prototype.bootstart = function ()
{
};
/**
* @param {string=} sPosition = ''
* @param {string=} sTemplate = ''
@ -3632,7 +3635,7 @@ KnoinAbstractViewModel.prototype.viewModelPosition = function ()
KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototype.closeCommand = function ()
{
};
/**
* @param {string} sScreenName
* @param {?=} aViewModels = []
@ -3708,7 +3711,7 @@ KnoinAbstractScreen.prototype.__start = function ()
this.oCross = oRoute;
}
};
/**
* @constructor
*/
@ -4099,7 +4102,7 @@ Knoin.prototype.bootstart = function ()
};
kn = new Knoin();
/**
* @param {string=} sEmail
* @param {string=} sName
@ -4463,7 +4466,7 @@ EmailModel.prototype.inputoTagLine = function ()
{
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -4683,7 +4686,7 @@ PopupsDomainViewModel.prototype.clearForm = function ()
this.smtpAuth(true);
this.whiteList('');
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -4820,7 +4823,7 @@ PopupsPluginViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -4936,7 +4939,7 @@ PopupsActivateViewModel.prototype.validateSubscriptionKey = function ()
{
var sValue = this.key();
return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
};
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5010,7 +5013,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
RL.data().mainLanguage(sLang);
this.cancelCommand();
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5128,7 +5131,7 @@ PopupsAskViewModel.prototype.onBuild = function ()
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5215,7 +5218,7 @@ AdminLoginViewModel.prototype.onHide = function ()
{
this.loginFocus(false);
};
/**
* @param {?} oScreen
*
@ -5237,7 +5240,7 @@ AdminMenuViewModel.prototype.link = function (sRoute)
{
return '#/' + sRoute;
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -5259,7 +5262,7 @@ AdminPaneViewModel.prototype.logoutClick = function ()
RL.remote().adminLogout(function () {
RL.loginAndLogoutReload();
});
};
};
/**
* @constructor
*/
@ -5359,7 +5362,7 @@ AdminGeneral.prototype.selectLanguage = function ()
{
kn.showScreenPopup(PopupsLanguagesViewModel);
};
/**
* @constructor
*/
@ -5411,7 +5414,7 @@ AdminLogin.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -5480,7 +5483,7 @@ AdminBranding.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -5700,7 +5703,7 @@ AdminContacts.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -5789,7 +5792,7 @@ AdminDomains.prototype.onDomainListChangeRequest = function ()
{
RL.reloadDomainList();
};
/**
* @constructor
*/
@ -5877,7 +5880,7 @@ AdminSecurity.prototype.phpInfoLink = function ()
{
return RL.link().phpInfo();
};
/**
* @constructor
*/
@ -5993,7 +5996,7 @@ AdminSocial.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -6090,7 +6093,7 @@ AdminPlugins.prototype.onPluginDisableRequest = function (sResult, oData)
RL.reloadPluginList();
};
/**
* @constructor
*/
@ -6194,7 +6197,7 @@ AdminPackages.prototype.installPackage = function (oPackage)
RL.remote().packageInstall(this.requestHelper(oPackage, true), oPackage);
}
};
/**
* @constructor
*/
@ -6245,7 +6248,7 @@ AdminLicensing.prototype.licenseExpiredMomentValue = function ()
{
var oDate = moment.unix(this.licenseExpired());
return oDate.format('LL') + ' (' + oDate.from(moment()) + ')';
};
};
/**
* @constructor
*/
@ -6257,6 +6260,7 @@ function AbstractData()
AbstractData.prototype.populateDataOnStart = function()
{
var
mLayout = Utils.pInt(RL.settingsGet('Layout')),
aLanguages = RL.settingsGet('Languages'),
aThemes = RL.settingsGet('Themes')
;
@ -6294,9 +6298,13 @@ AbstractData.prototype.populateDataOnStart = function()
this.desktopNotifications(!!RL.settingsGet('DesktopNotifications'));
this.useThreads(!!RL.settingsGet('UseThreads'));
this.replySameFolder(!!RL.settingsGet('ReplySameFolder'));
this.usePreviewPane(!!RL.settingsGet('UsePreviewPane'));
this.layout(!!RL.settingsGet('UsePreviewPane') ? Enums.Layout.SidePreview : Enums.Layout.NoPreview); // TODO
this.useCheckboxesInList(!!RL.settingsGet('UseCheckboxesInList'));
this.layout(Enums.Layout.SidePreview);
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
{
this.layout(mLayout);
}
this.facebookEnable(!!RL.settingsGet('AllowFacebookSocial'));
this.facebookAppID(RL.settingsGet('FacebookAppID'));
@ -6315,7 +6323,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
};
/**
* @constructor
* @extends AbstractData
@ -6349,7 +6357,7 @@ _.extend(AdminDataStorage.prototype, AbstractData.prototype);
AdminDataStorage.prototype.populateDataOnStart = function()
{
AbstractData.prototype.populateDataOnStart.call(this);
};
};
/**
* @constructor
*/
@ -6623,7 +6631,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
'Version': sVersion
});
};
/**
* @constructor
* @extends AbstractAjaxRemoteStorage
@ -6867,7 +6875,7 @@ AdminAjaxRemoteStorage.prototype.adminPing = function (fCallback)
{
this.defaultRequest(fCallback, 'AdminPing');
};
/**
* @constructor
*/
@ -6933,7 +6941,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{
this.oEmailsPicsHashes = oData;
};
/**
* @constructor
* @extends AbstractCacheStorage
@ -6944,7 +6952,7 @@ function AdminCacheStorage()
}
_.extend(AdminCacheStorage.prototype, AbstractCacheStorage.prototype);
/**
* @param {Array} aViewModels
* @constructor
@ -7121,7 +7129,7 @@ AbstractSettings.prototype.routes = function ()
['', oRules]
];
};
/**
* @constructor
* @extends KnoinAbstractScreen
@ -7136,7 +7144,7 @@ _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
AdminLoginScreen.prototype.onShow = function ()
{
RL.setTitle('');
};
};
/**
* @constructor
* @extends AbstractSettings
@ -7156,7 +7164,7 @@ AdminSettingsScreen.prototype.onShow = function ()
// AbstractSettings.prototype.onShow.call(this);
RL.setTitle('');
};
};
/**
* @constructor
* @extends KnoinAbstractBoot
@ -7472,7 +7480,7 @@ AbstractApp.prototype.bootstart = function ()
ssm.ready();
};
/**
* @constructor
* @extends AbstractApp
@ -7719,7 +7727,7 @@ AdminApp.prototype.bootstart = function ()
* @type {AdminApp}
*/
RL = new AdminApp();
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
@ -7766,9 +7774,9 @@ window['__RLBOOT'] = function (fCall) {
window['__RLBOOT'] = null;
});
};
if (window.SimplePace) {
window.SimplePace.add(10);
}
}
}(window, jQuery, ko, crossroads, hasher, _));

File diff suppressed because one or more lines are too long

View file

@ -1,5 +1,5 @@
/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible) {
/*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (window, $, ko, crossroads, hasher, moment, Jua, _, ifvisible) {
'use strict';
@ -70,14 +70,14 @@ var
$document = $(window.document),
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
;
;
/*jshint onevar: false*/
/**
* @type {?RainLoopApp}
*/
var RL = null;
/*jshint onevar: true*/
/**
* @type {?}
*/
@ -164,7 +164,7 @@ if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
return oType && 'application/pdf' === oType.type;
});
}
Consts.Defaults = {};
Consts.Values = {};
Consts.DataImages = {};
@ -282,7 +282,7 @@ Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA
* @type {string}
*/
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
/**
* @enum {string}
*/
@ -626,7 +626,7 @@ Enums.Notification = {
'UnknownNotification': 999,
'UnknownError': 999
};
Utils.trim = $.trim;
Utils.inArray = $.inArray;
Utils.isArray = _.isArray;
@ -1377,9 +1377,12 @@ Utils.initDataConstructorBySettings = function (oData)
oData.desktopNotifications = ko.observable(false);
oData.useThreads = ko.observable(true);
oData.replySameFolder = ko.observable(true);
oData.usePreviewPane = ko.observable(true);
oData.layout = ko.observable(Enums.Layout.SidePreview);
oData.useCheckboxesInList = ko.observable(true);
oData.layout = ko.observable(Enums.Layout.SidePreview);
oData.usePreviewPane = ko.computed(function () {
return Enums.Layout.NoPreview !== oData.layout();
});
oData.interfaceAnimation.subscribe(function (sValue) {
if (Globals.bMobileDevice || sValue === Enums.InterfaceAnimation.None)
@ -2193,7 +2196,7 @@ Utils.computedPagenatorHelper = function (koCurrentPage, koPageCount)
return aResult;
};
};
// Base64 encode / decode
// http://www.webtoolkit.info/
@ -2356,7 +2359,7 @@ Base64 = {
}
};
/*jslint bitwise: false*/
/*jslint bitwise: false*/
ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) {
if (!Globals.bMobileDevice)
@ -2978,7 +2981,7 @@ ko.observable.fn.validateFunc = function (fFunc)
return this;
};
/**
* @constructor
*/
@ -3276,7 +3279,7 @@ LinkBuilder.prototype.socialFacebook = function ()
{
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
};
/**
* @type {Object}
*/
@ -3370,7 +3373,7 @@ Plugins.settingsGet = function (sPluginSection, sName)
};
/**
* @constructor
*/
@ -4266,7 +4269,7 @@ HtmlEditor.htmlFunctions = {
}, this), this.toolbar);
}
};
/**
* @constructor
* @param {koProperty} oKoList
@ -4807,7 +4810,7 @@ Selector.prototype.on = function (sEventName, fCallback)
{
this.oCallbacks[sEventName] = fCallback;
};
/**
* @constructor
*/
@ -4881,7 +4884,7 @@ CookieDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -4953,7 +4956,7 @@ LocalStorageDriver.prototype.get = function (sKey)
return mResult;
};
/**
* @constructor
*/
@ -4996,7 +4999,7 @@ LocalStorage.prototype.get = function (iKey)
{
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
};
/**
* @constructor
*/
@ -5009,7 +5012,7 @@ KnoinAbstractBoot.prototype.bootstart = function ()
{
};
/**
* @param {string=} sPosition = ''
* @param {string=} sTemplate = ''
@ -5069,7 +5072,7 @@ KnoinAbstractViewModel.prototype.viewModelPosition = function ()
KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototype.closeCommand = function ()
{
};
/**
* @param {string} sScreenName
* @param {?=} aViewModels = []
@ -5145,7 +5148,7 @@ KnoinAbstractScreen.prototype.__start = function ()
this.oCross = oRoute;
}
};
/**
* @constructor
*/
@ -5536,7 +5539,7 @@ Knoin.prototype.bootstart = function ()
};
kn = new Knoin();
/**
* @param {string=} sEmail
* @param {string=} sName
@ -5900,7 +5903,7 @@ EmailModel.prototype.inputoTagLine = function ()
{
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
};
/**
* @constructor
*/
@ -6022,7 +6025,7 @@ ContactModel.prototype.lineAsCcc = function ()
return aResult.join(' ');
};
/**
* @param {number=} iType = Enums.ContactPropertyType.Unknown
* @param {string=} sValue = ''
@ -6044,7 +6047,7 @@ function ContactPropertyModel(iType, sValue, bFocused, sPlaceholder)
return sPlaceholder ? Utils.i18n(sPlaceholder) : '';
}, this);
}
/**
* @constructor
*/
@ -6280,7 +6283,7 @@ AttachmentModel.prototype.iconClass = function ()
return sClass;
};
/**
* @constructor
* @param {string} sId
@ -6341,7 +6344,7 @@ ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
}
return bResult;
};
};
/**
* @constructor
*/
@ -7319,7 +7322,7 @@ MessageModel.prototype.showInternalImages = function (bLazy)
Utils.windowResize(500);
}
};
/**
* @constructor
*/
@ -7653,7 +7656,7 @@ FolderModel.prototype.printableFullName = function ()
{
return this.fullName.split(this.delimiter).join(' / ');
};
/**
* @param {string} sEmail
* @param {boolean=} bCanBeDelete = true
@ -7674,7 +7677,7 @@ AccountModel.prototype.email = '';
AccountModel.prototype.changeAccountLink = function ()
{
return RL.link().change(this.email);
};
};
/**
* @param {string} sId
* @param {string} sEmail
@ -7710,7 +7713,7 @@ IdentityModel.prototype.formattedNameForEmail = function ()
var sName = this.name();
return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -7820,7 +7823,7 @@ PopupsFolderClearViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -7944,7 +7947,7 @@ PopupsFolderCreateViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -8063,7 +8066,7 @@ PopupsFolderSystemViewModel.prototype.onBuild = function ()
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -9511,7 +9514,7 @@ PopupsComposeViewModel.prototype.triggerForResize = function ()
this.resizer(!this.resizer());
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10151,7 +10154,7 @@ PopupsContactsViewModel.prototype.onHide = function ()
oItem.checked(false);
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10295,7 +10298,7 @@ PopupsAdvancedSearchViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10423,7 +10426,7 @@ PopupsAddAccountViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10585,7 +10588,7 @@ PopupsIdentityViewModel.prototype.onBuild = function ()
return bResult;
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10659,7 +10662,7 @@ PopupsLanguagesViewModel.prototype.changeLanguage = function (sLang)
RL.data().mainLanguage(sLang);
this.cancelCommand();
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10777,7 +10780,7 @@ PopupsAskViewModel.prototype.onBuild = function ()
});
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -10840,7 +10843,7 @@ PopupsPgpKey.prototype.onShow = function (bPrivate, fCallback)
this.bPrivate = bPrivate;
this.fCallback = fCallback;
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11112,7 +11115,7 @@ LoginViewModel.prototype.selectLanguage = function ()
kn.showScreenPopup(PopupsLanguagesViewModel);
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11179,7 +11182,7 @@ AbstractSystemDropDownViewModel.prototype.logoutClick = function ()
RL.loginAndLogoutReload(true, RL.settingsGet('ParentEmail') && 0 < RL.settingsGet('ParentEmail').length);
});
};
};
/**
* @constructor
* @extends AbstractSystemDropDownViewModel
@ -11191,7 +11194,7 @@ function MailBoxSystemDropDownViewModel()
}
Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
/**
* @constructor
* @extends AbstractSystemDropDownViewModel
@ -11203,7 +11206,7 @@ function SettingsSystemDropDownViewModel()
}
Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel);
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -11246,15 +11249,19 @@ MailBoxFolderListViewModel.prototype.onBuild = function (oDom)
oEvent.preventDefault();
var oFolder = ko.dataFor(this);
var
oData = RL.data(),
oFolder = ko.dataFor(this)
;
if (oFolder)
{
if (!RL.data().usePreviewPane())
if (Enums.Layout.NoPreview === oData.layout())
{
RL.data().message(null);
oData.message(null);
}
if (oFolder.fullNameRaw === RL.data().currentFolderFullNameRaw())
if (oFolder.fullNameRaw === oData.currentFolderFullNameRaw())
{
RL.cache().setFolderHash(oFolder.fullNameRaw, '');
}
@ -11318,7 +11325,7 @@ MailBoxFolderListViewModel.prototype.contactsClick = function ()
kn.showScreenPopup(PopupsContactsViewModel);
}
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -12237,7 +12244,7 @@ MailBoxMessageListViewModel.prototype.initUploaderForAppend = function ()
;
return !!oJua;
};
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -12266,6 +12273,7 @@ function MailBoxMessageViewViewModel()
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;
@ -12625,7 +12633,7 @@ MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
}
};
/**
* @param {?} oScreen
*
@ -12652,7 +12660,7 @@ SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox());
};
/**
* @constructor
* @extends KnoinAbstractViewModel
@ -12675,7 +12683,7 @@ SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox());
};
/**
* @constructor
*/
@ -12693,8 +12701,8 @@ function SettingsGeneral()
this.threading = oData.threading;
this.useThreads = oData.useThreads;
this.replySameFolder = oData.replySameFolder;
this.usePreviewPane = oData.usePreviewPane;
this.layout = oData.layout;
this.usePreviewPane = oData.usePreviewPane;
this.useCheckboxesInList = oData.useCheckboxesInList;
this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings;
@ -12719,6 +12727,11 @@ function SettingsGeneral()
Utils.addSettingsViewModel(SettingsGeneral, 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
SettingsGeneral.prototype.toggleLayout = function ()
{
this.layout(Enums.Layout.NoPreview === this.layout() ? Enums.Layout.SidePreview : Enums.Layout.NoPreview);
};
SettingsGeneral.prototype.onBuild = function ()
{
var self = this;
@ -12803,15 +12816,6 @@ SettingsGeneral.prototype.onBuild = function ()
});
});
oData.usePreviewPane.subscribe(function (bValue) {
oData.messageList([]);
RL.remote().saveSettings(Utils.emptyFunction, {
'UsePreviewPane': bValue ? '1' : '0'
});
});
oData.layout.subscribe(function (nValue) {
oData.messageList([]);
@ -12839,7 +12843,7 @@ SettingsGeneral.prototype.selectLanguage = function ()
{
kn.showScreenPopup(PopupsLanguagesViewModel);
};
/**
* @constructor
*/
@ -12877,7 +12881,7 @@ SettingsContacts.prototype.onShow = function ()
{
this.showPassword(false);
};
/**
* @constructor
*/
@ -12943,7 +12947,7 @@ SettingsAccounts.prototype.deleteAccount = function (oAccountToRemove)
}
}
};
/**
* @constructor
*/
@ -13001,7 +13005,7 @@ SettingsIdentity.prototype.onBuild = function ()
}, 50);
};
/**
* @constructor
*/
@ -13129,7 +13133,7 @@ SettingsIdentities.prototype.onBuild = function (oDom)
});
}, 50);
};
};
/**
* @constructor
*/
@ -13196,7 +13200,7 @@ function SettingsSocialScreen()
}
Utils.addSettingsViewModel(SettingsSocialScreen, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
/**
* @constructor
*/
@ -13260,7 +13264,7 @@ SettingsChangePasswordScreen.prototype.onChangePasswordResponse = function (sRes
this.passwordUpdateError(true);
}
};
/**
* @constructor
*/
@ -13455,7 +13459,7 @@ SettingsFolders.prototype.unSubscribeFolder = function (oFolder)
oFolder.subScribed(false);
};
/**
* @constructor
*/
@ -13672,7 +13676,7 @@ SettingsThemes.prototype.initCustomThemeUploader = function ()
return false;
};
/**
* @constructor
*/
@ -13684,6 +13688,7 @@ function AbstractData()
AbstractData.prototype.populateDataOnStart = function()
{
var
mLayout = Utils.pInt(RL.settingsGet('Layout')),
aLanguages = RL.settingsGet('Languages'),
aThemes = RL.settingsGet('Themes')
;
@ -13721,9 +13726,13 @@ AbstractData.prototype.populateDataOnStart = function()
this.desktopNotifications(!!RL.settingsGet('DesktopNotifications'));
this.useThreads(!!RL.settingsGet('UseThreads'));
this.replySameFolder(!!RL.settingsGet('ReplySameFolder'));
this.usePreviewPane(!!RL.settingsGet('UsePreviewPane'));
this.layout(!!RL.settingsGet('UsePreviewPane') ? Enums.Layout.SidePreview : Enums.Layout.NoPreview); // TODO
this.useCheckboxesInList(!!RL.settingsGet('UseCheckboxesInList'));
this.layout(Enums.Layout.SidePreview);
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
{
this.layout(mLayout);
}
this.facebookEnable(!!RL.settingsGet('AllowFacebookSocial'));
this.facebookAppID(RL.settingsGet('FacebookAppID'));
@ -13742,7 +13751,7 @@ AbstractData.prototype.populateDataOnStart = function()
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
};
/**
* @constructor
* @extends AbstractData
@ -14764,7 +14773,7 @@ WebMailDataStorage.prototype.setMessageList = function (oData, bCached)
));
}
};
/**
* @constructor
*/
@ -15038,7 +15047,7 @@ AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
'Version': sVersion
});
};
/**
* @constructor
* @extends AbstractAjaxRemoteStorage
@ -15738,7 +15747,7 @@ WebMailAjaxRemoteStorage.prototype.socialUsers = function (fCallback)
this.defaultRequest(fCallback, 'SocialUsers');
};
/**
* @constructor
*/
@ -15804,7 +15813,7 @@ AbstractCacheStorage.prototype.setEmailsPicsHashesData = function (oData)
{
this.oEmailsPicsHashes = oData;
};
/**
* @constructor
* @extends AbstractCacheStorage
@ -16122,7 +16131,7 @@ WebMailCacheStorage.prototype.storeMessageFlagsToCacheByFolderAndUid = function
this.setMessageFlagsToCache(sFolder, sUid, aFlags);
}
};
/**
* @param {Array} aViewModels
* @constructor
@ -16299,7 +16308,7 @@ AbstractSettings.prototype.routes = function ()
['', oRules]
];
};
/**
* @constructor
* @extends KnoinAbstractScreen
@ -16314,7 +16323,7 @@ _.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
LoginScreen.prototype.onShow = function ()
{
RL.setTitle('');
};
};
/**
* @constructor
* @extends KnoinAbstractScreen
@ -16364,7 +16373,7 @@ MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPrevie
{
if (Utils.isUnd(bPreview) ? false : !!bPreview)
{
if (!RL.data().usePreviewPane() && !RL.data().message())
if (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())
{
RL.historyBack();
}
@ -16385,7 +16394,7 @@ MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPrevie
.messageListSearch(sSearch)
;
if (!oData.usePreviewPane() && oData.message())
if (Enums.Layout.NoPreview === oData.layout() && oData.message())
{
oData.message(null);
oData.messageFullScreenMode(false);
@ -16425,14 +16434,14 @@ MailBoxScreen.prototype.onStart = function ()
RL.remote().appDelayStart(Utils.emptyFunction);
}, 35000);
$html.toggleClass('rl-no-preview-pane', !oData.usePreviewPane());
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout());
oData.folderList.subscribe(fResizeFunction);
oData.messageList.subscribe(fResizeFunction);
oData.message.subscribe(fResizeFunction);
oData.usePreviewPane.subscribe(function (bValue) {
$html.toggleClass('rl-no-preview-pane', !bValue);
oData.layout.subscribe(function (nValue) {
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
});
oData.foldersInboxUnreadCount.subscribe(function () {
@ -16495,7 +16504,7 @@ MailBoxScreen.prototype.routes = function ()
[/^([^\/]*)$/, {'normalize_': fNormS}]
];
};
/**
* @constructor
* @extends AbstractSettings
@ -16523,7 +16532,7 @@ SettingsScreen.prototype.onShow = function ()
RL.setTitle(this.sSettingsTitle);
};
/**
* @constructor
* @extends KnoinAbstractBoot
@ -16839,7 +16848,7 @@ AbstractApp.prototype.bootstart = function ()
ssm.ready();
};
/**
* @constructor
* @extends AbstractApp
@ -17785,7 +17794,7 @@ RainLoopApp.prototype.bootstart = function ()
* @type {RainLoopApp}
*/
RL = new RainLoopApp();
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
@ -17832,9 +17841,9 @@ window['__RLBOOT'] = function (fCall) {
window['__RLBOOT'] = null;
});
};
if (window.SimplePace) {
window.SimplePace.add(10);
}
}
}(window, jQuery, ko, crossroads, hasher, moment, Jua, _, ifvisible));

File diff suppressed because one or more lines are too long