From 3d6f2b2add64535b26c0a30ef297eeddb4c06f0f Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Thu, 9 Aug 2012 18:25:00 -0400 Subject: [PATCH] Authorities: Fix broken UI due to new XUL/Dojo/regressions New versions of XUL, since Firefox 10, hate dojo.query("foo bar"), so we have to refactor it to use dojo.query("foo").query("bar") instead. At least until we upgrade to a new version of Dojo. In addition, 522d8d82 introduced a regression meaning that the text of the authorities was no longer wrapped in a SPAN element with a class of "text". That in turn meant that the Dojo queries weren't picking up the labels for the merge box, leaving no visual indication to the user as to what authorities exactly were being merged. So, repair that. Also, similar to a fix for the MFHD editor, set the initial height of the spawned MARC Editor for an authority record to something reasonable. Signed-off-by: Dan Scott --- Open-ILS/web/js/ui/default/cat/authority/list.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Open-ILS/web/js/ui/default/cat/authority/list.js b/Open-ILS/web/js/ui/default/cat/authority/list.js index 3f1c666a22..2bd19bff49 100644 --- a/Open-ILS/web/js/ui/default/cat/authority/list.js +++ b/Open-ILS/web/js/ui/default/cat/authority/list.js @@ -75,8 +75,8 @@ function displayAuthorities(data) { // Grab the ID of the authority record - dojo.query("datafield[tag='901'] subfield[code='c']", node).forEach(function(dfNode) { - auth.id = dojox.xml.parser.textContent(dfNode); + dojo.query("datafield[tag='901']", node).query("subfield[code='c']").forEach(function(dfNode) { + auth.id = dojox.xml.parser.textContent(dfNode); }); /* I wrap this in try/catch only because: @@ -98,7 +98,8 @@ function displayAuthorities(data) { // Create the authority record listing entry. XXX i18n dojo.place( '
' + - '
' + auth.text + '
' + + '
' + + '' + auth.text + '
' + '
Control Set: ' + fetch_control_set(auth.thesaurus).name() + ' (#' + @@ -120,7 +121,7 @@ function displayAuthorities(data) { // "Merge" menu item new dijit.MenuItem({"id": "merge_" + auth.id, "onClick":function(){ auth.text = ''; - dojo.query('#auth' + auth.id + ' span.text').forEach(function(node) { + dojo.query('#auth' + auth.id).query('span.text').forEach(function(node) { auth.text += dojox.xml.parser.textContent(node); }); @@ -153,7 +154,7 @@ function displayAuthorities(data) { var delDlg = dijit.byId("delDialog_" + auth.id); - dojo.query('#auth' + auth.id + ' span.text').forEach(function(node) { + dojo.query('#auth' + auth.id).query('span.text').forEach(function(node) { auth.text += dojo.trim(dojox.xml.parser.textContent(node)); }); @@ -277,11 +278,18 @@ function showBibCount(authIds) { } function loadMarcEditor(pcrud, rec) { + + /* Prevent the spawned MARC editor from making its title bar inaccessible */ + var initHeight = self.outerHeight - 40; + /* Setting an explicit height results in a super skinny window, so fix that up */ + var initWidth = self.outerWidth / 2; + /* To run in Firefox directly, must set signed.applets.codebase_principal_support to true in about:config */ - win = window.open('/xul/server/cat/marcedit.xul','','chrome'); // XXX version? + win = window.open('/xul/server/cat/marcedit.xul','', // XXX version? + 'chrome,resizable=yes,height=' + initHeight + ',width=' + initWidth); win.xulG = { "record": {"marc": rec.marc(), "rtype": "are"}, @@ -365,7 +373,7 @@ function displayRecords(parms) { var widgets = dijit.findWidgets(dojo.byId('authlist-div')); dojo.forEach(widgets, function(w) { w.destroyRecursive(true); }); - dojo.query("#authlist-div div").orphan(); + dojo.query("#authlist-div").query("div").orphan(); var url = '/opac/extras/browse/marcxml/authority.' + dijit.byId('authAxis').attr('value') -- 2.11.0