From 442c3bb371ed09a98ccbc2853791c80d30fa1ab2 Mon Sep 17 00:00:00 2001 From: Paul Pound Date: Mon, 23 Jun 2014 15:26:07 -0300 Subject: [PATCH] added popups to eds targets and modified eds so we get the detailed record for each result --- targets/eds/js/eds_results.js | 28 +++++++++++++++----- targets/eds/js/eds_results_article.js | 38 ++++++++++++++++----------- targets/eds/roblib_search_eds.module | 12 +++++++++ 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/targets/eds/js/eds_results.js b/targets/eds/js/eds_results.js index f0f0d0a..91eef07 100644 --- a/targets/eds/js/eds_results.js +++ b/targets/eds/js/eds_results.js @@ -13,12 +13,15 @@ Drupal.behaviors.roblib_search_eds = { jQuery('#' + 'roblib-search-content-eds').empty().append('No Results'); jQuery('.' + 'pane-roblib-search-eds-roblib-search-eds-results').hide(); } else { + var counter = 0; + var divs = new Array(); + var content = new Array(); jQuery.each(data.records, function(key, val) { - - //items.push(''); - //jQuery.each(val.RecordInfo.BibEntity.Titles, function(key2, val2){ + id = 'roblib-search-eds-' + counter; + edsPopulatePopupDivs(content, val, counter); + divs[counter++] = id; if (typeof val.Items !== 'undefined') { - items.push('
'); + items.push('
'); if (typeof val.Items.Ti !== 'undefined') { jQuery.each(val.Items.Ti, function(key2, val2){ items.push('
'); @@ -50,9 +53,11 @@ Drupal.behaviors.roblib_search_eds = { items.push('
'); } - }); + }); + jQuery('#' + 'roblib-search-content-eds').empty().append(items.join('')); + qtipify(divs, content, 'Notes'); } - jQuery('#' + 'roblib-search-content-eds').empty().append(items.join('')); + var queries = []; jQuery.each(data.queries, function(key7, query){ queries.push(query.query); @@ -64,3 +69,14 @@ Drupal.behaviors.roblib_search_eds = { }); } } + +function edsPopulatePopupDivs(content, val, counter){ + content[counter] = ''; + jQuery.each(val.DetailedRecord, function(key, value){ + if(value.Group == 'Note' || value.Group == 'TOC') { + content[counter] += '
' + value.Label + '' ; + content[counter] += ' ' + value.Data +'
'; + } + }) +} + diff --git a/targets/eds/js/eds_results_article.js b/targets/eds/js/eds_results_article.js index 63aaa3d..5d8e5c8 100644 --- a/targets/eds/js/eds_results_article.js +++ b/targets/eds/js/eds_results_article.js @@ -13,12 +13,16 @@ Drupal.behaviors.roblib_search_eds_articles = { jQuery('#' + 'roblib-search-content-eds').empty().append('No Results'); jQuery('.' + 'pane-roblib-search-eds-roblib-search-eds-articles').hide(); } else { + var counter = 0; + var divs = new Array(); + var content = new Array(); jQuery.each(data.records, function(key, val) { - - //items.push('
'); - //jQuery.each(val.RecordInfo.BibEntity.Titles, function(key2, val2){ + id = 'roblib-search-eds-article-' + counter; + edsPopulatePopupDivs(content, val, counter); + divs[counter++] = id; + if (typeof val.Items !== 'undefined') { - items.push('
'); + items.push('
'); if (typeof val.Items.Ti !== 'undefined') { jQuery.each(val.Items.Ti, function(key2, val2){ items.push(''); } - }); + }); + jQuery('#' + 'roblib-search-content-eds-articles').empty().append(items.join('')); + qtipify(divs, content, 'Notes'); } - jQuery('#' + 'roblib-search-content-eds-articles').empty().append(items.join('')); + var queries = []; jQuery.each(data.queries, function(key7, query){ queries.push(query.query); @@ -66,3 +62,13 @@ Drupal.behaviors.roblib_search_eds_articles = { }); } } + +/*function edsArticlesPopulatePopupDivs(content, val, counter){ + content[counter] = ''; + jQuery.each(val.DetailedRecord, function(key, value){ + if(value.Group == 'Note') { + content[counter] += '
' + value.Label + '' ; + content[counter] += ' ' + value.Data +'
'; + } + }) +} */ diff --git a/targets/eds/roblib_search_eds.module b/targets/eds/roblib_search_eds.module index ed3055e..0addcf8 100644 --- a/targets/eds/roblib_search_eds.module +++ b/targets/eds/roblib_search_eds.module @@ -237,9 +237,21 @@ function roblib_search_eds_get_results($query = NULL, $type = NULL) { $query = urlencode($query); $params = "query=AND,$query&view=detailed&includefacets=n&$limiters&resultsperpage=$number_per_page"; $output = $eds_api->apiSearch($params); + $output = roblib_search_eds_get_detailed_result($output, $query, $eds_api); return json_encode($output); } +function roblib_search_eds_get_detailed_result(&$output, $query, &$eds_api) { + $detailed_record = array(); + foreach ($output['records'] as &$record) { + $db = $record['DbId']; + $an = $record['An']; + $arr = $eds_api->apiRetrieve($an, $db, $query); + $record['DetailedRecord'] = $arr['Items']; + } + return $output; +} + function roblib_search_eds_get_query_limiters($type) { $limiters = 'n'; switch ($type) {