Bug 22015: Move DataTables CSS to global include
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / z3950_auth_search.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 [% IF ( opsearch ) %]
6     <title>Koha &rsaquo; Z39.50 authority search points</title>
7 [% ELSE %]
8     <title>Koha &rsaquo; Z39.50 authority search results</title>
9     [% END %]
10 [% INCLUDE 'doc-head-close.inc' %]
11 <style>
12     #marcPreview { width : 90%; top: 5%; } .modal-body { max-height: 380px; } .modal-header { padding: 0 14px; } @media (max-width: 767px) { #marcPreview { margin: 0; width : auto; } }
13 </style>
14
15 <body id="cat_z3950_auth_search" class="cat">
16     <div class="container-fluid">
17
18     [% IF ( opsearch ) %]
19         <h2>Z39.50 authority search points</h2>
20         <form method="post" action="z3950_auth_search.pl" name="f" class="checkboxed">
21         <input type="hidden" name="op" id="op" value="do_search" />
22         <input type="hidden" name="authid" value="[% authid | html %]" />
23             <div class="row">
24             <div class="col-xs-6">
25                 <fieldset class="rows">
26                 <ol>
27                     <li><label for="srchany">Keyword (any): </label> <input type="text" id="srchany" name="srchany" value="" /></li>
28                     <li><label for="controlnumber">Control number: </label> <input type="text" id="controlnumber" name="controlnumber" value="" /></li>
29                     <li><label for="nameany">Name (any): </label> <input type="text" id="nameany" name="nameany" value="" /></li>
30                     <li><label for="authorany">Author (any): </label> <input type="text" id="authorany" name="authorany" value="" /></li>
31                     <li><label for="authorpersonal">Author (personal): </label> <input type="text" id="authorpersonal" name="authorpersonal" value="[% authorpersonal | html %]" /></li>
32                     <li><label for="authorcorp">Author (corporate): </label> <input type="text" id="authorcorp" name="authorcorp" value="[% authorcorp | html %]" /></li>
33                     <li><label for="authormeetingcon">Author (meeting / conference): </label> <input type="text" id="authormeetingcon" name="authormeetingcon" value="[% authormeetingcon | html %]" /></li>
34                 </ol>
35                 </fieldset>
36             </div>
37             <div class="col-xs-6">
38                 <div class="row">
39                     <fieldset class="rows">
40                     <ol>
41                         <li><label for="subject">Subject heading: </label> <input type="text" id="subject" name="subject" value="" /></li>
42                         <li><label for="subjectsubdiv">Subject sub-division: </label> <input type="text" id="subjectsubdiv" name="subjectsubdiv" value="" /></li>
43                         <li><label for="title">Title (any): </label> <input type="text" id="title"  name="title" value="[% title | html %]" /></li>
44                         <li><label for="uniformtitle">Title (uniform): </label> <input type="text" id="uniformtitle"  name="uniformtitle" value="[% uniformtitle | html %]" /></li>
45                         <li><a id="resetZ3950Search" href="#"><i class="fa fa-trash"></i> Clear search form</a></li>
46                     </ol>
47                     </fieldset>
48                 </div>
49
50                 <div class="row">
51                     <h2>Search targets</h2>
52                     <div id="z3950_search_targets_auth">
53                         <span class="z3950checks"><span class="checkall"><a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a></span> | <span class="clearall"><a id="CheckNone" href="#"><i class="fa fa-remove"></i> Clear all</a></span></span>
54                     [% FOREACH serverloo IN serverloop %]
55                         <p>
56                         [% IF ( serverloo.checked ) %]
57                             <input type="checkbox" name="id" id="z3950_[% serverloo.id | html %]" value="[% serverloo.id | html %]" checked="checked" />
58                         [% ELSE %]
59                             <input type="checkbox" name="id" id="z3950_[% serverloo.id | html %]" value="[% serverloo.id | html %]" />
60                         [% END %]
61                         <label for="z3950_[% serverloo.id | html %]">[% serverloo.servername | html %]</label>
62                         </p>
63                     [% END %]
64                     </div>
65                 </div>
66             </div>
67             </div>
68             <nav class="navbar navbar-default navbar-fixed-bottom">
69                 <div class="container-fluid">
70                      <fieldset class="action"><input type="submit"  class="submit" value="Search" /> <a class="cancel close" href="#">Cancel</a></fieldset>
71                 </div>
72             </nav>
73         </form>
74 [% ELSE %]
75     <h2>Results for authority records</h2>
76     [% IF ( breeding_loop ) %]
77     <table id="resultst">
78 <thead>    <tr>
79         <th>Server</th>
80         <th>Heading</th>
81         <th>Authority Type</th>
82         <th>Actions</th>
83     </tr></thead>
84     <tbody>[% FOREACH breeding_loo IN breeding_loop %]
85         [% IF ( breeding_loo.breedingid ) %]
86         <tr id="row[% breeding_loo.breedingid | html %]">
87             <td>[% breeding_loo.server | html %]</td>
88             <td>[% breeding_loo.heading | html %]</td>
89             <td>[% breeding_loo.heading_code | html %]</td>
90             <td class="actions">
91                 <div class="dropdown">
92                     <a class="btn btn-default btn-xs dropdown-toggle" id="cataloguesearchactions[% breeding_loo.breedingid | html %]" role="button" data-toggle="dropdown" href="#">
93                       Actions <b class="caret"></b>
94                     </a>
95                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="cataloguesearchactions[% breeding_loo.breedingid | html %]">
96                         <li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.breedingid | uri %]" class="previewMARC"><i class="fa fa-eye"></i> MARC preview</a></li>
97                         <li><a href="#" class="import_record" data-breedingid="[% breeding_loo.breedingid | html %]" data-heading_code="[% breeding_loo.heading_code | html %]" data-authid="[% breeding_loo.authid | html %]"><i class="fa fa-download"></i> Import</a></li>
98                     </ul>
99                 </div>
100             </td>
101         </tr>
102         [% END %]
103     [% END %]</tbody>
104 </table>
105
106     <div id="marcPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
107         <div class="modal-dialog">
108         <div class="modal-content">
109         <div class="modal-header">
110             <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
111             <h3 id="marcPreviewLabel">MARC preview</h3>
112         </div>
113         <div class="modal-body">
114             <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
115         </div>
116         </div>
117         </div>
118     </div>
119
120     <form method="post" action="z3950_auth_search.pl" id="page_form" name="page_form" class="checkboxed">
121         <input type="hidden" name="op" id="op" value="do_search" />
122         <input type="hidden" name="current_page" id="current_page" value="[% current_page | html %]" />
123         <input type="hidden" id="nameany"  name="nameany" value="[% nameany | html %]" />
124         <input type="hidden" id="authorany"  name="authorany" value="[% authorany | html %]" />
125         <input type="hidden" id="authorcorp"  name="authorcorp" value="[% authorcorp | html %]" />
126         <input type="hidden" id="authorpersonal"  name="authorpersonal" value="[% authorpersonal | html %]" />
127         <input type="hidden" id="authormeetingcon"  name="authormeetingcon" value="[% authormeetingcon | html %]" />
128         <input type="hidden" id="title"  name="title" value="[% title | html %]" />
129         <input type="hidden" id="uniformtitle"  name="uniformtitle" value="[% uniformtitle | html %]" />
130         <input type="hidden" id="subject" name="subject" value="[% subject | html %]" />
131         <input type="hidden" id="subjectsubdiv" name="subjectsubdiv" value="[% subjectsubdiv | html %]" />
132         <input type="hidden" id="heading"  name="heading" value="[% heading | html %]" />
133         <input type="hidden" id="srchany" name="srchany" value="[% srchany | html %]" />
134         <input type="hidden" name="authid" value="[% authid | html %]" />
135
136         [% FOREACH server IN servers %]
137         <input type="hidden" name="id" id="z3950_[% server.id | html %]" value="[% server.id | html %]" />
138         [% END %]
139
140         [% IF ( show_prevbutton ) %]
141             <input type="button" name="changepage_prev" value="Previous page" data-currentpage="[% current_page | html %]" />
142         [% END %]
143         Page [% current_page | html %] / [% total_pages | html %]
144         [% IF ( show_nextbutton ) %]
145             <input type="button" name="changepage_next" value="Next page" data-currentpage="[% current_page | html %]" />
146         [% END %]
147         <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" />
148     </form>
149
150 <p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="hidden" name="authid" value="[% authid | html %]" /><input type="submit" value="Try another search"/></form></p>
151     [% ELSE %]
152         [% IF ( errconn ) %]
153             <div class="dialog alert">
154                 <ul>
155                 [% FOREACH errcon IN errconn %]
156                     [% IF ( errcon.error == '10000' ) %]<li>Connection failed to [% errcon.server | html %]</li>
157                     [% ELSIF ( errcon.error == '10007' ) %]<li>Connection timeout to [% errcon.server | html %]</li>[% END %]
158                 [% END %]
159                 </ul>
160             </div>
161          [% END %]
162    <div class="dialog message">Nothing found.</div>
163     <p><form method="get" action="/cgi-bin/koha/cataloguing/z3950_auth_search.pl"><input type="hidden" name="authid" value="[% authid | html %]" /><input type="submit" value="Try another search"/></form></p>
164     [% END %]
165
166 [% END %]
167
168 [% IF ( numberpending ) %]<h3 align="center">Still [% numberpending | html %] servers to search</h3>[% END %]
169
170 [% MACRO jsinclude BLOCK %]
171     [% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
172     [% INCLUDE 'datatables.inc' %]
173     <script type="text/javascript">
174         $(document).ready(function(){
175
176             $(".dropdown").on("hidden.bs.dropdown", function(){
177                 // Reset menu styles so that a click on the
178                 // original dropdown button toggle works correctly
179                 $(".dropdown").css("position","absolute");
180                 $(".dropdown-menu").css({
181                     "top" : "100%",
182                     "left" : "auto",
183                     "right" : 0
184                 });
185             });
186
187             $("#resultst").dataTable($.extend(true, {}, dataTablesDefaults, {
188                 "sDom": 't',
189                 "aoColumnDefs": [
190                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
191                 ],
192                 "aaSorting": [[ 1, "asc" ]],
193                 "bPaginate": false
194             }));
195
196             /* Display actions menu anywhere the table is clicked */
197             $("td").click(function(event){
198                 var tgt = $(event.target);
199                 var row = $(this).parent();
200                 var rowid = row.attr("id");
201                 $("tr").removeClass("highlighted-row");
202                 row.addClass("highlighted-row");
203                 $(".dropdown").removeClass("open");
204                 if(tgt.is("a")||tgt.is(":nth-child(8)")){
205                     // Don't show inline links for cells containing links of their own.
206                 } else {
207                     event.stopPropagation();
208                     var dropdown = $(".dropdown", row);
209                     dropdown.addClass("open");
210                     var position = $(this).offset();
211                     var top = position.top + 5;
212                     var left = position.left + 5;
213                     dropdown.css("position","unset");
214                     $(".dropdown-menu", row).css({
215                         "top" : top,
216                         "left" : left,
217                         "right" : "unset"
218                     });
219
220                }
221             });
222
223         });
224     </script>
225     [% INCLUDE 'z3950_search.inc' %]
226     [% Asset.js("js/z3950_search.js") | $raw %]
227 [% END %]
228
229 [% INCLUDE 'intranet-bottom.inc' popup_window=1 %]