From b11902269b05f5da847cbb51a23fdf2046dea1ca Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Tue, 12 Nov 2013 17:51:57 -0500 Subject: [PATCH] LP#1272074 Physical Characteristics Wizard for the MARC Editor Right-click in an 007 field to find a new entry in the context menu that launches this wizard. The prompts and suggested values come from data already found in the database. Signed-off-by: Lebbeous Fogle-Weekley Signed-off-by: Dan Wells --- Open-ILS/web/opac/locale/en-US/lang.dtd | 2 + .../xul/staff_client/chrome/content/cat/opac.js | 3 +- .../staff_client/chrome/content/main/constants.js | 1 + Open-ILS/xul/staff_client/server/cat/marcedit.js | 50 +++++++++++++++++++++- Open-ILS/xul/staff_client/server/cat/marcedit.xul | 3 ++ 5 files changed, 56 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 2374fbed22..54b63fe063 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -3033,6 +3033,8 @@ + + diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index 1d76bc297e..ba54530ce3 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -277,7 +277,8 @@ function set_marc_edit() { } }, 'lock_tab' : xulG.lock_tab, - 'unlock_tab' : xulG.unlock_tab + 'unlock_tab' : xulG.unlock_tab, + 'url_prefix': xulG.url_prefix }; if (marc_edit_reset) { bottom_pane.reset_iframe( a,b,c ); diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index 3856f72bf1..189d1a4bfc 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -507,6 +507,7 @@ var urls = { 'EG_ACQ_USER_REQUESTS' : 'oils://remote/eg/acq/picklist/user_request', 'XUL_SERIAL_BATCH_RECEIVE': 'oils://remote/xul/server/serial/batch_receive.xul', 'XUL_SERIAL_PATTERN_WIZARD' : 'oils://remote/xul/server/serial/pattern_wizard.xul', + 'EG_MARCEDIT_PHYS_CHAR_WIZARD' : 'oils://remote/eg/cat/marcedit/phys_char_wizard', 'CUSTOM_JS' : '/xul/server/skin/custom.js', 'ACQ_LINEITEM' : 'oils://remote/eg/acq/lineitem/related/', 'SERIAL_LIST_SUBSCRIPTION' : 'oils://remote/eg/serial/list_subscription', diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js index 02cfa1e5fc..5881a609f1 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.js +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js @@ -257,12 +257,26 @@ function my_init() { } document.getElementById('save-button').setAttribute('label', window.xulG.save.label); + /* Ugh. Sorry about the spaghetti. */ document.getElementById('save-button').setAttribute('oncommand', + 'var to_save = function() { ' + /* begin to_save() */ 'if ($("xul-editor").hidden) set_flat_editor(false); ' + 'mangle_005(); ' + 'var xml_string = xml_escape_unicode( xml_record.toXMLString() ); ' + 'save_attempt( xml_string ); ' + - 'loadRecord();' + 'loadRecord(); ' + + '}; ' + /* end to_save() */ + + 'if (typeof _owPCW == "object") { ' + + ' for (var k in _owPCW) { ' + + ' if (_owPCW[k].active) { ' + + ' try { _owPCW[k].apply(to_save); to_save.ran = true; } ' + + ' catch (E) { alert("_ow_PCW[" + k + "]: " + E); } ' + + ' break; ' + + ' }' + + ' }' + + '} ' + + 'if (!to_save.ran) to_save();' ); if (window.xulG.record.url) { @@ -430,7 +444,9 @@ function my_init() { buildBibSourceList(authtoken, xulG.record.id); } + preparePhysCharWizardContext(); dojo.require('MARC.FixedFields'); + dojo.require("openils.widget.PhysCharWizard"); } catch(E) { alert('FIXME, MARC Editor, my_init: ' + E); @@ -996,6 +1012,36 @@ function getFFContextMenu(type, name) { return context_menu_id; } +/* This just sets up a special context menu for a 007 data field to use, so + * that users can right-click for a menu and get a choice to launch the + * Physical Characteristics Wizard. + */ +function preparePhysCharWizardContext() { + var menu = document.getElementById("physCharWizardContext"); + menu.appendChild(document.createElement("menuseparator")); + + var clipb_children = document.getElementById("clipboard").childNodes; + for (var i = 0; i < clipb_children.length; i++) /* collection not array */ { + var child = clipb_children[i]; + if (child.nodeName == 'menuitem') + menu.appendChild(child.cloneNode(true)); + } +} + +function launchPhysCharWizard(popup_node) { + try { + new openils.widget.PhysCharWizard({ + "node": popup_node, + "onapply": function(v) { + createControlField("007", v); + loadRecord(); + } + }); + } catch (E) { + alert("Exception raised by openils.widget.PhysCharWizard:\n" + E); + } +} + function fillFixedFields () { try { var grid = document.getElementById('leaderGrid'); @@ -1095,7 +1141,7 @@ function marcControlfield (field) { { value : field.text(), class : 'plain marcEditableControlfield', name : 'CONTROL' + tagname, - context : 'clipboard', + context : tagname == 7 ? 'physCharWizardContext': 'clipboard', size : 50, maxlength : 50 } ) ); diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.xul b/Open-ILS/xul/staff_client/server/cat/marcedit.xul index 6d86170e29..16505d9124 100644 --- a/Open-ILS/xul/staff_client/server/cat/marcedit.xul +++ b/Open-ILS/xul/staff_client/server/cat/marcedit.xul @@ -283,6 +283,9 @@ + + + -- 2.11.0