Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#7135 Multiple author affiliations (ROR) #1819

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dbscripts/xml/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
<migration class="APP\migration\install\MetricsMigration" />

<migration class="APP\migration\install\SeriesCategoriesMigration" />
<migration class="PKP\migration\install\AffiliationsMigration" />
<migration class="PKP\migration\install\RorsMigration" />

<code function="createData" />
<code function="createConfig" />
Expand Down
2 changes: 2 additions & 0 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@
<migration class="PKP\migration\upgrade\v3_5_0\FilterClassNames"/>
<migration class="APP\migration\upgrade\v3_5_0\I10620_EditorialBoardMemberRole"/>
<migration class="APP\migration\upgrade\v3_5_0\I9707_WeblateUILocales"/>
<migration class="PKP\migration\upgrade\v3_5_0\I7135_CreateAuthorAffiliationsTables"/>
<migration class="PKP\migration\upgrade\v3_5_0\I7135_CreateNewRorRegistryCacheTables"/>
<note file="docs/release-notes/README-3.5.0" />
</upgrade>

Expand Down
5 changes: 5 additions & 0 deletions pages/catalog/CatalogBookHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
use APP\submission\Submission;
use APP\template\TemplateManager;
use PKP\citation\CitationDAO;
use PKP\core\Core;
use PKP\core\PKPApplication;
use PKP\core\PKPRequest;
use PKP\db\DAORegistry;
Expand Down Expand Up @@ -298,6 +299,10 @@ public function book($args, $request)
'orcidUnauthenticatedIcon' => OrcidManager::getUnauthenticatedIcon(),
]);

$rorIconPath = Core::getBaseDir() . '/' . PKP_LIB_PATH . '/templates/images/ror.svg';
$rorIdIcon = file_exists($rorIconPath) ? file_get_contents($rorIconPath) : '';
$templateMgr->assign('rorIdIcon', $rorIdIcon);

// Ask robots not to index outdated versions and point to the canonical url for the latest version
if ($this->publication->getId() != $submission->getData('currentPublicationId')) {
$templateMgr->addHeader('noindex', '<meta name="robots" content="noindex">');
Expand Down
8 changes: 5 additions & 3 deletions plugins/generic/googleScholar/GoogleScholarPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use APP\template\TemplateManager;
use PKP\citation\CitationDAO;
use PKP\db\DAORegistry;
use PKP\i18n\LocaleConversion;
use PKP\plugins\GenericPlugin;
use PKP\plugins\Hook;

Expand Down Expand Up @@ -107,8 +106,11 @@ public function monographView($hookName, $args)
$authors = $isChapterRequest ? $templateMgr->getTemplateVars('chapterAuthors') : $publication->getData('authors');
foreach ($authors as $i => $author) {
$templateMgr->addHeader('googleScholarAuthor' . $i++, '<meta name="citation_author" content="' . htmlspecialchars($author->getFullName(false, false, $publicationLocale)) . '"/>');
if ($affiliation = htmlspecialchars($author->getLocalizedData('affiliation', $publicationLocale))) {
$templateMgr->addHeader('googleScholarAuthor' . $i++ . 'Affiliation', '<meta name="citation_author_institution" content="' . $affiliation . '"/>');
foreach ($author->getAffiliations() as $affiliation) {
$templateMgr->addHeader(
'googleScholarAuthor' . $i++ . 'Affiliation' . $affiliation->getId(),
'<meta name="citation_author_institution" content="' . htmlspecialchars($affiliation->getLocalizedName($publicationLocale)) . '"/>'
);
}
}

Expand Down
11 changes: 11 additions & 0 deletions plugins/importexport/native/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Native Import/Export Plugin

## Documentation

See https://docs.pkp.sfu.ca/admin-guide/en/data-import-and-export#native-xml-plugin
for documentation.

## Sample XML

Sample XML can be found in https://github.com/pkp/datasets/blob/main/omp/[branch]/mysql/native-export-sample.xml,
where [branch] indicates the GitHub repository branch name of your OMP version, e.g.: stable-3_3_0 for OMP 3.3.0-x, stable-3_4_0 for OMP 3.4.0-8.
221 changes: 0 additions & 221 deletions plugins/importexport/native/sample.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

namespace APP\plugins\importexport\onix30\filter;

use APP\author\Author;
use APP\codelist\ONIXCodelistItemDAO;
use APP\core\Application;
use APP\facades\Repo;
Expand Down Expand Up @@ -371,6 +372,7 @@ public function createProductNode(DOMDocument $doc, Submission $submission, Publ
$authors = $publication->getData('authors'); // sorts by sequence.
$sequence = 1;
foreach ($authors as $author) {
/** @var Author $author */
$contributorNode = $doc->createElementNS($deployment->getNamespace(), 'Contributor');
$contributorNode->appendChild($this->buildTextNode($doc, 'SequenceNumber', $sequence));

Expand All @@ -397,6 +399,13 @@ public function createProductNode(DOMDocument $doc, Submission $submission, Publ
$contributorNode->appendChild($this->buildTextNode($doc, 'KeyNames', $author->getFullName(false, false, $pubLocale)));
}

foreach ($author->getAffiliations() as $affiliation) {
$affiliationName = $affiliation->getLocalizedName($pubLocale);
$professionalAffiliationNode = $doc->createElementNS($deployment->getNamespace(), 'ProfessionalAffiliation');
$professionalAffiliationNode->appendChild($this->buildTextNode($doc, 'Affiliation', $affiliationName));
$contributorNode->appendChild($professionalAffiliationNode);
}

if ($author->getBiography($pubLocale) != '') {
$contributorNode->appendChild($this->buildTextNode($doc, 'BiographicalNote', $author->getBiography($pubLocale)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,7 @@ public function extractMetadataFromDataObject(&$publicationFormat)

// Creator
foreach ($publication->getData('authors') as $author) {
$authorNames = $author->getFullNames(false, true);
foreach ($authorNames as $locale => &$authorName) {
$affiliation = $author->getAffiliation($locale);
if (!empty($affiliation)) {
$authorName .= '; ' . $affiliation;
}
}
$this->_addLocalizedElements($dc11Description, 'dc:creator', $authorNames);
unset($authorName);
$this->_addLocalizedElements($dc11Description, 'dc:creator', $author->getFullNames(false, true));
}

// Subject
Expand Down
2 changes: 1 addition & 1 deletion plugins/reports/monographReport/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ private function getFieldMapper(): array
$authorHeader(__('user.familyName'), $i) => fn () => $this->getAuthor($i)?->getLocalizedFamilyName(),
$authorHeader(__('user.orcid'), $i) => fn () => $this->getAuthor($i)?->getData('orcid'),
$authorHeader(__('common.country'), $i) => fn () => $this->getAuthor($i)?->getData('country'),
$authorHeader(__('user.affiliation'), $i) => fn () => $this->getAuthor($i)?->getLocalizedData('affiliation'),
$authorHeader(__('user.affiliation'), $i) => fn () => $this->getAuthor($i)?->getLocalizedAffiliationNamesAsString(),
$authorHeader(__('user.email'), $i) => fn () => $this->getAuthor($i)?->getData('email'),
$authorHeader(__('user.url'), $i) => fn () => $this->getAuthor($i)?->getData('url'),
$authorHeader(__('user.biography'), $i) => fn () => $this->toPlainText($this->getAuthor($i)?->getLocalizedData('biography'))
Expand Down
10 changes: 7 additions & 3 deletions templates/frontend/components/authors.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@
{$author->getFullName()|escape}
{/if}
</div>
{if $author->getLocalizedAffiliation()}
{if count($author->getAffiliations()) > 0}
<div class="value">
{$author->getLocalizedAffiliation()|escape}
{foreach name="affiliations" from=$author->getAffiliations() item="affiliation"}
{$affiliation->getLocalizedName()|escape}
{if $affiliation->getRor()}<a href="{$affiliation->getRor()|escape}">{$rorIdIcon}</a>{/if}
{if !$smarty.foreach.affiliations.last}{translate key="common.commaListSeparator"}{/if}
{/foreach}
</div>
{/if}
{if $author->getOrcid()}
Expand Down Expand Up @@ -67,7 +71,7 @@
{else}
{capture assign="authorName"}<span class="label">{$author->getFullName()|escape}</span>{/capture}
{/if}
{capture assign="authorAffiliation"}<span class="value">{$author->getLocalizedAffiliation()|escape}</span>{/capture}
{capture assign="authorAffiliations"}<span class="value">{$author->getLocalizedAffiliationNamesAsString(null, ', ')|escape}</span>{/capture}
{translate key="submission.authorWithAffiliation" name=$authorName affiliation=$authorAffiliation}
{else}
<span class="label">{$author->getFullName()|escape}</span>
Expand Down
6 changes: 3 additions & 3 deletions templates/frontend/objects/chapter.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@
{if $author->getLocalizedBiography()}
<div class="sub_item">
<div class="label">
{if $author->getLocalizedAffiliation()}
{if $author->getLocalizedAffiliationNamesAsString()}
{capture assign="authorName"}{$author->getFullName()|escape}{/capture}
{capture assign="authorAffiliation"}<span class="affiliation">{$author->getLocalizedAffiliation()|escape}</span>{/capture}
{translate key="submission.authorWithAffiliation" name=$authorName affiliation=$authorAffiliation}
{capture assign="authorAffiliations"}<span class="affiliation">{$author->getLocalizedAffiliationNamesAsString(null, ', ')|escape}</span>{/capture}
{translate key="submission.authorWithAffiliation" name=$authorName affiliation=$authorAffiliations}
{else}
{$author->getFullName()|escape}
{/if}
Expand Down
6 changes: 3 additions & 3 deletions templates/frontend/objects/monograph_full.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@
{if $author->getLocalizedBiography()}
<div class="sub_item">
<div class="label">
{if $author->getLocalizedAffiliation()}
{if $author->getLocalizedAffiliationNamesAsString()}
{capture assign="authorName"}{$author->getFullName()|escape}{/capture}
{capture assign="authorAffiliation"}<span class="affiliation">{$author->getLocalizedAffiliation()|escape}</span>{/capture}
{translate key="submission.authorWithAffiliation" name=$authorName affiliation=$authorAffiliation}
{capture assign="authorAffiliations"} {$author->getLocalizedAffiliationNamesAsString(null, ', ')|escape} {/capture}
{translate key="submission.authorWithAffiliation" name=$authorName affiliation=$authorAffiliations}
{else}
{$author->getFullName()|escape}
{/if}
Expand Down
Loading