17 import(
'lib.pkp.classes.controllers.grid.CategoryGridHandler');
18 import(
'lib.pkp.classes.controllers.grid.DataObjectGridCellProvider');
21 import(
'lib.pkp.controllers.grid.users.author.PKPAuthorGridCellProvider');
22 import(
'controllers.grid.users.chapter.ChapterGridCategoryRow');
25 import(
'lib.pkp.classes.linkAction.request.AjaxModal');
35 parent::__construct();
37 array(ROLE_ID_AUTHOR, ROLE_ID_SUB_EDITOR, ROLE_ID_MANAGER, ROLE_ID_ASSISTANT),
39 'fetchGrid',
'fetchRow',
'fetchCategory',
'saveSequence',
40 'addChapter',
'editChapter',
'editChapterTab',
'updateChapter',
'deleteChapter',
41 'addAuthor',
'editAuthor',
'updateAuthor',
'deleteAuthor'
45 array(ROLE_ID_SUB_EDITOR, ROLE_ID_MANAGER, ROLE_ID_ASSISTANT),
46 array(
'identifiers',
'updateIdentifiers',
'clearPubId',)
84 $this->_readOnly = $readOnly;
97 function authorize($request, &$args, $roleAssignments) {
98 import(
'lib.pkp.classes.security.authorization.PublicationAccessPolicy');
100 return parent::authorize($request, $args, $roleAssignments);
107 parent::initialize($request, $args);
111 AppLocale::requireComponents(LOCALE_COMPONENT_APP_DEFAULT, LOCALE_COMPONENT_PKP_DEFAULT, LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_PKP_SUBMISSION);
113 if ($this->
getPublication()->getData(
'status') === STATUS_PUBLISHED) {
119 $router = $request->getRouter();
126 $router->url($request,
null,
null,
'addChapter',
null, $actionArgs),
127 __(
'submission.chapter.addChapter'),
130 __(
'submission.chapter.addChapter'),
142 'author.users.contributor.name',
146 array(
'width' => 50,
'alignment' => COLUMN_ALIGNMENT_LEFT)
152 'author.users.contributor.email',
161 'author.users.contributor.role',
175 import(
'lib.pkp.classes.controllers.grid.feature.OrderCategoryGridItemsFeature');
188 parent::getRequestArgs(),
206 if ($publication->getData(
'status') === STATUS_PUBLISHED) {
210 if (in_array(ROLE_ID_SITE_ADMIN, $userRoles)) {
215 if ($submission->getDateSubmitted() ==
null)
return true;
218 if (
Services::get(
'submission')->canEditPublication($submission->getId(), $user->getId())) {
237 function loadData($request, $filter) {
240 ->toAssociativeArray();
251 return $gridDataElement->getSequence();
261 $chapter->setSequence($newSequence);
262 $chapterDao->updateObject($chapter);
275 import(
'controllers.grid.users.chapter.ChapterGridCategoryRowCellProvider');
284 $authorFactory = $chapter->getAuthors();
285 return $authorFactory->toAssociativeArray();
292 return $author->getSequence();
305 $chapterAuthorDao->deleteChapterAuthorById($author->getId(), $chapterId);
309 $chapterAuthorDao->insertChapterAuthor($author->getId(), $chapterId,
false, $newSequence);
325 import(
'controllers.tab.pubIds.form.PublicIdentifiersForm');
328 return new JSONMessage(
true, $form->fetch($request));
342 import(
'controllers.tab.pubIds.form.PublicIdentifiersForm');
344 $form->readInputData();
345 if ($form->validate()) {
349 return new JSONMessage(
true, $form->fetch($request));
360 if (!$request->checkCSRF())
return new JSONMessage(
false);
365 import(
'controllers.tab.pubIds.form.PublicIdentifiersForm');
367 $form->clearPubId($request->getUserVar(
'pubIdPlugIn'));
395 $templateMgr->assign(array(
398 'chapterId' => $chapter->getId(),
401 if (array_intersect(array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT), $this->
getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES))) {
402 $publisherIdEnabled = in_array(
'chapter', (array) $request->getContext()->getData(
'enablePublisherId'));
404 $pubIdEnabled =
false;
405 foreach ($pubIdPlugins as $pubIdPlugin) {
406 if ($pubIdPlugin->isObjectTypeEnabled(
'Chapter', $request->getContext()->getId())) {
407 $pubIdEnabled =
true;
411 $templateMgr->assign(
'showIdentifierTab', $publisherIdEnabled || $pubIdEnabled);
414 return new JSONMessage(
true, $templateMgr->fetch(
'controllers/grid/users/chapter/editChapter.tpl'));
428 import(
'controllers.grid.users.chapter.form.ChapterForm');
430 $chapterForm->initData();
432 return new JSONMessage(
true, $chapterForm->fetch($request));
447 import(
'controllers.grid.users.chapter.form.ChapterForm');
449 $chapterForm->readInputData();
452 if ($chapterForm->validate()) {
454 $notificationMgr->createTrivialNotification($request->getUser()->getId());
455 $chapterForm->execute();
473 $chapterId = $chapter->getId();
477 $assignedAuthorIds = $chapterAuthorDao->getAuthorIdsByChapterId($chapterId);
479 foreach ($assignedAuthorIds as $authorId) {
480 $chapterAuthorDao->deleteChapterAuthorById($authorId, $chapterId);
484 $chapterDao->deleteById($chapterId);
493 (
int) $request->getUserVar(
'chapterId'),
494 $this->getPublication()->getId()