[open-ils-commits] r596 - conifer/trunk/web/opac/skin/default/js (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jul 28 01:49:38 EDT 2009
Author: dbs
Date: 2009-07-28 01:49:34 -0400 (Tue, 28 Jul 2009)
New Revision: 596
Modified:
conifer/trunk/web/opac/skin/default/js/rdetail.js
Log:
Bring detailed record display back into sync with rel_1_6_0
Modified: conifer/trunk/web/opac/skin/default/js/rdetail.js
===================================================================
--- conifer/trunk/web/opac/skin/default/js/rdetail.js 2009-07-27 17:41:34 UTC (rev 595)
+++ conifer/trunk/web/opac/skin/default/js/rdetail.js 2009-07-28 05:49:34 UTC (rev 596)
@@ -1,12 +1,22 @@
/* */
-
detachAllEvt('common', 'run');
attachEvt("common", "run", rdetailDraw);
attachEvt("rdetail", "recordDrawn", rdetailBuildStatusColumns);
attachEvt("rdetail", "recordDrawn", rdetailBuildInfoRows);
attachEvt("rdetail", "recordDrawn", rdetailGetPageIds);
+/* Per-skin configuration settings */
+var rdetailLocalOnly = true;
+var rdetailShowLocal = true;
+var rdetailShowCopyLocation = true;
+var rdetailGoogleBookPreview = true;
+var rdetailDisplaySerialHoldings = true;
+var rdetailEnableRefWorks = false;
+var rdetailRefWorksHost = 'http://refworks.scholarsportal.info';
+var enableHoldsOnAvailable = false;
+
+/* vars vars vars */
var record = null;
var cp_statuses = null;
var recordsCache = [];
@@ -17,27 +27,30 @@
var numStatuses = null;
var defaultCN;
var callnumberCache = {};
-var rdetailLocalOnly = true;
var globalCNCache = {};
var localTOC;
var cachedRecords;
var _statusPositions = {};
-
-var rdetailShowLocal = true;
-var rdetailShowCopyLocation = true;
-var googleBookPreview = true;
-var enableHoldsOnAvailable = false;
-var displaySerialHoldings = true;
var opac_strings;
+var nextContainerIndex;
+
+var nextRecord;
+var prevRecord;
+
+var rdetailPrev = null;
+var rdetailNext = null;
+var rdetailStart = null;
+var rdetailEnd = null;
+
/* serials are currently the only use of Dojo strings in the OPAC */
-if (displaySerialHoldings) {
+if (rdetailDisplaySerialHoldings) {
+ dojo.require("dijit.Menu");
+ dojo.require("dijit.form.Button");
dojo.requireLocalization("openils.opac", "opac");
opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
}
-var nextContainerIndex;
-
function rdetailReload() {
var args = {};
args[PARAM_LOCATION] = getNewSearchLocation();
@@ -45,16 +58,6 @@
goTo(buildOPACLink(args));
}
-var nextRecord;
-var prevRecord;
-
-var rdetailPrev = null;
-var rdetailNext = null;
-var rdetailStart = null;
-var rdetailEnd = null;
-
-
-
/* looks to see if we have a next and/or previous record in the
record cache, if so, set up the nav links */
function rdetailSetPaging(ids) {
@@ -125,10 +128,21 @@
req.callback(_rdetailDraw);
req.send();
- if (displaySerialHoldings) {
+ if (rdetailDisplaySerialHoldings) {
var req = new Request(FETCH_MFHD_SUMMARY, getRid());
req.callback(_holdingsDraw);
req.send();
+ if (isXUL()) {
+ var here = findOrgUnit(getLocation());
+ dojo.place("<div id='mfhd_ad_menu></div>", "rdetail_details_table", "after");
+ var mfhd_add = new dijit.Menu({style:"float: right;"});
+ new dijit.MenuItem({onClick:function(){
+ var req = new Request(CREATE_MFHD_RECORD, G.user.session, 1, here.id(), getRid());
+ var res = req.send();
+ alert(dojo.string.substitute(opac_strings.CREATED_MFHD_RECORD, [here.name()]));
+ }, label:opac_strings.CREATE_MFHD}).placeAt(mfhd_add);
+ mfhd_add.placeAt(mfhd_ad_menu);
+ }
}
detachAllEvt("result", "idsReceived");
@@ -226,9 +240,11 @@
if (!holdings) { return null; }
dojo.forEach(holdings, _holdingsDrawMFHD);
+
}
function _holdingsDrawMFHD(holdings, entryNum) {
+
var here = findOrgUnit(getLocation());
if (getDepth() > 0 || getDepth === 0 ) {
while (getDepth() < findOrgDepth(here))
@@ -251,12 +267,22 @@
if ( hh.length == 0 && hch.length == 0 && hs.length == 0 &&
hcs.length == 0 && hi.length == 0 && hci.length == 0 &&
- ho.length == 0 && hm.length == 0 && hinc.length == 0 && !isXUL()
+ ho.length == 0 && hm.length == 0 && hinc.length == 0
) {
- return null;
+
+ if (isXUL()) {
+ /*
+ * If we have a record, but nothing to show for it, then the
+ * record is likely empty or corrupt. This gives cataloguers a
+ * chance to add holdings or correct the record
+ */
+ hh = 'PLACEHOLDER';
+ } else {
+ return null;
+ }
}
- dojo.place("<table style='width: 100%;'><caption id='mfhdHoldingsCaption' class='rdetail_header color_1'>" +
+ dojo.place("<table style='width: 100%;'><caption id='mfhdHoldingsCaption" + entryNum + "' class='rdetail_header color_1'>" +
dojo.string.substitute(opac_strings.HOLDINGS_TABLE_CAPTION, [hloc]) +
"</caption><tbody id='rdetail_holdings_tbody_" + entryNum +
"'></tbody></table>", "rdetail_details_table", "after"
@@ -274,10 +300,20 @@
if (isXUL()) {
dojo.require('openils.Event');
dojo.require('openils.PermaCrud');
- dojo.place("<span> - </span><a class='classic_link' href='javascript:loadMarcEditor(" +
- holdings.id() + ")'>" + opac_strings.EDIT_LABEL + "</a>",
- "mfhdHoldingsCaption", "last"
- );
+ var mfhd_edit = new dijit.Menu({});
+ new dijit.MenuItem({onClick: function(){loadMarcEditor(holdings.id())}, label:opac_strings.EDIT_MFHD_RECORD}).placeAt(mfhd_edit, "first");
+ new dijit.MenuItem({onClick:function(){
+ var pcrud = new openils.PermaCrud({"authtoken": G.user.session});
+ var mfhd_rec = pcrud.retrieve("sre", holdings.id());
+ if (mfhd_rec) {
+ pcrud.eliminate(mfhd_rec);
+ alert(dojo.string.substitute(opac_strings.DELETED_MFHD_RECORD, [holdings.id()]));
+ }
+ }, label:opac_strings.DELETE_MFHD}).placeAt(mfhd_edit, "last");
+ // new dijit.MenuItem({onClick:function(){alert("Edit properties " + holdings.id());}, label:opac_strings.EDIT_PROPERTIES}).placeAt(mfhd_edit, "last");
+ var mfhd_mb = new dijit.form.DropDownButton({dropDown: mfhd_edit, label:opac_strings.EDIT_MFHD_MENU, style:"float:right"});
+ mfhd_mb.placeAt("mfhdHoldingsCaption" + entryNum, "last");
+ mfhd_edit.startup();
}
}
@@ -376,6 +412,27 @@
$('rdetail_place_hold').setAttribute(
'href','javascript:holdsDrawEditor({record:"'+record.doc_id()+'",type:"T"});');
+ var RW = $('rdetail_exp_refworks');
+ if (RW && rdetailEnableRefWorks) {
+
+ var here = (findOrgUnit(getLocation())).name();
+ var org_name = here.replace(" ", "+");
+ var cgi = new CGI();
+
+ RW.setAttribute(
+ 'href',
+ rdetailRefWorksHost + '/express/expressimport.asp?vendor='
+ + org_name
+ + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F'
+ + cgi.server_name + '/opac/extras/supercat/marctxt/record/'
+ + record.doc_id()
+ );
+
+ RW.setAttribute('target', 'RefWorksMain');
+
+ unHideMe($('rdetail_exp_refworks_span'));
+ }
+
$('rdetail_img_link').setAttribute('href', buildISBNSrc(cleanISBN(record.isbn()), 'large'));
G.ui.rdetail.image.setAttribute("src", buildISBNSrc(cleanISBN(record.isbn())));
runEvt("rdetail", "recordDrawn");
@@ -945,7 +1002,7 @@
* Check for a Google Book preview
*/
function rdetailCheckForGBPreview() {
- if (!googleBookPreview) return;
+ if (!rdetailGoogleBookPreview) return;
searchForGBPreview( cleanISBN(record.isbn()) );
}
More information about the open-ils-commits
mailing list