/** * Validate the form */ function validate($request) { if ($this->getData('showVolume')) { $this->addCheck(new FormValidatorCustom($this, 'volume', 'required', 'editor.issues.volumeRequired', create_function('$volume', 'return ($volume > 0);'))); } if ($this->getData('showNumber')) { $this->addCheck(new FormValidatorCustom($this, 'number', 'required', 'editor.issues.numberRequired', create_function('$number', 'return ($number > 0);'))); } if ($this->getData('showYear')) { $this->addCheck(new FormValidatorCustom($this, 'year', 'required', 'editor.issues.yearRequired', create_function('$year', 'return ($year > 0);'))); } if ($this->getData('showTitle')) { $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'editor.issues.titleRequired')); } // check if public issue ID has already been used $journal = $request->getJournal(); $journalDao = DAORegistry::getDAO('JournalDAO'); /* @var $journalDao JournalDAO */ $publicIssueId = $this->getData('publicIssueId'); if ($this->issue && $publicIssueId && $journalDao->anyPubIdExists($journal->getId(), 'publisher-id', $publicIssueId, ASSOC_TYPE_ISSUE, $this->issue->getId())) { $this->addError('publicIssueId', __('editor.publicIdentificationExists', array('publicIdentifier' => $publicIssueId))); $this->addErrorField('publicIssueId'); } if ($temporaryFileId = $this->getData('temporaryFileId')) { $user = $request->getUser(); $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO'); $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId()); if (!in_array($temporaryFile->getFileType(), array('text/plain', 'text/css'))) { $this->addError('styleFile', __('editor.issues.invalidStyleFormat')); } } // Verify additional fields from public identifer plug-ins. import('classes.plugins.PubIdPluginHelper'); $pubIdPluginHelper = new PubIdPluginHelper(); $pubIdPluginHelper->validate($journal->getId(), $this, $this->issue); return parent::validate(); }
/** * Check to ensure that the form is correctly validated. */ function validate() { // Verify that an image cover, if supplied, is actually an image. import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); if ($publicFileManager->uploadedFileExists(COVER_PAGE_IMAGE_NAME)) { $type = $publicFileManager->getUploadedFileType(COVER_PAGE_IMAGE_NAME); $extension = $publicFileManager->getImageExtension($type); if (!$extension) { // Not a valid image. $this->addError('imageFile', __('submission.layout.imageInvalid')); return false; } } // Verify additional fields from public identifer plug-ins. $journal = Request::getJournal(); import('classes.plugins.PubIdPluginHelper'); $pubIdPluginHelper = new PubIdPluginHelper(); $pubIdPluginHelper->validate($journal->getId(), $this, $this->article); // Fall back on parent validation return parent::validate(); }
/** * Validate the form */ function validate() { // check if public galley ID has already been used for another galley of this article $journal =& Request::getJournal(); $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO'); /* @var $galleylDao ArticleGalleyDAO */ $publicGalleyId = $this->getData('publicGalleyId'); if ($publicGalleyId && $galleyDao->getGalleyByPubId('publisher-id', $publicGalleyId, $this->articleId)) { $this->addError('publicGalleyId', __('editor.publicGalleyIdentificationExists', array('publicIdentifier' => $publicGalleyId))); $this->addErrorField('publicGalleyId'); } // Verify additional fields from public identifer plug-ins. import('classes.plugins.PubIdPluginHelper'); $pubIdPluginHelper = new PubIdPluginHelper(); $pubIdPluginHelper->validate($journal->getId(), $this, $this->galley); return parent::validate(); }
/** * Validate the form */ function validate($request) { // check if public issue ID has already been used $journal = $request->getJournal(); $journalDao = DAORegistry::getDAO('JournalDAO'); /* @var $journalDao JournalDAO */ $publicIssueId = $this->getData('publicIssueId'); if ($this->issue && $publicIssueId && $journalDao->anyPubIdExists($journal->getId(), 'publisher-id', $publicIssueId, ASSOC_TYPE_ISSUE, $this->issue->getId())) { $this->addError('publicIssueId', __('editor.publicIdentificationExists', array('publicIdentifier' => $publicIssueId))); $this->addErrorField('publicIssueId'); } if ($temporaryFileId = $this->getData('temporaryFileId')) { $user = $request->getUser(); $temporaryFileDao = DAORegistry::getDAO('TemporaryFileDAO'); $temporaryFile = $temporaryFileDao->getTemporaryFile($temporaryFileId, $user->getId()); if (!in_array($temporaryFile->getFileType(), array('text/plain', 'text/css'))) { $this->addError('styleFile', __('editor.issues.invalidStyleFormat')); } } // Verify additional fields from public identifer plug-ins. import('classes.plugins.PubIdPluginHelper'); $pubIdPluginHelper = new PubIdPluginHelper(); $pubIdPluginHelper->validate($journal->getId(), $this, $this->issue); return parent::validate(); }
/** * Validate the form */ function validate() { // check if public galley ID has already been used $journal =& Request::getJournal(); $journalDao =& DAORegistry::getDAO('JournalDAO'); /* @var $journalDao JournalDAO */ $publicGalleyId = $this->getData('publicGalleyId'); if ($publicGalleyId && $journalDao->anyPubIdExists($journal->getId(), 'publisher-id', $publicGalleyId, ASSOC_TYPE_GALLEY, $this->galleyId)) { $this->addError('publicGalleyId', __('editor.publicIdentificationExists', array('publicIdentifier' => $publicGalleyId))); $this->addErrorField('publicGalleyId'); } // Verify additional fields from public identifer plug-ins. import('classes.plugins.PubIdPluginHelper'); $pubIdPluginHelper = new PubIdPluginHelper(); $pubIdPluginHelper->validate($journal->getId(), $this, $this->galley); return parent::validate(); }
/** * Validate the form */ function validate($issue = null) { $issueId = $issue ? $issue->getId() : 0; if ($this->getData('showVolume')) { $this->addCheck(new FormValidatorCustom($this, 'volume', 'required', 'editor.issues.volumeRequired', create_function('$volume', 'return ($volume > 0);'))); } if ($this->getData('showNumber')) { $this->addCheck(new FormValidatorCustom($this, 'number', 'required', 'editor.issues.numberRequired', create_function('$number', 'return ($number > 0);'))); } if ($this->getData('showYear')) { $this->addCheck(new FormValidatorCustom($this, 'year', 'required', 'editor.issues.yearRequired', create_function('$year', 'return ($year > 0);'))); } if ($this->getData('showTitle')) { $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'editor.issues.titleRequired')); } // check if public issue ID has already been used $journal =& Request::getJournal(); $journalDao =& DAORegistry::getDAO('JournalDAO'); /* @var $journalDao JournalDAO */ $publicIssueId = $this->getData('publicIssueId'); if ($publicIssueId && $journalDao->anyPubIdExists($journal->getId(), 'publisher-id', $publicIssueId, ASSOC_TYPE_ISSUE, $issueId)) { $this->addError('publicIssueId', __('editor.publicIdentificationExists', array('publicIdentifier' => $publicIssueId))); $this->addErrorField('publicIssueId'); } import('classes.file.PublicFileManager'); $publicFileManager = new PublicFileManager(); if ($publicFileManager->uploadedFileExists('coverPage')) { $type = $publicFileManager->getUploadedFileType('coverPage'); if (!$publicFileManager->getImageExtension($type)) { $this->addError('coverPage', __('editor.issues.invalidCoverPageFormat')); $this->addErrorField('coverPage'); } } if ($publicFileManager->uploadedFileExists('styleFile')) { $type = $publicFileManager->getUploadedFileType('styleFile'); if ($type != 'text/plain' && $type != 'text/css') { $this->addError('styleFile', __('editor.issues.invalidStyleFormat')); } } // Verify additional fields from public identifer plug-ins. import('classes.plugins.PubIdPluginHelper'); $pubIdPluginHelper = new PubIdPluginHelper(); $pubIdPluginHelper->validate($journal->getId(), $this, $issue); return parent::validate(); }