Created
October 2, 2012 22:45
-
-
Save jkeck/3823798 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_addl_item_info(bcode,building,document) | |
# we need to have ON-ORDER records dealt with even though they don't have a barcode | |
if doc_on_order?(document) | |
return {:request_status => true, :status => "unavailable"} | |
else | |
if document.respond_to?(:holdings_from_solr) | |
unless document["item_display"].nil? or bcode.strip.blank? | |
return mod_item(bcode,building,document,document.holdings_from_solr[bcode.strip.to_sym]) if document.holdings_from_solr.has_key?(bcode.strip.to_sym) | |
end | |
end | |
end | |
{} | |
end | |
def mod_item(bcode,building,document,item) | |
hsh = {} | |
return hsh if bcode.strip.blank? | |
if document.is_a?(SolrDocument) and document.respond_to?(:holdings_from_solr) | |
holdings_from_solr = document.holdings_from_solr[bcode.strip.to_sym] | |
end | |
hsh[:l_raw] = holdings_from_solr[:home_location] unless holdings_from_solr[:home_location].nil? | |
hsh[:k_raw] = holdings_from_solr[:current_location] unless holdings_from_solr[:current_location].nil? | |
hsh[:k] = Constants::LOCS[holdings_from_solr[:current_location]] unless holdings_from_solr[:current_location].nil? | |
hsh[:t] = holdings_from_solr[:type] unless holdings_from_solr[:type].nil? | |
if document.respond_to?(:to_marc) and document.respond_to?(:holdings_from_marc) and !document.holdings_from_marc.nil? and document.holdings_from_marc.has_key?(bcode.strip.to_sym) | |
document.holdings_from_marc[bcode.strip.to_sym].each{|subfield| | |
if subfield.code == "o" | |
if subfield.value.include?(".PUBLIC.") | |
hsh[subfield.code.to_sym] = subfield.value.strip[8,subfield.value.length].strip | |
end | |
end | |
} | |
end | |
hsh[:status] = get_item_status(building,hsh) unless hsh[:l_raw].nil? | |
hsh[:request_status] = get_request_status(building,hsh) unless hsh[:l_raw].nil? | |
hsh | |
end | |
def get_request_status(building,hsh) | |
# if the type code begins w/ NH- : Request Status = FALSE | |
if hsh[:t] and hsh[:t].strip[0,3] == "NH-" | |
return false | |
end | |
# if the item is in a SAL(*) then do not provide a request link | |
if building == "SAL" or building == "SAL3" or building == "SAL Newark" or building == "Physics" or building == "Meyer" | |
return false | |
end | |
# if the item is in Green Media Microtext : Request Status = FALSE | |
if building == "Green" and hsh[:l_raw] and hsh[:l_raw].strip == "MEDIA-MTXT" | |
return false | |
end | |
# if the raw location code ends in -30 : Request Status = TRUE | |
if hsh[:l_raw] and hsh[:l_raw].strip[-3,3] == "-30" | |
return true | |
end | |
if hsh[:t] and ["REF","NONCIRC","LIBUSEONLY"].include?(hsh[:t]) | |
return false | |
end | |
# if the raw home location is in the list of location codes to apply a request link to: Request Stats = TRUE | |
if hsh[:l_raw] and Constants::REQUEST_LOCS.include?(hsh[:l_raw]) | |
return true | |
end | |
# Stupid hack for -LOAN items that are not SEE-LOAN | |
if hsh[:k_raw] and hsh[:k_raw] != "SEE-LOAN" and hsh[:k_raw].strip[-5,hsh[:k_raw].strip.length] == "-LOAN" | |
return true | |
end | |
# if the raw current location is in the list of location codes to apply a request link to: Request Stats = TRUE | |
if hsh[:k_raw] and Constants::REQUESTABLE_CURRENT_LOCS.include?(hsh[:k_raw]) | |
return true | |
end | |
# if the raw current location is in the list of unavailable current locations | |
if hsh[:k_raw] and Constants::UNAVAILABLE_CURRENT_LOCS.include?(hsh[:k_raw]) | |
# commenting out unless check until we find out if the request forms application can handle SPEC in process items | |
return true# unless (building == "Special Collections" and (hsh[:l_raw] and hsh[:l_raw].strip[-3,3] != "-30")) | |
end | |
if hsh[:k_raw] and Constants::NON_REQUESTABLE_CURRENT_LOCS.include?(hsh[:k_raw]) | |
return false | |
end | |
if hsh[:l_raw] and Constants::NON_REQUESTABLE_HOME_LOCS.include?(hsh[:l_raw]) | |
return false | |
end | |
false | |
end | |
def get_item_status(building,hsh) | |
if building == "Special Collections" or building == "Hoover Archives" | |
return "noncirc_page" | |
end | |
if building == "ARS" | |
return "noncirc" | |
end | |
if (hsh[:l_raw] and hsh[:l_raw][-3,3] == "-30") | |
return "page" | |
end | |
if building == "Meyer" | |
return "no_req" | |
end | |
if building == "Lane" or building == "Business" | |
return "unknown" | |
end | |
if building == "SAL" or building == "SAL3" or building == "SAL Newark" | |
return "page" | |
end | |
# This is for forcing current locations to be available (even if they are checked out). | |
# We need to also account for NONCIRC locations in this. This is really poor practice | |
# and really needs to be reworked when we re-code the availability stuff. | |
if (hsh[:k_raw] and Constants::FORCE_AVAILABLE_CURRENT_LOCS.include?(hsh[:k_raw])) | |
if (Constants::NON_REQUESTABLE_CURRENT_LOCS.include?(hsh[:k_raw])) | |
return "force_available no_req_hide" | |
else | |
return "force_available" | |
end | |
end | |
if (hsh[:k_raw] and Constants::FORCE_NONCIRC_CURRENT_LOCS.include?(hsh[:k_raw])) | |
return "force_noncirc_page hide_date" | |
end | |
# Temporarily making all physics items unavailable | |
if building == "Physics" | |
return "unavailable" | |
end | |
if (hsh[:k_raw] and hsh[:k_raw] != "SEE-LOAN" and hsh[:k_raw].strip[-5,hsh[:k_raw].strip.length] == "-LOAN") | |
return "unavailable" | |
end | |
if Constants::UNKNOWN_LOCS.include?(hsh[:l_raw]) | |
return "unknown" | |
elsif (Constants::UNAVAILABLE_LOCS.include?(hsh[:l_raw]) or Constants::UNAVAILABLE_CURRENT_LOCS.include?(hsh[:k_raw])) | |
# this is just to account for MEDIA-MTXT items that can be INPROCESS | |
if (building == "Green" and (hsh[:l_raw] and hsh[:l_raw] == "MEDIA-MTXT")) | |
return "no_req unavailable" | |
else | |
return "unavailable" | |
end | |
elsif Constants::NON_REQUESTABLE_CURRENT_LOCS.include?(hsh[:k_raw]) | |
return "no_req_hide" | |
elsif Constants::NONCIRC_PAGE_LOCS.include?(hsh[:l_raw]) | |
return "noncirc_page" | |
elsif (Constants::NONCIRC_LOCS.include?(hsh[:l_raw]) or ["REF","NONCIRC","LIBUSEONLY"].include?(hsh[:t])) | |
return "noncirc" | |
elsif Constants::PAGE_LOCS.include?(hsh[:l_raw]) | |
return "page" | |
end | |
# doing this last so that items from Media are not given request links if checked out | Appending the NH- item type so that these items don't get request links if checked out. | |
if (building == "Green" and (hsh[:l_raw] and hsh[:l_raw] == "MEDIA-MTXT")) or (hsh[:t] and hsh[:t].strip[0,3] == "NH-") | |
return "no_req" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Constants | |
UNKNOWN_LOCS = ["ASK@EASIA", "ASK@GSB", "ASK@LANE", "CHECKSHELF", "SEE-OTHER", "STACKS-BW"] | |
PAGE_LOCS = ["EALSAL-CHN", "EALSAL-JPN", "EALSAL-KOR", "L-PAGE-EA", "MEDIA-30", "MEDIAX-30", "MSS-30", "PAGE-LP", "PAGE-MP", "SAL-ARABIC", "SAL-FOLIO", "SAL-LOAN", "SAL-MUSIC", "SAL-SERG", "SAL-TEMP", "SALTURKISH", "STACKS-30"] | |
LOCS = {"13TH-FLOOR" => "13th floor", | |
"15TH-FLOOR" => "15th floor", | |
"1ST-FLOOR" => "1st floor", | |
"2ND-FLOOR" => "2nd floor", | |
"2NDFLR-REF" => "2nd floor (Non-circulating)", | |
"3RD-FLOOR" => "3rd floor", | |
"3RDFLR-REF" => "3rd floor (Non-circulating)", | |
"ACAD-DATA" => "Social Sciences Data Services (SSDS)", | |
"ARABIC" => "Arabic", | |
"ARTLCKL" => "Locked Stacks, Large", | |
"ARTLCKL-R" => "Locked Stacks, Large (Restricted access)", | |
"ARTLCKM" => "Locked Stacks, Medium", | |
"ARTLCKM-R" => "Locked Stacks, Medium (Restricted access)", | |
"ARTLCKO" => "Locked Stacks, Oversize", | |
"ARTLCKO-R" => "Locked Stacks, Oversize (Restricted access)", | |
"ARTLCKS" => "Locked Stacks, Small", | |
"ARTLCKS-R" => "Locked Stacks, Small (Restricted access)", | |
"ART-LOAN" => "Art Library loan desk", | |
"ART-RESV" => "On Reserve at ART Library", | |
"ART-AT-ENG" => "Currently available at Engineering Library", | |
"ARTVAULT" => "Art Vault", | |
"ASK@EASIA" => "Check East Asia Library for holdings", | |
"ASK@GSB" => "Check Business Library catalog for status", | |
"ASK@LANE" => "Check Lane catalog for status", | |
"ASSMD-LOST" => "Assumed lost", | |
"ATLASES" => "Atlas Section", | |
"AT-REPAIR" => "Out for repair", | |
"AVAIL_SOON" => "Not available right now", | |
"B&F-HOLD" => "At bindery", | |
"BARCHAS" => "Barchas Collection (Non-circulating)", | |
"BASEMENT" => "Basement", | |
"BASEMNT" => "Basement", | |
"BENDER" => "Bender Room (Non-circulating)", | |
"BIB-INDEX" => "Bibliographies & Indexes Section", | |
"BILLED-OD" => "Overdue", | |
"BINDERY" => "At bindery", | |
"BIO-LOAN" => "Biology (Falconer) Loan Desk", | |
"BIO-RESV" => "On Reserve at FALCONER Library", | |
"BOX-COLL" => "Box Collection", | |
"BRAN-RESV" => "On Reserve at BRANNER Library", | |
"BRIT-DOCS" => "British Government Documents", | |
"CALIF-DOCS" => "California State Documents", | |
"CCRMA" => "Center for Computer Research in Music and Acoustics", | |
"CDL-2NDFL" => "Curriculum Development Lab", | |
"CDP" => "Collection Development Program", | |
"CDP-CHI" => "CDP-CHI", | |
"CDP-GER" => "Collection Development Program: Germanic Studies", | |
"CDP-JUDA" => "Collection Development Program: Judaica", | |
"CDP-LAT" => "Collection Development Program: Latin America", | |
"CDP-ROM" => "Collection Development Program: Romance Languages", | |
"CDP-SLAV" => "Collection Development Program: Slavic Studies", | |
#"CHECKEDOUT" => "Checked out - Due <date>", | |
"CHECKSHELF" => "Check shelf", | |
"CHE-LOAN" => "Chemistry & Chem Eng (Swain) Loan Desk", | |
"CHEM-RESV" => "On Reserve at SWAIN Library", | |
"CHINESE" => "Chinese Collection", | |
"CHKD-OUT-D" => "Ask at loan desk", | |
"COLL-WORKS" => "Storage Area: Collected Works Section", | |
"COMPACT" => "Compact shelving", | |
"COURSE-RES" => "Course Reserves", | |
"COURSE-VID" => "Course Videos", | |
"CPM-HOLDS" => "At bindery", | |
"CROTHERS" => "Crothers Collection", | |
"CURRENTPER" => "Current Periodicals", | |
"CURRICULUM" => "Curriculum Collection", | |
"CURRSTOR" => "Ask at loan desk", | |
"DOMESTIC" => "Domestic", | |
"EALSAL-CHN" => "Chinese materials in SAL 1&2", | |
"EALSAL-JPN" => "Japanese materials in SAL 1&2", | |
"EALSAL-KOR" => "Korean materials in SAL 1&2", | |
"EAL-SETS" => "East Asia Big Sets", | |
"EAL-STKS-C" => "Chinese Collection", | |
"EAL-STKS-J" => "Japanese Collection", | |
"EAL-STKS-K" => "Korean Collection", | |
"EAR-LOAN" => "Earth Sciences (Branner) Loan Desk", | |
"EARTH-RESV" => "On Reserve at BRANNER Library", | |
"EAS-LOAN" => "East Asia Loan Desk", | |
"EAS-RESV" => "East Asia Reserves", | |
"EDI" => "In process", | |
"EDU-LOAN" => "Education Loan Desk", | |
"EDU-RESV" => "On Reserve at EDUCATION Library", | |
"ENDPROCESS" => "Not available right now", | |
"ENGDISPLAY" => "Engineering Display (Latest 3 issues only)", | |
"ENG-LOAN" => "Engineering Loan Desk", | |
"ENG-RESV" => "On Reserve at ENGINEERING Library", | |
"EQUIPMENT" =>"Equipment: Ask at Desk", | |
"EXPEDITION" => "Expedition: Locked Stacks", | |
"FED-DOCS" => "US Federal Documents", | |
"FELTON" => "Felton Collection (Non-circulating)", | |
"FELTON-30" => "Felton Collection (Non-circulating)", | |
"FELT-STOR" => "Felton Storage (Non-circulating)", | |
"FOLIO" => "Folio", | |
"FOLIO-3RD" => "Folios on the 3rd Floor", | |
"FOLIO-BAS" => "Folios in the Basement", | |
"FOLIO-CHN" => "Chinese Folios", | |
"FOLIO-FLAT" => "Flat Folio", | |
"FOLIO-JPN" => "Japanese Folios", | |
"FOLIO-KOR" => "Korean Folios", | |
"FOREIGN" => "Foreign", | |
"FORN-DOCS" => "Foreign Government Documents", | |
"FRECOT" => "Frecot Collection (Non-circulating)", | |
"GADGETBAR" => "Gadget Bar", | |
"GOLDSTAR" => "Ask at loan desk", | |
"GREEN-RESV" => "Green Reserves", | |
"GRE-LOAN" => "Green Loan Desk", | |
"GSB-RESV" => "GSB Reserves", | |
"GUNST" => "Gunst Collection (Non-circulating)", | |
"GUNST-30" => "Gunst Collection (Non-circulating)", | |
"GUNST-STOR" => "Gunst Storage (Non-circulating)", | |
"HAS-ATLAS" => "HAS Atlas Collection (Lane Room) (Non-circulating)", | |
"HAS-CA" => "HAS California History (Lane Room) (Non-circulating)", | |
"HAS-DIGIT" => "HAS-DIGIT (Lane Room) (Non-circulating)", | |
"HAS-FIC" => "HAS Fiction (Lane Room)", | |
"HAS-FOLIO" => "HAS Folio (Lane Room) (Non-circulating)", | |
"HAS-JOURN" => "HAS Journal Collection (Lane Room) (Non-circulating)", | |
"HAS-LIT" => "HAS Literary Criticism (Lane Room) (Non-circulating)", | |
"HAS-NEWBK" => "HAS New Books (Lane Room)", | |
"HASRC" => "HASRC (Lane Room) (Non-circulating)", | |
"HAS-RR" => "HAS Ready Reference (Lane Room) (Non-circulating)", | |
"HAS-SU" => "HAS Stanford History (Lane Room) (Non-circulating)", | |
"HMS-PAGE" => "In transit", | |
"HMS-RETURN" => "In transit", | |
"HOLDS" => "Ask at loan desk", | |
"HOO-LOAN" => "Hoover Library Loan Desk", | |
"HOOV-RESV" => "Hoover Reserves Desk", | |
"HOP-LOAN" => "Hopkins Loan Desk", | |
"HOP-RESV" => "Hopkins Reserves", | |
"HVA-LOAN" => "Hoover Archives Loan Desk", | |
"HV-TRANS" => "In transit", | |
"HY-PAGE-EA" => "Harvard-Yenching Collection", | |
"IC" => "InfoCenter (Non-circulating)", | |
"IC-ATLAS" => "InfoCenter: Atlas Shelves (Non-circulating)", | |
"IC-CDROM" => "InfoCenter: CD-ROMS (Non-circulating)", | |
"IC-DESK" => "InfoCenter: Desk (Non-circulating)", | |
"IC-DISPLAY" => "InfoCenter: Display", | |
"IC-EXHIBIT" => "InfoCenter: Exhibit", | |
"IC-NEWS" => "InfoCenter: Newspapers (Non-circulating)", | |
"IC-RREF" => "InfoCenter: Ready Reference (Non-circulating)", | |
"IC-STATS" => "InfoCenter: Statistics Shelves (Non-circulating)", | |
"ILB-LOAN" => "Borrowed through ILB", | |
"ILL" => "Interlibrary loan", | |
"ILL-OFFICE" => "Interlibrary Services Department", | |
"INDEXES" => "Indexes", | |
"INPROCESS" => "In process", | |
"INSHIPPING" => "In process", | |
"INSTRUCTOR" => "Instructor's copy", | |
"INTCOLLCAT" => "International College Catalogs", | |
"INTERNET" => "Online Resource", | |
"INTL-DOCS" => "International Government Documents", | |
"INTRANSIT" => "In transit", | |
"JAPANESE" => "Japanese Collection", | |
"KOREAN" => "Korean Collection", | |
"LAC" => "Out for vendor cataloging", | |
"LANE-RESV" => "On Reserve at LANE MEDICAL Library", | |
"LANG-LAB" => "Language Lab", | |
"LANG-RESV" => "Language Lab Reserves", | |
"LAW-ARCHIV" => "Law Library Archives: Ask at loan desk", | |
"LAW-BIND" => "At bindery", | |
"LAW-LOAN" => "Law Loan Desk", | |
"LAW-RESV" => "Law Reserves: Ask at loan desk", | |
"LAW-REVIEW" => "Law Review", | |
"LAW-SPEC" => "Law Collection (Non-circulating)", | |
"LCKBYTITL" => "Locked Stacks: Ask at loan desk", | |
"LCK-STOR" => "Locked Stacks: Ask at loan desk", | |
"LEWIS-COLL" => "Lewis Collection", | |
"LOAN-DESK" => "Held at loan desk", | |
"LOCK-CHN" => "Locked Stacks: Ask at loan desk", | |
"LOCKED-DIS" => "Locked Stacks: Ask at loan desk", | |
"LOCKED-MAP" => "Locked Map Files: Ask at loan desk", | |
"LOCKED-STK" => "Locked Stacks: Ask at loan desk", | |
"LOCK-HOLDS" => "Locked Stacks: Ask at loan desk", | |
"LOCK-JPN" => "Locked Stacks: Ask at loan desk", | |
"LOCK-KOR" => "Locked Stacks: Ask at loan desk", | |
"LOST-ASSUM" => "", | |
"LOST-CLAIM" => "Lost", | |
"LOST-PAID" => "Lost", | |
"L-PAGE-EA" => "Locked Stacks", | |
"MANNING" => "Manning Collection (Non-circulating)", | |
"MANUSCRIPT" => "Manuscript Collection", | |
"MAP-CASES" => "Map cases", | |
"MAP-FILE" => "Map files", | |
"MAP-REF" => "Reference Maps", | |
"MAPS" => "Maps", | |
"MAP-STOR" => "Map Storage: Ask at loan desk", | |
"MATH-RESV" => "On Reserve at Math/Stats Library", | |
"MAT-LOAN" => "Mathematics & Statistics Loan Desk", | |
"MEDIA" => "Media", | |
"MEDIA-30" => "Media", | |
"MEDIA-MTXT" => "Media-Microtext (Lower Level)", | |
"MEDIA-RESV" => "Media Reserves", | |
"MEDIAX" => "Media Collection (Restricted access)", | |
"MEDIAX-30" => "Media Collection", | |
"MEDIEVALRM" => "Medieval Studies Room (Non-circulating)", | |
"MEMLIBMUS" => "Memorial Library of Music (Non-circulating)", | |
"MEYER-RESV" => "Reserves", | |
"MEY-LOAN" => "Meyer Tech Desk", | |
"MEZZANINE" => "Mezzanine Shelving Area", | |
"MICROFICHE" => "Microfiche", | |
"MICROFILM" => "Microfilm", | |
"MICROTEXT" => "Microtext", | |
"MINIATURE" => "Miniature", | |
"MISSING" => "Missing", | |
"MISS-INPRO" => "Missing", | |
"MSS-10" => "Manuscript Collection", | |
"MSS-20" => "Manuscript Collection", | |
"MSS-30" => "Manuscript Collection", | |
"MSSX" => "Manuscript Collection: Restricted access", | |
"MSSX-30" => "Manuscript Collection", | |
"MUSIC-RESV" => "On Reserve at MUSIC Library", | |
"MUS-LOAN" => "Music Loan Desk", | |
"MUS-NOCIRC" => "Music (Non-circulating)", | |
"MUS-TXTBK" => "Music Class Textbook", | |
"ND-PAGE-EA" => "NDC Collection", | |
"NEWBOOKS" => "New Book Shelf", | |
"NEWSPAPERS" => "Newspapers", | |
"NEWS-STKS" => "Newspaper Stacks", | |
"NEWTON" => "Newton Collection (Non-circulating)", | |
"ON-ORDER" => "On order", | |
"OPEN-RES" => "Open Reserves", | |
"OVERSIZED" => "Oversized", | |
"PAGE-AR" => "Use restricted to Art Library", | |
"PAGE-AS" => "Use restricted to Archive of Recorded Sound", | |
"PAGE-BI" => "Use restricted to Falconer (Biology)", | |
"PAGE-CH" => "Use restricted to Swain (Chemistry)", | |
"PAGE-CL" => "Use restricted to Classics Library", | |
"PAGE-EA" => "Use restricted to East Asia Library", | |
"PAGE-ED" => "Use restricted to Cubberley (Education)", | |
"PAGE-EN" => "Use restricted to Engineering Library", | |
"PAGE-ES" => "Use restricted to Branner (Earth Sciences)", | |
"PAGE-GR" => "Use restricted to Green", | |
"PAGE-HA" => "Use restricted to Hoover Archives", | |
"PAGE-HP" => "Use restricted to Hopkins (Marine Biology)", | |
"PAGE-HV" => "Use restricted to Hoover Library", | |
"PAGE-ILL" => "Paged to Interlibrary Loan Department", | |
"PAGE-JA" => "Paged to Business (GSB)", | |
"PAGE-LN" => "Paged to Lane (Medical)", | |
"PAGE-LP" => "Paging restricted to Music or Green Media-Microtext", | |
"PAGE-LW" => "Use restricted to Lane (Law)", | |
"PAGE-MA" => "Use restricted to Math/Stats Library", | |
"PAGE-MD" => "Use restricted to Green Media-Microtext", | |
"PAGE-MP" => "Paging restricted to Branner (Earth Sciences)", | |
"PAGE-MU" => "Use restricted to Music Library", | |
"PAGE-MY" => "Use restricted to Meyer", | |
"PAGE-PH" => "Use restricted to Physics Library", | |
"PAGE-RLCP" => "Paged for Research Library Cooperative Program", | |
"PAGE-SP" => "Use restricted to Special Collections", | |
"PAGE-TA" => "Use restricted to Tanner (Philosophy)", | |
"PERM-RES" => "Permanent Reserve", | |
"PERSIAN" => "Persian", | |
"PGDFROMSAL" => "Paged from SAL to campus library", | |
"PHOTO-PERM" => "Ask at loan desk", | |
"PHY-LOAN" => "Physics Loan Desk", | |
"PHYS-RESV" => "On Reserve at PHYSICS Library", | |
"PHYSTEMP" => "Currently online only", | |
"PUB-TECH" => "Not available right now", | |
"RARE-BOOKS" => "Rare Books Collection (Non-circulating)", | |
"RARE-STOR" => "Rare Books Storage (Non-circulating)", | |
"RAUB-COLL" => "Raubitschek Collection of Papyrology and Epigraphy", | |
"RBC-30" => "Rare Books Collection", | |
"RBCX" => "Rare Books Collection: Restricted access", | |
"RBCX-30" => "Rare Books Collection", | |
"READING-RM" => "Reading Room", | |
"READY-REF" => "Ready Reference Shelf", | |
"RECORDINGS" => "Recordings", | |
"REF-CHN" => "Reference (Chinese) (Non-circulating)", | |
"REF-DESK" => "Reference Desk (Non-circulating)", | |
"REFERENCE" => "Reference (Non-circulating)", | |
"REF-JPN" => "Reference (Japanese) (Non-circulating)", | |
"REF-KOR" => "Reference (Korean) (Non-circulating)", | |
"REF-SERIAL" => "Reference Serial (Non-circulating)", | |
"REPAIR" => "Sent for repair", | |
"RESEARCH" => "Research", | |
"SW-RESERVE-DESK" => "Request at Loan Desk", #special internal code that SearchWorks uses for reserves. | |
"SW-E-RESERVE-DESK" => "Online item on course reading list", #special internal code that SearchWorks uses for reserves. | |
"RESERVES" => "Reserves", | |
"RESV-DESKS" => "Reserves", | |
"RET-REF" => "Retired Reference (Non-circulating)", | |
"R-FOLIO" => "Folio (Limited loan)", | |
"R-FOLIO-FL" => "Flat folio (Limited loan)", | |
"R-MINIATUR" => "Miniature (Limited loan)", | |
"ROBINSON" => "Robinson Collection (Non-circulating)", | |
"ROB-STOR" => "Robinson Collection Storage (Non-circulating)", | |
"R-STACKS" => "Stacks (Limited loan)", | |
"RUMSEY" => "Rumsey Collection (Non-circulating)", | |
"SAFETY" => "Safety Collection (Non-circulating)", | |
"SAL-ARABIC" => "Temporary Shelving for Arabic Materials", | |
"SAL-FOLIO" => "Temporary Shelving for Folio Materials", | |
"SAL-LOAN" => "SAL Loan Desk", | |
"SAL-MUSIC" => "Temporary Shelving for Music Materials", | |
"SAL-PAGE" => "Temporary Shelving", | |
"SAL-RETURN" => "Returning to SAL", | |
"SAL-SERG" => "Science and Engineering Shelving at SAL", | |
"SAL-TEMP" => "Temporary Shelving", | |
"SALTURKISH" => "Temporary Shelving for Turkish Materials", | |
"SAMSON" => "Samson Collection", | |
"SCBS" => "Bldg. 70, Stanford Center for Buddhist Studies (Non-circulating)", | |
"SCORES" => "Scores", | |
"SEE-ARCHIV" => "Lent to Hoover Archives", | |
"SEE-EASTA" => "Lent to East Asia Library", | |
"SEE-LOAN" => "See Loan Desk for Access", | |
"SEE-OTHER" => "See related record(s) to request item", | |
"SERIALS" => "Serials", | |
"SHELBYSER" => "Serials", | |
#"SHELBYSER" => "Serials - Shelved by series title", | |
#"SHELBYTITL" => "Serials - Shelved by title", | |
"SHELBYTITL" => "Serials", | |
"SL3-LOAN" => "Ask at Green Loan Desk", | |
"SLN-LOAN" => "Ask at Green Loan Desk", | |
"SOUTH-MEZZ" => "Ask at loan desk", | |
"SPECDESK" => "Ask at Special Collections Service Desk", | |
"SPEC-STOR" => "Special Collections Storage", | |
"SPE-LOAN" => "Ask at Special Collections Service Desk", | |
"SSRC" => "Social Sciences Resource Center (Non-circulating)", | |
"SSRC-ANRPT" => "SSRC Annual Reports (Non-circulating)", | |
"SSRC-ATLAS" => "SSRC: Atlas Shelves (Non-circulating)", | |
"SSRC-CLASS" => "Social Sciences Resource Center: Classic Texts", | |
"SSRC-CSLI" => "SSRC: Center for the Study of Language & Information", | |
"SSRC-CURR" => "SSRC: Current Awareness (Non-circulating)", | |
"SSRC-DATA" => "Social Science Data and Software Virtual Data Collection", | |
"SSRC-DESK" => "Social Sciences Resource Center: Desk (Non-circulating)", | |
"SSRC-DOCS" => "SSRC: Government Documents (Non-circulating)", | |
"SSRC-FICHE" => "SSRC: Microfiche (Non-circulating)", | |
"SSRC-FILM" => "SSRC: Microfilm (Non-circulating)", | |
"SSRC-NEWBK" => "Social Sciences Resource Center: New Books Shelf", | |
"SSRC-NWDOC" => "Social Sciences Resource Center: New Documents Shelf", | |
"SSRC-SSDS" => "Social Science Data and Software - Velma Denning Room (non-circulating)", | |
"STACKS" => "Stacks", | |
"STACKS-1" => "Stacks 1", | |
"STACKS-2" => "Stacks 2", | |
"STACKS-3" => "Stacks 3", | |
"STACKS-30" => "Stacks", | |
"STACKS-BW" => "Bound with another item", | |
"STAFF" => "Ask at loan desk", | |
"STK-NOCIRC" => "Stacks, Non-circulating item", | |
"STKS1-NEW" => "New Book Shelf", | |
"STORAGE" => "Ask at loan desk", | |
"STORBYTITL" => "Storage Area: Shelved by title", | |
"SUL-BIND" => "At bindery", | |
"SULBIND-WA" => "Not available right now", | |
"SUL-LOAN" => "Ask at loan desk", | |
"TAN-LOAN" => "Tanner Loan Desk", | |
"TANN-RESV" => "On Reserve at TANNER Library", | |
"TAUBE" => "Taube Collection (Non-circulating)", | |
"TECH-ACQ" => "In Tech Services", | |
"TECH-CAT" => "In Tech Services", | |
"TECH-CONS" => "In Tech Services", | |
"TECH-PROC" => "In Tech Services", | |
"TECH-RPTS" => "Technical Reports", | |
"TECH-SER" => "In Tech Services", | |
"TECH-SERV" => "In Tech Services", | |
"TEMP-LL" => "Not available right now", | |
"TEMP-LOC" => "Ask at loan desk", | |
"THEA-STOR" => "Theatre Collection Storage (Non-circulating)", | |
"THEATRE" => "Theatre Collection (Non-circulating)", | |
"THESES" => "Theses", | |
"TIMO-COLL" => "Timoshenko Collection (Non-circulating): Ask at loan desk", | |
"TINY" => "Miniature", | |
"TRES-LAIR" => "Tresidder LAIR", | |
"TURKISH" => "Turkish", | |
"UARCH-30" => "University Archives", | |
"U-ARCHIVES" => "University Archives: Request at Special Collections Desk", | |
"UARCH-REF" => "University Archives Reference (Non-circulating)", | |
"UARCH-STOR" => "University Archives Storage (Non-circulating)", | |
"UARCHX" => "University Archives: Restricted access", | |
"UARCHX-30" => "University Archives", | |
"UNCAT" => "Uncataloged", | |
"UNDERGRAD" => "Undergraduate Collection", | |
"US-LOCAL" => "US Local Documents", | |
"US-STATE" => "US State Documents", | |
"VARIES" => "Ask at loan desk", | |
"VAULT" => "Vault", | |
"VROOMAN" => "Vrooman Collection", | |
"WEST-7B" => "Ask at loan desk"} | |
NONCIRC_LOCS = ["MICROFICHE", | |
"2NDFLR-REF", | |
"3RDFLR-REF", | |
"ARTLCKL-R", | |
"ARTLCKM-R", | |
"ARTLCKO-R", | |
"ARTLCKS-R", | |
"ARTLCKL", | |
"ARTLCKM", | |
"ARTLCKO", | |
"ARTLCKS", | |
"BARCHAS", | |
"BENDER", | |
"FELTON", | |
"FELT-STOR", | |
"FRECOT", | |
"GUNST", | |
"GUNST-30", | |
"GUNST-STOR", | |
"HAS-ATLAS", | |
"HAS-CA", | |
"HAS-DIGIT", | |
"HAS-FOLIO", | |
"HAS-JOURN", | |
"HAS-LIT", | |
"HASRC", | |
"HAS-RR", | |
"HAS-SU", | |
"IC", | |
"IC-ATLAS", | |
"IC-CDROM", | |
"IC-DESK", | |
"IC-NEWS", | |
"IC-RREF", | |
"IC-STATS", | |
"LAW-SPEC", | |
"MANNING", | |
"MEDIEVALRM", | |
"MEMLIBMUS", | |
"MUS-NOCIRC", | |
"NEWTON", | |
"PERM-RES", | |
"RARE-BOOKS", | |
"RARE-STOR", | |
"RBCX", | |
"REF-CHN", | |
"REF-DESK", | |
"REFERENCE", | |
"REF-JPN", | |
"REF-KOR", | |
"REF-SERIAL", | |
"RET-REF", | |
"ROBINSON", | |
"ROB-STOR", | |
"RUMSEY", | |
"SAFETY", | |
"SCBS", | |
"SSRC", | |
"SSRC-ANRPT", | |
"SSRC-ATLAS", | |
"SSRC-CURR", | |
"SSRC-DATA", | |
"SSRC-DESK", | |
"SSRC-DOCS", | |
"SSRC-FICHE", | |
"SSRC-FILM", | |
"SSRC-SSDS", | |
"STK-NOCIRC", | |
"TAUBE", | |
"THEA-STOR", | |
"THEATRE", | |
"TIMO-COLL"] | |
NONCIRC_PAGE_LOCS = ["FELTON-30", | |
"PAGE-AR", | |
"PAGE-AS", | |
"PAGE-BI", | |
"PAGE-CH", | |
"PAGE-CL", | |
"PAGE-EA", | |
"PAGE-ED", | |
"PAGE-EN", | |
"PAGE-ES", | |
"PAGE-GR", | |
"PAGE-HA", | |
"PAGE-HP", | |
"PAGE-HV", | |
"PAGE-LW", | |
"PAGE-MA", | |
"PAGE-MD", | |
"PAGE-MU", | |
"PAGE-MY", | |
"PAGE-PH", | |
"PAGE-SP", | |
"PAGE-TA", | |
"RBC-30", | |
"RBCX-30", | |
"UARCH-30", | |
"U-ARCHIVES", | |
"UARCH-REF", | |
"UARCH-STOR", | |
"UARCHX", | |
"UARCHX-30"] | |
UNAVAILABLE_LOCS = ["ASSMD-LOST", | |
"AT-REPAIR", | |
"AVAIL_SOON", | |
"B&F-HOLD", | |
"BILLED-OD", | |
"BINDERY", | |
#"CHECKEDOUT", | |
'CHKD-OUT-D', | |
"CPM-HOLDS", | |
"EDI", | |
"ENDPROCESS", | |
"HMS-PAGE", | |
"HMS-RETURN", | |
"HV-TRANS", | |
"ILL", | |
"ILL-OFFICE", | |
"INPROCESS", | |
"INSHIPPING", | |
"INTRANSIT", | |
"LAW-BIND", | |
"LOST-ASSUM", | |
"LOST-CLAIM", | |
"LOST-PAID", | |
"MISSING", | |
"MISS-INPRO", | |
"ON-ORDER", | |
"PAGE-ILL", | |
"PAGE-JA", | |
"PAGE-LN", | |
"PAGE-RLCP", | |
"PGDFROMSAL", | |
"PUB-TECH", | |
"REPAIR", | |
# removing SAL-PAGE from unavailable locations per Vitus' request | |
#"SAL-PAGE", | |
"SAL-RETURN", | |
"SEE-ARCHIV", | |
"SEE-EASTA", | |
"SUL-BIND", | |
"SULBIND-WA", | |
"TECH-ACQ", | |
"TECH-CAT", | |
"TECH-CONS", | |
"TECH-PROC", | |
"TECH-SER", | |
"TECH-SERV", | |
"TEMP-LL"] | |
REQUEST_LOCS = ["GUNST-30", | |
"FELTON-30", | |
"RBC-30", | |
"RBCX-30", | |
"UARCH-30", | |
"UARCHX-30", | |
"MEDIA-30", | |
"MEDIAX-30", | |
"MSS-30", | |
"STACKS-30", | |
"AT-REPAIR", | |
"AVAIL_SOON", | |
"B&F-HOLD", | |
"BILLED-OD", | |
"BINDERY", | |
#"CHECKEDOUT", | |
"EDI", | |
"ENDPROCESS", | |
"INPROCESS", | |
"INSHIPPING", | |
"ON-ORDER", | |
"PUB-TECH", | |
"REPAIR", | |
"SAL-RETURN", | |
"SUL-BIND", | |
"SULBIND-WA", | |
"TECH-ACQ", | |
"TECH-CAT", | |
"TECH-CONS", | |
"TECH-PROC", | |
"TECH-SER", | |
"TECH-SERV", | |
"TEMP-LL", | |
"MSSX-30"] | |
REQUESTABLE_CURRENT_LOCS = [ | |
"MISSING", | |
"NEWBOOKS" | |
] | |
FORCE_AVAILABLE_CURRENT_LOCS = [ | |
"ART-AT-ENG", | |
"IC-DISPLAY" | |
] | |
FORCE_NONCIRC_CURRENT_LOCS = [ | |
"NEWBOOKS" | |
] | |
UNAVAILABLE_CURRENT_LOCS = ["AT-REPAIR", | |
"AVAIL_SOON", | |
"B&F-HOLD", | |
"BILLED-OD", | |
"BINDERY", | |
#"CHECKEDOUT", | |
"CPM-HOLDS", | |
"ENDPROCESS", | |
"INPROCESS", | |
"INTRANSIT", | |
"MISSING", | |
"ON-ORDER", | |
"PUB-TECH", | |
"REPAIR", | |
"SAL-RETURN", | |
"SUL-BIND", | |
"SULBIND-WA", | |
"TECH-ACQ", | |
"TECH-CAT", | |
"TECH-CONS", | |
"TECH-PROC", | |
"TECH-SER", | |
"TECH-SERV", | |
"TEMP-LL"] | |
NON_REQUESTABLE_CURRENT_LOCS = [ | |
"ART-AT-ENG", | |
"IC-DISPLAY", | |
"LAC", | |
"SEE-LOAN" | |
] | |
NON_REQUESTABLE_HOME_LOCS = [ | |
"SEE-OTHER" | |
] | |
HIDE_DUE_DATE_CURRENT_LOCS = [ | |
"ART-AT-ENG", | |
"IC-DISPLAY", | |
"NEWBOOKS", | |
"SEE-LOAN" | |
] | |
EALSAL_LOCS = [ | |
"EALSAL-CHN", | |
"EALSAL-JPN", | |
"EALSAL-KOR", | |
"L-PAGE-EA" | |
] | |
CURRENT_HOME_LOCS = [ | |
"ART-RESV", | |
"BIO-RESV", | |
"BRAN-RESV", | |
"CHEM-RESV", | |
"EARTH-RESV", | |
"EAS-RESV", | |
"EDU-RESV", | |
"ENG-RESV", | |
"GREEN-RESV", | |
"GSB-RESV", | |
"HAS-NEWBK", | |
"HOOV-RESV", | |
"HOP-RESV", | |
"IC-DISPLAY", | |
"LANE-RESV", | |
"LANG-RESV", | |
"LAW-RESV", | |
"LOAN-DESK", | |
"MATH-RESV", | |
"MEDIA-RESV", | |
"MEYER-RESV", | |
"MUSIC-RESV", | |
"PHYS-RESV", | |
"RESV-DESKS", | |
"RESERVES", | |
"SEE-LOAN", | |
"TANN-RESV", | |
"SSRC-NEWBK" | |
] | |
RESERVE_DESKS = { | |
"ART-RESV" => "ART", | |
"BIO-RESV" => "BIOLOGY", | |
"CHEM-RESV" => "CHEMCHMENG", | |
"E-RESV" => "SW-E-RESV", | |
"EARTH-RESV" => "EARTH-SCI", | |
"EAS-RESV" => "EAST-ASIA", | |
"EDU-RESV" => "EDUCATION", | |
"ENG-RESV" => "ENG", | |
"GREEN-RESV" => "GREEN", | |
"HOOV-RESV" => "HOOVER", | |
"HOP-RESV" => "HOPKINS", | |
"LAW-RESV" => "LAW", | |
"MATH-RESV" => "MATH-CS", | |
"MEDIA-RESV" => "SW-MEDIA-RESV", | |
"MUSIC-RESV" => "MUSIC" | |
} | |
LIB_TRANSLATIONS = {#"APPLIEDPHY" => "Applied Physics Dept", | |
"ARS" => "ARS", | |
"ART" => "Art", | |
"BIOLOGY" => "Falconer", | |
"CHEMCHMENG" => "Swain", | |
"CLASSICS" => "Classics", | |
#"CPM" => "Obsolete", | |
"EARTH-SCI" => "Branner", | |
"EAST-ASIA" => "East Asia", | |
"EDUCATION" => "Cubberley", | |
"SW-E-RESV" => "eReserve", # Library does not exist, this is an internal code used for reserves. | |
"ENG" => "Engineering", | |
"GOV-DOCS" => "Government Docs", | |
"GREEN" => "Green", | |
"GRN-REF" => "Green", | |
"HOOVER" => "Hoover Library", | |
"HOPKINS" => "Hopkins", | |
"HV-ARCHIVE" => "Hoover Archives", | |
#"ILB" => "Ignore", | |
"LANE-MED" => "Lane", | |
"LAW" => "Crown (Law)", | |
"JACKSON" => "Business", | |
"MATH-CS" => "Mathematics & Statistics", | |
"SW-MEDIA-RESV" => "Media Microtext", # Library does not exist, this is an internal code used for reserves. | |
"MEYER" => "Meyer", | |
"MUSIC" => "Music", | |
"PHYSICS" => "Physics", | |
"SAL" => "SAL 1&2", | |
"SAL3" => "SAL3", | |
"SAL-NEWARK" => "SAL Newark", | |
"SPEC-COLL" => "Special Collections", | |
#"SPEC-DESK" => "(In-transit location for SAL paged items)", | |
"TANNER" => "Tanner" | |
#"SUL" => "Ignore" | |
} | |
TRANSLATE_STATUS = { | |
"page" => "must be paged/requested", | |
"unavailable" => "unavailable", | |
"noncirc" => "in-library use only", | |
"unknown" => "status unknown", | |
"no_req unavailable" => "unavailable", | |
"noncirc_page" => "must be paged/requested for in-library use only" | |
} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def index | |
if request.env['HTTP_USER_AGENT'] =~ /bot/ or request.env['HTTP_USER_AGENT'] =~ /spider/ or request.env['HTTP_USER_AGENT'] =~ /crawl/ or request.env['HTTP_USER_AGENT'] =~ /teoma/ | |
return nil | |
end | |
if Rails.env.production? | |
live_lookup_server = "jenson" | |
else | |
live_lookup_server = "zaph" | |
end | |
if params[:ids] | |
ids = params[:ids] | |
id_arr = [] | |
if ids.length > 1 | |
i = 0 | |
ids.each do |l| | |
id_arr << "id#{i.to_s}=#{l}" | |
i += 1 | |
end | |
begin | |
timeout(15) do | |
xml = REXML::Document.new(Net::HTTP.get(URI.parse("http://#{live_lookup_server}.stanford.edu/cgi-bin/vufind.pl?search=holdings&#{id_arr.join('&')}"))) | |
end | |
rescue TimeoutError | |
return render(:text=>"Live lookup request timed out", :layout=>false) | |
end | |
xml = REXML::Document.new(Net::HTTP.get(URI.parse("http://#{live_lookup_server}.stanford.edu/cgi-bin/vufind.pl?search=holdings&#{id_arr.join('&')}"))) | |
else | |
begin | |
timeout(15) do | |
xml = REXML::Document.new(Net::HTTP.get(URI.parse("http://#{live_lookup_server}.stanford.edu/cgi-bin/vufind.pl?search=holding&id=#{ids}"))) | |
end | |
rescue TimeoutError | |
return render(:text=>"Live lookup request timed out", :layout=>false) | |
end | |
xml = REXML::Document.new(Net::HTTP.get(URI.parse("http://#{live_lookup_server}.stanford.edu/cgi-bin/vufind.pl?search=holding&id=#{ids}"))) | |
end | |
end | |
holdings = {} | |
@text = "" | |
xml.elements.each('*/record') {|records| | |
lib = records.elements['catalog/callnum_records/library'].text | |
if translate_lib.has_key?(lib) | |
lib = translate_lib[lib] | |
else | |
lib = lib | |
end | |
# The unless section below is dealing with the Sirsi upgrade. Zaph has a version of Sirsi that uses home_location and Jenson has a version of Sirsi that uses location. | |
# Once the upgrade is complete to Jenson (tentatively scheduled for winter break 2010) we can just go with home_location | |
unless records.elements['catalog/item_record/location'].nil? | |
loc = records.elements['catalog/item_record/location'].text | |
else | |
loc = records.elements['catalog/item_record/home_location'].text | |
end | |
# I don't think we need to do the LOST-ASSUM thing because the items are checked out. As long as we don't specifically say that this | |
# location should behave differently than any other checked out item then we should be fine. | |
if loc == "CHECKEDOUT"# or loc == "LOST-ASSUM" | |
num = 0 | |
records.elements.each('catalog/item_record/location') {|l| num += 1; num > 1 ? loc = l.text : nil } | |
end | |
if translate_loc.has_key?(loc) | |
loc = translate_loc[loc] | |
else | |
loc = loc | |
end | |
call_num = records.elements['catalog/callnum_records/item_number'].text | |
ckey = records.elements['catalog/catalog_key'].text | |
barcode = records.elements['catalog/item_record/item_id'].text | |
if records.elements['catalog/item_record/date_time_due'].nil? or records.elements['catalog/item_record/date_time_due'].text == "NEVER" | |
availability = 'Available' | |
due_date = "" | |
else | |
availability = 'Checked Out' | |
due_date = records.elements['catalog/item_record/date_time_due'].text | |
end | |
if holdings.has_key?(ckey) | |
if holdings[ckey].has_key?("#{lib}_#{loc}") | |
holdings[ckey]["#{lib}_#{loc}"] << [call_num,availability, due_date,barcode] | |
else | |
holdings[ckey]["#{lib}_#{loc}"] = [[call_num,availability, due_date,barcode]] | |
end | |
else | |
unless lib == "SUL" and loc == "Online" and call_num == "INTERNET RESOURCE" | |
holdings[ckey] = {"#{lib}_#{loc}" => [[call_num,availability, due_date,barcode]]} | |
end | |
end | |
} # each xml element | |
if params[:type] == 'show' | |
holdings.each do |ckey,lib_loc| | |
lib_loc.each do |loc,item_details| | |
item_details.each do |item_detail| | |
@text << "<span id='avail_#{item_detail[3]}'>" | |
if item_detail.include?("Checked Out") | |
if item_detail[2][-6,6] == ",23:59" | |
@text << item_detail[2].gsub(",23:59","") | |
else | |
@text << item_detail[2] | |
end | |
else | |
@text << "available" | |
end | |
@text << "</span>" | |
end | |
end | |
end | |
elsif params[:type] == 'index' or params[:type] == 'browse' | |
holdings.each do |ckey,lib_loc| | |
lib_loc.each do |loc,item_details| | |
item_details.each do |item_detail| | |
@text << "<span id='avail_#{item_detail[3]}'>" | |
if item_details.length > 1 | |
# if none are available then unavailable | |
if !item_details.flatten.include?("Available") | |
@text << "unavailable" | |
# if none of the items are checked out | |
elsif !item_details.flatten.include?("Checked Out") | |
@text << "available" | |
# if neither of the above conditions are met (ie a mix of checked out and non checked out items, then its unknown | |
else | |
@text << "unknown" | |
end | |
else | |
if item_details.flatten.include?("Checked Out") | |
@text << "unavailable" | |
else | |
@text << "available" | |
end | |
end | |
@text << "</span>" | |
end | |
end | |
end | |
end # if index | |
render :text => @text, :layout => false | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type='text/javascript'> | |
//<![CDATA[ | |
$(document).ready(function(){ | |
if (typeof(id_array) !== 'undefined' ) { | |
$.get("<%= access_data_path %>?record_id=<%= params[:id] %>&type=<%= params[:action].to_s %>&ids[]=" + id_array.join('&ids[]='), function(data){ | |
var $resp = $(data); | |
$resp.filter("span").each(function(){ | |
if($(this).text() == "available"){ | |
if($("#" + $(this).attr("id")).attr("class") != "no_req_hide"){ | |
$("#" + $(this).attr("id")).addClass('item_available'); | |
if($("#" + $(this).attr("id")).children("span.off_screen").text() == ""){ | |
$("#" + $(this).attr("id")).children("span.off_screen").text("available"); | |
} | |
if($("#" + $(this).attr("id")).attr("title") == ""){ | |
$("#" + $(this).attr("id")).attr("title",'available'); | |
} | |
}else{ | |
$("#" + $(this).attr("id")).addClass('unavailable'); | |
$("#" + $(this).attr("id")).children("span.off_screen").text("unavailable"); | |
$("#" + $(this).attr("id")).attr("title",'unavailable'); | |
} | |
}else if (<%= page_location == 'search_results' or page_location == "browse_view" %>) { | |
if($(this).text() == "unknown"){ | |
$("#" + $(this).attr("id")).addClass('unknown'); | |
if($("#" + $(this).attr("id")).attr("title") == ""){ | |
$("#" + $(this).attr("id")).attr("title",'status unknown'); | |
} | |
}else{ | |
$("#" + $(this).attr("id")).addClass('unavailable'); | |
if($("#" + $(this).attr("id")).attr("title") == ""){ | |
$("#" + $(this).attr("id")).attr("title",'unavailable'); | |
} | |
} | |
}else if (<%= page_location == 'record_view' %>) { | |
if(!$("#" + $(this).attr("id")).hasClass("no_req_hide") && !$("#" + $(this).attr("id")).hasClass("hide_date")){ | |
var temp = ""; | |
temp += "Due " + $(this).text(); | |
if ($("#" + $(this).attr("id")).attr("class") != "noncirc" && $("#" + $(this).attr("id")).attr("class") != "no_req"){ | |
temp += " " + $("#" + $(this).attr("id") + "_req_link").html(); | |
} | |
$("#" + $(this).attr("id")).next("span.current_location").append(temp); | |
$("#" + $(this).attr("id")).next("span.current_location").children("span.request_link").toggle(); | |
} | |
$("#" + $(this).attr("id")).addClass('unavailable'); | |
if($("#" + $(this).attr("id")).attr("title") == ""){ | |
$("#" + $(this).attr("id")).attr("title",'unavailable'); | |
} | |
$("#" + $(this).attr("id")).children("span.off_screen").text("unavailable"); | |
if($("#hopkins_page_link").length > 0){ | |
$("#hopkins_page_link .loc_link").toggle(); | |
$("#hopkins_page_link #hopkins_loc").toggle(); | |
} | |
} | |
}); | |
}); | |
} | |
}); | |
//]]> | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%- callnums = get_callnum(doc) -%> | |
<%- mhld = doc.mhld -%> | |
<%- holdings_list = get_holdings_order_list(doc.mhld,callnums) -%> | |
<% unless callnums.empty? and (mhld.nil? or mhld.blank?) %> | |
<h3 class="facet_selected">At the Library<span class="toggle"></span></h3> | |
<div> | |
<%- holdings_list.each do |holding| -%> | |
<%- lib = holding[:library] -%> | |
<%- loc = holding[:location] -%> | |
<%- if callnums.has_key?(lib) or (!mhld.nil? and mhld.has_key?(lib)) -%> | |
<%- if lib == "Special Collections" -%> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
if($("span#__GBS_Button0").length && $("span#__GBS_Button0").next("span").attr("class") != "spec_note") { | |
$("span#__GBS_Button0").after("<br/><div class='spec_note' style='color:red;font-size:0.8em;text-align:center;'>Special Collections note: This scanned item is not Stanford's copy.</div>"); | |
} | |
}); | |
</script> | |
<%- end -%> | |
<%- if (callnums.has_key?(lib) and callnums[lib].has_key?(loc)) -%> | |
<% callnums[lib][loc].sort!{|array1,array2| array1[4]<=>array2[4] } %> | |
<%- item_detail = callnums[lib][loc] -%> | |
<ul class="show_availability"> | |
<li> | |
<% if Constants::LOCS.index(loc) != "SEE-OTHER" and lib == "SAL 1&2" or lib == "SAL3" or lib == "SAL Newark" or (lib == "Hopkins" and doc['url_fulltext'].blank? and doc['url_sfx'].blank? and (marc_links.blank? or (!marc_links.blank? and marc_links[:full_text].blank?)) and callnums.keys.length == 1 and (loc == "Stacks" or loc == "In transit")) %> | |
<span class="library"> | |
<%= h(lib) %> | |
</span> - | |
<span class="location" <%= lib == "Hopkins" ? "id='hopkins_page_link'" : "" %>> | |
<%- if loc == "Stacks" -%> | |
<a href="<%= generate_request_link(doc,loc,{:barcode=>item_detail.first[1],:single_item=>false}) -%>">Page for delivery<span class="off_screen"> from <%= h(lib) %></span></a> | |
<span class="location" id="hopkins_loc" style="display:none;"><%= loc %></span> | |
<%- else -%> | |
<%= loc %> | |
<%- end -%> | |
</span> | |
<% else %> | |
<span class="library"><%= h(lib) %></span> - | |
<span class="location"> | |
<%- if lib == "Lane" -%> | |
<a href="http://lmldb.stanford.edu/cgi-bin/Pwebrecon.cgi?DB=local&Search_Arg=SOCW+<%= callnums[lib][loc][0][1].to_s.gsub(/^L/,'') %>&Search_Code=CMD*&CNT=10">Check Lane catalog for status</a> | |
<%- elsif lib == "Business" -%> | |
<a href="http://jbldb.stanford.edu/cgi-bin/Pwebrecon.cgi?DB=local&Search_Arg=<%= callnums[lib][loc][0][1].to_s[0,2] == 'JJ' ? callnums[lib][loc][0][1].to_s.gsub(/^JJ/,'035a+') : callnums[lib][loc][0][1].to_s.gsub(/^J/,'0359+') %>&Search_Code=CMD*&CNT=10">Check Business Library catalog for status</a> | |
<%- else -%> | |
<%= loc %> | |
<%- if lib == "Green" and loc != "Request at Loan Desk" -%> | |
<%= link_to("(map)", stackmap_catalog_path(doc[:id], :home_location => doc.holdings_from_solr[item_detail.first[1].to_sym][:home_location]), :class=>"lightboxLink stackmap") %> | |
<%- end -%> | |
<%- if Constants::EALSAL_LOCS.include?(Constants::LOCS.index(loc)) -%> | |
<a href="<%= generate_request_link(doc,Constants::LOCS.index(loc),{:barcode=>item_detail.first[1],:single_item=>false,:stupid_eal_hack=>true}) -%>">Page for delivery<span class="off_screen"> from <%= h(lib) %></span></a> | |
<%- elsif Constants::LOCS.index(loc) == "SSRC-DATA" -%> | |
<a href="<%= generate_request_link(doc,Constants::LOCS.index(loc),{:barcode=>item_detail.first[1],:single_item=>false,:ssrc_data=>true}) -%>">Request this dataset</a> | |
<%- end -%> | |
<%- end-%> | |
</span> | |
<% end %> | |
<%- if lib == "Special Collections" or lib == "Hoover Archives" -%> | |
<br/> | |
<span class="access_note">Request at service desk</span> | |
<%- end -%> | |
<%- if ((lib == "SAL 1&2" or lib == "SAL3" or lib == "SAL Newark") and loc != "Stacks") and Constants::LOCS.index(loc) != "SEE-OTHER" -%> | |
<br/> | |
<%- if Constants::LOCS.index(loc) == "L-PAGE-EA" -%> | |
<a class="salstacks" href="<%= generate_request_link(doc,Constants::LOCS.index(loc),{:barcode=>item_detail.first[1],:single_item=>false, :stupid_eal_hack=>true}) -%>">Page for delivery<span class="off_screen"> from <%= lib %></span></a> | |
<%- else -%> | |
<a class="salstacks" href="<%= generate_request_link(doc,loc,{:barcode=>item_detail.first[1],:single_item=>false}) -%>">Page for delivery<span class="off_screen"> from <%= lib %></span></a> | |
<%- end -%> | |
<%- end -%> | |
<%- if doc.respond_to?(:mhld) and !doc.mhld.nil? and doc.mhld.has_key?(lib) and doc.mhld[lib].has_key?(loc) -%> | |
<div class="mhld"> | |
<%- mhld_counter = 1 -%> | |
<%- doc.mhld[lib][loc].each do |comment,mhlds| -%> | |
<ul<%= " class='last'" if mhld_counter == doc.mhld[lib][loc].length %>> | |
<%= "<li>#{mhlds.first[:comment]}</li>".html_safe unless mhlds.first[:comment].blank? or mhlds.first[:comment] == :blank_comment %> | |
<%- mhlds.each do |current_mhld| -%> | |
<%= "<li><span class='mhld_label'>Library has: </span>#{current_mhld[:library_has]}</li>".html_safe unless current_mhld[:library_has].blank? %> | |
<%- end -%> | |
<%- mhlds.each do |current_mhld| -%> | |
<%= "<li><span class='mhld_label'>Latest: </span>#{current_mhld[:latest_received]}</li>".html_safe unless current_mhld[:latest_received].blank? %> | |
<%- end -%> | |
</ul> | |
<%- mhld_counter += 1 -%> | |
<%- end -%> | |
</div> | |
<%- end -%> | |
<ol class="item_list<%= " hide-callnumbers" if item_detail.length > 3 %>"> | |
<% item_detail.each_with_index do |cnum_bcode,ind| %> | |
<% addl_info = get_addl_item_info(cnum_bcode[1],lib,doc) %> | |
<%- if lib == "Hopkins" and (doc["url_fultext"] or doc["url_sfx"] or !marc_links.nil? or callnums.keys.length > 1) -%> | |
<%- request_link = "" -%> | |
<%- else -%> | |
<% request_link = "[<a href='#{generate_request_link(doc,loc,{:barcode=>cnum_bcode[1]})}'>request<span class='off_screen'> #{cnum_bcode[2]}</span></a>]".html_safe %> | |
<%- end -%> | |
<li<%= " class='hidden-callnum'" if item_detail.length > 3 and ind >= 3 %>> | |
<span id="avail_<%= cnum_bcode[1] %>_req_link" style="display:none;"><%= request_link %></span> | |
<span id="avail_<%= cnum_bcode[1] %>" class="<%= addl_info[:status] %>" <%= Constants::TRANSLATE_STATUS.has_key?(addl_info[:status]) ? "title='#{Constants::TRANSLATE_STATUS[addl_info[:status]]}'" : "" %>> | |
<%= cnum_bcode[2] %> | |
<span class="off_screen"><%= Constants::TRANSLATE_STATUS.has_key?(addl_info[:status]) ? Constants::TRANSLATE_STATUS[addl_info[:status]] : "" %></span> | |
</span> | |
<%- if (addl_info[:request_status] and addl_info[:k].nil?) -%> | |
<span class="request_link"><%= request_link %></span> | |
<%- end -%> | |
<span class="current_location"> | |
<%- unless addl_info[:k].nil? -%> | |
<%= addl_info[:k] %> | |
<%- end -%> | |
<%- unless cnum_bcode[5].nil? %> | |
<span class="reserve-note"><%= "On Reserve #{cnum_bcode[5]}" %></span> | |
<%- end -%> | |
<%- if addl_info[:request_status] and !addl_info[:k].nil? -%> | |
<span class="request_link"><%= request_link %></span> | |
<%- end -%> | |
</span> | |
<%- unless addl_info[:o].nil? -%> | |
<span class="public_note"><%= addl_info[:o] %></span> | |
<%- end -%> | |
</li> | |
<% end %> | |
<%- if item_detail.length > 3 -%> | |
<li> | |
<%= link_to("+ show all","", :class=>"toggle-link", :style=>"display:none;") %> | |
</li> | |
<%- end -%> | |
</ol> | |
</li> | |
</ul> | |
<%- elsif (!mhld.nil? and mhld[lib].has_key?(loc)) -%> | |
<ul class="show_availability"> | |
<li> | |
<span class="library"><%= h(lib) %></span> - <span class="location"><%= h(loc) %></span> | |
<div class="mhld"> | |
<%- mhld_counter = 1 -%> | |
<%- mhld[lib][loc].each do |comment,mhlds| -%> | |
<ul<%= " class='last'" if mhld_counter == doc.mhld[lib][loc].length %>> | |
<%= "<li>#{mhlds.first[:comment]}</li>".html_safe unless mhlds.first[:comment].blank? or mhlds.first[:comment] == :blank_comment %> | |
<%- mhlds.each do |current_mhld| -%> | |
<%= "<li><span class='mhld_label'>Library has: </span>#{current_mhld[:library_has]}</li>".html_safe unless current_mhld[:library_has].blank? %> | |
<%- end -%> | |
<%- mhlds.each do |current_mhld| -%> | |
<%= "<li><span class='mhld_label'>Latest: </span>#{current_mhld[:latest_received]}</li>".html_safe unless current_mhld[:latest_received].blank? %> | |
<%- end -%> | |
</ul> | |
<%- mhld_counter += 1 -%> | |
<%- end -%> | |
</div> | |
</li> | |
</ul> | |
<%- end -%> | |
<%- elsif (!mhld.nil? and mhld.has_key?(lib)) -%> | |
<ul class="show_availability"> | |
<li> | |
<span class="library"><%= h(lib) %></span> - <span class="location"><%= h(loc) %></span> | |
<div class="mhld"> | |
<%- mhld_counter = 1 -%> | |
<%- doc.mhld[lib][loc].each do |comment,mhlds| -%> | |
<ul<%= " class='last'" if mhld_counter == doc.mhld[lib][loc].length %>> | |
<%= "<li>#{mhlds.first[:comment]}</li>".html_safe unless mhlds.first[:comment].blank? or mhlds.first[:comment] == :blank_comment %> | |
<%- mhlds.each do |current_mhld| -%> | |
<%= "<li><span class='mhld_label'>Library has: </span>#{current_mhld[:library_has]}</li>".html_safe unless current_mhld[:library_has].blank? %> | |
<%- end -%> | |
<%- mhlds.each do |current_mhld| -%> | |
<%= "<li><span class='mhld_label'>Latest: </span>#{current_mhld[:latest_received]}</li>".html_safe unless current_mhld[:latest_received].blank? %> | |
<%- end -%> | |
</ul> | |
<%- mhld_counter += 1 -%> | |
<%- end -%> | |
</div> | |
</li> | |
</ul> | |
<%- end -%> | |
<%- end -%> | |
</div> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment