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