improving Search :
[koha_fer] / koha-tmpl / intranet-tmpl / default / en / search.marc / search.tmpl
1 <!-- TMPL_IF NAME="opac" -->
2     <!-- TMPL_INCLUDE NAME="opac-top.inc" -->
3 <!-- TMPL_ELSE -->
4     <!-- TMPL_INCLUDE NAME="cat-top.inc" -->
5 <!-- /TMPL_IF -->
6 <div id="mainbloc">
7
8 <h1 class="catalogue">Catalogue search</h1>
9
10 <form name="f" method="post">
11         <input type="hidden" name="op" value="do_search">
12         <input type="hidden" name="type" value="intranet">
13         <input type="hidden" name="nbstatements" value="<!-- TMPL_VAR NAME="nbstatements" -->">
14         <div id="bloc25">
15                 <h2 class="catalogue">Search on</h2>
16                 <p>
17                         <label class="label20">Keyword</label>
18                         <input type="hidden" name="marclist" value="">
19                         <input type="hidden" name="and_or" value="and">
20                         <input type="hidden" name="excluding" value="">
21                         <input type="hidden" name="operator" value="contains">
22                         <input type="text" name="value" onchange="sql_update()">
23                 </p>
24                 <p>
25                         <label class="label20">Title</label>
26                         <input type="hidden" name="marclist" value="biblio.title">
27                         <input type="hidden" name="and_or" value="and">
28                         <input type="hidden" name="excluding" value="">
29                         <input type="hidden" name="operator" value="contains">
30                         <input type="text" name="value" onchange="sql_update()">
31                 </p>
32                 <p>
33                         <label class="label20">author</label> <input type="hidden" name="marclist" value="biblio.author">
34                         <input type="hidden" name="and_or" value="and">
35                         <input type="hidden" name="excluding" value="">
36                         <input type="hidden" name="operator" value="contains">
37                         <input type="text" name="value" onchange="sql_update()">
38                 </p>
39         <p>
40                                 <label class="label20">barcode</label>
41                                 <input type="hidden" name="marclist" value="items.barcode">
42                                 <input type="hidden" name="and_or" value="and">
43                                 <input type="hidden" name="excluding" value="">
44                                 <input type="hidden" name="operator" value="contains">
45                                 <input type="text" name="value" onchange="sql_update()">
46         </p>
47         </div>
48         <div id="bloc25">
49                 <h2 class="catalogue">Search on</h2>
50                 <p>
51                         <label class="label20">Illustrator</label>
52                         <input type="hidden" name="marclist" value="biblioitems.illus">
53                         <input type="hidden" name="and_or" value="and">
54                         <input type="hidden" name="excluding" value="">
55                         <input type="hidden" name="operator" value="contains">
56                         <input type="text" name="value" onchange="sql_update()">
57                 </p>
58                 <p>
59                         <label class="label20">Dewey</label><input type="hidden" name="marclist" value="biblioitems.dewey">
60                         <input type="hidden" name="and_or" value="and">
61                         <input type="hidden" name="excluding" value="">
62                         <input type="hidden" name="operator" value="contains">
63                         <input type="text" name="value" onchange="sql_update()">
64                 </p>
65                 <p>
66                         <label class="label20">Item Type</label> <input type="hidden" name="marclist" value="biblioitems.itemtype">
67                         <input type="hidden" name="and_or" value="and">
68                         <input type="hidden" name="excluding" value="">
69                         <input type="hidden" name="operator" value="=">
70                         <!-- TMPL_VAR name="CGIitemtype" -->
71                 </p>
72                                                 <p>
73                                 <label class="label20">branch</label>
74                                 <input type="hidden" name="marclist" value="items.holdingbranch">
75                                 <input type="hidden" name="and_or" value="and">
76                                 <input type="hidden" name="excluding" value="">
77                                 <input type="hidden" name="operator" value="=">
78                                 <!-- TMPL_VAR name="CGIbranch" -->
79         </p>
80
81         </div>
82         <div id="bloc25">
83                 <h2 class="catalogue">More fields</h2>
84                 <!-- TMPL_LOOP NAME="statements" -->
85                         <p>
86                                 <select name="and_or" size="1" onchange="sql_update()">
87                                         <option value="and">and</option>
88                                         <option <!-- TMPL_IF NAME="or" -->selected <!-- /TMPL_IF -->value="or">or</option>
89                                 </select>
90                                 <!-- TMPL_VAR name="marclist" -->
91                                 <select name="excluding" size="1" onchange="sql_update()">
92                                         <option value="0"> </option>
93                                         <option <!-- TMPL_IF NAME="not" -->selected <!-- /TMPL_IF -->value="1">not</option>
94                                 </select>
95                                 <select name="operator" size="1" onchange="sql_update()">
96                                         <option <!-- TMPL_IF NAME="contains" -->selected<!-- /TMPL_IF --> value="contains">Contains</option>
97                                         <option <!-- TMPL_IF NAME="eq" -->selected<!-- /TMPL_IF --> value="=">Is equal to</option>
98                                         <option <!-- TMPL_IF NAME="start" -->selected<!-- /TMPL_IF --> value="start">Starts with</option>
99                                         <option <!-- TMPL_IF NAME="gt" -->selected<!-- /TMPL_IF --> value=">">Is greater than</option>
100                                         <option <!-- TMPL_IF NAME="ge" -->selected<!-- /TMPL_IF --> value=">=">Is greater or equal to</option>
101                                         <option <!-- TMPL_IF NAME="lt" -->selected<!-- /TMPL_IF --> value="<">Is lower than</option>
102                                         <option <!-- TMPL_IF NAME="le" -->selected<!-- /TMPL_IF --> value="<=">Is lower or equal to</option>
103                                 </select>
104                                 <input type="text" name="value" onChange="sql_update()" <!-- TMPL_IF NAME="value" -->value="<!-- TMPL_VAR NAME="value" -->"<!-- /TMPL_IF -->>
105                         </p>
106                 <!-- /TMPL_LOOP -->
107                 <p>
108                 <input type="button catalogue" value="Add criteria" onClick="AddStatement()" class="button catalogue">
109                 Warning : the "contains" statement does NOT work if you enter 2 or less letters
110         </div>
111         <div id="bloc25">
112                 <p>
113                         <div name="sql">
114                                 <textarea name="sql" rows=3 cols=70 disabled readonly></textarea>
115                         </div>
116                 </p>
117                 <p>Results per page :
118                         <select align="right" name="resultsperpage" size="1">
119                                 <option value="20">20</option>
120                                 <option value="50">50</option>
121                                 <option value="100">100</option>
122                         </select>
123                 Ordered by
124                         <select name="orderby" size="1">
125                                 <option value="biblio.title">Title</option>
126                                 <option value="biblio.author">Author</option>
127                                 <option value="biblioitems.dewey">Dewey</option>
128                                 <option value="biblioitems.publicationyear">Publication Year</option>
129                                 <option value="biblioitems.publishercode">Publisher</option>
130                         </select>
131                 </p>
132                 <p>
133                         <input type="submit" value="Start search" class="button catalogue">
134                         <a href="javascript:PopupSuggestion()" class="button catalogue">Suggestions</a>
135                 </p>
136         </div>
137 </form>
138
139 <script>
140 function sql_update() {
141 document.f.sql.value="";
142         for (i=0 ; i<document.f.marclist.length ; i++) {
143                 if (document.f.value[i].value.length>0) {
144                         document.f.sql.value = document.f.sql.value+
145                                                                                 document.f.and_or[i].value + ' (' +
146                                                                                 document.f.excluding[i].value + ' ' +
147                                                                                 document.f.marclist[i].value + ' ' +
148                                                                                 document.f.operator[i].value + ' ' +
149                                                                                 '\''+document.f.value[i].value + '\') ';
150                 }
151         }
152 }
153
154 function AddStatement() {
155
156         document.forms[0].op.value="AddStatement";
157         document.f.submit();
158 }
159
160 function PopupSuggestion() {
161     var strQuery="";
162         for (i=0 ; i<document.f.marclist.length ; i++) {
163                 if (document.f.value[i].value.length>0) {
164                     strQuery += " "+document.f.value[i].value;
165                 }
166         }
167         newin=window.open("suggest.pl?Q="+strQuery,"Suggestions",'width=500,height=400,toolbar=false,scrollbars=yes');
168 }
169
170 </script>
171 </div>
172 <!-- TMPL_IF NAME="opac" -->
173     <!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->
174 <!-- TMPL_ELSE -->
175     <!-- TMPL_INCLUDE NAME="cat-bottom.inc" -->
176 <!-- /TMPL_IF -->
177