Merge pull request #3096 from mepps/remove-autocomplete-email
authorcolemanw <coleman@civicrm.org>
Fri, 2 May 2014 01:25:28 +0000 (18:25 -0700)
committercolemanw <coleman@civicrm.org>
Fri, 2 May 2014 01:25:28 +0000 (18:25 -0700)
Removed autocomplete from send email activity

1  2 
CRM/Core/Resources.php
templates/CRM/Contact/Form/Task/Email.tpl
templates/CRM/Contact/Form/Task/SMS.tpl

Simple merge
index 74bfd05f87a4a38dd0a28d7b76029557689523fa,d1f7823e13003d75d15636751734067ff364053a..5f5caaaebebff74b7784475d4353cc97bee72d35
@@@ -104,13 -105,33 +105,32 @@@ CRM.$(function($)
                                     cj('tr#bcc ul li:not(:last)').remove();cj('#bcc').hide();
  });
  
- var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name or email address of an existing contact.{/ts}{literal}";
- var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}";
- var toDataUrl     = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}";
+   var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkemail' q='id=1' h=0 }{literal}";
+   function emailSelect(el, prepopulate){
+     $(el).data('api-entity', 'contact').crmSelect2({
+       minimumInputLength: 1,
+       multiple: true,
+       ajax: {
+         url: sourceDataUrl,
+         data: function(term) {
+           return {
+             name: term,
+           };
+         },
+         results: function(response) {
+           return {
+             results: response,
+           };
+         }
+       }
+     }).select2('data', prepopulate);
+   }
+   emailSelect('#to', toContact);
+   emailSelect('#cc_id', ccContact);
+   emailSelect('#bcc_id', bccContact);
+ });
  
- cj( "#to"     ).tokenInput( toDataUrl,     { prePopulate: toContact,  theme: 'facebook', hintText: hintText });
- cj( "#cc_id"  ).tokenInput( sourceDataUrl, { prePopulate: ccContact,  theme: 'facebook', hintText: hintText });
- cj( "#bcc_id" ).tokenInput( sourceDataUrl, { prePopulate: bccContact, theme: 'facebook', hintText: hintText });
- cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' );
  </script>
  {/literal}
 -{include file="CRM/common/formNavigate.tpl"}
index 858d913c04538c5cd9e47b7a0ca2963857aa2660,95ce29b86f6ef138175e349a0f4b42bd165807e1..f1fd5901139e81baaaaf307e5800d2c0ce147776
  {/if}
  
  {literal}
- var hintText = "{/literal}{ts escape='js'}Type in a partial or complete name or email address of an existing contact.{/ts}{literal}";
- var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkphone' h=0 }{literal}";
- var toDataUrl     = "{/literal}{crmURL p='civicrm/ajax/checkphone' q='id=1' h=0 }{literal}";
- cj( "#to"     ).tokenInput( toDataUrl,     { prePopulate: toContact,  theme: 'facebook', hintText: hintText });
- cj( 'ul.token-input-list-facebook, div.token-input-dropdown-facebook' ).css( 'width', '450px' );
+ CRM.$(function($){
+   var sourceDataUrl = "{/literal}{crmURL p='civicrm/ajax/checkphone' h=0 }{literal}";
+   function phoneSelect(el){
+     $(el).data('api-entity', 'contact').crmSelect2({
+       minimumInputLength: 1,
+       multiple: true,
+       ajax: {
+         url: sourceDataUrl,
+         data: function(term) {
+           return { name: term,};
+         },
+         results: function(response) {
+           return { results: response };
+         }
+       }
+     }).select2('data', toContact);
+   }
+   phoneSelect('#to');
+ });
  </script>
  {/literal}
 -{include file="CRM/common/formNavigate.tpl"}