Finally get TPAC AutoSuggest working in IE. Needed JSON_v1.js autosuggest-wip
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 27 Jan 2012 00:21:58 +0000 (19:21 -0500)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Fri, 27 Jan 2012 16:40:49 +0000 (11:40 -0500)
Incidentally also avoid x-webkit-speech if using AutoSuggest. Chrome
users see it for only a split second before the AutoSuggest widget
clobbers it anyway.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/templates/opac/parts/js.tt2
Open-ILS/src/templates/opac/parts/searchbar.tt2
Open-ILS/web/js/dojo/openils/AutoSuggestStore.js

index 6473bd5..91efa6a 100644 (file)
      }, lang, bidi;
 </script>
 <script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/dojo/dojo.js?[% ctx.eg_cache_hash %]"></script>
-<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/opensrf/opensrf.js?[% ctx.eg_cache_hash %]"></script>
-[%# See whether we can get away with killing this line - LFW %]<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/opensrf/opensrf_xhr.js?[% ctx.eg_cache_hash %]"></script>
 <script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/dojo/openils_dojo.js?[% ctx.eg_cache_hash %]"></script>
 
+[%- # So the following works in Mozilla and Chrome, but not in IE8.
+    # Seems like it /should/ work anywhere, though, and obviate the
+    # next three script tags: %]
+<!-- <script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/DojoSRF.js?[% ctx.eg_cache_hash %]"></script> -->
+
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/opensrf/opensrf.js?[% ctx.eg_cache_hash %]"></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/opensrf/opensrf_xhr.js?[% ctx.eg_cache_hash %]"></script>
+<script type="text/javascript" src="[% ctx.media_prefix %]/js/dojo/opensrf/JSON_v1.js?[% ctx.eg_cache_hash %]"></script>
+
 [% IF use_autosuggest.enabled == "t"; %]
 <script type="text/javascript">
     dojo.require("openils.widget.AutoSuggest");
index 6dcfcaa..80b55ee 100644 (file)
             l(' for ');
         %]
         <span class='search_box_wrapper'>
-            <input
+            <input type="text" id="search_box" name="query"
+                value="[% is_advanced ? ctx.processed_search_query : CGI.param('query') | html %]"
                 [%- IF use_autosuggest.enabled == "t" %]
                 dojoType="openils.widget.AutoSuggest" type_selector="'qtype'"
                 submitter="this.textbox.form.submit();"
-                [%- IF use_autosuggest.value.search('opac_visible') %]
+                [%-     IF use_autosuggest.value.search('opac_visible') %]
                 store_args='{"org_unit_getter": function() { return [% ctx.search_ou %]; }}'
-                [%- END -%]
-                [%- END -%] type="text" id="search_box" name="query"
-                value="[% is_advanced ? ctx.processed_search_query : CGI.param('query') | html %]"
-                x-webkit-speech />
+                [%-     END # opac_visible -%]
+                [%- ELSE -%]
+                x-webkit-speech
+                [%- END # autosuggest enabled %] />
         </span>
         [%- INCLUDE "opac/parts/qtype_selector.tt2" id="qtype";
             l(' in '); PROCESS build_org_selector name='loc' value=ctx.search_ou;
index 6d82651..e985183 100644 (file)
@@ -76,7 +76,7 @@ if (!dojo._hasResource["openils.AutoSuggestStore"]) {
             var query = {};
             query[pkey] = {"!=": null};
 
-            (new OpenSRF.ClientSession("open-ils.fielder")).request({
+            OpenSRF.CachedClientSession("open-ils.fielder").request({
                 "method": "open-ils.fielder." + key + ".atomic",
                 "params": [{"query": query, "fields": field_list}],
                 "async": true,
@@ -114,11 +114,10 @@ if (!dojo._hasResource["openils.AutoSuggestStore"]) {
                 class_list, function(key) {
                     self._setup_config_metabib_cache(
                         key, field_lists[key], function() {
-                            if (dojo.every(class_list, is_done)) {
+                            if (dojo.every(class_list, is_done))
                                 self.cm_cache.is_done = true;
-                            }
                         }
-                    )
+                    );
                 }
             );
         },