From 5d51a2f907e3b5843b80e589e24c8140644ece77 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 28 Apr 2015 22:47:56 -0600 Subject: [PATCH] CRM-16354 - Migrate forms to new wysiwyg code --- CRM/Admin/Form/MessageTemplates.php | 2 +- CRM/Admin/Form/Options.php | 2 +- CRM/Admin/Form/Preferences.php | 2 +- CRM/Campaign/Form/Campaign.php | 2 +- CRM/Campaign/Form/Petition.php | 4 +- CRM/Campaign/Form/Survey/Main.php | 2 +- CRM/Campaign/Form/SurveyType.php | 2 +- CRM/Case/Form/Activity/OpenCase.php | 2 +- CRM/Contact/Form/Edit/Email.php | 2 +- .../Form/ContributionPage/Amount.php | 2 +- .../Form/ContributionPage/Settings.php | 4 +- .../Form/ContributionPage/ThankYou.php | 14 ++---- .../Form/ContributionPage/Widget.php | 2 +- CRM/Contribute/Form/Task/Invoice.php | 2 +- CRM/Core/BAO/CustomField.php | 2 +- CRM/Core/BAO/UFGroup.php | 4 +- CRM/Core/Form.php | 44 ------------------- CRM/Custom/Form/Group.php | 4 +- CRM/Event/Form/ManageEvent/EventInfo.php | 2 +- CRM/Event/Form/ManageEvent/Fee.php | 2 +- CRM/Event/Form/ManageEvent/Registration.php | 38 +++------------- CRM/Friend/BAO/Friend.php | 4 +- CRM/Friend/Form.php | 2 +- CRM/Mailing/BAO/Mailing.php | 4 +- CRM/Mailing/Form/ForwardMailing.php | 2 +- CRM/Member/Form/MembershipBlock.php | 4 +- CRM/UF/Form/Group.php | 4 +- tools/CRM/Auction/Form/Auction.php | 2 +- tools/CRM/Auction/Form/Item.php | 2 +- 29 files changed, 44 insertions(+), 120 deletions(-) diff --git a/CRM/Admin/Form/MessageTemplates.php b/CRM/Admin/Form/MessageTemplates.php index a20e6b1398..98b6c18ceb 100644 --- a/CRM/Admin/Form/MessageTemplates.php +++ b/CRM/Admin/Form/MessageTemplates.php @@ -173,7 +173,7 @@ class CRM_Admin_Form_MessageTemplates extends CRM_Admin_Form { ); } else { - $this->addWysiwyg('msg_html', ts('HTML Message'), + $this->add('wysiwyg', 'msg_html', ts('HTML Message'), array( 'cols' => '80', 'rows' => '8', diff --git a/CRM/Admin/Form/Options.php b/CRM/Admin/Form/Options.php index 3c92c0bcc9..54f0536f5c 100644 --- a/CRM/Admin/Form/Options.php +++ b/CRM/Admin/Form/Options.php @@ -238,7 +238,7 @@ class CRM_Admin_Form_Options extends CRM_Admin_Form { } else { // Hard-coding attributes here since description is still stored as varchar and not text in the schema. dgg - $this->addWysiwyg('description', + $this->add('wysiwyg', 'description', ts('Description'), array('rows' => 4, 'cols' => 80), $required diff --git a/CRM/Admin/Form/Preferences.php b/CRM/Admin/Form/Preferences.php index 84adc99ce4..a239e973ea 100644 --- a/CRM/Admin/Form/Preferences.php +++ b/CRM/Admin/Form/Preferences.php @@ -202,7 +202,7 @@ class CRM_Admin_Form_Preferences extends CRM_Core_Form { break; case 'wysiwyg': - $this->addWysiwyg($fieldName, $fieldValue['title'], $fieldValue['attributes']); + $this->add('wysiwyg', $fieldName, $fieldValue['title'], $fieldValue['attributes']); break; case 'entity_reference': diff --git a/CRM/Campaign/Form/Campaign.php b/CRM/Campaign/Form/Campaign.php index 634b7fc086..923d7838c9 100644 --- a/CRM/Campaign/Form/Campaign.php +++ b/CRM/Campaign/Form/Campaign.php @@ -264,7 +264,7 @@ class CRM_Campaign_Form_Campaign extends CRM_Core_Form { ) ); - $this->addWysiwyg('goal_general', ts('Campaign Goals'), array('rows' => 2, 'cols' => 40)); + $this->add('wysiwyg', 'goal_general', ts('Campaign Goals'), array('rows' => 2, 'cols' => 40)); $this->add('text', 'goal_revenue', ts('Revenue Goal'), array('size' => 8, 'maxlength' => 12)); $this->addRule('goal_revenue', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('99.99', ' ')) diff --git a/CRM/Campaign/Form/Petition.php b/CRM/Campaign/Form/Petition.php index 43b0334756..ff73aee969 100644 --- a/CRM/Campaign/Form/Petition.php +++ b/CRM/Campaign/Form/Petition.php @@ -187,7 +187,7 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { $this->addElement('hidden', 'activity_type_id', $petitionTypeID); // script / instructions / description of petition purpose - $this->addWysiwyg('instructions', ts('Introduction'), $attributes['instructions']); + $this->add('wysiwyg', 'instructions', ts('Introduction'), $attributes['instructions']); // Campaign id $campaigns = CRM_Campaign_BAO_Campaign::getCampaigns(CRM_Utils_Array::value('campaign_id', $this->_values)); @@ -211,7 +211,7 @@ class CRM_Campaign_Form_Petition extends CRM_Core_Form { // thank you title and text (html allowed in text) $this->add('text', 'thankyou_title', ts('Thank-you Page Title'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'thankyou_title')); - $this->addWysiwyg('thankyou_text', ts('Thank-you Message'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'thankyou_text')); + $this->add('wysiwyg', 'thankyou_text', ts('Thank-you Message'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'thankyou_text')); // bypass email confirmation? $this->add('checkbox', 'bypass_confirm', ts('Bypass email confirmation')); diff --git a/CRM/Campaign/Form/Survey/Main.php b/CRM/Campaign/Form/Survey/Main.php index cc2bd7532f..2a7090f649 100644 --- a/CRM/Campaign/Form/Survey/Main.php +++ b/CRM/Campaign/Form/Survey/Main.php @@ -166,7 +166,7 @@ class CRM_Campaign_Form_Survey_Main extends CRM_Campaign_Form_Survey { $this->add('select', 'campaign_id', ts('Campaign'), array('' => ts('- select -')) + $campaigns); // script / instructions - $this->addWysiwyg('instructions', ts('Instructions for interviewers'), array('rows' => 5, 'cols' => 40)); + $this->add('wysiwyg', 'instructions', ts('Instructions for interviewers'), array('rows' => 5, 'cols' => 40)); // release frequency $this->add('text', 'release_frequency', ts('Release Frequency'), CRM_Core_DAO::getAttribute('CRM_Campaign_DAO_Survey', 'release_frequency')); diff --git a/CRM/Campaign/Form/SurveyType.php b/CRM/Campaign/Form/SurveyType.php index fe455f7106..cfa5a9630a 100644 --- a/CRM/Campaign/Form/SurveyType.php +++ b/CRM/Campaign/Form/SurveyType.php @@ -124,7 +124,7 @@ class CRM_Campaign_Form_SurveyType extends CRM_Admin_Form { $this->applyFilter('__ALL__', 'trim'); $this->add('text', 'label', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'label'), TRUE); - $this->addWysiwyg('description', + $this->add('wysiwyg', 'description', ts('Description'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_OptionValue', 'description') ); diff --git a/CRM/Case/Form/Activity/OpenCase.php b/CRM/Case/Form/Activity/OpenCase.php index 358f203e99..9776866da0 100644 --- a/CRM/Case/Form/Activity/OpenCase.php +++ b/CRM/Case/Form/Activity/OpenCase.php @@ -189,7 +189,7 @@ class CRM_Case_Form_Activity_OpenCase { // calling this field activity_location to prevent conflict with contact location fields $form->add('text', 'activity_location', ts('Location'), CRM_Core_DAO::getAttribute('CRM_Activity_DAO_Activity', 'location')); - $form->addWysiwyg('activity_details', ts('Details'), array('rows' => 4, 'cols' => 60), FALSE); + $form->add('wysiwyg', 'activity_details', ts('Details'), array('rows' => 4, 'cols' => 60), FALSE); $form->addButtons(array( array( diff --git a/CRM/Contact/Form/Edit/Email.php b/CRM/Contact/Form/Edit/Email.php index 3bef4b552a..d86c8f5645 100644 --- a/CRM/Contact/Form/Edit/Email.php +++ b/CRM/Contact/Form/Edit/Email.php @@ -115,7 +115,7 @@ class CRM_Contact_Form_Edit_Email { array('rows' => 2, 'cols' => 40) ); - $form->addWysiwyg("email[$blockId][signature_html]", ts('Signature (HTML)'), + $form->add('wysiwyg', "email[$blockId][signature_html]", ts('Signature (HTML)'), array('rows' => 2, 'cols' => 40) ); } diff --git a/CRM/Contribute/Form/ContributionPage/Amount.php b/CRM/Contribute/Form/ContributionPage/Amount.php index c6e9348fe2..1d68305afb 100644 --- a/CRM/Contribute/Form/ContributionPage/Amount.php +++ b/CRM/Contribute/Form/ContributionPage/Amount.php @@ -137,7 +137,7 @@ SELECT id CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pay_later_text'), FALSE ); - $this->addWysiwyg('pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pay_later_receipt')); + $this->add('wysiwyg', 'pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'pay_later_receipt')); $this->addElement('checkbox', 'is_billing_required', ts('Billing address required')); //add partial payment options diff --git a/CRM/Contribute/Form/ContributionPage/Settings.php b/CRM/Contribute/Form/ContributionPage/Settings.php index 7b8b7ec192..a9dbc7541f 100644 --- a/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/CRM/Contribute/Form/ContributionPage/Settings.php @@ -129,9 +129,9 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ //CRM-7362 --add campaigns. CRM_Campaign_BAO_Campaign::addCampaign($this, CRM_Utils_Array::value('campaign_id', $this->_values)); - $this->addWysiwyg('intro_text', ts('Introductory Message'), $attributes['intro_text']); + $this->add('wysiwyg', 'intro_text', ts('Introductory Message'), $attributes['intro_text']); - $this->addWysiwyg('footer_text', ts('Footer Message'), $attributes['footer_text']); + $this->add('wysiwyg', 'footer_text', ts('Footer Message'), $attributes['footer_text']); //Register schema which will be used for OnBehalOf and HonorOf profile Selector CRM_UF_Page_ProfileEditor::registerSchemas(array('OrganizationModel', 'HouseholdModel')); diff --git a/CRM/Contribute/Form/ContributionPage/ThankYou.php b/CRM/Contribute/Form/ContributionPage/ThankYou.php index 37db949665..31a9185aa5 100644 --- a/CRM/Contribute/Form/ContributionPage/ThankYou.php +++ b/CRM/Contribute/Form/ContributionPage/ThankYou.php @@ -62,17 +62,9 @@ class CRM_Contribute_Form_ContributionPage_ThankYou extends CRM_Contribute_Form_ // thank you title and text (html allowed in text) $this->add('text', 'thankyou_title', ts('Thank-you Page Title'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_title'), TRUE); - $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_text'); - $attributes['click_wysiwyg'] = TRUE; - $this->addWysiwyg('thankyou_text', ts('Thank-you Message'), $attributes); - // FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing - // explicit height and width. - $footerAttribs = array( - 'rows' => 2, - 'cols' => 40, - 'click_wysiwyg' => TRUE, - ); - $this->addWysiwyg('thankyou_footer', ts('Thank-you Footer'), $footerAttribs); + $attributes = CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'thankyou_text') + array('class' => 'collapsed'); + $this->add('wysiwyg', 'thankyou_text', ts('Thank-you Message'), $attributes); + $this->add('wysiwyg', 'thankyou_footer', ts('Thank-you Footer'), $attributes); $this->addElement('checkbox', 'is_email_receipt', ts('Email Receipt to Contributor?'), NULL, array('onclick' => "showReceipt()")); $this->add('text', 'receipt_from_name', ts('Receipt From Name'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_ContributionPage', 'receipt_from_name')); diff --git a/CRM/Contribute/Form/ContributionPage/Widget.php b/CRM/Contribute/Form/ContributionPage/Widget.php index 9b91f478c9..e404cd185b 100644 --- a/CRM/Contribute/Form/ContributionPage/Widget.php +++ b/CRM/Contribute/Form/ContributionPage/Widget.php @@ -186,7 +186,7 @@ class CRM_Contribute_Form_ContributionPage_Widget extends CRM_Contribute_Form_Co array('onclick' => "widgetBlock(this)") ); - $this->addWysiwyg('about', ts('About'), $attributes['about']); + $this->add('wysiwyg', 'about', ts('About'), $attributes['about']); foreach ($this->_fields as $name => $val) { $this->add($val[1], diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index 97ebb604a6..c14ea1a8b1 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -183,7 +183,7 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { $this->addRule('from_email_address', ts('From Email Address is required'), 'required'); } - $this->addWysiwyg('email_comment', ts('If you would like to add personal message to email please add it here. (If sending to more then one receipient the same message will be sent to each contact.)'), array( + $this->add('wysiwyg', 'email_comment', ts('If you would like to add personal message to email please add it here. (If sending to more then one receipient the same message will be sent to each contact.)'), array( 'rows' => 2, 'cols' => 40, )); diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 59707c5c30..e80bbb153c 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -989,7 +989,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { if ($field->text_length) { $attributes['maxlength'] = $field->text_length; } - $qf->addWysiwyg($elementName, $label, $attributes, $search); + $qf->add('wysiwyg', $elementName, $label, $attributes, $search); break; case 'Autocomplete-Select': diff --git a/CRM/Core/BAO/UFGroup.php b/CRM/Core/BAO/UFGroup.php index 2c90b4bbed..dac46e3f2c 100644 --- a/CRM/Core/BAO/UFGroup.php +++ b/CRM/Core/BAO/UFGroup.php @@ -2240,7 +2240,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) $form->add('select', $name, $title, CRM_Core_PseudoConstant::worldRegion(), $required, $selectAttributes); } elseif ($fieldName == 'signature_html') { - $form->addWysiwyg($name, $title, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', $fieldName)); + $form->add('wysiwyg', $name, $title, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', $fieldName)); } elseif ($fieldName == 'signature_text') { $form->add('textarea', $name, $title, CRM_Core_DAO::getAttribute('CRM_Core_DAO_Email', $fieldName)); @@ -2258,7 +2258,7 @@ AND ( entity_id IS NULL OR entity_id <= 0 ) } } elseif ($fieldName == 'activity_details') { - $form->addWysiwyg($fieldName, $title, array('rows' => 4, 'cols' => 60), $required); + $form->add('wysiwyg', $fieldName, $title, array('rows' => 4, 'cols' => 60), $required); } elseif ($fieldName == 'activity_duration') { $form->add('text', $name, $title, $attributes, $required); diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 01a7029658..5c00193ce6 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1350,50 +1350,6 @@ class CRM_Core_Form extends HTML_QuickForm_Page { )); } - /** - * @param string $name - * @param $label - * @param $attributes - * @param bool $forceTextarea - */ - public function addWysiwyg($name, $label, $attributes, $forceTextarea = FALSE) { - // 1. Get configuration option for editor (tinymce, ckeditor, pure textarea) - // 2. Based on the option, initialise proper editor - $editorID = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, - 'editor_id' - ); - $editor = strtolower(CRM_Utils_Array::value($editorID, - CRM_Core_OptionGroup::values('wysiwyg_editor') - )); - if (!$editor || $forceTextarea) { - $editor = 'textarea'; - } - if ($editor == 'joomla default editor') { - $editor = 'joomlaeditor'; - } - - if ($editor == 'drupal default editor') { - $editor = 'drupalwysiwyg'; - } - - //lets add the editor as a attribute - $attributes['editor'] = $editor; - - $this->addElement($editor, $name, $label, $attributes); - $this->assign('editor', $editor); - - // include wysiwyg editor js files - // FIXME: This code does not make any sense - $includeWysiwygEditor = FALSE; - $includeWysiwygEditor = $this->get('includeWysiwygEditor'); - if (!$includeWysiwygEditor) { - $includeWysiwygEditor = TRUE; - $this->set('includeWysiwygEditor', $includeWysiwygEditor); - } - - $this->assign('includeWysiwygEditor', $includeWysiwygEditor); - } - /** * @param int $id * @param $title diff --git a/CRM/Custom/Form/Group.php b/CRM/Custom/Form/Group.php index 2896c9462e..46f3a1c0f0 100644 --- a/CRM/Custom/Form/Group.php +++ b/CRM/Custom/Form/Group.php @@ -335,8 +335,8 @@ class CRM_Custom_Form_Group extends CRM_Core_Form { $this->assign('defaultSubtypes', json_encode($this->_subtypes)); // help text - $this->addWysiwyg('help_pre', ts('Pre-form Help'), $attributes['help_pre']); - $this->addWysiwyg('help_post', ts('Post-form Help'), $attributes['help_post']); + $this->add('wysiwyg', 'help_pre', ts('Pre-form Help'), $attributes['help_pre']); + $this->add('wysiwyg', 'help_post', ts('Post-form Help'), $attributes['help_post']); // weight $this->add('text', 'weight', ts('Order'), $attributes['weight'], TRUE); diff --git a/CRM/Event/Form/ManageEvent/EventInfo.php b/CRM/Event/Form/ManageEvent/EventInfo.php index db79e3af5c..2b3e1a701a 100644 --- a/CRM/Event/Form/ManageEvent/EventInfo.php +++ b/CRM/Event/Form/ManageEvent/EventInfo.php @@ -204,7 +204,7 @@ class CRM_Event_Form_ManageEvent_EventInfo extends CRM_Event_Form_ManageEvent { $this->addSelect('participant_listing_id', array('placeholder' => ts('Disabled'), 'option_url' => NULL)); $this->add('textarea', 'summary', ts('Event Summary'), $attributes['summary']); - $this->addWysiwyg('description', ts('Complete Description'), $attributes['event_description']); + $this->add('wysiwyg', 'description', ts('Complete Description'), $attributes['event_description']); $this->addElement('checkbox', 'is_public', ts('Public Event')); $this->addElement('checkbox', 'is_share', ts('Allow sharing through social media?')); $this->addElement('checkbox', 'is_map', ts('Include Map to Event Location')); diff --git a/CRM/Event/Form/ManageEvent/Fee.php b/CRM/Event/Form/ManageEvent/Fee.php index a0ba29fb33..50ae47e8c3 100644 --- a/CRM/Event/Form/ManageEvent/Fee.php +++ b/CRM/Event/Form/ManageEvent/Fee.php @@ -282,7 +282,7 @@ class CRM_Event_Form_ManageEvent_Fee extends CRM_Event_Form_ManageEvent { CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_text'), FALSE ); - $this->addWysiwyg('pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_receipt')); + $this->add('wysiwyg', 'pay_later_receipt', ts('Pay Later Instructions'), CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'pay_later_receipt')); $this->addElement('checkbox', 'is_billing_required', ts('Billing address required')); $this->add('text', 'fee_label', ts('Fee Label')); diff --git a/CRM/Event/Form/ManageEvent/Registration.php b/CRM/Event/Form/ManageEvent/Registration.php index 3a24bb1d96..cac7a8fd04 100644 --- a/CRM/Event/Form/ManageEvent/Registration.php +++ b/CRM/Event/Form/ManageEvent/Registration.php @@ -314,17 +314,9 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent * */ public function buildRegistrationBlock(&$form) { - $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event'); - $attributes['intro_text']['click_wysiwyg'] = TRUE; - $form->addWysiwyg('intro_text', ts('Introductory Text'), $attributes['intro_text']); - // FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing - // explicit height and width. - $footerAttribs = array( - 'rows' => 2, - 'cols' => 40, - 'click_wysiwyg' => TRUE, - ); - $form->addWysiwyg('footer_text', ts('Footer Text'), $footerAttribs); + $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event', 'intro_text') + array('class' => 'collapsed'); + $form->add('wysiwyg', 'intro_text', ts('Introductory Text'), $attributes); + $form->add('wysiwyg', 'footer_text', ts('Footer Text'), $attributes); extract(self::getProfileSelectorTypes()); //CRM-15427 @@ -401,7 +393,6 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent */ public function buildConfirmationBlock(&$form) { $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event'); - $attributes['confirm_text']['click_wysiwyg'] = TRUE; // CRM-11182 - Optional confirmation page for free events $is_monetary = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $form->_id, 'is_monetary'); $form->assign('is_monetary', $is_monetary); @@ -409,15 +400,8 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent $form->addYesNo('is_confirm_enabled', ts('Use a confirmation screen?'), NULL, NULL, array('onclick' => "return showHideByValue('is_confirm_enabled','','confirm_screen_settings','block','radio',false);")); } $form->add('text', 'confirm_title', ts('Title'), $attributes['confirm_title']); - $form->addWysiwyg('confirm_text', ts('Introductory Text'), $attributes['confirm_text']); - // FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing - // explicit height and width. - $footerAttribs = array( - 'rows' => 2, - 'cols' => 40, - 'click_wysiwyg' => TRUE, - ); - $form->addWysiwyg('confirm_footer_text', ts('Footer Text'), $footerAttribs); + $form->add('wysiwyg', 'confirm_text', ts('Introductory Text'), $attributes['confirm_text'] + array('class' => 'collapsed')); + $form->add('wysiwyg', 'confirm_footer_text', ts('Footer Text'), $attributes['confirm_text'] + array('class' => 'collapsed')); } /** @@ -445,17 +429,9 @@ class CRM_Event_Form_ManageEvent_Registration extends CRM_Event_Form_ManageEvent */ public function buildThankYouBlock(&$form) { $attributes = CRM_Core_DAO::getAttribute('CRM_Event_DAO_Event'); - $attributes['thankyou_text']['click_wysiwyg'] = TRUE; $form->add('text', 'thankyou_title', ts('Title'), $attributes['thankyou_title']); - $form->addWysiwyg('thankyou_text', ts('Introductory Text'), $attributes['thankyou_text']); - // FIXME: This hack forces height of editor to 175px. Need to modify QF classes for editors to allow passing - // explicit height and width. - $footerAttribs = array( - 'rows' => 2, - 'cols' => 40, - 'click_wysiwyg' => TRUE, - ); - $form->addWysiwyg('thankyou_footer_text', ts('Footer Text'), $footerAttribs); + $form->add('wysiwyg', 'thankyou_text', ts('Introductory Text'), $attributes['thankyou_text'] + array('class' => 'collapsed')); + $form->add('wysiwyg', 'thankyou_footer_text', ts('Footer Text'), $attributes['thankyou_text'] + array('class' => 'collapsed')); } /** diff --git a/CRM/Friend/BAO/Friend.php b/CRM/Friend/BAO/Friend.php index 545b7fd5f9..53617dbed8 100644 --- a/CRM/Friend/BAO/Friend.php +++ b/CRM/Friend/BAO/Friend.php @@ -246,7 +246,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend { $form->add('text', 'tf_title', ts('Title'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'title'), TRUE); // intro-text and thank-you text - $form->addWysiwyg('intro', ts('Introduction'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'intro'), TRUE); + $form->add('wysiwyg', 'intro', ts('Introduction'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'intro') + array('class' => 'collapsed')); $form->add('textarea', 'suggested_message', ts('Suggested Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'suggested_message'), FALSE @@ -256,7 +256,7 @@ class CRM_Friend_BAO_Friend extends CRM_Friend_DAO_Friend { $form->add('text', 'tf_thankyou_title', ts('Thank-you Title'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'thankyou_title'), TRUE); - $form->addWysiwyg('tf_thankyou_text', ts('Thank-you Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'thankyou_text'), TRUE); + $form->add('wysiwyg', 'tf_thankyou_text', ts('Thank-you Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'thankyou_text') + array('class' => 'collapsed')); if ($form->_friendId) { // CRM-14200 the i18n dialogs need this for translation diff --git a/CRM/Friend/Form.php b/CRM/Friend/Form.php index f8da2d709e..b48829235d 100644 --- a/CRM/Friend/Form.php +++ b/CRM/Friend/Form.php @@ -195,7 +195,7 @@ class CRM_Friend_Form extends CRM_Core_Form { ); $email->freeze(); - $this->addWysiwyg('suggested_message', ts('Your Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'suggested_message')); + $this->add('wysiwyg', 'suggested_message', ts('Your Message'), CRM_Core_DAO::getAttribute('CRM_Friend_DAO_Friend', 'suggested_message')); $friend = array(); $mailLimit = self::NUM_OPTION; if ($this->_entityTable == 'civicrm_pcp') { diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php index a0c7b9176e..42dca2625f 100644 --- a/CRM/Mailing/BAO/Mailing.php +++ b/CRM/Mailing/BAO/Mailing.php @@ -2663,7 +2663,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id if ($className != 'CRM_SMS_Form_Upload' && $className != 'CRM_Contact_Form_Task_SMS' && $className != 'CRM_Contact_Form_Task_SMS' ) { - $form->addWysiwyg('html_message', + $form->add('wysiwyg', 'html_message', ts('HTML Format'), array( 'cols' => '80', @@ -2763,7 +2763,7 @@ LEFT JOIN civicrm_mailing_group g ON g.mailing_id = m.id ); $form->add('text', 'saveTemplateName', ts('Template Title')); - $form->addWysiwyg('html_message', + $form->add('wysiwyg', 'html_message', ts('Your Letter'), array( 'cols' => '80', diff --git a/CRM/Mailing/Form/ForwardMailing.php b/CRM/Mailing/Form/ForwardMailing.php index 9de95bd79f..4a5f063239 100644 --- a/CRM/Mailing/Form/ForwardMailing.php +++ b/CRM/Mailing/Form/ForwardMailing.php @@ -83,7 +83,7 @@ class CRM_Mailing_Form_ForwardMailing extends CRM_Core_Form { //insert message Text by selecting "Select Template option" $this->add('textarea', 'forward_comment', ts('Comment'), array('cols' => '80', 'rows' => '8')); - $this->addWysiwyg('html_comment', + $this->add('wysiwyg', 'html_comment', ts('HTML Message'), array('cols' => '80', 'rows' => '8') ); diff --git a/CRM/Member/Form/MembershipBlock.php b/CRM/Member/Form/MembershipBlock.php index 13f92b6ab1..bb4f00947c 100644 --- a/CRM/Member/Form/MembershipBlock.php +++ b/CRM/Member/Form/MembershipBlock.php @@ -121,11 +121,11 @@ class CRM_Member_Form_MembershipBlock extends CRM_Contribute_Form_ContributionPa $this->addElement('text', 'new_title', ts('Title - New Membership'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'new_title')); - $this->addWysiwyg('new_text', ts('Introductory Message - New Memberships'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'new_text')); + $this->add('wysiwyg', 'new_text', ts('Introductory Message - New Memberships'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'new_text')); $this->addElement('text', 'renewal_title', ts('Title - Renewals'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'renewal_title')); - $this->addWysiwyg('renewal_text', ts('Introductory Message - Renewals'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'renewal_text')); + $this->add('wysiwyg', 'renewal_text', ts('Introductory Message - Renewals'), CRM_Core_DAO::getAttribute('CRM_Member_DAO_MembershipBlock', 'renewal_text')); $this->addElement('checkbox', 'is_required', ts('Require Membership Signup')); $this->addElement('checkbox', 'display_min_fee', ts('Display Membership Fee')); diff --git a/CRM/UF/Form/Group.php b/CRM/UF/Form/Group.php index 7f6ec3cb70..21b1c9ee12 100644 --- a/CRM/UF/Form/Group.php +++ b/CRM/UF/Form/Group.php @@ -148,8 +148,8 @@ class CRM_UF_Form_Group extends CRM_Core_Form { $this->addGroup($uf_group_type, 'uf_group_type', ts('Used For'), ' '); // help text - $this->addWysiwyg('help_pre', ts('Pre-form Help'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'help_post')); - $this->addWysiwyg('help_post', ts('Post-form Help'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'help_post')); + $this->add('wysiwyg', 'help_pre', ts('Pre-form Help'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'help_post')); + $this->add('wysiwyg', 'help_post', ts('Post-form Help'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFGroup', 'help_post')); // weight $this->add('text', 'weight', ts('Order'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_UFJoin', 'weight'), TRUE); diff --git a/tools/CRM/Auction/Form/Auction.php b/tools/CRM/Auction/Form/Auction.php index 4cfb8354ed..b96d6b179d 100644 --- a/tools/CRM/Auction/Form/Auction.php +++ b/tools/CRM/Auction/Form/Auction.php @@ -114,7 +114,7 @@ class CRM_Auction_Form_Auction extends CRM_Core_Form { TRUE ); - $this->addWysiwyg('description', + $this->add('wysiwyg', 'description', ts('Complete Description'), $attributes['description'] ); diff --git a/tools/CRM/Auction/Form/Item.php b/tools/CRM/Auction/Form/Item.php index 6633980e7e..c21221c650 100644 --- a/tools/CRM/Auction/Form/Item.php +++ b/tools/CRM/Auction/Form/Item.php @@ -141,7 +141,7 @@ class CRM_Auction_Form_Item extends CRM_Core_Form { TRUE ); - $this->addWysiwyg('description', + $this->add('wysiwyg', 'description', ts('Complete Description'), $attributes['description'] ); -- 2.25.1