|
|
| 30 |
// Validation checks for this form |
30 |
// Validation checks for this form |
| 31 |
$this->addCheck(new FormValidator($this, 'sectionId', 'required', 'author.submit.form.sectionRequired')); |
31 |
$this->addCheck(new FormValidator($this, 'sectionId', 'required', 'author.submit.form.sectionRequired')); |
| 32 |
$this->addCheck(new FormValidatorCustom($this, 'sectionId', 'required', 'author.submit.form.sectionRequired', array(DAORegistry::getDAO('SectionDAO'), 'sectionExists'), array($journal->getId()))); |
32 |
$this->addCheck(new FormValidatorCustom($this, 'sectionId', 'required', 'author.submit.form.sectionRequired', array(DAORegistry::getDAO('SectionDAO'), 'sectionExists'), array($journal->getId()))); |
|
|
33 |
$this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'author.submit.form.localeRequired', $journal->getSetting('supportedSubmissionLocales'))); |
| 33 |
} |
34 |
} |
| 34 |
|
35 |
|
| 35 |
/** |
36 |
/** |
|
|
| 44 |
// Get sections for this journal |
45 |
// Get sections for this journal |
| 45 |
$sectionDao =& DAORegistry::getDAO('SectionDAO'); |
46 |
$sectionDao =& DAORegistry::getDAO('SectionDAO'); |
| 46 |
|
47 |
|
| 47 |
// If this user is a section editor or an editor, they are allowed |
48 |
// If this user is a section editor or an editor, they are |
| 48 |
// to submit to sections flagged as "editor-only" for submissions. |
49 |
// allowed to submit to sections flagged as "editor-only" for |
| 49 |
// Otherwise, display only sections they are allowed to submit to. |
50 |
// submissions. Otherwise, display only sections they are |
|
|
51 |
// allowed to submit to. |
| 50 |
$roleDao =& DAORegistry::getDAO('RoleDAO'); |
52 |
$roleDao =& DAORegistry::getDAO('RoleDAO'); |
| 51 |
$isEditor = $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_SECTION_EDITOR); |
53 |
$isEditor = $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->roleExists($journal->getId(), $user->getId(), ROLE_ID_SECTION_EDITOR); |
|
|
54 |
$templateMgr->assign('sectionOptions', array('0' => Locale::translate('author.submit.selectSection')) + $sectionDao->getSectionTitles($journal->getId(), !$isEditor)); |
| 52 |
|
55 |
|
| 53 |
// Set up required Payment Related Information |
56 |
// Set up required Payment Related Information |
| 54 |
import('classes.payment.ojs.OJSPaymentManager'); |
57 |
import('classes.payment.ojs.OJSPaymentManager'); |
|
|
| 58 |
$completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO'); |
61 |
$completedPaymentDAO =& DAORegistry::getDAO('OJSCompletedPaymentDAO'); |
| 59 |
$articleId = $this->articleId; |
62 |
$articleId = $this->articleId; |
| 60 |
|
63 |
|
| 61 |
if ( $paymentManager->submissionEnabled() ) { |
64 |
if ($paymentManager->submissionEnabled()) { |
| 62 |
$templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment ( $journal->getId(), $articleId )); |
65 |
$templateMgr->assign_by_ref('submissionPayment', $completedPaymentDAO->getSubmissionCompletedPayment ($journal->getId(), $articleId)); |
| 63 |
} |
66 |
} |
| 64 |
|
67 |
|
| 65 |
if ( $paymentManager->fastTrackEnabled() ) { |
68 |
if ($paymentManager->fastTrackEnabled()) { |
| 66 |
$templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment ( $journal->getId(), $articleId )); |
69 |
$templateMgr->assign_by_ref('fastTrackPayment', $completedPaymentDAO->getFastTrackCompletedPayment ($journal->getId(), $articleId)); |
| 67 |
} |
70 |
} |
| 68 |
} |
71 |
} |
| 69 |
|
72 |
|
| 70 |
$templateMgr->assign('sectionOptions', array('0' => Locale::translate('author.submit.selectSection')) + $sectionDao->getSectionTitles($journal->getId(), !$isEditor)); |
73 |
// Provide available submission languages. (Convert the array |
|
|
74 |
// of locale symbolic names xx_XX into an associative array |
| 75 |
// of symbolic names => readable names.) |
| 76 |
$templateMgr->assign( |
| 77 |
'supportedSubmissionLocaleNames', |
| 78 |
array_flip(array_intersect( |
| 79 |
array_flip(Locale::getAllLocales()), |
| 80 |
$journal->getSetting('supportedSubmissionLocales') |
| 81 |
)) |
| 82 |
); |
| 83 |
|
| 71 |
parent::display(); |
84 |
parent::display(); |
| 72 |
} |
85 |
} |
| 73 |
|
86 |
|
|
|
| 78 |
if (isset($this->article)) { |
91 |
if (isset($this->article)) { |
| 79 |
$this->_data = array( |
92 |
$this->_data = array( |
| 80 |
'sectionId' => $this->article->getSectionId(), |
93 |
'sectionId' => $this->article->getSectionId(), |
|
|
94 |
'locale' => $this->article->getLocale(), |
| 81 |
'commentsToEditor' => $this->article->getCommentsToEditor() |
95 |
'commentsToEditor' => $this->article->getCommentsToEditor() |
| 82 |
); |
96 |
); |
|
|
97 |
} else { |
| 98 |
$journal =& Request::getJournal(); |
| 99 |
$supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales'); |
| 100 |
// Try these locales in order until we find one that's |
| 101 |
// supported to use as a default. |
| 102 |
$tryLocales = array( |
| 103 |
$this->getFormLocale(), // Current form locale |
| 104 |
Locale::getLocale(), // Current UI locale |
| 105 |
$journal->getPrimaryLocale(), // Journal locale |
| 106 |
$supportedSubmissionLocales[array_shift(array_keys($supportedSubmissionLocales))] // Fallback: first one on the list |
| 107 |
); |
| 108 |
$this->_data = array(); |
| 109 |
foreach ($tryLocales as $locale) { |
| 110 |
if (in_array($locale, $supportedSubmissionLocales)) { |
| 111 |
// Found a default to use |
| 112 |
$this->_data['locale'] = $locale; |
| 113 |
break; |
| 114 |
} |
| 115 |
} |
| 83 |
} |
116 |
} |
| 84 |
} |
117 |
} |
| 85 |
|
118 |
|
|
|
| 87 |
* Assign form data to user-submitted data. |
120 |
* Assign form data to user-submitted data. |
| 88 |
*/ |
121 |
*/ |
| 89 |
function readInputData() { |
122 |
function readInputData() { |
| 90 |
$this->readUserVars(array('submissionChecklist', 'copyrightNoticeAgree', 'sectionId', 'commentsToEditor')); |
123 |
$this->readUserVars(array('locale', 'submissionChecklist', 'copyrightNoticeAgree', 'sectionId', 'commentsToEditor')); |
| 91 |
} |
124 |
} |
| 92 |
|
125 |
|
| 93 |
/** |
126 |
/** |
|
|
| 113 |
$user =& Request::getUser(); |
146 |
$user =& Request::getUser(); |
| 114 |
|
147 |
|
| 115 |
$this->article = new Article(); |
148 |
$this->article = new Article(); |
| 116 |
$this->article->setLocale(Locale::getLocale()); // FIXME in bug #5543 |
149 |
$this->article->setLocale($this->getData('locale')); |
| 117 |
$this->article->setUserId($user->getId()); |
150 |
$this->article->setUserId($user->getId()); |
| 118 |
$this->article->setJournalId($journal->getId()); |
151 |
$this->article->setJournalId($journal->getId()); |
| 119 |
$this->article->setSectionId($this->getData('sectionId')); |
152 |
$this->article->setSectionId($this->getData('sectionId')); |