diff --git a/dev/Settings/Identities.js b/dev/Settings/Identities.js index 40eebdfb6..7f5561712 100644 --- a/dev/Settings/Identities.js +++ b/dev/Settings/Identities.js @@ -9,6 +9,7 @@ function SettingsIdentities() this.displayName = oData.displayName; this.signature = oData.signature; + this.signatureToAll = oData.signatureToAll; this.replyTo = oData.replyTo; this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle); @@ -119,5 +120,11 @@ SettingsIdentities.prototype.onBuild = function (oDom) }); }); + oData.signatureToAll.subscribe(function (bValue) { + RL.remote().saveSettings(null, { + 'SignatureToAll': bValue ? '1' : '0' + }); + }); + }, 50); }; \ No newline at end of file diff --git a/dev/Settings/Identity.js b/dev/Settings/Identity.js index 586d70ede..cdbda0cc7 100644 --- a/dev/Settings/Identity.js +++ b/dev/Settings/Identity.js @@ -9,6 +9,7 @@ function SettingsIdentity() this.displayName = oData.displayName; this.signature = oData.signature; + this.signatureToAll = oData.signatureToAll; this.replyTo = oData.replyTo; this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle); @@ -47,6 +48,12 @@ SettingsIdentity.prototype.onBuild = function () 'Signature': sValue }); }); + + oData.signatureToAll.subscribe(function (bValue) { + RL.remote().saveSettings(null, { + 'SignatureToAll': bValue ? '1' : '0' + }); + }); }, 50); }; diff --git a/dev/Storages/WebMailData.js b/dev/Storages/WebMailData.js index 820e3350a..dd94a672e 100644 --- a/dev/Storages/WebMailData.js +++ b/dev/Storages/WebMailData.js @@ -66,6 +66,7 @@ function WebMailDataStorage() // personal this.displayName = ko.observable(''); this.signature = ko.observable(''); + this.signatureToAll = ko.observable(false); this.replyTo = ko.observable(''); // accounts @@ -398,6 +399,7 @@ WebMailDataStorage.prototype.populateDataOnStart = function() this.displayName(RL.settingsGet('DisplayName')); this.replyTo(RL.settingsGet('ReplyTo')); this.signature(RL.settingsGet('Signature')); + this.signatureToAll(!!RL.settingsGet('SignatureToAll')); this.lastFoldersHash = RL.local().get(Enums.ClientSideKeyName.FoldersLashHash) || ''; diff --git a/dev/ViewModels/PopupsComposeViewModel.js b/dev/ViewModels/PopupsComposeViewModel.js index 328c5a81b..6316fa655 100644 --- a/dev/ViewModels/PopupsComposeViewModel.js +++ b/dev/ViewModels/PopupsComposeViewModel.js @@ -565,6 +565,26 @@ PopupsComposeViewModel.prototype.onHide = function () kn.routeOn(); }; +PopupsComposeViewModel.prototype.convertSignature = function (sSignature, sFrom) +{ + if ('' !== sSignature) + { + sFrom = Utils.pString(sFrom); + if ('' !== sFrom) + { + sSignature = sSignature.replace(/{{FROM}}/, sFrom); + } + else + { + sSignature = sSignature.replace(/{{IF:FROM}}[\s\S]+{{\/IF:FROM}}/gm, ''); + } + + sSignature = Utils.trim(sSignature.replace(/{{FROM}}/, '').replace(/{{IF:FROM}}/, '').replace(/{{\/IF:FROM}}/, '')); + } + + return sSignature; +}; + /** * @param {string=} sType = Enums.ComposeType.Empty * @param {?MessageModel|Array=} oMessageOrArray = null @@ -587,11 +607,13 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE aResplyAllParts = [], oExcludeEmail = {}, mEmail = RL.data().accountEmail(), + sSignature = RL.data().signature(), + bSignatureToAll = RL.data().signatureToAll(), aDownloads = [], aDraftInfo = null, oMessage = null, sComposeType = sType || Enums.ComposeType.Empty, - fEmailArrayToStringLineHelper = function (aList) { + fEmailArrayToStringLineHelper = function (aList, bFriendly) { var iIndex = 0, @@ -601,7 +623,7 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE for (; iIndex < iLen; iIndex++) { - aResult.push(aList[iIndex].toLine(false)); + aResult.push(aList[iIndex].toLine(!!bFriendly)); } return aResult.join(', '); @@ -732,12 +754,19 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE break; } + if (bSignatureToAll && '' !== sSignature) + { + sText = Utils.convertPlainTextToHtml(this.convertSignature(sSignature, + fEmailArrayToStringLineHelper(oMessage.from, true))) + '
' + sText; + } + this.oEditor.setRawText(sText, oMessage.isHtml()); } } else if (this.oEditor && Enums.ComposeType.Empty === sComposeType) { - this.oEditor.setRawText('
' + Utils.convertPlainTextToHtml(RL.data().signature()), Enums.EditorDefaultType.Html === RL.data().editorDefaultType()); + this.oEditor.setRawText(Utils.convertPlainTextToHtml(this.convertSignature(sSignature)), + Enums.EditorDefaultType.Html === RL.data().editorDefaultType()); } else if (Utils.isNonEmptyArray(oMessageOrArray)) { diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index 1c03c67ab..be4b05ebd 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -1103,6 +1103,7 @@ class Actions $aResult['DisplayName'] = ''; $aResult['ReplyTo'] = ''; $aResult['Signature'] = ''; + $aResult['SignatureToAll'] = false; $aResult['ParentEmail'] = ''; $aResult['InterfaceAnimation'] = \RainLoop\Enumerations\InterfaceAnimation::NORMAL; $aResult['CustomThemeType'] = \RainLoop\Enumerations\CustomThemeType::LIGHT; @@ -1141,6 +1142,7 @@ class Actions $aResult['DisplayName'] = $oSettings->GetConf('DisplayName', $aResult['DisplayName']); $aResult['ReplyTo'] = $oSettings->GetConf('ReplyTo', $aResult['ReplyTo']); $aResult['Signature'] = $oSettings->GetConf('Signature', $aResult['Signature']); + $aResult['SignatureToAll'] = !!$oSettings->GetConf('SignatureToAll', $aResult['SignatureToAll']); $aResult['ParentEmail'] = $oAccount->ParentEmail(); } @@ -3082,6 +3084,7 @@ class Actions $this->setSettingsFromParams($oSettings, 'DisplayName', 'string'); $this->setSettingsFromParams($oSettings, 'ReplyTo', 'string'); $this->setSettingsFromParams($oSettings, 'Signature', 'string'); + $this->setSettingsFromParams($oSettings, 'SignatureToAll', 'bool'); $this->setSettingsFromParams($oSettings, 'CustomThemeImg', 'string'); diff --git a/rainloop/v/0.0.0/app/templates/Views/SettingsIdentities.html b/rainloop/v/0.0.0/app/templates/Views/SettingsIdentities.html index c355158be..01a68e989 100644 --- a/rainloop/v/0.0.0/app/templates/Views/SettingsIdentities.html +++ b/rainloop/v/0.0.0/app/templates/Views/SettingsIdentities.html @@ -4,31 +4,40 @@
- +
- +
+
+
+ +
+

diff --git a/rainloop/v/0.0.0/app/templates/Views/SettingsIdentity.html b/rainloop/v/0.0.0/app/templates/Views/SettingsIdentity.html index 6c47d38c0..833f64d62 100644 --- a/rainloop/v/0.0.0/app/templates/Views/SettingsIdentity.html +++ b/rainloop/v/0.0.0/app/templates/Views/SettingsIdentity.html @@ -29,5 +29,14 @@
+
+
+ +
+
\ No newline at end of file diff --git a/rainloop/v/0.0.0/langs/de.ini b/rainloop/v/0.0.0/langs/de.ini index 630a09287..bd2e654bb 100644 --- a/rainloop/v/0.0.0/langs/de.ini +++ b/rainloop/v/0.0.0/langs/de.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identity" LABEL_DISPLAY_NAME = "Name" LABEL_REPLY_TO = "Reply To" LABEL_SIGNATURE = "Signatur" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Allgemein" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Additional Identities" LABEL_DISPLAY_NAME = "Name" LABEL_REPLY_TO = "Reply To" LABEL_SIGNATURE = "Signatur" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Add Identity" BUTTON_DELETE = "Delete" LOADING_PROCESS = "Updating identity list" diff --git a/rainloop/v/0.0.0/langs/en.ini b/rainloop/v/0.0.0/langs/en.ini index a8bae0b20..7825098ad 100644 --- a/rainloop/v/0.0.0/langs/en.ini +++ b/rainloop/v/0.0.0/langs/en.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identity" LABEL_DISPLAY_NAME = "Name" LABEL_REPLY_TO = "Reply-To" LABEL_SIGNATURE = "Signature" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "General" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Additional Identities" LABEL_DISPLAY_NAME = "Name" LABEL_REPLY_TO = "Reply-To" LABEL_SIGNATURE = "Signature" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Add Identity" BUTTON_DELETE = "Delete" LOADING_PROCESS = "Updating identity list" diff --git a/rainloop/v/0.0.0/langs/es.ini b/rainloop/v/0.0.0/langs/es.ini index 6b92c9118..7aeb5a43a 100644 --- a/rainloop/v/0.0.0/langs/es.ini +++ b/rainloop/v/0.0.0/langs/es.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identity" LABEL_DISPLAY_NAME = "Nombre" LABEL_REPLY_TO = "Responder a" LABEL_SIGNATURE = "Firma" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "General" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Additional Identities" LABEL_DISPLAY_NAME = "Nombre" LABEL_REPLY_TO = "Responder a" LABEL_SIGNATURE = "Firma" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Add Identity" BUTTON_DELETE = "Delete" LOADING_PROCESS = "Updating identity list" diff --git a/rainloop/v/0.0.0/langs/fr.ini b/rainloop/v/0.0.0/langs/fr.ini index 941595faa..3bf188b30 100644 --- a/rainloop/v/0.0.0/langs/fr.ini +++ b/rainloop/v/0.0.0/langs/fr.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identité" LABEL_DISPLAY_NAME = "Nom" LABEL_REPLY_TO = "Répondre à" LABEL_SIGNATURE = "Signature" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Général" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Identités supplémentaires" LABEL_DISPLAY_NAME = "Nom" LABEL_REPLY_TO = "Répondre à" LABEL_SIGNATURE = "Signature" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Ajouter une identitié" BUTTON_DELETE = "Supprimer" LOADING_PROCESS = "Met à jour la liste d'identités" diff --git a/rainloop/v/0.0.0/langs/is.ini b/rainloop/v/0.0.0/langs/is.ini index 4c8fae277..334cd8c23 100644 --- a/rainloop/v/0.0.0/langs/is.ini +++ b/rainloop/v/0.0.0/langs/is.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identity" LABEL_DISPLAY_NAME = "Nafn" LABEL_REPLY_TO = "Svara" LABEL_SIGNATURE = "Undirskrift" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Almennt" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Additional Identities" LABEL_DISPLAY_NAME = "Nafn" LABEL_REPLY_TO = "Svara" LABEL_SIGNATURE = "Undirskrift" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Add Identity" BUTTON_DELETE = "Delete" LOADING_PROCESS = "Updating identity list" diff --git a/rainloop/v/0.0.0/langs/ko-kr.ini b/rainloop/v/0.0.0/langs/ko-kr.ini index f134dc408..ceef67187 100644 --- a/rainloop/v/0.0.0/langs/ko-kr.ini +++ b/rainloop/v/0.0.0/langs/ko-kr.ini @@ -292,6 +292,7 @@ LEGEND_IDENTITY = "신원" LABEL_DISPLAY_NAME = "이름" LABEL_REPLY_TO = "답장" LABEL_SIGNATURE = "서명" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "일반" @@ -379,6 +380,7 @@ LEGEND_IDENTITIES = "새 신원 추가" LABEL_DISPLAY_NAME = "이름" LABEL_REPLY_TO = "답장" LABEL_SIGNATURE = "서명" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "신원 추가" BUTTON_DELETE = "삭제" LOADING_PROCESS = "신원 목록을 업데이트하고 있습니다." diff --git a/rainloop/v/0.0.0/langs/lv.ini b/rainloop/v/0.0.0/langs/lv.ini index a2a16ee48..c1882b116 100644 --- a/rainloop/v/0.0.0/langs/lv.ini +++ b/rainloop/v/0.0.0/langs/lv.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identity" LABEL_DISPLAY_NAME = "Vārds" LABEL_REPLY_TO = "Atbildēt uz" LABEL_SIGNATURE = "Paraksts" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Vispārējie" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Additional Identities" LABEL_DISPLAY_NAME = "Vārds" LABEL_REPLY_TO = "Atbildēt uz" LABEL_SIGNATURE = "Paraksts" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Add Identity" BUTTON_DELETE = "Delete" LOADING_PROCESS = "Updating identity list" diff --git a/rainloop/v/0.0.0/langs/nl.ini b/rainloop/v/0.0.0/langs/nl.ini index f6667c58e..bf4d8bad0 100644 --- a/rainloop/v/0.0.0/langs/nl.ini +++ b/rainloop/v/0.0.0/langs/nl.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identity" LABEL_DISPLAY_NAME = "Naam" LABEL_REPLY_TO = "Antwoorden naar" LABEL_SIGNATURE = "Handtekening" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Algemeen" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Additional Identities" LABEL_DISPLAY_NAME = "Naam" LABEL_REPLY_TO = "Antwoorden naar" LABEL_SIGNATURE = "Handtekening" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Add Identity" BUTTON_DELETE = "Delete" LOADING_PROCESS = "Updating identity list" diff --git a/rainloop/v/0.0.0/langs/no.ini b/rainloop/v/0.0.0/langs/no.ini index 96d5a45fc..40682660e 100644 --- a/rainloop/v/0.0.0/langs/no.ini +++ b/rainloop/v/0.0.0/langs/no.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identitet" LABEL_DISPLAY_NAME = "Navn" LABEL_REPLY_TO = "Svar til" LABEL_SIGNATURE = "Signatur" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Generelt" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Tilleggs Identities" LABEL_DISPLAY_NAME = "Navn" LABEL_REPLY_TO = "Svar til" LABEL_SIGNATURE = "Signatur" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Legg Identity" BUTTON_DELETE = "Slett" LOADING_PROCESS = "Oppdaterer identitet liste" diff --git a/rainloop/v/0.0.0/langs/pl.ini b/rainloop/v/0.0.0/langs/pl.ini index 0cd11e930..d909853bd 100644 --- a/rainloop/v/0.0.0/langs/pl.ini +++ b/rainloop/v/0.0.0/langs/pl.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Tożsamość" LABEL_DISPLAY_NAME = "Imie" LABEL_REPLY_TO = "Zwrotny adres e-mail" LABEL_SIGNATURE = "Sygnatura" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Ogólne" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Dodatkowe Tożsamości" LABEL_DISPLAY_NAME = "Nazwa" LABEL_REPLY_TO = "Odp. do" LABEL_SIGNATURE = "Sygnatura" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Dodaj Tożsamość" BUTTON_DELETE = "Usuń" LOADING_PROCESS = "Aktualizuj listę tożsamości" diff --git a/rainloop/v/0.0.0/langs/pt-br.ini b/rainloop/v/0.0.0/langs/pt-br.ini index 57af7b73e..cce056ad1 100644 --- a/rainloop/v/0.0.0/langs/pt-br.ini +++ b/rainloop/v/0.0.0/langs/pt-br.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identity" LABEL_DISPLAY_NAME = "Nome" LABEL_REPLY_TO = "Reenviar para" LABEL_SIGNATURE = "Assinatura" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Geral" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Additional Identities" LABEL_DISPLAY_NAME = "Nome" LABEL_REPLY_TO = "Reenviar para" LABEL_SIGNATURE = "Assinatura" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Add Identity" BUTTON_DELETE = "Delete" LOADING_PROCESS = "Updating identity list" diff --git a/rainloop/v/0.0.0/langs/pt-pt.ini b/rainloop/v/0.0.0/langs/pt-pt.ini index 3e834a533..3bba5c914 100644 --- a/rainloop/v/0.0.0/langs/pt-pt.ini +++ b/rainloop/v/0.0.0/langs/pt-pt.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Identity" LABEL_DISPLAY_NAME = "Nome" LABEL_REPLY_TO = "Reenviar para" LABEL_SIGNATURE = "Assinatura" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Geral" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Additional Identities" LABEL_DISPLAY_NAME = "Nome" LABEL_REPLY_TO = "Reenviar para" LABEL_SIGNATURE = "Assinatura" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "Add Identity" BUTTON_DELETE = "Delete" LOADING_PROCESS = "Updating identity list" diff --git a/rainloop/v/0.0.0/langs/ru.ini b/rainloop/v/0.0.0/langs/ru.ini index 6e3eca28b..ee6716416 100644 --- a/rainloop/v/0.0.0/langs/ru.ini +++ b/rainloop/v/0.0.0/langs/ru.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "Настройки профиля" LABEL_DISPLAY_NAME = "Имя" LABEL_REPLY_TO = "Отвечать на" LABEL_SIGNATURE = "Подпись" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "Основные Настройки" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "Дополнительные профили" LABEL_DISPLAY_NAME = "Имя" LABEL_REPLY_TO = "Отвечать на" LABEL_SIGNATURE = "Подпись" +LABEL_ADD_SIGNATURE_TO_ALL = "Добавлять свою подпись ко всем исходящим сообщениям" BUTTON_ADD_IDENTITY = "Добавить профиль" BUTTON_DELETE = "Удалить" LOADING_PROCESS = "Обновление списка профилей" diff --git a/rainloop/v/0.0.0/langs/zh-cn.ini b/rainloop/v/0.0.0/langs/zh-cn.ini index 6133a4155..0ba196c3b 100644 --- a/rainloop/v/0.0.0/langs/zh-cn.ini +++ b/rainloop/v/0.0.0/langs/zh-cn.ini @@ -295,6 +295,7 @@ LEGEND_IDENTITY = "签名" LABEL_DISPLAY_NAME = "名称" LABEL_REPLY_TO = "回复" LABEL_SIGNATURE = "签名" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" [SETTINGS_GENERAL] LEGEND_GENERAL = "一般设置" @@ -382,6 +383,7 @@ LEGEND_IDENTITIES = "附加签名" LABEL_DISPLAY_NAME = "名称" LABEL_REPLY_TO = "回复" LABEL_SIGNATURE = "签名" +LABEL_ADD_SIGNATURE_TO_ALL = "Add your signature to all the outgoing messages" BUTTON_ADD_IDENTITY = "添加签名" BUTTON_DELETE = "删除" LOADING_PROCESS = "更新签名中" diff --git a/rainloop/v/0.0.0/static/js/app.js b/rainloop/v/0.0.0/static/js/app.js index c91a61e10..ac89dc248 100644 --- a/rainloop/v/0.0.0/static/js/app.js +++ b/rainloop/v/0.0.0/static/js/app.js @@ -8573,6 +8573,26 @@ PopupsComposeViewModel.prototype.onHide = function () kn.routeOn(); }; +PopupsComposeViewModel.prototype.convertSignature = function (sSignature, sFrom) +{ + if ('' !== sSignature) + { + sFrom = Utils.pString(sFrom); + if ('' !== sFrom) + { + sSignature = sSignature.replace(/{{FROM}}/, sFrom); + } + else + { + sSignature = sSignature.replace(/{{IF:FROM}}[\s\S]+{{\/IF:FROM}}/gm, ''); + } + + sSignature = Utils.trim(sSignature.replace(/{{FROM}}/, '').replace(/{{IF:FROM}}/, '').replace(/{{\/IF:FROM}}/, '')); + } + + return sSignature; +}; + /** * @param {string=} sType = Enums.ComposeType.Empty * @param {?MessageModel|Array=} oMessageOrArray = null @@ -8595,11 +8615,13 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE aResplyAllParts = [], oExcludeEmail = {}, mEmail = RL.data().accountEmail(), + sSignature = RL.data().signature(), + bSignatureToAll = RL.data().signatureToAll(), aDownloads = [], aDraftInfo = null, oMessage = null, sComposeType = sType || Enums.ComposeType.Empty, - fEmailArrayToStringLineHelper = function (aList) { + fEmailArrayToStringLineHelper = function (aList, bFriendly) { var iIndex = 0, @@ -8609,7 +8631,7 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE for (; iIndex < iLen; iIndex++) { - aResult.push(aList[iIndex].toLine(false)); + aResult.push(aList[iIndex].toLine(!!bFriendly)); } return aResult.join(', '); @@ -8740,12 +8762,19 @@ PopupsComposeViewModel.prototype.onShow = function (sType, oMessageOrArray, aToE break; } + if (bSignatureToAll && '' !== sSignature) + { + sText = Utils.convertPlainTextToHtml(this.convertSignature(sSignature, + fEmailArrayToStringLineHelper(oMessage.from, true))) + '
' + sText; + } + this.oEditor.setRawText(sText, oMessage.isHtml()); } } else if (this.oEditor && Enums.ComposeType.Empty === sComposeType) { - this.oEditor.setRawText('
' + Utils.convertPlainTextToHtml(RL.data().signature()), Enums.EditorDefaultType.Html === RL.data().editorDefaultType()); + this.oEditor.setRawText(Utils.convertPlainTextToHtml(this.convertSignature(sSignature)), + Enums.EditorDefaultType.Html === RL.data().editorDefaultType()); } else if (Utils.isNonEmptyArray(oMessageOrArray)) { @@ -12687,6 +12716,7 @@ function SettingsIdentity() this.displayName = oData.displayName; this.signature = oData.signature; + this.signatureToAll = oData.signatureToAll; this.replyTo = oData.replyTo; this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle); @@ -12725,6 +12755,12 @@ SettingsIdentity.prototype.onBuild = function () 'Signature': sValue }); }); + + oData.signatureToAll.subscribe(function (bValue) { + RL.remote().saveSettings(null, { + 'SignatureToAll': bValue ? '1' : '0' + }); + }); }, 50); }; @@ -12738,6 +12774,7 @@ function SettingsIdentities() this.displayName = oData.displayName; this.signature = oData.signature; + this.signatureToAll = oData.signatureToAll; this.replyTo = oData.replyTo; this.displayNameTrigger = ko.observable(Enums.SaveSettingsStep.Idle); @@ -12848,6 +12885,12 @@ SettingsIdentities.prototype.onBuild = function (oDom) }); }); + oData.signatureToAll.subscribe(function (bValue) { + RL.remote().saveSettings(null, { + 'SignatureToAll': bValue ? '1' : '0' + }); + }); + }, 50); }; /** @@ -13528,6 +13571,7 @@ function WebMailDataStorage() // personal this.displayName = ko.observable(''); this.signature = ko.observable(''); + this.signatureToAll = ko.observable(false); this.replyTo = ko.observable(''); // accounts @@ -13860,6 +13904,7 @@ WebMailDataStorage.prototype.populateDataOnStart = function() this.displayName(RL.settingsGet('DisplayName')); this.replyTo(RL.settingsGet('ReplyTo')); this.signature(RL.settingsGet('Signature')); + this.signatureToAll(!!RL.settingsGet('SignatureToAll')); this.lastFoldersHash = RL.local().get(Enums.ClientSideKeyName.FoldersLashHash) || ''; diff --git a/rainloop/v/0.0.0/static/js/app.min.js b/rainloop/v/0.0.0/static/js/app.min.js index ea165d815..3cf400edd 100644 --- a/rainloop/v/0.0.0/static/js/app.min.js +++ b/rainloop/v/0.0.0/static/js/app.min.js @@ -1,9 +1,9 @@ /*! RainLoop Webmail Main Module (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */ !function(a,b,c,d,e,f,g,h){"use strict";function i(){this.sBase="#/",this.sCdnStaticDomain=Cb.settingsGet("CdnStaticDomain"),this.sVersion=Cb.settingsGet("Version"),this.sSpecSuffix=Cb.settingsGet("AuthAccountHash")||"0",this.sServer=(Cb.settingsGet("IndexFile")||"./")+"?",this.sCdnStaticDomain=""===this.sCdnStaticDomain?this.sCdnStaticDomain:"/"===this.sCdnStaticDomain.substr(-1)?this.sCdnStaticDomain:this.sCdnStaticDomain+"/"}function j(a,c,d,e){var f={DisableHtml:!1,onSwitch:!1,LangSwitcherConferm:"EDITOR_TEXT_SWITCHER_CONFIRM",LangSwitcherTextLabel:"EDITOR_SWITCHER_TEXT_LABEL",LangSwitcherHtmlLabel:"EDITOR_SWITCHER_HTML_LABEL"};this.bIe=!!/msie/.test(navigator.userAgent.toLowerCase()),e=b.extend(f,qb.isUnd(e)?{}:e),this.oOptions=e,this.bOnlyPlain=!!this.oOptions.DisableHtml,this.fOnSwitch=this.oOptions.onSwitch,this.textarea=b(a).empty().addClass("editorTextArea"),this.htmlarea=b(c).empty().addClass("editorHtmlArea").prop("contentEditable","true"),this.toolbar=b(d).empty().addClass("editorToolbar"),j.htmlInitEditor.apply(this),j.htmlInitToolbar.apply(this),j.htmlAttachEditorEvents.apply(this),this.bOnlyPlain&&this.toolbar.hide()}function k(a,b,c,d,e){this.list=a,this.selectedItem=b,this.selectedItem.extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.oContentVisible=null,this.oContentScrollable=null,this.sItemSelector=c,this.sItemSelectedSelector=d,this.sItemCheckedSelector=e,this.sLastUid="",this.oCallbacks={},this.iSelectTimer=0,this.bUseKeyboard=!0,this.emptyFunction=function(){},this.useItemSelectCallback=!0,this.throttleSelection=!1,this.selectedItem.subscribe(function(a){this.useItemSelectCallback&&(this.throttleSelection?(this.throttleSelection=!1,this.selectItemCallbacksThrottle(a)):this.selectItemCallbacks(a))},this);var f=this,g=[],i=null;this.list.subscribe(function(){var a=this,b=this.list();qb.isArray(b)&&h.each(b,function(b){b.checked()&&g.push(a.getItemUid(b)),null===i&&b.selected()&&(i=a.getItemUid(b))})},this,"beforeChange"),this.list.subscribe(function(a){if(this.useItemSelectCallback=!1,this.selectedItem(null),qb.isArray(a)){var b=this,c=g.length;h.each(a,function(a){c>0&&-1b?b:a))},this),this.body=null,this.isRtl=c.observable(!1),this.isHtml=c.observable(!1),this.hasImages=c.observable(!1),this.attachments=c.observableArray([]),this.priority=c.observable(ob.MessagePriority.Normal),this.readReceipt=c.observable(""),this.aDraftInfo=[],this.sMessageId="",this.sInReplyTo="",this.sReferences="",this.parentUid=c.observable(0),this.threads=c.observableArray([]),this.threadsLen=c.observable(0),this.hasUnseenSubMessage=c.observable(!1),this.hasFlaggedSubMessage=c.observable(!1),this.lastInCollapsedThread=c.observable(!1),this.lastInCollapsedThreadLoading=c.observable(!1),this.threadsLenResult=c.computed(function(){var a=this.threadsLen();return 0===this.parentUid()&&a>0?a+1:""},this)}function y(){this.name=c.observable(""),this.fullName="",this.fullNameRaw="",this.fullNameHash="",this.delimiter="",this.namespace="",this.deep=0,this.selectable=!1,this.existen=!0,this.isNamespaceFolder=!1,this.isGmailFolder=!1,this.isUnpaddigFolder=!1,this.interval=0,this.type=c.observable(ob.FolderType.User),this.selected=c.observable(!1),this.edited=c.observable(!1),this.collapsed=c.observable(!0),this.subScribed=c.observable(!0),this.subFolders=c.observableArray([]),this.deleteAccess=c.observable(!1),this.actionBlink=c.observable(!1).extend({falseTimeout:1e3}),this.nameForEdit=c.observable(""),this.name.subscribe(function(a){this.nameForEdit(a)},this),this.edited.subscribe(function(a){a&&this.nameForEdit(this.name())},this),this.privateMessageCountAll=c.observable(0),this.privateMessageCountUnread=c.observable(0),this.collapsedPrivate=c.observable(!0)}function z(a,b){this.email=a,this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(b)}function A(a,b,d){this.id=a,this.email=c.observable(b),this.name=c.observable(""),this.replyTo=c.observable(""),this.bcc=c.observable(""),this.deleteAccess=c.observable(!1),this.canBeDalete=c.observable(d)}function B(){p.call(this,"Popups","PopupsFolderClear"),this.selectedFolder=c.observable(null),this.clearingProcess=c.observable(!1),this.clearingError=c.observable(""),this.folderFullNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.printableFullName():""},this),this.folderNameForClear=c.computed(function(){var a=this.selectedFolder();return a?a.localName():""},this),this.dangerDescHtml=c.computed(function(){return qb.i18n("POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1",{FOLDER:this.folderNameForClear()})},this),this.clearCommand=qb.createCommand(this,function(){var a=this,b=this.selectedFolder();b&&(Cb.data().message(null),Cb.data().messageList([]),this.clearingProcess(!0),Cb.cache().setFolderHash(b.fullNameRaw,""),Cb.remote().folderClear(function(b,c){a.clearingProcess(!1),ob.StorageResultType.Success===b&&c&&c.Result?(Cb.reloadMessageList(!0),a.cancelCommand()):c&&c.ErrorCode?a.clearingError(qb.getNotification(c.ErrorCode)):a.clearingError(qb.getNotification(ob.Notification.MailServerError))},b.fullNameRaw))},function(){var a=this.selectedFolder(),b=this.clearingProcess();return!b&&null!==a}),r.constructorEnd(this)}function C(){p.call(this,"Popups","PopupsFolderCreate"),qb.initOnStartOrLangChange(function(){this.sNoParentText=qb.i18n("POPUPS_CREATE_FOLDER/SELECT_NO_PARENT")},this),this.folderName=c.observable(""),this.folderName.focused=c.observable(!1),this.selectedParentValue=c.observable(nb.Values.UnuseOptionValue),this.parentFolderSelectList=c.computed(function(){var a=Cb.data(),b=[],c=null,d=null,e=a.folderList(),f=function(a){return a?a.isSystemFolder()?a.name()+" "+a.manageFolderSystemName():a.name():""};return b.push(["",this.sNoParentText]),""!==a.namespace&&(c=function(b){return a.namespace!==b.fullNameRaw.substr(0,a.namespace.length)}),Cb.folderListOptionsBuilder([],e,[],b,null,c,d,f)},this),this.createFolder=qb.createCommand(this,function(){var a=Cb.data(),b=this.selectedParentValue();""===b&&1=a?1:a},this),this.contactsPagenator=c.computed(qb.computedPagenatorHelper(this.contactsPage,this.contactsPageCount)),this.emptySelection=c.observable(!0),this.viewClearSearch=c.observable(!1),this.viewID=c.observable(""),this.viewIDStr=c.observable(""),this.viewReadOnly=c.observable(!1),this.viewScopeType=c.observable(ob.ContactScopeType.Default),this.viewProperties=c.observableArray([]),this.viewSaveTrigger=c.observable(ob.SaveSettingsStep.Idle),this.viewPropertiesNames=this.viewProperties.filter(function(a){return-10&&b>0&&a>b},this),this.hasMessages=c.computed(function(){return 0'),e.after(f),e.remove()),f&&f[0]&&f.attr("data-href",g).attr("data-theme",a[0]).text(a[1]),d.themeTrigger(ob.SaveSettingsStep.TrueResult))}).always(function(){d.iTimer=a.setTimeout(function(){d.themeTrigger(ob.SaveSettingsStep.Idle)},1e3),d.oLastAjax=null})),Cb.remote().saveSettings(null,{Theme:c})},this)}function bb(){qb.initDataConstructorBySettings(this)}function cb(){bb.call(this);var a=function(a){return function(){var b=Cb.cache().getFolderFromCacheList(a());b&&b.type(ob.FolderType.User)}},d=function(a){return function(b){var c=Cb.cache().getFolderFromCacheList(b);c&&c.type(a)}};this.devEmail="",this.devLogin="",this.devPassword="",this.accountEmail=c.observable(""),this.accountIncLogin=c.observable(""),this.accountOutLogin=c.observable(""),this.projectHash=c.observable(""),this.threading=c.observable(!1),this.lastFoldersHash="",this.remoteSuggestions=!1,this.sentFolder=c.observable(""),this.draftFolder=c.observable(""),this.spamFolder=c.observable(""),this.trashFolder=c.observable(""),this.sentFolder.subscribe(a(this.sentFolder),this,"beforeChange"),this.draftFolder.subscribe(a(this.draftFolder),this,"beforeChange"),this.spamFolder.subscribe(a(this.spamFolder),this,"beforeChange"),this.trashFolder.subscribe(a(this.trashFolder),this,"beforeChange"),this.sentFolder.subscribe(d(ob.FolderType.SentItems),this),this.draftFolder.subscribe(d(ob.FolderType.Draft),this),this.spamFolder.subscribe(d(ob.FolderType.Spam),this),this.trashFolder.subscribe(d(ob.FolderType.Trash),this),this.draftFolderNotEnabled=c.computed(function(){return""===this.draftFolder()||nb.Values.UnuseOptionValue===this.draftFolder()},this),this.displayName=c.observable(""),this.signature=c.observable(""),this.replyTo=c.observable(""),this.accounts=c.observableArray([]),this.accountsLoading=c.observable(!1).extend({throttle:100}),this.identities=c.observableArray([]),this.identitiesLoading=c.observable(!1).extend({throttle:100}),this.namespace="",this.folderList=c.observableArray([]),this.foldersListError=c.observable(""),this.foldersLoading=c.observable(!1),this.foldersCreating=c.observable(!1),this.foldersDeleting=c.observable(!1),this.foldersRenaming=c.observable(!1),this.foldersInboxUnreadCount=c.observable(0),this.currentFolder=c.observable(null).extend({toggleSubscribe:[null,function(a){a&&a.selected(!1)},function(a){a&&a.selected(!0)}]}),this.currentFolderFullNameRaw=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameRaw:""},this),this.currentFolderFullName=c.computed(function(){return this.currentFolder()?this.currentFolder().fullName:""},this),this.currentFolderFullNameHash=c.computed(function(){return this.currentFolder()?this.currentFolder().fullNameHash:""},this),this.currentFolderName=c.computed(function(){return this.currentFolder()?this.currentFolder().name():""},this),this.folderListSystemNames=c.computed(function(){var a=["INBOX"],b=this.folderList(),c=this.sentFolder(),d=this.draftFolder(),e=this.spamFolder(),f=this.trashFolder();return qb.isArray(b)&&0=a?1:a},this),this.mainMessageListSearch=c.computed({read:this.messageListSearch,write:function(a){vb.setHash(Cb.link().mailBox(this.currentFolderFullNameHash(),1,qb.trim(a.toString())))},owner:this}),this.messageListError=c.observable(""),this.messageListLoading=c.observable(!1),this.messageListIsNotCompleted=c.observable(!1),this.messageListCompleteLoadingThrottle=c.observable(!1).extend({throttle:200}),this.messageListCompleteLoading=c.computed(function(){var a=this.messageListLoading(),b=this.messageListIsNotCompleted();return a||b},this),this.messageListCompleteLoading.subscribe(function(a){this.messageListCompleteLoadingThrottle(a)},this),this.messageList.subscribe(h.debounce(function(a){h.each(a,function(a){a.newForAnimation()&&a.newForAnimation(!1)})},500)),this.staticMessageList=new x,this.message=c.observable(null),this.messageLoading=c.observable(!1),this.messageLoadingThrottle=c.observable(!1).extend({throttle:50}),this.messageLoading.subscribe(function(a){this.messageLoadingThrottle(a)},this),this.messageFullScreenMode=c.observable(!1),this.messageError=c.observable(""),this.messagesBodiesDom=c.observable(null),this.messagesBodiesDom.subscribe(function(a){!a||a instanceof jQuery||this.messagesBodiesDom(b(a))},this),this.messageActiveDom=c.observable(null),this.isMessageSelected=c.computed(function(){return null!==this.message()},this),this.currentMessage=c.observable(null),this.message.subscribe(function(a){null===a&&(this.currentMessage(null),this.hideMessageBodies())},this),this.messageListChecked=c.computed(function(){return h.filter(this.messageList(),function(a){return a.checked()})},this),this.messageListCheckedOrSelected=c.computed(function(){var a=this.messageListChecked(),b=this.currentMessage();return h.union(a,b?[b]:[])},this),this.messageListCheckedUids=c.computed(function(){var a=[];return h.each(this.messageListChecked(),function(b){b&&(a.push(b.uid),00?Math.ceil(b/a*100):0},this),this.useKeyboardShortcuts=c.observable(!0),this.googleActions=c.observable(!1),this.googleLoggined=c.observable(!1),this.googleUserName=c.observable(""),this.facebookActions=c.observable(!1),this.facebookLoggined=c.observable(!1),this.facebookUserName=c.observable(""),this.twitterActions=c.observable(!1),this.twitterLoggined=c.observable(!1),this.twitterUserName=c.observable(""),this.customThemeType=c.observable(ob.CustomThemeType.Light),this.purgeMessageBodyCacheThrottle=h.throttle(this.purgeMessageBodyCache,3e4)}function db(){this.oRequests={}}function eb(){db.call(this),this.oRequests={}}function fb(){this.oEmailsPicsHashes={},this.oServices={}}function gb(){fb.call(this),this.oFoldersCache={},this.oFoldersNamesCache={},this.oFolderHashCache={},this.oFolderUidNextCache={},this.oMessageListHashCache={},this.oMessageFlagsCache={},this.oNewMessage={},this.oRequestedMessage={}}function hb(a){q.call(this,"settings",a),this.menu=c.observableArray([]),this.oCurrentSubScreen=null,this.oViewModelPlace=null}function ib(){q.call(this,"login",[L])}function jb(){q.call(this,"mailbox",[N,P,Q,R]),this.oLastRoute={}}function kb(){hb.call(this,[O,S,T]),qb.initOnStartOrLangChange(function(){this.sSettingsTitle=qb.i18n("TITLES/SETTINGS")},this,function(){Cb.setTitle(this.sSettingsTitle)})}function lb(){o.call(this),this.oSettings=null,this.oPlugins=null,this.oLocal=null,this.oLink=null,this.oSubs={},this.isLocalAutocomplete=!0,this.popupVisibility=c.observable(!1),this.iframe=b('