Skip to content

Commit

Permalink
changes and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed Jan 22, 2025
1 parent 4bb9ae2 commit 8d3a72b
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 40 deletions.
8 changes: 3 additions & 5 deletions pages/article/ArticleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use Firebase\JWT\Key;
use PKP\citation\CitationDAO;
use PKP\config\Config;
use PKP\core\Core;
use PKP\core\PKPApplication;
use PKP\core\PKPJwt as JWT;
use PKP\db\DAORegistry;
Expand Down Expand Up @@ -360,11 +361,8 @@ public function view($args, $request)
$templateMgr->assign('purchaseArticleEnabled', true);
}

// ror icon
$rorIdIcon = 'ROR';
if (file_exists('lib/pkp/templates/images/ror.svg')) {
$rorIdIcon = file_get_contents('lib/pkp/templates/images/ror.svg');
}
$rorIconPath = Core::getBaseDir() . '/' . PKP_LIB_PATH . '/templates/images/ror.svg';
$rorIdIcon = file_exists($rorIconPath) ? file_get_contents($rorIconPath) : '';
$templateMgr->assign('rorIdIcon', $rorIdIcon);

if (!Hook::call('ArticleHandler::view', [&$request, &$issue, &$article, $publication])) {
Expand Down
12 changes: 7 additions & 5 deletions plugins/generic/datacite/filter/DataciteXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public function createCreatorsNode(DOMDocument $doc, Issue $issue, Publication $
$creators[] = [
'name' => $author->getFullName(false, true, $publication->getData('locale')),
'orcid' => $author->getOrcid(),
'affiliations' => $author->getLocalizedAffiliations($publication->getData('locale'))
'affiliations' => $author->getAffiliations()
];
}
break;
Expand All @@ -336,14 +336,16 @@ public function createCreatorsNode(DOMDocument $doc, Issue $issue, Publication $
$creatorNode->appendChild($node);
}
if ($creator['affiliations']) {
foreach($creator['affiliations'] as $affiliation) {
// Currently affiliations are only there for Publication objects
foreach ($creator['affiliations'] as $affiliation) {
$node = $doc->createElementNS($deployment->getNamespace(), 'affiliation');
if ($affiliation['ror']) {
$node->setAttribute('affiliationIdentifier', $affiliation['ror']);
$ror = $affiliation->getRor();
if ($ror) {
$node->setAttribute('affiliationIdentifier', $ror);
$node->setAttribute('affiliationIdentifierScheme', 'ROR');
$node->setAttribute('schemeURI', 'https://ror.org');
}
$node->appendChild($doc->createTextNode($affiliation['name']));
$node->appendChild($doc->createTextNode($affiliation->getLocalizedName($publication->getData('locale'))));
$creatorNode->appendChild($node);
}
}
Expand Down
16 changes: 8 additions & 8 deletions plugins/importexport/doaj/filter/DOAJXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,12 @@ public function createAuthorNode($doc, $publication, $author, $affilList)
$authorNode->appendChild($node = $doc->createElement('name', htmlspecialchars($author->getFullName(false, false, $publication->getData('locale')), ENT_COMPAT, 'UTF-8')));
$affiliations = $author->getLocalizedAffiliationNames($publication->getData('locale'));
foreach ($affiliations as $affiliation) {
if (in_array($affiliation, $affilList) && !empty($affilList[0])) {
$authorNode->appendChild(
$node = $doc->createElement('affiliationId',
htmlspecialchars(current(array_keys($affilList, $affiliation)), ENT_COMPAT, 'UTF-8')
)
);
}
$authorNode->appendChild(
$doc->createElement(
'affiliationId',
htmlspecialchars(current(array_keys($affilList, $affiliation)), ENT_COMPAT, 'UTF-8')
)
);
}
if ($orcid = $author->getData('orcid')) {
$authorNode->appendChild($doc->createElement('orcid_id'))->appendChild($doc->createTextNode($orcid));
Expand All @@ -279,7 +278,8 @@ public function createAffiliationsList($authors, $publication)
$affiliations = $author->getLocalizedAffiliationNames($publication->getData('locale'));
foreach ($affiliations as $affiliation) {
if (!in_array($affiliation, $affilList)) {
$affilList[] = $affiliation;;
$affilList[] = $affiliation;
;
}
}
}
Expand Down
17 changes: 7 additions & 10 deletions plugins/importexport/pubmed/filter/ArticlePubMedXmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,17 +215,14 @@ public function generateAuthorNode($doc, $journal, $issue, $submission, $author)
$authorElement->appendChild($doc->createElement('FirstName'))->appendChild($doc->createTextNode(ucfirst($author->getLocalizedGivenName())));
$authorElement->appendChild($doc->createElement('LastName'))->appendChild($doc->createTextNode(ucfirst($author->getLocalizedFamilyName())));
}
foreach($author->getLocalizedAffiliations() as $affiliation) {
if(!empty($affiliation['name']) || !empty($affiliation['ror'])) {
$affiliationInfoElement = $doc->createElement('AffiliationInfo');
if(!empty($affiliation['name'])) {
$affiliationInfoElement->appendChild($doc->createElement('Affiliation'))->appendChild($doc->createTextNode($affiliation['name']));
}
if(!empty($affiliation['ror'])) {
$affiliationInfoElement->appendChild($doc->createElement('Identifier'))->appendChild($doc->createTextNode($affiliation['ror']));
}
$authorElement->appendChild($affiliationInfoElement);
foreach ($author->getAffiliations() as $affiliation) {
$affiliationInfoElement = $doc->createElement('AffiliationInfo');
$affiliationInfoElement->appendChild($doc->createElement('Affiliation'))->appendChild($doc->createTextNode($affiliation->getLocalizedName()));
if ($affiliation->getRor()) {
$affiliationInfoElement->appendChild($identifierNode = $doc->createElement('Identifier'))->appendChild($doc->createTextNode($affiliation->getRor()));
$identifierNode->setAttribute('Source', 'ROR');
}
$authorElement->appendChild($affiliationInfoElement);
}
// We're storing the ORCID with a URL (http://orcid.org/{$ID}), but the XML expects just the ID
$orcidId = explode('/', trim($author->getData('orcid') ?? '', '/'));
Expand Down
6 changes: 3 additions & 3 deletions plugins/oaiMetadataFormats/marc/templates/record.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
{foreach from=$authors item=author}
<varfield id="{if $authors|@count==1}100{else}720{/if}" i1="1" i2=" ">
<subfield label="a">{$author->getFullName(false, true, $journal->getPrimaryLocale())|escape}</subfield>
{foreach from=$author->getLocalizedAffiliations() item=$affiliation}
{if $affiliation['ror']}<subfield code="u">{$affiliation['ror']|escape}</subfield>
{elseif $affiliation['name']}<subfield code="u">{$affiliation['name']|escape}</subfield>{/if}
{foreach from=$author->getAffiliations() item=$affiliation}
{if $affiliation->getRor()}<subfield code="u">{$affiliation->getRor()|escape}</subfield>
{else}<subfield code="u">{$affiliation->getLocalizedName($publication->getData('locale'))|escape}</subfield>{/if}
{/foreach}
{if $author->getUrl()}<subfield label="0">{$author->getUrl()|escape}</subfield>{/if}
{if $author->getData('orcid')}<subfield label="0">{$author->getData('orcid')|escape}</subfield>{/if}
Expand Down
6 changes: 3 additions & 3 deletions plugins/oaiMetadataFormats/marcxml/templates/record.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
{foreach from=$authors item=author}
<datafield tag="{if $authors|@count==1}100{else}720{/if}" ind1="1" ind2=" ">
<subfield code="a">{$author->getFullName(false, true, $journal->getPrimaryLocale())|escape}</subfield>
{foreach from=$author->getLocalizedAffiliations() item=$affiliation}
{if $affiliation['ror']}<subfield code="u">{$affiliation['ror']|escape}</subfield>
{elseif $affiliation['name']}<subfield code="u">{$affiliation['name']|escape}</subfield>{/if}
{foreach from=$author->getAffiliations() item=$affiliation}
{if $affiliation->getRor()}<subfield code="u">{$affiliation->getRor()|escape}</subfield>
{else}<subfield code="u">{$affiliation->getLocalizedName($publication->getData('locale'))|escape}</subfield>{/if}
{/foreach}
{if $author->getUrl()}<subfield code="0">{$author->getUrl()|escape}</subfield>{/if}
{if $author->getData('orcid')}<subfield code="0">{$author->getData('orcid')|escape}</subfield>{/if}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function toXml($record, $format = null)

// Format creators
$creators = [];
foreach ($publication->getAuthors() as $author) {
foreach ($publication->getData('authors') as $author) {
$creators[] = $author->getFullName(false, true);
}

Expand Down
8 changes: 3 additions & 5 deletions templates/frontend/objects/article_details.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,12 @@
<span class="name">
{$author->getFullName()|escape}
</span>
{if $author->getLocalizedAffiliations()}
{foreach $author->getLocalizedAffiliations() as $affiliation}
{foreach $author->getAffiliations() as $affiliation}
<span class="affiliation">
{$affiliation['name']|escape}
{if $affiliation['ror']}<a href="{$affiliation['ror']|escape}">{$rorIdIcon}</a>{/if}
{$affiliation->getLocalizedName()|escape}
{if $affiliation->getRor()}<a href="{$affiliation->getRor()|escape}">{$rorIdIcon}</a>{/if}
</span><br/>
{/foreach}
{/if}
{assign var=authorUserGroup value=$userGroupsById[$author->getData('userGroupId')]}
{if $authorUserGroup->showTitle}
<span class="userGroup">
Expand Down

0 comments on commit 8d3a72b

Please sign in to comment.