14 import(
'lib.pkp.classes.form.Form');
33 $this->_plugin = $plugin;
34 $this->_context = $context;
35 $this->_submission = $submission;
54 'authorDepositUsername',
55 'authorDepositPassword',
67 $templateMgr->assign(array(
68 'depositPoints' => $depositPoints,
69 'submission' => $this->_submission,
70 'allowAuthorSpecify' => $this->
getSwordPlugin()->getSetting($this->_context->getId(),
'allowAuthorSpecify'),
71 'pluginJavaScriptURL' => $this->_plugin->getJsUrl($request),
80 public function execute($request) {
81 $user = $request->getUser();
86 $deposit->setMetadata($request);
87 $deposit->addEditorial();
88 $deposit->createPackage();
90 $allowAuthorSpecify = $this->
getSwordPlugin()->getSetting($this->_context->getId(),
'allowAuthorSpecify');
91 $authorDepositUrl = $this->
getData(
'authorDepositUrl');
92 if (($allowAuthorSpecify) && ($authorDepositUrl !=
'')) {
95 $this->
getData(
'authorDepositUrl'),
96 $this->
getData(
'authorDepositUsername'),
97 $this->
getData(
'authorDepositPassword')
100 'itemTitle' => $this->_submission->getLocalizedTitle(),
101 'repositoryName' => $this->getData(
'authorDepositUrl')
103 $notificationManager->createTrivialNotification(
105 NOTIFICATION_TYPE_SUCCESS,
106 array(
'contents' => __(
'plugins.generic.sword.depositComplete', $params))
109 catch(Exception $e) {
110 $contents = __(
'plugins.importexport.sword.depositFailed') .
': ' . $e->getMessage();
111 $notificationManager->createTrivialNotification(
113 NOTIFICATION_TYPE_ERROR,
114 array(
'contents' => $contents)
116 error_log($e->getTraceAsString());
122 $depositPoints = $this->
getData(
'depositPoint');
124 foreach ($depositableDepositPoints as $key => $depositPoint) {
125 if (!isset($depositPoints[$key][
'enabled']))
127 if ($depositPoint[
'type'] == SWORD_DEPOSIT_TYPE_OPTIONAL_SELECTION) {
128 $url = $depositPoints[$key][
'depositPoint'];
130 $url = $depositPoint[
'url'];
135 $depositPoint[
'username'],
136 $depositPoint[
'password'],
137 $depositPoint[
'apikey']
140 'itemTitle' => $this->_submission->getLocalizedTitle(),
141 'repositoryName' => $depositPoint[
'name']
143 $notificationManager->createTrivialNotification(
145 NOTIFICATION_TYPE_SUCCESS,
146 array(
'contents' => __(
'plugins.generic.sword.depositComplete', $params))
149 catch(Exception $e) {
150 $contents = __(
'plugins.importexport.sword.depositFailed') .
': ' . $e->getMessage();
151 $notificationManager->createTrivialNotification(
153 NOTIFICATION_TYPE_ERROR,
154 array(
'contents' => $contents)
156 error_log($e->getTraceAsString());
172 $depositPoints = $depositPointDao->getByContextId($context->getId(),
null);
173 while ($depositPoint = $depositPoints->next()) {
174 if (!in_array($depositPoint->getType(), array(SWORD_DEPOSIT_TYPE_OPTIONAL_SELECTION, SWORD_DEPOSIT_TYPE_OPTIONAL_FIXED)))
177 $list[$depositPoint->getId()][
'name'] = $depositPoint->getLocalizedName();
178 $list[$depositPoint->getId()][
'url'] = $depositPoint->getSwordUrl();
179 $list[$depositPoint->getId()][
'type'] = $depositPoint->getType();
180 $list[$depositPoint->getId()][
'username'] = $depositPoint->getSwordUsername();
181 $list[$depositPoint->getId()][
'password'] = $depositPoint->getSwordPassword();
182 $list[$depositPoint->getId()][
'apikey'] = $depositPoint->getSwordApikey();
183 if ($depositPoint->getType() == SWORD_DEPOSIT_TYPE_OPTIONAL_SELECTION) {
185 $depositPoint->getSwordUrl(),
186 $depositPoint->getSwordUsername(),
187 $depositPoint->getSwordPassword(),
188 $depositPoint->getSwordApikey()
190 $list[$depositPoint->getId()][
'depositPoints'] = $collections;