Bugzilla – Attachment 30191 Details for
Bug 6536
Z3950 Search Enhancements: SRU targets and additional XSLT processing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6536: SRU servers administration
Bug-6536-SRU-servers-administration.patch (text/plain), 11.12 KB, created by
Marcel de Rooy
on 2014-07-28 10:47:07 UTC
(
hide
)
Description:
Bug 6536: SRU servers administration
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2014-07-28 10:47:07 UTC
Size:
11.12 KB
patch
obsolete
>From dcc7135be03552d49e153957e7f63e660cd485c6 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 16 Jul 2014 16:38:57 +0200 >Subject: [PATCH] Bug 6536: SRU servers administration >Content-Type: text/plain; charset=utf-8 > >This patch makes adjustments in admin/z3950servers in order to insert, >edit and delete SRU server records. > >Test plan: >Add, edit, copy and delete SRU server. >Check if adding, editing, copying and deleting Z3950 servers still works. > >Signed-off-by: Giuseppe Angilella <giuseppe.angilella@ct.infn.it> >--- > admin/z3950servers.pl | 16 +++--- > .../prog/en/modules/admin/z3950servers.tt | 65 ++++++++++++++++--- > 2 files changed, 62 insertions(+), 19 deletions(-) > >diff --git a/admin/z3950servers.pl b/admin/z3950servers.pl >index c13c95f..b7a80c2 100755 >--- a/admin/z3950servers.pl >+++ b/admin/z3950servers.pl >@@ -36,6 +36,7 @@ use Koha::Database; > my $input = new CGI; > my $op = $input->param('op') || 'list'; > my $id = $input->param('id') || 0; >+my $type = $input->param('type') || ''; > my $searchfield = ''; > > my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { >@@ -58,29 +59,28 @@ if( $op eq 'delete_confirmed' && $id ) { > my $server = $schema->resultset('Z3950server')->find($id); > if ( $server ) { > $server->delete; >- $template->param( msg_deleted => 1, msg_add => $server->name ); >+ $template->param( msg_deleted => 1, msg_add => $server->servername ); > } else { > $template->param( msg_notfound => 1, msg_add => $id ); > } > $id = 0; > } elsif ( $op eq 'add_validated' ) { > my @fields=qw/host port db userid password rank syntax encoding timeout >- recordtype checked/; >+ recordtype checked servername servertype sru_options sru_fields >+ add_xslt/; > my $formdata = _form_data_hashref( $input, \@fields ); >- #add name from servername (an input with name="name" gave problems) >- $formdata->{name} = $input->param('servername'); > if( $id ) { > my $server = $schema->resultset('Z3950server')->find($id); > if ( $server ) { > $server->update( $formdata ); >- $template->param( msg_updated => 1, msg_add => $formdata->{name} ); >+ $template->param( msg_updated => 1, msg_add => $formdata->{servername} ); > } else { > $template->param( msg_notfound => 1, msg_add => $id ); > } > $id = 0; > } else { > $schema->resultset('Z3950server')->create( $formdata ); >- $template->param( msg_added => 1, msg_add => $formdata->{name} ); >+ $template->param( msg_added => 1, msg_add => $formdata->{servername} ); > } > } else { > #use searchfield only in remaining operations >@@ -94,7 +94,7 @@ if ( $op eq 'add' || $op eq 'edit' ) { > $data = ServerSearch( $schema, $id, $searchfield ) if $searchfield || $id; > delete $data->[0]->{id} if @$data && $op eq 'add'; #cloning record > $template->param( add_form => 1, server => @$data? $data->[0]: undef, >- op => $op ); >+ op => $op, type => $op eq 'add'? lc $type: '' ); > } else { > $data = ServerSearch( $schema, $id, $searchfield ); > $template->param( loop => \@$data, searchfield => $searchfield, id => $id, >@@ -107,7 +107,7 @@ output_html_with_http_headers $input, $cookie, $template->output; > sub ServerSearch { #find server(s) by id or name > my ( $schema, $id, $searchstring )= @_; > my $rs = $schema->resultset('Z3950server')->search( >- $id ? { id => $id }: { name => { like => $searchstring.'%' } }, >+ $id ? { id => $id }: { servername => { like => $searchstring.'%' } }, > { result_class => 'DBIx::Class::ResultClass::HashRefInflator' } > ); > return [ $rs->all ]; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >index c43e6eb..f585bc7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/z3950servers.tt >@@ -1,7 +1,16 @@ > [% INCLUDE 'doc-head-open.inc' %] >+ >+[% BLOCK ServerType %] >+ [% IF (server.servertype||type) == 'sru' %] >+ SRU >+ [% ELSIF (server.servertype||type) == 'zed' %] >+ Z39.50 >+ [% END %] >+[% END %] >+ > <title>Koha › Administration › Z39.50 servers >-[% IF op == 'edit' %] › Modify Z39.50 server [% server.name %][% END %] >-[% IF op == 'add' %] › New Z39.50 server[% END %] >+[% IF op == 'edit' %] › Modify [% PROCESS ServerType %] server [% server.servername %][% END %] >+[% IF op == 'add' %] › New [% PROCESS ServerType %] server[% END %] > </title> > [% INCLUDE 'doc-head-close.inc' %] > >@@ -20,6 +29,10 @@ > $("#encoding").val('[% server.encoding %]'); > $("#recordtype").val('[% server.recordtype %]'); > [% END %] >+ // Disable recordtype (and default to bib) for non-Z3950 servers until auth is supported >+ [% UNLESS (server.servertype||type) == 'zed' %] >+ $("#recordtype").prop('disabled',true); >+ [% END %] > $( "#serverentry" ).validate({ > rules: { > servername: { required: true }, >@@ -33,7 +46,17 @@ > timeout: { number: true } > } > }); >+ $("#serverentry").submit(function( event ) { >+ // copy show_sru_fields to hidden counterpart >+ $('#sru_fields').val( $('#show_sru_fields').val() ); >+ // enable recordtype to include field in post >+ $('#recordtype').prop('disabled',false); >+ }); > }); >+ function ModMapping () { >+ var map= $('#show_sru_fields').val(); >+ window.open('/cgi-bin/koha/admin/sru_modmapping.pl?mapping='+map,'popup','width=800,height=400,resizable=no,toolbar=false,scrollbars=no,top'); >+ } > [% ELSE %] > $(document).ready(function() { > $("#serverst").dataTable($.extend(true, {}, dataTablesDefaults, { >@@ -61,8 +84,8 @@ > > <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › > <a href="/cgi-bin/koha/admin/z3950servers.pl">Z39.50 servers</a> >-[% IF op == 'edit' %]› Modify Z39.50 server [% server.name %][% END %] >-[% IF op == 'add' %]› New Z39.50 server[% END %] >+[% IF op == 'edit' %]› Modify [% PROCESS ServerType %] server [% server.servername %][% END %] >+[% IF op == 'add' %]› New [% PROCESS ServerType %] server[% END %] > </div> > > <div id="doc3" class="yui-t2"> >@@ -83,15 +106,16 @@ > [% IF ( add_form ) %] > <form action="[% script_name %]" name="Aform" method="post" id="serverentry"> > <input type="hidden" name="op" value="add_validated" /> >+ <input type="hidden" name="servertype" value="[% server.servertype||type||'zed' %]"/> > [% IF op == 'edit' %] >- <h1>Modify Z39.50 server</h1> >+ <h1>Modify [% PROCESS ServerType %] server</h1> > <input type="hidden" name="id" value="[% server.id %]" /> > [% ELSE %] >- <h1>New Z39.50 server</h1> >+ <h1>New [% PROCESS ServerType %] server</h1> > [% END %] > <fieldset class="rows"> > <ol> >- <li><label for="name" class="required">Z39.50 server: </label><input type="text" name="servername" id="servername" size="65" maxlength="100" onblur="toUC(this)" value="[% server.name | html %]" required="required"/> <span class="required">Required</span></li> >+ <li><label for="name">Server name: </label><input type="text" name="servername" id="servername" size="65" maxlength="100" onblur="toUC(this)" value="[% server.servername | html %]"/></li> > > <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> > </li> >@@ -151,6 +175,24 @@ > <option value="authority">Authority</option> > </select> > </li> >+ [% IF (server.servertype||type) == 'sru' %] >+ <li> >+ <label for="sru_options">Additional SRU options: </label> >+ <input type="text" name="sru_options" id="sru_options" size="50" value="[% server.sru_options %]"/> >+ <span>( Separate options by commas. Example: sru=get,sru_version=1.1. See also http://www.indexdata.com/yaz/doc/zoom.html.)</span> >+ </li> >+ <li> >+ <label for="sru_fields">SRU Search fields mapping: </label> >+ <input type="hidden" name="sru_fields" id="sru_fields" value="[% server.sru_fields %]" /> >+ <input type="text" name="show_sru_fields" id="show_sru_fields" size="100" value="[% server.sru_fields %]" disabled/> <input type="button" value="Modify" onclick="ModMapping()" /> >+ </li> >+ [% END %] >+ <li> >+ <label for="add_xslt">XSLT File(s) for transforming results: </label> >+ <input type="text" name="add_xslt" id="add_xslt" size="100" value="[% server.add_xslt %]"/> >+ <span>( Separate files by commas.)</span> >+ </li> >+ > </ol> > </fieldset> > >@@ -160,7 +202,8 @@ > > [% IF op == 'list' %] > <div id="toolbar" class="btn-toolbar"> >- <a id="newserver" class="btn btn-small" href="/cgi-bin/koha/admin/z3950servers.pl?op=add"><i class="icon-plus"></i> New Z39.50 server</a> >+ <a id="newserver" class="btn btn-small" href="/cgi-bin/koha/admin/z3950servers.pl?op=add&type=zed"><i class="icon-plus"></i> New Z39.50 server</a> >+ <a id="newserver" class="btn btn-small" href="/cgi-bin/koha/admin/z3950servers.pl?op=add&type=sru"><i class="icon-plus"></i> New SRU server</a> > </div> > <h3>Z39.50 servers administration</h3> > [% IF id %] >@@ -178,9 +221,9 @@ > [% ELSE %] > <tr> > [% END %] >- <td><a href="[% loo.script_name %]?op=edit&id=[% loo.id %]">[% loo.name %]</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> >-<td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td><td>[% loo.recordtype %]</td> >- <td><a href="[% loo.script_name %]?op=edit&id=[% loo.id %]">Edit</a> <a href="[% loo.script_name %]?op=add&id=[% loo.id %]">Copy</a> <a href="javascript:void(0);" onclick="ConfirmDelete('[% loo.name | replace("['\"]","") %]','[% loo.id %]');">Delete</a></td> >+ <td><a href="[% loo.script_name %]?op=edit&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> >+ <td>[% loo.syntax %]</td><td>[% loo.encoding %]</td><td>[% loo.timeout %]</td><td>[% loo.recordtype %]</td> >+ <td><a href="[% loo.script_name %]?op=edit&id=[% loo.id %]">Edit</a> <a href="[% loo.script_name %]?op=add&id=[% loo.id %]">Copy</a> <a href="javascript:void(0);" onclick="ConfirmDelete('[% loo.servername | replace("['\"]","") %]','[% loo.id %]');">Delete</a></td> > </tr> > [% END %] > </tbody> >-- >1.7.7.6
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6536
:
4540
|
4541
|
4959
|
6901
|
6919
|
6920
|
6924
|
13462
|
26169
|
26170
|
26171
|
26172
|
29754
|
29755
|
29756
|
29779
|
29780
|
29788
|
29790
|
29791
|
29812
|
29813
|
29814
|
29815
|
29816
|
29817
|
29818
|
29819
|
30189
|
30190
|
30191
|
30192
|
30193
|
30194
|
30900
|
30901
|
30902
|
30903
|
30904
|
30905
|
30906
|
30907
|
30929
|
30930
|
30931
|
30932
|
30933
|
30934
|
30935
|
30936
|
31046
|
31048
|
31137
|
31193
|
31194
|
31195
|
31227
|
31247
|
31248
|
37264