Ok, I did some crude copy&pasting and now the download works for the Layout Editor! Let me see if I can summarize what I did (sorry for the backward slashes):
1. \pages\layoutEditor\SubmissionLayoutHandler.inc.phpreplaced lines
437-479- Code: Select all
if($this->validate($request, $articleId)) {
$journal =& $request->getJournal();
$submission =& $this->submission;
}
if (!LayoutEditorAction::downloadFile($submission, $fileId, $revision)) {
$request->redirect(null, null, 'submission', $articleId);
}
with these lines, essentially copied from
\pages\sectionEditor\SubmissionEditHandler.inc.php- Code: Select all
$this->validate($articleId);
if (!LayoutEditorAction::downloadFile($articleId, $fileId, $revision)) {
$request->redirect(null, null, 'submission', $articleId);
}
2.
\classes\submission\layoutEditor\LayoutEditorAction.inc.phpreplaced the
function downloadFile (lines 349-374)
- Code: Select all
function downloadFile($article, $fileId, $revision = null) {
$canDownload = false;
$galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$suppDao =& DAORegistry::getDAO('SuppFileDAO');
$layoutSignoff = $signoffDao->build('SIGNOFF_LAYOUT', ASSOC_TYPE_ARTICLE, $article->getId());
if ($layoutSignoff->getFileId() == $fileId) {
$canDownload = true;
} else if($galleyDao->galleyExistsByFileId($article->getId(), $fileId)) {
$canDownload = true;
} else if($suppDao->suppFileExistsByFileId($article->getId(), $fileId)) {
$canDownload = true;
}
$result = false;
if (!HookRegistry::call('LayoutEditorAction::downloadFile', array(&$article, &$fileId, &$revision, &$canDownload, &$result))) {
if ($canDownload) {
return parent::downloadFile($article->getId(), $fileId, $revision);
} else {
return false;
}
}
return $result;
}
with this much leaner version from the
\classes\submission\common\Action.inc.php- Code: Select all
function downloadFile($articleId, $fileId, $revision = null) {
import('classes.file.ArticleFileManager');
$articleFileManager = new ArticleFileManager($articleId);
return $articleFileManager->downloadFile($fileId, $revision);
}
The above function is called via
EditorAction.inc.php that calls
SectionEditorAction.inc.php that calls
\classes\submission\common\Action.inc.php. I copied the things from the Editor's section, because there everything worked.
However, I did not do anything to the viewFile function that has the same structure as downloadFile, this was just a quick fix for our needs. It looks to me that the Layout editor pages were not upgraded in the same way as the Editor and Section editor pages.
Cheers,
Ales