From: John Twyman Date: Wed, 5 May 2021 01:11:56 +0000 (+1000) Subject: dev/core-1711 Show segment count for SMS construction X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=0617ec90437d1eaf3f40f5a7e5333c18f43b819e;p=civicrm-core.git dev/core-1711 Show segment count for SMS construction Use Standard methods for downloading third party js package Update composer.lock --- diff --git a/composer.json b/composer.json index 5765df6b98..5015cc35eb 100644 --- a/composer.json +++ b/composer.json @@ -260,6 +260,10 @@ "smartmenus": { "url": "https://github.com/vadikom/smartmenus/archive/1.1.0.zip", "ignore": [".gitignore", "Gruntfile.js"] + }, + "sms-counter": { + "url": "https://github.com/danxexe/sms-counter/archive/master.zip", + "ignore": ["examples"] } }, "patches": { diff --git a/composer.lock b/composer.lock index 6938b626a7..8dfc659d5f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "806655f49ee4984e61d0c1bf7bcc0c88", + "content-hash": "3d4576d680aea8094656e1d832571507", "packages": [ { "name": "adrienrn/php-mimetyper", diff --git a/templates/CRM/Contact/Form/Task/SMS.hlp b/templates/CRM/Contact/Form/Task/SMS.hlp index af5b509608..e52a37f905 100644 --- a/templates/CRM/Contact/Form/Task/SMS.hlp +++ b/templates/CRM/Contact/Form/Task/SMS.hlp @@ -42,6 +42,12 @@ {/htxt} +{htxt id="id-count-text"} +

{ts}A single SMS message is typically 160 characters in length. If you want to send a message that is longer than 160 characters, it is split into multiple segments.{/ts}

+

{ts}The cost of sending SMS message is typically per segment.{/ts}

+

{ts}Certain characters like emoji or curly quotes can shorten the segment size to 96 characters, increasing the cost per message.{/ts}

+{/htxt} + {htxt id="id-message-text-title"} {ts}Rich Text{/ts} {/htxt} diff --git a/templates/CRM/Contact/Form/Task/SMSCommon.tpl b/templates/CRM/Contact/Form/Task/SMSCommon.tpl index 671da64343..16c1924a28 100644 --- a/templates/CRM/Contact/Form/Task/SMSCommon.tpl +++ b/templates/CRM/Contact/Form/Task/SMSCommon.tpl @@ -9,12 +9,14 @@ *} {*common template for compose sms*} +{crmScript file=bower_components/sms-counter/sms_counter.min.js region=html-header} +
{$form.sms_text_message.label}
-
+
{help id="id-count-text" tplFile=$tplFile file="CRM/Contact/Form/Task/SMS.hlp"}
{help id="id-token-text" tplFile=$tplFile file="CRM/Contact/Form/Task/SMS.hlp"} @@ -38,13 +40,16 @@
{$form.SMSsaveTemplateName.html|crmAddClass:huge}
+{capture assign="char_count_message"} +{ts}You can insert up to %1 characters. You have entered %2 characters, requiring %3 segments.{/ts} +{/capture} + {literal}