mozilla

Compare Revisions

Thunderbird Addon Demonstrating Autocomplete With Addrbook And LDAP

Change Revisions

Revision 300867:

Revision 300867 by Oeekker on

Revision 432069:

Revision 432069 by One on

Title:
Thunderbird Addon Demonstrating Autocomplete With Addrbook And LDAP
Thunderbird Addon Demonstrating Autocomplete With Addrbook And LDAP
Slug:
Thunderbird_Addon_Demonstrating_Autocomplete_With_Addrbook_And_LDAP
Thunderbird_Addon_Demonstrating_Autocomplete_With_Addrbook_And_LDAP
Tags:
"thunderbird"
"thunderbird"
Content:

Revision 300867
Revision 432069
n16    <p>n16    <pre>
17      <br>17<code class="brush: xml">        &lt;textbox flex="1" id="ldap-au
 >tocomp" timeout="300"
18      <code>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;textbo18                 maxrows="4"
>x flex="1" id="ldap-autocomp" timeout="300"<br> 
19      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp19                 autoFill="true"
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxrows="4"<br> 
20      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp20                 autoFillAfterMatch="true"
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; autoFill="true"<br> 
21      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp21                 forceComplete="true"
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; autoFillAfterMatch="true"<b 
>r> 
22      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp22                 minResultsForPopup="3"
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; forceComplete="true"<br> 
23      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp23                 ignoreBlurWhileSearching="true"
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; minResultsForPopup="3"<br> 
24      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp24                 type="autocomplete"
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ignoreBlurWhileSearching="t 
>rue"<br> 
25      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp25                 autocompletesearch="mydomain addrbook"  
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type="autocomplete"<br> 
26      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp26                 searchSessions="addrbook" /&gt;              </c
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; autocompletesearch="mydomai>ode>
>n addrbook"&nbsp;&nbsp;<br> 
27      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp27</pre>
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; searchSessions="addrbook" / 
>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& 
>nbsp;&nbsp;&nbsp;</code> 
28    </p>
t36    <p>t35    <pre>
37      <code>&nbsp; // This function originates from setupLdapAuto36<code class="brush: js">  // This function originates from setupL
>completeSession:<br>>dapAutocompleteSession:
38      &nbsp; // <a class="external" href="http://hg.mozilla.org/c37  // <a class="external" href="http://hg.mozilla.org/comm-central
>omm-central/file/117e438feb4a/mail/components/compose/content/Msg>/file/117e438feb4a/mail/components/compose/content/MsgComposeComm
>ComposeCommands.js" rel="freelink">http://hg.mozilla.org/comm-cen>ands.js" rel="freelink">http://hg.mozilla.org/comm-central/f...os
>tral/f...oseCommands.js</a><br>>eCommands.js</a>
39      &nbsp; //<br>38  //
40      &nbsp; // It was modified in the following ways:<br>39  // It was modified in the following ways:
41      &nbsp; // - Modified to support both Gecko 1.8.x and 1.9+<b40  // - Modified to support both Gecko 1.8.x and 1.9+
>r> 
42      &nbsp; // - Modified to take in an array of textbox ids to 41  // - Modified to take in an array of textbox ids to which the L
>which the LDAP<br>>DAP
43      &nbsp; //&nbsp;&nbsp; autocomplete should be attached<br>42  //   autocomplete should be attached
44      &nbsp; // - Removed mail.autoComplete.commentColumn support43  // - Removed mail.autoComplete.commentColumn support to keep co
> to keep code simple<br>>de simple
45      &nbsp; // - Removed observers on pref changes to keep code 44  // - Removed observers on pref changes to keep code simple 
>simple&nbsp;<br> 
46      &nbsp; //</code>45  //</code>
47    </p>46 
48    <p>
49      <code>setupLDAPAutoComplete: function(textBoxIds) {<br>47<code>setupLDAPAutoComplete: function(textBoxIds) {
50      &nbsp;&nbsp;&nbsp; var autocompleteLdap = false;<br>48    var autocompleteLdap = false;
51      &nbsp;&nbsp;&nbsp; var autocompleteDirectory = null;<br>49    var autocompleteDirectory = null;
52      &nbsp;&nbsp;&nbsp; autocompleteLdap = getPref("ldap_2.autoC50    autocompleteLdap = getPref("ldap_2.autoComplete.useDirectory"
>omplete.useDirectory");<br>>);
53      &nbsp;<br>51 
54      &nbsp;&nbsp;&nbsp; if (!autocompleteLdap) {<br>52    if (!autocompleteLdap) {
55      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>53      return;
56      &nbsp;&nbsp;&nbsp; }<br>54    }
57      &nbsp;&nbsp;&nbsp; else {<br>55    else {
58      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; autocompleteDirectory = getP56      autocompleteDirectory = getPref("ldap_2.autoComplete.direct
>ref("ldap_2.autoComplete.directoryServer");<br>>oryServer");
59      &nbsp;&nbsp;&nbsp; }<br>57    }
60      &nbsp;&nbsp;&nbsp; var LDAPSession= Components.classes["@mo58    var LDAPSession= Components.classes["@mozilla.org/autocomplet
>zilla.org/autocompleteSession;1?type=ldap"];<br>>eSession;1?type=ldap"];
61      &nbsp;&nbsp;&nbsp; LDAPSession = LDAPSession.createInstance59    LDAPSession = LDAPSession.createInstance().QueryInterface(Com
>().QueryInterface(Components.interfaces.nsILDAPAutoCompleteSessio>ponents.interfaces.nsILDAPAutoCompleteSession);
>n);<br> 
62      &nbsp;&nbsp;&nbsp; var url;<br>60    var url;
63      &nbsp;&nbsp;&nbsp; try {<br>61    try {
64      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Gecko 1.9 way<br>62      // Gecko 1.9 way
65      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url = getPref(autocompleteDi63      url = getPref(autocompleteDirectory + ".uri", true);
>rectory + ".uri", true);<br> 
66      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.serverURL = Comp64      LDAPSession.serverURL = Components.classes["@mozilla.org/ne
>onents.classes["@mozilla.org/network/io-service;1"].<br>>twork/io-service;1"].
67      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; getService(Compo65        getService(Components.interfaces.nsIIOService).
>nents.interfaces.nsIIOService).<br> 
68      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; newU66          newURI(url, null, null).
>RI(url, null, null).<br> 
69      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp67            QueryInterface(Components.interfaces.nsILDAPURL);
>;&nbsp; QueryInterface(Components.interfaces.nsILDAPURL);<br> 
70      &nbsp;&nbsp;&nbsp; }<br>68    }
71      &nbsp;&nbsp;&nbsp; catch(ex) {<br>69    catch(ex) {
72      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Try gecko 1.8 way<br>70      // Try gecko 1.8 way
73      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var serverURL = Components.c71      var serverURL = Components.classes[
>lasses[<br> 
74      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "@mo72          "@mozilla.org/network/ldap-url;1"].
>zilla.org/network/ldap-url;1"].<br> 
75      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; crea73          createInstance().QueryInterface(
>teInstance().QueryInterface(<br> 
76      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp74              Components.interfaces.nsILDAPURL);
>;&nbsp;&nbsp;&nbsp; Components.interfaces.nsILDAPURL);<br> 
77      <br>75 
78      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<br>76      try {
79      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; serv77          serverURL.spec = getPref(autocompleteDirectory + ".uri"
>erURL.spec = getPref(autocompleteDirectory + ".uri", true);<br>>, true);
80      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } catch (ex) {<br>78      } catch (ex) {
81      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dump79          dump("ERROR: " + ex + "\n");
>("ERROR: " + ex + "\n");<br> 
82      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>80      }
83      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.serverURL =&nbsp81      LDAPSession.serverURL =  serverURL;
>; serverURL;<br> 
84      &nbsp;&nbsp;&nbsp; }<br>82    }
85      &nbsp;&nbsp;&nbsp; // get the login to authenticate as, if 83    // get the login to authenticate as, if there is one
>there is one<br> 
86      &nbsp;&nbsp;&nbsp; try {<br>84    try {
87      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.login = getPref(85      LDAPSession.login = getPref(autocompleteDirectory + ".auth.
>autocompleteDirectory + ".auth.dn", true);<br>>dn", true);
88      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>86    } catch (ex) {
89      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if we don't have this pre87      // if we don't have this pref, no big deal
>f, no big deal<br> 
90      &nbsp;&nbsp;&nbsp; }<br>88    }
91      <br>89 
92      &nbsp;&nbsp;&nbsp; try {<br>90    try {
93      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.saslMechanism = 91      LDAPSession.saslMechanism = getPref(autocompleteDirectory +
>getPref(autocompleteDirectory + ".auth.saslmech", true);<br>> ".auth.saslmech", true);
94      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>92    } catch (ex) {
95      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // don't care if we don't ha93      // don't care if we don't have this pref
>ve this pref<br> 
96      &nbsp;&nbsp;&nbsp; }<br>94    }
97      &nbsp;&nbsp;&nbsp;<br>95   
98      &nbsp;&nbsp;&nbsp; // set the LDAP protocol version correct96    // set the LDAP protocol version correctly
>ly<br> 
99      &nbsp;&nbsp;&nbsp; var protocolVersion;<br>97    var protocolVersion;
100      &nbsp;&nbsp;&nbsp; try {<br>98    try {
101      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; protocolVersion = getPref(au99      protocolVersion = getPref(autocompleteDirectory +".protocol
>tocompleteDirectory +".protocolVersion");<br>>Version");
102      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>100    } catch (ex) {
103      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if we don't have this pre101      // if we don't have this pref, no big deal
>f, no big deal<br> 
104      &nbsp;&nbsp;&nbsp; }<br>102    }
105      &nbsp;&nbsp;&nbsp;<br>103   
106      &nbsp;&nbsp;&nbsp; if (protocolVersion == "2") {<br>104    if (protocolVersion == "2") {
107      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.version = Compon105      LDAPSession.version = Components.interfaces.nsILDAPConnecti
>ents.interfaces.nsILDAPConnection.VERSION2;<br>>on.VERSION2;
108      &nbsp;&nbsp;&nbsp; }<br>106    }
109      &nbsp;&nbsp;&nbsp; // don't search on non-CJK strings short107    // don't search on non-CJK strings shorter than this
>er than this<br> 
110      &nbsp;&nbsp;&nbsp; try {<br>108    try {
111      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.minStringLength 109      LDAPSession.minStringLength = getPref(autocompleteDirectory
>= getPref(autocompleteDirectory + ".autoComplete.minStringLength"> + ".autoComplete.minStringLength");
>);<br> 
112      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>110    } catch (ex) {
113      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if this pref isn't there,111      // if this pref isn't there, no big deal.  just let
> no big deal.&nbsp; just let<br> 
114      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // nsLDAPAutoCompleteSession112      // nsLDAPAutoCompleteSession use its default.
> use its default.<br> 
115      &nbsp;&nbsp;&nbsp; }<br>113    }
116      &nbsp;&nbsp;&nbsp; // don't search on CJK strings shorter t114    // don't search on CJK strings shorter than this
>han this<br> 
117      &nbsp;&nbsp;&nbsp; try {<br>115    try {
118      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.cjkMinStringLeng116      LDAPSession.cjkMinStringLength = getPref(autocompleteDirect
>th = getPref(autocompleteDirectory + ".autoComplete.cjkMinStringL>ory + ".autoComplete.cjkMinStringLength");
>ength");<br> 
119      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>117    } catch (ex) {
120      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if this pref isn't there,118      // if this pref isn't there, no big deal.  just let
> no big deal.&nbsp; just let<br> 
121      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // nsLDAPAutoCompleteSession119      // nsLDAPAutoCompleteSession use its default.
> use its default.<br> 
122      &nbsp;&nbsp;&nbsp; }<br>120    }
123      &nbsp;<br>121 
124      &nbsp;&nbsp;&nbsp; // we don't try/catch here, because if t122    // we don't try/catch here, because if this fails, we're outt
>his fails, we're outta luck<br>>a luck
125      &nbsp;&nbsp;&nbsp; var ldapFormatter = Components.classes["123    var ldapFormatter = Components.classes["@mozilla.org/ldap-aut
>@mozilla.org/ldap-autocomplete-formatter;1?type=addrbook"].<br>>ocomplete-formatter;1?type=addrbook"].
126      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; createInstance().QueryInterf124      createInstance().QueryInterface(Components.interfaces.nsIAb
>ace(Components.interfaces.nsIAbLDAPAutoCompFormatter);<br>>LDAPAutoCompFormatter);
127      &nbsp;&nbsp;&nbsp; // override autocomplete name format?<br125    // override autocomplete name format?
>> 
128      &nbsp;&nbsp;&nbsp; try {<br>126    try {
129      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ldapFormatter.nameFormat = g127      ldapFormatter.nameFormat = getPref(autocompleteDirectory +"
>etPref(autocompleteDirectory +".autoComplete.nameFormat",true);<b>.autoComplete.nameFormat",true);
>r> 
130      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>128    } catch (ex) {
131      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if this pref isn't there,129      // if this pref isn't there, no big deal.  just let
> no big deal.&nbsp; just let<br> 
132      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // nsAbLDAPAutoCompFormatter130      // nsAbLDAPAutoCompFormatter use its default.
> use its default.<br> 
133      &nbsp;&nbsp;&nbsp; }<br>131    }
134      &nbsp;&nbsp;&nbsp;<br>132   
135      &nbsp;&nbsp;&nbsp; // override autocomplete mail address fo133    // override autocomplete mail address format?
>rmat?<br> 
136      &nbsp;&nbsp;&nbsp; try {<br>134    try {
137      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ldapFormatter.addressFormat 135      ldapFormatter.addressFormat = getPref(autocompleteDirectory
>= getPref(autocompleteDirectory +".autoComplete.addressFormat",tr> +".autoComplete.addressFormat",true);
>ue);<br> 
138      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>136    } catch (ex) {
139      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if this pref isn't there,137      // if this pref isn't there, no big deal.  just let
> no big deal.&nbsp; just let<br> 
140      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // nsAbLDAPAutoCompFormatter138      // nsAbLDAPAutoCompFormatter use its default.
> use its default.<br> 
141      &nbsp;&nbsp;&nbsp; }<br>139    }
142      <br>140 
143      &nbsp;&nbsp;&nbsp; // set the session's formatter, which al141    // set the session's formatter, which also happens to
>so happens to<br> 
144      &nbsp;&nbsp;&nbsp; // force a call to the formatter's getAt142    // force a call to the formatter's getAttributes() method
>tributes() method<br> 
145      &nbsp;&nbsp;&nbsp; // -- which is why this needs to happen 143    // -- which is why this needs to happen after we've set the
>after we've set the<br> 
146      &nbsp;&nbsp;&nbsp; // various formats<br>144    // various formats
147      &nbsp;&nbsp;&nbsp; LDAPSession.formatter = ldapFormatter;<b145    LDAPSession.formatter = ldapFormatter;
>r> 
148      &nbsp;<br>146 
149      &nbsp;&nbsp;&nbsp; // override autocomplete entry formattin147    // override autocomplete entry formatting?
>g?<br> 
150      &nbsp;&nbsp;&nbsp; try {<br>148    try {
151      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.outputFormat = g149      LDAPSession.outputFormat = getPref(autocompleteDirectory +
>etPref(autocompleteDirectory +<br> 
152      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp150                                           ".autoComplete.outputF
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs>ormat",
>p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb 
>sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; " 
>.autoComplete.outputFormat",<br> 
153      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp151                                         true);
>;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs 
>p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb 
>sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; true);<br> 
154      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>152    } catch (ex) {
155      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if this pref isn't there,153      // if this pref isn't there, no big deal.  just let
> no big deal.&nbsp; just let<br> 
156      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // nsLDAPAutoCompleteSession154      // nsLDAPAutoCompleteSession use its default.
> use its default.<br> 
157      &nbsp;&nbsp;&nbsp; }<br>155    }
158      &nbsp;<br>156 
159      &nbsp;&nbsp;&nbsp; // override default search filter templa157    // override default search filter template?
>te?<br> 
160      &nbsp;&nbsp;&nbsp; try {<br>158    try {
161      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.filterTemplate =159      LDAPSession.filterTemplate = getPref(
> getPref(<br> 
162      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; autocompleteDire160        autocompleteDirectory + ".autoComplete.filterTemplate",
>ctory + ".autoComplete.filterTemplate",<br> 
163      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; true);<br>161        true);
164      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>162    } catch (ex) {
165      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if this pref isn't there,163      // if this pref isn't there, no big deal.  just let
> no big deal.&nbsp; just let<br> 
166      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // nsLDAPAutoCompleteSession164      // nsLDAPAutoCompleteSession use its default
> use its default<br> 
167      &nbsp;&nbsp;&nbsp; }<br>165    }
168      &nbsp;&nbsp;&nbsp;<br>166   
169      &nbsp;&nbsp;&nbsp; // override default maxHits (currently 1167    // override default maxHits (currently 100)
>00)<br> 
170      &nbsp;&nbsp;&nbsp; try {<br>168    try {
171      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // XXXdmose should really us169      // XXXdmose should really use .autocomplete.maxHits,
>e .autocomplete.maxHits,<br> 
172      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // but there's no UI for tha170      // but there's no UI for that yet
>t yet<br> 
173      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDAPSession.maxHits = getPre171      LDAPSession.maxHits = getPref(autocompleteDirectory + ".max
>f(autocompleteDirectory + ".maxHits");<br>>Hits");
174      &nbsp;&nbsp;&nbsp; } catch (ex) {<br>172    } catch (ex) {
175      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // if this pref isn't there,173      // if this pref isn't there, or is out of range, no big dea
> or is out of range, no big deal.<br>>l.
176      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // just let nsLDAPAutoComple174      // just let nsLDAPAutoCompleteSession use its default.
>teSession use its default.<br> 
177      &nbsp;&nbsp;&nbsp; }<br>175    }
178      <br>176 
179      &nbsp;&nbsp;&nbsp; for (i=0 ; i &lt; textBoxIds.length ; i+177    for (i=0 ; i &lt; textBoxIds.length ; i++ ) {
>+ ) {<br> 
180      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var autoCompleteWidget = doc178      var autoCompleteWidget = document.getElementById(textBoxIds
>ument.getElementById(textBoxIds[i]);<br>>[i]);
181      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; autoCompleteWidget.addSessio179      autoCompleteWidget.addSession(LDAPSession);
>n(LDAPSession);<br> 
182      &nbsp;&nbsp;&nbsp; }<br>180    }
183      &nbsp; }</code>181  }</code>
184    </p>182</pre>

Back to History