-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFidusWriterRevisionHandler.inc.php
43 lines (36 loc) · 1.22 KB
/
FidusWriterRevisionHandler.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
import('classes.handler.Handler');
class FidusWriterRevisionHandler extends Handler {
function initialize($request, $args = null)
{
parent::initialize($request);
AppLocale::requireComponents(
LOCALE_COMPONENT_PKP_GRID
);
}
function showCreateFidusRevisionForm($args, $request)
{
$plugin = FidusWriterPluginHelper::getFidusWriterPlugin();
$formTemplate = $plugin->getTemplateResource('createRevisionForm.tpl');
$plugin->import('form.FidusWriterCreateRevisionForm');
$form = new FidusWriterCreateRevisionForm($formTemplate);
if ($request->getUserVar('save')) {
$form->readInputData();
if ($form->validate()) {
$form->execute($plugin);
return DAO::getDataChangedEvent();
}
} else {
$reviewRoundDao = DAORegistry::getDAO('ReviewRoundDAO');
$reviewRound = $reviewRoundDao->getById($args['review_round_id']);
$form->setData('reviewRoundStatus', $reviewRound->getStatus());
$form->setData('reviewRoundId', $args['review_round_id']);
$form->setData('oldVersion', $args['old_version']);
$form->setData('newVersion', $args['new_version']);
$form->setData('apiKey', $args['key']);
$form->initData();
return new JSONMessage(true, $form->fetch($request));
}
return null;
}
}