LP#1700635-enable eg-marc-editor for queued records in MARC Batch Import/Export user/cesardv/lp1700635-vandelay_bib_queue_edit_marc_modal
authorCesar Velez <cesar.velez@equinoxinitiative.org>
Fri, 15 Sep 2017 21:02:31 +0000 (17:02 -0400)
committerCesar Velez <cesar.velez@equinoxinitiative.org>
Tue, 19 Sep 2017 14:42:36 +0000 (10:42 -0400)
This enables the angular modal marc-editor to be called from
the vandelay dojo UI in the iFrame.

Signed-off by: Cesar Velez <cesar.velez@equinoxinitiative.org>

Open-ILS/src/templates/staff/cat/catalog/t_edit_marc_modal.tt2 [new file with mode: 0644]
Open-ILS/src/templates/staff/cat/catalog/t_vandelay.tt2
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
Open-ILS/web/js/ui/default/vandelay/vandelay.js

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 (file)
index 0000000..1bc8904
--- /dev/null
@@ -0,0 +1,16 @@
+<div>
+  <div class="modal-header">
+    <button type="button" class="close"
+      ng-click="cancel()" aria-hidden="true">&times;</button>
+    <h4 class="modal-title">[% l('Edit MARC Record') %]</h4>
+  </div>
+  <div class="modal-body">
+    <eg-marc-edit-record dirty-flag="dirty_flag" marc-xml="args.marc_xml"
+                         in-place-mode="true" record-type="bre" save-label="[% l('Modify') %]" />
+  </div>
+  <div class="modal-footer">
+    <input type="submit" ng-click="ok(args)"
+        class="btn btn-primary" value="[% l('Use Edits') %]"/>
+    <button class="btn btn-warning" ng-click="cancel()">[% l('Cancel') %]</button>
+  </div>
+</div>
index 634c7bc..96780ad 100644 (file)
@@ -1 +1 @@
-<eg-embed-frame save-space="150" url="vandelay_url"></eg-embed-frame>
+<eg-embed-frame save-space="150" url="vandelay_url" handlers="funcs"></eg-embed-frame>
index faa0954..6b68058 100644 (file)
@@ -1825,9 +1825,32 @@ 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(li, callback){
+        var args = { 'marc_xml': li.marc(), 'recordId': li.id() };
+        $uibModal.open({
+            templateUrl: './cat/catalog/t_edit_marc_modal',
+            size: 'lg',
+            controller: ['$scope', '$uibModalInstance', function($scope, $uibModalInstance) {
+                $scope.focusMe = true;
+                $scope.args = args;
+                $scope.recordId = args.recordId;
+                $scope.dirty_flag = false;
+                $scope.ok = function(args){ $uibModalInstance.close(args) };
+                $scope.cancel = function(args){ $uibModalInstance.dismiss() }
+            }]
+        }).result.then(function(res){
+            var vqbibrecId = res.id;
+            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(args.id); });
+            });
+        });
+    };
 }])
 
 .controller('ManageAuthoritiesCtrl',
index 928ef05..5cf898d 100644 (file)
@@ -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, null); });
+        return;
+    }
+
     win = window.open('/xul/server/cat/marcedit.xul','','chrome'); // XXX version?
 
     var type;