Add an "Apply full authority" option to the MARC editor
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 20 Dec 2010 04:38:35 +0000 (04:38 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 20 Dec 2010 04:38:35 +0000 (04:38 +0000)
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

Open-ILS/xul/staff_client/server/cat/marcedit.js
Open-ILS/xul/staff_client/server/locale/en-US/cat.properties

index e446ffa..f1f6ad2 100644 (file)
@@ -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 <miker@esilibrary.com> 
+ *
+ * Copyright (C) 2010 Dan Scott <dan@coffeecode.net>
+ * Copyright (C) 2010 Internationaal Instituut voor Sociale Geschiedenis <info@iisg.nl>
+ *
+ * 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;
                       }
                     }
index 68f5f25..9181ba2 100644 (file)
@@ -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