From 313e646c476fb643a272a931b6a7a093b5045429 Mon Sep 17 00:00:00 2001 From: Jesse Weaver Date: Tue, 23 Jun 2015 16:24:17 -0600 Subject: [PATCH] Bug 11559: (followup) Fill in default values, fix redirect and UNIMARC This fixes the following issues: * Help for UNIMARC tags broken * MARC21 resources loaded when in UNIMARC * Clicking on "advanced editor" in basic editor fails * Shift-Tab goes to the beginning of a fixed-field widget rather than the end --- koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js | 4 ++-- koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js | 2 +- koha-tmpl/intranet-tmpl/lib/koha/cateditor/resources.js | 8 ++++++-- koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc | 3 ++- koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js index 7827f60..29287f7 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js @@ -156,7 +156,7 @@ define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin record.addFieldGrouped( newField ); if ( tagnum < '010' ) { - newField.addSubfield( [ '@', '' ] ); + newField.addSubfield( [ '@', (taginfo.subfields[0] ? taginfo.subfields[0][1].defaultvalue : null ) || '' ] ); return; } } @@ -167,7 +167,7 @@ define( [ '/cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=defin if ( subfieldinfo.mandatory != "1" && !allTags ) return; $.each( fields, function( undef, field ) { - if ( !field.hasSubfield(subfieldcode) ) field.addSubfieldGrouped( [ subfieldcode, '' ] ); + if ( !field.hasSubfield(subfieldcode) ) field.addSubfieldGrouped( [ subfieldcode, subfieldinfo.defaultvalue || '' ] ); } ); } ); } ); diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js index bc79eb6..9ee3872 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/marc-editor.js @@ -172,7 +172,7 @@ define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ], for ( var i = positions.length - 1; i >= 0; i-- ) { if ( positions[i].ch < cur.ch ) { - activateTabPosition( cm, positions[i] ); + activateTabPosition( cm, positions[i], -1 ); return false; } } diff --git a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/resources.js b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/resources.js index 5be97d6..24d8cab 100644 --- a/koha-tmpl/intranet-tmpl/lib/koha/cateditor/resources.js +++ b/koha-tmpl/intranet-tmpl/lib/koha/cateditor/resources.js @@ -31,8 +31,12 @@ define( [ 'module' ], function( module ) { _allResources.push(deferred); } - _res( 'marc21/xml/006', $.get( module.config().themelang + '/data/marc21_field_006.xml' ) ); - _res( 'marc21/xml/008', $.get( module.config().themelang + '/data/marc21_field_008.xml' ) ); + switch ( module.config().marcflavour ) { + case 'MARC21': + _res( 'marc21/xml/006', $.get( module.config().themelang + '/data/marc21_field_006.xml' ) ); + _res( 'marc21/xml/008', $.get( module.config().themelang + '/data/marc21_field_008.xml' ) ); + break; + } return Resources; } ); diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc index f6975ba..9a579af 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc @@ -7,6 +7,7 @@ require.config( { baseUrl: '/intranet-tmpl/lib/koha/cateditor/', config: { resources: { + marcflavour: '[% marcflavour %]', themelang: '[% themelang %]', }, }, @@ -179,7 +180,7 @@ require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr var first = tag[0]; var url = "http://archive.ifla.org/VI/3/p1996-1/uni" + first + ".htm#"; if ( first == '0' ) url += "b"; - if ( first != '9' ) url += field; + if ( first != '9' ) url += tag; return url; } 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 c370034..a4c6945 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -116,7 +116,7 @@ var biblionumber = [% biblionumber || "null" %]; if ( biblionumber ) { - window.location = '/cgi-bin/koha/cataloguing/editor.pl#catalog:' + biblionumber; + window.location = '/cgi-bin/koha/cataloguing/editor.pl#catalog/' + biblionumber; } else { window.location = '/cgi-bin/koha/cataloguing/editor.pl'; } -- 2.1.4