From: dbs Date: Mon, 20 Dec 2010 04:38:35 +0000 (+0000) Subject: Add an "Apply full authority" option to the MARC editor X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=88f0722b1954d460c8077d3049c1b57f97690443;p=evergreen%2Fmasslnc.git Add an "Apply full authority" option to the MARC editor By definition, the only subfields that should be applied from an authority record to a bibliographic record are the complete set from the 1XX field of the authority record. So, rather than forcing the user to select the correct subfields from the chosen authority record, give them this handy shortcut to do the right thing. Also, add copyright / licensing header - hopefully accurate. git-svn-id: svn://svn.open-ils.org/ILS/trunk@19023 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index e446ffaf56..f1f6ad204a 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -1,4 +1,23 @@ -// vim: et:sw=4:ts=4: +/* vim: et:sw=4:ts=4: + * + * Copyright (C) 2004-2008 Georgia Public Library Service + * Copyright (C) 2008-2010 Equinox Software, Inc. + * Mike Rylander + * + * Copyright (C) 2010 Dan Scott + * Copyright (C) 2010 Internationaal Instituut voor Sociale Geschiedenis + * + * This program 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 2 + * of the License, or (at your option) any later version. + * + * This program 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. + * + */ var xmlDeclaration = /^<\?xml version[^>]+?>/; var serializer = new XMLSerializer(); @@ -1916,9 +1935,18 @@ function getAuthorityContextMenu (target, sf) { return true; } -function applyAuthority ( target, ui_sf, e4x_sf ) { +/* Apply the complete 1xx */ +function applyFullAuthority ( target, ui_sf, e4x_sf ) { + var new_vals = dojo.query('*[tag^="1"]', target); + return applyAuthority( target, ui_sf, e4x_sf, new_vals ); +} +function applySelectedAuthority ( target, ui_sf, e4x_sf ) { var new_vals = target.getElementsByAttribute('checked','true'); + return applyAuthority( target, ui_sf, e4x_sf, new_vals ); +} + +function applyAuthority ( target, ui_sf, e4x_sf, new_vals ) { var field = e4x_sf.parent(); for (var i = 0; i < new_vals.length; i++) { @@ -2488,7 +2516,20 @@ function browseAuthority (sf_popup, menu_id, target, sf, limit, page) { createMenuitem( { label : $('catStrings').getString('staff.cat.marcedit.apply_selected.label'), command : function (event) { - applyAuthority(event.target.previousSibling, target, sf); + applySelectedAuthority(event.target.previousSibling, target, sf); + return true; + } + } + ) + ); + + popup.appendChild( createComplexXULElement( 'menuseparator' ) ); + + popup.appendChild( + createMenuitem( + { label : $('catStrings').getString('staff.cat.marcedit.apply_full.label'), + command : function (event) { + applyFullAuthority(event.target.previousSibling.previousSibling.previousSibling, target, sf); return true; } } diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties index 68f5f25485..9181ba2e17 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/cat.properties @@ -241,6 +241,7 @@ staff.cat.marcedit.replace_006.label=Add/Replace 006 staff.cat.marcedit.replace_007.label=Add/Replace 007 staff.cat.marcedit.replace_008.label=Add/Replace 008 staff.cat.marcedit.not_authority_field.label=Not a controlled subfield +staff.cat.marcedit.apply_full.label=Apply Full Authority (1XX) staff.cat.marcedit.apply_selected.label=Apply Selected staff.cat.marcedit.no_authority_match.label=No matching authority records found staff.cat.marcedit.next_page.label=Next page