Bugzilla – Attachment 125669 Details for
Bug 24698
UNIMARC authorities leader plugin
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24698: Add plugin and template files for unimarc authority leader
Bug-24698-Add-plugin-and-template-files-for-unimar.patch (text/plain), 10.38 KB, created by
Joonas Kylmälä
on 2021-10-03 12:32:47 UTC
(
hide
)
Description:
Bug 24698: Add plugin and template files for unimarc authority leader
Filename:
MIME Type:
Creator:
Joonas Kylmälä
Created:
2021-10-03 12:32:47 UTC
Size:
10.38 KB
patch
obsolete
>From f5dff4081ee57a1c98e900c37ce008a37badee63 Mon Sep 17 00:00:00 2001 >From: George Veranis <gveranis@dataly.gr> >Date: Fri, 12 Mar 2021 12:51:57 +0100 >Subject: [PATCH] Bug 24698: Add plugin and template files for unimarc > authority leader > >In Unimarc installations when adding/editing an authority record there is no >Tag Editor for the leader field ( 000 ). > >This patch fixes that. > >Test plan: > >1) Try to catalogue a new authoritry and check if on field 000 you can find >the Tag Editor. >2) Apply the patch. >3) In the authorities framework view the subfields of field 000 and select for >plugin option the value unimarc_leader_authorities.pl. >4) Restart memcached / plack if needed. >5) Repeat step 1 and notice if the Tag Editor is visible and click it to open >new window in order to manage the field contents and press OK. >6) Check the value of the generated leader. > >Signed-off-by: Esther <estherm@sodapsringsid.com> >--- > .../unimarc_leader_authorities.pl | 86 ++++++++ > .../unimarc_leader_authorities.tt | 201 ++++++++++++++++++ > 2 files changed, 287 insertions(+) > create mode 100644 cataloguing/value_builder/unimarc_leader_authorities.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_leader_authorities.tt > >diff --git a/cataloguing/value_builder/unimarc_leader_authorities.pl b/cataloguing/value_builder/unimarc_leader_authorities.pl >new file mode 100644 >index 0000000000..becdc574af >--- /dev/null >+++ b/cataloguing/value_builder/unimarc_leader_authorities.pl >@@ -0,0 +1,86 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Copyright (C) 2013 Vitor Fernandes , adapted for UNIMARC by George Veranis >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Koha::Util::FrameworkPlugin qw(wrapper); >+use C4::Auth; >+use CGI qw ( -utf8 ); >+use C4::Context; >+use C4::Output; >+ >+ >+sub plugin_javascript { >+ my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; >+ my $res = " >+ <script type='text/javascript'> >+ function Clic$field_number(i) { >+ var defaultvalue; >+ try { >+ defaultvalue = document.getElementById(i).value; >+ } catch(e) { >+ alert('error when getting '+i); >+ return; >+ } >+ window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=unimarc_leader_authorities.pl&index=\"+i+\"&result=\"+defaultvalue,\"unimarc_field_000\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+ } >+ </script> >+"; >+ >+ return ( $field_number, $res ); >+} >+ >+ >+sub plugin { >+ my ($input) = @_; >+ my $index = $input->param('index'); >+ my $result = $input->param('result'); >+ >+ my $dbh = C4::Context->dbh; >+ >+ #my $defaultlanguage = C4::Context->preference("UNIMARCField100Language"); >+ # $defaultlanguage = "fre" if (!$defaultlanguage || length($defaultlanguage) != 3); >+ >+ my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "cataloguing/value_builder/unimarc_leader_authorities.tt", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { editcatalogue => '*' }, >+ debug => 1, >+ } >+ ); >+ $result = " nz a22 3 4500" unless $result; >+ >+ >+ my $f5 = substr( $result, 5, 1 ); $f5 = wrapper( $f5 ) if $f5; >+ my $f6 = substr( $result, 6, 1 ); $f6 = wrapper( $f6 ) if $f6; >+ my $f9 = substr( $result, 9, 1 ); $f9 = wrapper( $f9 ) if $f9; >+ my $f17 = substr( $result, 17, 1 ); $f17 = wrapper( $f17 ) if $f17; >+ >+ $template->param( >+ index => $index, >+ "f5$f5" => 1, >+ "f6$f6" => 1, >+ "f9$f9" => 1, >+ "f17$f17" => 1, >+); >+ output_html_with_http_headers $input, $cookie, $template->output; >+} >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_leader_authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_leader_authorities.tt >new file mode 100644 >index 0000000000..6a9ce16861 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_leader_authorities.tt >@@ -0,0 +1,201 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>UNIMARC leader builder</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+<body id="cat_unimarc_leader_authorities" class="cat" style="padding:1em;"> >+<h3>000 - Leader</h3> >+<form name="f_pop" onsubmit="report()" action=""> >+<input name="plugin_name" value="unimarc_leader_authorities.pl" type="hidden"> >+ >+<table> >+ <tr> >+ <td>1-4 Record length</td> >+ <td>(auto-calculated)</td> >+ </tr> >+ <tr> >+ <td><label for="f5">5- Record status</label></td> >+ <td> >+ <select name="f5" id="f5" size="1"> >+ [% IF ( f5c ) %] >+ <option value="c" selected="selected">c - Corrected or revised</option> >+ [% ELSE %] >+ <option value="c">c - Corrected or revised</option> >+ [% END %] >+ [% IF ( f5d ) %] >+ <option value="d" selected="selected">d - Deleted</option> >+ [% ELSE %] >+ <option value="d">d - Deleted</option> >+ [% END %] >+ [% IF ( f5n ) %] >+ <option value="n" selected="selected">n - New</option> >+ [% ELSE %] >+ <option value="n">n - New</option> >+ [% END %] >+ </select> >+ </td> >+ </tr> >+ <tr> >+ <td><label for="f6">6- Type of record</label></td> >+ <td> >+ <select name="f6" id="f6" size="1"> >+ [% IF ( f6x ) %] >+ <option value="x" selected="selected">x - Authority entry record</option> >+ [% ELSE %] >+ <option value="x">x - Authority entry record</option> >+ [% END %] >+ >+ [% IF ( f6y ) %] >+ <option value="y" selected="selected">y - Reference entry record</option> >+ [% ELSE %] >+ <option value="y">y - Reference entry record</option> >+ [% END %] >+ >+ [% IF ( f6z ) %] >+ <option value="z" selected="selected">z - General explanatory entry record</option> >+ [% ELSE %] >+ <option value="z">z - General explanatory entry record</option> >+ [% END %] >+ >+ </select> >+ </td> >+ </tr> >+ <tr> >+ <td><label for="f7">7-8 Undefined</label></td> >+ <td></td> >+ </tr> >+ >+ <tr> >+ <td><label for="f9">9- Type of entity</label></td> >+ <td> >+ <select name="f9" id="f9" size="1"> >+ [% IF ( f9 ) %] >+ <option value=" " selected="selected"> - Series</option> >+ [% ELSE %] >+ <option value=" "> - Series</option> >+ [% END %] >+ >+ [% IF ( f9a ) %] >+ <option value="a" selected="selected">a - Personal name entry</option> >+ [% ELSE %] >+ <option value="a">a - Personal name entry</option> >+ [% END %] >+ >+ [% IF ( f9b ) %] >+ <option value="b" selected="selected">b - Corporate name entry</option> >+ [% ELSE %] >+ <option value="b">b - Corporate name entry</option> >+ [% END %] >+ >+ [% IF ( f9c ) %] >+ <option value="c" selected="selected">c - Territorial o geographical name</option> >+ [% ELSE %] >+ <option value="c">c - Territorial o geographical name</option> >+ [% END %] >+ >+ [% IF ( f9d ) %] >+ <option value="d" selected="selected">d - Trademark</option> >+ [% ELSE %] >+ <option value="d">d - Trademark</option> >+ [% END %] >+ >+ [% IF ( f9e ) %] >+ <option value="e" selected="selected">e - Family name</option> >+ [% ELSE %] >+ <option value="e">e - Family name</option> >+ [% END %] >+ >+ [% IF ( f9f ) %] >+ <option value="f" selected="selected">f - Uniform name</option> >+ [% ELSE %] >+ <option value="f">f - Uniform name</option> >+ [% END %] >+ >+ [% IF ( f9g ) %] >+ <option value="g" selected="selected">g - Collective uniform name</option> >+ [% ELSE %] >+ <option value="g">g - Collective uniform name</option> >+ [% END %] >+ >+ [% IF ( f9h ) %] >+ <option value="h" selected="selected">h - Name/title</option> >+ [% ELSE %] >+ <option value="h">h - Name/title</option> >+ [% END %] >+ >+ [% IF ( f9i ) %] >+ <option value="i" selected="selected">i - Name/collective uniform title</option> >+ [% ELSE %] >+ <option value="i">i - Name/collective uniform title</option> >+ [% END %] >+ >+ [% IF ( f9j ) %] >+ <option value="j" selected="selected">j - Topical subject</option> >+ [% ELSE %] >+ <option value="j">j - Topical subject</option> >+ [% END %] >+ >+ [% IF ( f9k ) %] >+ <option value="k" selected="selected">k - Place access</option> >+ [% ELSE %] >+ <option value="k">k - Place access</option> >+ [% END %] >+ >+ [% IF ( f9l ) %] >+ <option value="l" selected="selected">l - Form, genre or physical characteristics</option> >+ [% ELSE %] >+ <option value="l">l - Form, genre or physical characteristics</option> >+ [% END %] >+ >+ </select> >+ </td> >+ </tr> >+ <tr> >+ <td><label for="f10">10-16 indicator/subfields/size</label></td> >+ <td>(auto-calculated)</td> >+ </tr> >+ >+ <tr> >+ <td><label for="f17">17- Encoding level</label></td> >+ <td> >+ <select name="f17" id="f17" size="1"> >+ [% IF ( f17space ) %] >+ <option value=" " selected="selected"> - Full</option> >+ [% ELSE %] >+ <option value=" "> - Full</option> >+ [% END %] >+ [% IF ( f183 ) %] >+ <option value="3" selected="selected">3- Partial</option> >+ [% ELSE %] >+ <option value="3">3- Partial</option> >+ [% END %] >+ </select> >+ </td> >+ </tr> >+ >+ <tr> >+ <td>18-19 Undefined</td> >+ <td></td> >+ </tr> >+ >+ <tr> >+ <td>20-24 Entry map & lengths</td> >+ <td>(auto-filled)</td> >+ </tr> >+</table> >+<fieldset class="action"><input type="submit" value="OK" onclick="report();" /> <a href="#" class="cancel close">Cancel</a></fieldset> >+</form> >+<script type="text/javascript"> >+//<![CDATA[ >+function report() { >+ var doc = opener.document; >+ var field = doc.getElementById("[% index %]"); >+ >+ field.value =' '+document.f_pop.f5.value+document.f_pop.f6.value+' '+document.f_pop.f9.value+'22 '+document.f_pop.f17.value+' '+'45 '; >+ >+ self.close(); >+ return false; >+ } >+//]]> >+</script> >+ >+[% INCLUDE 'popup-bottom.inc' %] >-- >2.20.1
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 24698
:
118186
|
124437
|
125669
|
125670
|
125671
|
125672
|
125673
|
125674
|
125675
|
125676
|
125677
|
125678
|
125679
|
125680
|
125929
|
125930
|
125931
|
125932
|
125933
|
125934
|
125935
|
125936
|
125937
|
125938
|
125939
|
125940
|
125998
|
125999
|
126000
|
126001
|
126002
|
126003
|
126004
|
126005
|
126006
|
126007
|
126008
|
126009
|
126010