diff --git a/OASwitchboardPlugin.php b/OASwitchboardPlugin.php
index 5c96594..65be240 100644
--- a/OASwitchboardPlugin.php
+++ b/OASwitchboardPlugin.php
@@ -30,6 +30,7 @@ public function register($category, $path, $mainContextId = null)
if ($success && $this->getEnabled()) {
$message = new Message($this);
$resources = new Resources($this);
+ Hook::add('Template::Workflow::Publication', [$message, 'addSubmissionStatusToWorkflow']);
Hook::add('Publication::publish', [$message, 'sendToOASwitchboard']);
Hook::add('TemplateManager::display', [$resources, 'addWorkflowNotificationsJavaScript']);
Hook::add('Form::config::before', [$message, 'validateBeforePublicationEvent']);
diff --git a/classes/Message.php b/classes/Message.php
index d406fab..56222c6 100644
--- a/classes/Message.php
+++ b/classes/Message.php
@@ -89,6 +89,46 @@ public function validateBeforePublicationEvent($hookName, $form)
return false;
}
+ public function addSubmissionStatusToWorkflow($hookName, $params)
+ {
+ $smarty = &$params[1];
+ $output = &$params[2];
+ $request = Application::get()->getRequest();
+
+ $submission = $smarty->getTemplateVars('submission');
+ $contextId = $request->getContext()->getId();
+
+ try {
+ OASwitchboardService::validatePluginIsConfigured($this->plugin, $contextId);
+ } catch (\Exception $e) {
+ $message = '
' . $e->getMessage() . '
';
+ $smarty->assign([
+ 'pluginIsNotConfiguredInfo' => $message,
+ ]);
+ }
+
+ try {
+ $p1Pio = new P1Pio($submission);
+ $successMessage = $this->getSubmissionAlreadyToSendMessage($submission);
+ $smarty->assign([
+ 'submissionIsAlreadySendMessage' => $successMessage,
+ ]);
+ } catch (P1PioException $e) {
+ if ($e->getP1PioErrors()) {
+ $errorMessage = $this->getMandatoryDataErrorMessage($e->getP1PioErrors(), $submission);
+ $smarty->assign([
+ 'submissionRequirementsIsPending' => $errorMessage,
+ ]);
+ }
+ }
+
+ $output .= sprintf(
+ '%s',
+ __('plugins.generic.OASwitchboard.workflowTab.label'),
+ $smarty->fetch($this->plugin->getTemplateResource('submissionStatus.tpl'))
+ );
+ }
+
private function registerSubmissionEventLog($request, $submission, $error)
{
$eventLog = Repo::eventLog()->newDataObject([
diff --git a/locale/en/locale.po b/locale/en/locale.po
index fe42b2b..7e1b1d8 100644
--- a/locale/en/locale.po
+++ b/locale/en/locale.po
@@ -72,3 +72,9 @@ msgstr "You may review these metadata, or proceed with the publication without s
msgid "plugins.generic.OASwitchboard.postRequirementsSuccess"
msgstr "OA Switchboard: the requirements have been met and the P1 message will be sent to the OA Switchboard upon publishing the submission."
+
+msgid "plugins.generic.OASwitchboard.workflowTab.label"
+msgstr "OA Switchboard"
+
+msgid "plugins.generic.OASwitchboard.workflowTab.title"
+msgstr "Status of message sent to OA Switchboard"
\ No newline at end of file
diff --git a/locale/es/locale.po b/locale/es/locale.po
index 16ed8d0..3947640 100644
--- a/locale/es/locale.po
+++ b/locale/es/locale.po
@@ -71,4 +71,10 @@ msgid "plugins.generic.OASwitchboard.postRequirementsError.conclusionText"
msgstr "Puede revisar estos metadatos o continuar con la publicación sin enviar el mensaje al OA Switchboard."
msgid "plugins.generic.OASwitchboard.postRequirementsSuccess"
-msgstr "OA Switchboard: se han cumplido los requisitos y el mensaje P1 será enviado al OA Switchboard al publicar la publicacíon."
\ No newline at end of file
+msgstr "OA Switchboard: se han cumplido los requisitos y el mensaje P1 será enviado al OA Switchboard al publicar la publicacíon."
+
+msgid "plugins.generic.OASwitchboard.workflowTab.label"
+msgstr "OA Switchboard"
+
+msgid "plugins.generic.OASwitchboard.workflowTab.title"
+msgstr "Estado del Envío del Mensaje al OA Switchboard"
\ No newline at end of file
diff --git a/locale/pt_BR/locale.po b/locale/pt_BR/locale.po
index ee46fd6..3330b21 100644
--- a/locale/pt_BR/locale.po
+++ b/locale/pt_BR/locale.po
@@ -69,4 +69,10 @@ msgid "plugins.generic.OASwitchboard.postRequirementsError.conclusionText"
msgstr "Você pode rever estes metadados, ou continuar com a publicação sem o envio da mensagem para o OA Switchboard."
msgid "plugins.generic.OASwitchboard.postRequirementsSuccess"
-msgstr "OA Switchboard: os requisitos foram atendidos e a mensagem P1 será enviada ao OA Switchboard ao publicar a submissão."
\ No newline at end of file
+msgstr "OA Switchboard: os requisitos foram atendidos e a mensagem P1 será enviada ao OA Switchboard ao publicar a submissão."
+
+msgid "plugins.generic.OASwitchboard.workflowTab.label"
+msgstr "OA Switchboard"
+
+msgid "plugins.generic.OASwitchboard.workflowTab.title"
+msgstr "Situação do envio da mensagem para o OA Switchboard"
\ No newline at end of file
diff --git a/templates/submissionStatus.tpl b/templates/submissionStatus.tpl
new file mode 100644
index 0000000..399a177
--- /dev/null
+++ b/templates/submissionStatus.tpl
@@ -0,0 +1,13 @@
+{translate key="plugins.generic.OASwitchboard.workflowTab.title"}
+
+{if $pluginIsNotConfiguredInfo}
+ {$pluginIsNotConfiguredInfo}
+{else}
+ {if $submissionIsAlreadySendMessage}
+ {$submissionIsAlreadySendMessage}
+ {/if}
+
+ {if $submissionRequirementsIsPending}
+ {$submissionRequirementsIsPending}
+ {/if}
+{/if}
\ No newline at end of file
diff --git a/version.xml b/version.xml
index 859e612..759345f 100644
--- a/version.xml
+++ b/version.xml
@@ -12,6 +12,6 @@
OASwitchboard
plugins.generic
- 2.0.1.14
- 2024-11-04
+ 2.0.1.15
+ 2024-12-27