Correcting invalid markup in new YUI autocomplete search feature; Correcting and...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / serials-search.inc
1 <!-- Begin Serials Resident Search Box -->
2 <!-- TMPL_IF NAME="CircAutocompl" --><script type="text/javascript">
3 YAHOO.util.Event.onContentReady("header_search", function() {
4     new function() {
5         // Define a custom formatter function
6         this.fnCustomFormatter = function(oResultItem, sQuery) {
7             var name        = oResultItem[0];
8             var cardnumber  = oResultItem[1];
9             var address     = oResultItem[2];
10             var city        = oResultItem[3];
11             var zip         = oResultItem[4];
12             var aMarkup = [
13                 "<div class=\"sample-result\">",
14                 name,
15                 " (",
16                 cardnumber,
17                 ")<small> -- ",
18                 address,
19                 ", ",
20                 city,
21                 "</small>",
22                 "</div>"];
23             return (aMarkup.join(""));
24         };
25
26         // Instantiate one XHR DataSource and define schema as an array:
27         //     ["Record Delimiter",
28         //     "Field Delimiter"]
29         this.oACDS = new YAHOO.widget.DS_XHR("/cgi-bin/koha/circ/ysearch.pl", ["\n", "\t"]);
30         this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;
31         this.oACDS.maxCacheEntries = 60;
32         this.oACDS.queryMatchSubset = true;
33     
34         // Instantiate first AutoComplete
35         var myInput = document.getElementById('findborrower');
36         var myContainer = document.getElementById('yborrowercontainer');
37         this.oAutoComp = new YAHOO.widget.AutoComplete(myInput,myContainer,this.oACDS);
38         //this.oAutoComp.delimChar = ";";
39         //this.oAutoComp.queryDelay = 1;
40         this.oAutoComp.formatResult = this.fnCustomFormatter;
41 }
42 });    
43 </script><!-- /TMPL_IF -->
44 <div id="header_search">
45         <div id="subscription_search" class="residentsearch">
46         <p class="tip">Search Subscriptions:</p>
47  <form action="/cgi-bin/koha/serials/serials-home.pl" method="get"><!-- TMPL_IF NAME="routing" --><input type="hidden" name="routing" value="<!-- TMPL_VAR NAME="routing" -->" /><!-- /TMPL_IF --><input type="hidden" name="searched" value="1" /> <label for="ISSN_filter">ISSN:</label> <input type="text" size="10" maxlength="11" name="ISSN_filter" id="ISSN_filter" value="<!-- TMPL_VAR name="ISSN_filter" -->" /> <label for="title_filter">Title:</label> <input type="text" size="20" maxlength="40" name="title_filter" id="title_filter" value="<!-- TMPL_VAR name="title_filter" -->" /><input type="submit" value="Search" class="button" />
48 </form>
49         </div>
50         <div id="circ_search" class="residentsearch">
51         <p class="tip">Enter patron card number or partial name:</p>
52     <form action="/cgi-bin/koha/circ/circulation.pl" method="post">
53     <!-- TMPL_IF NAME="CircAutocompl" -->
54     <div class="autocomplete">
55             <div id="borrowerautocomplete" class="autocomplete">
56                 <input autocomplete="off" id="findborrower" name="findborrower" class="focus" type="text" />
57                 <div id="yborrowercontainer"></div>
58                 <input id="ysearchsubmit" type="submit" value="Submit" />
59                 <input name="branch" value="<!-- TMPL_VAR name="branch" -->" type="hidden" />
60                 <input name="printer" value="" type="hidden" />
61             </div>
62         </div>
63         <!-- TMPL_ELSE -->
64             <input id="findborrower" name="findborrower" size="40" class="focus" type="text" />
65             <input name="branch" value="<!-- TMPL_VAR name="branch" -->" type="hidden" />
66             <input name="printer" value="" type="hidden" />
67             <input value="Submit" type="submit" />
68         <!-- /TMPL_IF -->
69     </form>
70         </div>  
71         <div id="catalog_search" class="residentsearch">
72         <p class="tip">Enter search keywords:</p>
73                 <form action="/cgi-bin/koha/catalogue/search.pl"  method="get" id="cat-search-block">
74                          <input type="text" name="q" id="search-form" size="40" value="" title="Enter the terms you wish to search for." class="form-text" />
75                                 <input type="submit" value="Submit"  class="form-submit" />
76                 </form>
77         </div>
78                         <ul>
79                         <li><a href="/cgi-bin/koha/serials/serials-home.pl#subscription_search">Search Subscriptions</a></li>
80                         <li><a href="/cgi-bin/koha/circ/circulation.pl#circ_search">Check Out</a></li>
81                         <li><a href="/cgi-bin/koha/catalogue/search.pl#catalog_search">Search the Catalog</a></li>
82                         </ul>   
83 </div>
84 <!-- End Serials Resident Search Box -->