4 * @file ProductionHandler.inc.php
6 * Copyright (c) 2003-2008 John Willinsky
7 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
9 * @class ProductionHandler
10 * @ingroup pages_information
12 * @brief Display press information.
15 // $Id: ProductionEditorHandler.inc.php,v 1.11 2009/09/22 21:27:34 asmecher Exp $
18 import('handler.Handler');
19 import('submission.productionEditor.ProductionEditorAction');
21 class ProductionEditorHandler
extends Handler
{
23 function ProductionEditorHandler() {
28 * Display the information page for the press..
30 function index($args) {
33 $this->setupTemplate();
34 $press =& Request
::getPress();
36 $templateMgr =& TemplateManager
::getManager();
37 $user =& Request
::getUser();
38 $rangeInfo =& Handler
::getRangeInfo('submissions');
39 $productionSubmissionDao =& DAORegistry
::getDAO('ProductionEditorSubmissionDAO');
41 $page = isset($args[0]) ?
$args[0] : '';
51 $submissions = $productionSubmissionDao->getProductionEditorSubmissions($user->getId(), $press->getId(), $active, $rangeInfo);
53 $templateMgr =& TemplateManager
::getManager();
54 $templateMgr->assign('pageToDisplay', $page);
56 // Make view counts available if enabled.
57 $templateMgr->assign('statViews', $press->getSetting('statViews'));
59 $templateMgr->assign_by_ref('submissions', $submissions);
60 $templateMgr->display('productionEditor/index.tpl');
66 * @param $args array ($monographId, $assignmentId, $userId)
68 function selectProofreader($args) {
69 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
70 $assignmentId = isset($args[1]) ?
(int) $args[1] : 0;
71 $userId = isset($args[2]) ?
(int) $args[2] : 0;
73 $this->validate($monographId);
74 $press =& $this->press
;
75 $submission =& $this->submission
;
77 $roleDao =& DAORegistry
::getDAO('RoleDAO');
79 if ($userId && $monographId && $roleDao->roleExists($press->getId(), $userId, ROLE_ID_PROOFREADER
)) {
80 import('submission.proofreader.ProofreaderAction');
81 ProofreaderAction
::selectProofreader($userId, $assignmentId, $submission);
82 Request
::redirect(null, null, 'submissionLayout', $monographId);
84 $this->setupTemplate(true, $monographId, 'editing');
88 $search = $searchQuery = Request
::getUserVar('search');
89 $searchInitial = Request
::getUserVar('searchInitial');
91 $searchType = Request
::getUserVar('searchField');
92 $searchMatch = Request
::getUserVar('searchMatch');
94 } else if (isset($searchInitial)) {
95 $searchInitial = String::strtoupper($searchInitial);
96 $searchType = USER_FIELD_INITIAL
;
97 $search = $searchInitial;
100 $proofreaders = $roleDao->getUsersByRoleId(ROLE_ID_PROOFREADER
, $press->getId(), $searchType, $search, $searchMatch);
102 $acquisitionsEditorSubmissionDao =& DAORegistry
::getDAO('AcquisitionsEditorSubmissionDAO');
103 $proofreaderStatistics = $acquisitionsEditorSubmissionDao->getProofreaderStatistics($press->getId());
105 $templateMgr =& TemplateManager
::getManager();
107 $templateMgr->assign('searchField', $searchType);
108 $templateMgr->assign('searchMatch', $searchMatch);
109 $templateMgr->assign('search', $searchQuery);
110 $templateMgr->assign('searchInitial', Request
::getUserVar('searchInitial'));
112 $templateMgr->assign_by_ref('users', $proofreaders);
114 $signoffDao =& DAORegistry
::getDAO('SignoffDAO');
115 $proofSignoff =& $signoffDao->getBySymbolic('PRODUCTION_PROOF_PROOFREADER', ASSOC_TYPE_PRODUCTION_ASSIGNMENT
, $assignmentId);
117 $templateMgr->assign('currentUser', $proofSignoff->getUserId());
120 $templateMgr->assign('statistics', $proofreaderStatistics);
121 $templateMgr->assign('fieldOptions', Array(
122 USER_FIELD_FIRSTNAME
=> 'user.firstName',
123 USER_FIELD_LASTNAME
=> 'user.lastName',
124 USER_FIELD_USERNAME
=> 'user.username',
125 USER_FIELD_EMAIL
=> 'user.email'
127 $templateMgr->assign('monographId', $monographId);
128 $templateMgr->assign('pageSubTitle', 'editor.monograph.selectProofreader');
129 $templateMgr->assign('pageTitle', 'user.role.proofreaders');
130 $templateMgr->assign('actionHandler', 'selectProofreader');
131 $templateMgr->assign('productionAssignmentId', $assignmentId);
132 $templateMgr->assign('alphaList', explode(' ', Locale
::translate('common.alphaList')));
133 $templateMgr->assign('helpTopicId', 'press.roles.proofreader');
134 $templateMgr->display('productionEditor/selectUser.tpl');
140 * @param $args array ($monographId, $assignmentId, $userId)
142 function selectDesigner($args) {
143 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
144 $assignmentId = isset($args[1]) ?
(int) $args[1] : 0;
145 $userId = isset($args[2]) ?
(int) $args[2] : 0;
147 $this->validate($monographId);
148 $press =& $this->press
;
149 $submission =& $this->submission
;
151 $roleDao =& DAORegistry
::getDAO('RoleDAO');
153 if ($userId && $monographId && $roleDao->roleExists($press->getId(), $userId, ROLE_ID_DESIGNER
)) {
154 import('submission.designer.DesignerAction');
155 DesignerAction
::selectDesigner($userId, $assignmentId, $submission);
156 Request
::redirect(null, null, 'submissionLayout', $monographId);
158 $this->setupTemplate(true, $monographId, 'editing');
162 $search = $searchQuery = Request
::getUserVar('search');
163 $searchInitial = Request
::getUserVar('searchInitial');
164 if (isset($search)) {
165 $searchType = Request
::getUserVar('searchField');
166 $searchMatch = Request
::getUserVar('searchMatch');
168 } else if (isset($searchInitial)) {
169 $searchInitial = String::strtoupper($searchInitial);
170 $searchType = USER_FIELD_INITIAL
;
171 $search = $searchInitial;
174 $proofreaders = $roleDao->getUsersByRoleId(ROLE_ID_DESIGNER
, $press->getId(), $searchType, $search, $searchMatch);
176 $acquisitionsEditorSubmissionDao =& DAORegistry
::getDAO('AcquisitionsEditorSubmissionDAO');
177 $designerStatistics = $acquisitionsEditorSubmissionDao->getDesignerStatistics($press->getId());
179 $templateMgr =& TemplateManager
::getManager();
181 $templateMgr->assign('searchField', $searchType);
182 $templateMgr->assign('searchMatch', $searchMatch);
183 $templateMgr->assign('search', $searchQuery);
184 $templateMgr->assign('searchInitial', Request
::getUserVar('searchInitial'));
186 $templateMgr->assign_by_ref('users', $proofreaders);
188 $signoffDao =& DAORegistry
::getDAO('SignoffDAO');
189 $designSignoff =& $signoffDao->getBySymbolic('PRODUCTION_DESIGNER', ASSOC_TYPE_PRODUCTION_ASSIGNMENT
, $assignmentId);
190 if ($designSignoff) {
191 $templateMgr->assign('currentUser', $designSignoff->getUserId());
194 $templateMgr->assign('statistics', $designerStatistics);
195 $templateMgr->assign('fieldOptions', Array(
196 USER_FIELD_FIRSTNAME
=> 'user.firstName',
197 USER_FIELD_LASTNAME
=> 'user.lastName',
198 USER_FIELD_USERNAME
=> 'user.username',
199 USER_FIELD_EMAIL
=> 'user.email'
201 $templateMgr->assign('monographId', $monographId);
202 $templateMgr->assign('pageSubTitle', 'production.selectDesigner');
203 $templateMgr->assign('pageTitle', 'user.role.designers');
204 $templateMgr->assign('actionHandler', 'selectDesigner');
205 $templateMgr->assign('productionAssignmentId', $assignmentId);
206 $templateMgr->assign('alphaList', explode(' ', Locale
::translate('common.alphaList')));
207 $templateMgr->assign('helpTopicId', 'press.roles.proofreader');
208 $templateMgr->display('productionEditor/selectUser.tpl');
213 * Notify author for proofreading
215 function notifyAuthorProofreader($args) {
216 $monographId = Request
::getUserVar('monographId');
217 $send = Request
::getUserVar('send')?
1:0;
218 $this->validate($monographId);
219 $press =& $this->press
;
220 $submission =& $this->submission
;
221 $this->setupTemplate(true, $monographId, 'editing');
223 import('submission.proofreader.ProofreaderAction');
224 if (ProofreaderAction
::proofreadEmail($monographId, 'PROOFREAD_AUTHOR_REQUEST', $send?
'':Request
::url(null, null, 'notifyAuthorProofreader'))) {
225 Request
::redirect(null, null, 'submissionEditing', $monographId);
230 * Thank author for proofreading
232 function thankAuthorProofreader($args) {
233 $monographId = Request
::getUserVar('monographId');
234 $send = Request
::getUserVar('send')?
1:0;
235 $this->validate($monographId);
236 $press =& $this->press
;
237 $submission =& $this->submission
;
238 $this->setupTemplate(true, $monographId, 'editing');
240 import('submission.proofreader.ProofreaderAction');
241 if (ProofreaderAction
::proofreadEmail($monographId, 'PROOFREAD_AUTHOR_ACK', $send?
'':Request
::url(null, null, 'thankAuthorProofreader'))) {
242 Request
::redirect(null, null, 'submissionEditing', $monographId);
247 * Editor initiates proofreading
249 function editorInitiateProofreader() {
250 $monographId = Request
::getUserVar('monographId');
251 $this->validate($monographId);
252 $press =& $this->press
;
253 $submission =& $this->submission
;
255 $proofAssignmentDao =& DAORegistry
::getDAO('ProofAssignmentDAO');
256 $proofAssignment =& $proofAssignmentDao->getProofAssignmentByMonographId($monographId);
257 $proofAssignment->setDateProofreaderNotified(Core
::getCurrentDate());
258 $proofAssignmentDao->updateProofAssignment($proofAssignment);
260 Request
::redirect(null, null, 'submissionEditing', $monographId);
264 * Editor completes proofreading
266 function editorCompleteProofreader() {
267 $monographId = Request
::getUserVar('monographId');
268 $this->validate($monographId);
269 $press =& $this->press
;
270 $submission =& $this->submission
;
272 $proofAssignmentDao =& DAORegistry
::getDAO('ProofAssignmentDAO');
273 $proofAssignment =& $proofAssignmentDao->getProofAssignmentByMonographId($monographId);
274 $proofAssignment->setDateProofreaderCompleted(Core
::getCurrentDate());
275 $proofAssignmentDao->updateProofAssignment($proofAssignment);
277 Request
::redirect(null, null, 'submissionEditing', $monographId);
281 * Notify proofreader for proofreading
283 function notifyProofreader($args) {
284 $monographId = Request
::getUserVar('monographId');
285 $send = Request
::getUserVar('send');
286 $this->validate($monographId);
287 $press =& $this->press
;
288 $submission =& $this->submission
;
289 $this->setupTemplate(true, $monographId, 'editing');
291 import('submission.proofreader.ProofreaderAction');
292 if (ProofreaderAction
::proofreadEmail($monographId, 'PROOFREAD_REQUEST', $send?
'':Request
::url(null, null, 'notifyProofreader'))) {
293 Request
::redirect(null, null, 'submissionEditing', $monographId);
298 * Thank proofreader for proofreading
300 function thankProofreader($args) {
301 $monographId = Request
::getUserVar('monographId');
302 $send = Request
::getUserVar('send')?
1:0;
303 $this->validate($monographId);
304 $press =& $this->press
;
305 $submission =& $this->submission
;
306 $this->setupTemplate(true, $monographId, 'editing');
308 import('submission.proofreader.ProofreaderAction');
309 if (ProofreaderAction
::proofreadEmail($monographId, 'PROOFREAD_ACK', $send?
'':Request
::url(null, null, 'thankProofreader'))) {
310 Request
::redirect(null, null, 'submissionEditing', $monographId);
315 * Editor initiates layout editor proofreading
317 function editorInitiateLayoutEditor() {
318 $monographId = Request
::getUserVar('monographId');
319 $this->validate($monographId);
320 $press =& $this->press
;
321 $submission =& $this->submission
;
323 $proofAssignmentDao =& DAORegistry
::getDAO('ProofAssignmentDAO');
324 $proofAssignment =& $proofAssignmentDao->getProofAssignmentByMonographId($monographId);
325 $proofAssignment->setDateLayoutEditorNotified(Core
::getCurrentDate());
326 $proofAssignmentDao->updateProofAssignment($proofAssignment);
328 Request
::redirect(null, null, 'submissionEditing', $monographId);
332 * Editor completes layout editor proofreading
334 function editorCompleteLayoutEditor() {
335 $monographId = Request
::getUserVar('monographId');
336 $this->validate($monographId);
337 $press =& $this->press
;
338 $submission =& $this->submission
;
340 $proofAssignmentDao =& DAORegistry
::getDAO('ProofAssignmentDAO');
341 $proofAssignment =& $proofAssignmentDao->getProofAssignmentByMonographId($monographId);
342 $proofAssignment->setDateLayoutEditorCompleted(Core
::getCurrentDate());
343 $proofAssignmentDao->updateProofAssignment($proofAssignment);
345 Request
::redirect(null, null, 'submissionEditing', $monographId);
349 * Notify layout editor for proofreading
351 function notifyDesigner($args) {
352 $monographId = Request
::getUserVar('monographId');
353 $assignmentId = Request
::getUserVar('assignmentId');
354 $send = Request
::getUserVar('send') ?
true : false;
355 $this->validate($monographId);
356 $press =& $this->press
;
357 $submission =& $this->submission
;
358 $this->setupTemplate(true, $monographId, 'editing');
360 import('submission.productionEditor.ProductionEditorAction');
361 if (ProductionEditorAction
::notifyDesigner($submission, $assignmentId, $send)) {
362 Request
::redirect(null, null, 'submissionLayout', $monographId);
367 * Thank layout editor for proofreading
369 function thankLayoutEditorProofreader($args) {
370 $monographId = Request
::getUserVar('monographId');
371 $send = Request
::getUserVar('send')?
1:0;
372 $this->validate($monographId);
373 $press =& $this->press
;
374 $submission =& $this->submission
;
375 $this->setupTemplate(true, $monographId, 'editing');
377 import('submission.proofreader.ProofreaderAction');
378 if (ProofreaderAction
::proofreadEmail($monographId, 'PROOFREAD_LAYOUT_ACK', $send?
'':Request
::url(null, null, 'thankLayoutEditorProofreader'))) {
379 Request
::redirect(null, null, 'submissionEditing', $monographId);
383 function submission($args) {
384 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
385 $this->validate($monographId);
386 $submission =& $this->submission
;
387 $press =& Request
::getPress();
388 $this->setupTemplate(false, $monographId);
390 $user =& Request
::getUser();
392 $pressSettingsDao =& DAORegistry
::getDAO('PressSettingsDAO');
393 $pressSettings = $pressSettingsDao->getPressSettings($press->getId());
395 $roleDao =& DAORegistry
::getDAO('RoleDAO');
396 $isEditor = $roleDao->roleExists($press->getId(), $user->getId(), ROLE_ID_EDITOR
);
398 $enableComments = $press->getSetting('enableComments');
400 $templateMgr =& TemplateManager
::getManager();
402 $templateMgr->assign_by_ref('submission', $submission);
403 $templateMgr->assign_by_ref('pressSettings', $pressSettings);
404 $templateMgr->assign('userId', $user->getId());
405 $templateMgr->assign('isEditor', $isEditor);
406 $templateMgr->assign('enableComments', $enableComments);
408 if ($enableComments) {
409 import('monograph.Monograph');
410 $templateMgr->assign('commentsStatus', $submission->getCommentsStatus());
411 $templateMgr->assign_by_ref('commentsStatusOptions', Monograph
::getCommentsStatusOptions());
414 $templateMgr->assign('helpTopicId', 'editorial.editorsRole.submissionSummary');
416 $templateMgr->display('productionEditor/submission.tpl');
420 function submitArtwork($args) {
421 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
422 $this->validate($monographId);
423 $submission =& $this->submission
;
424 $this->setupTemplate(false, $monographId);
426 $user =& Request
::getUser();
427 import('monograph.form.MonographArtworkForm');
428 $artworkForm = new MonographArtworkForm('productionEditor/art.tpl', $submission);
430 $editData = $artworkForm->processEvents();
432 if (!$editData && $artworkForm->validate()) {
433 $monographId = $artworkForm->execute();
436 Request
::redirect(null, null, 'submissionArt', $submission->getMonographId());
438 function submissionArt($args) {
439 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
440 $this->validate($monographId);
441 $submission =& $this->submission
;
442 $this->setupTemplate(false, $monographId);
444 $user =& Request
::getUser();
445 import('monograph.form.MonographArtworkForm');
446 $artworkForm = new MonographArtworkForm('productionEditor/art.tpl', $submission);
448 if ($artworkForm->isLocaleResubmit()) {
449 $artworkForm->readInputData();
451 $artworkForm->initData();
454 $artworkForm->display();
456 function productionAssignment($args) {
457 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
458 $productionAssignmentId = isset($args[1]) ?
(int) $args[1] : null;
459 $this->validate($monographId);
460 $this->setupTemplate();
461 $submission =& $this->submission
;
463 $productionAssignment = null;
464 if ($productionAssignmentId) {
465 $productionAssignmentDao =& DAORegistry
::getDAO('ProductionAssignmentDAO');
466 $productionAssignment =& $productionAssignmentDao->getById($productionAssignmentId);
469 import('submission.form.ProductionAssignmentForm');
470 $form = new ProductionAssignmentForm($monographId, $productionAssignment);
472 $templateMgr =& TemplateManager
::getManager();
473 $templateMgr->assign_by_ref('submission', $submission);
475 if (!Request
::getUserVar('fromDesignAssignmentForm')) {
478 $form->readInputData();
480 if (Request
::getUserVar('save') && $form->validate()) {
481 $form->readInputData();
483 Request
::redirect(null, null, 'submissionLayout', $monographId);
490 function deleteSelectedAssignments() {
491 $monographId = Request
::getUserVar('monographId');
492 $this->validate($monographId);
494 $productionAssignmentDao =& DAORegistry
::getDAO('ProductionAssignmentDAO');
495 $selectedAssignments = Request
::getUserVar('selectedAssignments');
496 foreach ($selectedAssignments as $selectedAssignment) {
497 $productionAssignmentDao->deleteById($selectedAssignment);
500 Request
::redirect(null, null, 'submissionLayout', $monographId);
504 * Upload the layout version of the submission file
506 function uploadLayoutFile() {
507 $monographId = Request
::getUserVar('monographId');
508 $this->validate($monographId);
509 $submission =& $this->submission
;
511 ProductionEditorAction
::uploadLayoutVersion($submission);
513 Request
::redirect(null, null, 'submissionLayout', $monographId);
517 * Upload an artwork file (either layout version, galley, or supp. file).
519 function removeArtworkFile($args) {
520 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
521 $fileId = isset($args[1]) ?
(int) $args[1] : 0;
523 import('file.MonographFileManager');
524 $monographFileManager = new MonographFileManager($monographId);
526 $monographFileManager->deleteFile($fileId);
528 Request
::redirect(null, null, 'submissionArt', $monographId);
531 function addProductionAssignment($args) {
532 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
533 $this->validate($monographId);
535 $newProductionAssignment = Request
::getUserVar('newProductionAssignment');
537 $designAssignmentDao =& DAORegistry
::getDAO('ProductionAssignmentDAO');
538 $productionAssignment =& $designAssignmentDao->newDataObject();
539 $productionAssignment->setType($newProductionAssignment['type']);
540 $productionAssignment->setLabel($newProductionAssignment['label']);
541 $productionAssignment->setMonographId($monographId);
543 $designAssignmentDao->insertObject($productionAssignment);
545 Request
::redirect(null, null, 'submissionLayout', $monographId);
549 * Upload an artwork file (either layout version, galley, or supp. file).
551 function uploadArtworkFile() {
552 $monographId = Request
::getUserVar('monographId');
553 $this->validate($monographId);
555 import('file.MonographFileManager');
556 $monographFileManager = new MonographFileManager($monographId);
558 if ($monographFileManager->uploadedFileExists('artworkFile')) {
559 $fileId = $monographFileManager->uploadArtworkFile('artworkFile', null);
561 Request
::redirect(null, null, 'submissionArt', Request
::getUserVar('monographId'));
564 function submissionLayout($args) {
565 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
566 $this->validate($monographId);
567 $submission =& $this->submission
;
568 $this->setupTemplate(false, $monographId);
569 $press =& Request
::getPress();
570 $user =& Request
::getUser();
572 // $artworkCount = $monographFileDao->getArtworkFileCountByMonographId($submission->getMonographId());
574 $productionAssignmentDao =& DAORegistry
::getDAO('ProductionAssignmentDAO');
575 $productionAssignmentTypes = $productionAssignmentDao->productionAssignmentTypeToLocaleKey();
577 $enableComments = $press->getSetting('enableComments');
579 $templateMgr =& TemplateManager
::getManager();
580 $templateMgr->assign_by_ref('productionAssignmentTypes', $productionAssignmentTypes);
581 $templateMgr->assign('enableComments', $enableComments);
582 $templateMgr->assign_by_ref('submission', $submission);
583 $templateMgr->assign('artworkCount', $artworkCount);
584 $templateMgr->assign('galleys', $galleys);
586 if ($enableComments) {
587 import('monograph.Monograph');
588 $templateMgr->assign('commentsStatus', $submission->getCommentsStatus());
589 $templateMgr->assign_by_ref('commentsStatusOptions', Monograph
::getCommentsStatusOptions());
593 $templateMgr->assign('helpTopicId', 'editorial.editorsRole.submissionSummary');
596 $templateMgr->display('productionEditor/layout.tpl');
599 function viewMetadata($args) {
600 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
601 $this->validate($monographId);
602 $submission =& $this->submission
;
603 $this->setupTemplate(true, $monographId, 'summary');
605 Action
::viewMetadata($submission);
610 * @param $args array ($monographId, $fileId, [$revision])
612 function downloadFile($args) {
613 $monographId = isset($args[0]) ?
$args[0] : 0;
614 $fileId = isset($args[1]) ?
$args[1] : 0;
615 $revision = isset($args[2]) ?
$args[2] : null;
617 $this->validate($monographId);
618 $press =& Request
::getPress();
619 import('file.MonographFileManager');
620 $monographFileManager = new MonographFileManager($monographId);
621 if (!$monographFileManager->viewFile($fileId, $revision)) {
622 Request
::redirect(null, null, 'submissionLayout', $monographId);
627 * View a file (inline file).
628 * @param $args array ($monographId, $fileId, [$revision])
630 function viewFile($args) {
631 $monographId = isset($args[0]) ?
$args[0] : 0;
632 $fileId = isset($args[1]) ?
$args[1] : 0;
633 $revision = isset($args[2]) ?
$args[2] : null;
635 $this->validate($monographId);
636 $press =& Request
::getPress();
637 import('file.MonographFileManager');
638 $monographFileManager = new MonographFileManager($monographId);
639 if (!$monographFileManager->viewFile($fileId, $revision)) {
640 Request
::redirect(null, null, 'submissionLayout', $monographId);
645 * Setup common template variables.
646 * @param $subclass boolean set to true if caller is below this handler in the hierarchy
648 function setupTemplate($subclass = false, $monographId = 0, $parentPage = null) {
649 parent
::setupTemplate();
650 Locale
::requireComponents(array(LOCALE_COMPONENT_OMP_AUTHOR
, LOCALE_COMPONENT_OMP_EDITOR
, LOCALE_COMPONENT_PKP_SUBMISSION
));
651 $templateMgr =& TemplateManager
::getManager();
653 $pageHierarchy = $subclass ?
array(array(Request
::url(null, 'user'), 'navigation.user'), array(Request
::url(null, 'productionEditor'), 'user.role.productionEditor'), array(Request
::url(null, 'productionEditor'), 'manuscript.submissions'))
654 : array(array(Request
::url(null, 'user'), 'navigation.user'), array(Request
::url(null, 'productionEditor'), 'user.role.productionEditor'));
656 $templateMgr->assign('pageHierarchy', $pageHierarchy);
660 * Validate that user has production editor permissions in the selected press.
661 * Redirects to user index page if not properly authenticated.
663 function validate($monographId = null, $reason = null) {
666 $press =& Request
::getPress();
667 $productionEditorSubmission = null;
670 if ($monographId != null) {
671 $productionEditorSubmissionDao =& DAORegistry
::getDAO('ProductionEditorSubmissionDAO');
672 $productionEditorSubmission =& $productionEditorSubmissionDao->getById($monographId, $press->getId());
674 if ($productionEditorSubmission == null) {
677 } else if ($productionEditorSubmission->getPressId() != $press->getId()) {
680 } else if ($productionEditorSubmission->getDateSubmitted() == null) {
685 if (!isset($press) ||
!Validation
::isProductionEditor($press->getId())) {
686 Validation
::redirectLogin($reason);
690 Request
::redirect(null, Request
::getRequestedPage());
693 $this->press
=& $press;
694 $this->submission
=& $productionEditorSubmission;
699 * Notify the layout editor.
701 function notifyLayoutDesigner($args) {
702 $monographId = Request
::getUserVar('monographId');
703 $layoutAssignmentId = Request
::getUserVar('assignmentId');
704 $this->validate($monographId);
705 $submission =& $this->submission
;
707 $send = Request
::getUserVar('send') ?
true : false;
708 $this->setupTemplate(true, $monographId, 'editing');
710 if (ProductionEditorAction
::notifyDesigner($submission, $assignmentId, $send)) {
711 Request
::redirect(null, null, 'submissionLayout', $monographId);
716 * Thank the layout designer.
718 function thankLayoutDesigner($args) {
719 $monographId = Request
::getUserVar('monographId');
720 $assignmentId = Request
::getUserVar('assignmentId');
721 $this->validate($monographId);
722 $press =& $this->press
;
723 $submission =& $this->submission
;
725 $send = Request
::getUserVar('send') ?
true : false;
726 $this->setupTemplate(true, $monographId, 'editing');
728 if (ProductionEditorAction
::thankLayoutDesigner($submission, $assignmentId, $send)) {
729 Request
::redirect(null, null, 'submissionLayout', $monographId);
734 * Create a new galley with the uploaded file.
736 function uploadGalley($args) {
737 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
738 $this->validate($monographId);
740 import('submission.form.MonographGalleyForm');
741 $productionAssignmentId = Request
::getUserVar('productionAssignmentId');
743 $galleyForm = new MonographGalleyForm($monographId);
744 $galleyId = $galleyForm->execute('galleyFile', $productionAssignmentId);
746 Request
::redirect(null, null, 'editGalley', array($monographId, $galleyId));
751 * @param $args array ($monographId, $galleyId)
753 function editGalley($args) {
754 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
755 $galleyId = isset($args[1]) ?
(int) $args[1] : 0;
756 $this->validate($monographId);
757 $press =& $this->press
;
758 $submission =& $this->submission
;
760 $this->setupTemplate(true, $monographId, 'editing');
762 import('submission.form.MonographGalleyForm');
764 $submitForm = new MonographGalleyForm($monographId, $galleyId);
766 if ($submitForm->isLocaleResubmit()) {
767 $submitForm->readInputData();
769 $submitForm->initData();
771 $submitForm->display();
775 * Save changes to a galley.
776 * @param $args array ($monographId, $galleyId)
778 function saveGalley($args) {
779 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
780 $galleyId = isset($args[1]) ?
(int) $args[1] : 0;
781 $this->validate($monographId);
782 $press =& $this->press
;
783 $submission =& $this->submission
;
785 import('submission.form.MonographGalleyForm');
787 $submitForm = new MonographGalleyForm($monographId, $galleyId);
789 $submitForm->readInputData();
790 if ($submitForm->validate()) {
791 $submitForm->execute();
793 if (Request
::getUserVar('uploadImage')) {
794 $submitForm->uploadImage();
795 Request
::redirect(null, null, 'editGalley', array($monographId, $galleyId));
796 } else if(($deleteImage = Request
::getUserVar('deleteImage')) && count($deleteImage) == 1) {
797 list($imageId) = array_keys($deleteImage);
798 $submitForm->deleteImage($imageId);
799 Request
::redirect(null, null, 'editGalley', array($monographId, $galleyId));
801 Request
::redirect(null, null, 'submissionLayout', $monographId);
803 $this->setupTemplate(true, $monographId, 'editing');
804 $submitForm->display();
809 * Change the sequence order of a galley.
811 function orderGalley() {
812 $monographId = Request
::getUserVar('monographId');
813 $this->validate($monographId);
814 $press =& $this->press
;
815 $submission =& $this->submission
;
817 ProductionEditorAction
::orderGalley($submission, Request
::getUserVar('galleyId'), Request
::getUserVar('d'));
819 Request
::redirect(null, null, 'submissionLayout', $monographId);
823 * Delete a galley file.
824 * @param $args array ($monographId, $galleyId)
826 function deleteGalley($args) {
827 $monographId = isset($args[0]) ?
(int) $args[0] : 0;
828 $galleyId = isset($args[1]) ?
(int) $args[1] : 0;
829 $this->validate($monographId);
830 $submission =& $this->submission
;
832 ProductionEditorAction
::deleteGalley($submission, $galleyId);
834 Request
::redirect(null, null, 'submissionLayout', $monographId);