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

Change Submission Language #1451

Open
wants to merge 4 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion classes/publication/Repository.php
Expand Up @@ -78,6 +78,7 @@ public function add(Publication $publication): int
}

$supportedLocales = $submissionContext->getSupportedSubmissionLocales();
in_array($primaryLocale = $submission->getData('locale'), $supportedLocales) || array_push($supportedLocales, $primaryLocale);
foreach ($supportedLocales as $localeKey) {
if (!array_key_exists($localeKey, $publication->getData('coverImage'))) {
continue;
Expand Down Expand Up @@ -272,7 +273,7 @@ public function edit(Publication $publication, array $params): Publication
$publicFileManager->removeContextFile($submission->getData('contextId'), $this->getThumbnailFileName($oldCoverImage[$localeKey]['uploadName']));
}

// Otherwise generate a new thumbnail if a cover image exists
// Otherwise generate a new thumbnail if a cover image exists
} elseif (!empty($newCoverImage) && array_key_exists('temporaryFileId', $newCoverImage)) {
$coverImageFilePath = $publicFileManager->getContextFilesPath($submission->getData('contextId')) . '/' . $coverImages[$localeKey]['uploadName'];
$this->makeThumbnail(
Expand Down
5 changes: 4 additions & 1 deletion classes/publication/maps/Schema.php
Expand Up @@ -96,7 +96,10 @@ function ($publicationFormat) use ($submissionFiles, $genres) {
);
}

$output = $this->schemaService->addMissingMultilingualValues(PKPSchemaService::SCHEMA_PUBLICATION, $output, $this->context->getSupportedSubmissionLocales());
$locales = $this->context->getSupportedSubmissionLocales();
in_array($primaryLocale = $this->submission->getData('locale'), $locales) || array_push($locales, $primaryLocale);

$output = $this->schemaService->addMissingMultilingualValues(PKPSchemaService::SCHEMA_PUBLICATION, $output, $locales);

ksort($output);

Expand Down
5 changes: 4 additions & 1 deletion classes/submission/maps/Schema.php
Expand Up @@ -59,7 +59,10 @@ protected function mapByProperties(array $props, Submission $submission): array
$output['newRelease'] = $newReleaseDao->getNewReleaseAll($submission->getId());
}

$output = $this->schemaService->addMissingMultilingualValues($this->schemaService::SCHEMA_SUBMISSION, $output, $this->context->getSupportedSubmissionLocales());
$locales = $this->context->getSupportedSubmissionLocales();
in_array($primaryLocale = $submission->getData('locale'), $locales) || array_push($locales, $primaryLocale);

$output = $this->schemaService->addMissingMultilingualValues($this->schemaService::SCHEMA_SUBMISSION, $output, $locales);

ksort($output);

Expand Down
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 60 files
+5 −0 api/v1/submissions/PKPSubmissionHandler.php
+3 −1 api/v1/vocabs/PKPVocabHandler.php
+2 −1 classes/author/Repository.php
+136 −0 classes/components/forms/submission/ChangeSubmissionLanguageMetadataForm.php
+1 −1 classes/core/PKPContainer.php
+28 −2 classes/decision/types/traits/IsRecommendation.php
+1 −1 classes/log/event/EventLogEntry.php
+2 −2 classes/proxy/ProxyParser.php
+4 −1 classes/publication/Repository.php
+5 −1 classes/query/QueryDAO.php
+3 −2 classes/submission/Repository.php
+17 −1 controllers/grid/queries/QueriesGridHandler.php
+16 −0 controllers/grid/queries/QueryNotesGridHandler.php
+28 −8 jobs/BaseJob.php
+5 −0 jobs/bulk/BulkEmailSender.php
+1 −3 jobs/email/EditorialReminder.php
+7 −2 jobs/submissions/UpdateSubmissionSearchJob.php
+18 −3 jobs/testJobs/TestJobFailure.php
+11 −2 jobs/testJobs/TestJobSuccess.php
+4 −1 locale/bg/manager.po
+1 −1 locale/bg/user.po
+2 −2 locale/cs/user.po
+4 −1 locale/da/manager.po
+1 −1 locale/da/user.po
+3 −0 locale/en/api.po
+15 −0 locale/en/submission.po
+206 −63 locale/fr_CA/admin.po
+32 −12 locale/fr_CA/api.po
+7 −6 locale/fr_CA/common.po
+29 −4 locale/fr_CA/default.po
+12 −9 locale/fr_CA/grid.po
+132 −39 locale/fr_CA/manager.po
+201 −54 locale/fr_CA/submission.po
+6 −3 locale/fr_CA/user.po
+265 −94 locale/fr_FR/admin.po
+57 −22 locale/fr_FR/api.po
+33 −27 locale/fr_FR/common.po
+24 −2 locale/fr_FR/default.po
+49 −17 locale/fr_FR/editor.po
+19 −14 locale/fr_FR/grid.po
+538 −253 locale/fr_FR/manager.po
+307 −124 locale/fr_FR/submission.po
+11 −9 locale/fr_FR/user.po
+2 −2 locale/hy/user.po
+4 −1 locale/mk/manager.po
+3 −1 locale/mk/submission.po
+6 −2 locale/mk/user.po
+98 −25 locale/ms/admin.po
+4 −1 locale/ru/manager.po
+1 −1 locale/ru/user.po
+1 −1 locale/sl/user.po
+17 −9 locale/tr/admin.po
+2 −2 locale/tr/api.po
+4 −4 locale/tr/editor.po
+1 −1 locale/tr/grid.po
+14 −10 locale/tr/manager.po
+1 −1 locale/uk/user.po
+41 −6 pages/authorDashboard/PKPAuthorDashboardHandler.php
+59 −7 pages/workflow/PKPWorkflowHandler.php
+7 −3 tools/jobs.php
7 changes: 4 additions & 3 deletions pages/workflow/WorkflowHandler.php
Expand Up @@ -115,7 +115,8 @@ public function setupIndex($request)
$submissionContext = Services::get('context')->get($submission->getContextId());
}

$locales = $submissionContext->getSupportedFormLocaleNames();
$locales = $submissionContext->getSupportedFormLocaleNames() + [$submission->getData('locale') => (new \PKP\i18n\LocaleMetadata($submission->getData('locale')))->getDisplayName(null, false)];
ksort($locales);
$locales = array_map(fn (string $locale, string $name) => ['key' => $locale, 'label' => $name], array_keys($locales), $locales);
$latestPublication = $submission->getLatestPublication();

Expand Down Expand Up @@ -156,9 +157,9 @@ public function setupIndex($request)

$components = $templateMgr->getState('components');
$components[FORM_AUDIENCE] = $audienceForm->getConfig();
$components[FORM_CATALOG_ENTRY] = $catalogEntryForm->getConfig();
$components[FORM_CATALOG_ENTRY] = $this->getLocalizedForm($catalogEntryForm, $submission, $submissionContext);
$components[FORM_PUBLICATION_DATES] = $publicationDatesForm->getConfig();
$components[$publicationLicenseForm->id] = $publicationLicenseForm->getConfig();
$components[$publicationLicenseForm->id] = $this->getLocalizedForm($publicationLicenseForm, $submission, $submissionContext);

$publicationFormIds = $templateMgr->getState('publicationFormIds');
$publicationFormIds[] = FORM_CATALOG_ENTRY;
Expand Down
5 changes: 5 additions & 0 deletions templates/authorDashboard/authorDashboard.tpl
Expand Up @@ -22,6 +22,11 @@
>
{translate key="common.upload.addFile"}
</pkp-button>
<pkp-button
:disabled="true"
>
{{ changeLangButtonLabel }}
</pkp-button>
<pkp-button
@click="openLibrary"
>
Expand Down
25 changes: 25 additions & 0 deletions templates/workflow/workflow.tpl
Expand Up @@ -81,6 +81,25 @@
</template>
</ul>
</dropdown>
<pkp-button
:disabled="!canChangeLang || publicationList.length > 1 || submission.status === getConstant('STATUS_PUBLISHED')"
@click="$modal.show('changeLangModal')"
>
{{ changeLangButtonLabel }}
</pkp-button>
{* Modal to change submission language and metadata *}
<modal
:close-label="__('common.close')"
name="changeLangModal"
title="{translate key="submission.list.changeLangTitle"}"
>
<div id="changeSubmissionLanguage">
<p>{translate key="submission.list.changeLangDescription"}</p>
<div class="pkpPublication" aria-live="polite">
<pkp-form ref="changeLangSubmissionForm" v-bind="components.{$smarty.const.FORM_CHANGE_SUBMISSION_LANGUAGE_METADATA}" @set="updateSubmissionLangMetadataFormData" @closed="setFocusToRef('changeLangButton')" @success="changeSubmissionLanguage"></pkp-form>
</div>
</div>
</modal>
{if $canAccessEditorialHistory}
<pkp-button
ref="activityButton"
Expand Down Expand Up @@ -221,6 +240,12 @@
>
{translate key="publication.editDisabled"}
</div>
<div
v-if="workingPublication.status !== getConstant('STATUS_PUBLISHED') && !submissionSupportedLocales.includes(submission.locale)"
class="pkpSubmission__localeNotSupported"
>
{translate key="submission.localeNotSupported" subLocale=$changeLangButtonLabel}
</div>
<tabs class="pkpPublication__tabs" :is-side-tabs="true" :track-history="true" :label="publicationTabsLabel">
<tab id="titleAbstract" label="{translate key="publication.titleAbstract"}">
<pkp-form v-bind="components.{$smarty.const.FORM_TITLE_ABSTRACT}" @set="set" />
Expand Down