if (count($form->_contactIds) > 1) {
$form->_single = FALSE;
}
-
- $to = $form->add('text', 'to', ts('To'), '', TRUE);
- $cc = $form->add('text', 'cc_id', ts('CC'));
- $bcc = $form->add('text', 'bcc_id', ts('BCC'));
+
+ $emailAttributes = array(
+ 'class' => 'huge',
+ );
+ $to = $form->add('text', 'to', ts('To'), $emailAttributes, TRUE);
+ $cc = $form->add('text', 'cc_id', ts('CC'), $emailAttributes);
+ $bcc = $form->add('text', 'bcc_id', ts('BCC'), $emailAttributes);
$setDefaults = TRUE;
if (property_exists($form, '_context') && $form->_context == 'standalone') {
if ($queryString) {
$offset = CRM_Utils_Array::value('offset', $_GET, 0);
- $rowCount = CRM_Utils_Array::value('rowcount', $_GET, 20);
+ $rowCount = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'search_autocomplete_count', NULL, 10);
$offset = CRM_Utils_Type::escape($offset, 'Int');
- $rowCount = CRM_Utils_Type::escape($rowCount, 'Int');
// add acl clause here
list($aclFrom, $aclWhere) = CRM_Contact_BAO_Contact_Permission::cacheClause('cc');
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
$result[] = array(
- 'name' => $dao->name,
'id' => $dao->id,
+ 'text' => $dao->name,
);
}
}
$dao = CRM_Core_DAO::executeQuery($query);
while ($dao->fetch()) {
+ //working here
$result[] = array(
- 'name' => '"' . $dao->name . '" <' . $dao->email . '>',
+ 'text' => '"' . $dao->name . '" <' . $dao->email . '>',
'id' => (CRM_Utils_Array::value('id', $_GET)) ? "{$dao->id}::{$dao->email}" : '"' . $dao->name . '" <' . $dao->email . '>',
);
}
}
-
if ($result) {
echo json_encode($result);
}
{/if}
{literal}
-cj('#addcc').toggle( function() { cj(this).text('Remove CC');
+CRM.$(function($){
+ cj('#addcc').toggle( function() { cj(this).text('Remove CC');
cj('tr#cc').show().find('ul').find('input').focus();
},function() { cj(this).text('Add CC');cj('#cc_id').val('');
cj('tr#cc ul li:not(:last)').remove();cj('#cc').hide();
});
-cj('#addbcc').toggle( function() { cj(this).text('Remove BCC');
+ cj('#addbcc').toggle( function() { cj(this).text('Remove BCC');
cj('tr#bcc').show().find('ul').find('input').focus();
},function() { cj(this).text('Add BCC');cj('#bcc_id').val('');
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){
+ $(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,
+ };
+ }
+ }
+ });
+ }
+ emailSelect('#to');
+ emailSelect('#cc_id');
+ emailSelect('#bcc_id');
+});
+
-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"}