- HOW TO ADD FIELD TO AUTOCOMPLETION
- UPGRADE FROM PREVIOUS RELEASE
- SCRIPTACULOUS AND RT 3.8
RTx::EmailCompletion - Add auto completion on RT email fields
This document describes version 0.06 of RTx::EmailCompletion.
I'm so tired to type email address by hand that I've done this module to add AJAX autocompletion on all email field of RT. As adding completion is dynamic, it should work on most RT releases (see later if it's not the case).
There's 4 things :
a small web service
html/Ajax/EmailCompletionwhich search in all known users in the database ;
prototype library to manipulate DOM and scriptaculous library to autocomplete ;
a perl module to handle all the logic
if upgrading from a previous release see later UPGRADE FROM PREVIOUS RELEASE
if you upgrade from a version older than 0.05 of this module with RT >= 3.8, see later SCRIPTACULOUS AND RT 3.8
Install it like a standard perl module :
RTHOME=/opt/rt3 perl Makefile.PL make make install
In RT 3.8 and later, to enable EmailCompletion plugin, you must add something like that in your etc/RT_SiteConfig.pm :
This section is fairly long but you don't really need to read it if you just want the basic : autocompletion only for privileged users against all registred users of RT database.
By default, completion works only for privileged users.
You can activate it for unprivileged users (in the SelfService) by setting $EmailCompletionUnprivileged in RTHOME/etc/RT_SiteConfig.pm. There's three ways :
Be careful, this will also show all yours LDAP users.
show only privileged users
This won't show LDAP users
show only email matching a regexp
Set($EmailCompletionUnprivileged, qr/\@my\.corp\.domain$/ );
This will also show LDAP user mails that matchs the regexp
You can also change the operator used in the
where clause to search email with the global var $RT::EmailCompletionSearch. The default one is
To change it, add a line like this in RTHOME/etc/RT_SiteConfig.pm :
This variable can take the values
By default, the plugin searches on Users.EmailAddress.
You can change where it searches by setting $EmailCompletionSearchFields in RTHOME/etc/RT_SiteConfig.pm to an arrayref of fields from the Users table.
Set( $EmailCompletionSearchFields, [qw(EmailAddress RealName Name)] );
This would allow you to search by usernames, full names and email addresses
Starting with RTx::EmailCompletion 0.03, autocompletion works with LDAP servers.
If you already have installed and configured LDAP authentication overlay, this configuration will be used and it should/could work just as it is.
The following configuration parameters applied :
EmailCompletionLdapServer : the ldap server (mandatory)
If not set, RTx::EmailCompletion will search for LdapServer parameter (configured for the LDAP RT authentification layout and some others LDAP RT extensions).
EmailCompletionLdapBase : the ldap base (mandatory)
If not set, RTx::EmailCompletion will search for LdapBase parameter (configured for the LDAP RT authentification layout and some others LDAP RT extensions).
EmailCompletionLdapUser : the ldap user if you need authentication
If not set, RTx::EmailCompletion will search for LdapUser parameter (configured for the LDAP RT authentification layout and some others LDAP RT extensions).
EmailCompletionLdapPass : the ldap password if you need authentication
If not set, RTx::EmailCompletion will search for LdapPass parameter (configured for the LDAP RT authentification layout and some others LDAP RT extensions).
EmailCompletionLdapFilter : the ldap filter if needed
If not set, RTx::EmailCompletion will search for LdapFilter parameter (configured for the LDAP RT authentification layout).
EmailCompletionLdapAttrSearch : the ldap search attributes
Set($EmailCompletionLdapAttrSearch, [qw/mail cn/]);
Default value is mail.
EmailCompletionLdapAttrShow : the mail attribute name
Default value is mail
EmailCompletionLdapMinLength : minimum parameter length to send an ldap request
Default value is 4
The minimum LDAP configuration look somethink like this :
Set($EmailCompletionLdapServer, "db.debian.org"); Set($EmailCompletionLdapBase, "dc=debian,dc=org");
You can disable ldap completion (useful if you have installed ldap authentication overlay and you don't want ldap completion) with :
If you want to keep only LDAP completion, you can also disable RDBMS :
The given value must be true for perl.
If you find email field without autocomplete, you can modify
html/NoAuth/js/emailcompletion.js to handle this field (and email me to patch this module).
At the beginning of this file you will find two global vars
singleCompletion. They are array of regexp.
Regexp must match all the word because
$ are added for matching. So if you want to match
Field2 you must add something like
Field. or better
Because of a change in Makefile.PL, if you upgrade from a previous release, you should delete everything from this package. You can find
find RTHOME | grep -i emailcompletion
RT 3.8 and later come with their own scriptaculous library. So if you have installed an release older than 0.05 of this module with RT 3.8 and later, the original scriptaculous will be overriden by this module.
The best solution is to remove RTHOME/share/html/NoAuth/js/ and copy RTSOURCE/share/html/NoAuth/js/ to RTHOME/share/html/NoAuth/.
This release is not subject to this problem.
The first version (unreleased) modify html pages. The better method actually used allow this module to be compatible with, virtually, all RT release.
Nicolas Chuche <firstname.lastname@example.org>
Copyright 2007 by Nicolas Chuche <email@example.com>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
All Scriptaculous and Prototype program are placed under MIT licence and are copyrighted by their owners (see top of files).