Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#10837 Add image code and lists to announcement desc toolbar #10827

Open
wants to merge 1 commit into
base: stable-3_3_0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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