From 7b8b443bec3700218a697b4e3fde6406fa5d33a5 Mon Sep 17 00:00:00 2001 From: dbwells Date: Wed, 14 Jul 2010 15:03:15 +0000 Subject: [PATCH] - Establish client menu entries for MFHD editing (moving the functionality out of the catalog page) and setting the Serial Control View - Setup some of the backend constants/entities - Small MFHD comment change git-svn-id: svn://svn.open-ils.org/ILS/branches/seials-integration@16928 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/Utils/MFHD.pm | 2 +- Open-ILS/web/opac/locale/en-US/lang.dtd | 23 ++++ .../xul/staff_client/chrome/content/cat/opac.js | 130 ++++++++++++++++++++- .../xul/staff_client/chrome/content/cat/opac.xul | 9 ++ .../staff_client/chrome/content/main/constants.js | 35 ++++++ 5 files changed, 197 insertions(+), 2 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD.pm b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD.pm index 4b3a30fe56..757925595f 100755 --- a/Open-ILS/src/perlmods/OpenILS/Utils/MFHD.pm +++ b/Open-ILS/src/perlmods/OpenILS/Utils/MFHD.pm @@ -224,7 +224,7 @@ sub active_captions { my $self = shift; my $tag = shift; - # TODO: add support for caption types as argument? (base, index, supplement) + # TODO: add support for caption types as argument? (basic, index, supplement) my @captions; my @active_captions; diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index c03b5ef58b..89dd0a598a 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1508,6 +1508,29 @@ + + + + + + + + + + + + + + + + + + + + + + + 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 865b0db6e3..c77c72a733 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -4,6 +4,7 @@ var marc_view_reset = true; var marc_edit_reset = true; var copy_browser_reset = true; var hold_browser_reset = true; +var serctrl_view_reset = true; function $(id) { return document.getElementById(id); } @@ -303,6 +304,41 @@ function set_opac() { } } ); + + $('mfhd_add').setAttribute('oncommand','create_mfhd()'); + var mfhd_edit_menu = $('mfhd_edit'); + var mfhd_delete_menu = $('mfhd_delete'); + + // clear menus on subsequent loads + if (mfhd_edit_menu.firstChild) { + mfhd_edit_menu.removeChild(mfhd_edit_menu.firstChild); + mfhd_delete_menu.removeChild(mfhd_delete_menu.firstChild); + } + + mfhd_edit_menu.disabled = true; + mfhd_delete_menu.disabled = true; + + win.attachEvt("rdetail", "MFHDDrawn", + function() { + if (win.mfhdDetails && win.mfhdDetails.length > 0) { + g.data.mfhd = {}; + g.data.mfhd.details = win.mfhdDetails; + g.data.stash('mfhd'); + mfhd_edit_menu.disabled = false; + mfhd_delete_menu.disabled = false; + for (var i = 0; i < win.mfhdDetails.length; i++) { + var mfhd_details = win.mfhdDetails[i]; + var num = mfhd_details.entryNum; + num++; + var label = mfhd_details.label + ' (' + num + ')'; + var item = mfhd_edit_menu.appendItem(label); + item.setAttribute('oncommand','open_mfhd_editor('+mfhd_details.id+')'); + item = mfhd_delete_menu.appendItem(label); + item.setAttribute('oncommand','delete_mfhd('+mfhd_details.id+')'); + } + } + } + ); }, 'url_prefix' : xulG.url_prefix, }; @@ -331,6 +367,97 @@ function set_opac() { } } +function set_serctrl_view() { + g.view = 'serctrl_view'; + if (serctrl_view_reset) { + bottom_pane.reset_iframe( xulG.url_prefix( urls.XUL_SERIAL_SERCTRL_MAIN ) + '?docid=' + window.escape(docid), {}, xulG); + serctrl_view_reset =false; + } else { + bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_SERIAL_SERCTRL_MAIN ) + '?docid=' + window.escape(docid), {}, xulG); + } +} + +function create_mfhd() { + try { + g.data.create_mfhd_aou = ''; + JSAN.use('util.window'); var win = new util.window(); + win.open( + xulG.url_prefix(urls.XUL_SERIAL_SELECT_AOU), + 'sel_bucket_win' + win.window_name_increment(), + 'chrome,resizable,modal,centerscreen' + ); + if (!g.data.create_mfhd_aou) { + return; + } + var r = g.network.simple_request( + 'MFHD_XML_RECORD_CREATE', + [ ses(), 1, g.data.create_mfhd_aou, docid ] + ); + if (typeof r.ilsevent != 'undefined') { + throw(r); + } + alert("MFHD record created."); //TODO: better success message + //TODO: refresh opac display + } catch(E) { + g.error.standard_unexpected_error_alert("Create MFHD failed", E); //TODO: better error handling + } +} + +function delete_mfhd(sre_id) { + if (g.error.yns_alert( + document.getElementById('offlineStrings').getFormattedString('serial.delete_record.confirm', [sre_id]), + document.getElementById('offlineStrings').getString('cat.opac.delete_record'), + document.getElementById('offlineStrings').getString('cat.opac.delete'), + document.getElementById('offlineStrings').getString('cat.opac.cancel'), + null, + document.getElementById('offlineStrings').getString('cat.opac.record_deleted.confirm')) == 0) { + var robj = g.network.request( + 'open-ils.permacrud', + 'open-ils.permacrud.delete.sre', + [ses(),sre_id]); + if (typeof robj.ilsevent != 'undefined') { + alert(document.getElementById('offlineStrings').getFormattedString('cat.opac.record_deleted.error', [docid, robj.textcode, robj.desc]) + '\n'); + } else { + alert(document.getElementById('offlineStrings').getString('cat.opac.record_deleted')); + //TODO: refresh opac display + } + } +} + +function open_mfhd_editor(sre_id) { + try { + var r = g.network.simple_request( + 'FM_SRE_RETRIEVE', + [ ses(), sre_id ] + ); + if (typeof r.ilsevent != 'undefined') { + throw(r); + } + open_marc_editor(r, 'MFHD'); + } catch(E) { + g.error.standard_unexpected_error_alert("Create MFHD failed", E); //TODO: better error handling + } +} + +function open_marc_editor(rec, label) { + win = window.open( xulG.url_prefix('/xul/server/cat/marcedit.xul') ); + + win.xulG = { + record : {marc : rec.marc()}, + save : { + label: 'Save ' + label, + func: function(xmlString) { // TODO: switch to pcrud, or define an sre update method in Serial.pm? + var method = 'open-ils.permacrud.update.' + rec.classname; + rec.marc(xmlString); + g.network.request( + 'open-ils.permacrud', method, + [ses(), rec] + ); + } + } + }; +} + function bib_in_new_tab() { try { var url = browser_frame.contentWindow.g.browser.controller.view.browser_browser.contentWindow.wrappedJSObject.location.href; @@ -353,7 +480,7 @@ function add_to_bucket() { win.open( xulG.url_prefix(urls.XUL_RECORD_BUCKETS_QUICK), 'sel_bucket_win' + win.window_name_increment(), - 'chrome,resizable,modal,center', + 'chrome,resizable,modal,centerscreen', { record_ids: [ docid ] } @@ -485,6 +612,7 @@ function refresh_display(id) { case 'marc_edit' : set_marc_edit(); break; case 'copy_browser' : set_copy_browser(); break; case 'hold_browser' : set_hold_browser(); break; + case 'serctrl_view' : set_serctrl_view(); break; case 'opac' : default: set_opac(); break; } diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul b/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul index 7f0fdbb035..671b6ba37f 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.xul @@ -64,6 +64,15 @@ + + + + + + + + + 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 52c8b47004..a1af39e951 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -273,6 +273,37 @@ var api = { 'MARC_HTML_RETRIEVE' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.biblio.record.html', 'secure' : false }, 'FM_BLOB_RETRIEVE_VIA_Z3950_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_class' }, 'FM_BLOB_RETRIEVE_VIA_Z3950_RAW_SEARCH' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.search_service' }, + 'FM_SCAP_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.caption_and_pattern.batch.retrieve', 'secure' : false }, + 'FM_SCAP_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.caption_and_pattern.batch.retrieve', 'secure' : false }, + 'FM_SDIST_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution.fleshed.batch.retrieve', 'secure' : false }, + 'FM_SDIST_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution.fleshed.batch.retrieve.authoritative', 'secure' : false }, + 'FM_SDIST_ID_LIST' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.id_list.sdist'}, + 'FM_SDIST_RETRIEVE' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.retrieve.sdist'}, + 'FM_SDIST_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.sdist'}, + 'FM_SDISTN_CREATE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution_note.create' }, + 'FM_SDISTN_DELETE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution_note.delete', 'secure' : false }, + 'FM_SDISTN_RETRIEVE_ALL' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.distribution_note.retrieve.all', 'secure' : false }, + 'FM_SIN_CREATE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.item_note.create' }, + 'FM_SIN_DELETE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.item_note.delete', 'secure' : false }, + 'FM_SIN_RETRIEVE_ALL' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.item_note.retrieve.all', 'secure' : false }, + 'FM_SISS_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.issuance.fleshed.batch.retrieve', 'secure' : false }, + 'FM_SISS_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.issuance.fleshed.batch.retrieve.authoritative', 'secure' : false }, + 'FM_SITEM_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.item.fleshed.batch.retrieve', 'secure' : false }, + 'FM_SITEM_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.item.fleshed.batch.retrieve.authoritative', 'secure' : false }, + 'FM_SITEM_ID_LIST' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.id_list.sitem'}, + 'FM_SITEM_RETRIEVE' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.retrieve.sitem'}, + 'FM_SITEM_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.sitem'}, + 'FM_SRE_RETRIEVE' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.retrieve.sre'}, + 'FM_SRE_SEARCH' : { 'app' : 'open-ils.pcrud', 'method' : 'open-ils.pcrud.search.sre'}, + 'FM_SSUB_AOU_IDS_RETRIEVE_VIA_RECORD_ID' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription.retrieve_orgs_by_title', 'secure' : false }, + 'FM_SSUB_AOU_IDS_RETRIEVE_VIA_RECORD_ID.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription.retrieve_orgs_by_title.authoritative', 'secure' : false }, + 'FM_SSUB_FLESHED_BATCH_RETRIEVE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription.fleshed.batch.retrieve', 'secure' : false }, + 'FM_SSUB_FLESHED_BATCH_RETRIEVE.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription.fleshed.batch.retrieve.authoritative', 'secure' : false }, + 'FM_SSUB_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription_tree.retrieve', 'secure' : false }, + 'FM_SSUB_TREE_LIST_RETRIEVE_VIA_RECORD_ID_AND_ORG_IDS.authoritative' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription_tree.retrieve.authoritative', 'secure' : false }, + 'FM_SSUBN_CREATE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription_note.create' }, + 'FM_SSUBN_DELETE' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription_note.delete', 'secure' : false }, + 'FM_SSUBN_RETRIEVE_ALL' : { 'app' : 'open-ils.serial', 'method' : 'open-ils.serial.subscription_note.retrieve.all', 'secure' : false }, 'RETRIEVE_Z3950_SERVICES' : { 'app' : 'open-ils.search', 'method' : 'open-ils.search.z3950.retrieve_services', 'secure' : false }, 'MARK_ITEM_DAMAGED' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.mark_item_damaged' }, 'MARK_ITEM_MISSING' : { 'app' : 'open-ils.circ', 'method' : 'open-ils.circ.mark_item_missing' }, @@ -392,6 +423,10 @@ var urls = { 'XUL_RECORD_BUCKETS' : '/xul/server/cat/record_buckets.xul', 'XUL_RECORD_BUCKETS_QUICK' : '/xul/server/cat/record_buckets_quick.xul', 'XUL_REMOTE_BROWSER' : '/xul/server/util/rbrowser.xul', + 'XUL_SERIAL_ITEM_EDITOR' : '/xul/server/serial/item_editor.xul', + 'XUL_SERIAL_NOTES' : '/xul/server/serial/notes.xul', + 'XUL_SERIAL_SELECT_AOU' : '/xul/server/serial/select_aou.xul', + 'XUL_SERIAL_SERCTRL_MAIN' : '/xul/server/serial/serctrl_main.xul', 'XUL_SPINE_LABEL' : '/xul/server/cat/spine_labels.xul', 'XUL_STAGED_PATRONS' : '/xul/server/patron/staged.xul', 'XUL_STANDALONE' : 'chrome://open_ils_staff_client/content/circ/offline.xul', -- 2.11.0