From 7d73c077a9c6a3626ae6b905114575b42de0ec6a Mon Sep 17 00:00:00 2001 From: Jhon Date: Thu, 9 Jan 2025 15:20:28 -0400 Subject: [PATCH 1/5] Fixes displaying of DOI on preprint landing page Issue: documentacao-e-tarefas/scielo#734 Signed-off-by: Jhon --- .../frontend/objects/preprint_details.tpl | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/templates/frontend/objects/preprint_details.tpl b/templates/frontend/objects/preprint_details.tpl index 315c6cf..bcba4d6 100644 --- a/templates/frontend/objects/preprint_details.tpl +++ b/templates/frontend/objects/preprint_details.tpl @@ -146,27 +146,22 @@ {/if} - {* DOI (requires plugin) *} - {foreach from=$pubIdPlugins item=pubIdPlugin} - {if $pubIdPlugin->getPubIdType() != 'doi'} - {continue} - {/if} - {assign var=pubId value=$publication->getStoredPubId($pubIdPlugin->getPubIdType())} - {if $pubId} - {assign var="doiUrl" value=$pubIdPlugin->getResolvingURL($currentJournal->getId(), $pubId)|escape} -
-

- {capture assign=translatedDOI}{translate key="plugins.pubIds.doi.readerDisplayName"}{/capture} - {translate key="semicolon" label=$translatedDOI} -

- - - {$doiUrl} - - -
- {/if} - {/foreach} + {* DOI *} + {assign var=doiObject value=$publication->getData('doiObject')} + {if $doiObject} + {assign var="doiUrl" value=$doiObject->getData('resolvingUrl')|escape} +
+

+ {capture assign=translatedDOI}{translate key="doi.readerDisplayName"}{/capture} + {translate key="semicolon" label=$translatedDOI} +

+ + + {$doiUrl} + + +
+ {/if} {* Keywords *} {if !empty($publication->getLocalizedData('keywords'))} From 84ab71cdb43aade94d79b25484fae542e21ed0c3 Mon Sep 17 00:00:00 2001 From: Jhon Date: Thu, 9 Jan 2025 17:07:34 -0400 Subject: [PATCH 2/5] WIP: Adds translation badge on the side of authors name Issue: documentacao-e-tarefas/scielo#734 Signed-off-by: Jhon --- locale/en/locale.po | 5 ++++- locale/es/locale.po | 5 ++++- locale/pt_BR/locale.po | 5 ++++- styles/objects/article_details.less | 10 ++++++++++ templates/frontend/objects/preprint_details.tpl | 3 +++ 5 files changed, 25 insertions(+), 3 deletions(-) diff --git a/locale/en/locale.po b/locale/en/locale.po index 206f002..375ee68 100755 --- a/locale/en/locale.po +++ b/locale/en/locale.po @@ -66,4 +66,7 @@ msgid "plugins.themes.scielo.indexToArchive" msgstr "All preprints" msgid "plugins.themes.scielo.msgCountingDownloads" -msgstr " (as of yesterday)" \ No newline at end of file +msgstr " (as of yesterday)" + +msgid "plugins.themes.scielo.translation" +msgstr "Translation" diff --git a/locale/es/locale.po b/locale/es/locale.po index 1ca9dc5..4cf5283 100644 --- a/locale/es/locale.po +++ b/locale/es/locale.po @@ -76,4 +76,7 @@ msgid "plugins.themes.scielo.indexToArchive" msgstr "Todos los preprints" msgid "plugins.themes.scielo.msgCountingDownloads" -msgstr " (hasta ayer)" \ No newline at end of file +msgstr " (hasta ayer)" + +msgid "plugins.themes.scielo.translation" +msgstr "Traducción" diff --git a/locale/pt_BR/locale.po b/locale/pt_BR/locale.po index beaeaac..3bd0fde 100644 --- a/locale/pt_BR/locale.po +++ b/locale/pt_BR/locale.po @@ -71,4 +71,7 @@ msgid "plugins.themes.scielo.indexToArchive" msgstr "Todos os preprints" msgid "plugins.themes.scielo.msgCountingDownloads" -msgstr " (até ontem)" \ No newline at end of file +msgstr " (até ontem)" + +msgid "plugins.themes.scielo.translation" +msgstr "Tradução" diff --git a/styles/objects/article_details.less b/styles/objects/article_details.less index be0a80d..b54ccaf 100755 --- a/styles/objects/article_details.less +++ b/styles/objects/article_details.less @@ -93,6 +93,16 @@ .name { font-weight: bold; display: block; + + .translationBadge { + font-size: 14px; + font-weight: @normal; + color: @text-light; + padding: 0.25em 1em; + border: 1px solid #007ab2; + border-radius: 14px; + margin-left: 5px; + } } .orcid { diff --git a/templates/frontend/objects/preprint_details.tpl b/templates/frontend/objects/preprint_details.tpl index bcba4d6..6897625 100644 --- a/templates/frontend/objects/preprint_details.tpl +++ b/templates/frontend/objects/preprint_details.tpl @@ -123,6 +123,9 @@
  • {$author->getFullName()|escape} + + {translate key="plugins.themes.scielo.translation"} + {if $author->getLocalizedData('affiliation')} From a3f188040d41394e85e8716036d607a710087c1d Mon Sep 17 00:00:00 2001 From: Jhon Date: Thu, 9 Jan 2025 18:04:02 -0400 Subject: [PATCH 3/5] Only shows translation badge to authors who have translator role Issue: documentacao-e-tarefas/scielo#734 Signed-off-by: Jhon --- ScieloThemePlugin.php | 31 +++++++++++++++++++ .../frontend/objects/preprint_details.tpl | 9 ++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ScieloThemePlugin.php b/ScieloThemePlugin.php index c8c87ad..58310ac 100755 --- a/ScieloThemePlugin.php +++ b/ScieloThemePlugin.php @@ -21,6 +21,8 @@ use PKP\plugins\ThemePlugin; use PKP\session\SessionManager; use PKP\plugins\Hook; +use APP\template\TemplateManager; +use APP\facades\Repo; class ScieloThemePlugin extends ThemePlugin { @@ -179,6 +181,7 @@ public function init() Hook::add('LoadHandler', [$this, 'replaceIndexHandler']); Hook::add('Templates::Common::Sidebar', [$this, 'setSidebarToNotShowAtHome']); + Hook::add('PreprintHandler::view', [$this, 'addDataOnSubmissionView']); } public function register($category, $path, $mainContextId = null) @@ -216,6 +219,34 @@ public function setSidebarToNotShowAtHome($hookName, $args) } } + public function addDataOnSubmissionView($hookName, $args) + { + $request = $args[0]; + $templateMgr = TemplateManager::getManager($request); + $translatorsUserGroup = $this->getTranslatorsUserGroup($request->getContext()->getId()); + + if ($translatorsUserGroup) { + $templateMgr->assign(['translatorsUserGroupId' => $translatorsUserGroup->getId()]); + } + } + + private function getTranslatorsUserGroup(int $contextId) + { + $contextUserGroups = Repo::userGroup()->getCollector() + ->filterByContextIds([$contextId]) + ->getMany(); + + foreach ($contextUserGroups as $userGroup) { + $userGroupAbbrev = strtolower($userGroup->getData('abbrev', 'en')); + + if ($userGroupAbbrev === 'tr') { + return $userGroup; + } + } + + return null; + } + public function getContextSpecificPluginSettingsFile() { return $this->getPluginPath() . '/settings.xml'; diff --git a/templates/frontend/objects/preprint_details.tpl b/templates/frontend/objects/preprint_details.tpl index 6897625..251c85d 100644 --- a/templates/frontend/objects/preprint_details.tpl +++ b/templates/frontend/objects/preprint_details.tpl @@ -123,9 +123,12 @@
  • {$author->getFullName()|escape} - - {translate key="plugins.themes.scielo.translation"} - + + {if $author->getData('userGroupId') == $translatorsUserGroupId} + + {translate key="plugins.themes.scielo.translation"} + + {/if} {if $author->getLocalizedData('affiliation')} From 333113f1b41e1d32a79e1f9f2bcdda04b6064f49 Mon Sep 17 00:00:00 2001 From: Jhon Date: Fri, 10 Jan 2025 11:39:40 -0400 Subject: [PATCH 4/5] Changes styling of translation badge Issue: documentacao-e-tarefas/scielo#734 Signed-off-by: Jhon --- styles/objects/article_details.less | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/styles/objects/article_details.less b/styles/objects/article_details.less index b54ccaf..867a9c8 100755 --- a/styles/objects/article_details.less +++ b/styles/objects/article_details.less @@ -95,12 +95,12 @@ display: block; .translationBadge { - font-size: 14px; + font-size: 12px; font-weight: @normal; - color: @text-light; - padding: 0.25em 1em; - border: 1px solid #007ab2; - border-radius: 14px; + color: #fff; + background-color: #007ab2; + padding: 0.2em 0.8em; + border-radius: 12px; margin-left: 5px; } } From d052e8a1e05b4393b81e8f16dd743a907ec316ea Mon Sep 17 00:00:00 2001 From: Jhon Date: Fri, 10 Jan 2025 11:44:44 -0400 Subject: [PATCH 5/5] Updates version.xml Issue: documentacao-e-tarefas/scielo#734 Signed-off-by: Jhon --- version.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.xml b/version.xml index ca13802..087f846 100755 --- a/version.xml +++ b/version.xml @@ -12,8 +12,8 @@ scieloTheme plugins.themes - 2.0.0 - 2024-02-08 + 2.1.0.0 + 2025-01-10 1 ScieloThemePlugin