Bugzilla – Attachment 39374 Details for
Bug 13437
Convert marc21 framework plugins to new style
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 13437: Conversion of marc21 cataloguing plugins to new style
SIGNED-OFF-Bug-13437-Conversion-of-marc21-catalogu.patch (text/plain), 33.91 KB, created by
Bernardo Gonzalez Kriegel
on 2015-05-21 18:55:33 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 13437: Conversion of marc21 cataloguing plugins to new style
Filename:
MIME Type:
Creator:
Bernardo Gonzalez Kriegel
Created:
2015-05-21 18:55:33 UTC
Size:
33.91 KB
patch
obsolete
>From f382f500f8133a3ca536ea04b5cc388d5e6e7cb9 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 14 May 2015 10:20:15 +0200 >Subject: [PATCH] [SIGNED-OFF] Bug 13437: Conversion of marc21 cataloguing > plugins to new style > >This patch converts marc21 plugins to new style by making the following >modifications: > >[1] Replace use strict with use Modern::Perl. This implies that we now >re-enabled warnings. There are no redefine warnings anymore, but note that >we need to silence some warnings from individual plugins that were covered >by disabling the warnings pragma until now. Silencing these individual >warnings is outside the scope of this report. >[2] Sub plugin_javascript is replaced by an anonymous subroutine $builder. >[3] The parameters of $builder are combined in a params hashref. In most >cases we only need $params->{id} for the function name. >[4] Javascript function Clicxxx is renamed to Clickxxx. >[5] The builder does no longer return function_name. >[6] Sub plugin is replaced by subroutine $launcher. >[7] The parameters of $launcher are combined in a params hashref. We only >use $params->{cgi}. Mostly we save that to $input. One exception: $query. >[8] The plugins returns a hash with $builder and/or $launcher. > >Test plan: >[1] Run t/db_dependent/FrameworkPlugin.t -incl cataloguing/value_builder/ >marc21*.pl. This should catch compile errors and general problems when >building or launching these plugins. >NOTE: You will see several initialize warnings from individual plugins that >were hidden until now by disabling warnings. This is fine; we will be >able to address these warnings now on new reports. >[2] Check behavior of several plugins in the marc editor. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Checked all marc21 plugins. Attached unused plugins to some field. >Some plugins (unused by default) may need some further attention, but >also outside the scope of this report. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >New warnigs, but all seems to work. >No errors. >--- > cataloguing/value_builder/marc21_field_003.pl | 19 ++++++----- > cataloguing/value_builder/marc21_field_005.pl | 19 ++++++----- > cataloguing/value_builder/marc21_field_006.pl | 30 +++++++++-------- > cataloguing/value_builder/marc21_field_007.pl | 30 +++++++++-------- > cataloguing/value_builder/marc21_field_008.pl | 34 +++++++++++--------- > .../value_builder/marc21_field_008_authorities.pl | 34 +++++++++++--------- > cataloguing/value_builder/marc21_field_040c.pl | 19 ++++++----- > cataloguing/value_builder/marc21_field_040d.pl | 19 ++++++----- > cataloguing/value_builder/marc21_field_245h.pl | 21 ++++++------ > cataloguing/value_builder/marc21_leader.pl | 34 +++++++++++--------- > .../value_builder/marc21_leader_authorities.pl | 34 +++++++++++--------- > cataloguing/value_builder/marc21_leader_book.pl | 30 +++++++++-------- > .../value_builder/marc21_leader_computerfile.pl | 30 +++++++++-------- > cataloguing/value_builder/marc21_leader_video.pl | 28 +++++++++------- > .../value_builder/marc21_linking_section.pl | 28 +++++++++------- > 15 files changed, 232 insertions(+), 177 deletions(-) > >diff --git a/cataloguing/value_builder/marc21_field_003.pl b/cataloguing/value_builder/marc21_field_003.pl >index 4a3b516..9844863 100755 >--- a/cataloguing/value_builder/marc21_field_003.pl >+++ b/cataloguing/value_builder/marc21_field_003.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > > # Copyright 2000-2002 Katipo Communications > # >@@ -18,13 +20,12 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > use C4::Context; > >-sub plugin_javascript { >- my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; >- my $function_name= $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > > my $org = C4::Context->preference('MARCOrgCode'); > my $res = " >@@ -32,12 +33,14 @@ sub plugin_javascript { > //<![CDATA[ > > function Focus$function_name(subfield_managed) { >- document.getElementById(\"$field_number\").value='$org'; >+ document.getElementById(\"$params->{id}\").value='$org'; > return 0; > } > > //]]> > </script> > "; >- return ($function_name,$res); >-} >+ return $res; >+}; >+ >+return { builder => $builder }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_field_005.pl b/cataloguing/value_builder/marc21_field_005.pl >index ad8d64d..4771bbd 100755 >--- a/cataloguing/value_builder/marc21_field_005.pl >+++ b/cataloguing/value_builder/marc21_field_005.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,12 +19,11 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > >-sub plugin_javascript { >- my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; >- my $function_name= $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > > # find today's date > my @a= (localtime) [5,4,3,2,1,0]; $a[0]+=1900; $a[1]++; >@@ -33,12 +34,14 @@ sub plugin_javascript { > //<![CDATA[ > > function Focus$function_name(subfield_managed) { >- document.getElementById(\"$field_number\").value='$date'; >+ document.getElementById(\"$params->{id}\").value='$date'; > return 0; > } > > //]]> > </script> > "; >- return ($function_name,$res); >-} >+ return $res; >+}; >+ >+return { builder => $builder }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_field_006.pl b/cataloguing/value_builder/marc21_field_006.pl >index 0268a33..1a01cf0 100755 >--- a/cataloguing/value_builder/marc21_field_006.pl >+++ b/cataloguing/value_builder/marc21_field_006.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,8 +19,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > use C4::Auth; > use CGI qw ( -utf8 ); > use C4::Context; >@@ -28,27 +29,28 @@ use C4::Output; > > use XML::LibXML; > >-sub plugin_javascript { >- my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > my $res = " > <script type=\"text/javascript\"> > //<![CDATA[ > >-function Clic$function_name(i) { >- defaultvalue=document.getElementById(\"$field_number\").value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_006.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+function Click$function_name(i) { >+ defaultvalue=document.getElementById(\"$params->{id}\").value; >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_006.pl&index=$params->{id}&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> > </script> > "; > >- return ($function_name, $res); >-} >+ return $res; >+}; > >-sub plugin { >- my ($input) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; > my $index = $input->param('index'); > my $result = $input->param('result'); > >@@ -86,4 +88,6 @@ sub plugin { > errorXml => $errorXml, > ); > output_html_with_http_headers $input, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_field_007.pl b/cataloguing/value_builder/marc21_field_007.pl >index 65f7d09..d8bf1ea 100755 >--- a/cataloguing/value_builder/marc21_field_007.pl >+++ b/cataloguing/value_builder/marc21_field_007.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,9 +19,8 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >+use Modern::Perl; > >-#use warnings; FIXME - Bug 2505 > use C4::Auth; > use CGI qw ( -utf8 ); > use C4::Context; >@@ -27,27 +28,28 @@ use C4::Context; > use C4::Search; > use C4::Output; > >-sub plugin_javascript { >- my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > my $res = " > <script type=\"text/javascript\"> > //<![CDATA[ > >-function Clic$function_name(i) { >- defaultvalue=document.getElementById(\"$field_number\").value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_007.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+function Click$function_name(i) { >+ defaultvalue=document.getElementById(\"$params->{id}\").value; >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_007.pl&index=$params->{id}&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> > </script> > "; > >- return ( $function_name, $res ); >-} >+ return $res; >+}; > >-sub plugin { >- my ($input) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; > my $index = $input->param('index'); > my $result = $input->param('result'); > >@@ -144,4 +146,6 @@ sub plugin { > "f22$f22" => $f22, > ); > output_html_with_http_headers $input, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_field_008.pl b/cataloguing/value_builder/marc21_field_008.pl >index 9503fe0..e93e522 100755 >--- a/cataloguing/value_builder/marc21_field_008.pl >+++ b/cataloguing/value_builder/marc21_field_008.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,8 +19,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > use C4::Auth; > use CGI qw ( -utf8 ); > use C4::Context; >@@ -29,30 +30,30 @@ use C4::Output; > use XML::LibXML; > use Koha::Util::FrameworkPlugin qw|date_entered|; > >-sub plugin_javascript { >- my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_; >+my $builder = sub { >+ my ( $params ) = @_; > > my $lang = C4::Context->preference('DefaultLanguageField008' ); > $lang = "eng" unless $lang; > $lang = pack("A3", $lang); > >- my $function_name = $field_number; >+ my $function_name = $params->{id}; > my $dateentered = date_entered(); > my $res = " > <script type=\"text/javascript\"> > //<![CDATA[ > > function Focus$function_name(subfield_managed) { >- if ( document.getElementById(\"$field_number\").value ) { >+ if ( document.getElementById(\"$params->{id}\").value ) { > } > else { >- document.getElementById(\"$field_number\").value='$dateentered' + 'b xxu||||| |||| 00| 0 $lang d'; >+ document.getElementById(\"$params->{id}\").value='$dateentered' + 'b xxu||||| |||| 00| 0 $lang d'; > } > return 1; > } > >-function Clic$function_name(i) { >- defaultvalue=document.getElementById(\"$field_number\").value; >+function Click$function_name(i) { >+ defaultvalue=document.getElementById(\"$params->{id}\").value; > //Retrieve full leader string and pass it to the 008 tag editor > var leader_value = \$(\"input[id^='tag_000']\").val(); > var leader_parameter = \"\"; >@@ -60,18 +61,19 @@ function Clic$function_name(i) { > //Only add the parameter to the URL if there is a value to add > leader_parameter = \"&leader=\"+leader_value; > } >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$field_number&result=\"+defaultvalue+leader_parameter,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$params->{id}&result=\"+defaultvalue+leader_parameter,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> > </script> > "; > >- return ($function_name, $res); >-} >+ return $res; >+}; > >-sub plugin { >- my ($input) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; > my $lang = C4::Context->preference('DefaultLanguageField008' ); > $lang = "eng" unless $lang; > $lang = pack("A3", $lang); >@@ -163,4 +165,6 @@ sub plugin { > material_configuration => $material_configuration, > ); > output_html_with_http_headers $input, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >diff --git a/cataloguing/value_builder/marc21_field_008_authorities.pl b/cataloguing/value_builder/marc21_field_008_authorities.pl >index 699ab65..5489a43 100755 >--- a/cataloguing/value_builder/marc21_field_008_authorities.pl >+++ b/cataloguing/value_builder/marc21_field_008_authorities.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,8 +19,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > use C4::Auth; > use CGI qw ( -utf8 ); > use C4::Context; >@@ -30,9 +31,9 @@ use Koha::Util::FrameworkPlugin qw|date_entered|; > use constant FIXLEN_DATA_ELTS => '|| aca||aabn | a|a d'; > use constant PREF_008 => 'MARCAuthorityControlField008'; > >-sub plugin_javascript { >- my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; >- my $function_name= $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > my $dateentered = date_entered(); > my $defaultval = substr( C4::Context->preference(PREF_008) || FIXLEN_DATA_ELTS, 0, 34 ); > my $res=" >@@ -40,32 +41,33 @@ sub plugin_javascript { > //<![CDATA[ > > function Focus$function_name(subfield_managed) { >- if (!document.getElementById(\"$field_number\").value) { >+ if (!document.getElementById(\"$params->{id}\").value) { > var authtype=document.forms['f'].elements['authtypecode'].value; > var fieldval='$dateentered$defaultval'; > if(authtype && (authtype == 'TOPIC_TERM' || authtype == 'GENRE/FORM' || authtype == 'CHRON_TERM')) { > fieldval= fieldval.substr(0,14)+'b'+fieldval.substr(15); > } >- document.getElementById(\"$field_number\").value=fieldval; >+ document.getElementById(\"$params->{id}\").value=fieldval; > } > return 1; > } > >-function Clic$function_name(i) { >+function Click$function_name(i) { > var authtype=document.forms['f'].elements['authtypecode'].value; >- defaultvalue=document.getElementById(\"$field_number\").value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_authorities.pl&index=$field_number&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+ defaultvalue=document.getElementById(\"$params->{id}\").value; >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_authorities.pl&index=$params->{id}&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> > </script> > "; > >- return ($function_name,$res); >-} >+ return $res; >+}; > >-sub plugin { >- my ($input) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; > my $index= $input->param('index'); > my $result= $input->param('result'); > my $authtype= $input->param('authtypecode')||''; >@@ -101,4 +103,6 @@ sub plugin { > ); > } > output_html_with_http_headers $input, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >diff --git a/cataloguing/value_builder/marc21_field_040c.pl b/cataloguing/value_builder/marc21_field_040c.pl >index 35cc7b3..0ad692b 100755 >--- a/cataloguing/value_builder/marc21_field_040c.pl >+++ b/cataloguing/value_builder/marc21_field_040c.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,13 +19,12 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > use C4::Context; > >-sub plugin_javascript { >- my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; >- my $function_name= $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > > my $org = C4::Context->preference('MARCOrgCode'); > my $res = " >@@ -31,12 +32,14 @@ sub plugin_javascript { > //<![CDATA[ > > function Focus$function_name(subfield_managed) { >- document.getElementById(\"$field_number\").value='$org'; >+ document.getElementById(\"$params->{id}\").value='$org'; > return 0; > } > > //]]> > </script> > "; >- return ($function_name,$res); >-} >+ return $res; >+}; >+ >+return { builder => $builder }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_field_040d.pl b/cataloguing/value_builder/marc21_field_040d.pl >index aad04b1..0ad692b 100755 >--- a/cataloguing/value_builder/marc21_field_040d.pl >+++ b/cataloguing/value_builder/marc21_field_040d.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,13 +19,12 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > use C4::Context; > >-sub plugin_javascript { >- my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > > my $org = C4::Context->preference('MARCOrgCode'); > my $res = " >@@ -31,12 +32,14 @@ sub plugin_javascript { > //<![CDATA[ > > function Focus$function_name(subfield_managed) { >- document.getElementById(\"$field_number\").value='$org'; >+ document.getElementById(\"$params->{id}\").value='$org'; > return 0; > } > > //]]> > </script> > "; >- return ($function_name,$res); >-} >+ return $res; >+}; >+ >+return { builder => $builder }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_field_245h.pl b/cataloguing/value_builder/marc21_field_245h.pl >index 1912c4c..9317497 100755 >--- a/cataloguing/value_builder/marc21_field_245h.pl >+++ b/cataloguing/value_builder/marc21_field_245h.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2009 Kyle Hall <kyle.m.hall@gmail.com> > # > # This file is part of Koha. >@@ -17,25 +19,24 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > use C4::Context; > >-sub plugin_javascript { >- my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > > my $res = " > <script type=\"text/javascript\"> > //<![CDATA[ > > function Blur$function_name(index) { >- var fieldValue = document.getElementById(\"$field_number\").value; >+ var fieldValue = document.getElementById(\"$params->{id}\").value; > if ( fieldValue.substring(0,1) != '[' > && > fieldValue.substring(fieldValue.length-1) != '[' > ) { >- document.getElementById(\"$field_number\").value = '[' + fieldValue + ']'; >+ document.getElementById(\"$params->{id}\").value = '[' + fieldValue + ']'; > } > return 0; > } >@@ -43,5 +44,7 @@ function Blur$function_name(index) { > //]]> > </script> > "; >- return ($function_name,$res); >-} >+ return $res; >+}; >+ >+return { builder => $builder }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_leader.pl b/cataloguing/value_builder/marc21_leader.pl >index 4b49ae0..28f7dce 100755 >--- a/cataloguing/value_builder/marc21_leader.pl >+++ b/cataloguing/value_builder/marc21_leader.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,9 +19,8 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >+use Modern::Perl; > >-#use warnings; FIXME - Bug 2505 > use C4::Auth; > use CGI qw ( -utf8 ); > use C4::Context; >@@ -27,34 +28,35 @@ use C4::Context; > use C4::Search; > use C4::Output; > >-sub plugin_javascript { >- my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > my $res = " > <script type=\"text/javascript\"> > //<![CDATA[ > > function Focus$function_name(subfield_managed) { >- if(!document.getElementById(\"$field_number\").value){ >- document.getElementById(\"$field_number\").value = ' nam a22 7a 4500'; >+ if(!document.getElementById(\"$params->{id}\").value){ >+ document.getElementById(\"$params->{id}\").value = ' nam a22 7a 4500'; > } > return 1; > } > >-function Clic$function_name(i) { >- defaultvalue=document.getElementById(\"$field_number\").value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+function Click$function_name(i) { >+ defaultvalue=document.getElementById(\"$params->{id}\").value; >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader.pl&index=$params->{id}&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> > </script> > "; > >- return ( $function_name, $res ); >-} >+ return $res; >+}; > >-sub plugin { >- my ($input) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; > my $index = $input->param('index'); > my $result = $input->param('result'); > >@@ -90,4 +92,6 @@ sub plugin { > "f2023" => $f2023, > ); > output_html_with_http_headers $input, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_leader_authorities.pl b/cataloguing/value_builder/marc21_leader_authorities.pl >index 15e31ff..527b12f 100755 >--- a/cataloguing/value_builder/marc21_leader_authorities.pl >+++ b/cataloguing/value_builder/marc21_leader_authorities.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,9 +19,8 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >+use Modern::Perl; > >-#use warnings; FIXME - Bug 2505 > use C4::Auth; > use CGI qw ( -utf8 ); > use C4::Context; >@@ -27,34 +28,35 @@ use C4::Context; > use C4::Search; > use C4::Output; > >-sub plugin_javascript { >- my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > my $res = " > <script type=\"text/javascript\"> > //<![CDATA[ > > function Focus$function_name(subfield_managed) { >- if(!document.getElementById(\"$field_number\").value){ >- document.getElementById(\"$field_number\").value = ' nz a22 n 4500'; >+ if(!document.getElementById(\"$params->{id}\").value){ >+ document.getElementById(\"$params->{id}\").value = ' nz a22 n 4500'; > } > return 1; > } > >-function Clic$function_name(i) { >- defaultvalue=document.getElementById(\"$field_number\").value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader_authorities.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+function Click$function_name(i) { >+ defaultvalue=document.getElementById(\"$params->{id}\").value; >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader_authorities.pl&index=$params->{id}&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> > </script> > "; > >- return ( $function_name, $res ); >-} >+ return $res; >+}; > >-sub plugin { >- my ($input) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; > my $index = $input->param('index'); > my $result = $input->param('result'); > >@@ -88,4 +90,6 @@ sub plugin { > "f2023" => $f2023, > ); > output_html_with_http_headers $input, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_leader_book.pl b/cataloguing/value_builder/marc21_leader_book.pl >index 45aeb70..646b32d 100755 >--- a/cataloguing/value_builder/marc21_leader_book.pl >+++ b/cataloguing/value_builder/marc21_leader_book.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,9 +19,8 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >+use Modern::Perl; > >-#use warnings; FIXME - Bug 2505 > use C4::Auth; > use CGI qw ( -utf8 ); > use C4::Context; >@@ -27,27 +28,28 @@ use C4::Context; > use C4::Search; > use C4::Output; > >-sub plugin_javascript { >- my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > my $res = " > <script type=\"text/javascript\"> > //<![CDATA[ > >-function Clic$function_name(i) { >- defaultvalue=document.getElementById(\"$field_number\").value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+function Click$function_name(i) { >+ defaultvalue=document.getElementById(\"$params->{id}\").value; >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader.pl&index=$params->{id}&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> > </script> > "; > >- return ( $function_name, $res ); >-} >+ return $res; >+}; > >-sub plugin { >- my ($input) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; > my $index = $input->param('index'); > my $result = $input->param('result'); > >@@ -84,4 +86,6 @@ sub plugin { > "f19$f19" => 1, > ); > output_html_with_http_headers $input, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_leader_computerfile.pl b/cataloguing/value_builder/marc21_leader_computerfile.pl >index 9dc90c7..d47cf36 100755 >--- a/cataloguing/value_builder/marc21_leader_computerfile.pl >+++ b/cataloguing/value_builder/marc21_leader_computerfile.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,9 +19,8 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >+use Modern::Perl; > >-#use warnings; FIXME - Bug 2505 > use C4::Auth; > use CGI qw ( -utf8 ); > use C4::Context; >@@ -27,27 +28,28 @@ use C4::Context; > use C4::Search; > use C4::Output; > >-sub plugin_javascript { >- my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > my $res = " > <script type=\"text/javascript\"> > //<![CDATA[ > >-function Clic$function_name(i) { >- defaultvalue=document.getElementById(\"$field_number\").value; >- newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader.pl&index=$field_number&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); >+function Click$function_name(i) { >+ defaultvalue=document.getElementById(\"$params->{id}\").value; >+ newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader.pl&index=$params->{id}&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } > //]]> > </script> > "; > >- return ( $function_name, $res ); >-} >+ return $res; >+}; > >-sub plugin { >- my ($input) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; > my $index = $input->param('index'); > my $result = $input->param('result'); > >@@ -84,4 +86,6 @@ sub plugin { > "f19$f19" => 1, > ); > output_html_with_http_headers $input, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_leader_video.pl b/cataloguing/value_builder/marc21_leader_video.pl >index 7edc5f6..a52a0c6 100755 >--- a/cataloguing/value_builder/marc21_leader_video.pl >+++ b/cataloguing/value_builder/marc21_leader_video.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -17,9 +19,8 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >+use Modern::Perl; > >-#use warnings; FIXME - Bug 2505 > use C4::Auth; > use CGI qw ( -utf8 ); > use C4::Context; >@@ -27,15 +28,15 @@ use C4::Context; > use C4::Search; > use C4::Output; > >-sub plugin_javascript { >- my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > my $res = " > <script type=\"text/javascript\"> > //<![CDATA[ > >-function Clic$function_name(i) { >- defaultvalue=document.getElementById(\"$field_number\").value; >+function Click$function_name(i) { >+ defaultvalue=document.getElementById(\"$params->{id}\").value; > newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_leader.pl&index=\"+i+\"&result=\"+defaultvalue,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); > > } >@@ -43,11 +44,12 @@ function Clic$function_name(i) { > </script> > "; > >- return ( $function_name, $res ); >-} >+ return $res; >+}; > >-sub plugin { >- my ($input) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $input = $params->{cgi}; > my $index = $input->param('index'); > my $result = $input->param('result'); > >@@ -84,4 +86,6 @@ sub plugin { > "f19$f19" => 1, > ); > output_html_with_http_headers $input, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >diff --git a/cataloguing/value_builder/marc21_linking_section.pl b/cataloguing/value_builder/marc21_linking_section.pl >index f53ed2a..54909ba 100644 >--- a/cataloguing/value_builder/marc21_linking_section.pl >+++ b/cataloguing/value_builder/marc21_linking_section.pl >@@ -1,5 +1,7 @@ > #!/usr/bin/perl > >+# Converted to new plugin style (Bug 13437) >+ > # Copyright Biblibre 2007 - CILEA 2011 > # > # This file is part of Koha. >@@ -17,8 +19,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI qw ( -utf8 ); > use C4::Output; >@@ -33,24 +34,25 @@ use MARC::Record; > use C4::Branch; > use C4::ItemType; > >-sub plugin_javascript { >- my ( $dbh, $record, $tagslib, $field_number, $tabloop ) = @_; >- my $function_name = $field_number; >+my $builder = sub { >+ my ( $params ) = @_; >+ my $function_name = $params->{id}; > my $res = " > <script type='text/javascript'> >- function Clic$function_name(i) { >- defaultvalue=document.getElementById(\"$field_number\").value; >+ function Click$function_name(i) { >+ defaultvalue=document.getElementById(\"$params->{id}\").value; > window.open(\"/cgi-bin/koha/cataloguing/plugin_launcher.pl?plugin_name=marc21_linking_section.pl&index=\" + i + \"&result=\"+defaultvalue,\"marc21_field_7\"+i+\"\",'width=900,height=700,toolbar=false,scrollbars=yes'); > > } > </script> > "; > >- return ( $function_name, $res ); >-} >+ return $res; >+}; > >-sub plugin { >- my ($query) = @_; >+my $launcher = sub { >+ my ( $params ) = @_; >+ my $query = $params->{cgi}; > my $dbh = C4::Context->dbh; > my $op = $query->param('op'); > # -- op could be equal to >@@ -311,4 +313,6 @@ sub plugin { > ); > } > output_html_with_http_headers $query, $cookie, $template->output; >-} >+}; >+ >+return { builder => $builder, launcher => $launcher }; >\ No newline at end of file >-- >1.7.9.5
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 13437
:
39093
|
39095
|
39140
|
39141
|
39142
|
39177
|
39184
|
39193
|
39194
|
39195
|
39196
|
39371
|
39372
|
39373
|
39374
|
39375
|
39949
|
39950
|
39951
|
39952
|
39953