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