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