Skip to content

Commit

Permalink
pkp/pkp-lib#7135 Multiple author affiliations (ROR)
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed Feb 6, 2025
1 parent 8e5353d commit 99b51ba
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 30 deletions.
10 changes: 7 additions & 3 deletions cypress/tests/data/60-content/CmontgomerieSubmission.cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* @file cypress/tests/data/60-content/CmontgomerieSubmission.cy.js
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
*/
Expand All @@ -29,7 +29,11 @@ describe('Data suite: Cmontgomerie', function() {
givenName: {en: 'Mark'},
familyName: {en: 'Irvine'},
country: 'CA',
affiliation: {en: 'University of Victoria'},
affiliations: [
{
name: {en: 'University of Victoria'}
}
],
email: 'mirvine@mailinator.com',
userGroupId: Cypress.env('authorUserGroupId')
}
Expand Down
10 changes: 7 additions & 3 deletions cypress/tests/data/60-content/EostromSubmission.cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* @file cypress/tests/data/60-content/EostromSubmission.cy.js
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
*/
Expand All @@ -28,7 +28,11 @@ describe('Data suite: Eostrom', function() {
givenName: {en: 'Frank'},
familyName: {en: 'van Laerhoven'},
country: 'US',
affiliation: {en: 'Indiana University'},
affiliations: [
{
name: {en: 'Indiana University'}
}
],
email: 'fvanlaerhoven@mailinator.com',
userGroupId: Cypress.env('authorUserGroupId')
}
Expand Down
10 changes: 7 additions & 3 deletions cypress/tests/data/60-content/KalkhafajiSubmission.cy.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* @file cypress/tests/data/60-content/KalkhafajiSubmission.cy.js
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
*/
Expand All @@ -28,7 +28,11 @@ describe('Data suite: Kalkhafaji', function() {
givenName: {en: 'Margaret'},
familyName: {en: 'Morse'},
country: 'US',
affiliation: {en: 'Stanford University'},
affiliations: [
{
name: {en: 'Stanford University'}
}
],
email: 'mmorse@mailinator.com',
userGroupId: Cypress.env('authorUserGroupId')
}
Expand Down
7 changes: 5 additions & 2 deletions dbscripts/xml/install.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!--
* dbscripts/xml/install.xml
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2003-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* Installation descriptor file.
Expand Down Expand Up @@ -47,10 +47,13 @@
<migration class="PKP\migration\install\HighlightsMigration" />
<migration class="PKP\migration\install\InstitutionsMigration" />
<migration class="APP\migration\install\MetricsMigration" />
<migration class="PKP\migration\install\AffiliationsMigration" />
<migration class="PKP\migration\install\RorsMigration" />

<!-- Other install tasks -->
<code function="createData"/>
<code function="createConfig"/>
<code function="addPluginVersions"/>
<code function="installDefaultNavigationMenus"/>
<code function="updateRorRegistryDataset"/>
</install>
6 changes: 4 additions & 2 deletions dbscripts/xml/upgrade.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!--
* dbscripts/xml/upgrade.xml
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2003-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* Upgrade descriptor file.
Expand Down Expand Up @@ -141,6 +141,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
9 changes: 7 additions & 2 deletions pages/preprint/PreprintHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/**
* @file pages/preprint/PreprintHandler.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2003-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class PreprintHandler
Expand All @@ -27,6 +27,7 @@
use Firebase\JWT\JWT;
use PKP\citation\CitationDAO;
use PKP\config\Config;
use PKP\core\Core;
use PKP\core\PKPApplication;
use PKP\db\DAORegistry;
use PKP\orcid\OrcidManager;
Expand Down Expand Up @@ -185,6 +186,9 @@ public function view($args, $request)
return empty($a) || strtotime((string) $b->getData('datePublished')) < strtotime((string) $a->getData('datePublished')) ? $b : $a;
}, 0);

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

$templateMgr = TemplateManager::getManager($request);
$templateMgr->assign([
'preprint' => $preprint,
Expand All @@ -196,6 +200,7 @@ public function view($args, $request)
'submissionFileId' => $this->submissionFileId,
'orcidIcon' => OrcidManager::getIcon(),
'orcidUnauthenticatedIcon' => OrcidManager::getUnauthenticatedIcon(),
'rorIdIcon' => $rorIdIcon,
]);
$this->setupTemplate($request);

Expand Down
5 changes: 5 additions & 0 deletions plugins/importexport/native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@

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/ops/[branch]/mysql/native-export-sample.xml,
where [branch] indicates the GitHub repository branch name of your OPS version, e.g.: stable-3_3_0 for OJS 3.3.0-x, stable-3_4_0 for OJS 3.4.0-x.
13 changes: 10 additions & 3 deletions plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
/**
* @file plugins/oaiMetadataFormats/dc/tests/OAIMetadataFormat_DCTest.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2000-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @class OAIMetadataFormat_DCTest
Expand Down Expand Up @@ -86,7 +86,14 @@ public function testToXml()
$author = new Author();
$author->setGivenName('author-firstname', 'en');
$author->setFamilyName('author-lastname', 'en');
$author->setAffiliation('author-affiliation', 'en');
$author->setAffiliations([
Repo::affiliation()->newDataObject([
'id' => 1,
'authorId' => 1,
'ror' => 'https://ror.org/05ek4tb53',
'name' => ['en' => 'author-affiliation']
])
]);
$author->setEmail('someone@example.com');

/** @var Publication|MockObject */
Expand Down
6 changes: 5 additions & 1 deletion plugins/themes/default/styles/objects/preprint_details.less
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
font-size: @font-sml;
color: @text-light;
}

.affiliation a {
display: inline-block;
}
}

.author_bios {
Expand All @@ -128,7 +132,7 @@
display: flex;
flex-flow: row nowrap;
justify-content: start;

li {
margin-inline-end: 1rem;
}
Expand Down
28 changes: 17 additions & 11 deletions templates/frontend/objects/preprint_details.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{**
* templates/frontend/objects/preprint_details.tpl
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2003-2021 John Willinsky
* Copyright (c) 2014-2025 Simon Fraser University
* Copyright (c) 2003-2025 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @brief View of an Preprint which displays all details about the preprint.
Expand Down Expand Up @@ -130,9 +130,13 @@
<span class="name">
{$author->getFullName()|escape}
</span>
{if $author->getLocalizedData('affiliation')}
{if count($author->getAffiliations()) > 0}
<span class="affiliation">
{$author->getLocalizedData('affiliation')|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}
</span>
{/if}
{if $author->getData('orcid')}
Expand Down Expand Up @@ -227,25 +231,27 @@
{translate key="submission.authorBiography"}
{/if}
</h2>
<ul class="authors">
{foreach from=$publication->getData('authors') item=author}
{if $author->getLocalizedData('biography')}
<section class="sub_item">
<h3 class="label">
{if $author->getLocalizedData('affiliation')}
<li class="sub_item">
<div class="label">
{if $author->getLocalizedAffiliationNamesAsString()}
{capture assign="authorName"}{$author->getFullName()|escape}{/capture}
{capture assign="authorAffiliation"}<span class="affiliation">{$author->getLocalizedData('affiliation')|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}
</h3>
</div>
<div class="value">
{$author->getLocalizedData('biography')|strip_unsafe_html}
</div>
</section>
{/if}
{/foreach}
</section>
</ul>
</section>
{/if}

{* References *}
Expand Down

0 comments on commit 99b51ba

Please sign in to comment.