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

Reusability of handler helper methods #33

Open
ctgraham opened this issue Oct 17, 2019 · 2 comments
Open

Reusability of handler helper methods #33

ctgraham opened this issue Oct 17, 2019 · 2 comments

Comments

@ctgraham
Copy link
Contributor

Methods TextureHandler::_createDependentFile() and TextureHandler::_updateManuscriptFile() seem reusable enough that they could be methods of the Plugin, or even of SubmissionFileManager.

For example, for #32, we would want a plugin hook to potentially do both of these things. There would be no need to reach out to a Handler.

@withanage , @asmecher , opinions on whether to promote these methods to the plugin or to SubmissionFileManager? Are there assumptions or specifics I'm missing here which limit the reusability of this code?

ctgraham added a commit to ulsdevteam/texture that referenced this issue Oct 17, 2019
@ctgraham
Copy link
Contributor Author

Also, this transformation of mime type to genre: probably not robust enough for GenreDAO, but should we stub it out in that direction?

import('classes.file.PublicFileManager');
$publicFileManager = new PublicFileManager();
$journal = $request->getJournal();
$genreDao = DAORegistry::getDAO('GenreDAO');
$genres = $genreDao->getByDependenceAndContextId(true, $journal->getId());
$genreId = null;
$extension = $publicFileManager->getImageExtension($media["fileType"]);
while ($candidateGenre = $genres->next()) {
if ($extension) {
if ($candidateGenre->getKey() == 'IMAGE') {
$genreId = $candidateGenre->getId();
break;
}
} else {
if ($candidateGenre->getKey() == 'MULTIMEDIA') {
$genreId = $candidateGenre->getId();
break;
}
}
}

@ctgraham
Copy link
Contributor Author

ctgraham commented Oct 17, 2019

Concrete example (if we want to keep it to the plugin):
ulsdevteam@b461f23

ctgraham added a commit to ulsdevteam/texture that referenced this issue Oct 17, 2019
ctgraham added a commit to ulsdevteam/texture that referenced this issue Oct 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant