Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
PublicationFormatHandler.inc.php
1 <?php
2 
16 import('classes.handler.Handler');
17 
18 // import UI base classes
19 import('lib.pkp.classes.linkAction.LinkAction');
20 import('lib.pkp.classes.linkAction.request.AjaxModal');
21 
27  parent::Handler();
28 
29  $this->addRoleAssignment(
30  array(ROLE_ID_SUB_EDITOR, ROLE_ID_MANAGER, ROLE_ID_ASSISTANT),
31  array('fetchPublicationFormat')
32  );
33  }
34 
35 
36  //
37  // Implement template methods from PKPHandler
38  //
42  function authorize($request, &$args, $roleAssignments) {
43  // Get the publication Format Policy
44  import('classes.security.authorization.internal.PublicationFormatRequiredPolicy');
45  $publicationFormatPolicy = new PublicationFormatRequiredPolicy($request, $args);
46 
47  // Get the workflow stage policy
48  import('classes.security.authorization.WorkflowStageAccessPolicy');
49  $stagePolicy = new WorkflowStageAccessPolicy($request, $args, $roleAssignments, 'submissionId', WORKFLOW_STAGE_ID_PRODUCTION);
50 
51  // Add the Publication Format policy to the stage policy.
52  $stagePolicy->addPolicy($publicationFormatPolicy);
53 
54  // Add the augmented policy to the handler.
55  $this->addPolicy($stagePolicy);
56  return parent::authorize($request, $args, $roleAssignments);
57  }
58 
62  function initialize($request, $args) {
63  $this->setupTemplate($request);
64  }
65 
70  function setupTemplate($request) {
71  parent::setupTemplate($request);
72  AppLocale::requireComponents(LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_APP_SUBMISSION, LOCALE_COMPONENT_APP_EDITOR);
73 
74  $templateMgr = TemplateManager::getManager($request);
75 
76  $monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
77  $stageId = $this->getAuthorizedContextObject(ASSOC_TYPE_WORKFLOW_STAGE);
78  $publicationFormat =& $this->getAuthorizedContextObject(ASSOC_TYPE_PUBLICATION_FORMAT);
79 
80  // Assign the authorized monograph.
81  $templateMgr->assign_by_ref('submission', $monograph);
82  $templateMgr->assign('stageId', $stageId);
83  $templateMgr->assign_by_ref('publicationFormat', $publicationFormat);
84  }
85 
86 
87  //
88  // Public operations
89  //
95  function fetchPublicationFormat($args, $request) {
96  // Fetch the template
97  $templateMgr = TemplateManager::getManager($request);
98  return $templateMgr->fetchJson('workflow/publicationFormat.tpl');
99  }
100 }
101 
102 ?>
addPolicy($authorizationPolicy, $addToTop=false)
authorize($request, &$args, $roleAssignments)
Policy that ensures that the request contains a valid publication format.
static requireComponents()
Class to control access to OMP&#39;s submission workflow stage components.
addRoleAssignment($roleIds, $operations)
Publication format sub-page handler.
Base request handler application class.
Definition: Handler.inc.php:20
& getAuthorizedContextObject($assocType)