Skip to content

Commit

Permalink
*8148* make submission file genres optional
Browse files Browse the repository at this point in the history
  • Loading branch information
jnugent committed Apr 25, 2013
1 parent 1780274 commit 8c061be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Expand Up @@ -87,7 +87,7 @@ function validate($request) {
$router = $request->getRouter();
$context = $router->getContext($request);

if (!$revisedFileId) {
if (!$revisedFileId && $this->_appHasFileGenres()) {
// Add an additional check for the genre to the form.
$this->addCheck(
new FormValidatorCustom(
Expand Down Expand Up @@ -201,6 +201,9 @@ function fetch($request) {
// Include a status message for this installation's max file upload size.
$this->setData('maxFileUploadSize', get_cfg_var('upload_max_filesize'));

// Allow file genres by default.
$this->setData('appHasFileGenres', $this->_appHasFileGenres());

return parent::fetch($request);
}

Expand Down Expand Up @@ -302,6 +305,14 @@ function _uploadFile($request, $user, $uploaderUserGroupId, $revisedFileId, $fil
function _logEvent($request, $user, $submissionFile, $assocType, $revisedFileId, $fileStage) {
assert(false);
}

/**
* Indicates whether or not submission files have genres.
* @return boolean
*/
function _appHasFileGenres() {
return true; // the default for PKP-lib
}
}

?>
Expand Up @@ -100,7 +100,7 @@
{assign var="showFileSelector" value=true}
{/if}
{else}
{assign var="showGenreSelector" value=true}
{if $appHasFileGenres}{assign var="showGenreSelector" value=true}{/if}
{if empty($submissionFileOptions)}
{* Use case 4: Upload a new file *}
{if is_numeric($revisedFileId)}{"A revised file id cannot be given when uploading a new file!"|fatalError}{/if}
Expand Down

0 comments on commit 8c061be

Please sign in to comment.