Skip to content

Commit

Permalink
[document_repository] Notification emails (aces#6635)
Browse files Browse the repository at this point in the history
Use notification framework for uploading a new file and creating a new category.

Resolves aces#6580
  • Loading branch information
kongtiaowang authored and AlexandraLivadas committed Jun 15, 2021
1 parent ffd0358 commit 96b6d14
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/document_repository/php/files.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,24 @@ class Files extends \NDB_Page
'visitLabel' => $req['visitLabel'] ?? null,
'pscid' => $req['pscid'] ?? null,
];
$fileName = $req['fileName'];
$Notifier = new \NDB_Notifier(
"document_repository",
"edit"
);
try {
$db->update(
'document_repository',
$updateValues,
['record_id' => $req['id']]
);
$factory = \NDB_Factory::singleton();
$baseURL = $factory->settings()->getBaseURL();
$msg_data = [
'updatedDocument' => $baseURL . "/document_repository/",
'document' => $fileName,
];
$Notifier->notify($msg_data);
return (new \LORIS\Http\Response\JSON\OK(
['message' => 'File updated.']
));
Expand Down
11 changes: 11 additions & 0 deletions modules/document_repository/php/uploadcategory.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,16 @@ class UploadCategory extends \NDB_Page
"comments" => $comments,
]
);
$Notifier = new \NDB_Notifier(
"document_repository",
"new_category"
);
$factory = \NDB_Factory::singleton();
$baseURL = $factory->settings()->getBaseURL();
$msg_data = [
'newCategory' => $baseURL . "/document_repository/",
'category' => $category_name,
];
$Notifier->notify($msg_data);
}
}

0 comments on commit 96b6d14

Please sign in to comment.