Skip to content

Commit

Permalink
#10837 ojs stable 3.3.0 Add image code and list to announcement desc …
Browse files Browse the repository at this point in the history
…toolbar (#10827)
  • Loading branch information
salmanm2003 authored Jan 28, 2025
1 parent 45d3f11 commit 0d02655
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
18 changes: 15 additions & 3 deletions classes/components/forms/announcement/PKPAnnouncementForm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ class PKPAnnouncementForm extends FormComponent {
* @param $action string URL to submit the form to
* @param $locales array Supported locales
* @param $announcementContext Context The context to get supported announcement types
* @param $temporaryFileApiUrl string URL to upload files to
* @param $imageUploadUrl string The API endpoint for images uploaded through the rich text field
*/
public function __construct($action, $locales, $announcementContext) {
public function __construct($action, $locales, $announcementContext, $temporaryFileApiUrl, $imageUploadUrl) {
$this->action = $action;
$this->locales = $locales;

Expand All @@ -46,14 +48,24 @@ public function __construct($action, $locales, $announcementContext) {
'label' => __('manager.announcements.form.descriptionShort'),
'description' => __('manager.announcements.form.descriptionShortInstructions'),
'isMultilingual' => true,
'toolbar' => 'bold italic superscript subscript | link | blockquote bullist numlist | image | code',
'plugins' => 'paste,link,image,lists,code',
'uploadUrl' => $imageUploadUrl,
'options' => [
'url' => $temporaryFileApiUrl,
],
]))
->addField(new FieldRichTextarea('description', [
'label' => __('manager.announcements.form.description'),
'description' => __('manager.announcements.form.descriptionInstructions'),
'isMultilingual' => true,
'size' => 'large',
'toolbar' => 'bold italic superscript subscript | link | blockquote bullist numlist',
'plugins' => 'paste,link,lists',
'toolbar' => 'bold italic superscript subscript | link | blockquote bullist numlist | image | code',
'plugins' => 'paste,link,image,lists,code',
'uploadUrl' => $imageUploadUrl,
'options' => [
'url' => $temporaryFileApiUrl,
],
]))
->addField(new FieldText('dateExpire', [
'label' => __('manager.announcements.form.dateExpire'),
Expand Down
6 changes: 5 additions & 1 deletion pages/management/ManagementHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ function announcements($args, $request) {
$templateMgr = TemplateManager::getManager($request);
$this->setupTemplate($request);

$context = $request->getContext();
$dispatcher = $request->getDispatcher();
$temporaryFileApiUrl = $dispatcher->url($request, ROUTE_API, $context->getPath(), 'temporaryFiles');
$publicFileApiUrl = $dispatcher->url($request, ROUTE_API, $context->getPath(), '_uploadPublicFile');
$apiUrl = $request->getDispatcher()->url($request, ROUTE_API, $request->getContext()->getPath(), 'announcements');

$supportedFormLocales = $request->getContext()->getSupportedFormLocales();
Expand All @@ -323,7 +327,7 @@ function announcements($args, $request) {
return ['key' => $localeKey, 'label' => $localeNames[$localeKey]];
}, $supportedFormLocales);

$announcementForm = new \PKP\components\forms\announcement\PKPAnnouncementForm($apiUrl, $locales, $request->getContext());
$announcementForm = new \PKP\components\forms\announcement\PKPAnnouncementForm($apiUrl, $locales, $request->getContext(), $temporaryFileApiUrl, $publicFileApiUrl);

$getParams = [
'contextIds' => $request->getContext()->getId(),
Expand Down

0 comments on commit 0d02655

Please sign in to comment.