Skip to content

Commit

Permalink
#1932 display submission note file
Browse files Browse the repository at this point in the history
  • Loading branch information
bozana committed Mar 30, 2017
1 parent 2c6b285 commit 8170fa2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
22 changes: 21 additions & 1 deletion controllers/informationCenter/InformationCenterHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,31 @@ function listNotes($args, $request) {
$templateMgr = TemplateManager::getManager($request);
$noteDao = DAORegistry::getDAO('NoteDAO');
$user = $request->getUser();

// get submission note file, needed for legacy data
$noteFilesDownloadLink = array();
$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO');
import('lib.pkp.classes.submission.SubmissionFile');
import('lib.pkp.controllers.api.file.linkAction.DownloadFileLinkAction');
$notes = $noteDao->getByAssoc($this->_getAssocType(), $this->_getAssocId());
while ($note = $notes->next()) {
$submissionFiles = $submissionFileDao->getLatestRevisionsByAssocId(
ASSOC_TYPE_NOTE, $note->getId(),
$this->_getAssocId(),
SUBMISSION_FILE_NOTE
);
if (!empty($submissionFiles)) {
assert(count($submissionFiles) == 1);
$noteFilesDownloadLink[$note->getId()] = new DownloadFileLinkAction($request, array_shift($submissionFiles), $request->getUserVar('stageId'));
}
}

$templateMgr->assign(array(
'notes' => $noteDao->getByAssoc($this->_getAssocType(), $this->_getAssocId()),
'currentUserId' => $user->getId(),
'notesDeletable' => true,
'notesListId' => 'notesList'
'notesListId' => 'notesList',
'noteFilesDownloadLink' => $noteFilesDownloadLink,
));
$json = new JSONMessage(true, $templateMgr->fetch('controllers/informationCenter/notesList.tpl'));
$json->setEvent('dataChanged');
Expand Down
6 changes: 3 additions & 3 deletions templates/controllers/informationCenter/note.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
</span>
{if ($notesDeletable && array_intersect(array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR), (array)$userRoles)) || $noteFileDownloadLink}
<div class="actions">
{if $noteFileDownloadLink}
{include file="linkAction/linkAction.tpl" action=$noteFileDownloadLink contextId=$note->getId()}
{/if}
{if $notesDeletable && array_intersect(array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR), (array)$userRoles)}
<form class="pkp_form" id="{$formId}" action="{url op="deleteNote" noteId=$noteId params=$linkParams}">
{csrf}
Expand All @@ -48,6 +45,9 @@
{/if}
</div>
<div class="message">
{if $noteFileDownloadLink}
{include file="linkAction/linkAction.tpl" action=$noteFileDownloadLink contextId=$note->getId()}
{/if}
{include file="controllers/revealMore.tpl" content=$note->getContents()|strip_unsafe_html}
</div>
</div>

0 comments on commit 8170fa2

Please sign in to comment.