Revert bug 13618 - "Prevent XSS in the Staff Client and the OPAC" due to performance...
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / z3950_search.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Z39.50/SRU search results</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
5 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
6 [% INCLUDE 'datatables.inc' %]
7 <script type="text/javascript">
8 //<![CDATA[
9 function Import(GetThisOne,biblionumber) {
10     opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+biblionumber+"&z3950=1&frameworkcode=[% frameworkcode %]&breedingid="+GetThisOne;
11     window.close();
12     return false;
13 }
14
15 function closemenu(){
16     $(".linktools").hide();
17     $("tr").removeClass("selected");
18 }
19
20 $(document).ready(function(){
21     $("#CheckAll").click(function(){
22         $(".checkboxed").checkCheckboxes();
23         return false;
24     });
25     $("#CheckNone").click(function(){
26         $(".checkboxed").unCheckCheckboxes();
27         return false;
28     });
29     $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
30         "sDom": 't',
31         "aoColumnDefs": [
32             { "aTargets": [ -1,-2,-3 ], "bSortable": false, "bSearchable": false },
33             { "aTargets": [ 1 ], "sType": "nsb-nse" },
34         ],
35         "aaSorting": [[ 1, "asc" ]],
36         "bPaginate": false
37     }));
38         /* Inline edit/delete links */
39         $("td").click(function(event){
40             var $tgt = $(event.target);
41             var row = $(this).parent();
42             $(".linktools").hide();
43             $("tr").removeClass("selected");
44             row.addClass("selected");
45             if($tgt.is("a")||$tgt.is(":nth-child(8)")||$tgt.is(":nth-child(9)")||$tgt.is(":nth-child(10)")){
46                 //Don't show inline links for cells containing links of their own.
47             } else {
48                 var position = $(this).offset();
49                 var top = position.top+5;
50                 var left = position.left+5;
51                 $(".linktools",row).show().css("position","absolute").css("top",top).css("left",left);
52             }
53         });
54     $("form[name='f']").submit(function(){
55         if ($('input[type=checkbox]').filter(':checked').length == 0) {
56             alert(_("Please choose at least one external target"));
57             return false;
58         } else
59             return true;
60     });
61     $("#resetZ3950Search").click(function(e) {
62         e.preventDefault();
63        $("form[name='f']").find("input[type=text]").val("");
64     });
65     $(".previewData").on("click", function(e){
66         e.preventDefault();
67         var ltitle = $(this).text();
68         var page = $(this).attr("href");
69         $("#dataPreviewLabel").text(ltitle);
70         $("#dataPreview .modal-body").load(page + " div");
71         $('#dataPreview').modal({show:true});
72     });
73     $("#dataPreview").on("hidden", function(){
74         $("#dataPreviewLabel").html("");
75         $("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
76     });
77
78 });
79
80 [% IF ( total_pages ) %]
81 function validate_goto_page(){
82     var page = $('#goto_page').val();
83     if(isNaN(page)) {
84         alert(_("The page entered is not a number."));
85         return false;
86     }
87     else if(page < 1 || page > [% total_pages %] ) {
88         alert(_("The page should be a number between 1 and %s.").format([% total_pages %]));
89         return false;
90     }
91     else {
92         return true;
93     }
94 }
95 [% END %]
96
97 //]]>
98 </script>
99 <style type="text/css">
100 .linktools { background-color:#FFF;border-top:1px solid #DDD; border-left: 1px solid #DDD; border-right: 1px solid #666; border-bottom:1px solid #666;display: none; white-space: nowrap;}
101 .linktools a { font-size : 85%; text-decoration:none; padding:.3em;;background-color:#FFF; display:block;float:left;border-right:1px solid #DDD;}
102 .linktools a:hover { background-color:#EEE;color:#CC3300;border-right:1px solid #CCC;}
103 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : transparent; }
104 #dataPreview { width : 90%; margin-left : -45%; top: 5%; } .modal-body { max-height: 380px; } .modal-header { padding: 0 14px; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }
105 </style>
106       [% IF ( opsearch ) %]
107    <style type="text/css">
108            #custom-doc { width:53em;*width:51.72em;min-width:689px; margin:auto; text-align:left; }
109    </style>
110 </head>
111 <body id="cat_z3950_search" class="cat">
112
113 <div id="custom-doc" class="yui-t7">
114 [% ELSE %]
115 </head>
116 <body id="cat_z3950_search" class="cat" style="padding:.5em;">
117 <div>
118 [% END %]
119       <div id="bd">
120           [% IF ( opsearch ) %]
121 <h2>Z39.50/SRU search</h2>
122     <form method="post" action="z3950_search.pl" name="f" class="checkboxed">
123     <input type="hidden" name="op" id="op" value="do_search" />
124         <div class="yui-g">
125     <div class="yui-u first">
126             <fieldset class="rows"> 
127         <ol>
128         <li><label for="isbn">ISBN: </label> <input type="text" id="isbn" name="isbn" value="[% isbn %]" /></li>
129         <li><label for="issn">ISSN: </label> <input type="text" id="issn" name="issn" value="[% issn %]" /></li>
130         <li><label for="title">Title: </label> <input type="text" id="title"  name="title" value="[% title |html %]" /></li>
131         <li><label for="author">Author: </label> <input type="text" id="author" name="author" value="[% author %]" /></li>
132         <li><label for="subject">Subject heading: </label> <input type="text" id="subject" name="subject" value="" /></li>
133         <li><label for="srchany">Keyword (any): </label> <input type="text" id="srchany" name="srchany" value="" /></li>
134         <li><label for="lccall">LC call number: </label> <input type="text" id="lccall" name="lccall" value="" /></li>
135         <li><label for="controlnumber">Control no.: </label> <input type="text" id="controlnumber" name="controlnumber" value="" /></li>
136         <li><label for="dewey">Dewey: </label> <input type="text" id="dewey" name="dewey" value="" /></li>
137         <li><label for="stdid">Standard ID: </label> <input type="text" id="stdid" name="stdid" value="" /></li>
138         </ol>
139     <p><a id="resetZ3950Search" href="#">Clear search form</a></p>
140     <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
141     <input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
142     </div>
143     <div class="yui-g">
144       <h2>Search targets <span style="display: inline; font-size: 70%; padding-left: 1em;"><span class="checkall"><a id="CheckAll" href="#">Select all</a></span><span class="clearall"><a id="CheckNone" href="#">Clear all</a></span></span></h2>
145       <div id="z3950_search_targets">
146     [% FOREACH serverloo IN serverloop %]
147         <p> 
148             [% IF ( serverloo.checked ) %]
149                 <input type="checkbox" name="id" id="z3950_[% serverloo.id %]" value="[% serverloo.id %]" checked="checked" />
150             [% ELSE %]
151                 <input type="checkbox" name="id" id="z3950_[% serverloo.id %]" value="[% serverloo.id %]" />
152             [% END %]
153             <label for="z3950_[% serverloo.id %]">[% serverloo.servername %]</label>
154
155         </p>
156     [% END %]
157       </div>
158     </div>
159     <fieldset class="action"><input type="submit"  class="submit" value="Search" onclick="cursor :'wait'"/> <a class="cancel close" href="#">Cancel</a></fieldset>
160     </form>
161
162
163 [% ELSE %]
164     <h2>Results</h2>
165     <p>You searched for:
166         [% IF ( title ) %]<em>Title: </em><span class=term>[% title %]</span> [% END %]
167         [% IF ( author ) %]<em>Author: </em><span class=term>[% author %]</span> [% END %]
168         [% IF ( isbn ) %]<em>ISBN: </em><span class=term>[% isbn %]</span> [% END %]
169         [% IF ( issn ) %]<em>ISSN: </em><span class=term>[% issn %]</span> [% END %]
170         [% IF ( lccall ) %]<em>LC call number: </em><span class=term>[% lccall %]</span> [% END %]
171         [% IF ( subject ) %]<em>Subject heading: </em><span class=term>[% subject %]</span> [% END %]
172         [% IF ( controlnumber ) %]<em>Control no: </em><span class=term>[% controlnumber %]</span> [% END %]
173         [% IF ( dewey ) %]<em>Dewey: </em><span class=term>[% dewey %]</span> [%END %]
174         [% IF ( srchany ) %]<em>Raw (any): </em><span class=term>[% srchany %]</span> [% END %]
175         [% IF ( stdid ) %]<em>Standard ID: </em><span class=term>[% stdid %]</span> [% END %]
176     </p>
177     [% IF ( errconn ) %]
178             <div class="dialog alert">
179                 <ul>
180                 [% FOREACH errcon IN errconn %]
181                     [% IF ( errcon.error == '10000' ) %]<li>Connection failed to [% errcon.server %]</li>
182                     [% ELSIF ( errcon.error == '10007' ) %]<li>Connection timeout to [% errcon.server %]</li>
183                     [% ELSIF ( errcon.error == 'xslt_err' ) %]<li>[% errcon.server %]: Warning: XSLT error on search result [% errcon.seq %]</li>
184                     [% ELSE %]<li>[% errcon.server %] record [% errcon.seq %]: [% errcon.error %]</li>
185                     [% END %]
186                 [% END %]
187                 </ul>
188             </div>
189     [% END %]
190
191     [% IF ( breeding_loop ) %]
192     <table id="resultst">
193 <thead>    <tr>
194         <th>Server</th>
195         <th>Title</th>
196         <th>Author</th>
197         <th>Date</th>
198         <th>Edition</th>
199         <th>ISBN</th>
200         <th>LCCN</th>
201         <th>MARC</th>
202         <th>Card</th>
203                 <th>&nbsp;</th>
204     </tr></thead>
205     <tbody>[% FOREACH breeding_loo IN breeding_loop %]
206         [% IF ( breeding_loo.breedingid ) %]
207
208             <tr id="row[% breeding_loo.breedingid %]">
209             <td>[% breeding_loo.server %] <div class="linktools"><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" class="previewData">Preview MARC</a> <a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid %]" class="previewData">Preview card</a> <a href="#" onclick="Import([% breeding_loo.breedingid %],[% breeding_loo.biblionumber %]); return false">Import</a><a href="#" onclick="closemenu();return false;" title="Close this menu"> X </a></div> </td>
210             <td>[% breeding_loo.title |html %]</td>
211             <td>[% breeding_loo.author %]</td>
212             <td>[% breeding_loo.date %]</td>
213             <td>[% breeding_loo.edition %]</td>
214             <td>[% breeding_loo.isbn %]</td>
215             <td>[% breeding_loo.lccn %]</td>
216             <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" class="previewData">MARC</a></td>
217             <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid %]" class="previewData">Card</a></td>
218             <td><a href="#" onclick="Import([% breeding_loo.breedingid %],[% breeding_loo.biblionumber %]); return false">Import</a></td> 
219         </tr>
220         [% END %]
221     [% END %]</tbody>
222 </table>
223
224 <div id="dataPreview" class="modal hide" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
225     <div class="modal-header">
226         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
227         <h3 id="dataPreviewLabel">Preview</h3>
228     </div>
229     <div class="modal-body">
230         <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
231     </div>
232
233 </div>
234
235
236     <form method="post" action="z3950_search.pl" id="page_form" name="page_form" class="checkboxed">
237         <input type="hidden" name="op" id="op" value="do_search" />
238         <input type="hidden" name="current_page" id="current_page" value="[% current_page %]" />
239         <input type="hidden" id="title"  name="title" value="[% title %]" />
240         <input type="hidden" id="isbn" name="isbn" value="[% isbn %]" />
241         <input type="hidden" id="lccall" name="lccall" value="[% lccall %]" />
242         <input type="hidden" id="controlnumber" name="controlnumber" value="[% controlnumber %]" />
243         <input type="hidden" id="srchany" name="srchany" value="[% srchany %]" />
244         <input type="hidden" id="author" name="author" value="[% author %]" />
245         <input type="hidden" id="subject" name="subject" value="[% subject %]" />
246         <input type="hidden" id="dewey" name="dewey" value="[% dewey %]" />
247         <input type="hidden" id="stdid" name="stdid" value="[% stdid %]" />
248         <input type="hidden" name="biblionumber" value="[% biblionumber %]" />
249         <input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
250
251         [% FOREACH server IN servers %]
252         <input type="hidden" name="id" id="z3950_[% server.id %]" value="[% server.id %]" />
253         [% END %]
254
255         [% IF ( show_prevbutton ) %]
256             <input type="button" name="changepage_prev" value="Previous Page" onclick="$('#current_page').val([% current_page %]-1);$('#page_form').submit();" />
257         [% END %]
258         Page [% current_page %] / [% total_pages %]
259         [% IF ( show_nextbutton ) %]
260             <input type="button" name="changepage_next" value="Next Page" onclick="$('#current_page').val([% current_page %]+1);$('#page_form').submit();" />
261         [% END %]
262         <br />Go to page : <input id="goto_page" name="goto_page" value="[% current_page %]" size="4" /><input type="submit" name="changepage_goto" onclick="return validate_goto_page();" value="Go" />
263     </form>
264
265     [% ELSE %]
266         <div class="dialog message">Nothing found.</div>
267     [% END %]
268 <p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_search.pl"><input type="hidden" name="biblionumber" value="[% biblionumber %]"/><input type="hidden" name="frameworkcode" value="[% frameworkcode %]"/><input type="submit" value="Try another search"/></form></p>
269
270 [% END %]
271
272         </div>
273 </div>
274 [% IF ( numberpending ) %]<h3 align="center">Still [% numberpending %] servers to search</h3>[% END %]
275
276 </body>
277 </html>
278