added a marc-edit button to the marc-html view interface. launches marc editor tab...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 6 Oct 2008 21:44:57 +0000 (21:44 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 6 Oct 2008 21:44:57 +0000 (21:44 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@10767 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/vandelay.dtd
Open-ILS/web/vandelay/inc/marchtml.xml
Open-ILS/web/vandelay/vandelay.js

index 50e25c7..754132b 100644 (file)
@@ -7,6 +7,7 @@
 <!ENTITY vandelay.bib.attrs "Bibliographic attributes">
 <!ENTITY vandelay.bib.records "Bibliographic Records">
 <!ENTITY vandelay.cancel "Cancel">
+<!ENTITY vandelay.edit "Edit">
 <!ENTITY vandelay.code "Code">
 <!ENTITY vandelay.column "Column">
 <!ENTITY vandelay.create.attr.def "Create Attribute Definition">
index af70ba2..d17d983 100644 (file)
@@ -2,6 +2,7 @@
 <h1>&vandelay.marc.record;</h1><br/>
 <div>
     <button id='vl-marc-html-done-button' dojoType='dijit.form.Button'>&#x2196; &vandelay.return;</button>
+    <button id='vl-marc-html-edit-button' dojoType='dijit.form.Button'>&vandelay.edit;</button>
 </div>
 <div>
     <style>#vl-marc-record-html td {padding:0px;}</style>
index 80c23ce..bcfeb0c 100644 (file)
@@ -387,6 +387,7 @@ function vlPopulateMatchGrid(grid, data) {
 
 function vlLoadMARCHtml(recId, inCat, oncomplete) {
     dijit.byId('vl-marc-html-done-button').onClick = oncomplete;
+    dijit.byId('vl-marc-html-edit-button').onClick = function() {vlLoadMarcEditor(currentType, recId);};
     displayGlobalDiv('vl-generic-progress');
     var api;
     var params = [recId, 1];
@@ -753,6 +754,52 @@ function vlFetchQueueFromForm() {
     retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
 }
 
+function vlOpenMarcEditWindow(rec) {
+    win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+    win.xulG = {
+        record : {marc : rec.marc()},
+        save : {
+            label: 'Save', // XXX
+            func: function(xmlString) {
+                var method = 'open-ils.permacrud.update.' + rec.classname;
+                rec.marc(xmlString);
+                fieldmapper.standardRequest(
+                    ['open-ils.permacrud', method],
+                    {   async: true,
+                        params: [authtoken, rec],
+                        oncomplete: function(r) {
+                            if(e = openils.Event.parse(rec))
+                                return alert(e);
+                            alert('Record Updated'); // XXX
+                            win.close();
+                            // XXX reload marc html view with updates
+                        }
+                    }
+                );
+            },
+        }
+    };
+}
+
+function vlLoadMarcEditor(type, recId) {
+    var method = 'open-ils.permacrud.search.vqbr';
+    if(currentType != 'bib')
+        method = method.replace(/vqbr/,'vqar');
+
+    fieldmapper.standardRequest(
+        ['open-ils.permacrud', method],
+        {   async: true, 
+            params: [authtoken, {id : recId}],
+            oncomplete: function(r) {
+                var rec = r.recv().content();
+                if(e = openils.Event.parse(rec))
+                    return alert(e);
+                vlOpenMarcEditWindow(rec);
+            }
+        }
+    );
+}
+
 
 
 //------------------------------------------------------------