-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzenonIdPlugin.inc.php
executable file
·217 lines (181 loc) · 6.21 KB
/
zenonIdPlugin.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
<?php
/**
* @file plugins/pubIds/zenon/zenonIdPlugin.inc.php
*
*
* @class zenonPubIdPlugin
* @ingroup plugins_pubIds_zenon
*
* @brief zenon plugin class
*/
use APP\plugins\PubIdPlugin;
class zenonIdPlugin extends PubIdPlugin {
/**
* @copydoc Plugin::register()
*/
public function register($category, $path, $mainContextId = null) {
$success = parent::register($category, $path, $mainContextId);
if (!Config::getVar('general', 'installed') || defined('RUNNING_UPGRADE')) return $success;
if ($success && $this->getEnabled($mainContextId)) {
// HookRegistry::register('CitationStyleLanguage::citation', array($this, 'getCitationData'));
// HookRegistry::register('Publication::getProperties::summaryProperties', array($this, 'modifyObjectProperties'));
// HookRegistry::register('Publication::getProperties::fullProperties', array($this, 'modifyObjectProperties'));
// HookRegistry::register('Publication::validate', array($this, 'validatePublicationDoi'));
// HookRegistry::register('Issue::getProperties::summaryProperties', array($this, 'modifyObjectProperties'));
// HookRegistry::register('Issue::getProperties::fullProperties', array($this, 'modifyObjectProperties'));
// HookRegistry::register('Galley::getProperties::summaryProperties', array($this, 'modifyObjectProperties'));
// HookRegistry::register('Galley::getProperties::fullProperties', array($this, 'modifyObjectProperties'));
// HookRegistry::register('Publication::getProperties::values', array($this, 'modifyObjectPropertyValues'));
// HookRegistry::register('Issue::getProperties::values', array($this, 'modifyObjectPropertyValues'));
// HookRegistry::register('Galley::getProperties::values', array($this, 'modifyObjectPropertyValues'));
HookRegistry::register('Form::config::before', array($this, 'addPublicationFormFields'));
// HookRegistry::register('Form::config::before', array($this, 'addPublishFormNotice'));
}
return $success;
}
// function getPubId($pubObject) {
// $zenonId = $pubObject->getData('zenonId');
// if ($zenonId) {
// $this->setStoredPubId($pubObject, $zenonId);
// $pubObject->setData('zenonId', null);
// return $zenonId;
// }
// $storedPubId = $pubObject->getStoredPubId($this->getPubIdType());
// if ($storedPubId) return $storedPubId;
// return "";
// }
/**
* Name in plugin list
*/
function getDisplayName() {
return __('plugins.pubIds.zenon.displayName');
}
/**
* Description in plugin list
*/
function getDescription() {
return __('plugins.pubIds.zenon.description');
}
function getPubIdType() {
return 'other::zenon';
}
function getPubIdDisplayType() {
return 'iDAI.bibliography/Zenon';
}
function getPubIdFullName() {
return 'iDAI.bibliography/Zenon Fullname, wo taucht das auf?';
}
function getResolvingURL($contextId, $pubId) {
return "https://zenon.dainst.org/Record/" . $pubId;
}
// function verifyData($fieldName, $fieldValue, $pubObject, $contextId, &$errorMsg) {
// $pubObject->setData('pub-id::other::zenon', null); // THIS is really important. it's hack which makes the pub-id always changeable
// return true;
// }
function getDAOFieldNames() {
return array('pub-id::other::zenon');
}
/**
* Add Zenon ID to submission
*
* @param $hookName string <Object>::getProperties::summaryProperties or
* <Object>::getProperties::fullProperties
* @param $args array [
* @option $props array Existing properties
* @option $object Submission|Issue|Galley
* @option $args array Request args
* ]
*
* @return array
*/
public function modifyObjectProperties($hookName, $args) {
$props =& $args[0];
$props[] = 'pub-id::other::zenon';
}
/**
* Add Zenon ID fields to the publication identifiers form
*
* @param $hookName string Form::config::before
* @param $form FormComponent The form object
*/
public function addPublicationFormFields($hookName, $form) {
if ($form->id !== 'publicationIdentifiers') {
return;
}
$fieldData = [
'label' => $this->getPubIdDisplayType(),
'value' => $form->publication->getData('pub-id::other::zenon'),
'description' => __('plugins.pubIds.zenon.editor.description'),
'submissionId' => $form->publication->getData('submissionId'),
// 'assignIdLabel' => __('plugins.pubIds.zenon.editor.zenon.assignZenon'),
// 'clearIdLabel' => __('plugins.pubIds.zenon.editor.clearObjectsZenon'),
];
$form->addField(new \PKP\components\forms\FieldPubId('pub-id::other::zenon', $fieldData));
}
/**
* abstract functions we don't use but need to implement
*/
/**
* Because we inheriting base class PubIdPlugin we have to implement this method,
* but have no use for it. This will just display a simple message.
* See 'templates/settingsForm.tpl'.
*/
function instantiateSettingsForm($contextId) {
$this->import('classes.form.zenonSettingsForm');
return new zenonSettingsForm($this, $contextId);
}
/**
* Same as instantiateSettingsForm.
* See 'templates/zenonIdEdit.tmp'.
*/
function getPubIdAssignFile() {
return $this->getTemplateResource('zenonIdEdit.tpl');
}
/**
* Same as instantiateSettingsForm.
* See 'templates/zenonIdEdit.tmp'.
*/
function getPubIdMetadataFile() {
return $this->getTemplateResource('zenonIdEdit.tpl');
}
function getFormFieldNames() {
return array();
// return array("zenonId"); //'pub-id::other::zenon'
}
function getAssignFormFieldName() {
return '';
// return 'assignZenon';
}
// function addJavaScript($request, $templateMgr) {
// $templateMgr->addJavaScript(
// 'urnCheckNo',
// $request->getBaseUrl() . DIRECTORY_SEPARATOR . $this->getPluginPath() . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'checkNumber.js',
// array(
// 'inline' => false,
// 'contexts' => 'publicIdentifiersForm',
// )
// );
// }
function constructPubId($pubIdPrefix, $pubIdSuffix, $contextId) {
return "";
}
function isObjectTypeEnabled($pubObjectType, $contextId) {
return false;
}
function getPrefixFieldName() {
return '';
}
function getSuffixFieldName() {
return '';
}
function getLinkActions($pubObject) {
return array();
}
function getSuffixPatternsFieldNames() {
return array();
}
function getNotUniqueErrorMsg() {
return __('plugins.pubIds.zenon.editor.not_unique');
}
}
?>