}
.my_opac_update_table td {
- padding-left: 8px;
+ padding-left: 12px;
}
text-align:center;
}
+.login_dialog {
+ position: absolute;
+ z-index: 40;
+ top: 10px;
+ border: 2px solid lightblue;
+ background: #FFE;
+ padding: 10px;
+}
+
this.theadDrawn = false;
this.bigOlBox = getById("big_ol_box");
-
}
var c = misc_row.insertCell(0);
+
/* shove in a div for each of the types of resource */
for( var i = 0; i!= 9; i++) {
var div = createAppElement("div");
author_cell.innerHTML = " ";
author_cell.appendChild(this.mkLink(record.doc_id(), "author", author ));
+ var marcd = elem("div");
if(instanceOf(this, RecordResultPage)) {
var span = createAppElement("span");
span.style.marginLeft = "10px";
var func = buildViewMARCWindow(record);
marcb.onclick = func;
- var marcd = elem( "div", { style: "float:right" } );
+ marcd = elem( "div", { style: "float:right" } );
marcd.appendChild(marcb);
+
//author_cell.appendChild(marcd);
//misc_row.insertCell(misc_row.cells.length).appendChild(marcd);
- c.appendChild(marcd);
+ //c.appendChild(marcd);
}
style: "text-decoration:underline"
}, {}, "Place Hold" );
- var user = UserSession.instance();
- /*
- if(!(user && user.verifySession()))
- return;
- */
-
var type = "M";
if(instanceOf(this, RecordResultPage))
type = "T";
- var win = new HoldsWindow(record.doc_id(),
+ var win;
+ var user = UserSession.instance();
+ if(user.verifySession()) {
+ win = new HoldsWindow(record.doc_id(),
type, user.userObject, user.userObject, user.session_id);
+ } else {
+ win = new HoldsWindow(record.doc_id(),
+ type, null, null, null);
+ }
- win.buildWindow();
- holds.onclick = function() { win.toggle(); }
+
+ holds.onclick = function() { win.toggle(holds); }
var holddiv = elem("div");
//if(instanceOf(this,RecordResultPage))
holddiv.appendChild(holds);
//var space = elem("span", {style:"padding:5px"},null, " ");
//c.appendChild(space)
- c.appendChild(mktext(" "))
- c.appendChild(holddiv)
+ //c.appendChild(mktext(" "))
+ //c.appendChild(holddiv)
+
+ var tab = elem("table",{style:"float:right"});
+ var tr = tab.insertRow(0);
+ var tc = tr.insertCell(0);
+ var tc2 = tr.insertCell(1);
+ var tc3 = tr.insertCell(2);
+ tc.setAttribute("nowrap", "nowrap");
+ tc3.setAttribute("nowrap", "nowrap");
+ tc.appendChild(marcd);
+ tc2.appendChild(mktext(" "));
+ tc3.appendChild(holddiv);
+ c.appendChild(tab);
var pic = createAppElement("img");
+
+ if(resource.indexOf("sound recording") != -1)
+ resource = "sound recording";
pic.setAttribute("src", "/images/" + resource + ".jpg");
pic.className = "record_resource_pic";
pic.setAttribute("width", "20");
-var resourceFormats = [
- "text",
- "moving image",
- "sound recording",
- "software, multimedia",
- "still images",
- "cartographic",
- "mixed material",
- "notated music",
- "three dimensional object" ];
-
/*
@param record the id of the target item
this.recipient = recipient;
this.type = type;
this.session = requestor_login;
+ this.built = false;
add_css_class(this.div, "holds_window");
add_css_class(this.div, "hide_me");
}
-HoldsWindow.prototype.buildWindow = function() {
+/* returns false if we don't have a recipient for the hold */
+HoldsWindow.prototype.buildWindow = function(node) {
+ if(this.built) return true;
var d = elem("div");
var id = this.record;
var usr = this.recipient;
- if(!usr) return;
+ if(!usr) {
+ var obj = this;
+ var func = function(usr) {
+ obj.recipient = usr.userObject;
+ obj.requestor = usr.userObject;
+ obj.session = usr.session_id;
+ obj.toggle();
+ }
+ var diag = new LoginDialog(getDocument().body, func);
+ diag.display(node);
+ return false;
+ }
+
var org = usr.home_ou();
d.appendChild(this.buildPickuplibSelector(org));
d.appendChild(this.buildSubmit());
this.div.appendChild(d);
+ this.built = true;
+ return true;
}
-HoldsWindow.prototype.toggle = function() {
+HoldsWindow.prototype.toggle = function(node) {
+
+ debug("Building window with node " + node);
+ if(!this.built)
+ if(!this.buildWindow(node)) return;
+
swapClass( this.div, "hide_me", "show_me" );
if(IE) {
var sels = getDocument().getElementsByTagName("select");
- if(sels.length == 0) return;
+ if(sels.length == 0) return true;
if(this.div.className.indexOf("hide_me") != -1) {
for(var i = 0; i!= sels.length; i++) {
}
}
}
+
+ return true;
}
/*
add_css_class(bdiv, "holds_window_buttons");
var button = elem("input",
- {type:"submit", style:"margin-left: 10px;", value:"Place Hold"});
+ {type:"submit", style:"margin-right: 10px;", value:"Place Hold"});
var cancel = elem("input",
- {type:"submit", style:"margin-right: 10px;",value:"Cancel"});
+ {type:"submit", style:"margin-left: 10px;",value:"Cancel"});
var obj = this;
cancel.onclick = function() { obj.toggle(); }
button.onclick = function() { obj.toggle(); obj.process(); }
div.appendChild(elem("br"));
- bdiv.appendChild(cancel);
bdiv.appendChild(button);
+ bdiv.appendChild(cancel);
div.appendChild(bdiv);
return div;
}
-function mkResourceImage(resource) {
- var pic = elem("img");
- pic.setAttribute("src", "/images/" + resource + ".jpg");
- pic.setAttribute("width", "20");
- pic.setAttribute("height", "20");
- pic.setAttribute("title", resource);
- return pic;
-}
+
Page.navBox.finalize();
var location = getById("main_page_nav_box");
- if(location)
+ if(location) {
+ removeChildren(location);
location.appendChild(Page.navBox.getNode());
+ }
return Page.navBox.getNode();
tree.selectedIndex = idx;
var opt = tree.options[idx];
if(opt) opt.selected = true;
+
+ obj.displayParentLink(findOrgUnit(org_id), obj.record);
}
/* builds the select list with the appropriate org units */
function _fleshOrgTree(org_array, selector) {
- debug("Fleshing org tree selector");
+ debug("Fleshing org tree selector with " + org_array);
for( var idx in org_array ) {
var slot = org_array[idx];
_addOrgAndParents(selector, org);
}
+ /* clear out the state flags we added after the tree is built */
+ setTimeout(function(){_clearOrgFlags();}, 500);
+
debug("Tree is built..");
}
+function _clearOrgFlags(node) {
+ if(node == null)
+ node = globalOrgTree;
+ node.added = false;
+ for(var c in node.children())
+ _clearOrgFlags(node.children()[c]);
+}
+
function _addOrgAndParents(selector, org) {
{}, "Place Hold" );
var user = UserSession.instance();
- if(!(user && user.verifySession())) /* needs to pop up a login dialog XXX */
- return;
-
- var win = new HoldsWindow(record.doc_id(),
+ var win;
+ if(user.verifySession()) {
+ win = new HoldsWindow(record.doc_id(),
"T", user.userObject, user.userObject, user.session_id);
- win.buildWindow();
- holds.onclick = function() { win.toggle(); }
+ } else {
+ win = new HoldsWindow(record.doc_id(),
+ "T", null, null, null);
+ }
+ holds.onclick = function() { win.toggle(holds); }
var space = elem("span", {style:"padding:5px"},null, " ");
this.viewMarc.appendChild(space);
var tcn_cell = getById("record_detail_tcn_cell");
var resource_cell = getById("record_detail_resource_cell");
var pic_cell = getById("record_detail_pic_cell");
+ var abstract_cell = getById("record_detail_abstract_cell");
add_css_class(title_cell, "detail_item_cell");
add_css_class(author_cell, "detail_item_cell");
add_css_class(subject_cell, "detail_item_cell");
add_css_class(tcn_cell, "detail_item_cell");
add_css_class(resource_cell, "detail_item_cell");
+ add_css_class(abstract_cell, "detail_item_cell");
title_cell.appendChild(
createAppTextNode(normalize(record.title())));
tcn_cell.appendChild(
createAppTextNode(record.tcn()));
+ var abs = record.synopsis();
+ if(abs == null || abs == "") abs = "N/A";
+ abstract_cell.appendChild(mktext(abs));
var resource = record.types_of_resource()[0];
+ if(resource.indexOf("sound recording") != -1)
+ resource = "sound recording";
var r_pic = elem("img",
{ src: "/images/" + resource + ".jpg" } );
resource_cell.appendChild(r_pic);
resource_cell.appendChild(
createAppTextNode(record.types_of_resource()));
-
pic_cell.appendChild(this.mkImage(record));
+
+ var locs = record.online_loc();
+ if(locs && locs.length > 0){
+ var tab = pic_cell.parentNode.parentNode;
+ var loc_row = tab.insertRow(tab.rows.length);
+ var desc_cell =loc_row.insertCell(0);
+ add_css_class(desc_cell, "detail_item_label");
+ desc_cell.appendChild(mktext("Other Resources"));
+ var links_cell =loc_row.insertCell(1);
+
+ var found = new Array(); /* weed out duplicates */
+ /* online location field is of the form [link, title, link, title, ...] */
+ for(var i = 0; i!= locs.length; i++ ) {
+ var ref = locs[i++];
+ var ttl = locs[i];
+ if(find_list(found,function(f){return (f==ref);}))
+ continue;
+ found.push(ref);
+ var a = elem("a", {style:"text-decoration:underline",
+ target:"_blank",href:ref,title:ttl}, null, ttl);
+ links_cell.appendChild(a);
+ links_cell.appendChild(mktext(" "));
+ }
+ }
+
var orgUnit = globalSelectedLocation;
if(!orgUnit) orgUnit = globalLocation;
/* displays a link to view info for the parent org
if showMe == true, we don't search for the parent,
but use the given orgUnit as the link point */
-RecordDetailPage.prototype.displayParentLink = function(orgUnit, record, showMe) {
-
- var region = orgUnit;
- if(!showMe)
- region = findOrgUnit(orgUnit.parent_ou());
+RecordDetailPage.prototype.displayParentLink = function(orgUnit, record) {
var href = this.parentLink;
removeChildren(href);
+ var region = orgUnit;
+ if(region == null) return;
+
+ var depth = parseInt(findOrgType(region.ou_type()).depth());
+
+ if(depth < 2) return;
+
+ region = findOrgUnit(orgUnit.parent_ou());
href.appendChild(createAppTextNode(
"View Volumes/Copies for " + region.name()));
/* allows the above message to be displayed */
setTimeout(function() { obj.displayTrees(region, record, true) }, 100);
- if(showMe)
- obj.displayParentLink(orgUnit, record);
- else
- obj.displayParentLink(orgUnit, record, true);
+ obj.displayParentLink(null);
}
var reg_div = createAppElement("div");
if( req.id != id )
tmpArray.push(req);
else {
- debug("Cleaning " + req.id );
+ //debug("Cleaning " + req.id );
req.clean();
}
}
}
-UserSession.prototype.fleshMe = function() {
- if(this.fleshed) return;
+UserSession.prototype.fleshMe = function(force) {
+ if(this.fleshed && !force) return;
var req = new RemoteRequest(
"open-ils.actor",
req.send(true);
this.userObject = req.getResultObject();
+ this.username = this.userObject.usrname();
this.fleshed = true;
}
/* */
+
+/* these are the types of resource provided my MODS - used in virtual records */
+var resourceFormats = [
+ "text",
+ "moving image",
+ "sound recording",
+ "software, multimedia",
+ "still images",
+ "cartographic",
+ "mixed material",
+ "notated music",
+ "three dimensional object" ];
+
+
+
function findOrgDepth(type_id) {
if(type_id == null || globalOrgTypes == null)
}
}
+var singleOrgCache = new Object();
function findOrgUnit(org_id, branch) {
+
if(org_id == null) return null;
if(typeof org_id == 'object') return org_id;
- if(globalOrgTree == null)
- throw new EXArg("Need globalOrgTree");
+
+ /* if we don't have the global org tree, grab the org unit from the server */
+ var tree_exists = false;
+ try{if(globalOrgTree != null) tree_exists = true;}catch(E){}
+
+ if(!tree_exists) {
+ var org = singleOrgCache[org_id];
+ if(org) return org;
+ var r = new RemoteRequest(
+ "open-ils.actor",
+ "open-ils.actor.org_unit.retrieve", null, org_id);
+ r.send(true);
+ return r.getResultObject();
+ }
if(orgArraySearcher == null)
_flattenOrgs();
return "ef";
case "mixed material":
return "op";
- case "notated muix":
+ case "notated music":
return "cd";
case "three dimensional object":
return "r";
throw new EXLogic("Invalid format provided form modsFormatToMARC: " + format);
}
+function MARCFormatToMods(format) {
+ switch(format) {
+
+ case "a":
+ case "t":
+ return "text";
+
+ case "g":
+ return "moving image";
+
+ case "i":
+ case "j":
+ return "sound recording";
+
+ case "m":
+ return "software, multimedia";
+
+ case "k":
+ return "still images";
+
+ case "e":
+ case "f":
+ return "cartographic";
+
+ case "o":
+ case "p":
+ return "mixed material";
+
+ case "c":
+ case "d":
+ return "notated music";
+
+ case "r":
+ return "three dimensional object";
+ }
+ throw new EXLogic("Invalid format provided for MARCFormatToMods: " + format);
+}
+
+
+
+/* if callback exists, call is asynchronous and
+ the returned item is passed to the callback... */
+function fetchRecord(id, callback) {
+ var req = new RemoteRequest(
+ "open-ils.search",
+ "open-ils.search.biblio.record.mods_slim.retrieve",
+ id );
+
+ if(callback) {
+ req.setCompleteCallback(
+ function(req) {callback(req.getResultObject())});
+ req.send();
+ } else {
+ req.send(true);
+ return req.getResultObject();
+ }
+}
+
+/* if callback exists, call is asynchronous and
+ the returned item is passed to the callback... */
+function fetchMetaRecord(id, callback) {
+ var req = new RemoteRequest(
+ "open-ils.search",
+ "open-ils.search.biblio.metarecord.mods_slim.retrieve",
+ id );
+
+ if(callback) {
+ req.setCompleteCallback(
+ function(req) {callback(req.getResultObject())});
+ req.send();
+ } else {
+ req.send(true);
+ return req.getResultObject();
+ }
+}
+/* if callback exists, call is asynchronous and
+ the returned item is passed to the callback... */
+/* XXX no method yet... */
+function fetchVolume(id, callback) {
+ var req = new RemoteRequest(
+ "open-ils.search",
+ "open-ils.search.biblio.metarecord.mods_slim.retrieve",
+ id );
+
+ if(callback) {
+ req.setCompleteCallback(
+ function(req) {callback(req.getResultObject())});
+ req.send();
+ } else {
+ req.send(true);
+ return req.getResultObject();
+ }
+}
+
+/* if callback exists, call is asynchronous and
+ the returned item is passed to the callback... */
+function fetchCopy(id, callback) {
+ var req = new RemoteRequest(
+ "open-ils.search",
+ "open-ils.search.asset.copy.fleshed.retrieve",
+ id );
+
+ if(callback) {
+ req.setCompleteCallback(
+ function(req) {callback(req.getResultObject())});
+ req.send();
+ } else {
+ req.send(true);
+ return req.getResultObject();
+ }
+}
+
+function mkResourceImage(resource) {
+ var pic = elem("img");
+ pic.setAttribute("src", "/images/" + resource + ".jpg");
+ pic.setAttribute("width", "20");
+ pic.setAttribute("height", "20");
+ pic.setAttribute("title", resource);
+ return pic;
+}
while(node.childNodes[0])
node.removeChild(node.childNodes[0]);
}
+ return node;
}
function userMessage(msg) {
alert("An unknown error occured during the following process: " + msg);
}
+
+
+
+/* returns [ xoffset, yoffset ] of the target node */
+function getXYOffsets(target) {
+
+ var x = findPosX(target);
+ var y = findPosY(target);
+ var height = getObjectHeight(target);
+ var xpos = x;
+
+ var offsety = y + height;
+ var offsetx = xpos;
+
+ if(IE) { /*HACK XXX*/
+ offsety = parseInt(offsety) + 15;
+ offsetx = parseInt(offsetx) + 8;
+ }
+
+ debug("getXYOffset y: " + offsety + " x: " + offsetx );
+ return [x, y];
+}
+
js( src='/js/opac/MyOPACSPage.js' );
js( src='/js/util/RemoteRequest.js' );
js( src='/js/util/webutils.js' );
+ js( src='/js/util/ils_utils.js' );
js( src='/js/util/UserSession.js' );
js( src='/js/util/Cookie.js' );
js( src='/js/util/ex.js' );
cell(content="Subjects", class='detail_item_label');
cell(id='record_detail_subject_cell');
END;
-
+
+ WRAPPER html/row class='detail_item_row';
+ cell(content="Abstract", class='detail_item_label');
+ cell(id='record_detail_abstract_cell');
+ END;
+
END; # table
END;