diff --git a/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php b/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php index 2e27f68e0f28b284c103e5e742d891fed3b7760d..1b0de558b6043b614d428ab3ef6da0161414747b 100644 --- a/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php +++ b/module/finc/src/finc/RecordDriver/SolrDefaultFincTrait.php @@ -246,8 +246,6 @@ trait SolrDefaultFincTrait /** * Combined fields of author data. * - * @todo Check whether static call of getCorporateAuthor is necessary - * * @return array * @link https://intern.finc.info/issues/1866 */ @@ -255,28 +253,41 @@ trait SolrDefaultFincTrait { $retval = []; - if ($this->getPrimaryAuthor() != '') { - $original = ''; - if ($this->getPrimaryAuthorOrig() != '') { - $original = $this->getPrimaryAuthorOrig(); - } - $retval[] = ($original == '') ? $this->getPrimaryAuthor() - : $this->getPrimaryAuthor() . ' (' . $original . ')'; - } elseif ( self::getCorporateAuthor() != '' ) { - $retval[] = self::getCorporateAuthor(); - } elseif (count($this->getSecondaryAuthors()) > 0) { - foreach ($this->getSecondaryAuthors() as $val) { - $retval[] = $val; - } - } elseif (count($this->getCorporateSecondaryAuthors()) > 0) { - foreach ($this->getCorporateSecondaryAuthors() as $val) { - $retval[] = $val; + $buildCombined = function ($authors, $authors_orig) use(&$retval) { + foreach ($authors as $key => $value) { + $retval[] = $value . ( + isset($author_orig[$key]) + && $author_orig[$key] != $this->getDefaultOrigName() + ? '(' . $author_orig[$key] . ')' : '' + ); } + }; + + if ($this->getPrimaryAuthors()) { + $buildCombined( + $this->getPrimaryAuthors(), $this->getPrimaryAuthorOrig() + ); + } elseif ($this->getCorporateAuthors()) { + $retval = $this->getCorporateAuthors(); + } elseif ($this->getSecondaryAuthors()) { + $retval = $this->getSecondaryAuthors(); + } elseif ($this->getCorporateSecondaryAuthors()) { + $retval = $this->getCorporateSecondaryAuthors(); } return $retval; } + /** + * Get the default value if no original name is available + * + * @return string + */ + protected function getDefaultOrigName() { + //TODO: make this configurable - aka get value from config! + return 'noOrigName'; + } + /** * Get the main author of the record. * @@ -286,7 +297,7 @@ trait SolrDefaultFincTrait public function getPrimaryAuthor() { return isset($this->fields['author']) ? - $this->_filterAuthorDates($this->fields['author']) : ''; + $this->_filterAuthorDates(parent::getPrimaryAuthor()) : ''; } /** @@ -294,10 +305,10 @@ trait SolrDefaultFincTrait * * @return string */ - public function getPrimaryAuthorOrig() + public function getPrimaryAuthorsOrig() { return isset($this->fields['author_orig']) ? - $this->_filterAuthorDates($this->fields['author_orig']) : ''; + $this->_filterAuthorDates($this->fields['author_orig']) : []; } /** @@ -306,11 +317,11 @@ trait SolrDefaultFincTrait * @return string * @access public */ - public function getCorporateAuthor() + /*public function getCorporateAuthor() { return isset($this->fields['author_corp']) ? $this->fields['author_corp'] : ''; - } + }*/ /** * Get the secondary corporate authors (if any) for the record. diff --git a/module/finc/src/finc/RecordDriver/SolrMarc.php b/module/finc/src/finc/RecordDriver/SolrMarc.php index d077f11acf6142b1cd3ebf2a111bff056880dec6..5e832393e9b542ae72803d0057a5d8902b4dbce5 100644 --- a/module/finc/src/finc/RecordDriver/SolrMarc.php +++ b/module/finc/src/finc/RecordDriver/SolrMarc.php @@ -184,21 +184,6 @@ class SolrMarc extends SolrDefault return $this->getFieldArray('504'); } - /** - * Get the main corporate author (if any) for the record. - * - * @return string - */ - public function getCorporateAuthor() - { - // Try 110 first -- if none found, try 710 next. - $main = $this->getFirstFieldValue('110', ['a', 'b']); - if (!empty($main)) { - return $main; - } - return $this->getFirstFieldValue('710', ['a', 'b']); - } - /** * Return an array of all values extracted from the specified field/subfield * combination. If multiple subfields are specified and $concat is true, they @@ -1087,7 +1072,9 @@ class SolrMarc extends SolrDefault */ public function supportsAjaxStatus() { - return true; + // as AJAX status lookups are done via the ILS AJAX status lookup support is + // only given if the ILS is available for this record + return $this->hasILS(); } /** diff --git a/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml b/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml index 885af255d86fbdd4996ac5ba5f87f2c0579da3c8..88dcb82db588d0f7c3c4dcf0baba167c585d70a0 100644 --- a/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml +++ b/themes/finc/templates/RecordDriver/SolrAI/result-list.phtml @@ -25,27 +25,20 @@ <? if ($this->driver->isCollection()): ?> <?=implode('<br>', array_map(array($this, 'escapeHtml'), $this->driver->getSummary()));?> <? else: ?> - <?/* getCombinedAuthors etc below is ok - 04.16 - CK */?> - <? $summAuthors = $this->driver->getCombinedAuthors(); if (!empty($summAuthors)): ?> - <? foreach($summAuthors as $summAuthor) : ?> - <a href="<?=$this->record($this->driver)->getLink('author', $summAuthor)?>" class="author"><? - $summHighlightedAuthor = $this->driver->getHighlightedAuthor(); - echo !empty($summHighlightedAuthor) - ? $this->highlight($summHighlightedAuthor) - : $this->escapeHtml($summAuthor); - ?> - </a> + <? $summAuthors = $this->driver->getPrimaryAuthorsWithHighlighting(); if (!empty($summAuthors)): ?> + <?=$this->transEsc('by')?> + <? $authorCount = count($summAuthors); foreach ($summAuthors as $i => $summAuthor): ?> + <a href="<?=$this->record($this->driver)->getLink('author', $this->highlight($summAuthor, null, true, false))?>" class="author"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ',' : ''?> <? endforeach; ?> <? endif; ?> <?/* getPublishDateSort etc below is ok - 04.16 - CK */?> - <? $journalTitle = $this->driver->getContainerTitle(); - $summDate = $this->driver->getPublishDateSort(); $placesOfPublication = $this->driver->getPlacesOfPublication(); ?> + <? $journalTitle = $this->driver->getContainerTitle(); $summDate = $this->driver->getPublishDateSort(); ?> <? if (!empty($journalTitle)): ?> <?=!empty($summAuthor) ? '<br />' : ''?> <?=$this->transEsc('Published in')?> <? $containerSource = $this->driver->getSourceIdentifier(); ?> <? $containerID = $this->driver->getContainerRecordID(); ?> - <? /* TODO: handle highlighting more elegantly here: */ ?> + <? /* TODO: handle highlighting more elegantly here: */?> <a href="<?=($containerID ? $this->recordLink()->getUrl("$containerSource|$containerID") : $this->record($this->driver)->getLink('journaltitle', str_replace(array('{{{{START_HILITE}}}}', '{{{{END_HILITE}}}}'), '', $journalTitle)))?>"><?=$this->highlight($journalTitle) ?></a> <?=!empty($summDate) ? ' (' . $this->escapeHtml($summDate[0]) . ')' : ''?> <? elseif (!empty($summDate)): ?> diff --git a/themes/finc/templates/RecordDriver/SolrDefault/core.phtml b/themes/finc/templates/RecordDriver/SolrDefault/core.phtml index 378025165746503e017e1507f0817fa351fb5bb0..d656dda67628b54bf109c0e607f3023cac359e19 100644 --- a/themes/finc/templates/RecordDriver/SolrDefault/core.phtml +++ b/themes/finc/templates/RecordDriver/SolrDefault/core.phtml @@ -103,15 +103,19 @@ if($loggedin = $this->auth()->isLoggedIn()) { <? $authors = $this->driver->getDeduplicatedAuthors(); ?> <? if (isset($authors['main']) && !empty($authors['main'])): ?> <tr> - <th><?=$this->transEsc('Main Author')?>: </th> - <td property="author"><a href="<?=$this->record($this->driver)->getLink('author', $authors['main'])?>"><?=$this->escapeHtml($authors['main'])?></a></td> + <th><?=$this->transEsc(count($authors['main']) > 1 ? 'Main Authors' : 'Main Author')?>: </th> + <td> + <? $i = 0; foreach ($authors['main'] as $author => $roles): ?><?=($i++ == 0)?'':', '?><span property="author"><a href="<?=$this->record($this->driver)->getLink('author', $author)?>"><?=$this->escapeHtml($author)?></a><? if (count($roles) > 0): ?> (<? $j = 0; foreach ($roles as $role): ?><?=($j++ == 0)?'':', '?><?=$this->transEsc("CreatorRoles::" . $role)?><? endforeach; ?>)<? endif; ?></span><? endforeach; ?> + </td> </tr> <? endif; ?> <? if (isset($authors['corporate']) && !empty($authors['corporate'])): ?> <tr> - <th><?=$this->transEsc('Corporate Author')?>: </th> - <td property="creator"><a href="<?=$this->record($this->driver)->getLink('author', $authors['corporate'])?>"><?=$this->escapeHtml($authors['corporate'])?></a></td> + <th><?=$this->transEsc(count($authors['corporate']) > 1 ? 'Corporate Author' : 'Corporate Authors')?>: </th> + <td> + <? $i = 0; foreach ($authors['corporate'] as $corporate => $roles): ?><?=($i++ == 0)?'':', '?><span property="creator"><a href="<?=$this->record($this->driver)->getLink('author', $corporate)?>"><?=$this->escapeHtml($corporate)?></a><? if (count($roles) > 0): ?> (<? $j = 0; foreach ($roles as $role): ?><?=($j++ == 0)?'':', '?><?=$this->transEsc("CreatorRoles::" . $role)?><? endforeach; ?>)<? endif; ?></span><? endforeach; ?> + </td> </tr> <? endif; ?> @@ -119,7 +123,7 @@ if($loggedin = $this->auth()->isLoggedIn()) { <tr> <th><?=$this->transEsc('Other Authors')?>: </th> <td> - <? $i = 0; foreach ($authors['secondary'] as $field): ?><?=($i++ == 0)?'':', '?><span property="contributor"><a href="<?=$this->record($this->driver)->getLink('author', $field)?>"><?=$this->escapeHtml($field)?></a></span><? endforeach; ?> + <? $i = 0; foreach ($authors['secondary'] as $author => $roles): ?><?=($i++ == 0)?'':', '?><span property="contributor"><a href="<?=$this->record($this->driver)->getLink('author', $author)?>"><?=$this->escapeHtml($author)?></a><? if (count($roles) > 0): ?> (<? $j = 0; foreach ($roles as $role): ?><?=($j++ == 0)?'':', '?><?=$this->transEsc("CreatorRoles::" . $role)?><? endforeach; ?>)<? endif; ?></span><? endforeach; ?> </td> </tr> <? endif; ?> diff --git a/themes/finc/templates/RecordDriver/SolrDefault/result-list.phtml b/themes/finc/templates/RecordDriver/SolrDefault/result-list.phtml index 7190ce2aac47417605debff2eb9a617cfb75a609..e4f26172f29d8bf557f177a24bdb407dcc2c4179 100644 --- a/themes/finc/templates/RecordDriver/SolrDefault/result-list.phtml +++ b/themes/finc/templates/RecordDriver/SolrDefault/result-list.phtml @@ -9,198 +9,189 @@ <div class="small-3 medium-2 columns left"><?=$cover?></div> <? /* BOF - finc-specific StyleBasedIcons */ ?> <div class="small-6 medium-7 columns middle"> - <? elseif ($this->record($this->driver)->showStyleBasedIcons()): ?> - <div class="small-3 medium-2 columns left"><?=$this->record($this->driver)->getRecordIcon()?></div> - <div class="small-6 medium-7 columns middle"> - <? else : ?> - <div class="small-9 columns middle"> - <? /* EOF - finc-specific StyleBasedIcons */ ?> - <? endif ?> - <div> - <a href="<?=$this->recordLink()->getUrl($this->driver)?>" class="title"> - <?=$this->record($this->driver)->getTitleHtml()?> - </a> - </div> - - <div> - <? if ($this->driver->isCollection()): ?> - <?=implode('<br>', array_map(array($this, 'escapeHtml'), $this->driver->getSummary()));?> - <? else: ?> - <? $summAuthor = $this->driver->getPrimaryAuthor(); - if (!empty($summAuthor)): ?> - <?=$this->transEsc('by')?> - <a href="<?=$this->record($this->driver)->getLink('author', $summAuthor)?>" class="author"><? - $summHighlightedAuthor = $this->driver->getHighlightedAuthor(); - echo !empty($summHighlightedAuthor) - ? $this->highlight($summHighlightedAuthor) - : $this->escapeHtml($summAuthor); - ?> - </a> - <? endif; ?> - - <? $journalTitle = $this->driver->getContainerTitle(); - $summDate = $this->driver->getPublicationDates(); ?> - <? if (!empty($journalTitle)): ?> - <?=!empty($summAuthor) ? '<br />' : ''?> - <?=$this->transEsc('Published in')?> - <? $containerSource = $this->driver->getSourceIdentifier(); ?> - <? $containerID = $this->driver->getContainerRecordID(); ?> - <? /* TODO: handle highlighting more elegantly here: */ ?> - <a href="<?=($containerID ? $this->recordLink()->getUrl("$containerSource|$containerID") : $this->record($this->driver)->getLink('journaltitle', str_replace(array('{{{{START_HILITE}}}}', '{{{{END_HILITE}}}}'), '', $journalTitle)))?>"><?=$this->highlight($journalTitle) ?></a> - <?=!empty($summDate) ? ' (' . $this->escapeHtml($summDate[0]) . ')' : ''?> - <? elseif (!empty($summDate)): ?> - <?=!empty($summAuthor) ? '<br />' : ''?> - <?=$this->transEsc('Published') . ' ' . $this->escapeHtml($summDate[0])?> - <? endif; ?> - <? $summInCollection = $this->driver->getContainingCollections(); - if (!empty($summInCollection)): ?> - <? foreach ($summInCollection as $collId => $collText): ?> - <div> - <strong><?=$this->transEsc("in_collection_label")?></strong> - <a class="collectionLinkText" href="<?=$this->url('collection', array('id' => $collId))?>?recordID=<?=urlencode($this->driver->getUniqueID())?>"> - <?=$this->escapeHtml($collText)?> - </a> - </div> - <? endforeach; ?> - <? endif; ?> - <? endif; ?> - </div> + <? elseif ($this->record($this->driver)->showStyleBasedIcons()): ?> + <div class="small-3 medium-2 columns left"><?=$this->record($this->driver)->getRecordIcon()?></div> + <div class="small-6 medium-7 columns middle"> + <? else : ?> + <div class="small-9 columns middle"> + <? /* EOF - finc-specific StyleBasedIcons */ ?> + <? endif ?> + <div> + <a href="<?=$this->recordLink()->getUrl($this->driver)?>" class="title"> + <?=$this->record($this->driver)->getTitleHtml()?> + </a> + </div> - <? if (!$this->driver->isCollection()): ?> - <? if ($snippet = $this->driver->getHighlightedSnippet()): ?> - <? if (!empty($snippet['caption'])): ?> - <strong><?=$this->transEsc($snippet['caption'])?>:</strong> '; - <? endif; ?> - <? if (!empty($snippet['snippet'])): ?> - <span class="quotestart">“</span>...<?=$this->highlight($snippet['snippet'])?>...<span class="quoteend">”</span><br/> - <? endif; ?> - <? endif; ?> - <? endif; ?> + <div> + <? if ($this->driver->isCollection()): ?> + <?=implode('<br>', array_map(array($this, 'escapeHtml'), $this->driver->getSummary()));?> + <? else: ?> + <? $summAuthors = $this->driver->getPrimaryAuthorsWithHighlighting(); if (!empty($summAuthors)): ?> + <?=$this->transEsc('by')?> + <? $authorCount = count($summAuthors); foreach ($summAuthors as $i => $summAuthor): ?> + <a href="<?=$this->record($this->driver)->getLink('author', $this->highlight($summAuthor, null, true, false))?>" class="author"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ',' : ''?> + <? endforeach; ?> + <? endif; ?> - <? - /* Display information on duplicate records if available */ - if ($dedupData = $this->driver->getDedupData()): ?> - <div class="dedupInformation"> - <? - $i = 0; - foreach ($dedupData as $source => $current) { - if (++$i == 1) { - ?><span class="currentSource"><a href="<?=$this->recordLink()->getUrl($this->driver)?>"><?=$this->transEsc("source_$source", array(), $source)?></a></span><? - } else { - if ($i == 2) { - ?> <span class="otherSources">(<?=$this->transEsc('Other Sources')?>: <? - } else { - ?>, <? - } - ?><a href="<?=$this->recordLink()->getUrl($current['id'])?>"><?=$this->transEsc("source_$source", array(), $source)?></a><? - } - } - if ($i > 1) { - ?>)</span><? - } ?> + <? $journalTitle = $this->driver->getContainerTitle(); $summDate = $this->driver->getPublicationDates(); ?> + <? if (!empty($journalTitle)): ?> + <?=!empty($summAuthor) ? '<br />' : ''?> + <?=$this->transEsc('Published in')?> + <? $containerSource = $this->driver->getSourceIdentifier(); ?> + <? $containerID = $this->driver->getContainerRecordID(); ?> + <? /* TODO: handle highlighting more elegantly here: */?> + <a href="<?=($containerID ? $this->recordLink()->getUrl("$containerSource|$containerID") : $this->record($this->driver)->getLink('journaltitle', str_replace(array('{{{{START_HILITE}}}}', '{{{{END_HILITE}}}}'), '', $journalTitle)))?>"><?=$this->highlight($journalTitle) ?></a> + <?=!empty($summDate) ? ' (' . $this->escapeHtml($summDate[0]) . ')' : ''?> + <? elseif (!empty($summDate)): ?> + <?=!empty($summAuthor) ? '<br />' : ''?> + <?=$this->transEsc('Published') . ' ' . $this->escapeHtml($summDate[0])?> + <? endif; ?> + <? $summInCollection = $this->driver->getContainingCollections(); if (!empty($summInCollection)): ?> + <? foreach ($summInCollection as $collId => $collText): ?> + <div> + <strong><?=$this->transEsc("in_collection_label")?></strong> + <a class="collectionLinkText" href="<?=$this->url('collection', array('id' => $collId))?>?recordID=<?=urlencode($this->driver->getUniqueID())?>"> + <?=$this->escapeHtml($collText)?> + </a> </div> - <? endif; ?> + <? endforeach; ?> + <? endif; ?> + <? endif; ?> + </div> - <div class="callnumAndLocation ajax-availability hide"> - <? if ($this->driver->supportsAjaxStatus()): ?> - <strong class="hideIfDetailed"><?=$this->transEsc('Call Number')?>:</strong> - <span class="callnumber ajax-availability hide"> - <?=$this->transEsc('Loading')?> ...<br/> - </span> - <strong><?=$this->transEsc('Located')?>:</strong> - <span class="location ajax-availability hide"> - <?=$this->transEsc('Loading')?> ... - </span> - <div class="locationDetails"></div> - <? else: ?> - <? $summCallNo = $this->driver->getCallNumber(); - if (!empty($summCallNo)): ?> - <strong><?=$this->transEsc('Call Number')?>:</strong> <?=$this->escapeHtml($summCallNo)?> - <? endif; ?> - <? endif; ?> - </div> + <? if (!$this->driver->isCollection()): ?> + <? if ($snippet = $this->driver->getHighlightedSnippet()): ?> + <? if (!empty($snippet['caption'])): ?> + <strong><?=$this->transEsc($snippet['caption'])?>:</strong> '; + <? endif; ?> + <? if (!empty($snippet['snippet'])): ?> + <span class="quotestart">“</span>...<?=$this->highlight($snippet['snippet'])?>...<span class="quoteend">”</span><br/> + <? endif; ?> + <? endif; ?> + <? endif; ?> - <? /* We need to find out if we're supposed to display an OpenURL link ($openUrlActive), - but even if we don't plan to display the link, we still want to get the $openUrl - value for use in generating a COinS (Z3988) tag -- see bottom of file. - */ - $openUrl = $this->openUrl($this->driver, 'results'); - $openUrlActive = $openUrl->isActive(); - // Account for replace_other_urls setting - $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); + <? + /* Display information on duplicate records if available */ + if ($dedupData = $this->driver->getDedupData()): ?> + <div class="dedupInformation"> + <? + $i = 0; + foreach ($dedupData as $source => $current) { + if (++$i == 1) { + ?><span class="currentSource"><a href="<?=$this->recordLink()->getUrl($this->driver)?>"><?=$this->transEsc("source_$source", array(), $source)?></a></span><? + } else { + if ($i == 2) { + ?> <span class="otherSources">(<?=$this->transEsc('Other Sources')?>: <? + } else { + ?>, <? + } + ?><a href="<?=$this->recordLink()->getUrl($current['id'])?>"><?=$this->transEsc("source_$source", array(), $source)?></a><? + } + } + if ($i > 1) { + ?>)</span><? + } ?> + </div> + <? endif; ?> - if ($openUrlActive || !empty($urls)): ?> - <? if ($openUrlActive): ?> - <br/> - <?=$openUrl->renderTemplate()?> - <? endif; ?> - <? if (!is_array($urls)) $urls = array(); - if (!$this->driver->isCollection()): - foreach ($urls as $current): ?> - <a href="<?=$this->escapeHtmlAttr($this->proxyUrl($current['url']))?>" class="fulltext" target="new"> - <i class="fa fa-external-link"></i> - <?=($current['url'] == $current['desc']) ? $this->transEsc('Get full text') : $this->escapeHtml($current['desc'])?> - </a> - <br/> - <? endforeach; ?> - <? endif; ?> - <? endif; ?> + <div class="callnumAndLocation ajax-availability hide"> + <? if ($this->driver->supportsAjaxStatus()): ?> + <strong class="hideIfDetailed"><?=$this->transEsc('Call Number')?>:</strong> + <span class="callnumber ajax-availability hide"> + <?=$this->transEsc('Loading')?> ...<br/> + </span> + <strong><?=$this->transEsc('Located')?>:</strong> + <span class="location ajax-availability hide"> + <?=$this->transEsc('Loading')?> ... + </span> + <div class="locationDetails"></div> + <? else: ?> + <? $summCallNo = $this->driver->getCallNumber(); if (!empty($summCallNo)): ?> + <strong><?=$this->transEsc('Call Number')?>:</strong> <?=$this->escapeHtml($summCallNo)?> + <? endif; ?> + <? endif; ?> + </div> - <?=str_replace('class="', 'class="label info ', $this->record($this->driver)->getFormatList())?> + <? /* We need to find out if we're supposed to display an OpenURL link ($openUrlActive), + but even if we don't plan to display the link, we still want to get the $openUrl + value for use in generating a COinS (Z3988) tag -- see bottom of file. + */ + $openUrl = $this->openUrl($this->driver, 'results'); + $openUrlActive = $openUrl->isActive(); + // Account for replace_other_urls setting + $urls = $this->record($this->driver)->getLinkDetails($openUrlActive); - <? if (!$openUrlActive && empty($urls) && $this->driver->supportsAjaxStatus()): ?> - <span class="status ajax-availability hide"> - <span class="label secondary"><?=$this->transEsc('Loading')?> ...</span> - </span> - <? endif; ?> - <?=$this->record($this->driver)->getPreviews()?> - </div> + if ($openUrlActive || !empty($urls)): ?> + <? if ($openUrlActive): ?> + <br/> + <?=$openUrl->renderTemplate()?> + <? endif; ?> + <? if (!is_array($urls)) $urls = array(); + if (!$this->driver->isCollection()): + foreach ($urls as $current): ?> + <a href="<?=$this->escapeHtmlAttr($this->proxyUrl($current['url']))?>" class="fulltext" target="new"> + <i class="fa fa-external-link"></i> + <?=($current['url'] == $current['desc']) ? $this->transEsc('Get full text') : $this->escapeHtml($current['desc'])?> + </a> + <br/> + <? endforeach; ?> + <? endif; ?> + <? endif; ?> - <div class="small-3 columns right hide-for-print"> - <? /* Display qrcode if appropriate: */ ?> - <? if ($QRCode = $this->record($this->driver)->getQRCode("results")): ?> - <? - // Add JS Variables for QrCode - $this->jsTranslations()->addStrings(array('qrcode_hide' => 'qrcode_hide', 'qrcode_show' => 'qrcode_show')); - ?> - <div class="hide-for-small"> - <i class="fa fa-fw fa-qrcode"></i> - <a href="<?=$this->escapeHtmlAttr($QRCode);?>" class="qrcodeLink"><?=$this->transEsc('qrcode_show')?></a> + <?=str_replace('class="', 'class="label info ', $this->record($this->driver)->getFormatList())?> - <div class="qrcode hide"> - <script type="text/template" class="qrCodeImgTag"> - <img alt="<?=$this->transEsc('QR Code')?>" src="<?=$this->escapeHtmlAttr($QRCode);?>"/> - </script> - </div> - <br/> - </div> - <? endif; ?> + <? if (!$openUrlActive && empty($urls) && $this->driver->supportsAjaxStatus()): ?> + <span class="status ajax-availability hide"> + <span class="label secondary"><?=$this->transEsc('Loading')?> ...</span> + </span> + <? endif; ?> + <?=$this->record($this->driver)->getPreviews()?> + </div> - <? if ($this->userlist()->getMode() !== 'disabled'): ?> - <? /* Add to favorites */ ?> - <a href="<?=$this->recordLink()->getActionUrl($this->driver, 'Save')?>" data-lightbox class="save-record" data-id="<?=$this->escapeHtmlAttr($this->driver->getUniqueId()) ?>" title="<?=$this->transEsc('Add to favorites')?>"><i class="fa fa-fw fa-star"></i> <?=$this->transEsc('Add to favorites')?></a><br/> - <? /* Saved lists */ ?> - <div class="savedLists hide alert-box info" data-alert tabindex="0" aria-live="assertive" role="dialogalert"> - <strong><?=$this->transEsc("Saved in")?>:</strong> - </div> - <? endif; ?> + <div class="small-3 columns right hide-for-print"> + <? /* Display qrcode if appropriate: */ ?> + <? if ($QRCode = $this->record($this->driver)->getQRCode("results")): ?> + <? + // Add JS Variables for QrCode + $this->jsTranslations()->addStrings(array('qrcode_hide' => 'qrcode_hide', 'qrcode_show' => 'qrcode_show')); + ?> + <div class="hide-for-small"> + <i class="fa fa-fw fa-qrcode"></i> + <a href="<?=$this->escapeHtmlAttr($QRCode);?>" class="qrcodeLink"><?=$this->transEsc('qrcode_show')?></a> - <? /* Hierarchy tree link */ ?> - <? $trees = $this->driver->tryMethod('getHierarchyTrees'); - if (!empty($trees)): ?> - <? foreach ($trees as $hierarchyID => $hierarchyTitle): ?> - <div class="hierarchyTreeLink"> - <input type="hidden" value="<?=$this->escapeHtmlAttr($hierarchyID)?>" class="hiddenHierarchyId"/> - <i class="fa fa-fw fa-sitemap"></i> - <a class="hierarchyTreeLinkText" data-lightbox href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree')?>?hierarchy=<?=urlencode($hierarchyID)?>" title="<?=$this->transEsc('hierarchy_tree')?>" data-lightbox-href="<?=$this->recordLink()->getTabUrl($this->driver, 'AjaxTab')?>?hierarchy=<?=urlencode($hierarchyID)?>" data-lightbox-post="tab=hierarchytree"> - <?=$this->transEsc('hierarchy_view_context')?><? if (count($trees) > 1): ?>: <?=$this->escapeHtml($hierarchyTitle)?><? endif; ?> - </a> - </div> - <? endforeach; ?> - <? endif; ?> + <div class="qrcode hide"> + <script type="text/template" class="qrCodeImgTag"> + <img alt="<?=$this->transEsc('QR Code')?>" src="<?=$this->escapeHtmlAttr($QRCode);?>"/> + </script> + </div> + <br/> + </div> + <? endif; ?> - <?=$this->driver->supportsCoinsOpenUrl() ? '<span class="Z3988" title="' . $this->escapeHtmlAttr($this->driver->getCoinsOpenUrl()) . '"></span>' : ''?> + <? if ($this->userlist()->getMode() !== 'disabled'): ?> + <? /* Add to favorites */ ?> + <a href="<?=$this->recordLink()->getActionUrl($this->driver, 'Save')?>" data-lightbox class="save-record" data-id="<?=$this->escapeHtmlAttr($this->driver->getUniqueId()) ?>" title="<?=$this->transEsc('Add to favorites')?>"><i class="fa fa-fw fa-star"></i> <?=$this->transEsc('Add to favorites')?></a><br/> + <? /* Saved lists */ ?> + <div class="savedLists hide alert-box info" data-alert tabindex="0" aria-live="assertive" role="dialogalert"> + <strong><?=$this->transEsc("Saved in")?>:</strong> </div> - </div> + <? endif; ?> + + <? /* Hierarchy tree link */ ?> + <? $trees = $this->driver->tryMethod('getHierarchyTrees'); if (!empty($trees)): ?> + <? foreach ($trees as $hierarchyID => $hierarchyTitle): ?> + <div class="hierarchyTreeLink"> + <input type="hidden" value="<?=$this->escapeHtmlAttr($hierarchyID)?>" class="hiddenHierarchyId" /> + <i class="fa fa-fw fa-sitemap"></i> + <a class="hierarchyTreeLinkText" data-lightbox href="<?=$this->recordLink()->getTabUrl($this->driver, 'HierarchyTree')?>?hierarchy=<?=urlencode($hierarchyID)?>" title="<?=$this->transEsc('hierarchy_tree')?>" data-lightbox-href="<?=$this->recordLink()->getTabUrl($this->driver, 'AjaxTab')?>?hierarchy=<?=urlencode($hierarchyID)?>" data-lightbox-post="tab=hierarchytree"> + <?=$this->transEsc('hierarchy_view_context')?><? if (count($trees) > 1): ?>: <?=$this->escapeHtml($hierarchyTitle)?><? endif; ?> + </a> + </div> + <? endforeach; ?> + <? endif; ?> + + <?=$this->driver->supportsCoinsOpenUrl()?'<span class="Z3988" title="'.$this->escapeHtmlAttr($this->driver->getCoinsOpenUrl()).'"></span>':''?> </div> + </div> +</div> <!-- recordDriver - solrDefault - RESULT-LIST.phtml end --> \ No newline at end of file diff --git a/themes/foundation5/templates/Recommend/CatalogResults.phtml b/themes/foundation5/templates/Recommend/CatalogResults.phtml index cef16c172496061a95576338b6588221273dc1d5..3c30cbd9ebaef7f5749d02c3ddb0ae2c6faf4c3d 100644 --- a/themes/foundation5/templates/Recommend/CatalogResults.phtml +++ b/themes/foundation5/templates/Recommend/CatalogResults.phtml @@ -9,24 +9,18 @@ <?=$this->record($driver)->getTitleHtml()?> </a> <? $summDate = $driver->getPublicationDates(); ?> - <? $summAuthor = $driver->getPrimaryAuthor(); ?> - <? if (!empty($summDate) || !empty($summAuthor)): ?> + <? $summAuthors = $driver->getPrimaryAuthorsWithHighlighting(); ?> + <? if (!empty($summDate) || !empty($summAuthors)): ?> <? if (!empty($summDate)): ?> <span class="small date"> <?=$this->transEsc('Published')?>: (<?=$this->escapeHtml($summDate[0])?>) </span> <? endif; ?> - <? if (!empty($summAuthor)): ?> + <? if (!empty($summAuthors)): ?> <br><span class="small"><?=$this->transEsc('By')?></span> - <a class="small author" href="<?=$this->record($driver)->getLink('author', $summAuthor)?>"> - <? - $summHighlightedAuthor = $driver->getHighlightedAuthor(); - echo !empty($summHighlightedAuthor) - ? $this->highlight($summHighlightedAuthor) - : $this->escapeHtml($summAuthor); - ?></a> + <a class="small author" href="<?=$this->record($driver)->getLink('author', $this->highlight($summAuthors[0], null, true, false))?>"><?=$this->highlight($summAuthors[0])?></a><? if (count($summAuthors) > 1): ?><span class="small">, <?=$this->transEsc('more_authors_abbrev')?></span><? endif; ?> <? endif; ?> <? endif; ?> </li> diff --git a/themes/foundation5/templates/Recommend/SummonResults.phtml b/themes/foundation5/templates/Recommend/SummonResults.phtml index 7795c2f45805e23a362ecd22fab4f651aa63b057..9568340d1f56cf09d6afb9d2ae3b88f32e8305cb 100644 --- a/themes/foundation5/templates/Recommend/SummonResults.phtml +++ b/themes/foundation5/templates/Recommend/SummonResults.phtml @@ -9,17 +9,10 @@ <a href="<?=$this->recordLink()->getUrl($driver)?>" class="title <?=$this->record($driver)->getFormatClass($format)?>"> <?=$this->record($driver)->getTitleHtml()?> </a> - <? $summAuthor = $driver->getPrimaryAuthor(); if (!empty($summAuthor)): ?> + <? $summAuthors = $driver->getPrimaryAuthorsWithHighlighting(); if (!empty($summAuthors)): ?> <span class="small"> <?=$this->transEsc('by')?> - <a href="<?=$this->record($driver)->getLink('author', $summAuthor)?>"> - <? - $summHighlightedAuthor = $driver->getHighlightedAuthor(); - echo !empty($summHighlightedAuthor) - ? $this->highlight($summHighlightedAuthor) - : $this->escapeHtml($summAuthor); - ?> - </a> + <a href="<?=$this->record($driver)->getLink('author', $this->highlight($summAuthors[0], null, true, false))?>"><?=$this->highlight($summAuthors[0])?></a><? if (count($summAuthors) > 1): ?>, <?=$this->transEsc('more_authors_abbrev')?><? endif; ?> </span> <? endif; ?> </span> diff --git a/themes/foundation5/templates/RecordDriver/Pazpar2/result-list.phtml b/themes/foundation5/templates/RecordDriver/Pazpar2/result-list.phtml index 1b50541fc36c065643932ce46a36faf339d26ee5..6fc6bce70b460caaa63a114ad55fde9f3e0ef189 100644 --- a/themes/foundation5/templates/RecordDriver/Pazpar2/result-list.phtml +++ b/themes/foundation5/templates/RecordDriver/Pazpar2/result-list.phtml @@ -21,14 +21,11 @@ </div> <div> - <? $summAuthor = $this->driver->getPrimaryAuthor(); if (!empty($summAuthor)): ?> + <? $summAuthors = $this->driver->getPrimaryAuthorsWithHighlighting(); if (!empty($summAuthors)): ?> <?=$this->transEsc('by')?> - <a href="<?=$this->record($this->driver)->getLink('author', $summAuthor)?>"><? - $summHighlightedAuthor = $this->driver->getHighlightedAuthor(); - echo !empty($summHighlightedAuthor) - ? $this->highlight($summHighlightedAuthor) - : $this->escapeHtml($summAuthor); - ?></a> + <? $authorCount = count($summAuthors); foreach ($summAuthors as $i => $summAuthor): ?> + <a href="<?=$this->record($this->driver)->getLink('author', $this->highlight($summAuthor, null, true, false))?>"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ',' : ''?> + <? endforeach; ?> <? endif; ?> <? $journalTitle = $this->driver->getContainerTitle(); $summDate = $this->driver->getPublicationDates(); ?> diff --git a/themes/foundation5/templates/RecordDriver/SolrDefault/core.phtml b/themes/foundation5/templates/RecordDriver/SolrDefault/core.phtml index a499ee1cb5d887820fb05cfc7832bdfeef180c09..bb0de45b75fb9a004dddadc0562f4eeb7cc65337 100644 --- a/themes/foundation5/templates/RecordDriver/SolrDefault/core.phtml +++ b/themes/foundation5/templates/RecordDriver/SolrDefault/core.phtml @@ -99,15 +99,19 @@ if($loggedin = $this->auth()->isLoggedIn()) { <? $authors = $this->driver->getDeduplicatedAuthors(); ?> <? if (isset($authors['main']) && !empty($authors['main'])): ?> <tr> - <th><?=$this->transEsc('Main Author')?>: </th> - <td property="author"><a href="<?=$this->record($this->driver)->getLink('author', $authors['main'])?>"><?=$this->escapeHtml($authors['main'])?></a></td> + <th><?=$this->transEsc(count($authors['main']) > 1 ? 'Main Authors' : 'Main Author')?>: </th> + <td> + <? $i = 0; foreach ($authors['main'] as $author => $roles): ?><?=($i++ == 0)?'':', '?><span property="author"><a href="<?=$this->record($this->driver)->getLink('author', $author)?>"><?=$this->escapeHtml($author)?></a><? if (count($roles) > 0): ?> (<? $j = 0; foreach ($roles as $role): ?><?=($j++ == 0)?'':', '?><?=$this->transEsc("CreatorRoles::" . $role)?><? endforeach; ?>)<? endif; ?></span><? endforeach; ?> + </td> </tr> <? endif; ?> <? if (isset($authors['corporate']) && !empty($authors['corporate'])): ?> <tr> - <th><?=$this->transEsc('Corporate Author')?>: </th> - <td property="creator"><a href="<?=$this->record($this->driver)->getLink('author', $authors['corporate'])?>"><?=$this->escapeHtml($authors['corporate'])?></a></td> + <th><?=$this->transEsc(count($authors['corporate']) > 1 ? 'Corporate Author' : 'Corporate Authors')?>: </th> + <td> + <? $i = 0; foreach ($authors['corporate'] as $corporate => $roles): ?><?=($i++ == 0)?'':', '?><span property="creator"><a href="<?=$this->record($this->driver)->getLink('author', $corporate)?>"><?=$this->escapeHtml($corporate)?></a><? if (count($roles) > 0): ?> (<? $j = 0; foreach ($roles as $role): ?><?=($j++ == 0)?'':', '?><?=$this->transEsc("CreatorRoles::" . $role)?><? endforeach; ?>)<? endif; ?></span><? endforeach; ?> + </td> </tr> <? endif; ?> @@ -115,7 +119,7 @@ if($loggedin = $this->auth()->isLoggedIn()) { <tr> <th><?=$this->transEsc('Other Authors')?>: </th> <td> - <? $i = 0; foreach ($authors['secondary'] as $field): ?><?=($i++ == 0)?'':', '?><span property="contributor"><a href="<?=$this->record($this->driver)->getLink('author', $field)?>"><?=$this->escapeHtml($field)?></a></span><? endforeach; ?> + <? $i = 0; foreach ($authors['secondary'] as $author => $roles): ?><?=($i++ == 0)?'':', '?><span property="contributor"><a href="<?=$this->record($this->driver)->getLink('author', $author)?>"><?=$this->escapeHtml($author)?></a><? if (count($roles) > 0): ?> (<? $j = 0; foreach ($roles as $role): ?><?=($j++ == 0)?'':', '?><?=$this->transEsc("CreatorRoles::" . $role)?><? endforeach; ?>)<? endif; ?></span><? endforeach; ?> </td> </tr> <? endif; ?> diff --git a/themes/foundation5/templates/RecordDriver/SolrDefault/result-list.phtml b/themes/foundation5/templates/RecordDriver/SolrDefault/result-list.phtml index 92571fbdcb00dcb20a58e5622273ef744338ddd4..6d9869727e49b45430868005f279e25e2c2699f3 100644 --- a/themes/foundation5/templates/RecordDriver/SolrDefault/result-list.phtml +++ b/themes/foundation5/templates/RecordDriver/SolrDefault/result-list.phtml @@ -2,8 +2,8 @@ <div class="<?=$this->driver->supportsAjaxStatus() ? 'ajaxItem ' : ''?> small-11 columns"> <div class="row"> <div> - <input type="hidden" value="<?=$this->escapeHtmlAttr($this->driver->getUniqueID())?>" class="hiddenId" /> - <input type="hidden" value="<?=$this->escapeHtmlAttr($this->driver->getSourceIdentifier())?>" class="hiddenSource" /> + <input type="hidden" value="<?=$this->escapeHtmlAttr($this->driver->getUniqueID())?>" class="hiddenId"/> + <input type="hidden" value="<?=$this->escapeHtmlAttr($this->driver->getSourceIdentifier())?>" class="hiddenSource"/> </div> <? if ($cover = $this->record($this->driver)->getCover('result-list', 'medium', $this->recordLink()->getUrl($this->driver))): ?> <div class="small-3 medium-2 columns left"><?=$cover?></div> @@ -19,26 +19,20 @@ <? if ($this->driver->isCollection()): ?> <?=implode('<br>', array_map(array($this, 'escapeHtml'), $this->driver->getSummary()));?> <? else: ?> - <? $summAuthor = $this->driver->getPrimaryAuthor(); - if (!empty($summAuthor)): ?> + <? $summAuthors = $this->driver->getPrimaryAuthorsWithHighlighting(); if (!empty($summAuthors)): ?> <?=$this->transEsc('by')?> - <a href="<?=$this->record($this->driver)->getLink('author', $summAuthor)?>" class="author"><? - $summHighlightedAuthor = $this->driver->getHighlightedAuthor(); - echo !empty($summHighlightedAuthor) - ? $this->highlight($summHighlightedAuthor) - : $this->escapeHtml($summAuthor); - ?> - </a> + <? $authorCount = count($summAuthors); foreach ($summAuthors as $i => $summAuthor): ?> + <a href="<?=$this->record($this->driver)->getLink('author', $this->highlight($summAuthor, null, true, false))?>" class="author"><?=$this->highlight($summAuthor)?></a><?=$i + 1 < $authorCount ? ',' : ''?> + <? endforeach; ?> <? endif; ?> - <? $journalTitle = $this->driver->getContainerTitle(); - $summDate = $this->driver->getPublicationDates(); ?> + <? $journalTitle = $this->driver->getContainerTitle(); $summDate = $this->driver->getPublicationDates(); ?> <? if (!empty($journalTitle)): ?> <?=!empty($summAuthor) ? '<br />' : ''?> <?=$this->transEsc('Published in')?> <? $containerSource = $this->driver->getSourceIdentifier(); ?> <? $containerID = $this->driver->getContainerRecordID(); ?> - <? /* TODO: handle highlighting more elegantly here: */ ?> + <? /* TODO: handle highlighting more elegantly here: */?> <a href="<?=($containerID ? $this->recordLink()->getUrl("$containerSource|$containerID") : $this->record($this->driver)->getLink('journaltitle', str_replace(array('{{{{START_HILITE}}}}', '{{{{END_HILITE}}}}'), '', $journalTitle)))?>"><?=$this->highlight($journalTitle) ?></a> <?=!empty($summDate) ? ' (' . $this->escapeHtml($summDate[0]) . ')' : ''?> <? elseif (!empty($summDate)): ?> @@ -177,8 +171,7 @@ <? endif; ?> <? /* Hierarchy tree link */ ?> - <? $trees = $this->driver->tryMethod('getHierarchyTrees'); - if (!empty($trees)): ?> + <? $trees = $this->driver->tryMethod('getHierarchyTrees'); if (!empty($trees)): ?> <? foreach ($trees as $hierarchyID => $hierarchyTitle): ?> <div class="hierarchyTreeLink"> <input type="hidden" value="<?=$this->escapeHtmlAttr($hierarchyID)?>" class="hiddenHierarchyId" /> @@ -190,7 +183,7 @@ <? endforeach; ?> <? endif; ?> - <?=$this->driver->supportsCoinsOpenUrl() ? '<span class="Z3988" title="' . $this->escapeHtmlAttr($this->driver->getCoinsOpenUrl()) . '"></span>' : ''?> + <?=$this->driver->supportsCoinsOpenUrl()?'<span class="Z3988" title="'.$this->escapeHtmlAttr($this->driver->getCoinsOpenUrl()).'"></span>':''?> </div> </div> </div>