[open-ils-commits] r13217 - in trunk/Open-ILS: examples web/opac/skin/default/js (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri May 22 10:42:35 EDT 2009
Author: dbs
Date: 2009-05-22 10:42:33 -0400 (Fri, 22 May 2009)
New Revision: 13217
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/web/opac/skin/default/js/rdetail.js
Log:
Rough working MFHD editor
To do:
* Support internationalization
* Open the MARC editor in a tab instead of a pop-up window
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2009-05-22 14:37:36 UTC (rev 13216)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2009-05-22 14:42:33 UTC (rev 13217)
@@ -2285,7 +2285,7 @@
<field name="incomplete" oils_persist:virtual="true" />
</fields>
</class>
- <class id="sre" controller="open-ils.cstore" oils_obj:fieldmapper="serial::record_entry" oils_persist:tablename="serial.record_entry" reporter:label="Record Entry">
+ <class id="sre" controller="open-ils.pcrud open-ils.cstore" oils_obj:fieldmapper="serial::record_entry" oils_persist:tablename="serial.record_entry" reporter:label="Serial Record Entry">
<fields oils_persist:primary="id" oils_persist:sequence="serial.record_entry_id_seq">
<field name="active" reporter:datatype="bool"/>
<field reporter:label="Bib Record" name="record" reporter:datatype="link"/>
@@ -2304,8 +2304,16 @@
<link field="editor" reltype="has_a" key="id" map="" class="au"/>
<link field="creator" reltype="has_a" key="id" map="" class="au"/>
</links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="CREATE_MFHD_RECORD" global_required="true"/>
+ <retrieve/>
+ <update permission="UPDATE_MFHD_RECORD" global_required="true"/>
+ <delete permission="DELETE_MFHD_RECORD" global_required="true"/>
+ </actions>
+ </permacrud>
</class>
- <class id="sfr" controller="open-ils.cstore" oils_obj:fieldmapper="serial::full_rec" oils_persist:tablename="serial.full_rec" reporter:label="Full Record">
+ <class id="sfr" controller="open-ils.cstore" oils_obj:fieldmapper="serial::full_rec" oils_persist:tablename="serial.full_rec" reporter:label="Serial Full Record">
<fields oils_persist:primary="id" oils_persist:sequence="serial.full_rec_id_seq">
<field name="id" reporter:datatype="id" />
<field name="ind1" />
Modified: trunk/Open-ILS/web/opac/skin/default/js/rdetail.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/rdetail.js 2009-05-22 14:37:36 UTC (rev 13216)
+++ trunk/Open-ILS/web/opac/skin/default/js/rdetail.js 2009-05-22 14:42:33 UTC (rev 13217)
@@ -180,6 +180,34 @@
hideMe(G.ui.rdetail.cp_info_none);
}
+function OpenMarcEditWindow(pcrud, rec) {
+ /*
+ To run in Firefox directly, must set signed.applets.codebase_principal_support
+ to true in about:config
+ */
+ netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+ win = window.open('/xul/server/cat/marcedit.xul'); // XXX version?
+ dojo.require('openils.PermaCrud');
+
+ win.xulG = {
+ record : {marc : rec.marc()},
+ save : {
+ label: 'Save',
+ func: function(xmlString) {
+ rec.marc(xmlString);
+ rec.ischanged(true);
+ pcrud.update(rec);
+ },
+ }
+ };
+}
+
+function loadMarcEditor(recId) {
+ var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
+ var recs = pcrud.search("sre", {"record": recId});
+ OpenMarcEditWindow(pcrud, recs[0]);
+}
+
/*
* This function could be written much more intelligently
* Limited brain power means that I'm brute-forcing it for now
@@ -205,7 +233,7 @@
return null;
}
- dojo.place("<table><caption class='rdetail_header color_1'>Holdings summary</caption><tbody id='rdetail_holdings_tbody'></tbody></table>", "rdetail_details_table", "after");
+ dojo.place("<table><caption id='mfhdHoldingsCaption' class='rdetail_header color_1'>Holdings summary</caption><tbody id='rdetail_holdings_tbody'></tbody></table>", "rdetail_details_table", "after");
if (hh.length > 0) {
dojo.place("<tr><td> </td><td nowrap='nowrap' class='rdetail_desc'>Holdings</td><td class='rdetail_item'>" + hh + "</td></tr>", "rdetail_holdings_tbody", "last");
}
@@ -233,6 +261,11 @@
if (hinc.length > 0) {
dojo.place("<tr><td> </td><td nowrap='nowrap' class='rdetail_desc'>Incomplete</td><td class='rdetail_item'>" + hinc + "</td></tr>", "rdetail_holdings_tbody", "last");
}
+ if (isXUL()) {
+ dojo.require('openils.Event');
+ dojo.require('openils.PermaCrud');
+ dojo.place("<span> - </span><a class='classic_link' href='javascript:loadMarcEditor(" + getRid() + ")'> Edit</a>", "mfhdHoldingsCaption", "last");
+ }
}
function _rdetailDraw(r) {
More information about the open-ils-commits
mailing list