From 0d44691eb8a9eb6efb788fd2c9faf8759c001ef1 Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 29 Oct 2007 15:13:59 +0000 Subject: [PATCH] added ability to link back to a vendor product page from the record details page. this is useful for supplying cover art attribution. only currently supported options are null (no vendor links, default) and "amazon" git-svn-id: svn://svn.open-ils.org/ILS/trunk@7943 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/common/js/added_content.js | 11 +++++++++-- Open-ILS/web/opac/common/js/config.js | 9 +++++++++ Open-ILS/web/opac/locale/en-US/opac.dtd | 3 +++ Open-ILS/web/opac/skin/default/css/layout.css | 5 +++++ Open-ILS/web/opac/skin/default/js/rdetail.js | 9 ++++++++- .../web/opac/skin/default/xml/rdetail/rdetail_summary.xml | 12 +++++++++--- 6 files changed, 43 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/opac/common/js/added_content.js b/Open-ILS/web/opac/common/js/added_content.js index 4f974336be..1fb9cfcc57 100644 --- a/Open-ILS/web/opac/common/js/added_content.js +++ b/Open-ILS/web/opac/common/js/added_content.js @@ -1,9 +1,8 @@ /** * This function should return a URL which points to the book cover image based on ISBN. -* Ideally, this should point to some type of added content service. -* The example below uses Amazon... *use at own risk* */ + function buildISBNSrc(isbn, size) { size = (size) ? size : 'small'; if(OILS_OPAC_IMAGES_HOST) @@ -11,6 +10,14 @@ function buildISBNSrc(isbn, size) { return '../../../../extras/ac/jacket/'+size+'/'+isbn; } +function buildVendorProductLink(isbn, vendor) { + vendor = (vendor) ? vendor : ADDED_CONTENT_VENDOR; + switch(vendor) { + case 'amazon': + return 'http://www.amazon.com/dp/' + isbn; + } + return ''; +} function acMakeURL(type, key) { diff --git a/Open-ILS/web/opac/common/js/config.js b/Open-ILS/web/opac/common/js/config.js index 87c6ab639c..a8a5af2b2c 100644 --- a/Open-ILS/web/opac/common/js/config.js +++ b/Open-ILS/web/opac/common/js/config.js @@ -140,6 +140,15 @@ var PREF_DEF_LOCATION = 'opac.default_search_location'; var PREF_DEF_DEPTH = 'opac.default_search_depth'; +/** global added content vendor setting. This setting is only needed/used + if your added content vendor requires links back to their site. If + set to null, no links will be constructed + + Current options are: null and 'amazon' + */ +var ADDED_CONTENT_VENDOR=null; + + /* container for global variables shared accross pages */ var G = {}; G.user = null; /* global user object */ diff --git a/Open-ILS/web/opac/locale/en-US/opac.dtd b/Open-ILS/web/opac/locale/en-US/opac.dtd index 0ad7241b4f..7202092dfd 100644 --- a/Open-ILS/web/opac/locale/en-US/opac.dtd +++ b/Open-ILS/web/opac/locale/en-US/opac.dtd @@ -620,3 +620,6 @@ Ensure Caps-Lock is off and try again or contact your local library."> + + + diff --git a/Open-ILS/web/opac/skin/default/css/layout.css b/Open-ILS/web/opac/skin/default/css/layout.css index 33cbce6e90..978fffc984 100644 --- a/Open-ILS/web/opac/skin/default/css/layout.css +++ b/Open-ILS/web/opac/skin/default/css/layout.css @@ -206,3 +206,8 @@ table { border-collapse: collapse; } .invalid_hold { background: #F0F0D0; } .myopac_summary_table td { padding : 3px; } + +.jacket_attrib { font-size: 7pt; } + + + diff --git a/Open-ILS/web/opac/skin/default/js/rdetail.js b/Open-ILS/web/opac/skin/default/js/rdetail.js index 8cc6c535c4..95b2422772 100644 --- a/Open-ILS/web/opac/skin/default/js/rdetail.js +++ b/Open-ILS/web/opac/skin/default/js/rdetail.js @@ -191,6 +191,14 @@ function _rdetailDraw(r) { } G.ui.rdetail.abstr.appendChild(text(record.synopsis())); + try{ + if(ADDED_CONTENT_VENDOR) { + unHideMe($('rdetail.jacket_attrib_div')); + $('rdetail.jacket_attrib_link').setAttribute( + 'href', buildVendorProductLink(cleanISBN(record.isbn()))); + } + } catch(E) {} + // see if the record has any external links var links = record.online_loc(); @@ -206,7 +214,6 @@ function _rdetailDraw(r) { } - $('rdetail_place_hold').setAttribute( 'href','javascript:holdsDrawEditor({record:"'+record.doc_id()+'",type:"T"});'); diff --git a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml index c0eb67564b..9d92a03877 100644 --- a/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml +++ b/Open-ILS/web/opac/skin/default/xml/rdetail/rdetail_summary.xml @@ -4,13 +4,19 @@ - - -- 2.11.0
- + + +
+
&opac.image_provided;
+ +
&common.title;