Skip to content

Commit

Permalink
Messenger: add the ability to share the send report page with other u…
Browse files Browse the repository at this point in the history
…sers. (#1831)

Co-authored-by: Sandra Kuipers <[email protected]>
  • Loading branch information
ali-ichk and SKuipers authored May 13, 2024
1 parent 5506a94 commit 3a238fc
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGEDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -809,4 +809,5 @@
ALTER TABLE `gibbonMessenger` CHANGE `messageWall_date1` `messageWall_dateStart` date DEFAULT NULL;end
ALTER TABLE `gibbonMessenger` CHANGE `messageWall_date2` `messageWall_dateEnd` date DEFAULT NULL;end
ALTER TABLE `gibbonMessenger` DROP `messageWall_date3`;end
ALTER TABLE `gibbonMessenger` ADD `enableSharingLink` ENUM('N','Y') NOT NULL DEFAULT 'N';end
";
1 change: 1 addition & 0 deletions modules/Messenger/messenger_manage_editProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
'confidential' => $_POST['confidential'] ?? 'N',
'includeSignature' => $_POST['includeSignature'] ?? 'N',
'timestamp' => date('Y-m-d H:i:s'),
'enableSharingLink' => $_POST['enableSharingLink'] ?? 'N',
];

if ($status == 'Draft') {
Expand Down
17 changes: 15 additions & 2 deletions modules/Messenger/messenger_manage_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

use Gibbon\Http\Url;
use Gibbon\Forms\Form;
use Gibbon\Forms\Prefab\BulkActionForm;
use Gibbon\Services\Format;
use Gibbon\Forms\Prefab\BulkActionForm;
use Gibbon\Domain\Messenger\MessengerGateway;

if (isActionAccessible($guid, $connection2, "/modules/Messenger/messenger_manage_report.php")==FALSE) {
Expand Down Expand Up @@ -90,10 +91,15 @@
};

$sender = false;
if ($values['gibbonPersonID'] == $session->get('gibbonPersonID') || $highestAction == 'Manage Messages_all') {
if ($values['gibbonPersonID'] == $session->get('gibbonPersonID') || $highestAction == 'Manage Messages_all' || $values['enableSharingLink'] == 'Y') {
$sender = true;
}

if ($highestAction != 'Manage Messages_all' && $values['gibbonPersonID'] != $session->get('gibbonPersonID') && $values['enableSharingLink'] == 'N') {
$page->addError(__("You do not have access to this action."));
return;
}

if ($values['email'] == 'Y' && $values['emailReceipt'] == 'Y') {
$alertText = __('Email read receipts have been enabled for this message. You can use the Resend action along with the checkboxes next to recipients who have not yet confirmed to send a reminder to these users.').' '.__('Recipients who may not have received the original email due to a delivery issue are highlighted in orange.');

Expand Down Expand Up @@ -144,6 +150,13 @@
$row->addLabel('confirmationMode', __('Confirmation Required By'));
$row->addSelect('confirmationMode')->fromArray($confirmationOptions)->selected($confirmationMode);

if ($values['enableSharingLink'] == 'Y') {
$linkURL = Url::fromModuleRoute('Messenger', 'messenger_manage_report')->withQueryParams(['gibbonMessengerID' => $gibbonMessengerID, 'sidebar' => true])->withAbsoluteUrl(true);
$row = $form->addRow();
$row->addLabel('sharingLink', __('Link of Send Report'))->description(__('Right Click and Copy the link to share it with other users.'));
$row->addContent('<h4>'.Format::link($linkURL, __("Link")).'</h4>');
}

echo $form->getOutput();
}

Expand Down
1 change: 1 addition & 0 deletions modules/Messenger/messenger_postProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
'emailReplyTo' => $_POST['emailReplyTo'] ?? $session->get('email'),
'emailReceipt' => $_POST['emailReceipt'] ?? 'N',
'emailReceiptText' => $_POST['emailReceiptText'] ?? '',
'enableSharingLink' => $_POST['enableSharingLink'] ?? 'N',
'individualNaming' => $_POST['individualNaming'] ?? 'N',
'includeSignature' => $_POST['includeSignature'] ?? 'N',
'confidential' => $_POST['confidential'] ?? 'N',
Expand Down
4 changes: 4 additions & 0 deletions modules/Messenger/src/Forms/MessageForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,10 @@ public function createForm($action, $gibbonMessengerID = null)
$row = $form->addRow()->addClass('emailReceipt');
$row->addLabel('emailReceiptText', __('Link Text'))->description(__('Confirmation link text to display to recipient.'));
$row->addTextArea('emailReceiptText')->setRows(4)->required()->setValue($values['emailReceiptText'])->readonly($sent);

$row = $form->addRow()->addClass('emailReceipt');
$row->addLabel('enableSharingLink', __('Enable Sharing Send Report'))->description(__('The Link of the Send Report can be shared to other users if turned on'));
$row->addYesNoRadio('enableSharingLink')->required()->checked($values['enableSharingLink'] ?? 'N');
}
}

Expand Down

0 comments on commit 3a238fc

Please sign in to comment.