Bug 11297: (QA follow-up) Make table headings match other pages
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / z3950servers.tt
blobf2df3a8fa15df877fda7cf02e31793a54ceb33d8
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
6 [% BLOCK ServerType %]
7     [% IF (server.servertype||type) == 'sru' %]
8         SRU
9     [% ELSIF (server.servertype||type) == 'zed' %]
10         Z39.50
11     [% END %]
12 [% END %]
14 <title>Koha &rsaquo; Administration &rsaquo; Z39.50/SRU servers
15 [% IF op == 'edit' %] &rsaquo; Modify [% PROCESS ServerType %] server [% server.servername | html %][% END %]
16 [% IF op ==  'add' %] &rsaquo; New [% PROCESS ServerType %] server[% END %]
17 </title>
18 [% INCLUDE 'doc-head-close.inc' %]
19 </head>
21 <body id="admin_z3950servers" class="admin">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'z3950-admin-search.inc' %]
25 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
26 <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50/SRU servers</a>
27 [% IF op == 'edit' %]&rsaquo; Modify [% PROCESS ServerType %] server [% server.servername | html %][% END %]
28 [% IF op ==  'add' %]&rsaquo; New [% PROCESS ServerType %] server[% END %]
29 </div>
31 <div class="main container-fluid">
32     <div class="row">
33         <div class="col-sm-10 col-sm-push-2">
34             <main>
36 [% IF msg_deleted %]
37     <div class="dialog alert">Z39.50/SRU server deleted ([% msg_add | html %])</div>
38 [% ELSIF msg_updated %]
39     <div class="dialog message">Z39.50/SRU server updated ([% msg_add | html %])</div>
40 [% ELSIF msg_added %]
41     <div class="dialog message">Z39.50/SRU server added ([% msg_add | html %])</div>
42 [% ELSIF msg_notfound %]
43     <div class="dialog alert">Error: Server with id [% msg_add | html %] not found</div>
44 [% END %]
46 [% IF ( add_form ) %]
47     <form action="[% script_name | html %]" name="Aform" method="post" id="serverentry">
48         <input type="hidden" name="op" value="add_validated" />
49         <input type="hidden" name="servertype" value="[% server.servertype||type||'zed' | html %]"/>
50         [% IF op == 'edit' %]
51             <h1>Modify [% PROCESS ServerType %] server</h1>
52             <input type="hidden" name="id" value="[% server.id | html %]" />
53         [% ELSE %]
54             <h1>New [% PROCESS ServerType %] server</h1>
55         [% END %]
56         <fieldset class="rows">
57         <ol>
58         <li><label for="name" class="required">Server name: </label>
59             <input type="text" name="servername" id="servername" size="65" maxlength="100" value="[% server.servername | html %]" required="required" /> <span class="required">Required</span>
60         </li>
62         <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>
63             [% IF (server.servertype||type) == 'sru' %]
64                 <div class="hint">Includes the domain part, but the path part of the URL should go into Database.</div>
65             [% END %]
66         </li>
67         <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>
68         </li>
69         <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>
70         </li>
71         <li><label for="userid">Userid: </label> <input type="text" name="userid" id="userid" value="[% server.userid | html %]" />
72         </li>
73         <li><label for="password">Password: </label> <input type="text" name="password" id="password" value="[% server.password | html %]" />
74         </li>
75         <li><label for="checked">Preselected (searched by default): </label>
76         [% IF ( server.checked ) %]
77             <input type="checkbox" name="checked" id="checked" value="1" checked="checked" />
78         [% ELSE %]
79             <input type="checkbox" name="checked" id="checked" value="1" />
80         [% END %]
81         </li>
82         <li><label for="rank">Rank (display order): </label> <input type="text" name="rank" id="rank" size="4" value="[% server.rank | html %]" />
83         </li>
84         [% IF (server.servertype||type) == 'zed' %]
85         <li><label for="attributes">Attributes (additional PQF attributes added to each query): </label><input type="text" name="attributes" id="attributes" size="30" value="[% server.attributes | html %]" />
86         </li>
87         [% END %]
89         <li><label for="syntax">Syntax (z3950 can send<br /> records in various format. Choose one): </label>
90         <select name="syntax" id="syntax">
91             <option value="UNIMARC">UNIMARC</option>
92             <option value="INTERMARC">INTERMARC</option>
93             <option value="CCF">CCF</option>
94             <option value="USMARC">MARC21/USMARC</option>
95             <option value="UKMARC">UKMARC</option>
96             <option value="NORMARC">NORMARC</option>
97             <option value="LIBRISMARC">LIBRISMARC</option>
98             <option value="DANMARC">DANMARC</option>
99             <option value="FINMARC">FINMARC</option>
100             <option value="CANMARC">CANMARC</option>
101             <option value="SBN">SBN</option>
102             <option value="PICAMARC">PICAMARC</option>
103             <option value="AUSMARC">AUSMARC</option>
104             <option value="IBERMARC">IBERMARC</option>
105             <option value="CATMARC">CATMARC</option>
106             <option value="MALMARC">MALMARC</option>
107         </select>
108         </li>
110         <li><label for="encoding">Encoding (z3950 can send<br /> records in various encodings. Choose one): </label>
111         <select name="encoding" id="encoding">
112             [% FOREACH enc IN [ 'utf8' 'EUC-KR' 'ISO_5426' 'ISO_6937' 'ISO_8859-1' 'MARC-8' ] %]
113                 <option value="[% enc | html %]">[% enc | html %]</option>
114             [% END %]
115         </select>
116         </li>
118         <li><label for="timeout">Timeout (0 its like not set): </label>
119         <input type="text" name="timeout" id="timeout" size="4" value="[% server.timeout | html %]" /> seconds
120         </li>
121         <li><label for="recordtype">Record type: </label>
122         <select name="recordtype" id="recordtype">
123             <option value="biblio">Bibliographic</option>
124             <option value="authority">Authority</option>
125         </select>
126         </li>
127         [% IF (server.servertype||type) == 'sru' %]
128         <li>
129         <label for="sru_options">Additional SRU options: </label>
130         <input type="text" name="sru_options" id="sru_options" size="50" value="[% server.sru_options | html %]"/>
131         <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>
132         </li>
133         <li>
134         <label for="sru_fields">SRU Search fields mapping: </label>
135         <input type="hidden" name="sru_fields" id="sru_fields" value="[% server.sru_fields | html %]" />
136             <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" />
137         </li>
138         [% END %]
139         <li>
140         <label for="add_xslt">XSLT File(s) for transforming results: </label>
141         <input type="text" name="add_xslt" id="add_xslt" size="100" value="[% server.add_xslt | html %]"/>
142         <div class="hint">Separate multiple filenames by commas.</div>
143         </li>
145         </ol>
146         </fieldset>
148         <fieldset class="action"><input type="submit" value="Save" /> <a class="cancel" href="/cgi-bin/koha/admin/z3950servers.pl">Cancel</a></fieldset>
149     </form>
150 [% END %]
152 [% IF op == 'list' %]
153     <div id="toolbar" class="btn-toolbar">
154         <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>
155         <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>
156     </div>
157     <h3>Z39.50/SRU servers administration</h3>
158     [% IF id %]
159         You searched for record [% id | html %]
160     [% ELSIF searchfield %]
161         You searched for [% searchfield | html %]
162     [% END %]
163     <table id="serverst">
165         <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>Actions</th>
166         </tr></thead>
167         <tbody>
168         [% FOREACH loo IN loop %]
169             <tr>
170             <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>
171             <td>[% loo.syntax | html %]</td><td>[% loo.encoding | html %]</td><td>[% loo.timeout | html %]</td>
172             <td>[% IF ( loo.recordtype == 'biblio' )  %]
173                 <span>Bibliographic</span>
174                 [% ELSIF ( loo.recordtype == 'authority' ) %]
175                 <span>Authority</span>
176                 [% END %]
177             </td>
178             <td>[% loo.attributes | html %]</td>
179             <td>
180                 <div class="dropdown">
181                     <a class="btn btn-default btn-xs dropdown-toggle" id="reportactions[% savedreport.id | html %]" role="button" data-toggle="dropdown" href="#">
182                         Actions <b class="caret"></b>
183                     </a>
184                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reportactions[% savedreport.id | html %]">
185                         <li><a href="/cgi-bin/koha/admin/z3950servers.pl?op=edit&amp;id=[% loo.id | uri %]"><i class="fa fa-pencil"></i> Edit</a></li>
186                         <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>
187                         <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"></i> Delete</a></li>
188                     </ul>
189                 </div>
190             </td>
191             </tr>
192         [% END %]
193         </tbody>
194     </table>
195 [% END %]
197             </main>
198         </div> <!-- /.col-sm-10.col-sm-push-2 -->
200         <div class="col-sm-2 col-sm-pull-10">
201             <aside>
202                 [% INCLUDE 'admin-menu.inc' %]
203             </aside>
204         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
205      </div> <!-- /.row -->
207 [% MACRO jsinclude BLOCK %]
208     [% Asset.js("js/admin-menu.js") | $raw %]
209     [% IF op == 'list' %]
210         [% INCLUDE 'datatables.inc' %]
211     [% END %]
213     <script>
214         [% IF ( add_form ) %]
215             $(document).ready(function(){
216                 // Update selects for syntax, encoding and recordtype
217                 [% IF server %]
218                     $("#syntax").val('[% server.syntax | html %]');
219                     $("#encoding").val('[% server.encoding | html %]');
220                     $("#recordtype").val('[% server.recordtype | html %]');
221                 [% END %]
222                 $( "#serverentry" ).validate({
223                     rules: {
224                         servername: { required: true },
225                         host: { required: true },
226                         port: {
227                             required: true,
228                             number: true
229                         },
230                         db: { required: true },
231                         rank: { number: true },
232                         timeout: { number: true }
233                     }
234                 });
235                 $("#serverentry").submit(function( event ) {
236                     // first test if show_sru_fields exists
237                     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?"))) {
238                         return false;
239                     }
240                     // copy show_sru_fields to hidden counterpart
241                     $('#sru_fields').val( $('#show_sru_fields').val() );
242                     // enable recordtype to include field in post
243                     $('#recordtype').prop('disabled',false);
244                 });
245                 $("#servername").on("blur",function(){
246                     toUC(this);
247                 });
248                 $("#modify_sru_fields").on("click",function(){
249                     ModMapping();
250                 });
251             });
252             function ModMapping () {
253                 var map= $('#show_sru_fields').val();
254                 var type= $('#recordtype').val();
255                 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');
256             }
257         [% ELSE %]
258             $(document).ready(function() {
259                 $("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, {
260                     "aoColumnDefs": [
261                         { "aTargets": [-1], "bSortable": false, "bSearchable": false },
262                     ],
263                     "sPaginationType": "full"
264                 }));
265                 $(".delete").on("click",function(e){
266                     var servername = $(this).data("servername");
267                     if( confirm( _("Are you sure you want to delete server %s?").format(servername) ) ) {
268                         return true;
269                     } else {
270                         e.preventDefault();
271                     }
272                 });
273             });
274         [% END %]
275     </script>
276 [% END %]
277 [% INCLUDE 'intranet-bottom.inc' %]