Bug 34853: Switch to 'div' as suggested
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / z3950servers.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE HtmlTags %]
4 [% PROCESS 'i18n.inc' %]
5 [% SET footerjs = 1 %]
6 [% INCLUDE 'doc-head-open.inc' %]
7
8 [% IF (server.servertype||type) == 'sru' %]
9     [% SET servertype = "SRU" %]
10 [% ELSIF (server.servertype||type) == 'zed' %]
11     [% SET servertype = "Z39.50" %]
12 [% END %]
13
14 <title>[% FILTER collapse %]
15     [% IF op == 'edit' %]
16         [% tx("Modify {servertype} server '{servername}'", { servertype = servertype, servername = server.servername }) | html %] &rsaquo;
17     [% ELSIF op ==  'add' %]
18         [% tx("New {servertype} server", { servertype = servertype }) | html %] &rsaquo;
19     [% ELSIF searchfield %]
20         [% tx("Search results for '{search_keyword}'", { search_keyword = searchfield }) | html %] &rsaquo;
21     [% END %]
22     [% t("Z39.50/SRU servers") | html %] &rsaquo;
23     [% t("Administration") | html %] &rsaquo;
24     [% t("Koha") | html %]
25 [% END %]</title>
26 [% INCLUDE 'doc-head-close.inc' %]
27 </head>
28
29 <body id="admin_z3950servers" class="admin">
30 [% WRAPPER 'header.inc' %]
31     [% INCLUDE 'z3950-admin-search.inc' %]
32 [% END %]
33
34 [% WRAPPER 'sub-header.inc' %]
35     [% WRAPPER breadcrumbs %]
36         [% WRAPPER breadcrumb_item %]
37             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
38         [% END %]
39
40         [% IF op == 'edit' || op == 'add' || searchfield %]
41             [% WRAPPER breadcrumb_item %]
42                 <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a>
43             [% END %]
44         [% END %]
45
46         [% IF op == 'edit' %]
47             [% WRAPPER breadcrumb_item bc_active= 1 %]
48                 [% tx("Modify {servertype} server '{servername}'", { servertype = servertype, servername = server.servername }) | html %]
49             [% END %]
50
51         [% ELSIF op == 'add' %]
52             [% WRAPPER breadcrumb_item bc_active= 1 %]
53                 [% tx("New {servertype} server", { servertype = servertype }) | html %]
54             [% END %]
55
56         [% ELSIF searchfield %]
57             [% WRAPPER breadcrumb_item bc_active= 1 %]
58                 [% tx("Search results for '{search_keyword}'", { search_keyword = searchfield }) | html %]
59             [% END %]
60         [% ELSE %]
61             [% WRAPPER breadcrumb_item bc_active= 1 %]
62                 <span>Z39.50/SRU servers</span>
63             [% END %]
64         [% END %]
65     [% END #/ WRAPPER breadcrumbs %]
66 [% END #/ WRAPPER sub-header.inc %]
67
68 <div class="main container-fluid">
69     <div class="row">
70         <div class="col-sm-10 col-sm-push-2">
71             <main>
72
73 [% IF msg_deleted %]
74     <div class="dialog alert">Z39.50/SRU server deleted ([% msg_add | html %])</div>
75 [% ELSIF msg_updated %]
76     <div class="dialog message">Z39.50/SRU server updated ([% msg_add | html %])</div>
77 [% ELSIF msg_added %]
78     <div class="dialog message">Z39.50/SRU server added ([% msg_add | html %])</div>
79 [% ELSIF msg_notfound %]
80     <div class="dialog alert">Error: Server with ID [% msg_add | html %] not found</div>
81 [% END %]
82
83 [% IF ( add_form ) %]
84     <form action="[% script_name | html %]" name="Aform" method="post" id="serverentry">
85         [% IF op == 'edit' %]
86             <h1>[% tx("Modify {servertype} server '{servername}'", { servertype = servertype, servername = server.servername }) | html %]</h1>
87             <input type="hidden" name="id" value="[% server.id | html %]" />
88         [% ELSE %]
89             <h1>[% tx("New {servertype} server", { servertype = servertype }) | html %]</h1>
90         [% END %]
91
92         <input type="hidden" name="op" value="add_validated" />
93         <input type="hidden" name="servertype" value="[% server.servertype||type||'zed' | html %]"/>
94         <fieldset class="rows">
95         <ol>
96         <li><label for="name" class="required">Server name: </label>
97             [% IF server.servername %]
98                 <input type="text" name="servername" id="servername" size="65" maxlength="100" value="[% server.servername | html %]" required="required" />
99             [% ELSE %]
100                 <input type="text" name="servername" id="servername" class="focus" size="65" maxlength="100" value="[% server.servername | html %]" required="required" />
101             [% END %]
102              <span class="required">Required</span>
103         </li>
104
105         <li><label for="host" class="required">Hostname: </label> <input type="text" name="host" id="host" size="30" value="[% server.host | html %]" required="required" /> <span class="required">Required</span>
106             [% IF (server.servertype||type) == 'sru' %]
107                 <div class="hint">Includes the domain part, but the path part of the URL should go into Database.</div>
108             [% END %]
109         </li>
110         <li><label for="port" class="required">Port: </label> <input type="text" name="port" id="port" size="5" value="[% server.port | html %]" required="required" /> <span class="required">Required</span>
111         </li>
112         <li><label for="db" class="required">Database: </label> <input type="text" name="db" id="db" value="[% server.db | html %]" required="required" /> <span class="required">Required</span>
113         </li>
114         <li><label for="userid">Userid: </label> <input type="text" name="userid" id="userid" value="[% server.userid | html %]" />
115         </li>
116         <li><label for="password">Password: </label> <input type="text" name="password" id="password" value="[% server.password | html %]" />
117         </li>
118         <li>
119             <label for="checked">Preselected: </label>
120         [% IF ( server.checked ) %]
121             <input type="checkbox" name="checked" id="checked" value="1" checked="checked" />
122         [% ELSE %]
123             <input type="checkbox" name="checked" id="checked" value="1" />
124         [% END %]
125             <span class="hint">Searched by default.</span>
126         </li>
127         <li>
128             <label for="rank">Rank: </label>
129             <input type="text" name="rank" id="rank" size="4" value="[% server.rank | html %]" />
130             <div class="hint">Display order.</div>
131         </li>
132         [% IF (server.servertype||type) == 'zed' %]
133         <li>
134             <label for="attributes">Attributes: </label>
135             <input type="text" name="attributes" id="attributes" size="30" value="[% server.attributes | html %]" />
136             <div class="hint">Additional PQF attributes added to each query.</div>
137         </li>
138         [% END %]
139
140         <li>
141             <label for="syntax">Syntax: </label>
142         <select name="syntax" id="syntax">
143             <option value="UNIMARC">UNIMARC</option>
144             <option value="INTERMARC">INTERMARC</option>
145             <option value="CCF">CCF</option>
146             <option value="USMARC">MARC21/USMARC</option>
147             <option value="UKMARC">UKMARC</option>
148             <option value="NORMARC">NORMARC</option>
149             <option value="LIBRISMARC">LIBRISMARC</option>
150             <option value="DANMARC">DANMARC</option>
151             <option value="FINMARC">FINMARC</option>
152             <option value="CANMARC">CANMARC</option>
153             <option value="SBN">SBN</option>
154             <option value="PICAMARC">PICAMARC</option>
155             <option value="AUSMARC">AUSMARC</option>
156             <option value="IBERMARC">IBERMARC</option>
157             <option value="CATMARC">CATMARC</option>
158             <option value="MALMARC">MALMARC</option>
159         </select>
160             <div class="hint">Z39.50 can send records in various formats. Choose one.</div>
161         </li>
162
163         <li>
164             <label for="encoding">Encoding: </label>
165         <select name="encoding" id="encoding">
166             [% FOREACH enc IN [ 'utf8' 'EUC-KR' 'ISO_5426' 'ISO_6937' 'ISO_8859-1' 'MARC-8' ] %]
167                 <option value="[% enc | html %]">[% enc | html %]</option>
168             [% END %]
169         </select>
170             <div class="hint">Z39.50 can send records in various encodings. Choose one.</div>
171         </li>
172
173         <li>
174             <label for="timeout">Timeout: </label>
175         <input type="text" name="timeout" id="timeout" size="4" value="[% server.timeout | html %]" /> seconds
176             <div class="hint">Enter 0 to disable.</div>
177         </li>
178         <li><label for="recordtype">Record type: </label>
179         <select name="recordtype" id="recordtype">
180             <option value="biblio">Bibliographic</option>
181             <option value="authority">Authority</option>
182         </select>
183         </li>
184         [% IF (server.servertype||type) == 'sru' %]
185         <li>
186         <label for="sru_options">Additional SRU options: </label>
187         <input type="text" name="sru_options" id="sru_options" size="50" value="[% server.sru_options | html %]"/>
188         <div class="hint">Separate options by commas. Example: sru=get,sru_version=1.1. See also http://www.indexdata.com/yaz/doc/zoom.html.</div>
189         </li>
190         <li>
191         <label for="sru_fields">SRU Search fields mapping: </label>
192         <input type="hidden" name="sru_fields" id="sru_fields" value="[% server.sru_fields | html %]" />
193             <input type="text" name="show_sru_fields" id="show_sru_fields" size="100" value="[% server.sru_fields | html %]" disabled="disabled" /> <input type="button" id="modify_sru_fields" value="Modify" />
194         </li>
195         [% END %]
196         <li>
197         <label for="add_xslt">XSLT File(s) for transforming results: </label>
198         <input type="text" name="add_xslt" id="add_xslt" size="100" value="[% server.add_xslt | html %]"/>
199         <div class="hint">Separate multiple filenames by commas.</div>
200         </li>
201
202         </ol>
203         </fieldset>
204
205         <fieldset class="action"><input type="submit" class="btn btn-primary" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/z3950servers.pl">Cancel</a></fieldset>
206     </form>
207 [% END %]
208
209 [% IF op == 'list' %]
210     <div id="toolbar" class="btn-toolbar">
211         <a id="newserver" class="btn btn-default" href="/cgi-bin/koha/admin/z3950servers.pl?op=add&type=zed"><i class="fa fa-plus"></i> New Z39.50 server</a>
212         <a id="newserver" class="btn btn-default" href="/cgi-bin/koha/admin/z3950servers.pl?op=add&type=sru"><i class="fa fa-plus"></i> New SRU server</a>
213     </div>
214     <h1>Z39.50/SRU servers</h1>
215     [% IF searchfield %]
216         <h2>
217             [% tx("Searching by target starting with '{search_keyword}'", { search_keyword = searchfield }) | html %]
218         </h2>
219     [% END %]
220
221     <div class="page-section">
222     <table id="serverst">
223
224         <thead><tr><th>Target</th><th>Hostname/Port</th><th>Database</th><th>Userid</th><th>Password</th><th>Preselected</th><th>Rank</th><th>Syntax</th><th>Encoding</th><th>Timeout</th><th>Record type</th><th>Attributes</th><th class="noExport">Actions</th>
225         </tr></thead>
226         <tbody>
227         [% FOREACH loo IN loop %]
228             <tr>
229             <td><a href="/cgi-bin/koha/admin/z3950servers.pl?op=edit&amp;id=[% loo.id | uri %]">[% loo.servername | html %]</a></td><td>[% loo.host | html %]:[% loo.port | html %]</td><td>[% loo.db | html %]</td><td>[% loo.userid | html %]</td><td>[% IF loo.password %]########[% END %]</td><td>[% IF ( loo.checked ) %]Yes[% ELSE %]No[% END %]</td><td>[% loo.rank | html %]</td>
230             <td>[% loo.syntax | html %]</td><td>[% loo.encoding | html %]</td><td>[% loo.timeout | html %]</td>
231             <td>[% IF ( loo.recordtype == 'biblio' )  %]
232                 <span>Bibliographic</span>
233                 [% ELSIF ( loo.recordtype == 'authority' ) %]
234                 <span>Authority</span>
235                 [% END %]
236             </td>
237             <td>[% loo.attributes | html %]</td>
238             <td>
239                 <div class="btn-group dropup">
240                     <a class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown" href="#">
241                         Actions <b class="caret"></b>
242                     </a>
243                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
244                         <li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=edit&amp;id=[% loo.id | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a></li>
245                         <li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=add&amp;id=[% loo.id | uri %]"><i class="fa fa-copy"></i> Copy</a></li>
246                         <li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=delete_confirmed&amp;id=[% loo.id | uri %]" class="delete" data-servername="[% loo.servername | html %]"><i class="fa fa-trash-can"></i> Delete</a></li>
247                     </ul>
248                 </div>
249             </td>
250             </tr>
251         [% END %]
252         </tbody>
253     </table>
254     </div> <!-- /.page-section -->
255 [% END %]
256
257             </main>
258         </div> <!-- /.col-sm-10.col-sm-push-2 -->
259
260         <div class="col-sm-2 col-sm-pull-10">
261             <aside>
262                 [% INCLUDE 'admin-menu.inc' %]
263             </aside>
264         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
265      </div> <!-- /.row -->
266
267 [% MACRO jsinclude BLOCK %]
268     [% Asset.js("js/admin-menu.js") | $raw %]
269     [% IF op == 'list' %]
270         [% INCLUDE 'datatables.inc' %]
271     [% END %]
272
273     <script>
274         [% IF ( add_form ) %]
275             $(document).ready(function(){
276                 // Update selects for syntax, encoding and recordtype
277                 [% IF server %]
278                     $("#syntax").val('[% server.syntax | html %]');
279                     $("#encoding").val('[% server.encoding | html %]');
280                     $("#recordtype").val('[% server.recordtype | html %]');
281                 [% END %]
282                 $( "#serverentry" ).validate({
283                     rules: {
284                         servername: { required: true },
285                         host: { required: true },
286                         port: {
287                             required: true,
288                             number: true
289                         },
290                         db: { required: true },
291                         rank: { number: true },
292                         timeout: { number: true }
293                     }
294                 });
295                 $("#serverentry").submit(function( event ) {
296                     // first test if show_sru_fields exists
297                     if( $('#show_sru_fields').length && $('#show_sru_fields').val()=='' && !confirm( _("No SRU search field mappings have been defined. This means that all field searches will go through the whole record. Continue?"))) {
298                         return false;
299                     }
300                     // copy show_sru_fields to hidden counterpart
301                     $('#sru_fields').val( $('#show_sru_fields').val() );
302                     // enable recordtype to include field in post
303                     $('#recordtype').prop('disabled',false);
304                 });
305                 $("#servername").on("blur",function(){
306                     toUC(this);
307                 });
308                 $("#modify_sru_fields").on("click",function(){
309                     ModMapping();
310                 });
311             });
312             function ModMapping () {
313                 var map= $('#show_sru_fields').val();
314                 var type= $('#recordtype').val();
315                 window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map + '&type=' + type,'popup','width=800,height=400,resizable=yes,toolbar=false,scrollbars=yes,top');
316             }
317         [% ELSE %]
318             $(document).ready(function() {
319                 $("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
320                     "columnDefs": [
321                         { "targets": [-1], "orderable": false, "searchable":  false },
322                     ],
323                     "pagingType": "full"
324                 }));
325                 $(".delete").on("click",function(e){
326                     var servername = $(this).data("servername");
327                     if( confirm( _("Are you sure you want to delete server %s?").format(servername) ) ) {
328                         return true;
329                     } else {
330                         e.preventDefault();
331                     }
332                 });
333             });
334         [% END %]
335     </script>
336 [% END %]
337 [% INCLUDE 'intranet-bottom.inc' %]