From d07e88235a50dfb7f7ddca8fc265cb94eac69891 Mon Sep 17 00:00:00 2001 From: Cesar Velez Date: Fri, 15 Sep 2017 17:02:31 -0400 Subject: [PATCH] LP#1700635: enable eg-marc-editor for queued records in MARC Batch Import/Export This enables the angular modal marc-editor to be called from the vandelay dojo UI in the iFrame. To test: [1] In the web staff client, go to MARC Batch Import/Export and load some records in a Vandelay queue. [2] Inspect the queue and choose View MARC. [3] Click the Edit button, and verify that it brings up the web staff MARC editor. [4] Make a change, then click Modify, then click Use Edits. [5] Verify that the MARC view reflects the updated record. [6] Go back to the queue. If the bib was /not/ imported into Evergreen, the bib attributes may change. [7] Verify that steps 1-6 in the XUL client work (and that the XUL MARC editor is displayed). Note that this patch doesn't ensure that the modal can save the record and be dismissed via just a single click of the Modify button; an issue was discovered with that that could not be resolved in time for beta2. Signed-off by: Cesar Velez Signed-off-by: Galen Charlton --- .../staff/cat/catalog/t_edit_marc_modal.tt2 | 16 ++++++++++ .../staff/cat/catalog/t_vandelay.tt2 | 2 +- .../js/ui/default/staff/cat/catalog/app.js | 29 +++++++++++++++++-- .../web/js/ui/default/vandelay/vandelay.js | 5 ++++ 4 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 Open-ILS/src/templates/staff/cat/catalog/t_edit_marc_modal.tt2 diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_edit_marc_modal.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_edit_marc_modal.tt2 new file mode 100644 index 0000000000..1bc890412a --- /dev/null +++ b/Open-ILS/src/templates/staff/cat/catalog/t_edit_marc_modal.tt2 @@ -0,0 +1,16 @@ +
+ + + +
diff --git a/Open-ILS/src/templates/staff/cat/catalog/t_vandelay.tt2 b/Open-ILS/src/templates/staff/cat/catalog/t_vandelay.tt2 index 634c7bcf2d..96780ad49b 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/t_vandelay.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/t_vandelay.tt2 @@ -1 +1 @@ - + diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 69526606e8..af2ea77561 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -1830,9 +1830,34 @@ function($scope , $location) { }]) .controller('VandelayCtrl', - ['$scope','$location', -function($scope , $location) { + ['$scope','$location', 'egCore', '$uibModal', +function($scope , $location, egCore, $uibModal) { $scope.vandelay_url = $location.absUrl().replace(/\/staff\/cat\/catalog\/vandelay/, '/vandelay/vandelay'); + $scope.funcs = {}; + $scope.funcs.edit_marc_modal = function(bre, callback){ + var marcArgs = { 'marc_xml': bre.marc() }; + var vqbibrecId = bre.id(); + $uibModal.open({ + templateUrl: './cat/catalog/t_edit_marc_modal', + size: 'lg', + controller: ['$scope', '$uibModalInstance', function($scope, $uibModalInstance) { + $scope.focusMe = true; + $scope.recordId = vqbibrecId; + $scope.args = marcArgs; + $scope.dirty_flag = false; + $scope.ok = function(marg){ + $uibModalInstance.close(marg); + }; + $scope.cancel = function(){ $uibModalInstance.dismiss() } + }] + }).result.then(function(res){ + var new_xml = res.marc_xml; + egCore.pcrud.retrieve('vqbr', vqbibrecId).then(function(vqbib){ + vqbib.marc(new_xml); + egCore.pcrud.update(vqbib).then( function(){ callback(vqbibrecId); }); + }); + }); + }; }]) .controller('ManageAuthoritiesCtrl', diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index 928ef05821..87261537d0 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -1725,6 +1725,11 @@ function vlOpenMarcEditWindow(rec, postReloadHTMLHandler) { To run in Firefox directly, must set signed.applets.codebase_principal_support to true in about:config */ + if(window.IAMBROWSER){ + xulG.edit_marc_modal(rec, function(breId){ vlLoadMARCHtml(breId, false, postReloadHTMLHandler); }); + return; + } + win = window.open('/xul/server/cat/marcedit.xul','','chrome'); // XXX version? var type; -- 2.43.2