diff --git a/classes/author/form/submit/AuthorSubmitStep1Form.inc.php b/classes/author/form/submit/AuthorSubmitStep1Form.inc.php index d2cf515..420e759 100644 --- a/classes/author/form/submit/AuthorSubmitStep1Form.inc.php +++ b/classes/author/form/submit/AuthorSubmitStep1Form.inc.php @@ -30,6 +30,7 @@ class AuthorSubmitStep1Form extends AuthorSubmitForm { // Validation checks for this form $this->addCheck(new FormValidator($this, 'sectionId', 'required', 'author.submit.form.sectionRequired')); $this->addCheck(new FormValidatorCustom($this, 'sectionId', 'required', 'author.submit.form.sectionRequired', array(DAORegistry::getDAO('SectionDAO'), 'sectionExists'), array($journal->getId()))); + $this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'author.submit.form.localeRequired', $journal->getSetting('supportedSubmissionLocales'))); } /** @@ -44,11 +45,13 @@ class AuthorSubmitStep1Form extends AuthorSubmitForm { // Get sections for this journal $sectionDao =& DAORegistry::getDAO('SectionDAO'); - // If this user is a section editor or an editor, they are allowed - // to submit to sections flagged as "editor-only" for submissions. - // Otherwise, display only sections they are allowed to submit to. + // If this user is a section editor or an editor, they are + // allowed to submit to sections flagged as "editor-only" for + // submissions. Otherwise, display only sections they are + // allowed to submit to. $roleDao =& DAORegistry::getDAO('RoleDAO'); $isEditor = $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_SECTION_EDITOR); + $templateMgr->assign('sectionOptions', array('0' => Locale::translate('author.submit.selectSection')) + $sectionDao->getSectionTitles($journal->getId(), !$isEditor)); // Set up required Payment Related Information import('classes.payment.ojs.OJSPaymentManager'); @@ -58,16 +61,26 @@ class AuthorSubmitStep1Form extends AuthorSubmitForm { $completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO'); $articleId = $this->articleId; - if ( $paymentManager->submissionEnabled() ) { - $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment ( $journal->getId(), $articleId )); + if ($paymentManager->submissionEnabled()) { + $templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment ($journal->getId(), $articleId)); } - if ( $paymentManager->fastTrackEnabled() ) { - $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment ( $journal->getId(), $articleId )); + if ($paymentManager->fastTrackEnabled()) { + $templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment ($journal->getId(), $articleId)); } } - $templateMgr->assign('sectionOptions', array('0' => Locale::translate('author.submit.selectSection')) + $sectionDao->getSectionTitles($journal->getId(), !$isEditor)); + // Provide available submission languages. (Convert the array + // of locale symbolic names xx_XX into an associative array + // of symbolic names => readable names.) + $templateMgr->assign( + 'supportedSubmissionLocaleNames', + array_flip(array_intersect( + array_flip(Locale::getAllLocales()), + $journal->getSetting('supportedSubmissionLocales') + )) + ); + parent::display(); } @@ -78,8 +91,28 @@ class AuthorSubmitStep1Form extends AuthorSubmitForm { if (isset($this->article)) { $this->_data = array( 'sectionId' => $this->article->getSectionId(), + 'locale' => $this->article->getLocale(), 'commentsToEditor' => $this->article->getCommentsToEditor() ); + } else { + $journal =& Request::getJournal(); + $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); + // Try these locales in order until we find one that's + // supported to use as a default. + $tryLocales = array( + $this->getFormLocale(), // Current form locale + Locale::getLocale(), // Current UI locale + $journal->getPrimaryLocale(), // Journal locale + $supportedSubmissionLocales[array_shift(array_keys($supportedSubmissionLocales))] // Fallback: first one on the list + ); + $this->_data = array(); + foreach ($tryLocales as $locale) { + if (in_array($locale, $supportedSubmissionLocales)) { + // Found a default to use + $this->_data['locale'] = $locale; + break; + } + } } } @@ -87,7 +120,7 @@ class AuthorSubmitStep1Form extends AuthorSubmitForm { * Assign form data to user-submitted data. */ function readInputData() { - $this->readUserVars(array('submissionChecklist', 'copyrightNoticeAgree', 'sectionId', 'commentsToEditor')); + $this->readUserVars(array('locale', 'submissionChecklist', 'copyrightNoticeAgree', 'sectionId', 'commentsToEditor')); } /** @@ -113,7 +146,7 @@ class AuthorSubmitStep1Form extends AuthorSubmitForm { $user =& Request::getUser(); $this->article = new Article(); - $this->article->setLocale(Locale::getLocale()); // FIXME in bug #5543 + $this->article->setLocale($this->getData('locale')); $this->article->setUserId($user->getId()); $this->article->setJournalId($journal->getId()); $this->article->setSectionId($this->getData('sectionId')); diff --git a/classes/manager/form/LanguageSettingsForm.inc.php b/classes/manager/form/LanguageSettingsForm.inc.php index 26686e1..776b4ab 100644 --- a/classes/manager/form/LanguageSettingsForm.inc.php +++ b/classes/manager/form/LanguageSettingsForm.inc.php @@ -33,6 +33,7 @@ class LanguageSettingsForm extends Form { $this->settings = array( 'supportedLocales' => 'object', + 'supportedSubmissionLocales' => 'object', 'supportedFormLocales' => 'object' ); @@ -69,7 +70,7 @@ class LanguageSettingsForm extends Form { $this->setData('primaryLocale', $journal->getPrimaryLocale()); - foreach (array('supportedFormLocales', 'supportedLocales') as $name) { + foreach (array('supportedFormLocales', 'supportedSubmissionLocales', 'supportedLocales') as $name) { if ($this->getData($name) == null || !is_array($this->getData($name))) { $this->setData($name, array()); } @@ -84,7 +85,7 @@ class LanguageSettingsForm extends Form { $vars[] = 'primaryLocale'; $this->readUserVars($vars); - foreach (array('supportedFormLocales', 'supportedLocales') as $name) { + foreach (array('supportedFormLocales', 'supportedSubmissionLocales', 'supportedLocales') as $name) { if ($this->getData($name) == null || !is_array($this->getData($name))) { $this->setData($name, array()); } @@ -99,7 +100,7 @@ class LanguageSettingsForm extends Form { $settingsDao =& DAORegistry::getDAO('JournalSettingsDAO'); // Verify additional locales - foreach (array('supportedLocales', 'supportedFormLocales') as $name) { + foreach (array('supportedLocales', 'supportedSubmissionLocales', 'supportedFormLocales') as $name) { $$name = array(); foreach ($this->getData($name) as $locale) { if (Locale::isLocaleValid($locale) && in_array($locale, $this->availableLocales)) { @@ -112,13 +113,14 @@ class LanguageSettingsForm extends Form { // Make sure at least the primary locale is chosen as available if ($primaryLocale != null && !empty($primaryLocale)) { - foreach (array('supportedLocales', 'supportedFormLocales') as $name) { + foreach (array('supportedLocales', 'supportedSubmissionLocales', 'supportedFormLocales') as $name) { if (!in_array($primaryLocale, $$name)) { array_push($$name, $primaryLocale); } } } $this->setData('supportedLocales', $supportedLocales); + $this->setData('supportedSubmissionLocales', $supportedSubmissionLocales); $this->setData('supportedFormLocales', $supportedFormLocales); foreach ($this->_data as $name => $value) { diff --git a/dbscripts/xml/upgrade/2.3.2_update.xml b/dbscripts/xml/upgrade/2.3.2_update.xml index a1f9765..f3589d8 100644 --- a/dbscripts/xml/upgrade/2.3.2_update.xml +++ b/dbscripts/xml/upgrade/2.3.2_update.xml @@ -40,5 +40,9 @@ UPDATE articles SET locale = j.primary_locale FROM journals j WHERE articles.journal_id = j.journal_id + + + INSERT INTO journal_settings (journal_id, locale, setting_name, setting_value, setting_type) SELECT journal_id, locale, 'supportedSubmissionLocales', setting_value, setting_type FROM journal_settings WHERE setting_name = 'supportedFormLocales' + diff --git a/locale/en_US/author.xml b/locale/en_US/author.xml index 00b4491..79964e5 100644 --- a/locale/en_US/author.xml +++ b/locale/en_US/author.xml @@ -51,6 +51,8 @@ Journal Section About the Journal).]]> Please select a section... + Submission Language + This journal accepts submissions in several languages. Choose the primary language of the submission from the pulldown below. Submission Checklist Indicate that this submission is ready to be considered by this journal by checking off the following (comments to the editor can be added below). You must make sure all items in the submission checklist are satisfied before continuing. @@ -59,6 +61,7 @@ Comments for the Editor Enter text (optional) Please select an appropriate journal section for this submission. + Please select a submission language. Journal's Privacy Statement Reorder authors to appear in the order they will be listed on publication. Reorder author's name diff --git a/locale/en_US/manager.xml b/locale/en_US/manager.xml index 4ff5b25..a9ff8a6 100644 --- a/locale/en_US/manager.xml +++ b/locale/en_US/manager.xml @@ -24,9 +24,10 @@ No editorial team positions have been created. Journal Management UI + Submissions Forms This will replace any locale-specific journal settings you had for this locale - Reload locale-specific default settings + Reload defaults
If a language supported by OJS is not listed below, ask your site administrator to install the language from the site administration interface. For instructions on adding support for new languages, please consult the OJS documentation.]]>
Sorry, no additional languages are available. Contact your site administrator if you wish to use additional languages with this journal. This will be the default language for the journal site. diff --git a/templates/author/submit/step1.tpl b/templates/author/submit/step1.tpl index 1ad7084..8178b3d 100644 --- a/templates/author/submit/step1.tpl +++ b/templates/author/submit/step1.tpl @@ -21,13 +21,14 @@
+
+{include file="common/formErrors.tpl"} +{if $articleId}{/if} + {if count($sectionOptions) <= 1}

{translate key="author.submit.notAccepting"}

{else} - -{include file="common/formErrors.tpl"} - {if count($sectionOptions) == 2} {* If there's only one section, force it and skip the section parts of the interface. *} @@ -42,9 +43,6 @@ {url|assign:"url" page="about"}

{translate key="author.submit.journalSectionDescription" aboutUrl=$url}

-{if $articleId} - -{/if} @@ -60,6 +58,30 @@ {/if}{* if count($sectionOptions) == 2 *} +{if count($supportedSubmissionLocaleNames) == 1} + {* There is only one supported submission locale; choose it invisibly *} + {foreach from=$supportedSubmissionLocaleNames item=locale} + + {/foreach} +{else} + {* There are several submission locales available; allow choice *} +
+ +

{translate key="author.submit.submissionLocale"}

+

{translate key="author.submit.submissionLocaleDescription"}

+ +
+ + + + +
{fieldLabel name="locale" required="true" key="article.language"}
+ +
+ + {* submissionLocale *} +{/if}{* count($supportedSubmissionLocaleNames) == 1 *} +