Search The ForumSearch   RegisterRegister  LoginLogin

AfterLogic WebMail Lite 7

 AfterLogic Forum : AfterLogic WebMail Lite 7
Subject Topic: Contacts e-mails autosuggestion Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
bobr-kun
Newbie
Newbie


Joined: 09 March 2017
Location: Ukraine
Online Status: Offline
Posts: 4
Posted: 09 March 2017 at 3:40am | IP Logged Quote bobr-kun

Hi everybody!
I need help with enabling contacts e-mail addresses autosuggestion and autocompletion (like, for exapmle, gmail does) when composing a new letter.
I've tried to enable the webmail.allow-first-character-search in the /data/settings/config.php - that won't work. Then I've tried to use the add-suggest-contacts-example: I've installed it thoroughly following the instruction, with enabling it in /data/settings/config.php as well. But I was confused somehow with this lines of the instruction:
Quote:

n the plugin code, you'll need to supply the actual code for fetching contacts from your application or contacts storage. The actual code must overwrite pseudo-code supplied there:

$oRemoteDb = CRemoteApi::GetDB();
$aResultContacts = $oRemoteDb->GetContacts($oAccount->Email, $sSearch);

$oAccount->Email is email address of current user, $sSearch is a search pattern entered in address line, your code should probably consider both the parameters when fetching matching addresses.

Plugin merges autocompletion suggestions generated by WebMail with those fetched from external system. However, it doesn't cover removing duplicates and trimming list if it gets too long, you'll need to do that in your custom code supplied within the plugin.

I've checked out the code of the CAPi and I couldn't quite understand: why I need to change something in this part of code
Code:

$oRemoteDb = CRemoteApi::GetDB();
$aResultContacts = $oRemoteDb->GetContacts($oAccount->Email, $sSearch);

? It seems to use the default e-mail address of the current WebMail account to filter the Contacts, doesn't it? Shortly speaking - that won't work too.
Can someone help me to enable such a feature?
Back to Top View bobr-kun's Profile Search for other posts by bobr-kun
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 09 March 2017 at 3:54am | IP Logged Quote Igor

Hello,

Actually, address autocompletion and suggestion works out-of-box in WebMail Lite. Once you send email out to some new recipient, next time that address will become available in address autocompletion dropdown list. Doesn't it work for you that way?

As for the plugin code you were referring to:

Code:
$oRemoteDb = CRemoteApi::GetDB();
$aResultContacts = $oRemoteDb->GetContacts($oAccount->Email, $sSearch);


it's not an actual code, just a demonstration of retrieving data from some arbitrary backend. You will need to replace that with "real" code working with your external address book.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
bobr-kun
Newbie
Newbie


Joined: 09 March 2017
Location: Ukraine
Online Status: Offline
Posts: 4
Posted: 09 March 2017 at 4:17am | IP Logged Quote bobr-kun

Quote:

Actually, address autocompletion and suggestion works out-of-box in WebMail Lite. Once you send email out to some new recipient, next time that address will become available in address autocompletion dropdown list. Doesn't it work for you that way?

Emmm - nope. No at all.

Quote:

code working with your external address book

I've missed up the EXTERNAL word, I think...
Back to Top View bobr-kun's Profile Search for other posts by bobr-kun
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 09 March 2017 at 4:29am | IP Logged Quote Igor

Quote:
Emmm - nope. No at all.


That's strange, I've just checked it on my local install, everything works like a charm.

Can you please setup a blank install of the product and confirm whether the issue is reproduced there?

If it may be possible to provide us with a test account the issue is reproduced with, please send access details via HelpDesk.
--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
bobr-kun
Newbie
Newbie


Joined: 09 March 2017
Location: Ukraine
Online Status: Offline
Posts: 4
Posted: 09 March 2017 at 5:03am | IP Logged Quote bobr-kun

I've made up a testing acc for you...but I'm using a Lite version of WebMail and it's not an option in porducts list on the helpdesk tickets form for new users. Should I choose WebMail Pro instead?
Back to Top View bobr-kun's Profile Search for other posts by bobr-kun
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 09 March 2017 at 5:05am | IP Logged Quote Igor

Yes sure, you can select the Pro there. There's no guaranteed support for Lite but we'll do what we can to assist you.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 
bobr-kun
Newbie
Newbie


Joined: 09 March 2017
Location: Ukraine
Online Status: Offline
Posts: 4
Posted: 09 March 2017 at 5:15am | IP Logged Quote bobr-kun

Thanks in advance!
Back to Top View bobr-kun's Profile Search for other posts by bobr-kun
 
Igor
AfterLogic Support
AfterLogic Support


Joined: 24 June 2008
Location: United States
Online Status: Offline
Posts: 6038
Posted: 10 March 2017 at 2:55am | IP Logged Quote Igor

Turns out the particular installation was configured to use PostgreSQL, and its implementation is currently limited and experimental. Still, it's possible to make autocompletion functional.

In libraries/afterlogic/common/managers/contactsmain/storages/db/command_creator.php file, locate the following lines in GetSuggestContactItems:

Code:
$sSql = 'SELECT id_addr, str_id, id_user, auto_create, view_email, primary_email, h_email, b_email, other_email,
use_frequency, fullname, firstname, use_friendly_nm, type, type_id, b_phone, h_phone, h_mobile, shared_to_all,
(use_frequency/CEIL(DATEDIFF(CURDATE() + INTERVAL 1 DAY, date_modified)/30)) as age_score
FROM %sawm_addr_book
WHERE %s AND deleted = 0 AND hide_in_gab = 0%s AND use_frequency >= 0
ORDER BY age_score DESC, type ASC, shared_to_all ASC
LIMIT %d OFFSET %d';


Replace those with:

Code:
$sSql = 'SELECT id_addr, str_id, id_user, auto_create, view_email, primary_email, h_email, b_email, other_email,
use_frequency, fullname, firstname, use_friendly_nm, type, type_id, b_phone, h_phone, h_mobile, shared_to_all
FROM %sawm_addr_book
WHERE %s AND deleted = 0 AND hide_in_gab = 0%s AND use_frequency >= 0
ORDER BY use_frequency DESC, type ASC, shared_to_all ASC
LIMIT %d OFFSET %d';


Hope this helps.

--
Regards,
Igor, AfterLogic Support
Back to Top View Igor's Profile Search for other posts by Igor
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide