Bug 13218: usability enhancements for z39.50 searches
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / z3950_auth_search.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Z39.50 search results</title>
3 [% INCLUDE 'greybox.inc' %]
4 [% INCLUDE 'doc-head-close.inc' %]
5 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
6 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
7 [% INCLUDE 'datatables.inc' %]
8 <script type="text/javascript">
9 //<![CDATA[
10 function Import(Breeding,AuthType) {
11     opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType;
12     window.close();
13     return false;
14 }
15
16 function closemenu(){
17     $(".linktools").hide();
18     $("tr").removeClass("selected");
19 }
20
21 $(document).ready(function(){
22     $("#CheckAll").click(function(){
23         $(".checkboxed").checkCheckboxes();
24         return false;
25     });
26     $("#CheckNone").click(function(){
27         $(".checkboxed").unCheckCheckboxes();
28         return false;
29     });
30     $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
31         "sDom": 't',
32         "aoColumnDefs": [
33             { "aTargets": [ -1,-2,-3 ], "bSortable": false, "bSearchable": false },
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(4)")||$tgt.is(":nth-child(5)")){
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 Z39.50 target"));
57             return false;
58         } else
59             return true;
60     });
61 });
62
63 [% IF ( total_pages ) %]
64 function validate_goto_page(){
65     var page = $('#goto_page').val();
66     if(isNaN(page)) {
67         alert(_("The page entered is not a number."));
68         return false;
69     }
70     else if(page < 1 || page > [% total_pages %] ) {
71         alert(_("The page should be a number between 1 and %s.").format([% total_pages %]));
72         return false;
73     }
74     else {
75         return true;
76     }
77 }
78 [% END %]
79
80 //]]>
81 </script>
82 <style type="text/css">
83 .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;}
84 .linktools a { font-size : 85%; text-decoration:none; padding:.3em;;background-color:#FFF; display:block;float:left;border-right:1px solid #DDD;}
85 .linktools a:hover { background-color:#EEE;color:#CC3300;border-right:1px solid #CCC;}
86 tr.selected { background-color : #FFFFCC; } tr.selected td { background-color : transparent; }
87 </style>
88
89     [% IF ( opsearch ) %]
90         <style type="text/css">
91         #custom-doc { width:53em;*width:51.72em;min-width:689px; margin:auto; text-align:left; }
92         </style>
93         </head>
94         <body id="cat_z3950_auth_search" class="cat">
95         <div id="custom-doc" class="yui-t7">
96     [% ELSE %]
97         </head>
98         <body style="padding:.5em;">
99         <div>
100     [% END %]
101     <div id="bd">
102     [% IF ( opsearch ) %]
103         <h2>Z39.50 Authority search points</h2>
104         <form method="post" action="z3950_auth_search.pl" name="f" class="checkboxed">
105         <input type="hidden" name="op" id="op" value="do_search" />
106         <div class="yui-g">
107             <div class="yui-u first">
108                 <fieldset class="rows">
109                 <ol>
110                     <li><label for="srchany">Keyword (any): </label> <input type="text" id="srchany" name="srchany" value="" /></li>
111                     <li><label for="nameany">Name (any): </label> <input type="text" id="nameany" name="nameany" value="" /></li>
112                     <li><label for="authorany">Author (any): </label> <input type="text" id="authorany" name="authorany" value="" /></li>
113                     <li><label for="authorpersonal">Author (personal): </label> <input type="text" id="authorpersonal" name="authorpersonal" value="" /></li>
114                     <li><label for="authorcorp">Author (corporate): </label> <input type="text" id="authorcorp" name="authorcorp" value="" /></li>
115                     <li><label for="authormeetingcon">Author (meeting/conference): </label> <input type="text" id="authormeetingcon" name="authormeetingcon" value="" /></li>
116                     <li><label for="subject">Subject heading: </label> <input type="text" id="subject" name="subject" value="" /></li>
117                     <li><label for="subjectsubdiv">Subject sub-division: </label> <input type="text" id="subjectsubdiv" name="subjectsubdiv" value="" /></li>
118                     <li><label for="title">Title (any): </label> <input type="text" id="title"  name="title" value="[% title |html %]" /></li>
119                     <li><label for="uniformtitle">Title (uniform): </label> <input type="text" id="uniformtitle"  name="uniformtitle" value="[% uniformtitle |html %]" /></li>
120                 </ol>
121                 </fieldset>
122             </div>
123         <div class="yui-g">
124             <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>
125             [% FOREACH serverloo IN serverloop %]
126                 <p>
127                 [% IF ( serverloo.checked ) %]
128                     <input type="checkbox" name="id" id="z3950_[% serverloo.id %]" value="[% serverloo.id %]" checked="checked" />
129                 [% ELSE %]
130                     <input type="checkbox" name="id" id="z3950_[% serverloo.id %]" value="[% serverloo.id %]" />
131                 [% END %]
132                 <label for="z3950_[% serverloo.id %]">[% serverloo.servername %]</label>
133                 </p>
134             [% END %]
135         </div>
136         <fieldset class="action"><input type="submit"  class="submit" value="Search" onclick="cursor :'wait'"/> <a class="cancel close" href="#">Cancel</a></fieldset>
137         </form>
138
139
140 [% ELSE %]
141     <h2>Results for Authority Records</h2>
142     [% IF ( breeding_loop ) %]
143     <table id="resultst">
144 <thead>    <tr>
145         <th>Server</th>
146         <th>Heading</th>
147         <th>Authority Type</th>
148         <th>MARC</th>
149         <!-- <th>Card</th> -->
150         <th>&nbsp;</th>
151     </tr></thead>
152     <tbody>[% FOREACH breeding_loo IN breeding_loop %]
153         [% IF ( breeding_loo.breedingid ) %]
154         <tr id="row[% breeding_loo.breedingid %]">
155             <td>[% breeding_loo.server %] <div class="linktools"><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" rel="gb_page_center[600,500]">Preview MARC</a> <a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]'); return false">Import</a><a href="#" onclick="closemenu();return false;" title="Close this menu"> X </a></div> </td>
156             <td>[% breeding_loo.heading %]</td>
157             <td>[% breeding_loo.heading_code %]</td>
158             <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid %]" title="MARC" rel="gb_page_center[600,500]">MARC</a></td>
159             <!-- <td><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&amp;importid=[% breeding_loo.breedingid %]" title="MARC" rel="gb_page_center[600,500]">Card</a></td> -->
160             <td><a href="#" onclick="Import([% breeding_loo.breedingid %],'[% breeding_loo.heading_code %]'); return false">Import</a></td>
161         </tr>
162         [% END %]
163     [% END %]</tbody>
164 </table>
165
166     <form method="post" action="z3950_auth_search.pl" id="page_form" name="page_form" class="checkboxed">
167         <input type="hidden" name="op" id="op" value="do_search" />
168         <input type="hidden" name="current_page" id="current_page" value="[% current_page %]" />
169         <input type="hidden" id="nameany"  name="nameany" value="[% nameany %]" />
170         <input type="hidden" id="authorany"  name="authorany" value="[% authorany %]" />
171         <input type="hidden" id="authorcorp"  name="authorcorp" value="[% authorcorp %]" />
172         <input type="hidden" id="authorpersonal"  name="authorpersonal" value="[% authorpersonal %]" />
173         <input type="hidden" id="authormeetingcon"  name="authormeetingcon" value="[% authormeetingcon %]" />
174         <input type="hidden" id="title"  name="title" value="[% title %]" />
175         <input type="hidden" id="uniformtitle"  name="uniformtitle" value="[% uniformtitle %]" />
176         <input type="hidden" id="subject" name="subject" value="[% subject %]" />
177         <input type="hidden" id="subjectsubdiv" name="subjectsubdiv" value="[% subjectsubdiv %]" />
178         <input type="hidden" id="heading"  name="heading" value="[% heading %]" />
179         <input type="hidden" id="srchany" name="srchany" value="[% srchany %]" />
180
181         [% FOREACH server IN servers %]
182         <input type="hidden" name="id" id="z3950_[% server.id %]" value="[% server.id %]" />
183         [% END %]
184
185         [% IF ( show_prevbutton ) %]
186             <input type="button" name="changepage_prev" value="Previous Page" onclick="$('#current_page').val([% current_page %]-1);$('#page_form').submit();" />
187         [% END %]
188         Page [% current_page %] / [% total_pages %]
189         [% IF ( show_nextbutton ) %]
190             <input type="button" name="changepage_next" value="Next Page" onclick="$('#current_page').val([% current_page %]+1);$('#page_form').submit();" />
191         [% END %]
192         <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" />
193     </form>
194
195 <p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="submit" value="Try Another Search"/></form></p>
196     [% ELSE %]
197         [% IF ( errconn ) %]
198             <div class="dialog alert">
199                 <ul>
200                 [% FOREACH errcon IN errconn %]
201                     [% IF ( errcon.error == '10000' ) %]<li>Connection failed to [% errcon.server %]</li>
202                     [% ELSIF ( errcon.error == '10007' ) %]<li>Connection timeout to [% errcon.server %]</li>[% END %]
203                 [% END %]
204                 </ul>
205             </div>
206          [% END %]
207    <div class="dialog message">Nothing found.</div>
208     <p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="submit" value="Try Another Search"/></form></p>
209     [% END %]
210
211 [% END %]
212 </div>
213 </div>
214
215 [% IF ( numberpending ) %]<h3 align="center">Still [% numberpending %] servers to search</h3>[% END %]
216
217 </body>
218 </html>