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