14 import(
'lib.pkp.classes.controllers.grid.GridHandler');
15 import(
'plugins.generic.sword.controllers.grid.SwordDepositPointsGridRow');
16 import(
'plugins.generic.sword.controllers.grid.SwordDepositPointsGridCellProvider');
34 parent::__construct();
36 array(ROLE_ID_MANAGER),
37 array(
'index',
'fetchGrid',
'fetchRow',
'addDepositPoint',
'editDepositPoint',
'updateDepositPoint',
'delete')
44 function authorize($request, &$args, $roleAssignments) {
45 import(
'lib.pkp.classes.security.authorization.ContextAccessPolicy');
47 return parent::authorize($request, $args, $roleAssignments);
54 parent::initialize($request);
55 $context = $request->getContext();
58 $this->
setTitle(
'plugins.generic.sword.settings.depositPoints');
62 self::$plugin->import(
'classes.DepositPoint');
64 $depositPoints = $depositPointDao->getByContextId($context->getId());
68 $router = $request->getRouter();
69 import(
'lib.pkp.classes.linkAction.request.AjaxModal');
74 $router->url($request,
null,
null,
'addDepositPoint'),
75 __(
'plugins.generic.sword.depositPoints.create'),
78 __(
'plugins.generic.sword.depositPoints.create'),
87 'plugins.generic.sword.depositPoints.name',
89 'controllers/grid/gridCell.tpl',
94 'plugins.importexport.sword.depositUrl',
96 'controllers/grid/gridCell.tpl',
103 'controllers/grid/gridCell.tpl',
120 public function index($args, $request) {
122 $dispatcher = $request->getDispatcher();
123 return $templateMgr->fetchAjax(
124 'swordDepositPointsGridContainer',
126 $request, ROUTE_COMPONENT,
null,
127 'plugins.generic.sword.controllers.grid.SwordDepositPointsGridHandler',
149 $depositPointId = $request->getUserVar(
'depositPointId');
150 $context = $request->getContext();
152 self::$plugin->import(
'controllers.grid.form.SwordDepositPointForm');
153 $swordDepositPointForm =
new SwordDepositPointForm(self::$plugin, $context->getId(), $depositPointId);
154 $swordDepositPointForm->initData();
155 return new JSONMessage(
true, $swordDepositPointForm->fetch($request));
165 $depositPointId = $request->getUserVar(
'depositPointId');
166 $context = $request->getContext();
169 self::$plugin->import(
'controllers.grid.form.SwordDepositPointForm');
170 $swordDepositPointForm =
new SwordDepositPointForm(self::$plugin, $context->getId(), $depositPointId);
171 $swordDepositPointForm->readInputData($request);
173 if ($swordDepositPointForm->validate()) {
174 $swordDepositPointForm->execute();
178 return new JSONMessage(
true, $swordDepositPointForm->fetch($request));
188 public function delete($args, $request) {
189 $depositPointId = $request->getUserVar(
'depositPointId');
190 $context = $request->getContext();
193 $depositPointDao->deleteById($depositPointId, $context->getId());