first commit
This commit is contained in:
@@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/AnnouncementNotify.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class AnnouncementNotify
|
||||
*
|
||||
* @brief Email sent to notify users about new announcement
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\core\Application;
|
||||
use PKP\announcement\Announcement;
|
||||
use PKP\context\Context;
|
||||
use PKP\core\PKPApplication;
|
||||
use PKP\facades\Locale;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\mail\traits\Unsubscribe;
|
||||
use PKP\security\Role;
|
||||
|
||||
class AnnouncementNotify extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Unsubscribe;
|
||||
|
||||
protected static ?string $name = 'mailable.announcementNotify.name';
|
||||
protected static ?string $description = 'mailable.announcementNotify.description';
|
||||
protected static ?string $emailTemplateKey = 'ANNOUNCEMENT';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_READER];
|
||||
|
||||
protected static string $announcementTitle = 'announcementTitle';
|
||||
protected static string $announcementSummary = 'announcementSummary';
|
||||
protected static string $announcementUrl = 'announcementUrl';
|
||||
|
||||
protected Announcement $announcement;
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(Context $context, Announcement $announcement)
|
||||
{
|
||||
parent::__construct(array_slice(func_get_args(), 0, -1));
|
||||
$this->announcement = $announcement;
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add description to a new email template variables
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
$variables[static::$announcementTitle] = __('emailTemplate.variable.announcementTitle');
|
||||
$variables[static::$announcementSummary] = __('emailTemplate.variable.announcementSummary');
|
||||
$variables[static::$announcementUrl] = __('emailTemplate.variable.announcementUrl');
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set localized email template variables
|
||||
*/
|
||||
public function setData(?string $locale = null): void
|
||||
{
|
||||
parent::setData($locale);
|
||||
if (is_null($locale)) {
|
||||
$locale = Locale::getLocale();
|
||||
}
|
||||
|
||||
$request = Application::get()->getRequest();
|
||||
$dispatcher = $request->getDispatcher();
|
||||
$this->viewData = array_merge(
|
||||
$this->viewData,
|
||||
[
|
||||
static::$announcementTitle => $this->announcement->getData('title', $locale),
|
||||
static::$announcementSummary => $this->announcement->getData('descriptionShort', $locale),
|
||||
static::$announcementUrl => $dispatcher->url(
|
||||
$request,
|
||||
PKPApplication::ROUTE_PAGE,
|
||||
$this->context->getData('urlPath'),
|
||||
'announcement',
|
||||
'view',
|
||||
$this->announcement->getId()
|
||||
),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a footer with unsubscribe link
|
||||
*/
|
||||
protected function addFooter(string $locale): Mailable
|
||||
{
|
||||
$this->setupUnsubscribeFooter($locale, $this->context);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionAcceptNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionAcceptNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decisions is made:
|
||||
* Decision::ACCEPT
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\ReviewerComments;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class DecisionAcceptNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use ReviewerComments;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.accept.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.accept.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_ACCEPT';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
/**
|
||||
* @param array<ReviewAssignment> $reviewAssignments
|
||||
*/
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments)
|
||||
{
|
||||
parent::__construct(array_slice(func_get_args(), 0, -1));
|
||||
$this->setupReviewerCommentsVariable($reviewAssignments, $submission);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return self::addReviewerCommentsDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionBackFromCopyeditingNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionBackFromCopyeditingNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when following decisions are made :
|
||||
* Decision::BACK_FROM_COPYEDITING
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionBackFromCopyeditingNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.backFromCopyediting.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.backFromCopyediting.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_BACK_FROM_COPYEDITING';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_COPYEDITING];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionBackFromProductionNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionBackFromProductionNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decision is made:
|
||||
* Decision::BACK_FROM_PRODUCTION
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionBackFromProductionNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.backToCopyediting.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.backToCopyediting.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_BACK_FROM_PRODUCTION';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_PRODUCTION];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionCancelReviewRoundNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionCancelReviewRoundNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decision is made:
|
||||
* Decision::CANCEL_REVIEW_ROUND
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionCancelReviewRoundNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.cancelReviewRound.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.cancelReviewRound.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_CANCEL_REVIEW_ROUND';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionDeclineNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionDeclineNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decisions are made:
|
||||
* Decision::DECLINE
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\ReviewerComments;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class DecisionDeclineNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use ReviewerComments;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.decline.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.decline.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_DECLINE';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
/**
|
||||
* @param array<ReviewAssignment> $reviewAssignments
|
||||
*/
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments)
|
||||
{
|
||||
parent::__construct(array_slice(func_get_args(), 0, -1));
|
||||
$this->setupReviewerCommentsVariable($reviewAssignments, $submission);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return self::addReviewerCommentsDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionInitialDeclineNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionInitialDeclineNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decision is made
|
||||
* Decision::INITIAL_DECLINE
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionInitialDeclineNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.initialDecline.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.initialDecline.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_INITIAL_DECLINE';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionNewReviewRoundNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionNewReviewRoundNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decisions are made:
|
||||
* Decision::NEW_EXTERNAL_ROUND
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionNewReviewRoundNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.newReviewRound.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.newReviewRound.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_NEW_ROUND';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionNotifyOtherAuthors.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionNotifyOtherAuthors
|
||||
*
|
||||
* @brief Email sent to other authors of a submission when an editorial decision
|
||||
* is made. These are authors with metadata records on the publication who are
|
||||
* not assigned as participants to the submission workflow.
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\facades\Locale;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\user\User;
|
||||
|
||||
class DecisionNotifyOtherAuthors extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Sender;
|
||||
|
||||
/** @var string An email variable that contains the message that was sent to the submitting author */
|
||||
public const MESSAGE_TO_SUBMITTING_AUTHOR = 'messageToSubmittingAuthor';
|
||||
public const SUBMITTING_AUTHOR_NAME = 'submittingAuthorName';
|
||||
|
||||
protected static ?string $name = 'mailable.decision.notifyOtherAuthors.name';
|
||||
protected static ?string $description = 'mailable.decision.notifyOtherAuthors.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_NOTIFY_OTHER_AUTHORS';
|
||||
protected static array $groupIds = [
|
||||
self::GROUP_SUBMISSION,
|
||||
self::GROUP_REVIEW,
|
||||
self::GROUP_COPYEDITING,
|
||||
self::GROUP_PRODUCTION,
|
||||
];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
/** @var User[] */
|
||||
protected array $assignedAuthors;
|
||||
|
||||
public function __construct(Context $context, Submission $submission, array $assignedAuthors)
|
||||
{
|
||||
parent::__construct([$context, $submission]);
|
||||
|
||||
$this->assignedAuthors = $assignedAuthors;
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
$variables[self::MESSAGE_TO_SUBMITTING_AUTHOR] = __('mailable.decision.notifyOtherAuthors.variable.message.description');
|
||||
$variables[self::SUBMITTING_AUTHOR_NAME] = __('emailTemplate.variable.submission.submittingAuthorName');
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set submitting author name email template variable
|
||||
*/
|
||||
public function setData(?string $locale = null): void
|
||||
{
|
||||
parent::setData($locale);
|
||||
|
||||
if (is_null($locale)) {
|
||||
$locale = Locale::getLocale();
|
||||
}
|
||||
|
||||
$this->viewData[self::SUBMITTING_AUTHOR_NAME] = $this->getSubmittingAuthorName($locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* The name(s) of authors assigned as participants to the
|
||||
* submission workflow.
|
||||
*
|
||||
* Usually this is the submitting author.
|
||||
*/
|
||||
protected function getSubmittingAuthorName(string $locale): string
|
||||
{
|
||||
$authorNames = [];
|
||||
foreach ($this->assignedAuthors as $user) {
|
||||
$authorNames[] = $user->getFullName(true, false, $locale);
|
||||
}
|
||||
return join(__('common.commaListSeparator'), $authorNames);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionNotifyReviewer.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionNotifyReviewer
|
||||
*
|
||||
* @brief Email sent to the reviewers who have completed a review in the review round
|
||||
* when the following decisions is made:
|
||||
* Decision::ACCEPT
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionNotifyReviewer extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
/** @var string An email variable that contains a description of the editorial decision */
|
||||
public const DECISION_DESCRIPTION = 'decisionDescription';
|
||||
|
||||
protected static ?string $name = 'mailable.decision.notifyReviewer.name';
|
||||
protected static ?string $description = 'mailable.decision.notifyReviewer.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_NOTIFY_REVIEWERS';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
protected Decision $decision;
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
$this->decision = $decision;
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
|
||||
public function getDecision(): Decision
|
||||
{
|
||||
return $this->decision;
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
$variables[self::DECISION_DESCRIPTION] = __('mailable.decision.notifyReviewer.variable.decisionDescription');
|
||||
return $variables;
|
||||
}
|
||||
|
||||
public function setData(?string $locale = null): void
|
||||
{
|
||||
parent::setData($locale);
|
||||
$this->viewData[self::DECISION_DESCRIPTION] = $this->getDecisionDescription($locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a description of the decision to use as an email variable
|
||||
*/
|
||||
protected function getDecisionDescription(?string $locale = null): string
|
||||
{
|
||||
switch ($this->decision->getData('decision')) {
|
||||
case Decision::ACCEPT: return __('mailable.decision.notifyReviewer.variable.decisionDescription.accept', [], $locale);
|
||||
case Decision::DECLINE: return __('mailable.decision.notifyReviewer.variable.decisionDescription.decline', [], $locale);
|
||||
case Decision::PENDING_REVISIONS: return __('mailable.decision.notifyReviewer.variable.decisionDescription.pendingRevisions', [], $locale);
|
||||
case Decision::RESUBMIT: return __('mailable.decision.notifyReviewer.variable.decisionDescription.resubmit', [], $locale);
|
||||
default: return '';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionRequestRevisionsNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionRequestRevisionsNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decisions are made:
|
||||
* Decision::PENDING_REVISIONS
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\ReviewerComments;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class DecisionRequestRevisionsNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use ReviewerComments;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.requestRevisions.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.requestRevisions.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_REVISIONS';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
/**
|
||||
* @param array<ReviewAssignment> $reviewAssignments
|
||||
*/
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments)
|
||||
{
|
||||
parent::__construct(array_slice(func_get_args(), 0, -1));
|
||||
$this->setupReviewerCommentsVariable($reviewAssignments, $submission);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return self::addReviewerCommentsDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionResubmitNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionResubmitNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decisions are made:
|
||||
* Decision::RESUBMIT
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\ReviewerComments;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class DecisionResubmitNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use ReviewerComments;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.resubmit.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.resubmit.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_RESUBMIT';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
/**
|
||||
* @param array<ReviewAssignment> $reviewAssignments
|
||||
*/
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments)
|
||||
{
|
||||
parent::__construct(array_slice(func_get_args(), 0, -1));
|
||||
$this->setupReviewerCommentsVariable($reviewAssignments, $submission);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return self::addReviewerCommentsDescription($variables);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionRevertDeclineNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionRevertDeclineNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decisions are made:
|
||||
* Decision::DECLINE
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionRevertDeclineNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.revertDecline.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.revertDecline.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_REVERT_DECLINE';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionRevertInitialDeclineNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionRevertInitialDeclineNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decisions are made:
|
||||
* Decision::REVERT_INITIAL_DECLINE
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionRevertInitialDeclineNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.revertInitialDecline.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.revertInitialDecline.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_REVERT_INITIAL_DECLINE';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionSendExternalReviewNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionSendExternalReviewNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when a the following decisions is made:
|
||||
* Decision::EXTERNAL_REVIEW
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class DecisionSendExternalReviewNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
public const REVIEW_TYPE_DESCRIPTION_VARIABLE = 'reviewTypeDescription';
|
||||
|
||||
protected static ?string $name = 'mailable.decision.sendExternalReview.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.sendExternalReview.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_SEND_TO_EXTERNAL';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
$this->setupReviewTypeVariable($context);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
return array_merge(
|
||||
parent::getDataDescriptions(),
|
||||
[
|
||||
static::REVIEW_TYPE_DESCRIPTION_VARIABLE => __('emailTemplate.variable.reviewType'),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
protected function setupReviewTypeVariable(Context $context)
|
||||
{
|
||||
switch ($context->getData('defaultReviewMode')) {
|
||||
case ReviewAssignment::SUBMISSION_REVIEW_METHOD_ANONYMOUS:
|
||||
$description = __('emailTemplate.variable.reviewType.anonymous');
|
||||
break;
|
||||
case ReviewAssignment::SUBMISSION_REVIEW_METHOD_OPEN:
|
||||
$description = __('emailTemplate.variable.reviewType.open');
|
||||
break;
|
||||
default:
|
||||
$description = __('emailTemplate.variable.reviewType.doubleAnonymous');
|
||||
}
|
||||
|
||||
$this->addData([
|
||||
static::REVIEW_TYPE_DESCRIPTION_VARIABLE => $description,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionSendToProductionNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionSendToProductionNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decisions are made:
|
||||
* Decision::SEND_TO_PRODUCTION
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionSendToProductionNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.sendToProduction.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.sendToProduction.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_SEND_TO_PRODUCTION';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_COPYEDITING];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DecisionSkipExternalReviewNotifyAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DecisionSkipExternalReviewNotifyAuthor
|
||||
*
|
||||
* @brief Email sent to the author(s) when the following decisions are made:
|
||||
* Decision::SKIP_EXTERNAL_REVIEW
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DecisionSkipExternalReviewNotifyAuthor extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.decision.skipReview.notifyAuthor.name';
|
||||
protected static ?string $description = 'mailable.decision.skipReview.notifyAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_DECISION_SKIP_REVIEW';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DiscussionCopyediting.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DiscussionCopyediting
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent when a new query is created or a note is added to a query on the copyediting workflow stage
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Discussion;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DiscussionCopyediting extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
use Discussion;
|
||||
|
||||
protected static ?string $name = 'mailable.discussionCopyediting.name';
|
||||
protected static ?string $description = 'mailable.discussionCopyediting.description';
|
||||
protected static ?string $emailTemplateKey = 'DISCUSSION_NOTIFICATION_COPYEDITING';
|
||||
protected static bool $canDisable = true;
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_COPYEDITING];
|
||||
protected static array $fromRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
];
|
||||
protected static array $toRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
];
|
||||
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(Context $context, Submission $submission)
|
||||
{
|
||||
parent::__construct([$context, $submission]);
|
||||
$this->context = $context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DiscussionProduction.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DiscussionProduction
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent when a new query is created or a note is added to a query on the production workflow stage
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Discussion;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DiscussionProduction extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
use Discussion;
|
||||
|
||||
protected static ?string $name = 'mailable.discussionProduction.name';
|
||||
protected static ?string $description = 'mailable.discussionProduction.description';
|
||||
protected static ?string $emailTemplateKey = 'DISCUSSION_NOTIFICATION_PRODUCTION';
|
||||
protected static bool $canDisable = true;
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_PRODUCTION];
|
||||
protected static array $fromRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
];
|
||||
protected static array $toRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
];
|
||||
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(Context $context, Submission $submission)
|
||||
{
|
||||
parent::__construct([$context, $submission]);
|
||||
$this->context = $context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DiscussionReview.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DiscussionReview
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent when a new query is created or a note is added to a query on the (external) review workflow stage
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Discussion;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DiscussionReview extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
use Discussion;
|
||||
|
||||
protected static ?string $name = 'mailable.discussionReview.name';
|
||||
protected static ?string $description = 'mailable.discussionReview.description';
|
||||
protected static ?string $emailTemplateKey = 'DISCUSSION_NOTIFICATION_REVIEW';
|
||||
protected static bool $canDisable = true;
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
];
|
||||
protected static array $toRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
];
|
||||
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(Context $context, Submission $submission)
|
||||
{
|
||||
parent::__construct([$context, $submission]);
|
||||
$this->context = $context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/DiscussionSubmission.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class DiscussionSubmission
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent when a new query is created or a note is added to a query on the submission workflow stage
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Discussion;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
|
||||
class DiscussionSubmission extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
use Discussion;
|
||||
|
||||
protected static ?string $name = 'mailable.discussionSubmission.name';
|
||||
protected static ?string $description = 'mailable.discussionSubmission.description';
|
||||
protected static ?string $emailTemplateKey = 'DISCUSSION_NOTIFICATION_SUBMISSION';
|
||||
protected static bool $canDisable = true;
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $fromRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
];
|
||||
protected static array $toRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
];
|
||||
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(Context $context, Submission $submission)
|
||||
{
|
||||
parent::__construct([$context, $submission]);
|
||||
$this->context = $context;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/EditReviewNotify.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class EditReviewNotify
|
||||
*
|
||||
* @brief An automatic email sent to the reviewer when the details of their review assignment have been changed
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\mail\traits\Unsubscribe;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class EditReviewNotify extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Unsubscribe;
|
||||
|
||||
protected static ?string $name = 'mailable.editReviewNotify.name';
|
||||
protected static ?string $description = 'mailable.editReviewNotify.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_EDIT';
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Submission $submission,
|
||||
ReviewAssignment $reviewAssignment
|
||||
) {
|
||||
parent::__construct(func_get_args());
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
protected function addFooter(string $locale): self
|
||||
{
|
||||
$this->setupUnsubscribeFooter($locale, $this->context, 'emails.footer.unsubscribe.automated');
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/EditorAssigned.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class EditorAssigned
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent to editors assigned to a submission.
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
|
||||
class EditorAssigned extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.editorAssigned.name';
|
||||
protected static ?string $description = 'mailable.editorAssigned.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_ASSIGN';
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/EditorialReminder.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class EditorialReminder
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email is sent automatically to an editor to remind them of outstanding tasks
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\core\Application;
|
||||
use APP\publication\Publication;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Unsubscribe;
|
||||
use PKP\security\Role;
|
||||
|
||||
class EditorialReminder extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Unsubscribe;
|
||||
|
||||
public const OUTSTANDING_TASKS = 'outstandingTasks';
|
||||
public const NUMBER_OF_SUBMISSIONS = 'numberOfSubmissions';
|
||||
|
||||
protected static ?string $name = 'mailable.editorialReminder.name';
|
||||
protected static ?string $description = 'mailable.editorialReminder.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITORIAL_REMINDER';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
|
||||
protected Context $context;
|
||||
protected array $outstanding = [];
|
||||
|
||||
/** @var Submission[] $submissions */
|
||||
protected array $submissions = [];
|
||||
|
||||
/** @TODO: docblock for $outstanding */
|
||||
public function __construct(Context $context)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a {$outstandingTasks} variable
|
||||
*
|
||||
* @TODO docblock params
|
||||
*/
|
||||
public function setOutstandingTasks(array $outstanding, array $submissions, int $numberOfSubmissions): self
|
||||
{
|
||||
$outstandingTasks = [];
|
||||
foreach ($outstanding as $submissionId => $task) {
|
||||
/** @var Submission $submission */
|
||||
$submission = $submissions[$submissionId];
|
||||
/** @var Publication $publication */
|
||||
$publication = $submission->getCurrentPublication();
|
||||
$url = Application::get()->getRequest()->getDispatcher()->url(
|
||||
Application::get()->getRequest(),
|
||||
Application::ROUTE_PAGE,
|
||||
$this->context->getPath(),
|
||||
'workflow',
|
||||
'access',
|
||||
$submission->getId()
|
||||
);
|
||||
|
||||
$outstandingTasks[] = '
|
||||
<tr>
|
||||
<td style="color: red; vertical-align: top; width: 25px;">⬤</td>
|
||||
<td style="vertical-align: top">
|
||||
' . $task . '<br />
|
||||
<a href="' . $url . '">'
|
||||
. $submission->getId()
|
||||
. ' — '
|
||||
. htmlspecialchars($publication->getShortAuthorString())
|
||||
. ' — '
|
||||
. htmlspecialchars($publication->getLocalizedFullTitle(null, 'html'))
|
||||
. '</a><br />
|
||||
<br />
|
||||
</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
$this->addData([
|
||||
self::OUTSTANDING_TASKS => '<table>' . join('', $outstandingTasks) . '</table>',
|
||||
self::NUMBER_OF_SUBMISSIONS => $numberOfSubmissions,
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @copydoc Mailable::getDataDescriptions()
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
$variables[static::OUTSTANDING_TASKS] = __('emailTemplate.variable.editorialReminder.outstandingTasks');
|
||||
$variables[static::NUMBER_OF_SUBMISSIONS] = __('emailTemplate.variable.editorialReminder.numberOfSubmissions');
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a footer with unsubscribe link
|
||||
*/
|
||||
protected function addFooter(string $locale): Mailable
|
||||
{
|
||||
$this->setupUnsubscribeFooter($locale, $this->context, 'emails.footer.unsubscribe.automated');
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/PasswordResetRequested.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class PasswordResetRequested
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent automatically when user requests to reset a password
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\PasswordResetUrl;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
use PKP\site\Site;
|
||||
use PKP\user\User;
|
||||
|
||||
class PasswordResetRequested extends Mailable
|
||||
{
|
||||
use Recipient {
|
||||
recipients as recipientsTrait;
|
||||
}
|
||||
use Configurable;
|
||||
use PasswordResetUrl;
|
||||
|
||||
protected static ?string $name = 'mailable.passwordResetRequested.name';
|
||||
protected static ?string $description = 'mailable.passwordResetRequested.description';
|
||||
protected static ?string $emailTemplateKey = 'PASSWORD_RESET_CONFIRM';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
Role::ROLE_ID_READER,
|
||||
Role::ROLE_ID_REVIEWER,
|
||||
Role::ROLE_ID_SUBSCRIPTION_MANAGER,
|
||||
];
|
||||
|
||||
public function __construct(Site $site)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
return static::addPasswordResetUrlDescription(parent::getDataDescriptions());
|
||||
}
|
||||
|
||||
public function recipients(User $recipient, ?string $locale = null): Mailable
|
||||
{
|
||||
$this->recipientsTrait([$recipient], $locale);
|
||||
$this->setPasswordResetUrl($recipient);
|
||||
|
||||
// See pkp/pkp-lib#9111
|
||||
$this->addData(['lostPasswordUrl' => $this->viewData[self::$passwordResetUrl]]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/PublicationVersionNotify.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class PublicationVersionNotify
|
||||
*
|
||||
* @brief Email is automatically sent to editors assigned to submission when new publication version is created
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Unsubscribe;
|
||||
use PKP\security\Role;
|
||||
|
||||
class PublicationVersionNotify extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Unsubscribe;
|
||||
|
||||
protected static ?string $name = 'mailable.publicationVersionNotify.name';
|
||||
protected static ?string $description = 'mailable.publicationVersionNotify.description';
|
||||
protected static ?string $emailTemplateKey = 'VERSION_CREATED';
|
||||
protected static array $groupIds = [self::GROUP_PRODUCTION];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(Context $context, Submission $submission)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
protected function addFooter(string $locale): self
|
||||
{
|
||||
$this->setupUnsubscribeFooter($locale, $this->context);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/RecommendationNotifyEditors.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class RecommendationNotifyEditors
|
||||
*
|
||||
* @brief Message sent to deciding editors when any SUBMISSION_EDITOR_RECOMMEND_*
|
||||
* decision is made.
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\facades\Repo;
|
||||
use APP\submission\Submission;
|
||||
use Exception;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\ReviewerComments;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\mail\variables\RecipientEmailVariable;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class RecommendationNotifyEditors extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient {
|
||||
recipients as traitRecipients;
|
||||
}
|
||||
use ReviewerComments;
|
||||
use Sender;
|
||||
|
||||
public const RECOMMENDATION_VARIABLE = 'recommendation';
|
||||
|
||||
protected static ?string $name = 'mailable.decision.recommendation.notifyEditors.name';
|
||||
protected static ?string $description = 'mailable.decision.recommendation.notifyEditors.description';
|
||||
protected static ?string $emailTemplateKey = 'EDITOR_RECOMMENDATION';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
|
||||
/**
|
||||
* @param array<ReviewAssignment> $reviewAssignments
|
||||
*/
|
||||
public function __construct(Context $context, Submission $submission, Decision $decision, array $reviewAssignments)
|
||||
{
|
||||
parent::__construct(array_slice(func_get_args(), 0, -1));
|
||||
$this->setupRecommendationVariable($decision);
|
||||
$this->setupReviewerCommentsVariable($reviewAssignments, $submission);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
$variables[static::RECOMMENDATION_VARIABLE] = __('emailTemplate.variable.recommendation');
|
||||
return self::addReviewerCommentsDescription($variables);
|
||||
}
|
||||
|
||||
protected function setupRecommendationVariable(Decision $decision)
|
||||
{
|
||||
$decisionType = Repo::decision()->getDecisionType($decision->getData('decision'));
|
||||
if (!$decisionType || !method_exists($decisionType, 'getRecommendationLabel')) {
|
||||
throw new Exception('Tried to get the recommendation from a decision that does not exist');
|
||||
}
|
||||
$this->addData([
|
||||
static::RECOMMENDATION_VARIABLE => $decisionType->getRecommendationLabel(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function recipients(array $recipients): Mailable
|
||||
{
|
||||
$this->traitRecipients($recipients);
|
||||
|
||||
// See pkp/pkp-lib#9111
|
||||
foreach ($this->variables as $key => $variable) {
|
||||
if (get_class($variable) === RecipientEmailVariable::class) {
|
||||
|
||||
// override including new variable
|
||||
$this->variables[$key] = new class($recipients, $this) extends RecipientEmailVariable
|
||||
{
|
||||
public function values(string $locale): array
|
||||
{
|
||||
$values = parent::values($locale);
|
||||
$values['editors'] = $values[RecipientEmailVariable::RECIPIENT_FULL_NAME];
|
||||
return $values;
|
||||
}
|
||||
};
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewAcknowledgement.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewAcknowledgement
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent by a section editor to confirm receipt of a completed review and thank the reviewer
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\PKPSubmission;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewAcknowledgement extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewAcknowledgement.name';
|
||||
protected static ?string $description = 'mailable.reviewAcknowledgement.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_ACK';
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
public function __construct(Context $context, PKPSubmission $submission, ReviewAssignment $reviewAssignment)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewCompleteNotifyEditors.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewCompleteNotifyEditors
|
||||
*
|
||||
* @brief Email is automatically sent to the assigned editors when the reviewer completes the review
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Unsubscribe;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewCompleteNotifyEditors extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
use Unsubscribe;
|
||||
|
||||
public const REVIEWER_FILES = 'reviewerFiles';
|
||||
|
||||
protected static ?string $name = 'mailable.reviewCompleteNotifyEditors.name';
|
||||
protected static ?string $description = 'mailable.reviewCompleteNotifyEditors.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_COMPLETE';
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Submission $submission,
|
||||
ReviewAssignment $reviewAssignment
|
||||
) {
|
||||
parent::__construct(func_get_args());
|
||||
|
||||
$this->context = $context;
|
||||
}
|
||||
|
||||
protected function addFooter(string $locale): self
|
||||
{
|
||||
$this->setupUnsubscribeFooter($locale, $this->context, 'emails.footer.unsubscribe.automated');
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewConfirm.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewConfirm
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email is sent automatically by a reviewer after accepting review request
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\PKPSubmission;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewConfirm extends Mailable
|
||||
{
|
||||
use Sender;
|
||||
use Recipient;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewConfirm.name';
|
||||
protected static ?string $description = 'mailable.reviewConfirm.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_CONFIRM';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
|
||||
public function __construct(PKPSubmission $submission, ReviewAssignment $reviewAssignment, Context $context)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewDecline.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewDecline
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email is sent by a reviewer after declining a review request
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\PKPSubmission;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewDecline extends Mailable
|
||||
{
|
||||
use Sender;
|
||||
use Recipient;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewDecline.name';
|
||||
protected static ?string $description = 'mailable.reviewDecline.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_DECLINE';
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
|
||||
public function __construct(PKPSubmission $submission, ReviewAssignment $reviewAssignment, Context $context)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewRemind.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewRemind
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email is sent by an editor to a reviewer to remind about the review request
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\OneClickReviewerAccess;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\mail\variables\ContextEmailVariable;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewRemind extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use OneClickReviewerAccess;
|
||||
use Sender;
|
||||
use Recipient;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewRemind.name';
|
||||
protected static ?string $description = 'mailable.reviewRemind.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_REMIND';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
protected Context $context;
|
||||
protected ReviewAssignment $reviewAssignment;
|
||||
|
||||
public function __construct(Context $context, Submission $submission, ReviewAssignment $reviewAssignment)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
|
||||
$this->context = $context;
|
||||
$this->reviewAssignment = $reviewAssignment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the setData method to add the one-click access
|
||||
* URL for the reviewer
|
||||
*/
|
||||
public function setData(?string $locale = null): void
|
||||
{
|
||||
parent::setData($locale);
|
||||
|
||||
$this->setOneClickAccessUrl($this->context, $this->reviewAssignment);
|
||||
|
||||
// See pkp/pkp-lib#9111
|
||||
$this->addData(['lostPasswordUrl' => $this->viewData[ContextEmailVariable::PASSWORD_LOST_URL]]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewRemindAuto.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewRemindAuto
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email is sent automatically to a reviewer after a due date as a reminder to complete a review
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\OneClickReviewerAccess;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\variables\ContextEmailVariable;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewRemindAuto extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use OneClickReviewerAccess;
|
||||
use Recipient;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewRemindAuto.name';
|
||||
protected static ?string $description = 'mailable.reviewRemindAuto.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_REMIND_AUTO';
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
protected Context $context;
|
||||
protected ReviewAssignment $reviewAssignment;
|
||||
|
||||
public function __construct(Context $context, Submission $submission, ReviewAssignment $reviewAssignment)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
|
||||
$this->context = $context;
|
||||
$this->reviewAssignment = $reviewAssignment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the setData method to add the one-click access
|
||||
* URL for the reviewer
|
||||
*/
|
||||
public function setData(?string $locale = null): void
|
||||
{
|
||||
parent::setData($locale);
|
||||
|
||||
$this->setOneClickAccessUrl($this->context, $this->reviewAssignment);
|
||||
|
||||
// See pkp/pkp-lib#9111
|
||||
$this->addData(['lostPasswordUrl' => $this->viewData[ContextEmailVariable::PASSWORD_LOST_URL]]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewerRequest.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewRequest
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief An email send to a reviewer with a request to accept or decline a task to review a submission
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\PKPSubmission;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewRequest extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewRequest.name';
|
||||
protected static ?string $description = 'mailable.reviewRequest.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_REQUEST';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
public function __construct(Context $context, PKPSubmission $submission, ReviewAssignment $reviewAssignment)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewRequestSubsequent.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewRequestSubsequent
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief An email send to a reviewer with a request to accept or decline a task to review a submission on subsequent review rounds
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\PKPSubmission;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewRequestSubsequent extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewRequestSubsequent.name';
|
||||
protected static ?string $description = 'mailable.reviewRequestSubsequent.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_REQUEST_SUBSEQUENT';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
public function __construct(Context $context, PKPSubmission $submission, ReviewAssignment $reviewAssignment)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewResponseRemindAuto.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewResponseRemindAuto
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email is sent automatically to a reviewer as a reminder after a deadline for response
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\OneClickReviewerAccess;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\variables\ContextEmailVariable;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewResponseRemindAuto extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use OneClickReviewerAccess;
|
||||
use Recipient;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewResponseOverdueAuto.name';
|
||||
protected static ?string $description = 'mailable.reviewResponseOverdueAuto.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_RESPONSE_OVERDUE_AUTO';
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
protected Context $context;
|
||||
protected ReviewAssignment $reviewAssignment;
|
||||
|
||||
public function __construct(Context $context, Submission $submission, ReviewAssignment $reviewAssignment)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
|
||||
$this->context = $context;
|
||||
$this->reviewAssignment = $reviewAssignment;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override the setData method to add the one-click access
|
||||
* URL for the reviewer
|
||||
*/
|
||||
public function setData(?string $locale = null): void
|
||||
{
|
||||
parent::setData($locale);
|
||||
|
||||
$this->setOneClickAccessUrl($this->context, $this->reviewAssignment);
|
||||
|
||||
// See pkp/pkp-lib#9111
|
||||
$this->addData([
|
||||
'lostPasswordUrl' => $this->viewData[ContextEmailVariable::PASSWORD_LOST_URL],
|
||||
'passwordResetUrl' => $this->viewData[ContextEmailVariable::PASSWORD_LOST_URL],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewerRegister.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewerRegister
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email is sent automatically to a newly registered reviewer (see Create Reviewer Form)
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\user\User;
|
||||
|
||||
class ReviewerRegister extends Mailable
|
||||
{
|
||||
use Recipient {
|
||||
recipients as traitRecipients;
|
||||
}
|
||||
use Sender;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewerRegister.name';
|
||||
protected static ?string $description = 'mailable.reviewerRegister.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEWER_REGISTER';
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
];
|
||||
protected static array $toRoleIds = [
|
||||
Role::ROLE_ID_REVIEWER,
|
||||
];
|
||||
protected static ?string $variablePassword = 'password';
|
||||
|
||||
protected string $password;
|
||||
|
||||
public function __construct(Context $context, string $password)
|
||||
{
|
||||
parent::__construct([$context]);
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @copydoc Mailable::getDataDescriptions()
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return static::addPasswordVariable($variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a description to a new password variable
|
||||
*/
|
||||
protected static function addPasswordVariable(array $variables): array
|
||||
{
|
||||
$variables[static::$variablePassword] = __('emailTemplate.variable.password');
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override trait's method to include user password variable
|
||||
*/
|
||||
public function recipients(User $recipient, ?string $locale = null): Mailable
|
||||
{
|
||||
$this->traitRecipients([$recipient], $locale);
|
||||
$this->addData([
|
||||
static::$variablePassword => htmlspecialchars($this->password)
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewerReinstate.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewerReinstate
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent to a reviewer when their assignment is reinstated
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\PKPSubmission;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewerReinstate extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewerReinstate.name';
|
||||
protected static ?string $description = 'mailable.reviewerReinstate.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_REINSTATE';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
public function __construct(Context $context, PKPSubmission $submission, ReviewAssignment $reviewAssignment)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewerResendRequest.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewerResendRequest
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent to a review who has declined their review assignment to ask them
|
||||
* to reconsider accepting the review assignment
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\PKPSubmission;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewerResendRequest extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.reviewerResendRequest.name';
|
||||
protected static ?string $description = 'mailable.reviewerResendRequest.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_RESEND_REQUEST';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
public function __construct(Context $context, PKPSubmission $submission, ReviewAssignment $reviewAssignment)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ReviewerUnassign.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2000-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ReviewerUnassign
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent when a reviewer is unassigned
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\PKPSubmission;
|
||||
use PKP\submission\reviewAssignment\ReviewAssignment;
|
||||
|
||||
class ReviewerUnassign extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
|
||||
/** @var string An email variable that contains a description of the editorial decision */
|
||||
public const DECISION_DESCRIPTION = 'decisionDescription';
|
||||
|
||||
protected static ?string $name = 'mailable.reviewerUnassign.name';
|
||||
protected static ?string $description = 'mailable.reviewerUnassign.description';
|
||||
protected static ?string $emailTemplateKey = 'REVIEW_CANCEL';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $fromRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_REVIEWER];
|
||||
|
||||
protected ?Decision $decision;
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
PKPSubmission $submission,
|
||||
?ReviewAssignment $reviewAssignment = null,
|
||||
?Decision $decision = null
|
||||
) {
|
||||
parent::__construct(array_filter(func_get_args(), fn ($param) => !is_null($param)));
|
||||
$this->decision = $decision;
|
||||
}
|
||||
|
||||
public function getDecision(): ?Decision
|
||||
{
|
||||
return $this->decision;
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
|
||||
$variables[self::DECISION_DESCRIPTION] = __('mailable.decision.notifyReviewer.variable.decisionDescription');
|
||||
return $variables;
|
||||
}
|
||||
|
||||
public function setData(?string $locale = null): void
|
||||
{
|
||||
parent::setData($locale);
|
||||
|
||||
if ($this->decision) {
|
||||
$this->viewData[self::DECISION_DESCRIPTION] = $this->getDecisionDescription($locale);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a description of the decision to use as an email variable
|
||||
*/
|
||||
protected function getDecisionDescription(?string $locale = null): string
|
||||
{
|
||||
$class = Decision::class;
|
||||
$reviewerUnassignedTypes = collect([
|
||||
'CANCEL_REVIEW_ROUND',
|
||||
'CANCEL_INTERNAL_REVIEW_ROUND',
|
||||
])
|
||||
->map(fn ($type) => defined("{$class}::{$type}") ? constant("{$class}::{$type}") : null)
|
||||
->filter(fn ($type) => !is_null($type))
|
||||
->toArray();
|
||||
|
||||
if (in_array($this->decision->getData('decision'), $reviewerUnassignedTypes)) {
|
||||
return __('mailable.decision.notifyReviewer.variable.decisionDescription.unassigned', [], $locale);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/RevisedVersionNotify.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class RevisedVersionNotify
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief The email is sent automatically to the assigned editor when author uploads a revised version of an article
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\submission\reviewRound\ReviewRound;
|
||||
use PKP\user\User;
|
||||
|
||||
class RevisedVersionNotify extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Sender;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.revisedVersionNotify.name';
|
||||
protected static ?string $description = 'mailable.revisedVersionNotify.description';
|
||||
protected static ?string $emailTemplateKey = 'REVISED_VERSION_NOTIFY';
|
||||
protected static bool $supportsTemplates = false;
|
||||
protected static array $groupIds = [self::GROUP_REVIEW];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
|
||||
protected Submission $submission;
|
||||
protected static string $submitterName = 'submitterName';
|
||||
|
||||
public function __construct(Context $context, Submission $submission, User $uploader, ReviewRound $reviewRound)
|
||||
{
|
||||
parent::__construct(array_slice(func_get_args(), 0, -2));
|
||||
$this->setupSubmitterNameVariable($uploader);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add description to a submissionUrl email template variable
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
$variables[static::$submitterName] = __('emailTemplate.variable.submitterName');
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add submitterName variable; submitter may not be a sender
|
||||
*/
|
||||
protected function setupSubmitterNameVariable(User $uploader): void
|
||||
{
|
||||
$this->addData([static::$submitterName => $uploader->getFullName()]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/AnnouncementNotify.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class StatisticsReportNotify
|
||||
*
|
||||
* @brief Email sent to notify users about new announcement
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\core\Application;
|
||||
use PKP\context\Context;
|
||||
use PKP\core\PKPApplication;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Unsubscribe;
|
||||
use PKP\security\Role;
|
||||
|
||||
class StatisticsReportNotify extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Configurable;
|
||||
use Unsubscribe;
|
||||
|
||||
protected static ?string $name = 'mailable.statisticsReportNotify.name';
|
||||
protected static ?string $description = 'mailable.statisticsReportNotify.description';
|
||||
protected static ?string $emailTemplateKey = 'STATISTICS_REPORT_NOTIFICATION';
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_SUB_EDITOR];
|
||||
|
||||
protected Context $context;
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
array $editorialTrends,
|
||||
int $totalSubmissions,
|
||||
string $month,
|
||||
int $year
|
||||
) {
|
||||
parent::__construct([$context]);
|
||||
$this->context = $context;
|
||||
$this->setupStatisticsVariables($context, $editorialTrends, $totalSubmissions, $month, $year);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = [
|
||||
'newSubmissions' => __('emailTemplate.variable.statisticsReportNotify.newSubmissions'),
|
||||
'declinedSubmissions' => __('emailTemplate.variable.statisticsReportNotify.declinedSubmissions'),
|
||||
'acceptedSubmissions' => __('emailTemplate.variable.statisticsReportNotify.acceptedSubmissions'),
|
||||
'skippedSubmissions' => __('emailTemplate.variable.statisticsReportNotify.otherSubmissions'),
|
||||
'totalSubmissions' => __('emailTemplate.variable.statisticsReportNotify.totalSubmissions'),
|
||||
'month' => __('emailTemplate.variable.statisticsReportNotify.month'),
|
||||
'year' => __('emailTemplate.variable.statisticsReportNotify.year'),
|
||||
'editorialStatsLink' => __('emailTemplate.variable.statisticsReportNotify.editorialStatsLink'),
|
||||
'publicationStatsLink' => __('emailTemplate.variable.statisticsReportNotify.publicationStatsLink'),
|
||||
];
|
||||
|
||||
return array_merge(parent::getDataDescriptions(), $variables);
|
||||
}
|
||||
|
||||
protected function setupStatisticsVariables(
|
||||
Context $context,
|
||||
array $editorialTrends,
|
||||
int $totalSubmissions,
|
||||
string $month,
|
||||
int $year
|
||||
): void {
|
||||
$dispatcher = Application::get()->getDispatcher();
|
||||
$request = Application::get()->getRequest();
|
||||
|
||||
$trends = [];
|
||||
foreach ($editorialTrends as $stat) {
|
||||
$trends[$stat['key']] = $stat['value'];
|
||||
}
|
||||
|
||||
// The submissionsAccepted might not exist
|
||||
$trends['submissionsAccepted'] ??= null;
|
||||
[
|
||||
'submissionsReceived' => $newSubmissions,
|
||||
'submissionsDeclined' => $declinedSubmissions,
|
||||
'submissionsAccepted' => $acceptedSubmissions,
|
||||
'submissionsSkipped' => $skippedSubmissions
|
||||
] = $trends;
|
||||
|
||||
$this->addData([
|
||||
'newSubmissions' => $newSubmissions,
|
||||
'declinedSubmissions' => $declinedSubmissions,
|
||||
'acceptedSubmissions' => $acceptedSubmissions,
|
||||
'skippedSubmissions' => $skippedSubmissions,
|
||||
'totalSubmissions' => $totalSubmissions,
|
||||
'month' => $month,
|
||||
'year' => $year,
|
||||
'editorialStatsLink' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context->getPath(), 'stats', 'editorial'),
|
||||
'publicationStatsLink' => $dispatcher->url($request, PKPApplication::ROUTE_PAGE, $context->getPath(), 'stats', 'publications')
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a footer with unsubscribe link
|
||||
*/
|
||||
protected function addFooter(string $locale): Mailable
|
||||
{
|
||||
$this->setupUnsubscribeFooter($locale, $this->context);
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubmissionAcknowledgement.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubmissionAcknowledgement
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent to a submitting author when they submit their submission
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\mail\variables\ContextEmailVariable;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubmissionAcknowledgement extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.submissionAck.name';
|
||||
protected static ?string $description = 'mailable.submissionAck.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBMISSION_ACK';
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* @copydoc Mailable::setData()
|
||||
*/
|
||||
public function setData(?string $locale = null): void
|
||||
{
|
||||
parent::setData($locale);
|
||||
$this->addData([
|
||||
'editorialContactSignature' => $this->viewData[ContextEmailVariable::CONTEXT_SIGNATURE],
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubmissionAcknowledgementNotAuthor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubmissionAcknowledgementNotAuthor
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief This email is sent automatically to the contributors identified in a submission to the journal
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
use PKP\user\User;
|
||||
|
||||
class SubmissionAcknowledgementNotAuthor extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.submissionAckNotAuthor.name';
|
||||
protected static ?string $description = 'mailable.submissionAckNotAuthor.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBMISSION_ACK_NOT_USER';
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
protected static string $submitterName = 'submitterName';
|
||||
|
||||
public function __construct(Context $context, Submission $submission, User $submitter)
|
||||
{
|
||||
parent::__construct(array_slice(func_get_args(), 0, -1));
|
||||
|
||||
$this->addData([
|
||||
self::$submitterName => $submitter->getFullName()
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return static::addSubmitterNameDescription($variables);
|
||||
}
|
||||
|
||||
protected static function addSubmitterNameDescription(array $variables): array
|
||||
{
|
||||
$variables[self::$submitterName] = __('emailTemplate.variable.submitterName');
|
||||
return $variables;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubmissionAcknowledgementOtherAuthors.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubmissionAcknowledgementOtherAuthors
|
||||
*
|
||||
* @brief Email sent to authors named as contributors to a new submission who
|
||||
* are not the submitting author.
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\author\Author;
|
||||
use APP\submission\Submission;
|
||||
use Illuminate\Support\Enumerable;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
use PKP\user\User;
|
||||
|
||||
class SubmissionAcknowledgementOtherAuthors extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
|
||||
protected const AUTHORS_WITH_AFFILIATION = 'authorsWithAffiliation';
|
||||
protected const SUBMITTER_NAME = 'submitterName';
|
||||
|
||||
protected static ?string $name = 'mailable.submissionAckOtherAuthors.name';
|
||||
protected static ?string $description = 'emails.submissionAckNotUser.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBMISSION_ACK_NOT_USER';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
protected Submission $submission;
|
||||
protected Enumerable $submitterUsers;
|
||||
|
||||
|
||||
public function __construct(Context $context, Submission $submission, Enumerable $submitterUsers)
|
||||
{
|
||||
parent::__construct([$context, $submission]);
|
||||
$this->submission = $submission;
|
||||
$this->submitterUsers = $submitterUsers;
|
||||
$this->addData([
|
||||
self::AUTHORS_WITH_AFFILIATION => $this->getAuthorsWithAffiliation(),
|
||||
self::SUBMITTER_NAME => $this->getSubmitterName(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
return array_merge([
|
||||
parent::getDataDescriptions(),
|
||||
[
|
||||
self::AUTHORS_WITH_AFFILIATION => __('emailTemplate.variable.authorsWithAffiliation'),
|
||||
self::SUBMITTER_NAME => __('emailTemplate.variable.submitterName'),
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
protected function getSubmitterName(): string
|
||||
{
|
||||
return $this->submitterUsers
|
||||
->map(fn (User $user) => $user->getFullName())
|
||||
->join(__('common.commaListSeparator'));
|
||||
}
|
||||
|
||||
protected function getAuthorsWithAffiliation(): string
|
||||
{
|
||||
$authors = $this->submission->getCurrentPublication()->getData('authors');
|
||||
|
||||
if ($authors->empty()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $authors
|
||||
->map(fn (Author $author) => join(__('common.commaListSeparator'), [$author->getFullName(), $author->getLocalizedAffiliation()]))
|
||||
->join('<br>');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubmissionNeedsEditor.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubmissionNeedsEditor
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent to managers when a new submission is made and no editor is assigned
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubmissionNeedsEditor extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
use Configurable;
|
||||
|
||||
protected static ?string $name = 'mailable.submissionNeedsEditor.name';
|
||||
protected static ?string $description = 'mailable.submissionNeedsEditor.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBMISSION_NEEDS_EDITOR';
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
|
||||
public function __construct(Context $context, Submission $submission)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/SubmissionSavedForLater.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class SubmissionSavedForLater
|
||||
*
|
||||
* @brief Email sent to a submitting author when they save their submission
|
||||
* to be completed later
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use APP\decision\Decision;
|
||||
use APP\submission\Submission;
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
|
||||
class SubmissionSavedForLater extends Mailable
|
||||
{
|
||||
use Recipient;
|
||||
|
||||
/** @var string An email variable that contains a description of the editorial decision */
|
||||
public const DECISION_DESCRIPTION = 'decisionDescription';
|
||||
|
||||
protected static ?string $name = 'mailable.submissionSavedForLater.name';
|
||||
protected static ?string $description = 'mailable.submissionSavedForLater.description';
|
||||
protected static ?string $emailTemplateKey = 'SUBMISSION_SAVED_FOR_LATER';
|
||||
protected static bool $supportsTemplates = true;
|
||||
protected static array $groupIds = [self::GROUP_SUBMISSION];
|
||||
protected static bool $canDisable = true;
|
||||
protected static array $toRoleIds = [Role::ROLE_ID_AUTHOR];
|
||||
protected Decision $decision;
|
||||
|
||||
public function __construct(Context $context, Submission $submission)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/UserCreated.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class UserCreated
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Email sent when a new user is added from the user management screen.
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\mail\traits\Sender;
|
||||
use PKP\security\Role;
|
||||
use PKP\user\User;
|
||||
|
||||
class UserCreated extends Mailable
|
||||
{
|
||||
use Recipient {
|
||||
recipients as traitRecipients;
|
||||
}
|
||||
use Configurable;
|
||||
use Sender;
|
||||
|
||||
protected static ?string $name = 'mailable.userRegister.name';
|
||||
protected static ?string $description = 'mailable.userRegister.description';
|
||||
protected static ?string $emailTemplateKey = 'USER_REGISTER';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
];
|
||||
protected static array $toRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
Role::ROLE_ID_READER,
|
||||
Role::ROLE_ID_REVIEWER,
|
||||
Role::ROLE_ID_SUBSCRIPTION_MANAGER,
|
||||
];
|
||||
protected static ?string $variablePassword = 'password';
|
||||
|
||||
protected string $password;
|
||||
|
||||
public function __construct(Context $context, string $password)
|
||||
{
|
||||
parent::__construct([$context]);
|
||||
$this->password = $password;
|
||||
}
|
||||
|
||||
/**
|
||||
* @copydoc Mailable::getDataDescriptions()
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
$variables = parent::getDataDescriptions();
|
||||
return static::addPasswordVariable($variables);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a description to a new password variable
|
||||
*/
|
||||
protected static function addPasswordVariable(array $variables): array
|
||||
{
|
||||
$variables[static::$variablePassword] = __('emailTemplate.variable.password');
|
||||
return $variables;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override trait's method to include user password variable
|
||||
*/
|
||||
public function recipients(User $recipient, ?string $locale = null): Mailable
|
||||
{
|
||||
$this->traitRecipients([$recipient], $locale);
|
||||
$this->addData([
|
||||
static::$variablePassword => htmlspecialchars($this->password)
|
||||
]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ValidateEmailContext.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ValidateEmailContext
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Represents registration validation email
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\context\Context;
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
|
||||
class ValidateEmailContext extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
|
||||
protected static ?string $name = 'mailable.validateEmailContext.name';
|
||||
protected static ?string $description = 'mailable.validateEmailContext.description';
|
||||
protected static ?string $emailTemplateKey = 'USER_VALIDATE_CONTEXT';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
Role::ROLE_ID_READER,
|
||||
Role::ROLE_ID_REVIEWER,
|
||||
Role::ROLE_ID_SUBSCRIPTION_MANAGER,
|
||||
];
|
||||
|
||||
public function __construct(Context $context)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add description for the validation link variable
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
return array_merge(parent::getDataDescriptions(), [
|
||||
'activateUrl' => __('emailTemplate.variable.activateUrl'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file classes/mail/mailables/ValidateEmailSite.php
|
||||
*
|
||||
* Copyright (c) 2014-2022 Simon Fraser University
|
||||
* Copyright (c) 2000-2022 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class ValidateEmailSite
|
||||
*
|
||||
* @ingroup mail_mailables
|
||||
*
|
||||
* @brief Represents registration validation email
|
||||
*/
|
||||
|
||||
namespace PKP\mail\mailables;
|
||||
|
||||
use PKP\mail\Mailable;
|
||||
use PKP\mail\traits\Configurable;
|
||||
use PKP\mail\traits\Recipient;
|
||||
use PKP\security\Role;
|
||||
use PKP\site\Site;
|
||||
|
||||
class ValidateEmailSite extends Mailable
|
||||
{
|
||||
use Configurable;
|
||||
use Recipient;
|
||||
|
||||
protected static ?string $name = 'mailable.validateEmailSite.name';
|
||||
protected static ?string $description = 'mailable.validateEmailSite.description';
|
||||
protected static ?string $emailTemplateKey = 'USER_VALIDATE_SITE';
|
||||
protected static array $groupIds = [self::GROUP_OTHER];
|
||||
protected static array $fromRoleIds = [self::FROM_SYSTEM];
|
||||
protected static array $toRoleIds = [
|
||||
Role::ROLE_ID_SUB_EDITOR,
|
||||
Role::ROLE_ID_ASSISTANT,
|
||||
Role::ROLE_ID_AUTHOR,
|
||||
Role::ROLE_ID_READER,
|
||||
Role::ROLE_ID_REVIEWER,
|
||||
Role::ROLE_ID_SUBSCRIPTION_MANAGER,
|
||||
];
|
||||
|
||||
public function __construct(Site $site)
|
||||
{
|
||||
parent::__construct(func_get_args());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add description for the validation link variable
|
||||
*/
|
||||
public static function getDataDescriptions(): array
|
||||
{
|
||||
return array_merge(parent::getDataDescriptions(), [
|
||||
'activateUrl' => __('emailTemplate.variable.activateUrl'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user