"?target=mr_result&mr_search_type=author&page=0&mr_search_query=" +
encodeURIComponent(auth) +
"&mr_search_depth=" + this.searchDepth +
- "&mr_search_location=" + this.searchLocation);
+ "&mr_search_location=" + this.searchLocation +
+ "&location=" + this.searchLocation +
+ "&depth=" + this.searchDepth);
href.appendChild(createAppTextNode(auth));
href.title = "Author search for " + auth;
"?target=mr_result&mr_search_type=series&page=0&mr_search_query=" +
encodeURIComponent(series) +
"&mr_search_depth=" + this.searchDepth +
- "&mr_search_location=" + this.searchLocation);
+ "&mr_search_location=" + this.searchLocation +
+ "&location=" + this.searchLocation +
+ "&depth=" + this.searchDepth);
href.appendChild(createAppTextNode(series));
href.title = "Series search for " + series;
"?target=mr_result&mr_search_type=subject&page=0&mr_search_query=" +
encodeURIComponent(sub) +
"&mr_search_depth=" + this.searchDepth +
- "&mr_search_location=" + this.searchLocation);
+ "&mr_search_location=" + this.searchLocation +
+ "&location=" + this.searchLocation +
+ "&depth=" + this.searchDepth);
+
href.appendChild(createAppTextNode(sub));
href.title = "Subject search for " + sub;
return href;
var lastSearchString = null;
var lastSearchType = null;
+/* this is true if we directed to the record detail page
+ becuase of only having one hit on the record result
+ page. this allows us to back up from the detail
+ page to the mr_result page */
+var recordResultRedirect = false;
var loaded = false;
if( isXUL() && globalAppFrame )
globalAppFrame.document.body.style.background = "#FFF";
- if(paramObj.__location != null) {
- globalSelectedLocation = findOrgUnit(paramObj.__location);
- debug("Setting selected location to " + globalSelectedLocation.name() );
- }
-
- if(paramObj.__depth != null) {
- globalSearchDepth = findOrgType(paramObj.__depth);
- debug("Setting selected depth to " + globalSearchDepth.name() );
- }
var page_name = globalPageTarget;
}
globalPage.init();
+
+ if(paramObj.__location != null) {
+ globalSelectedLocation = findOrgUnit(paramObj.__location);
+ debug("Setting selected location to " + globalSelectedLocation.name() );
+ }
+
+
+ if(paramObj.__depth != null) {
+ debug("Passed in depth from search params: " + paramObj.__depth);
+ globalSearchDepth = parseInt(paramObj.__depth);
+ debug("Setting selected depth to " + globalSearchDepth );
+ }
+
globalPage.setLocDisplay();
globalPage.locationTree = globalOrgTreeWidget;
globalPage.setPageTrail();
if( globalSearchBarFormChunk != null)
globalSearchBarFormChunk.resetPage();
+
+
}
add_css_class(href,"record_result_title_link");
href.setAttribute("href",
"?target=record_result&page=0&mrid=" + id +
- "&hits_per_page=" + this.hitsPerPage);
+ "&hits_per_page=" + this.hitsPerPage +
+ "&location=" + this.searchLocation +
+ "&depth=" + this.searchDepth );
href.appendChild(createAppTextNode(value));
href.title = "View titles for " + t + "";
break;
add_css_class(href,"record_result_title_link");
href.setAttribute("href",
"?target=record_result&page=0&mrid=" + id +
- "&hits_per_page=" + this.hitsPerPage);
+ "&hits_per_page=" + this.hitsPerPage +
+ "&location=" + this.searchLocation +
+ "&depth=" + this.searchDepth );
href.title = "View titles for " + t + "";
break;
createAppTextNode(record.types_of_resource()));
+ pic_cell.appendChild(this.mkImage(record));
+
+ var orgUnit = globalSelectedLocation;
+ if(!orgUnit) orgUnit = globalLocation;
+
+ this.drawCopyTrees(orgUnit, record);
+}
+
+/* sets up the cover art image */
+RecordDetailPage.prototype.mkImage = function(record) {
var isbn = record.isbn();
if(isbn) isbn = isbn.replace(/\s+/,"");
else isbn = "";
- var img_src = "http://images.amazon.com/images/P/" +isbn + ".01.MZZZZZZZ.jpg";
- var pic = createAppElement("img");
- pic.setAttribute("src", img_src);
- pic_cell.appendChild(pic);
+ var big_pic = elem("a", {
+ href : "http://images.amazon.com/images/P/" +isbn + ".01.LZZZZZZZ.jpg",
+ title : "Click for larger image" } );
- var orgUnit = globalSelectedLocation;
- if(!orgUnit) orgUnit = globalLocation;
+ var img_src = "http://images.amazon.com/images/P/" +isbn + ".01.MZZZZZZZ.jpg";
+ var pic = elem ( "img", { src : img_src }, { border : "0px none" });
+ big_pic.appendChild(pic);
- this.drawCopyTrees(orgUnit, record);
+ return big_pic;
}
+
/* if sync, it is a synchronous call */
RecordDetailPage.prototype.grabCopyTree = function(record, orgUnit, callback, sync) {
var href;
+ var org = globalSelectedLocation;
+ if(org == null)
+ org = globalLocation;
+
switch(type) {
+
case "title":
href = createAppElement("a");
add_css_class(href,"record_result_title_link");
- href.setAttribute("href","?target=record_detail&record=" + id );
+ href.setAttribute("href",
+ "?target=record_detail&record=" + id +
+ "&location=" + org.id() +
+ "&depth=" + globalSearchDepth );
href.appendChild(createAppTextNode(value));
href.title = "View title details for " + value;
break;
case "img":
href = createAppElement("a");
add_css_class(href,"record_result_image_link");
- href.setAttribute("href","?target=record_detail&page=0&mrid=" + id );
+ href.setAttribute("href",
+ "?target=record_detail&page=0&mrid=" + id +
+ "&location=" + org.id() +
+ "&depth=" + globalSearchDepth );
href.title = "View title details for " + value;
break;
try{
obj.gatherIDs(req.getResultObject());
- if(parseInt(obj.hitCount) == 1) {
- debug("Redirecting to record detail page with record " + obj.recordIDs[0] );
+ if(!recordResultRedirect) { /* if the user isn't just hitting the 'back' button */
+ if(parseInt(obj.hitCount) == 1) {
+ recordResultRedirect = true;
+ debug("Redirecting to record detail page with record " + obj.recordIDs[0] );
url_redirect( [
- "target", "record_detail",
- "record", obj.recordIDs[0] ] );
- return;
+ "target", "record_detail",
+ "record", obj.recordIDs[0] ] );
+ return;
+ }
+ } else {
+ recordResultRedirect = false;
}
obj.collectRecords();
for(var type in globalOrgTypes) {
var t =globalOrgTypes[type];
- if( t.id() == type_id )
+ if( t.id() == type_id || t.id() == parseInt(type_id) )
return t;
}
return null;