e020742167faf7b05f686c43bec92e77ee83996a
[koha-equinox.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / z3950_search.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% USE Koha %]
5 [% USE ColumnsSettings %]
6 [% INCLUDE 'doc-head-open.inc' %]
7 <title>Koha &rsaquo; Z39.50/SRU search results</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 <style>
10     #dataPreview { width : 90%; top: 5%; } .modal-body { max-height: 380px; } .modal-header { padding: 0 14px; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }
11 </style>
12 </head>
13
14 <body id="cat_z3950_search" class="cat">
15     <div class="container-fluid">
16         [% IF ( opsearch ) %]
17             <h2>Z39.50/SRU search</h2>
18             <form method="post" action="z3950_search.pl" name="f" class="checkboxed">
19                 <div class="row">
20                     <div class="col-xs-6">
21                         <input type="hidden" name="op" id="op" value="do_search" />
22                         <fieldset class="rows">
23                             <ol>
24                                 <li>
25                                     <label for="isbn">ISBN: </label> <input type="text" id="isbn" name="isbn" value="[% isbn | html %]" class="focus" />
26                                 </li>
27                                 <li>
28                                     <label for="issn">ISSN: </label> <input type="text" id="issn" name="issn" value="[% issn | html %]" /></li>
29                                 <li>
30                                     <label for="title">Title: </label> <input type="text" id="title"  name="title" value="[% title | html %]" /></li>
31                                 <li>
32                                     <label for="author">Author: </label> <input type="text" id="author" name="author" value="[% author | html %]" /></li>
33                                 <li>
34                                     <label for="subject">Subject heading: </label> <input type="text" id="subject" name="subject" value="" /></li>
35                                 <li>
36                                     <label for="srchany">Keyword (any): </label> <input type="text" id="srchany" name="srchany" value="" /></li>
37                                 <li>
38                                     <label for="lccall">LC call number: </label> <input type="text" id="lccall" name="lccall" value="" /></li>
39                                 <li>
40                                     <label for="controlnumber">Control no.: </label> <input type="text" id="controlnumber" name="controlnumber" value="" /></li>
41                                 <li>
42                                     <label for="dewey">Dewey: </label> <input type="text" id="dewey" name="dewey" value="" /></li>
43                                 <li>
44                                     <label for="stdid">Standard ID: </label> <input type="text" id="stdid" name="stdid" value="" /></li>
45                                 <li>
46                                     <a id="resetZ3950Search" href="#"><i class="fa fa-trash"></i> Clear search form</a>
47                                 </li>
48                             </ol>
49                             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
50                             <input type="hidden" name="frameworkcode" value="[% frameworkcode | html %]" />
51                         </fieldset> <!-- /.rows -->
52                     </div> <!-- /.col-xs-6 -->
53
54                     <div class="col-xs-6">
55                         <h2>Search targets</h2>
56                         <div id="z3950_search_targets">
57                             <span class="z3950checks">
58                                 <span class="checkall"><a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a></span> |
59                                 <span class="clearall"><a id="CheckNone" href="#"><i class="fa fa-remove"></i> Clear all</a></span>
60                             </span>
61                             [% FOREACH serverloo IN serverloop %]
62                                 <p>
63                                     [% IF ( serverloo.checked ) %]
64                                         <input type="checkbox" name="id" id="z3950_[% serverloo.id | html %]" value="[% serverloo.id | html %]" checked="checked" />
65                                     [% ELSE %]
66                                         <input type="checkbox" name="id" id="z3950_[% serverloo.id | html %]" value="[% serverloo.id | html %]" />
67                                     [% END %]
68                                     <label for="z3950_[% serverloo.id | html %]">[% serverloo.servername | html %]</label>
69                                 </p>
70                             [% END %]
71                         </div> <!-- /#z3950_search_targets -->
72                     </div> <!-- /.col-xs-6 -->
73                 </div> <!-- /.row -->
74
75                 <nav class="navbar navbar-default navbar-fixed-bottom">
76                     <div class="container-fluid">
77                         <fieldset class="action"><input type="submit"  class="submit" value="Search" /> <a class="cancel close" href="#">Cancel</a></fieldset>
78                     </div>
79                 </nav>
80             </form> <!-- /.checkboxed -->
81
82         [% ELSE # IF opsearch %]
83
84             <div class="row">
85                 <div class="col-xs-12">
86                     <h2>Results</h2>
87                     <p>
88                         You searched for:
89                         [% IF ( title ) %]<em>Title: </em><span class="term">[% title | html %]</span> [% END %]
90                         [% IF ( author ) %]<em>Author: </em><span class="term">[% author | html %]</span> [% END %]
91                         [% IF ( isbn ) %]<em>ISBN: </em><span class="term">[% isbn | html %]</span> [% END %]
92                         [% IF ( issn ) %]<em>ISSN: </em><span class="term">[% issn | html %]</span> [% END %]
93                         [% IF ( lccall ) %]<em>LC call number: </em><span class="term">[% lccall | html %]</span> [% END %]
94                         [% IF ( subject ) %]<em>Subject heading: </em><span class="term">[% subject | html %]</span> [% END %]
95                         [% IF ( controlnumber ) %]<em>Control no: </em><span class="term">[% controlnumber | html %]</span> [% END %]
96                         [% IF ( dewey ) %]<em>Dewey: </em><span class="term">[% dewey | html %]</span> [%END %]
97                         [% IF ( srchany ) %]<em>Raw (any): </em><span class="term">[% srchany | html %]</span> [% END %]
98                         [% IF ( stdid ) %]<em>Standard ID: </em><span class="term">[% stdid | html %]</span> [% END %]
99                     </p>
100                     [% IF ( errconn ) %]
101                         <div class="dialog alert">
102                             <ul>
103                             [% FOREACH errcon IN errconn %]
104                                 [% IF ( errcon.error == '10000' ) %]<li>Connection failed to [% errcon.server | html %]</li>
105                                 [% ELSIF ( errcon.error == '10007' ) %]<li>Connection timeout to [% errcon.server | html %]</li>
106                                 [% ELSIF errcon.error.match( '^XSLTH' ) %]<li>[% errcon.server | html %] record [% errcon.seq | html %]: [% PROCESS 'xslt-handler.inc' code=errcon.error %]</li>
107                                 [% ELSE %]<li>[% errcon.server | html %] record [% errcon.seq | html %]: [% errcon.error | html %]</li>
108                                 [% END %]
109                             [% END %]
110                             </ul>
111                         </div>
112                     [% END %]
113
114                     [% IF ( breeding_loop ) %]
115                         <table id="resultst">
116                             <thead>
117                                 <tr>
118                                     <th>Server</th>
119                                     <th>Title</th>
120                                     <th>Author</th>
121                                     <th>Date</th>
122                                     <th>Edition</th>
123                                     <th>ISBN</th>
124                                     <th>LCCN</th>
125                                     [% IF Koha.Preference('AdditionalFieldsInZ3950ResultSearch') != '' %]
126                                         <th>Additional fields</th>
127                                     [% END %]
128                                     <th class="noExport">Actions</th>
129                                 </tr>
130                             </thead>
131                             <tbody>
132                                 [% FOREACH breeding_loo IN breeding_loop %]
133                                     [% IF ( breeding_loo.breedingid ) %]
134                                         <tr id="row[% breeding_loo.breedingid | html %]">
135                                             <td>[% breeding_loo.server | html %]</td>
136                                             <td>[% breeding_loo.title | html %]</td>
137                                             <td>[% breeding_loo.author | html %]</td>
138                                             <td>[% breeding_loo.date | html %]</td>
139                                             <td>[% breeding_loo.edition | html %]</td>
140                                             <td>[% breeding_loo.isbn | html %]</td>
141                                             <td>[% breeding_loo.lccn | html %]</td>
142                                             [% IF Koha.Preference('AdditionalFieldsInZ3950ResultSearch') != '' %]
143                                                 <td>
144                                                    <dl>
145                                                       [% FOREACH addnumberfield IN breeding_loo.addnumberfields %]
146                                                         [% FOREACH string IN breeding_loo.$addnumberfield %]
147                                                             <dt>[% addnumberfield | html %]:</dt>
148                                                             <dd>[% string | html %]</dd>
149                                                         [% END %]
150                                                       [% END %]
151                                                    </dl>
152                                                 </td>
153                                             [% END %]
154                                             <td>
155                                                 <div class="dropdown">
156                                                     <a class="btn btn-default btn-xs dropdown-toggle" id="cataloguesearchactions[% breeding_loo.breedingid | html %]" role="button" data-toggle="dropdown" href="#">
157                                                       Actions <b class="caret"></b>
158                                                     </a>
159                                                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="cataloguesearchactions[% breeding_loo.breedingid | html %]">
160                                                         <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid | uri %]" title="MARC" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
161                                                         <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid | uri %]" title="Card" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
162                                                         <li><a href="#" class="import_record" data-breedingid="[% breeding_loo.breedingid | html %]" data-biblionumber="[% breeding_loo.biblionumber | html %]" data-frameworkcode="[% frameworkcode | uri %]"><i class="fa fa-download"></i> Import</a></li>
163                                                     </ul>
164                                                 </div>
165                                             </td>
166                                         </tr>
167                                     [% END %]
168                                 [% END %]
169                             </tbody>
170                         </table> <!-- /#resultst -->
171
172                         <div id="dataPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
173                             <div class="modal-dialog">
174                                 <div class="modal-content">
175                                     <div class="modal-header">
176                                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
177                                         <h3 id="dataPreviewLabel">Preview</h3>
178                                     </div>
179                                     <div class="modal-body">
180                                         <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
181                                     </div>
182                                 </div>
183                             </div>
184                         </div>
185
186                         <form method="post" action="z3950_search.pl" id="page_form" name="page_form" class="checkboxed">
187                             <input type="hidden" name="op" id="op" value="do_search" />
188                             <input type="hidden" name="current_page" id="current_page" value="[% current_page | html %]" />
189                             <input type="hidden" id="title"  name="title" value="[% title | html %]" />
190                             <input type="hidden" id="isbn" name="isbn" value="[% isbn | html %]" />
191                             <input type="hidden" id="lccall" name="lccall" value="[% lccall | html %]" />
192                             <input type="hidden" id="controlnumber" name="controlnumber" value="[% controlnumber | html %]" />
193                             <input type="hidden" id="srchany" name="srchany" value="[% srchany | html %]" />
194                             <input type="hidden" id="author" name="author" value="[% author | html %]" />
195                             <input type="hidden" id="subject" name="subject" value="[% subject | html %]" />
196                             <input type="hidden" id="dewey" name="dewey" value="[% dewey | html %]" />
197                             <input type="hidden" id="stdid" name="stdid" value="[% stdid | html %]" />
198                             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]" />
199                             <input type="hidden" name="frameworkcode" value="[% frameworkcode | html %]" />
200
201                             [% FOREACH server IN servers %]
202                                 <input type="hidden" name="id" id="z3950_[% server.id | html %]" value="[% server.id | html %]" />
203                             [% END %]
204
205                             [% IF ( show_prevbutton ) %]
206                                 <input type="button" name="changepage_prev" value="Previous page" data-currentpage="[% current_page | html %]" />
207                             [% END %]
208                             <span id="result_pagenumbers">Showing page [% current_page | html %] of [% total_pages | html %]</span>
209                             [% IF ( show_nextbutton ) %]
210                                 <input type="button" name="changepage_next" value="Next page" data-currentpage="[% current_page | html %]" />
211                             [% END %]
212                             <br />Go to page : <input id="goto_page" name="goto_page" value="[% current_page | html %]" size="4" type="text" /><input type="submit" name="changepage_goto" value="Go" />
213                         </form> <!-- /#page_form -->
214
215                     [% ELSE %]
216                         <div class="dialog message">Nothing found.</div>
217                     [% END  # /IF breeding_loop %]
218
219                     <form method="get" action="/cgi-bin/koha/cataloguing/z3950_search.pl">
220                         <p>
221                             <input type="hidden" name="biblionumber" value="[% biblionumber | html %]"/>
222                             <input type="hidden" name="frameworkcode" value="[% frameworkcode | html %]"/>
223                             <input type="submit" value="Try another search"/>
224                         </p>
225                     </form>
226                 </div> <!-- /.col-xs-12 -->
227             </div> <!-- /.row -->
228         [% END # /IF opsearch %]
229
230         [% IF ( numberpending ) %]
231             <h3 align="center">Still [% numberpending | html %] servers to search</h3>
232         [% END %]
233
234 [% MACRO jsinclude BLOCK %]
235     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
236     [% Asset.js("js/z3950_search.js") | $raw %]
237     [% INCLUDE 'datatables.inc' %]
238     [% INCLUDE 'columns_settings.inc' %]
239     <script>
240         $(document).ready(function(){
241
242             $(".dropdown").on("hidden.bs.dropdown", function(){
243                 // Reset menu styles so that a click on the
244                 // original dropdown button toggle works correctly
245                 $(".dropdown").css("position","absolute");
246                 $(".dropdown-menu").css({
247                     "top" : "100%",
248                     "left" : "auto",
249                     "right" : 0
250                 });
251             });
252
253             var columns_settings = [% ColumnsSettings.GetColumns( 'cataloguing', 'z3950_search', 'resultst', 'json' ) | $raw %];
254             var thetable = KohaTable("resultst", {
255                 "aoColumnDefs": [
256                     { "targets": [ "NoSort" ],"sortable": false,"searchable": false },
257                     { "aTargets": [ 1 ], "sType": "nsb-nse" },
258                 ],
259                 "aaSorting": [[ 1, "asc" ]],
260                 "bPaginate": false
261             }, columns_settings );
262
263
264             /* Display actions menu anywhere the table is clicked */
265             $("td").click(function(event){
266                 var tgt = $(event.target);
267                 var row = $(this).parent();
268                 var rowid = row.attr("id");
269                 $("tr").removeClass("highlighted-row");
270                 row.addClass("highlighted-row");
271                 $(".dropdown").removeClass("open");
272                 if(tgt.is("a")||tgt.is(":nth-child(8)")){
273                     // Don't show inline links for cells containing links of their own.
274                 } else {
275                     event.stopPropagation();
276                     var dropdown = $(".dropdown", row);
277                     dropdown.addClass("open");
278                     var position = $(this).offset();
279                     var top = position.top + 5;
280                     var left = position.left + 5;
281                     dropdown.css("position","unset");
282                     $(".dropdown-menu", row).css({
283                         "top" : top,
284                         "left" : left,
285                         "right" : "unset"
286                     });
287                }
288             });
289         });
290
291         function columnsInit(){
292             $(".dataTables_info").text( $("#result_pagenumbers").text() );
293             $("#result_pagenumbers").hide();
294         }
295     </script>
296     [% INCLUDE 'z3950_search.inc' %]
297 [% END %]
298
299 [% INCLUDE 'intranet-bottom.inc' popup_window=1 %]