@ -1,8 +1,8 @@
Drupal . behaviors . roblib _search _eds = {
Drupal . behaviors . roblib _search _eds = {
attach : function ( context , settings ) {
attach : function ( context , settings ) {
$url = settings . roblib _search _eds . search _url ;
$url = settings . roblib _search _eds . search _url ;
profile = 'eds' ; //settings.roblib_search_eds.eds_profile;
profile = 'eds' ; //settings.roblib_search_eds.eds_profile;
jQuery . getJSON ( $url , function ( data ) {
jQuery . getJSON ( $url , function ( data ) {
var items = [ ] ;
var items = [ ] ;
var numberOfDocs = 0 ;
var numberOfDocs = 0 ;
try {
try {
@ -10,54 +10,54 @@ Drupal.behaviors.roblib_search_eds = {
} catch ( err ) {
} catch ( err ) {
// do nothing leave docLength at 0
// do nothing leave docLength at 0
}
}
if ( numberOfDocs < 1 ) {
if ( numberOfDocs < 1 ) {
jQuery ( '#' + 'roblib-search-content-eds' ) . empty ( ) . append ( 'No Results' ) ;
jQuery ( '#' + 'roblib-search-content-eds' ) . empty ( ) . append ( 'No Results' ) ;
jQuery ( '.' + 'pane-roblib-search-eds-roblib-search-eds-results' ) . hide ( ) ;
jQuery ( '.' + 'pane-roblib-search-eds-roblib-search-eds-results' ) . hide ( ) ;
} else {
} else {
var counter = 0 ;
var counter = 0 ;
var divs = new Array ( ) ;
var divs = new Array ( ) ;
var content = new Array ( ) ;
var content = new Array ( ) ;
jQuery . each ( data . records , function ( key , val ) {
jQuery . each ( data . records , function ( key , val ) {
id = 'roblib-search-eds-' + counter ;
id = 'roblib-search-eds-' + counter ;
divs [ counter ++ ] = id ;
divs [ counter ++ ] = id ;
if ( typeof val . Items !== 'undefined' ) {
if ( typeof val . Items !== 'undefined' ) {
items . push ( '<div class ="roblib-search-row" id="' + id + '">' ) ;
items . push ( '<div class ="roblib-search-row" id="' + id + '">' ) ;
if ( typeof val . Items . Ti !== 'undefined' ) {
if ( typeof val . Items . Ti !== 'undefined' ) {
jQuery . each ( val . Items . Ti , function ( key2 , val2 ) {
jQuery . each ( val . Items . Ti , function ( key2 , val2 ) {
items . push ( '<div class="roblib-title eds">' ) ;
items . push ( '<div class="roblib-title eds">' ) ;
items . push ( '<a href="http://proxy.library.upei.ca/login?url=' + val . PLink + '&scope=site">' + val2 . Data + '</a></div>' ) ;
items . push ( '<a href="http://proxy.library.upei.ca/login?url=' + val . PLink + '&scope=site">' + val2 . Data + '</a></div>' ) ;
} )
} )
}
}
pubYear = val . RecordInfo . BibRelationships . IsPartOfRelationships [ "date" ] ;
pubYear = val . RecordInfo . BibRelationships . IsPartOfRelationships [ "date" ] ;
! pubYear ? pubYear = " " : pubYear = pubYear [ 0 ] [ "Y" ] ;
! pubYear ? pubYear = " " : pubYear = pubYear [ 0 ] [ "Y" ] ;
if ( typeof val . Items . TypPub !== 'undefined' ) {
if ( typeof val . Items . TypPub !== 'undefined' ) {
jQuery . each ( val . Items . TypPub , function ( key6 , typpub ) {
jQuery . each ( val . Items . TypPub , function ( key6 , typpub ) {
strs = typpub . Data . split ( '; ' ) ;
strs = typpub . Data . split ( '; ' ) ;
types = roblib _intersects ( strs , [ '<span class="highlight">Book</span>' , '<span class="highlight">eBook</span>' ] ) ;
types = roblib _intersects ( strs , [ '<span class="highlight">Book</span>' , '<span class="highlight">eBook</span>' ] ) ;
items . push ( '<div class="eds-type"><span class="eds-pubyear">' + pubYear + '</span> - ' + types . join ( ', ' ) + '</div>' ) ;
items . push ( '<div class="eds-type"><span class="eds-pubyear">' + pubYear + '</span> - ' + types . join ( ', ' ) + '</div>' ) ;
} )
} )
}
}
items . push ( '<div class="eds-sor">' ) ;
items . push ( '<div class="eds-sor">' ) ;
roblib _authors = "" ;
roblib _authors = "" ;
jQuery . each ( val . RecordInfo . BibRelationships . HasContributorRelationships , function ( key3 , author ) {
jQuery . each ( val . RecordInfo . BibRelationships . HasContributorRelationships , function ( key3 , author ) {
roblib _authors += author . NameFull ;
roblib _authors += author . NameFull ;
} )
} )
roblib _authors = roblib _shorten ( roblib _authors , 50 , " " ) ;
roblib _authors = roblib _shorten ( roblib _authors , 50 , " " ) ;
items . push ( roblib _authors ) ;
items . push ( roblib _authors ) ;
items . push ( '</div>' ) ;
items . push ( '</div>' ) ;
if ( typeof val . Items . Src !== 'undefined' ) {
if ( typeof val . Items . Src !== 'undefined' ) {
jQuery . each ( val . Items . Src , function ( key4 , source ) {
jQuery . each ( val . Items . Src , function ( key4 , source ) {
items . push ( '<div class="eds-src">' + source . Data + '</div>' ) ;
items . push ( '<div class="eds-src">' + source . Data + '</div>' ) ;
} )
} )
}
}
if ( typeof val . Items . PubIrInfo !== 'undefined' ) {
if ( typeof val . Items . PubIrInfo !== 'undefined' ) {
jQuery . each ( val . Items . PubIrInfo , function ( key5 , pubinfo ) {
jQuery . each ( val . Items . PubIrInfo , function ( key5 , pubinfo ) {
items . push ( '<div class="eds-pubinfo">' + pubinfo . Data + '</div>' ) ;
items . push ( '<div class="eds-pubinfo">' + pubinfo . Data + '</div>' ) ;
} )
} )
}
}
items . push ( '<div class="eds-db">' + val . DbLabel + '</div>' ) ;
items . push ( '<div class="eds-db">' + val . DbLabel + '</div>' ) ;
items . push ( '</div>' ) ;
items . push ( '</div>' ) ;
}
}
@ -66,14 +66,14 @@ Drupal.behaviors.roblib_search_eds = {
}
}
var queries = [ ] ;
var queries = [ ] ;
jQuery . each ( data . queries , function ( key7 , query ) {
jQuery . each ( data . queries , function ( key7 , query ) {
queries . push ( query . query ) ;
queries . push ( query . query ) ;
} )
} )
var query _str = data . queries [ 0 ] . query ;
var query _str = data . queries [ 0 ] . query ;
//var host = "http://eds-api.ebscohost.com";
//var host = "http://eds-api.ebscohost.com";
//var get = "/edsapi/rest/Search?query=history&searchmode=all&resultsperpage=20&pagenumber=1&sort=relevance&highlight=y&includefacets=y&facetfilter=1%2cSourceType%3aMagazines%2cSourceType%3aNews%2cSourceType%3aAcademic+Journals%2cSourceType%3aConference+Materials&view=detailed";
//var get = "/edsapi/rest/Search?query=history&searchmode=all&resultsperpage=20&pagenumber=1&sort=relevance&highlight=y&includefacets=y&facetfilter=1%2cSourceType%3aMagazines%2cSourceType%3aNews%2cSourceType%3aAcademic+Journals%2cSourceType%3aConference+Materials&view=detailed";
var href _str = 'http://search.ebscohost.com/login.aspx?direct=true&site=ehost-live&scope=site&type=1&custid=uprince&groupid=main&profid=' + profile + '&mode=bool&lang=en&bquery=' ;
var href _str = 'http://search.ebscohost.com/login.aspx?direct=true&site=ehost-live&scope=site&type=1&custid=uprince&groupid=main&profid=' + profile + '&mode=bool&lang=en&bquery=' ;
jQuery ( '#roblib-search-eds-more' ) . empty ( ) . append ( '<a href="http://proxy.library.upei.ca/login?url=' + href _str + query _str + '" id="see_all_results">See all results (' + data . recordCount + ')</a>' ) ;
jQuery ( '#roblib-search-eds-more' ) . empty ( ) . append ( '<a href="http://proxy.library.upei.ca/login?url=' + href _str + query _str + '" id="see_all_results">See all results (' + data . recordCount + ')</a>' ) ;
} ) ;
} ) ;
}
}