[open-ils-commits] [GIT] Evergreen ILS branch master updated. 9836fe817670d0b82057e13f805b9fba2fad2755

Evergreen Git git at git.evergreen-ils.org
Tue Aug 30 16:33:29 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  9836fe817670d0b82057e13f805b9fba2fad2755 (commit)
      from  817a79b3c110e278b560f0f88f4fcfd30faa91a4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9836fe817670d0b82057e13f805b9fba2fad2755
Author: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>
Date:   Tue Aug 30 16:28:20 2011 -0400

    Merge branch 'collab/miker/acs-ui-repairs' from working/Evergreen.git
    
    Use bib tag instead to find the correct ACS, instead of the static field map
    Use authority main entry instead of thesaurus to find the correct ACS
    Add method for finding an ACS by authority tag
    
    See https://bugs.launchpad.net/evergreen/+bug/837637
    
    Signed-off-by: Mike Rylander <mrylander at gmail.com>
    Signed-off-by: Lebbeous Fogle-Weekley <lebbeous at esilibrary.com>

diff --git a/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js b/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js
index 990583f..36ac521 100644
--- a/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js
+++ b/Open-ILS/web/js/dojo/openils/AuthorityControlSet.js
@@ -259,6 +259,26 @@ if(!dojo._hasResource["openils.AuthorityControlSet"]) {
             return acs_list;
         },
 
+        findControlSetsForAuthorityTag : function (tag) {
+            var me = this;
+            var old_acs = this.controlSetId();
+
+            var acs_list = dojo.filter(
+                me.controlSetList(),
+                function(acs_id) {
+                    var a = me.controlSet(acs_id);
+                    for (var btag in a.control_map) {
+                        for (var sf in a.control_map[btag]) {
+                            if (a.control_map[btag][sf][tag]) return true;
+                        }
+                    }
+                    return false;
+                }
+            );
+            this.controlSetId(old_acs);
+            return acs_list;
+        },
+
         bibToAuthority : function (field) {
             var b_field = this.bibFieldByTag(field.tag);
 
diff --git a/Open-ILS/web/opac/skin/default/js/authbrowse.js b/Open-ILS/web/opac/skin/default/js/authbrowse.js
index 1e58dd5..ff4c10d 100644
--- a/Open-ILS/web/opac/skin/default/js/authbrowse.js
+++ b/Open-ILS/web/opac/skin/default/js/authbrowse.js
@@ -156,6 +156,7 @@ function renderAuthorityRecord(m, control_set, auth_id) {
     var table = dojo.create("table", {"className": "authority-record"});
     var tbody = dojo.create("tbody", {"id": "authority_" + auth_id}, table);
 
+
     dojo.forEach(
         main_entries, function(af) { renderAuthorityMainEntry(m, af, tbody); }
     );
@@ -187,16 +188,20 @@ function displayAuthorityRecords(axis, doc) {
         function(record) {
             var m = new MARC.Record({"xml": record});
 
-            /* is 001 reliable for this? I'm guessing not */
-            var auth_id = m.field("001").data;
+            var auth_id = m.subfield("901","c")[1];
             auth_ids.push(auth_id);
 
-            var cs = acs_helper.controlSetByThesaurusCode(
-                m.extractFixedField("Subj")
-            );
+            /* best guess */
+            var t = m.field(/^1/);
+            if (dojo.isArray(t)) t = t[0];
+
+            var cs = acs_helper.findControlSetsForAuthorityTag( t.tag );
+            if (dojo.isArray(cs)) cs = cs[0];
+
+            acs_helper.controlSetId( cs );
 
             dojo.place(
-                renderAuthorityRecord(m, cs.raw, auth_id),
+                renderAuthorityRecord(m, acs_helper.controlSet().raw, auth_id),
                 "authority-record-holder"
             );
         }
diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js
index 7ea4e04..6a8680b 100644
--- a/Open-ILS/xul/staff_client/server/cat/marcedit.js
+++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js
@@ -1928,11 +1928,23 @@ function summarizeField(sf) {
     source_f.ind1 = sf.parent(). at ind1.toString();
     source_f.ind1 = sf.parent(). at ind2.toString();
 
+    var found_acs = [];
+    dojo.forEach( acs.controlSetList(), function (acs_id) {
+        if (acs.controlSet(acs_id).control_map[sf.parent(). at tag]) found_acs.push(acs_id);
+    });
+
+    var cmap;
+    if (!found_acs.length) {
+        return false;
+    } else {
+        cmap = acs.controlSet(found_acs[0]).control_map;
+    }
+
     for (var i = 0; i < sf.parent().subfield.length(); i++) {
         var sf_iter = sf.parent().subfield[i];
 
         /* Filter out subfields that are not controlled for this tag */
-        if (!control_map[source_f.tag][sf_iter. at code.toString()]) {
+        if (!cmap[source_f.tag][sf_iter. at code.toString()]) {
             continue;
         }
 

-----------------------------------------------------------------------

Summary of changes:
 .../web/js/dojo/openils/AuthorityControlSet.js     |   20 ++++++++++++++++++++
 Open-ILS/web/opac/skin/default/js/authbrowse.js    |   17 +++++++++++------
 Open-ILS/xul/staff_client/server/cat/marcedit.js   |   14 +++++++++++++-
 3 files changed, 44 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list