[imp] (imp) LDAP search criteria options

Michael Stamper michael@wishard.edu
Wed, 05 Sep 2001 15:23:42 -0500 (EST)


I did it!  I figured it out, and I also fixed another annoyance along the way.  
I didn't like the way IMP would reset the search fields when choosing a 
different LDAP directory.  We have 8 different address books at our site, 
and the users will not have access to outside directories like Bigfoot, etc., so 
this works for us.  Here's what I did:

I modified 2 files in /horde/imp/templates/contacts:
javascript.inc & ldap-php3.inc

===================
Part One (to expand LDAP search criteria options):

In javascript.inc, I commented out the following lines (lines 279-301 in my 
files, under the function UpdateOptions())

/*            if (attr == "<?php echo $lang->mail; ?>") {
               if (document.ldap_form.ldap_serv.options[0].selected ) {
                  ClearOptions();
                  AddOption("is_strict");
               }
	       
               if (document.ldap_form.ldap_serv.options[1].selected ) {
                  ClearOptions();
                  AddOption("is_strict");
               }
       
               if (document.ldap_form.ldap_serv.options[2].selected ) {
                  ClearOptions();
                  AddOption("is_strict");
               }    
	    }
	    
	    if (attr == "<?php echo $lang->sn; ?>") {
               if (document.ldap_form.ldap_serv.options[1].selected ) {
                  ClearOptions();
                  AddOption("is_strict");
               }  
	    }*/

===================
Part two (to disable auto updating seach fields when changing LDAP directories)

I commented out parts of lines 28 & 45 - to skip "onChange=UpdateSelect()"
Here's what they look like now:
28: <select name="ldap_serv" >  /* onChange=UpdateSelect()> */
45: <select name="attr_type"> /* onChange=UpdateOptions() onLoad=UpdateSelect()> 
*/

I'm certain there are better/cleaner solutions to achieve these results. but 
these seem to work for me...


Quoting Chuck Hagenbuch <chuck@horde.org>:

> Quoting Michael Stamper <michael@wishard.edu>:
> 
> > > > How can I expand the options for the "email" search to include
> the
> > > > "contains" criteria?
> > > 
> > Sorry, I forgot to include that information.
> > Horde 1.2.4
> > IMP 2.2.4
> 
> If adding it to the last parameter to the LDAPServer constructor in
> config/ldap.php3 doesn't do it, then somewhere - probably in
> templates/contacts/ldap-php3.inc - you'll just have to hack it in. It's
> been
> years since I looked at that ldap code, sorry...
> 
> -chuck
> 
> --
> Charles Hagenbuch, <chuck@horde.org>
> Some fallen angels have their good reasons.
> 
> -- 
> IMP mailing list: http://horde.org/imp/
> Archive: http://marc.theaimsgroup.com/?l=imp&r=1&w=2
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe@lists.horde.org
> 
>