From 47da0f9bf8407605fdc75de1cc44099e50c23f95 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 28 Oct 2020 13:30:13 +0100 Subject: [PATCH] * Addressbook: allow to configure sending fax via email by replacing the number with an email address --- addressbook/lang/egw_de.lang | 1 + addressbook/lang/egw_en.lang | 1 + addressbook/templates/default/config.xet | 7 +++++++ addressbook/templates/default/edit.xet | 8 ++++---- addressbook/templates/default/index.xet | 2 +- api/js/etemplate/et2_widget_url.js | 14 +++++++++++--- api/js/etemplate/et2_widget_url.ts | 16 +++++++++++++--- api/src/Config.php | 2 +- 8 files changed, 39 insertions(+), 12 deletions(-) diff --git a/addressbook/lang/egw_de.lang b/addressbook/lang/egw_de.lang index db83580086..def63ce122 100644 --- a/addressbook/lang/egw_de.lang +++ b/addressbook/lang/egw_de.lang @@ -451,6 +451,7 @@ select the type of conversion: addressbook de Typ der Umwandlung auswählen: select where you want to store / retrieve contacts admin de Auswählen wo Sie Adressen speichern möchten selected contacts addressbook de ausgewählte Kontakte send emailcopy to receiver addressbook de Versendet eine Kopie der E-Mail zu dem Empfänger +send fax via email by replacing fax number with an email address addressbook de Fax per Email senden durch ersetzen der Faxnummer mit einer Email Adresse send succeeded to %1 common de erfolgreich versandt an seperator addressbook de Feldtrenner set full name and file as field in contacts of all users (either all or only empty values) admin de Setzt vollen Namen und eigene Sortierung in Kontakten aller Benutzer (entweder alle oder nur leere Werte) diff --git a/addressbook/lang/egw_en.lang b/addressbook/lang/egw_en.lang index df1006285f..e0b73e70b0 100644 --- a/addressbook/lang/egw_en.lang +++ b/addressbook/lang/egw_en.lang @@ -451,6 +451,7 @@ select the type of conversion: addressbook en Select the type of conversion: select where you want to store / retrieve contacts admin en Select where contacts should be stored / retrieved. selected contacts addressbook en Selected contacts send emailcopy to receiver addressbook en Send email copy to receiver +send fax via email by replacing fax number with an email address addressbook en Send fax via email by replacing fax number with an email address send succeeded to %1 common en Send succeeded to %1 seperator addressbook en Separator set full name and file as field in contacts of all users (either all or only empty values) admin en Set full name and 'fileas' field in contacts of all users. Either all or only empty values. diff --git a/addressbook/templates/default/config.xet b/addressbook/templates/default/config.xet index 68823d81fe..cae9f0d790 100644 --- a/addressbook/templates/default/config.xet +++ b/addressbook/templates/default/config.xet @@ -20,6 +20,13 @@ + + + + + + + diff --git a/addressbook/templates/default/edit.xet b/addressbook/templates/default/edit.xet index 4cc96116b9..0fba3c2837 100644 --- a/addressbook/templates/default/edit.xet +++ b/addressbook/templates/default/edit.xet @@ -79,7 +79,7 @@ - + @@ -112,7 +112,7 @@ - + @@ -232,7 +232,7 @@ - + @@ -264,7 +264,7 @@ - + diff --git a/addressbook/templates/default/index.xet b/addressbook/templates/default/index.xet index 658a630b74..e927665cf0 100644 --- a/addressbook/templates/default/index.xet +++ b/addressbook/templates/default/index.xet @@ -142,7 +142,7 @@ - + diff --git a/api/js/etemplate/et2_widget_url.js b/api/js/etemplate/et2_widget_url.js index 7c7a2b06de..05ecb58eed 100644 --- a/api/js/etemplate/et2_widget_url.js +++ b/api/js/etemplate/et2_widget_url.js @@ -8,7 +8,6 @@ * @link http://www.egroupware.org * @author Nathan Gray * @copyright Nathan Gray 2011 - * @version $Id$ */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { @@ -93,6 +92,7 @@ var et2_url = /** @class */ (function (_super_1) { this._button.attr("href", _value).attr("target", "_blank").addClass("url"); break; case "url-phone": + case "url-fax": if (_value) { if (typeof _value == 'function') { this._button.click(this, _value).addClass("phone").show(); @@ -128,6 +128,12 @@ var et2_url = /** @class */ (function (_super_1) { et2_url.prototype.get_link = function (type, value) { if (!value) return false; + // convert fax numbers to email, if configured + if (type === 'url-fax' && this.egw().config('fax_email') && + (value = value.replace('♥', '').replace('(0)', '').replace(/[^0-9+]/g, ''))) { + value = value.replace(new RegExp(this.egw().config('fax_email_regexp') || '(.*)'), this.egw().config('fax_email')); + type = 'url-email'; + } switch (type) { case "url": // Silently use http if no protocol @@ -135,6 +141,7 @@ var et2_url = /** @class */ (function (_super_1) { value = "http://" + value; break; case "url-phone": + case "url-fax": // Clean number value = value.replace('♥', '').replace('(0)', ''); value = value.replace(/[abc]/gi, 2).replace(/[def]/gi, 3).replace(/[ghi]/gi, 4).replace(/[jkl]/gi, 5).replace(/[mno]/gi, 6); @@ -274,7 +281,7 @@ var et2_url = /** @class */ (function (_super_1) { et2_url.EMAIL_PREG = new RegExp(/^(([^\042',<][^,<]+|\042[^\042]+\042|\'[^\']+\'|"(?:[^"\\]|\\.)*")\s?<)?[^\x00-\x20()\xe2\x80\x8b<>@,;:\042\[\]\x80-\xff]+@([a-z0-9ÄÖÜäöüß](|[a-z0-9ÄÖÜäöüß_-]*[a-z0-9ÄÖÜäöüß])\.)+[a-z]{2,}>?$/i); return et2_url; }(et2_widget_textbox_1.et2_textbox)); -et2_core_widget_1.et2_register_widget(et2_url, ["url", "url-email", "url-phone"]); +et2_core_widget_1.et2_register_widget(et2_url, ["url", "url-email", "url-phone", "url-fax"]); /** * et2_url_ro is the readonly implementation of the url, email & phone. * It renders things as links, when possible @@ -323,6 +330,7 @@ var et2_url_ro = /** @class */ (function (_super_1) { this.span.attr("href", link).attr("target", "_blank"); break; case "url-phone": + case "url-fax": if (typeof link == 'function') { this.span.off('click.et2_url'); this.span.on('click.et2_url', link); @@ -464,5 +472,5 @@ var et2_url_ro = /** @class */ (function (_super_1) { et2_url_ro.email_cache = []; return et2_url_ro; }(et2_core_valueWidget_1.et2_valueWidget)); -et2_core_widget_1.et2_register_widget(et2_url_ro, ["url_ro", "url-email_ro", "url-phone_ro"]); +et2_core_widget_1.et2_register_widget(et2_url_ro, ["url_ro", "url-email_ro", "url-phone_ro", "url-fax_ro"]); //# sourceMappingURL=et2_widget_url.js.map \ No newline at end of file diff --git a/api/js/etemplate/et2_widget_url.ts b/api/js/etemplate/et2_widget_url.ts index 44a0e20d5f..85ef31a20b 100644 --- a/api/js/etemplate/et2_widget_url.ts +++ b/api/js/etemplate/et2_widget_url.ts @@ -7,7 +7,6 @@ * @link http://www.egroupware.org * @author Nathan Gray * @copyright Nathan Gray 2011 - * @version $Id$ */ /*egw:uses @@ -129,6 +128,7 @@ class et2_url extends et2_textbox this._button.attr("href", _value).attr("target", "_blank").addClass("url"); break; case "url-phone": + case "url-fax": if(_value) { if(typeof _value == 'function') { @@ -168,6 +168,14 @@ class et2_url extends et2_textbox get_link(type, value) { if(!value) return false; + // convert fax numbers to email, if configured + if (type === 'url-fax' && this.egw().config('fax_email') && + (value = value.replace('♥','').replace('(0)','').replace(/[^0-9+]/g, ''))) + { + value = value.replace(new RegExp(this.egw().config('fax_email_regexp')||'(.*)'), + this.egw().config('fax_email')); + type = 'url-email'; + } switch(type) { case "url": @@ -175,6 +183,7 @@ class et2_url extends et2_textbox if(value.indexOf("://") == -1) value = "http://"+value; break; case "url-phone": + case "url-fax": // Clean number value = value.replace('♥','').replace('(0)',''); value = value.replace(/[abc]/gi,2).replace(/[def]/gi,3).replace(/[ghi]/gi,4).replace(/[jkl]/gi,5).replace(/[mno]/gi,6); @@ -289,7 +298,7 @@ class et2_url extends et2_textbox return res; } } -et2_register_widget(et2_url, ["url", "url-email", "url-phone"]); +et2_register_widget(et2_url, ["url", "url-email", "url-phone", "url-fax"]); /** * et2_url_ro is the readonly implementation of the url, email & phone. @@ -363,6 +372,7 @@ class et2_url_ro extends et2_valueWidget this.span.attr("href", link).attr("target", "_blank"); break; case "url-phone": + case "url-fax": if(typeof link == 'function') { this.span.off('click.et2_url'); @@ -522,5 +532,5 @@ class et2_url_ro extends et2_valueWidget this.span.attr('title',_values.statustext ? _values.statustext : this.options.statustext); } } -et2_register_widget(et2_url_ro, ["url_ro", "url-email_ro", "url-phone_ro"]); +et2_register_widget(et2_url_ro, ["url_ro", "url-email_ro", "url-phone_ro", "url-fax_ro"]); diff --git a/api/src/Config.php b/api/src/Config.php index 8ef97323cc..bc90e47eb6 100755 --- a/api/src/Config.php +++ b/api/src/Config.php @@ -256,7 +256,7 @@ class Config 'checkfornewversion','checkappversions','email_address_format', // admin >> site config 'site_title','login_logo_file','login_logo_url','login_logo_title','favicon_file', 'markuntranslated','link_list_thumbnail','enabled_spellcheck','debug_minify', - 'call_link','call_popup','geolocation_url', // addressbook + 'call_link','call_popup','fax_email','fax_email_regexp','geolocation_url', // addressbook 'hide_birthdays','calview_no_consolidate', 'egw_tutorial_disable','fw_mobile_app_list'), // calendar 'projectmanager' => array('hours_per_workday', 'duration_units'), 'manual' => array('manual_remote_egw_url'),