[open-ils-commits] r1379 - in conifer/branches/rel_2_0/web/opac/skin: . uwin uwin/css uwin/js (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Apr 18 10:51:42 EDT 2011
Author: dbs
Date: 2011-04-18 10:51:40 -0400 (Mon, 18 Apr 2011)
New Revision: 1379
Added:
conifer/branches/rel_2_0/web/opac/skin/uwin/
conifer/branches/rel_2_0/web/opac/skin/uwin/css/
conifer/branches/rel_2_0/web/opac/skin/uwin/css/layout.css
conifer/branches/rel_2_0/web/opac/skin/uwin/js/
conifer/branches/rel_2_0/web/opac/skin/uwin/js/result_common.js
Log:
Begin the uwin reboot, file-by-file: CSS and result_common.js to start
Added: conifer/branches/rel_2_0/web/opac/skin/uwin/css/layout.css
===================================================================
--- conifer/branches/rel_2_0/web/opac/skin/uwin/css/layout.css (rev 0)
+++ conifer/branches/rel_2_0/web/opac/skin/uwin/css/layout.css 2011-04-18 14:51:40 UTC (rev 1379)
@@ -0,0 +1,290 @@
+body { margin: 6px; }
+body { background-color: white; }
+
+.main_header { width: 100%; }
+.space { padding-right:5px; }
+.vert_space { padding-top: 82px; width: 100%;}
+.right { position:absolute; right: 0px; }
+.hide_me { display:none; visibility: hidden; }
+.recid { position:relative; left: 0px; color: #EBEBEB; }
+
+table { border-collapse: collapse; }
+
+/* generic CSS for a table with data */
+.data_grid { font-weight: 500; border-collapse: collapse;}
+.data_grid thead tr { }
+.data_grid thead td { padding-right: 5px; padding-left: 5px;}
+.data_grid tbody td { padding: 5px; }
+.data_grid_center { text-align: center; }
+
+.data_grid_nb { font-weight: 500; border-collapse: collapse;}
+.data_grid_nb thead tr { color: #000000; }
+.data_grid_nb thead td { padding-right: 5px; padding-left: 5px;}
+.data_grid_nb tbody td { padding: 5px; }
+
+
+.classic_link { text-decoration: underline; color: black;}
+.classic_link:visited { text-decoration: underline; color: black;}
+.classic_link_col { text-decoration: underline; color: red;}
+
+.encircled { border: 1px solid black; }
+
+
+.adv_quick_search { padding: 3px;}
+.adv_quick_search_submit { padding: 3px;}
+
+.overdue { color: red; font-weight: bold;}
+
+#main_table { border-collapse: collapse; width: 100%; }
+#main_left_cell { width: 20%; vertical-align: top;margin: 0px; padding: 0px;}
+#main_right_cell { width: 80%; vertical-align: top; margin: 0px; padding:0px; padding-right:5px;}
+
+.too_many_copies {font-weight: bold; color: #000000;}
+
+
+#content { min-height: 300px; }
+
+.canvas { min-height: 300px; padding-left: 4px; -moz-border-radius: 6px;}
+#canvas_main { padding-bottom: 4px; }
+
+#loading_div { width: 100%;}
+
+
+
+.shadowed { background: #F0F0E0; }
+.no_copies { background: #E0E0E0; }
+.overdue_circ { border: 2px dashed #F0D0E0; }
+
+.org_tree { padding-left: 2px; padding-right: 2px; }
+.org_link { padding-right: 15px; }
+#org_link_container { margin-bottom: 5px; padding-left: 4px; padding-bottom: 3px; padding-top: 3px; width: 100%; }
+#left_div { float:left; width: 20%; }
+#statusbar {}
+
+#frontsearch_table { }
+#frontsearch_table tr { margin: 6px; }
+
+/* ---------------------------------------------------------------------- */
+.sidebar_div { width: 100%; font-size: 9pt; margin-top: 12px; }
+.sidebar_header { margin-top: 10px; padding-left: 3px; margin-right: 6px; }
+
+.sidebar_extra_item { padding: 0px; margin-right: 8px;}
+.side_bar_item { padding-left: 8px; padding-right: 8px; padding-top: 4px; padding-bottom: 4px; margin-right: 8px; }
+
+.sidebar_item_active { margin-right: 0px; }
+
+.sidebar_chunk { width: 100%; }
+
+/* ---------------------------------------------------------------------- */
+
+#searchbar { margin-top: 22px; width: 100%; }
+#searchbar table tr td {font-weight: bold; font-size: 8pt; }
+#searchbar select, input { border-collapse: collapse; font-size: 9pt; }
+.searchbar_item { margin: 3px; font-size: 9pt; }
+.searchbar_label_span { font-size: 9pt; }
+#searchbar_table { border-collapse: collapse; }
+
+.search_box_container { width: 240px; padding: 3px; }/* border: 1px solid #A0A0A0;' class='color_2'>*/
+#search_box { width: 260px; }
+
+
+/* ---------------------------------------------------------------------- */
+#login_box { width: 70%; padding: 5px;}
+.login_text { margin-left: 8px; }
+
+/* ---------------------------------------------------------------------- */
+#result_table_div { text-align: left; width: 100%; }
+
+#search_nav_links { width: 100%; }
+#result_info_box { text-align: left; }
+#next_prev_links { padding-left: 2px; padding-right: 2px; text-align: left;}
+#goto_page_links { text-align: left; padding-left: 2px; padding-right: 2px;}
+
+#next_prev_links_dead {padding-left: 5px; padding-right: 5px;}
+
+#res_table { width: 100%; }
+
+.result_table_pic_cell { width: 43px;}
+.result_table_pic { height: 50px; width: 40px; border: none;}
+.result_table_pic_header { width: 43px; }
+
+.result_table_row { text-align: left; width: 100%; }
+.result_table_subtable { width: 100%; border-collapse: collapse; vertical-align: top;}
+/* .result_table_subtable { width: 100%; border-width: 0px; vertical-align: top;} */
+.result_table_subtbody { height: 100%; width: 100%; }
+/* make title slightly larger */
+.result_table_title_cell { font-weight: bold; text-align: left; }
+.result_table_sfx_cell { background: #EBEBEB; color: #000000; font-weight: bold; text-align: left; }
+.result_table_format_cell { font-size: medium; text-align: left;}
+.sfx_image {background: #EBEBEB; padding-right: 10px;}
+.sfx_display {background: #EBEBEB;}
+.sfx_right {width: 25%;}
+
+/* style dan's supercool live status stuff */
+/* windsor's colours are #005595 #B2BB1E */
+.live_call_cell { color: #000000; font-weight: bold; text-align: left; }
+.live_separator_cell { font-weight: bold; text-align: left; }
+.live_location_cell { color: #000000; font-weight: bold; text-align: left; }
+.live_status_cell { color: #000000; font-weight: bold; text-align: left; }
+
+.copy_count_cell { width: 0%; vertical-align: middle; text-align: center; }
+.copy_count_div { width: 4em; height: 99%; vertical-align: middle; text-align: center; }
+
+.search_page_nav_link { margin-right: 5px; }
+
+.np_nav_link { margin-right: 5px; }
+
+/* ---------------------------------------------------------------------- */
+
+#rdetail_detail_main { width: 100%; }
+#rdetail_details_table { padding-top: 10px; width: 100%; padding: 30px; border-collapse: collapse;}
+.rdetail_header { padding: 3px; padding-left: 10px;}
+.rdetail_desc { padding: 2px; padding-left: 2px; padding-right: 2px;}
+.rdetail_item { padding-left: 10px; }
+#rdetail_image { padding-right: 10px; }
+#rdetail_copy_info_table { padding: 4px; width: 100%; border-collapse: collapse; }
+.rdetail_copy_info_header_cell { padding: 2px; }
+.rdetail_copy_count_cell { text-align: center; }
+
+.resolver_item { background: #EBEBEB; }
+
+
+.tor_pic { width: 17px; height: 17px; border: none;}
+
+.dim2_border { border: 1px solid #F06000; -moz-border-radius: 3px;}
+
+.dim2 {
+ filter:alpha(opacity=50);
+ -moz-opacity:0.5;
+ opacity: 0.5;
+ text-decoration: none; }
+
+.dim {
+ filter:alpha(opacity=10);
+ -moz-opacity:0.1;
+ opacity: 0.1;
+ text-decoration: none; }
+
+/* ---------------------------------------------------------------------- */
+
+.myopac_link { width: 12%; margin: 3px; padding: 3px; text-align: center; vertical-align: middle; }
+.myopac_link_active { font-weight: 700;}
+.myopac_table thead tr td { padding: 2px; font-weight: 500; border: 1px solid #808080;}
+.myopac_table td { padding: 3px; }
+.myopac_form_pic { width: 20px; height: 20px; }
+
+.tips { padding: 2px; text-align: center; border: solid #E0E0E0 3px; -moz-border-radius: 3px; width: 99%; }
+
+.holds_cell { border: 1px solid #E0E0E0; padding: 5px; width: 50%;}
+.myopac_update_cell { border: 3px solid #E0E0E0; width:100%; padding-top: 4px; padding-bottom: 4px;}
+.myopac_update_span { padding: 5px;}
+
+.lowhits_div { width: 100%; border-top: 1px solid #E0E0E0; text-align: center;
+ padding-top: 8px; padding-bottom: 8px; }
+
+.rdetail_extras_div {
+ border-top: 3px solid #E0E0E0;margin-top: 3px; padding-top: 5px; width: 100%;}
+
+.copy_info_region_row {
+ padding: 6px;
+ border: 2px solid #E0E0E0;
+ font-weight: 600;
+}
+
+.rdetail_extras_td { padding-right: 15px; padding-left: 15px; border-right: 1px solid #888; }
+.rdetails_extra_links { border: 1px solid #808080; padding-right: 5px; padding-left: 5px; }
+
+
+.cn_browse_item { height: 190px; }
+.cn_browse_info { padding: 4px; border-bottom: 1px dashed #E0E0E0;}
+
+.bookshelf {
+ /*background-image: url(http://10.4.0.10/woodgrain.jpeg);*/
+ /*
+ background-image: url(http://dev.gapines.org/opac/images/woodgrain.jpg);
+ background-repeat: repeat;
+ */
+ border-bottom: 1px solid black;
+}
+
+.cn_browse_loading { width: 95%; padding: 15px; text-align: center; background: #E0F0E0; }
+
+.cn_browse_home_cn { border: 2px solid #E0F0E0; background: green; font-weight: 700;}
+
+.rdetail_context_row { background: #F0E0E0; }
+
+.unadorned_link { text-decoration: none; vertical-align: bottom; }
+
+
+/* ie does not support disabling <option> elements */
+.disabled_option { color: #808080; }
+
+.copy_more_info { padding-left: 6px; color: #804070; }
+
+.invalid_hold { background: #F0F0D0; }
+.myopac_summary_table td { padding : 3px; }
+
+.jacket_attrib { font-size: 7pt; }
+
+/* block that contains footer links and copyright */
+#copyright_block {
+ width: 100%;
+ text-align: center;
+ vertical-align: bottom;
+ margin-top: 10px;
+}
+
+/* block that contains the footer links */
+#footer_links {
+ width: 80%;
+ text-align: center;
+ padding: 10px;
+ margin: auto;
+}
+
+/* span for each link in the footer */
+.footer-link {
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
+/* block that contains the copyright text */
+#copyright_text {
+ margin-top: 4px;
+}
+
+/* block that contains the logo */
+#footer_logo {
+ text-align: center;
+ margin: auto;
+}
+
+#opac.result.sort { margin-left: 5px; }
+
+#xul_recipient_me { margin-left: 25px; }
+#myopac_holds_thaw_date_form {padding: 10px; text-align: center;}
+#myopac_holds_freeze_select_thaw {margin-right: 100px; margin-left: 100px; }
+
+/* titles in result list */
+/*
+.result_table_title_cell .search_link {
+ font-weight: bold;
+}
+*/
+
+.search_link {
+ color: #005596;
+}
+
+.search_link:visited {
+ color: #005596;
+}
+
+.search_link:hover {
+ color: red;
+ text-decoration: none;
+}
+
+.libselect {
+ text-decoration: none;
+}
Added: conifer/branches/rel_2_0/web/opac/skin/uwin/js/result_common.js
===================================================================
--- conifer/branches/rel_2_0/web/opac/skin/uwin/js/result_common.js (rev 0)
+++ conifer/branches/rel_2_0/web/opac/skin/uwin/js/result_common.js 2011-04-18 14:51:40 UTC (rev 1379)
@@ -0,0 +1,1017 @@
+dojo.require('openils.BibTemplate');
+dojo.requireLocalization("openils.opac", "opac");
+var opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
+
+var recordsHandled = 0;
+var recordsCache = [];
+var lowHitCount = 4;
+var isbnList = '';
+var googleBooksLink = false;
+
+var resultFetchAllRecords = false;
+var resultCompiledSearch = null;
+var allRecordsReceivedAndProcessed = false;
+
+var enableHoldsOnAvailable = false;
+var enableExtraSearchesLowHits = true;
+var localProxyPrefix = '';
+var suppressCopyCounts = true;
+var lookUpLimit = 100; //limit for invoking live status info
+var elec_loc = 'software, multimedia'; //res name for url locations
+
+function sortOutCopies(loc_id, rec_id, form_id) {
+ var copies = 0;
+ var recreq = new Request(FETCH_R_COPY_COUNTS, loc_id, rec_id, form_id);
+ recreq.send(true);
+ if (recreq) {
+ var copy_info = recreq.result();
+ for (var i in copy_info) {
+ if (loc_id == copy_info[i].org_unit)
+ return copy_info[i].available;
+ }//for
+ }//if
+
+ return copies;
+}
+
+/* this was in opac_utils.js, putting here for now */
+function cleanISBN(isbn) {
+ if(isbn) {
+ isbn = isbn.toString().replace(/^\s+/,"");
+ var idx = isbn.indexOf(" ");
+ if(idx > -1) { isbn = isbn.substring(0, idx); }
+ } else isbn = "";
+ return isbn;
+}
+
+
+/* an array of the extra services to which we want to direct people, in order of priority:
+Properties:
+ url: will be proxied via localProxyPrefix
+ description: will be used in the OPAC display
+ termTransform: a function name that transforms Evergreen compiled searches to the target search format
+*/
+var externalSearchServices = [
+ {
+ "url": "http://books.scholarsportal.info/search.html?searchField=All+Fields&limit=full_text&sortBy=relevance&collection=all&searchTerm=",
+ "description": "Search ScholarsPortal ebooks",
+ "termTransform": "allKeywords"
+ },
+ {
+ "url": "http://scholar.google.com/scholar?q=",
+ "description": "Search Google Scholar",
+ "termTransform": "allKeywords"
+ }
+];
+
+/* set up the event handlers */
+if( findCurrentPage() == MRESULT || findCurrentPage() == RRESULT ) {
+ G.evt.result.hitCountReceived.push(resultSetHitInfo);
+
+ //we don't display copy counts for consortium
+ //G.evt.result.recordReceived.push(resultDisplayRecord, resultAddCopyCounts);
+ G.evt.result.recordReceived.push(resultDisplayRecord);
+
+ //we don't display copy counts for consortium
+ //G.evt.result.copyCountsReceived.push(resultDisplayCopyCounts);
+ G.evt.result.allRecordsReceived.push( function(){unHideMe($('result_info_2'))}, function() { allRecordsReceivedAndProcessed = true; });
+
+ attachEvt('result','lowHits',resultLowHits);
+ attachEvt('result','zeroHits',resultZeroHits);
+ attachEvt( "common", "locationUpdated", resultSBSubmit );
+ /* do this after we have ID's so the rank for mr pages will be correct */
+ attachEvt("result", "preCollectRecords", resultPaginate);
+}
+
+function resultSBSubmit(){searchBarSubmit();}
+
+/* returns the last 'index' postion ocurring in this page */
+function resultFinalPageIndex() {
+ if(getHitCount() < (getOffset() + getDisplayCount()))
+ return getHitCount() - 1;
+ return getOffset() + getDisplayCount() - 1;
+}
+
+
+
+
+/* generic search method */
+function resultCollectSearchIds( type, method, handler ) {
+
+ var sort = (getSort() == SORT_TYPE_REL) ? null : getSort();
+ var sortdir = (sort) ? ((getSortDir()) ? getSortDir() : SORT_DIR_ASC) : null;
+
+ var item_type;
+ var item_form;
+ var args = {};
+
+ if( type ) {
+ var form = parseForm(getForm());
+ item_type = form.item_type;
+ item_form = form.item_form;
+
+ } else {
+ item_type = (getItemType()) ? getItemType().split(/,/) : null;
+ item_form = (getItemForm()) ? getItemForm().split(/,/) : null;
+ }
+
+ var limit = (resultFetchAllRecords) ? 1000 : getDisplayCount();
+
+ if( getOffset() > 0 ) {
+ if( getHitCount() > 0 && (getOffset() + getDisplayCount()) > getHitCount() )
+ limit = getHitCount() - getOffset();
+ }
+
+ var lasso = getLasso();
+
+ if (lasso) args.org_unit = -lasso;
+ else args.org_unit = getLocation();
+
+ args.depth = getDepth();
+ args.limit = limit;
+ args.offset = getOffset();
+ args.visibility_limit = 3000;
+ args.default_class = getStype();
+
+ if(sort) args.sort = sort;
+ if(sortdir) args.sort_dir = sortdir;
+ if(item_type) args.item_type = item_type;
+ if(item_form) args.item_form = item_form;
+ if(getAvail()) args.available = 1;
+
+
+ if(getFacet()) args.facets = getFacet();
+
+ if(getAudience()) args.audience = getAudience().split(/,/);
+ if(getLitForm()) args.lit_form = getLitForm().split(/,/);
+ if(getLanguage()) args.language = getLanguage().split(/,/);
+ if(getBibLevel()) args.bib_level = getBibLevel().split(/,/);
+ if(getCopyLocs()) args.locations = getCopyLocs().split(/,/);
+ if(getPubdBefore()) args.before = getPubdBefore();
+ else if(getPubdAfter()) args.after = getPubdAfter();
+ else if(getPubdBetween()) args.between = getPubdBetween().split(/,/);
+
+ _debug('Search args: ' + js2JSON(args));
+ _debug('Raw query: ' + getTerm());
+
+ var atomfeed = "/opac/extras/opensearch/1.1/" + findOrgUnit(args.org_unit).shortname() + "/atom-full/" + getStype() + '?searchTerms=' + getTerm();
+ if (args.facets) { atomfeed += ' ' + args.facets; }
+ if (sort) { atomfeed += '&searchSort=' + sort; }
+ if (sortdir) { atomfeed += '&searchSortDir=' + sortdir; }
+ dojo.create('link', {"rel":"alternate", "href":atomfeed, "type":"application/atom+xml"}, dojo.query('head')[0]);
+
+ var req = new Request(method, args, getTerm(), 1);
+ req.callback(handler);
+ req.send();
+}
+
+
+
+
+
+/* set the search result info, number of hits, which results we're
+ displaying, links to the next/prev pages, etc. */
+function resultSetHitInfo() {
+
+ var lasso = getLasso();
+ if (!lasso) {
+ /* tell the user where the results are coming from */
+ var baseorg = findOrgUnit(getLocation());
+ var depth = getDepth();
+ var mydepth = findOrgDepth(baseorg);
+ if( findOrgDepth(baseorg) != depth ) {
+ var tmporg = baseorg;
+ while( mydepth > depth ) {
+ mydepth--;
+ tmporg = findOrgUnit(tmporg.parent_ou());
+ }
+ unHideMe($('including_results_for'));
+ $('including_results_location').appendChild(text(tmporg.name()));
+ }
+ }
+
+
+ try{searchTimer.stop()}catch(e){}
+
+ //if( findCurrentPage() == MRESULT ) {
+ if( findCurrentPage() == MRESULT ||
+
+ (findCurrentPage() == RRESULT &&
+ (
+ getRtype() == RTYPE_TITLE ||
+ getRtype() == RTYPE_AUTHOR ||
+ getRtype() == RTYPE_SUBJECT ||
+ getRtype() == RTYPE_SERIES ||
+ getRtype() == RTYPE_KEYWORD
+ )
+
+ ) ) {
+
+ if(getHitCount() <= lowHitCount && getTerm())
+ runEvt('result', 'lowHits');
+ }
+
+ if(getHitCount() == 0) {
+ runEvt('result', 'zeroHits');
+ return;
+ }
+
+
+ var pages = getHitCount() / getDisplayCount();
+ if(pages % 1) pages = parseInt(pages) + 1;
+
+
+
+ var cpage = (getOffset()/getDisplayCount()) + 1;
+
+ G.ui.result.current_page.appendChild(text(cpage));
+ G.ui.result.num_pages.appendChild(text(pages + ")")); /* the ) is dumb */
+
+ $('current_page2').appendChild(text(cpage));
+ $('num_pages2').appendChild(text(pages + ")")); /* the ) is dumb */
+
+ /* set the offsets */
+ var offsetEnd = getDisplayCount() + getOffset();
+ if( getDisplayCount() > (getHitCount() - getOffset()))
+ offsetEnd = getHitCount();
+
+ G.ui.result.offset_end.appendChild(text(offsetEnd));
+ G.ui.result.offset_start.appendChild(text(getOffset() + 1));
+
+ $('offset_end2').appendChild(text(offsetEnd));
+ $('offset_start2').appendChild(text(getOffset() + 1));
+
+ G.ui.result.result_count.appendChild(text(getHitCount()));
+ unHideMe(G.ui.result.info);
+
+ $('result_count2').appendChild(text(getHitCount()));
+ unHideMe($('result_info_div2'));
+}
+
+function resultLowHits() {
+ showCanvas();
+ unHideMe($('result_low_hits'));
+ if(getHitCount() > 0)
+ unHideMe($('result_low_hits_msg'));
+
+ var words = [];
+ for(var key in resultCompiledSearch.searches)
+ words.push(resultCompiledSearch.searches[key].term);
+
+ var sreq = new Request(CHECK_SPELL, words.join(' '));
+ sreq.callback(resultSuggestSpelling);
+ sreq.send();
+
+ for(var key in resultCompiledSearch.searches) {
+ var areq = new Request(FETCH_CROSSREF, key, resultCompiledSearch.searches[key].term);
+ areq.callback(resultLowHitXRef);
+ areq.send();
+ }
+
+ if( !(getForm() == null || getForm() == 'all' || getForm() == "") ) {
+ var a = {};
+ a[PARAM_FORM] = "all";
+ $('low_hits_remove_format_link').setAttribute('href',buildOPACLink(a));
+ unHideMe($('low_hits_remove_format'));
+ }
+
+ resultSuggestSearchClass();
+
+ if (enableExtraSearchesLowHits) {
+ resultSuggestExtraSearches();
+ }
+
+ if(getTerm()) resultExpandSearch(); /* advanced search */
+}
+
+var lowHitsXRefSet = {};
+var lowHitsXRefLink;
+var lowHitsXRefLinkParent;
+function resultLowHitXRef(r) {
+ if(!lowHitsXRefLink){
+ lowHitsXRefLinkParent = $('low_hits_xref_link').parentNode;
+ lowHitsXRefLink = lowHitsXRefLinkParent.removeChild($('low_hits_xref_link'));
+ }
+ var res = r.getResultObject();
+ var arr = res.from;
+ arr.concat(res.also);
+ if(arr && arr.length > 0) {
+ unHideMe($('low_hits_cross_ref'));
+ var word;
+ var c = 0;
+ while( word = arr.shift() ) {
+
+ if (lowHitsXRefSet[word] == 1) continue;
+ lowHitsXRefSet[word] = 1;
+
+ if(c++ > 20) break;
+ var a = {};
+ a[PARAM_TERM] = word;
+ var template = lowHitsXRefLink.cloneNode(true);
+ template.setAttribute('href',buildOPACLink(a));
+ template.appendChild(text(word));
+ lowHitsXRefLinkParent.appendChild(template);
+ lowHitsXRefLinkParent.appendChild(text(' '));
+ }
+ }
+}
+
+function resultZeroHits() {
+ showCanvas();
+ unHideMe($('result_low_hits'));
+ unHideMe($('result_zero_hits_msg'));
+ //if(getTerm()) resultExpandSearch(); /* advanced search */
+}
+
+function resultExpandSearch() {
+ var top = findOrgDepth(globalOrgTree);
+
+ /* We don't want to expand the scope to Everywhere in Conifer, that's just confusing */
+ if(getDepth() == top || getDepth() - 1 == top) return;
+ unHideMe($('low_hits_expand_range'));
+ var par = $('low_hits_expand_link').parentNode;
+ var template = par.removeChild($('low_hits_expand_link'));
+
+ var bottom = getDepth();
+ while( top < bottom ) {
+ var a = {};
+ a[PARAM_DEPTH] = top;
+ var temp = template.cloneNode(true);
+ temp.appendChild(text(findOrgTypeFromDepth(top).opac_label()))
+ temp.setAttribute('href',buildOPACLink(a));
+ par.appendChild(temp);
+ top++;
+ }
+}
+
+/* Generate links to our extra search services */
+function resultSuggestExtraSearches() {
+ dojo.forEach(externalSearchServices, function(esItem) {
+ var extraSearchStuff = this[esItem.termTransform].apply(this, [esItem.url]);
+ dojo.place("<div style='text-align: center; width: 100%; margin-left: auto; margin-right: auto;'><strong>" +
+ esItem.description + "</strong>: <a class='classic_link' href='" +
+ extraSearchStuff.searchTerms + "'>" + extraSearchStuff.displayTerms + "</a><div>", "result_low_hits", "child"
+ );
+ });
+}
+
+/* Transform everything in the Evergreen search to plain old keywords */
+function allKeywords(esUrl) {
+ var ebook_search = localProxyPrefix + esUrl;
+ var ebook_terms = '';
+ for (var key in resultCompiledSearch.searches) {
+ ebook_search += resultCompiledSearch.searches[key].term + '+';
+ ebook_terms += resultCompiledSearch.searches[key].term + ' ';
+ }
+ ebook_search = ebook_search.replace(/ /g, '+');
+ ebook_search = ebook_search.replace(/\%20/g, '+');
+ ebook_search = ebook_search.replace(/\+$/g, '');
+ ebook_terms = ebook_terms.replace(/ $/g, '');
+ var extraSuggestion = {"displayTerms": ebook_terms, "searchTerms": ebook_search};
+ return extraSuggestion;
+}
+
+function resultSuggestSearchClass() {
+ var stype = getStype();
+ if(stype == STYPE_KEYWORD) return;
+ var a = {}; var ref;
+ unHideMe($('low_hits_search_type'));
+ if(stype != STYPE_TITLE) {
+ ref = $('low_hits_title_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_TITLE;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_AUTHOR) {
+ ref = $('low_hits_author_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_AUTHOR;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_SUBJECT) {
+ ref = $('low_hits_subject_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_SUBJECT;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_KEYWORD) {
+ ref = $('low_hits_keyword_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_KEYWORD;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+ if(stype != STYPE_SERIES) {
+ ref = $('low_hits_series_search');
+ unHideMe(ref);
+ a[PARAM_STYPE] = STYPE_SERIES;
+ ref.setAttribute('href',buildOPACLink(a));
+ }
+}
+
+function resultSuggestSpelling(r) {
+ var res = r.getResultObject();
+ var phrase = getTerm();
+ var words = phrase.split(/ /);
+
+ var newterm = "";
+
+ for( var w = 0; w < words.length; w++ ) {
+ var word = words[w];
+ var blob = grep(res, function(i){return (i.word == word);});
+ if( blob ) blob = blob[0];
+ else continue;
+ if( blob.word == word ) {
+ if( blob.suggestions && blob.suggestions[0] ) {
+ newterm += " " + blob.suggestions[0];
+ unHideMe($('did_you_mean'));
+ } else {
+ newterm += " " + word;
+ }
+ }
+ }
+
+ var arg = {};
+ arg[PARAM_TERM] = newterm;
+ $('spell_check_link').setAttribute('href', buildOPACLink(arg));
+ $('spell_check_link').appendChild(text(newterm));
+}
+
+
+function resultPaginate() {
+ var o = getOffset();
+
+ if( !( ((o) + getDisplayCount()) >= getHitCount()) ) {
+
+ var args = {};
+ args[PARAM_OFFSET] = o + getDisplayCount();
+ args[PARAM_SORT] = SORT;
+ args[PARAM_SORT_DIR] = SORT_DIR;
+ args[PARAM_RLIST] = new CGI().param(PARAM_RLIST);
+
+ G.ui.result.next_link.setAttribute("href", buildOPACLink(args));
+ addCSSClass(G.ui.result.next_link, config.css.result.nav_active);
+
+ $('next_link2').setAttribute("href", buildOPACLink(args));
+ addCSSClass($('next_link2'), config.css.result.nav_active);
+
+ args[PARAM_OFFSET] = getHitCount() - (getHitCount() % getDisplayCount());
+
+ /* when hit count is divisible by display count, we have to adjust */
+ if( getHitCount() % getDisplayCount() == 0 )
+ args[PARAM_OFFSET] -= getDisplayCount();
+
+ /*
+ G.ui.result.end_link.setAttribute("href", buildOPACLink(args));
+ addCSSClass(G.ui.result.end_link, config.css.result.nav_active);
+
+ $('end_link2').setAttribute("href", buildOPACLink(args));
+ addCSSClass($('end_link2'), config.css.result.nav_active);
+ */
+ }
+
+ if( o > 0 ) {
+
+ var args = {};
+ args[PARAM_SORT] = SORT;
+ args[PARAM_SORT_DIR] = SORT_DIR;
+ args[PARAM_RLIST] = new CGI().param(PARAM_RLIST);
+
+ args[PARAM_OFFSET] = o - getDisplayCount();
+ G.ui.result.prev_link.setAttribute( "href", buildOPACLink(args));
+ addCSSClass(G.ui.result.prev_link, config.css.result.nav_active);
+
+ //$('prev_link2').setAttribute( "href", buildOPACLink(args));
+ $('prev_link2').setAttribute( "href", buildOPACLink('/'));
+ addCSSClass($('prev_link2'), config.css.result.nav_active);
+
+ args[PARAM_OFFSET] = 0;
+ G.ui.result.home_link.setAttribute( "href", buildOPACLink(args));
+ addCSSClass(G.ui.result.home_link, config.css.result.nav_active);
+
+ $('search_home_link2').setAttribute( "href", buildOPACLink(args));
+ addCSSClass($('search_home_link2'), config.css.result.nav_active);
+ }
+
+ if(getDisplayCount() < getHitCount()) {
+ unHideMe($('start_end_links_span'));
+ unHideMe($('start_end_links_span2'));
+ }
+
+ showCanvas();
+ try{searchTimer.stop()}catch(e){}
+}
+
+function buildunAPISpan (span, type, id) {
+ var cgi = new CGI();
+ var d = new Date();
+
+ addCSSClass(span,'unapi-id');
+
+ span.setAttribute(
+ 'title',
+ 'tag:' + cgi.server_name + ',' +
+ d.getFullYear() +
+ ':' + type + '/' + id
+ );
+}
+
+function unhideGoogleBooksLink (data) {
+ for ( var i in data ) {
+ //if (data[i].preview == 'noview') continue;
+
+ var gbspan = $n(document.documentElement, 'googleBooksLink-' + i);
+ var gba = $n(gbspan, "googleBooks-link");
+
+ gba.setAttribute(
+ 'href',
+ data[i].info_url
+ );
+ removeCSSClass( gbspan, 'hide_me' );
+ }
+}
+
+/* riff on buildTitleDetailLink from opac_utils */
+function buildResultTitleDetailLink(rec, link, copyCnt) {
+ if(!rec) return;
+ link.appendChild(text(normalize(truncate(rec.title(), 500))));
+ var args = {};
+ args.page = RDETAIL;
+
+ if (copyCnt > lookUpLimit)
+ args.page = RSDETAIL;
+
+ args[PARAM_RID] = rec.doc_id();
+ // in IE, if the link text contains a '@', it replaces the innerHTML text
+ // with the value of the href attribute. Wait, what? Yes. Capture the
+ // innerHTML and put it back into place after the href is set
+ var linkText = link.innerHTML; // IE
+ link.setAttribute("href", buildOPACLink(args));
+ link.innerHTML = linkText; // IE
+}
+
+
+
+/* display the record info in the record display table 'pos' is the
+ zero based position the record should have in the display table */
+function resultDisplayRecord(rec, pos, is_mr) {
+
+ fieldmapper.IDL.load(['mvr']);
+ if(rec == null) rec = new mvr(); /* so the page won't die if there was an error */
+ recordsHandled++;
+ recordsCache.push(rec);
+
+ var r = table.rows[pos + 1];
+ var currentISBN = cleanISBN(rec.isbn());
+ var currentISSN = cleanISBN(rec.isbn());
+
+ if (googleBooksLink) {
+ var gbspan = $n(r, "googleBooksLink");
+ if (currentISBN) {
+ gbspan.setAttribute(
+ 'name',
+ gbspan.getAttribute('name') + '-' + currentISBN
+ );
+
+ if (isbnList) isbnList += ', ';
+ isbnList += currentISBN;
+ }
+ }
+
+ if (currentISBN && chilifresh && chilifresh != '(none)') {
+ var cfrow = $n(r, "chilifreshReview");
+ if (cfrow) {
+ removeCSSClass( cfrow, 'hide_me' );
+ }
+ var cflink = $n(r, "chilifreshReviewLink");
+ if (cflink) {
+ cflink.setAttribute(
+ 'id',
+ 'isbn_' + currentISBN
+ );
+ }
+ var cfdiv = $n(r, "chilifreshReviewResult");
+ if (cfdiv) {
+ cfdiv.setAttribute(
+ 'id',
+ 'chili_review_' + currentISBN
+ )
+ }
+ }
+
+/*
+ try {
+ var rank = parseFloat(ranks[pos + getOffset()]);
+ rank = parseInt( rank * 100 );
+ var relspan = $n(r, "relevancy_span");
+ relspan.appendChild(text(rank));
+ unHideMe(relspan.parentNode);
+ } catch(e){ }
+*/
+
+ var pic = $n(r, config.names.result.item_jacket);
+
+ if (currentISBN.length > 8) {
+ pic.setAttribute("src", buildISBNSrc(currentISBN));
+ } else {
+ pic.setAttribute("src", "/opac/images/blank.png");
+ }
+
+ var title_link = $n(r, config.names.result.item_title);
+ var author_link = $n(r, config.names.result.item_author);
+
+ var onlyrec;
+ if( is_mr ) {
+ onlyrec = onlyrecord[ getOffset() + pos ];
+ if(onlyrec) {
+ buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', onlyrec);
+
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = onlyrec;
+ args[PARAM_MRID] = rec.doc_id();
+ if (pic!= null)
+ pic.parentNode.setAttribute("href", buildOPACLink(args));
+ title_link.setAttribute("href", buildOPACLink(args));
+ title_link.appendChild(text(normalize(truncate(rec.title(), 65))));
+
+ } else {
+ buildunAPISpan($n(r,'unapi'), 'metabib-metarecord', rec.doc_id());
+
+ buildTitleLink(rec, title_link);
+ var args = {};
+ args.page = RRESULT;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_MRID] = rec.doc_id();
+ if (pic != null)
+ pic.parentNode.setAttribute("href", buildOPACLink(args));
+ }
+
+ if (enableHoldsOnAvailable) {
+ unHideMe($n(r,'place_hold_span'));
+ $n(r,'place_hold_link').setAttribute(
+ 'href','javascript:holdsDrawEditor({record:"'+rec.doc_id()+'",type:"M"});');
+ }
+
+ } else {
+ onlyrec = rec.doc_id();
+ buildunAPISpan($n(r,'unapi'), 'biblio-record_entry', onlyrec);
+
+ buildResultTitleDetailLink(rec, title_link, copyCnt);
+ var args = {};
+ args.page = RDETAIL;
+ args[PARAM_OFFSET] = 0;
+ args[PARAM_RID] = rec.doc_id();
+ if (pic != null)
+ pic.parentNode.setAttribute("href", buildOPACLink(args));
+
+ //don't bother with holds at this point
+ /*
+ if (enableHoldsOnAvailable) {
+ unHideMe($n(r,'place_hold_span'));
+ $n(r,'place_hold_link').setAttribute(
+ 'href','javascript:holdsDrawEditor({record:"'+rec.doc_id()+'",type:"T"});');
+ }
+
+ $n(r,'place_hold_link').setAttribute(
+ 'href','javascript:holdsDrawEditor({record:"'+rec.doc_id()+'",type:"T"});');
+ */
+ // Stolen from trunk - (and stolen again from lul :-))
+ var here = findOrgUnit(getLocation());
+
+ if (copyCnt <= lookUpLimit) {
+ dojo.require('openils.BibTemplate');
+ var l_cn_list = $n(r,'local_callnumber_list');
+
+ dojo.addOnLoad(function () {
+ new openils.BibTemplate({
+ root : l_cn_list,
+ record : '' + onlyrec,
+ org_unit : here.shortname()
+ }).render();
+ unHideMe(l_cn_list);
+ });
+ } else {
+ //there is probably an easier way to deal with IE on this but...
+ unHideMe( $n(r, "local_callnumber_list"));
+ var callSpot = $n(r, "local_callnumber_list").parentNode;
+ var newTd = document.createElement( 'td' )
+ //to do: internationalize this
+ newTd.appendChild(text("... " + copyCnt + " print items, please see full record for details on print and digital coverage."));
+ addCSSClass(newTd,"too_many_copies");
+ var newTr = document.createElement( 'tr' )
+ newTr.appendChild(newTd);
+ callSpot.insertBefore(newTr,
+ $n(r, "local_callnumber_list"));
+ }//if
+ }
+
+ buildSearchLink(STYPE_AUTHOR, rec.author(), author_link);
+
+ if(! is_mr ) {
+
+ $n(r, "recid_holder").appendChild( text( rec.doc_id()) );
+ if(!isNull(rec.edition())) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ $n(r, "result_table_edition_span").appendChild( text( rec.edition()) );
+ }
+ if(!isNull(rec.pubdate())) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ unHideMe($n(r, "result_table_pub_span"));
+ $n(r, "result_table_pub_span").appendChild( text( rec.pubdate() ));
+ }
+ if(!isNull(rec.publisher()) ) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ unHideMe($n(r, "result_table_pub_span"));
+ $n(r, "result_table_pub_span").appendChild( text( " " + rec.publisher() ));
+ }
+
+ if(!isNull(rec.physical_description()) ) {
+ unHideMe( $n(r, "result_table_extra_span"));
+ var t = " " + rec.physical_description();
+ //$n(r, "result_table_phys_span").appendChild( text(t.replace(/:.*/g,'')));
+ $n(r, "result_table_phys_span").appendChild( text(t));
+ }
+ }
+
+ resultBuildFormatIcons( r, rec, is_mr );
+
+ var bt_params = {
+ sync : false,
+ root : r,
+ subObjectLimit : 10,
+ org_unit : findOrgUnit(getLocation()).shortname(),
+ depth : getDepth()
+ };
+
+ if (!is_mr) {
+ bt_params = dojo.mixin( bt_params, { record : onlyrec } );
+ } else {
+ bt_params = dojo.mixin( bt_params, { metarecord : onlyrec } );
+ }
+
+ if (findOrgType(findOrgUnit(getLocation()).ou_type()).can_have_vols())
+ unHideMe($n(r,'local_callnumber_list'));
+
+ new openils.BibTemplate( bt_params ).render();
+
+ unHideMe(r);
+
+ runEvt("result", "recordDrawn", rec.doc_id(), title_link);
+
+ /*
+ if(resultPageIsDone()) {
+ runEvt('result', 'allRecordsReceived', recordsCache);
+ }
+ */
+}
+
+function _resultFindRec(id) {
+ for( var i = 0; i != recordsCache.length; i++ ) {
+ var rec = recordsCache[i];
+ if( rec && rec.doc_id() == id )
+ return rec;
+ }
+ return null;
+}
+
+
+function resultBuildFormatIcons( row, rec, is_mr ) {
+
+ var ress = rec.types_of_resource();
+
+ for( var i in ress ) {
+
+ var res = ress[i];
+ if(!res) continue;
+
+ if (elec_loc.length > 0 && rec.online_loc().length > 0)
+ res=elec_loc;
+
+ var link = $n(row, res + "_link");
+ link.title = res;
+ var img = link.getElementsByTagName("img")[0];
+ removeCSSClass( img, config.css.dim );
+
+ var f = getForm();
+ if( f != "all" ) {
+ if( f == modsFormatToMARC(res) )
+ addCSSClass( img, "dim2_border");
+ }
+
+ var args = {};
+ args[PARAM_OFFSET] = 0;
+
+ if(is_mr) {
+ args.page = RRESULT;
+ args[PARAM_TFORM] = modsFormatToMARC(res);
+ args[PARAM_MRID] = rec.doc_id();
+
+ } else {
+ args.page = RDETAIL
+ args[PARAM_RID] = rec.doc_id();
+ }
+
+ link.setAttribute("href", buildOPACLink(args));
+
+ }
+}
+
+function fetchGoogleBooksLink () {
+ if (allRecordsReceivedAndProcessed) { return; }
+
+ if (isbnList && googleBooksLink) {
+ var scriptElement = document.createElement("script");
+ scriptElement.setAttribute("id", "jsonScript");
+ scriptElement.setAttribute("src",
+ "http://books.google.com/books?bibkeys=" +
+ escape(isbnList) + "&jscmd=viewapi&callback=unhideGoogleBooksLink");
+ scriptElement.setAttribute("type", "text/javascript");
+ // make the request to Google Book Search
+ document.documentElement.firstChild.appendChild(scriptElement);
+ }
+}
+
+function fetchChiliFreshReviews() {
+ if (chilifresh && chilifresh != '(none)') {
+ try { chili_init(); } catch(E) { console.log(E + '\n'); }
+ }
+}
+
+function resultPageIsDone(pos) {
+
+ return (recordsHandled == getDisplayCount()
+ || recordsHandled + getOffset() == getHitCount());
+}
+
+var resultCCHeaderApplied = false;
+
+/* -------------------------------------------------------------------- */
+/* dynamically add the copy count rows based on the org type 'countsrow'
+ is the row into which we will add TD's to hold the copy counts
+ This code generates copy count cells with an id of
+ 'copy_count_cell_<depth>_<pagePosition>' */
+function resultAddCopyCounts(rec, pagePosition) {
+
+ var r = table.rows[pagePosition + 1];
+ var countsrow = $n(r, config.names.result.counts_row );
+ var ccell = $n(countsrow, config.names.result.count_cell);
+
+ var nodes = orgNodeTrail(findOrgUnit(getLocation()));
+ var start_here = 0;
+ var orgHiding = checkOrgHiding();
+ if (orgHiding) {
+ for (var i = 0; i < nodes.length; i++) {
+ if (orgHiding.depth == findOrgDepth(nodes[i])) {
+ start_here = i;
+ }
+ }
+ }
+
+ var node = nodes[start_here];
+ var type = findOrgType(node.ou_type());
+ ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition;
+ ccell.title = type.opac_label();
+ //addCSSClass(ccell, config.css.result.cc_cell_even);
+
+ var lastcell = ccell;
+ var lastheadcell = null;
+
+ var cchead = null;
+ var ccheadcell = null;
+ if(!resultCCHeaderApplied && !getLasso()) {
+ ccrow = $('result_thead_row');
+ ccheadcell = ccrow.removeChild($n(ccrow, "result_thead_ccell"));
+ var t = ccheadcell.cloneNode(true);
+ lastheadcell = t;
+ //t.appendChild(text(type.opac_label()));
+ t.appendChild(text(" "));
+ ccrow.appendChild(t);
+ resultCCHeaderApplied = true;
+ }
+
+ if(nodes[start_here+1]) {
+
+ var x = start_here+1;
+ var d = findOrgDepth(nodes[start_here+1]);
+ var d2 = findOrgDepth(nodes[nodes.length -1]);
+
+ for( var i = d; i <= d2 ; i++ ) {
+
+ ccell = ccell.cloneNode(true);
+
+ //if((i % 2)) removeCSSClass(ccell, "copy_count_cell_even");
+ //else addCSSClass(ccell, "copy_count_cell_even");
+
+ var node = nodes[x++];
+ var type = findOrgType(node.ou_type());
+
+ ccell.id = "copy_count_cell_" + type.depth() + "_" + pagePosition;
+ ccell.title = type.opac_label();
+ countsrow.insertBefore(ccell, lastcell);
+ lastcell = ccell;
+
+ if(ccheadcell) {
+ var t = ccheadcell.cloneNode(true);
+ t.appendChild(text(type.opac_label()));
+ ccrow.insertBefore(t, lastheadcell);
+ lastheadcell = t;
+ }
+ }
+ }
+
+ unHideMe($("search_info_table"));
+}
+
+/* collect copy counts for a record using method 'methodName' */
+function resultCollectCopyCounts(rec, pagePosition, methodName) {
+ if(rec == null || rec.doc_id() == null) return;
+
+ var loc = getLasso();
+ if (loc) loc = -loc;
+ else loc= getLocation();
+
+ var req = new Request(methodName, loc, rec.doc_id(), getForm() );
+ req.request.userdata = [ rec, pagePosition ];
+ req.callback(resultHandleCopyCounts);
+ req.send();
+}
+
+function resultHandleCopyCounts(r) {
+ runEvt('result', 'copyCountsReceived', r.userdata[0], r.userdata[1], r.getResultObject());
+}
+
+
+/* XXX Needs to understand Lasso copy counts... */
+/* display the collected copy counts */
+function resultDisplayCopyCounts(rec, pagePosition, copy_counts) {
+ if(copy_counts == null || rec == null || suppressCopyCounts) return;
+
+ if (getLasso()) {
+ var copy_counts_lasso = {
+ transcendant : null,
+ count : 0,
+ unshadow : 0,
+ available : 0,
+ depth : -1,
+ org_unit : getLasso()
+ };
+
+ for (var i in copy_counts) {
+ copy_counts_lasso.transcendant = copy_counts[i].transcendant;
+ copy_counts_lasso.count += parseInt(copy_counts[i].count);
+ copy_counts_lasso.unshadow += parseInt(copy_counts[i].unshadow);
+ copy_counts_lasso.available += parseInt(copy_counts[i].available);
+ }
+
+ copy_counts = [ copy_counts_lasso ];
+ }
+
+ var i = 0;
+ var metarecords = (findCurrentPage() == MRESULT);
+ while(copy_counts[i] != null) {
+ var cell = $("copy_count_cell_" + i +"_" + pagePosition);
+ var cts = copy_counts[i];
+
+ var availMess = "Available";
+ if (cts.count >= cts.available && cts.available > 1)
+ availMess = cts.available + " of " + cts.count + " Available";
+ if (cts.count > cts.available && cts.available == 0)
+ availMess = "Checked Out";
+ if (cts.count == 0 && cts.available == 0)
+ availMess = "Online";
+
+ //cell.appendChild(text(cts.available + " / " + cts.count));
+ cell.appendChild(text(availMess));
+
+ //don't bother with holds at this point
+ /*
+ if (!enableHoldsOnAvailable && (i == (copy_counts.length - 1))) {
+ var resultTBody = findParentByNodeName(cell, 'TBODY');
+ if (cts.available == 0 && cts.count > 0 && !metarecords) {
+ dojo.query('[name="place_hold_span"]', resultTBody).removeClass('hide_me');
+ } else {
+ dojo.query('[name="place_hold_span"]', resultTBody).addClass('hide_me');
+ }
+ }
+ */
+
+ if(isXUL()) {
+ /* here we style opac-invisible records for xul */
+
+ if( cts.depth == 0 ) {
+ if(cts.transcendant == null && cts.unshadow == 0) {
+ _debug("found an opac-shadowed record: " + rec.doc_id());
+ var row = cell.parentNode.parentNode.parentNode.parentNode.parentNode;
+ if( cts.count == 0 )
+ addCSSClass( row, 'no_copies' );
+ else
+ addCSSClass( row, 'shadowed' );
+ }
+ }
+ }
+ i++;
+ }
+}
+
+
More information about the open-ils-commits
mailing list