Bugzilla – Attachment 37950 Details for
Bug 10480
Improvements for framework plugins in cataloguing/item editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 10480: Use the framework plugin object in cataloguing
PASSED-QA-Bug-10480-Use-the-framework-plugin-objec.patch (text/plain), 34.24 KB, created by
Kyle M Hall (khall)
on 2015-04-16 11:42:36 UTC
(
hide
)
Description:
[PASSED QA] Bug 10480: Use the framework plugin object in cataloguing
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2015-04-16 11:42:36 UTC
Size:
34.24 KB
patch
obsolete
>From 504420fb344ef6e20aca55e4fea6f225cae93da1 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 20 Oct 2014 12:36:36 +0200 >Subject: [PATCH] [PASSED QA] Bug 10480: Use the framework plugin object in cataloguing > >This patch implements the use of Koha::FrameworkPlugin in Cataloguing, >Authorities, Acquisition, Serials and Tools. > >The main change is architectural: see the commit message of the previous >patch. No changes in behavior are expected, but the support of new events >may provide additional functionality in the future. Some small bugs are >resolved along the way. > >The change primarily focuses on the MARC and items editor in Cataloguing. >But the MARC editor for Authorities and the item editor in Acquisition, >Serials and Tools are touched too. This commit message gives some comments >per module. > >NOTE FOR CATALOGUING: >A new plugin without popup (or other click event code) now shows the title >No popup when hovering over the tag editor image. The image alerts the >user on a plugin, the title tells about its status. The noclick property >allows for further style modifications in the template. Note that a >follow-up patch will clean up the old style plugins too with the same >effect. > >Some additional code in cataloging.js makes it possible to clone subfields >with plugins (although only theoretically useful). The clones use the >same javascript functions but event.data contains an updated id. >This effectively resolves bug 13306. Note that if old plugins do not use >the javascript parameter for the id but the perl variable, cloning does >still operate on the wrong field (with and without this patch set). > >In the absence of report 12176 in master, it is not yet necessary to modify >additem.tt. When it gets pushed, it should be an easy rebase. >New style item plugins will no longer need an extra parameter. (The code in >the FrameworkPlugin object actually takes care of that.) > >NOTE FOR AUTHORITIES: >This patch also adds class name tag_editor to the buttonDot anchors. This >effectively makes the same tag editor image appear as in Cataloguing. >Futhermore it removes the button from the tab sequence if there is no click >event (really effective after conversion to the new style, since the old >style plugins contain empty onclicks and launchers). >Both small adjustments increase consistency between auth and bib edits. > >NOTE FOR ACQUISITION: >In Acquisition two scripts use an item editor, but in a different way. >The scripts addorderiso2709 and neworderempty both rely on the routine >PrepareItemrecordDisplay in C4::Items, but neworderempty creates item >blocks dynamically via an ajax call to services/itemrecorddisplay.pl. > >In order to make the dynamic item blocks work with plugins, some code >changes were needed in additem.js. (Normally the event binding is done >at document ready time; now it must be done later.) > >At this moment the routine in Items.pm contains the html tags, and this >makes changes to the following templates not necessary for now: >* acqui/addorderiso2709.tt >* services/itemrecorddisplay.tt >Report 13397 has been opened to address moving the html to the templates. > >NOTE FOR SERIALS: >Script serial-edit relies also on C4::Items (just as in Acquisition). >This makes changes to serials/serials-edit.tt not necessary for now. > >NOTE FOR TOOLS: >The current code in tools/batchMod.pl allows the use of plugins for batch >modification of items. This patch just converts that code to use the new >object. Most item plugins however may not be very useful for operating on >multiple items at once. > >PERFORMANCE: >I have benchmarked build_tabs in addbiblio to see how especially the >additional processing of the javascript in the FrameworkPlugin object >would impact performance. Testing default MARC21 framework with 8 plugins >gave the following figures: >- Old situation: 851 ms >- New situation: 942 ms (+10,7%) >- New situation after plugin cleanup: 881 ms (+3,4%) >Note also that adding lines for event binding is compensated by removing >lines for unused events. Page load should essentially be the same. > >TEST PLAN: >Suggestion: If you also apply the next patch with the EXAMPLE plugin, you >can test with a rather harmless plugin (with popup) on various places :) >But your test should also include old style plugins, with[out] popups. > >If you want to test a new plugin without popup, rename/remove Click$id >in the javascript code of the $builder definition (temporarily). > >[1] Test Cataloguing: > - Add/Edit biblio. Try plugins with and without popup. > - Add/Edit items. (EXAMPLE can be used as an item plugin with popup.) > - Clone a subfield with plugin (use EXAMPLE): Verify that the plugin > works on both original and clone with the respective field values. > Is the value put back in the right field too? >[2] Test Authorities: > Edit an authority record. Try plugins with an without popup. >[3] Test Acquisition: > Set system preference AcqCreateItem to "placing an order". > Check the item editor in the following two places: > a- addorderiso2709: Open a basket, add an order from a staged file. > Select a file, click Add orders, and go to tab Item information. > b- neworderempty: Open a basket, add an order from a new empty record. >[4] Test Serials: > Check the item editor on serials-edit. Go to subscription detail. > Click Receive. Choose "Click to add item". (Note that this subscription > should create an item record when receiving this serial.) >[5] Test Tools: > Check the item editor for batch item modification. Enter a few valid > barcodes and press Continue to reach the item editor. > >Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Items.pm | 33 ++++++----- > authorities/authorities.pl | 56 ++++++++++---------- > cataloguing/addbiblio.pl | 39 +++++-------- > cataloguing/additem.pl | 38 ++++++------- > cataloguing/plugin_launcher.pl | 23 +++------ > koha-tmpl/intranet-tmpl/prog/en/js/additem.js | 14 +++++ > koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js | 49 ++++++++++++------ > .../prog/en/modules/authorities/authorities.tt | 8 ++- > .../prog/en/modules/cataloguing/addbiblio.tt | 10 +++- > .../prog/en/modules/tools/batchMod-edit.tt | 8 ++- > tools/batchMod.pl | 30 +++++----- > 11 files changed, 169 insertions(+), 139 deletions(-) > >diff --git a/C4/Items.pm b/C4/Items.pm >index 22a8bc2..f443d38 100644 >--- a/C4/Items.pm >+++ b/C4/Items.pm >@@ -3022,21 +3022,24 @@ sub PrepareItemrecordDisplay { > labels => \%authorised_lib, > }; > } elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { >- # opening plugin >- my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; >- if (do $plugin) { >- my $extended_param = plugin_parameters( $dbh, undef, $tagslib, $subfield_data{id}, undef ); >- my ( $function_name, $javascript ) = plugin_javascript( $dbh, undef, $tagslib, $subfield_data{id}, undef ); >- $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? >- $subfield_data{marc_value} = qq[<input type="text" tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" >- onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');" >- onblur=" Blur$function_name($subfield_data{random}, '$subfield_data{id}');" /> >- <a href="#" class="buttonDot" onclick="Clic$function_name('$subfield_data{id}'); return false;" title="Tag Editor">...</a> >- $javascript]; >- } else { >- warn "Plugin Failed: $plugin"; >- $subfield_data{marc_value} = qq(<input type="text" tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" />); # supply default input form >- } >+ # it is a plugin >+ require Koha::FrameworkPlugin; >+ my $plugin = Koha::FrameworkPlugin->new({ >+ name => $tagslib->{$tag}->{$subfield}->{value_builder}, >+ item_style => 1, >+ }); >+ my $pars = { dbh => $dbh, record => undef, tagslib =>$tagslib, id => $subfield_data{id}, tabloop => undef }; >+ $plugin->build( $pars ); >+ if( !$plugin->errstr ) { >+ #TODO Move html to template; see report 12176/13397 >+ my $tab= $plugin->noclick? '-1': ''; >+ my $class= $plugin->noclick? ' disabled': ''; >+ my $title= $plugin->noclick? 'No popup': 'Tag editor'; >+ $subfield_data{marc_value} = qq[<input type="text" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" /><a href="#" id="buttonDot_$subfield_data{id}" tabindex="$tab" class="buttonDot $class" title="$title">...</a>\n].$plugin->javascript; >+ } else { >+ warn $plugin->errstr; >+ $subfield_data{marc_value} = qq(<input type="text" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" />); # supply default input form >+ } > } > elsif ( $tag eq '' ) { # it's an hidden field > $subfield_data{marc_value} = qq(<input type="hidden" tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="50" maxlength="255" value="$defaultvalue" />); >diff --git a/authorities/authorities.pl b/authorities/authorities.pl >index f9a79ad..88eb156 100755 >--- a/authorities/authorities.pl >+++ b/authorities/authorities.pl >@@ -212,37 +212,37 @@ sub create_input { > value => $value, > authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode}, > }; >- # it's a plugin field > } >- elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) { >- >- # opening plugin. Just check whether we are on a developer computer on a production one >- # (the cgidir differs) >- my $cgidir = C4::Context->intranetdir . "/cgi-bin/cataloguing/value_builder"; >- unless (-r $cgidir and -d $cgidir) { >- $cgidir = C4::Context->intranetdir . "/cataloguing/value_builder"; >+ elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) { # plugin >+ require Koha::FrameworkPlugin; >+ my $plugin = Koha::FrameworkPlugin->new({ >+ name => $tagslib->{$tag}->{$subfield}->{'value_builder'}, >+ }); >+ my $pars= { dbh => $dbh, record => $rec, tagslib =>$tagslib, >+ id => $subfield_data{id}, tabloop => $tabloop }; >+ $plugin->build( $pars ); >+ if( !$plugin->errstr ) { >+ $subfield_data{marc_value} = { >+ type => 'text2', >+ id => $subfield_data{id}, >+ name => $subfield_data{id}, >+ value => $value, >+ maxlength => $max_length, >+ javascript => $plugin->javascript, >+ noclick => $plugin->noclick, >+ }; >+ } else { # warn and supply default field >+ warn $plugin->errstr; >+ $subfield_data{marc_value} = { >+ type => 'text', >+ id => $subfield_data{id}, >+ name => $subfield_data{id}, >+ value => $value, >+ maxlength => $max_length, >+ }; > } >- my $plugin = $cgidir . "/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; >- do $plugin || die "Plugin Failed: ".$plugin; >- my $extended_param; >- eval{ >- $extended_param = plugin_parameters( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop ); >- }; >- my ( $function_name, $javascript ) = plugin_javascript( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop ); >-# my ( $function_name, $javascript,$extended_param ); >- >- $subfield_data{marc_value} = { >- type => 'text2', >- id => $subfield_data{id}, >- name => $subfield_data{id}, >- value => $value, >- maxlength => $max_length, >- function => $function_name, >- index_tag => $index_tag, >- javascript => $javascript, >- }; >- # it's an hidden field > } >+ # it's an hidden field > elsif ( $tag eq '' ) { > $subfield_data{marc_value} = { > type => 'hidden', >diff --git a/cataloguing/addbiblio.pl b/cataloguing/addbiblio.pl >index 9013a4e..ecc87f2 100755 >--- a/cataloguing/addbiblio.pl >+++ b/cataloguing/addbiblio.pl >@@ -391,21 +391,15 @@ sub create_input { > }; > > # it's a plugin field >- } >- elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) { >- >- # opening plugin. Just check whether we are on a developer computer on a production one >- # (the cgidir differs) >- my $cgidir = C4::Context->intranetdir . "/cgi-bin/cataloguing/value_builder"; >- unless ( opendir( DIR, "$cgidir" ) ) { >- $cgidir = C4::Context->intranetdir . "/cataloguing/value_builder"; >- closedir( DIR ); >- } >- my $plugin = $cgidir . "/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; >- if (do $plugin) { >- my $extended_param = plugin_parameters( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop ); >- my ( $function_name, $javascript ) = plugin_javascript( $dbh, $rec, $tagslib, $subfield_data{id}, $tabloop ); >- >+ } elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) { >+ require Koha::FrameworkPlugin; >+ my $plugin = Koha::FrameworkPlugin->new( { >+ name => $tagslib->{$tag}->{$subfield}->{'value_builder'}, >+ }); >+ my $pars= { dbh => $dbh, record => $rec, tagslib => $tagslib, >+ id => $subfield_data{id}, tabloop => $tabloop }; >+ $plugin->build( $pars ); >+ if( !$plugin->errstr ) { > $subfield_data{marc_value} = { > type => 'text_complex', > id => $subfield_data{id}, >@@ -413,13 +407,11 @@ sub create_input { > value => $value, > size => 67, > maxlength => $subfield_data{maxlength}, >- function_name => $function_name, >- index_tag => $index_tag, >- javascript => $javascript, >+ javascript => $plugin->javascript, >+ noclick => $plugin->noclick, > }; >- > } else { >- warn "Plugin Failed: $plugin"; >+ warn $plugin->errstr; > # supply default input form > $subfield_data{marc_value} = { > type => 'text', >@@ -430,11 +422,10 @@ sub create_input { > maxlength => $subfield_data{maxlength}, > readonly => 0, > }; >- > } >- # it's an hidden field >- } >- elsif ( $tag eq '' ) { >+ >+ # it's an hidden field >+ } elsif ( $tag eq '' ) { > $subfield_data{marc_value} = { > type => 'hidden', > id => $subfield_data{id}, >diff --git a/cataloguing/additem.pl b/cataloguing/additem.pl >index 6ff3bbd..0e8f2ef 100755 >--- a/cataloguing/additem.pl >+++ b/cataloguing/additem.pl >@@ -120,7 +120,6 @@ sub generate_subfield_form { > > $subfield_data{tag} = $tag; > $subfield_data{subfield} = $subfieldtag; >- $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? > $subfield_data{marc_lib} ="<span id=\"error$i\" title=\"".$subfieldlib->{lib}."\">".$subfieldlib->{lib}."</span>"; > $subfield_data{mandatory} = $subfieldlib->{mandatory}; > $subfield_data{repeatable} = $subfieldlib->{repeatable}; >@@ -267,25 +266,24 @@ sub generate_subfield_form { > "; > } > # it's a plugin field >- elsif ( $subfieldlib->{value_builder} ) { >- # opening plugin >- my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $subfieldlib->{'value_builder'}; >- if (do $plugin) { >- my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, $loop_data ); >- my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, $loop_data ); >- my $change = index($javascript, 'function Change') > -1 ? >- "return Change$function_name($subfield_data{random}, '$subfield_data{id}');" : >- 'return 1;'; >- $subfield_data{marc_value} = qq[<input type="text" $attributes >- onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');" >- onchange=" $change" >- onblur=" Blur$function_name($subfield_data{random}, '$subfield_data{id}');" /> >- <a href="#" class="buttonDot" onclick="Clic$function_name('$subfield_data{id}'); return false;" title="Tag Editor">...</a> >- $javascript]; >- } else { >- warn "Plugin Failed: $plugin"; >- $subfield_data{marc_value} = "<input type=\"text\" $attributes />"; # supply default input form >- } >+ elsif ( $subfieldlib->{value_builder} ) { # plugin >+ require Koha::FrameworkPlugin; >+ my $plugin = Koha::FrameworkPlugin->new({ >+ name => $subfieldlib->{'value_builder'}, >+ item_style => 1, >+ }); >+ my $pars= { dbh => $dbh, record => $temp, tagslib =>$tagslib, >+ id => $subfield_data{id}, tabloop => $loop_data }; >+ $plugin->build( $pars ); >+ if( !$plugin->errstr ) { >+ #TODO Report 12176 will make this even better ! >+ my $class= 'buttonDot'. ( $plugin->noclick? ' disabled': '' ); >+ my $title= $plugin->noclick? 'No popup': 'Tag editor'; >+ $subfield_data{marc_value} = qq[<input type="text" $attributes /><a href="#" id="buttonDot_$subfield_data{id}" class="$class" title="$title">...</a>\n].$plugin->javascript; >+ } else { >+ warn $plugin->errstr; >+ $subfield_data{marc_value} = "<input type=\"text\" $attributes />"; # supply default input form >+ } > } > elsif ( $tag eq '' ) { # it's an hidden field > $subfield_data{marc_value} = qq(<input type="hidden" $attributes />); >diff --git a/cataloguing/plugin_launcher.pl b/cataloguing/plugin_launcher.pl >index 50aeb32..ff4d60e 100755 >--- a/cataloguing/plugin_launcher.pl >+++ b/cataloguing/plugin_launcher.pl >@@ -1,6 +1,5 @@ > #!/usr/bin/perl > >- > # Copyright 2000-2002 Katipo Communications > # > # This file is part of Koha. >@@ -18,21 +17,13 @@ > # with Koha; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-use strict; >-#use warnings; FIXME - Bug 2505 >+use Modern::Perl; > use CGI qw ( -utf8 ); >-use C4::Context; >-use C4::Output; > >-my $input = new CGI; >-my $plugin_name="cataloguing/value_builder/".$input->param("plugin_name"); >+use Koha::FrameworkPlugin; > >-# opening plugin. Just check whether we are on a developer computer on a production one >-# (the cgidir differs) >-my $cgidir = C4::Context->intranetdir ."/cgi-bin"; >-my $vbdir = "$cgidir/cataloguing/value_builder"; >-unless (-r $vbdir and -d $vbdir) { >- $cgidir = C4::Context->intranetdir; >-} >-do $cgidir."/".$plugin_name; >-&plugin($input); >+my $input = new CGI; >+my $plugin= Koha::FrameworkPlugin->new( { >+ name => $input->param("plugin_name"), >+}); >+$plugin->launch({ cgi => $input }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js >index aa19155..de3ee71 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/additem.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/additem.js >@@ -161,10 +161,24 @@ function cloneItemBlock(index, unique_item_fields) { > }); > > $("#outeritemblock").append(clone); >+ BindPluginEvents(data); > } > }); > } > >+function BindPluginEvents(data) { >+// the script tag in data for plugins contains a document ready that binds >+// the events for the plugin >+// when we append, this code does not get executed anymore; so we do it here >+ var events= data.match(/BindEventstag_\d+_subfield_._\d+/g); >+ var i; >+ for(i=0; i<events.length; i++) { >+ window[events[i]](); >+ if( i<events.length-1 && events[i]==events[i+1] ) { i++; } >+ // normally we find the function name twice >+ } >+} >+ > function clearItemBlock(node) { > var index = $(node).closest("div").attr('id'); > var block = $("#"+index); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js >index 70ae6f9..9fa70a5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/cataloging.js >@@ -130,6 +130,10 @@ function CloneField(index, hideMarc, advancedMARCEditor) { > textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key); > } > } >+ if( $(inputs[1]).hasClass('framework_plugin') ) { >+ var oldcontrol= original.getElementsByTagName('input')[1]; >+ AddEventHandlers( oldcontrol,inputs[1],id_input ); >+ } > > if (advancedMARCEditor == '0') { > // when cloning a subfield, re set its label too. >@@ -172,13 +176,9 @@ function CloneField(index, hideMarc, advancedMARCEditor) { > if(buttonDot){ > // 2 possibilities : > try{ >- var buttonDotOnClick = buttonDot.getAttribute('onclick'); >- if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin >- var re = /\('.*'\)/i; >- buttonDotOnClick = buttonDotOnClick.replace(re,"('"+inputs[1].getAttribute('id')+"')"); >- if(buttonDotOnClick){ >- buttonDot.setAttribute('onclick',buttonDotOnClick); >- } >+ if( $(buttonDot).hasClass('framework_plugin') ) { >+ var oldcontrol= original.getElementsByTagName('a')[0]; >+ AddEventHandlers(oldcontrol,buttonDot,id_input); > } else { > if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value > var re1 = /&index=.*',/; >@@ -267,6 +267,11 @@ function CloneSubfield(index, advancedMARCEditor){ > inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key); > linkid = id_input; > } >+ // Plugin input >+ if( $(inputs[1]).hasClass('framework_plugin') ) { >+ var oldcontrol= original.getElementsByTagName('input')[1]; >+ AddEventHandlers( oldcontrol, inputs[1], linkid ); >+ } > > // select > for(var i=0,len=selects.length; i<len ; i++ ){ >@@ -282,16 +287,11 @@ function CloneSubfield(index, advancedMARCEditor){ > textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key); > } > >- // Changing the "..." link's onclick attribute for plugin callback >+ // Handle click event on buttonDot for plugin > var links = clone.getElementsByTagName('a'); >- var link = links[0]; >- var buttonDotOnClick = link.getAttribute('onclick'); >- if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin >- var re = /\('.*'\)/i; >- buttonDotOnClick = buttonDotOnClick.replace(re,"('"+linkid+"')"); >- if(buttonDotOnClick){ >- link.setAttribute('onclick',buttonDotOnClick); >- } >+ if( $(links[0]).hasClass('framework_plugin') ) { >+ var oldcontrol= original.getElementsByTagName('a')[0]; >+ AddEventHandlers( oldcontrol, links[0], linkid ); > } > > if(advancedMARCEditor == '0') { >@@ -325,6 +325,23 @@ function CloneSubfield(index, advancedMARCEditor){ > original.parentNode.insertBefore(clone,original.nextSibling); > } > >+function AddEventHandlers (oldcontrol, newcontrol, newinputid ) { >+// This function is a helper for CloneField and CloneSubfield. >+// It adds the event handlers from oldcontrol to newcontrol. >+// newinputid is the id attribute of the cloned controlling input field >+// Note: This code depends on the jQuery data for events; this structure >+// is moved to _data as of jQuery 1.8. >+ var ev= $(oldcontrol).data('events'); >+ if(typeof ev != 'undefined') { >+ $.each(ev, function(prop,val) { >+ $.each(val, function(prop2,val2) { >+ $(newcontrol).off( val2.type ); >+ $(newcontrol).on( val2.type, {id: newinputid}, val2.handler ); >+ }); >+ }); >+ } >+} >+ > /** > * This function removes or clears unwanted subfields > */ >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt >index 693b61e..31939b4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt >@@ -357,8 +357,12 @@ function confirmnotdup(redirect){ > <input type="text" id="[%- mv.id -%]" name="[%- mv.id -%]" value="[%- mv.value -%]" class="input_marceditor" tabindex="1" /> > <a href="#" class="buttonDot" onclick="openAuth(this.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtypecode -%]','auth'); return false;" tabindex="1" title="Tag editor">...</a> > [% ELSIF ( mv.type == 'text2' ) %] >- <input tabindex="1" type="text" id="[%- mv.id -%]" size="67" maxlength="[%- mv.maxlength -%]" name="[%- mv.id -%]" value="[%- mv.value -%]" class="input_marceditor" onfocus="Focus[%- mv.function -%]([%- mv.index_tag -%])" onblur="Blur[%- mv.function -%]([%- mv.index_tag -%]);" /> >- <a href="#" class="buttonDot" onclick="Clic[%- mv.function -%]('[%- mv.id -%]'); return false;" title="Tag editor">...</a> >+ <input type="text" id="[%- mv.id -%]" size="67" maxlength="[%- mv.maxlength -%]" name="[%- mv.name -%]" value="[%- mv.value -%]" class="input_marceditor" /> >+ [% IF mv.noclick %] >+ <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup">...</a> >+ [% ELSE %] >+ <a href="#" id="buttonDot_[% mv.id %]" class="buttonDot tag_editor" title="Tag editor">...</a> >+ [% END %] > [% mv.javascript %] > [% ELSIF ( mv.type == 'text' ) %] > <input type="text" id="[%- mv.id -%]" name="[%- mv.name -%]" value="[%- mv.value -%]" class="input_marceditor" tabindex="1" size="67" maxlength="[%- mv.maxlength -%]" /> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >index c530ce0..7c6b48d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt >@@ -626,7 +626,15 @@ function Changefwk(FwkList) { > <span class="subfield_controls"><a href="#" class="buttonDot tag_editor" onclick="openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'[%- mv.authtype -%]','biblio'); return false;" tabindex="1" title="Tag editor">Tag editor</a></span> > [% END %] > [% ELSIF ( mv.type == 'text_complex' ) %] >- <input type="text" id="[%- mv.id -%]" name="[%- mv.name -%]" value="[%- mv.value -%]" class="input_marceditor" tabindex="1" size="[%- mv.size -%]" maxlength="[%- mv.maxlength -%]" onfocus="Focus[%- mv.function_name -%]([%- mv.index_tag -%])" onblur="Blur[%- mv.function_name -%]([%- mv.index_tag -%])" /><span class="subfield_controls"><a href="#" class="buttonDot tag_editor" onclick="Clic[%- mv.function_name -%]('[%- mv.id -%]'); return false;" tabindex="1" title="Tag editor">Tag editor</a></span>[% mv.javascript %] >+ <input type="text" id="[%- mv.id -%]" name="[%- mv.name -%]" value="[%- mv.value -%]" class="input_marceditor framework_plugin" tabindex="1" size="[%- mv.size -%]" maxlength="[%- mv.maxlength -%]" /> >+ <span class="subfield_controls"> >+ [% IF mv.noclick %] >+ <a href="#" class="buttonDot tag_editor disabled" tabindex="-1" title="No popup"></a> >+ [% ELSE %] >+ <a href="#" id="buttonDot_[% mv.id %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor">Tag editor</a> >+ [% END %] >+ </span> >+ [% mv.javascript %] > [% ELSIF ( mv.type == 'hidden' ) %] > <input tabindex="1" type="hidden" id="[%- mv.id -%]" name="[%- mv.name -%]" size="[%- mv.size -%]" maxlength="[%- mv.maxlength -%]" value="[%- mv.value -%]" /> > [% ELSIF ( mv.type == 'textarea' ) %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >index ab9c2de..38a76ce 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt >@@ -193,8 +193,12 @@ $(document).ready(function(){ > <input type="text" tabindex="1" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value -%]" /> > <a href="#" class="buttonDot" onclick="Dopop('/cgi-bin/koha/authorities/auth_finder.pl?authtypecode=[%- mv.authtypecode -%]&index=[%- mv.id -%]','[%- mv.id -%]'); return false;" title="Tag editor">...</a> > [% ELSIF ( mv.type == 'text2' ) %] >- <input type="text" tabindex="1" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value -%]" onfocus="Focus[%- mv.function -%]([%- mv.random -%], '[%- mv.id -%]');" onblur=" Blur[%- mv.function -%]([%- mv.random -%], '[%- mv.id -%]');" /> >- <a href="#" class="buttonDot" onclick="Clic[%- mv.function -%]('[%- mv.id -%]'); return false;" title="Tag editor">...</a> >+ <input type="text" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value -%]" /> >+ [% IF mv.noclick %] >+ <a href="#" class="buttonDot disabled" title="No popup">...</a> >+ [% ELSE %] >+ <a href="#" id="buttonDot_[% mv.id %]" class="buttonDot" title="Tag editor">...</a> >+ [% END %] > [% mv.javascript %] > [% ELSIF ( mv.type == 'text' ) %] > <input type="text" tabindex="1" id="[%- mv.id -%]" name="field_value" class="input_marceditor" size="50" maxlength="255" value="[%- mv.value -%]" /> >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 4ff95e8..afb0abc 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -326,8 +326,6 @@ foreach my $tag (sort keys %{$tagslib}) { > } > $subfield_data{tag} = $tag; > $subfield_data{subfield} = $subfield; >- $subfield_data{random} = int(rand(1000000)); # why do we need 2 different randoms? >- # $subfield_data{marc_lib} = $tagslib->{$tag}->{$subfield}->{lib}; > $subfield_data{marc_lib} ="<span id=\"error$i\" title=\"".$tagslib->{$tag}->{$subfield}->{lib}."\">".$tagslib->{$tag}->{$subfield}->{lib}."</span>"; > $subfield_data{mandatory} = $tagslib->{$tag}->{$subfield}->{mandatory}; > $subfield_data{repeatable} = $tagslib->{$tag}->{$subfield}->{repeatable}; >@@ -411,26 +409,28 @@ foreach my $tag (sort keys %{$tagslib}) { > value => $value, > authtypecode => $tagslib->{$tag}->{$subfield}->{authtypecode}, > } >- # it's a plugin field > } >- elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { >- # opening plugin >- my $plugin = C4::Context->intranetdir . "/cataloguing/value_builder/" . $tagslib->{$tag}->{$subfield}->{'value_builder'}; >- if (do $plugin) { >- my $temp; >- my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); >- my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data ); >+ elsif ( $tagslib->{$tag}->{$subfield}->{value_builder} ) { # plugin >+ require Koha::FrameworkPlugin; >+ my $plugin = Koha::FrameworkPlugin->new( { >+ name => $tagslib->{$tag}->{$subfield}->{'value_builder'}, >+ item_style => 1, >+ }); >+ my $temp; >+ my $pars= { dbh => $dbh, record => $temp, tagslib => $tagslib, >+ id => $subfield_data{id}, tabloop => \@loop_data }; >+ $plugin->build( $pars ); >+ if( !$plugin->errstr ) { > $subfield_data{marc_value} = { > type => 'text2', > id => $subfield_data{id}, > value => $value, >- function => $function_name, >- random => $subfield_data{random}, >- javascript => $javascript, >+ javascript => $plugin->javascript, >+ noclick => $plugin->noclick, > }; > } else { >- warn "Plugin Failed: $plugin"; >- $subfield_data{marc_value} = { # supply default input form >+ warn $plugin->errstr; >+ $subfield_data{marc_value} = { # supply default input form > type => 'text', > id => $subfield_data{id}, > value => $value, >-- >1.7.2.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 10480
:
19064
|
19072
|
19098
|
19152
|
19154
|
19168
|
19169
|
34308
|
34309
|
34310
|
34311
|
34312
|
35187
|
35188
|
35189
|
35190
|
35191
|
35286
|
35287
|
36106
|
36107
|
36108
|
36109
|
36110
|
36953
|
36954
|
36955
|
36956
|
36957
|
37948
|
37949
| 37950 |
37951
|
37952
|
37953
|
37983