17 import(
'lib.pkp.classes.controllers.grid.GridHandler');
18 import(
'lib.pkp.classes.controllers.grid.DataObjectGridCellProvider');
21 import(
'lib.pkp.classes.linkAction.request.AjaxModal');
31 parent::__construct();
33 array(ROLE_ID_MANAGER, ROLE_ID_REVIEWER, ROLE_ID_AUTHOR, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT),
34 array(
'fetchGrid',
'fetchRow',
'addNote',
'insertNote',
'deleteNote'));
72 function authorize($request, &$args, $roleAssignments) {
73 $stageId = $request->getUserVar(
'stageId');
76 import(
'lib.pkp.classes.security.authorization.QueryAccessPolicy');
78 return parent::authorize($request, $args, $roleAssignments);
85 parent::initialize($request, $args);
86 $this->
setTitle(
'submission.query.messages');
90 LOCALE_COMPONENT_PKP_SUBMISSION,
91 LOCALE_COMPONENT_PKP_USER,
92 LOCALE_COMPONENT_PKP_EDITOR
95 import(
'lib.pkp.controllers.grid.queries.QueryNotesGridCellProvider');
106 array(
'width' => 80,
'html' =>
true)
112 'submission.query.from',
116 array(
'html' =>
true)
120 $this->_user = $request->getUser();
132 import(
'lib.pkp.controllers.grid.queries.QueryNotesGridRow');
152 function loadData($request, $filter =
null) {
153 return $this->
getQuery()->getReplies(
null, NOTE_ORDER_DATE_CREATED, SORT_DIRECTION_ASC, $this->
getCanManage(
null));
164 function addNote($args, $request) {
165 import(
'lib.pkp.controllers.grid.queries.form.QueryNoteForm');
167 $queryNoteForm->initData();
168 return new JSONMessage(
true, $queryNoteForm->fetch($request));
177 import(
'lib.pkp.controllers.grid.queries.form.QueryNoteForm');
179 $queryNoteForm->readInputData();
180 if ($queryNoteForm->validate()) {
181 $note = $queryNoteForm->execute();
184 return new JSONMessage(
true, $queryNoteForm->fetch($request));
194 $isAdmin = (0 !=
count(array_intersect(
196 array(ROLE_ID_MANAGER, ROLE_ID_ASSISTANT, ROLE_ID_SUB_EDITOR)
199 if ($note ===
null) {
202 return ($note->getUserId() == $this->_user->getId() || $isAdmin);
215 $note = $noteDao->getById($request->getUserVar(
'noteId'));
216 $user = $request->getUser();
218 if (!$request->checkCSRF() || !$note || $note->getAssocType() != ASSOC_TYPE_QUERY || $note->getAssocId() != $query->getId()) {
228 $noteDao->deleteObject($note);