CRM-16354 - Remove old wysiwyg code
authorColeman Watts <coleman@civicrm.org>
Wed, 29 Apr 2015 04:29:50 +0000 (22:29 -0600)
committerColeman Watts <coleman@civicrm.org>
Wed, 29 Apr 2015 04:29:50 +0000 (22:29 -0600)
33 files changed:
CRM/Activity/Form/Activity.php
CRM/Admin/Form/Preferences/Display.php
CRM/Contact/Form/Relationship.php
CRM/Core/Form/Search.php
CRM/Core/Page.php
CRM/Core/Smarty.php
CRM/Event/Page/ManageEvent.php
js/wysiwyg/crm.ckeditor.js
templates/CRM/Activity/Form/Activity.tpl
templates/CRM/Admin/Form/MessageTemplates.tpl
templates/CRM/Admin/Page/MessageTemplates.tpl
templates/CRM/Admin/Page/ScheduleReminders.tpl
templates/CRM/Batch/Form/Entry.js
templates/CRM/Batch/Form/Entry.tpl
templates/CRM/Campaign/Form/Survey/Main.tpl
templates/CRM/Case/Form/Activity.tpl
templates/CRM/Case/Form/Case.tpl
templates/CRM/Case/Page/CustomDataView.tpl
templates/CRM/Contact/Form/Relationship.tpl
templates/CRM/Contact/Form/Task/Email.hlp
templates/CRM/Contact/Form/Task/EmailCommon.tpl
templates/CRM/Contact/Form/Task/PDFLetterCommon.tpl
templates/CRM/Contact/Page/View/Summary.tpl
templates/CRM/Mailing/Form/ForwardMailing.tpl
templates/CRM/Mailing/Form/InsertTokens.tpl
templates/CRM/common/TabHeader.tpl
templates/CRM/common/batchCopy.tpl
templates/CRM/common/customData.tpl
templates/CRM/common/drupal.tpl
templates/CRM/common/drupal6.tpl
templates/CRM/common/joomla.tpl
templates/CRM/common/wordpress.tpl
templates/CRM/common/wysiwyg.tpl [deleted file]

index 1fe07df7cb32008c2e2513839f22bba1484893ac..cc825b6a9c980b7fcf92af9bfd65b53af7f7c5ef 100644 (file)
@@ -157,8 +157,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
       'details' => array(
         'type' => 'wysiwyg',
         'label' => ts('Details'),
-        // forces a smaller edit window
-        'attributes' => array('rows' => 4, 'cols' => 60),
+        'attributes' => array('class' => 'huge'),
         'required' => FALSE,
       ),
       'status_id' => array(
@@ -664,10 +663,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
         $attribute = CRM_Utils_Array::value('attributes', $values);
         $required = !empty($values['required']);
 
-        if ($values['type'] == 'wysiwyg') {
-          $this->addWysiwyg($field, $values['label'], $attribute, $required);
-        }
-        elseif ($values['type'] == 'select' && empty($attribute)) {
+        if ($values['type'] == 'select' && empty($attribute)) {
           $this->addSelect($field, array('entity' => 'activity'), $required);
         }
         elseif ($values['type'] == 'entityRef') {
index 5fde51486a25340a64cd04f06ee7df68b1114b4f..6fb5569b47cd1a3678176228b86b5e728cc624f2 100644 (file)
@@ -226,17 +226,8 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
       CRM_Core_BAO_OptionValue::updateOptionWeights($opGroupId, array_flip($preferenceWeights));
     }
 
-    $config = CRM_Core_Config::singleton();
-    if ($config->userSystem->is_drupal == '1' && module_exists("wysiwyg")) {
-      variable_set('civicrm_wysiwyg_input_format', $this->_params['wysiwyg_input_format']);
-    }
-
     $this->_config->editor_id = $this->_params['editor_id'];
 
-    // set default editor to session if changed
-    $session = CRM_Core_Session::singleton();
-    $session->set('defaultWysiwygEditor', $this->_params['editor_id']);
-
     $this->postProcessCommon();
   }
 
index 275b27b66cbb1205b356087ad26866494a6dd472..661432c665531160c3f9515880c4ba7ca5a34230 100644 (file)
@@ -297,8 +297,6 @@ class CRM_Contact_Form_Relationship extends CRM_Core_Form {
       );
       return;
     }
-    // Just in case custom data includes a rich text field
-    $this->assign('includeWysiwygEditor', TRUE);
 
     // Select list
     $relationshipList = CRM_Contact_BAO_Relationship::getContactRelationshipType($this->_contactId, $this->_rtype, $this->_relationshipId);
index 9aba90f82489f07ab4f47dd399dc42b192b66a51..98af3869686700524173b6c2b8862ac94d9de06b 100644 (file)
@@ -94,14 +94,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form {
    * Common buildform tasks required by all searches
    */
   public function buildQuickform() {
-    $resources = CRM_Core_Resources::singleton();
-
-    if ($resources->ajaxPopupsEnabled) {
-      // Script needed by some popups
-      $this->assign('includeWysiwygEditor', TRUE);
-    }
-
-    $resources
+    CRM_Core_Resources::singleton()
       ->addScriptFile('civicrm', 'js/crm.searchForm.js', 1, 'html-header')
       ->addStyleFile('civicrm', 'css/searchForm.css', 1, 'html-header');
 
index 0dd6d871420d942888f896d756681ce9cac5c3be..97f07de085e3de0c05d52b5ed432bca6f6594a12 100644 (file)
@@ -227,7 +227,6 @@ class CRM_Core_Page {
       CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'ajaxPopupsEnabled', NULL, TRUE)
     ) {
       CRM_Core_Resources::singleton()->addScriptFile('civicrm', 'js/crm.livePage.js', 1, 'html-header');
-      $this->assign('includeWysiwygEditor', TRUE);
     }
 
     $content = self::$_template->fetch('CRM/common/' . strtolower($config->userFramework) . '.tpl');
index 1e7b03379e10bca5ea907716e8b33013143843c7..7553d4ae86da63cf81051811312320b20b67307e 100644 (file)
@@ -141,20 +141,6 @@ class CRM_Core_Smarty extends Smarty {
     $this->assign_by_ref('config', $config);
     $this->assign_by_ref('session', $session);
 
-    // check default editor and assign to template
-    $defaultWysiwygEditor = $session->get('defaultWysiwygEditor');
-    if (!$defaultWysiwygEditor && !CRM_Core_Config::isUpgradeMode()) {
-      $defaultWysiwygEditor = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
-        'editor_id'
-      );
-      // For logged-in users, store it in session to reduce db calls
-      if ($session->get('userID')) {
-        $session->set('defaultWysiwygEditor', $defaultWysiwygEditor);
-      }
-    }
-
-    $this->assign('defaultWysiwygEditor', $defaultWysiwygEditor);
-
     global $tsLocale;
     $this->assign('tsLocale', $tsLocale);
 
index 75ae25dbdd4c3ff91841030fc732bd62418fd31b..4dae8e7c6195d136f1121feda070f62c0a5f3882 100644 (file)
@@ -248,7 +248,6 @@ class CRM_Event_Page_ManageEvent extends CRM_Core_Page {
    * @return void
    */
   public function browse() {
-    $this->assign('includeWysiwygEditor', TRUE);
     $this->_sortByCharacter = CRM_Utils_Request::retrieve('sortByCharacter',
       'String',
       $this
index f42ab23319713c4383cb349df82d6a8e8c82b1b8..fe7fc499d8ff881744f9e07cc61258ee9feaf849 100644 (file)
@@ -25,6 +25,9 @@
       editor.config.filebrowserUploadUrl = uploadUrl + '&type=files';
       editor.config.filebrowserImageUploadUrl = uploadUrl + '&type=images';
       editor.config.filebrowserFlashUploadUrl = uploadUrl + '&type=flash';
+      editor.on('focus', function() {
+        $(item).trigger('focus');
+      });
       editor.on('blur', function() {
         editor.updateElement();
         $(item).trigger("blur");
index 896c090f7e6e1a4a0e028f94023d8fdf2e76fe04..9916977ef0cc9fdaae79f68645d6880af51b23b5 100644 (file)
     <td class="label">{$form.details.label}</td>
     {if $activityTypeName eq "Print PDF Letter"}
       <td class="view-value">
-      {* If using plain textarea, assign class=huge to make input large enough. *}
-      {if $defaultWysiwygEditor eq 0}{$form.details.html|crmAddClass:huge}{else}{$form.details.html}{/if}
+      {$form.details.html}
       </td>
       {else}
       <td class="view-value">
-      {* If using plain textarea, assign class=huge to make input large enough. *}
-       {if $defaultWysiwygEditor eq 0}{$form.details.html|crmStripAlternatives|crmAddClass:huge}{else}{$form.details.html|crmStripAlternatives}{/if}
+       {$form.details.html|crmStripAlternatives}
       </td>
     {/if}
   </tr>
index ca03ec8860a7efaca52cc0bd3c1f271d3614a427..2f362dde80045f8a5a3c21c5406a7bec2c463ea7 100644 (file)
@@ -69,7 +69,7 @@
          <div class="crm-accordion-body">
            <div class="helpIcon" id="helphtml">
              <input class="crm-token-selector big" data-field="html_message" />
-             {help id="id-token-html" tplFile=$tplFile isAdmin=$isAdmin editor=$editor file="CRM/Contact/Form/Task/Email.hlp"}
+             {help id="id-token-html" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"}
            </div>
                 <div class="clear"></div>
                 <div class='html resizable-textarea'>
index c17fac045160e67182c7729270f1d86fe31b8d17..ef4ce5405f58ca60652d51aaff83c3ddd1eefe97 100644 (file)
@@ -87,9 +87,6 @@
 
 {if $rows and $action ne 2 and $action ne 4}
 
-  {* include wysiwyg related files*}
-  {include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
-
   <div id='mainTabContainer'>
     <ul>
       <li id='tab_user'>    <a href='#user'     title='{ts}User-driven Messages{/ts}'>    {ts}User-driven Messages{/ts}    </a></li>
index 7f6cb7eaba9fa90d73d6d4661cf3cc18e1def6f6..ff9c7da401a33a5e8f49983fd99094e4f7da726b 100644 (file)
@@ -33,8 +33,6 @@
 {if $action eq 1 or $action eq 2 or $action eq 8 or $action eq 16384}
    {include file="CRM/Admin/Form/ScheduleReminders.tpl"}
 {else}
-  {* include wysiwyg related files*}
-  {include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
   {if !$component}
     {capture assign=schedRemindersDocLink}{docURL page="user/current/email/scheduled-reminders/"}{/capture}
     <div class="help">
index 5a5ce82dcee77fc3048c0be3885897b50bf720f0..76de1283bcdb99e1e1b9b95cca778422836677db 100755 (executable)
@@ -216,9 +216,6 @@ function setFieldValue(fname, fieldValue, blockNo) {
   //check if it is date element
   var isDateElement = elementId.attr('format');
 
-  // check if it is wysiwyg element
-  var editor = elementId.attr('editor');
-
   //get the element type
   var elementType = elementId.attr('type');
 
@@ -244,25 +241,8 @@ function setFieldValue(fname, fieldValue, blockNo) {
       }
     }
     else {
-      if (editor) {
-        switch (editor) {
-          case 'ckeditor':
-            elemtId = elementId.attr('id');
-            oEditor = CKEDITOR.instances[elemtId];
-            oEditor.setData(htmlContent);
-            break;
-          case 'tinymce':
-            var elemtId = element.attr('id');
-            tinyMCE.get(elemtId).setContent(htmlContent);
-            break;
-          case 'joomlaeditor':
-            // TO DO
-          case 'drupalwysiwyg':
-            // TO DO
-            break;
-          default:
-            elementId.val(fieldValue);
-        }
+      if (elementId.is('textarea')) {
+        CRM.wysiwyg.setVal(elementId, fieldValue);
       }
       else {
         elementId.val(fieldValue);
index ec71ea6737976f7cc3cf8da3dbe6370a0ef16fbb..f2f33d856cde2f8f82713049adbac989a7ca7d04 100755 (executable)
@@ -427,9 +427,6 @@ function setFieldValue(fname, fieldValue, blockNo) {
   //check if it is date element
   var isDateElement = elementId.attr('format');
 
-  // check if it is wysiwyg element
-  var editor = elementId.attr('editor');
-
   //get the element type
   var elementType = elementId.attr('type');
 
@@ -455,24 +452,8 @@ function setFieldValue(fname, fieldValue, blockNo) {
       }
     }
     else {
-      if (editor) {
-        switch (editor) {
-          case 'ckeditor':
-            var elemtId = elementId.attr('id');
-            oEditor = CKEDITOR.instances[elemtId];
-            oEditor.setData(htmlContent);
-            break;
-          case 'tinymce':
-            var elemtId = element.attr('id');
-            tinyMCE.get(elemtId).setContent(htmlContent);
-            break;
-          case 'joomlaeditor':
-          // TO DO
-          case 'drupalwysiwyg':
-          // TO DO
-          default:
-            elementId.val(fieldValue);
-        }
+      if (elementId.is('textarea')) {
+        CRM.wysiwyg.setVal(elementId, fieldValue);
       }
       else {
         elementId.val(fieldValue);
index 46dc9dde1816614d5e7eed0bb93433623cfb26a8..93dd5416ad8cef282cf4ddda40e90ece294d8d55 100644 (file)
     });
 </script>
 {/literal}
-{* editor has already been included in TabHeader.tpl so set flag true *}
-{include file="CRM/common/customData.tpl" includeWysiwygEditor=true}
 {literal}
   <script type="text/javascript">
     CRM.$(function($) {
index ff8de35be0b2a8497ddb5b1d8fe9fced4e19e702..413878d027bcd7e15e987c99cc2d5aff23b59dda 100644 (file)
@@ -64,8 +64,7 @@
       <tr class="crm-case-activity-form-block-details">
         <td class="label">{ts}Notes{/ts}</td>
         <td class="view-value">
-          {* If using plain textarea, assign class=huge to make input large enough. *}
-          {if $defaultWysiwygEditor eq 0}{$form.details.html|crmAddClass:huge}{else}{$form.details.html}{/if}
+          {$form.details.html}
         </td>
       </tr>
       {* Added Activity Details accordion tab *}
                 <tr class="crm-case-activity-form-block-details">
                   <td class="label">{$form.details.label}</td>
                   <td class="view-value">
-                  {* If using plain textarea, assign class=huge to make input large enough. *}
-                    {if $defaultWysiwygEditor eq 0}{$form.details.html|crmAddClass:huge}{else}{$form.details.html}{/if}
+                    {$form.details.html}
                   </td>
                 </tr>
               {/if}
index 4e4b1e44cf8bca840375bafa2a585f689356162f..a693ee142ef779d897410964339a541c723a6166 100644 (file)
@@ -76,7 +76,7 @@
 {if $form.activity_details.html}
     <tr class="crm-case-form-block-activity_details">
         <td class="label">{$form.activity_details.label}{help id="id-details" activityTypeFile=$activityTypeFile file="CRM/Case/Form/Case.hlp"}</td>
-        <td class="view-value">{if $defaultWysiwygEditor eq 0}{$form.activity_details.html|crmStripAlternatives|crmAddClass:huge40}{else}{$form.activity_details.html|crmStripAlternatives}{/if}</td>
+        <td class="view-value">{$form.activity_details.html|crmStripAlternatives}</td>
     </tr>
 {/if}
 
index 99b31b3af7663d276fb279122a2efc589f5af2d5..c5552e843ba78998fca39b126e127cba3b876434 100644 (file)
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
-{* include wysiwyg related files*}
-{if !$includeWysiwygEditor}
-  {include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
-{/if}
 {* Custom Data view mode*}
 {foreach from=$viewCustomData item=customValues key=customGroupId}
   {foreach from=$customValues item=cd_edit key=cvID}
index d009e724716e2befa13afcfae7381e26ba925a6d..a5fe163a18d2e5379e0b27eda97ec0cbecd4314d 100644 (file)
     </div>
   {/if}
   {if ($action EQ 1) OR ($action EQ 2) }
-    {*include custom data js file - setting includeWysiwygEditor=TRUE because it's already been loaded*}
-    {include file="CRM/common/customData.tpl" includeWysiwygEditor=TRUE}
+    {*include custom data js file *}
+    {include file="CRM/common/customData.tpl"}
     <script type="text/javascript">
       {literal}
       CRM.$(function($) {
index 395b2b1cc70d922b7d203eddf3ae1cede07205f2..0797f7a3d567c5b7eb1718fa19f4eb8caf986403 100644 (file)
@@ -68,21 +68,14 @@ be an equal sign and a number (=12). The number (12 in this example) is the id o
 {if $params.tplFile EQ 'CRM/Mailing/Form/Upload.tpl'}
     <p>
     {ts}You will also use tokens to insert Unsubscribe, Opt out and Forwarding links in your message.{/ts}
-    {if $params.editor NEQ 'textarea'}
         {ts}Use these steps to insert clickable action links:{/ts}
         <ul>
             <li>{ts}Select the action token from the Insert Tokens pop-up list - e.g. Unsubscribe via web page - and insert into your message.{/ts}</li>
             <li>{ts 1='&#123;action.unsubscribeUrl&#125;}'}Highlight the token and copy it to your clipboard - e.g. %1.{/ts}</li>
             <li>{ts}Replace the token in your message with the text you want for the link - e.g. Click here to unsubscribe.{/ts}</li>
             <li>{ts}With the text highlighted, click the Insert/Edit Link icon in the editor toolbar.{/ts}</li>
-            {if $params.editor EQ 'fckeditor'}
-                <li>{ts}In the Link pop-up window select &lt;other&gt; for the &quot;Protocol&quot; (selecting &quot;http://&quot; will result in an invalid link).{/ts}</li>
-                <li>{ts}Paste the action token into the URL field and click OK.{/ts}</li>
-            {else}
-                <li>{ts}Paste the action token into the URL field and click Insert (or Update).{/ts}</li>
-            {/if}
+            <li>{ts}Paste the action token into the URL field and click Insert (or Update).{/ts}</li>
         </ul>
-    {/if}
     </p>
 {/if}
 <p>{ts}Custom tokens (based on custom data) can be added for organizations as well. These tokens will not be displayed in the list of available tokens, but can be added manually. The format is {literal}{contact.custom_12}{/literal} â€“ where 12 is the ID of the custom data field. To find the custom data field ID,
index 116d5b4ea75a311fef0363525a37a59d9fddbb06..1d876350a44848671f9ccc53c64ccc87efaf037b 100644 (file)
@@ -33,7 +33,7 @@
  <div class="crm-accordion-body">
   <div class="helpIcon" id="helphtml">
     <input class="crm-token-selector big" data-field="html_message" />
-    {help id="id-token-html" tplFile=$tplFile isAdmin=$isAdmin editor=$editor file="CRM/Contact/Form/Task/Email.hlp"}
+    {help id="id-token-html" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"}
   </div>
   <div class="clear"></div>
     <div class='html'>
index 89f6c21eed50ac806d2dbd5aea7be3f6f8bf325a..44ab458598586554542d0ccf74727738be241bf2 100644 (file)
  <div class="crm-accordion-body">
    <div class="helpIcon" id="helphtml">
      <input class="crm-token-selector big" data-field="html_message" />
-     {help id="id-token-html" tplFile=$tplFile isAdmin=$isAdmin editor=$editor file="CRM/Contact/Form/Task/Email.hlp"}
+     {help id="id-token-html" tplFile=$tplFile isAdmin=$isAdmin file="CRM/Contact/Form/Task/Email.hlp"}
    </div>
     <div class="clear"></div>
     <div class='html'>
-  {if $editor EQ 'textarea'}
-      <div class="help description">{ts}NOTE: If you are composing HTML-formatted messages, you may want to enable a Rich Text (WYSIWYG) editor (Administer &raquo; Customize Data & Screens &raquo; Display Preferences).{/ts}</div>
-  {/if}
   {$form.html_message.html}<br />
     </div>
 
index 2c82fa25731fe1b3414df0fb3c8d87d96099c6b1..255403d894a2cbee51a8030de3467641be17bfd3 100644 (file)
@@ -28,8 +28,6 @@
   {include file="CRM/Contact/Form/Contact.tpl"}
 {else}
 
-  {include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
-
   <div class="crm-summary-contactname-block crm-inline-edit-container">
     <div class="crm-summary-block" id="contactname-block">
       {include file="CRM/Contact/Page/Inline/ContactName.tpl"}
index 4da4c17ca300685a910200b5a769ab3affa60fee..4637ddfe92ca3dd987ea4b8a68b15bac5d181bd8 100644 (file)
 <div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
 </div>
 
-{literal}
-<script type="text/javascript" >
-var editor = {/literal}"{$editor}"{literal};
-{/literal}
-{if $editor eq "fckeditor"}
-{literal}
-  function FCKeditor_OnComplete( editorInstance )
-  {
-     oEditor = FCKeditorAPI.GetInstance('html_comment');
-    loadEditor();
-    editorInstance.Events.AttachEvent( 'OnFocus') ;
-      }
-{/literal}
-{/if}
-{if $editor eq "tinymce"}
-{literal}
-  function customEvent() {
-    loadEditor();
-    tinyMCE.get('html_comment').onKeyPress.add(function(ed, e) {
-     });
-  }
-
-tinyMCE.init({
-  oninit : "customEvent"
-});
-
-{/literal}
-{/if}
-{literal}
-</script>
-{/literal}
index 57dc5c8122c901cc18b9940ba497512eaa72eafc..a711b1b76b9965e1db40ed342905cc27347c4809 100644 (file)
@@ -75,7 +75,6 @@ var isMailing    = false;
 {/if}
 {literal}
 
-var editor = {/literal}"{$editor}"{literal};
 function showSaveUpdateChkBox(prefix) {
   prefix = prefix || '';
   if (document.getElementById(prefix + "template") == null) {
@@ -127,33 +126,7 @@ function selectValue( val, prefix) {
         document.getElementById("text_message").value ="";
       }
     }
-    if ( editor == "ckeditor" ) {
-      oEditor = CKEDITOR.instances[html_message];
-      oEditor.setData('');
-    }
-    else if ( editor == "tinymce" ) {
-      tinyMCE.getInstanceById(html_message).setContent( html_body );
-    }
-    else if ( editor == "joomlaeditor" ) {
-      document.getElementById(html_message).value = '' ;
-      tinyMCE.execCommand('mceSetContent',false, '');
-    }
-    else if ( editor =="drupalwysiwyg" ) {
-      if (Drupal.wysiwyg.instances[html_message].setContent) {
-        Drupal.wysiwyg.instances[html_message].setContent(html_body);
-      }
-      // @TODO: Remove this when http://drupal.org/node/614146 drops
-      else if (Drupal.wysiwyg.instances[html_message].insert) {
-        alert("Please note your editor doesn't completely support this function. You may need to clear the contents of the editor prior to choosing a new template.");
-        Drupal.wysiwyg.instances[html_message].insert(html_body);
-      }
-      else {
-        alert("Sorry, your editor doesn't support this function yet.");
-      }
-    }
-    else {
-      document.getElementById(html_message).value = '' ;
-    }
+    CRM.wysiwyg.setVal('#' + html_message, '');
     if ( isPDF ) {
       showBindFormatChkBox();
     }
@@ -184,38 +157,9 @@ function selectValue( val, prefix) {
     else {
       cj("#subject").val( data.subject );
     }
-    var html_body  = "";
-    if (  data.msg_html ) {
-      html_body = data.msg_html;
-    }
 
-    if (editor == "ckeditor") {
-      oEditor = CKEDITOR.instances[html_message];
-      oEditor.setData( html_body );
-    }
-    else if (editor == "tinymce") {
-      tinyMCE.execInstanceCommand('html_message',"mceInsertContent",false, html_body );
-    }
-    else if (editor == "joomlaeditor") {
-      cj("#"+ html_message).val( html_body );
-      tinyMCE.execCommand('mceSetContent',false, html_body);
-    }
-    else if ( editor =="drupalwysiwyg") {
-      if (Drupal.wysiwyg.instances[html_message].setContent) {
-        Drupal.wysiwyg.instances[html_message].setContent(html_body);
-      }
-      // @TODO: Remove this when http://drupal.org/node/614146 drops
-      else if (Drupal.wysiwyg.instances[html_message].insert) {
-        alert("Please note your editor doesn't completely support this function. You may need to clear the contents of the editor prior to choosing a new template.");
-        Drupal.wysiwyg.instances[html_message].insert(html_body);
-      }
-      else {
-        alert("Sorry, your editor doesn't support this function yet.");
-      }
-    }
-    else {
-      cj("#"+ html_message).val( html_body );
-    }
+    CRM.wysiwyg.setVal('#' + html_message, data.msg_html || '');
+
     if (isPDF) {
       var bind = data.pdf_format_id ? true : false ;
       selectFormat( data.pdf_format_id, bind );
@@ -270,52 +214,7 @@ if ( isMailing ) {
     showSaveUpdateChkBox();
   }
 
-  {/literal}
-  {if $editor eq "ckeditor"}
-  {literal}
-    CRM.$(function($) {
-      oEditor = CKEDITOR.instances['html_message'];
-      oEditor.BaseHref = '' ;
-      oEditor.UserFilesPath = '' ;
-      oEditor.on( 'focus', verify );
-    });
-  {/literal}
-  {elseif $editor eq "tinymce"}
-  {literal}
-    CRM.$(function($) {
-      if ( isMailing ) {
-        $('div.html').hover(
-          function( ) {
-            if ( tinyMCE.get(html_message) ) {
-              tinyMCE.get(html_message).onKeyUp.add(function() {
-                verify( );
-              });
-            }
-          },
-          function( ) {
-            if ( tinyMCE.get(html_message) ) {
-              if ( tinyMCE.get(html_message).getContent() ) {
-                verify( );
-              }
-            }
-          }
-        );
-      }
-    });
-  {/literal}
-  {elseif $editor eq "drupalwysiwyg"}
-  {literal}
-    CRM.$(function($) {
-      if ( isMailing ) {
-        $('div.html').hover(
-          verify,
-          verify
-        );
-      }
-    });
-  {/literal}
-  {/if}
-  {literal}
+  cj('#' + html_message).on('focus change', verify);
 }
 
 CRM.$(function($) {
@@ -323,12 +222,10 @@ CRM.$(function($) {
     var
       token = $(this).val(),
       field = $(this).data('field');
-    if (field === 'html_message') {
-      tokenReplHtml(token);
-    } else {
+    if (field !== 'html_message') {
       field = textMsgID($(this));
-      $('#' + field).replaceSelection(token);
     }
+    CRM.wysiwyg.insert('#' + field, token);
     $(this).select2('val', '');
     if (isMailing) {
       verify();
@@ -349,39 +246,6 @@ CRM.$(function($) {
     return field;
   }
 
-  function tokenReplHtml(token) {
-    var editor     = {/literal}"{$editor}"{literal};
-    if ( editor == "tinymce" ) {
-      tinyMCE.execInstanceCommand('html_message',"mceInsertContent",false, token );
-    }
-    else if ( editor == "joomlaeditor" ) {
-      tinyMCE.execCommand('mceInsertContent',false, token);
-      var msg       = document.getElementById(html_message).value;
-      var cursorlen = document.getElementById(html_message).selectionStart;
-      var textlen   = msg.length;
-      document.getElementById(html_message).value = msg.substring(0, cursorlen) + token + msg.substring(cursorlen, textlen);
-      var cursorPos = (cursorlen + token.length);
-      document.getElementById(html_message).selectionStart = cursorPos;
-      document.getElementById(html_message).selectionEnd   = cursorPos;
-      document.getElementById(html_message).focus();
-    }
-    else if ( editor == "ckeditor" ) {
-      oEditor = CKEDITOR.instances[html_message];
-      oEditor.insertHtml(token.toString() );
-    }
-    else if ( editor == "drupalwysiwyg" ) {
-      if (Drupal.wysiwyg.instances[html_message].insert) {
-        Drupal.wysiwyg.instances[html_message].insert(token.toString() );
-      }
-      else {
-        alert("Sorry, your editor doesn't support this function yet.");
-      }
-    }
-    else {
-      $( "#"+ html_message ).replaceSelection( token );
-    }
-  }
-
   // Initialize token selector widgets
   var form = $('form.{/literal}{$form.formClass}{literal}');
   $('input.crm-token-selector', form)
@@ -422,44 +286,15 @@ CRM.$(function($) {
     if ( !isNaN( emailID ) ) {
       var dataUrl = {/literal}"{crmURL p='civicrm/ajax/signature' h=0 }"{literal};
       $.post( dataUrl, {emailID: emailID}, function( data ) {
-        var editor     = {/literal}"{$editor}"{literal};
 
         if (data.signature_text) {
-          // get existing text & html and append signatue
           var textMessage =  $("#"+ text_message).val( ) + '\n\n--\n' + data.signature_text;
-
-          // append signature
           $("#"+ text_message).val( textMessage );
         }
 
-        if ( data.signature_html ) {
-          var htmlMessage =  $("#"+ html_message).val( ) + '<br/><br/>--<br/>' + data.signature_html;
-
-          // set wysiwg editor
-          if ( editor == "ckeditor" ) {
-            oEditor = CKEDITOR.instances[html_message];
-            var htmlMessage = oEditor.getData( ) + '<br/><br/>--' + data.signature_html;
-            oEditor.setData( htmlMessage  );
-          }
-          else if ( editor == "tinymce" ) {
-            tinyMCE.execInstanceCommand('html_message',"mceInsertContent",false, htmlMessage);
-          }
-          else if ( editor == "drupalwysiwyg" ) {
-            if (Drupal.wysiwyg.instances[html_message].setContent) {
-              Drupal.wysiwyg.instances[html_message].setContent(htmlMessage);
-            }
-            // @TODO: Remove this when http://drupal.org/node/614146 drops
-            else if (Drupal.wysiwyg.instances[html_message].insert) {
-              alert("Please note your editor doesn't completely support this function. You may need to clear the contents of the editor prior to choosing a new template.");
-              Drupal.wysiwyg.instances[html_message].insert(htmlMessage);
-            }
-            else {
-              alert("Sorry, your editor doesn't support this function yet.");
-            }
-          }
-          else {
-            $("#"+ html_message).val(htmlMessage);
-          }
+        if (data.signature_html) {
+          var htmlMessage = CRM.wysiwyg.getVal("#" + html_message) + '<br/><br/>--<br/>' + data.signature_html;
+          CRM.wysiwyg.setVal("#" + html_message, htmlMessage);
         }
       }, 'json');
     }
index fbb1194eeeb710d7a736cd4db699a27f3a8bf33b..7d65c5d1b156d160dcbc5dcdc6ed55cd5cab85d7 100644 (file)
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
-
-{* include wysiwyg related files*}
-{include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
-
 {* enclose all tabs and its content in a block *}
 <div class="crm-block crm-content-block">
   {if $tabHeader and count($tabHeader)}
index 7b46b1defae7717b439681185c3f8e4da4a3ba3b..fce5a2a385e65f055b4105746fa755d9b36e9356 100644 (file)
@@ -45,9 +45,6 @@
       //check if it is date element
       var isDateElement     = elementId.attr('format');
 
-      // check if it is wysiwyg element
-      var editor = elementId.attr('editor');
-
       //get the element type
       var elementType       = elementId.attr('type');
 
           }
         }
       }
-      else if ( editor ) {
-        var firstElementId = firstElement.attr('id');
-        switch ( editor ) {
-          case 'ckeditor':
-            //get the content of first element
-            oEditor = CKEDITOR.instances[firstElementId];
-            var htmlContent = oEditor.getData( );
-
-            // copy first element content to all the elements
-            elementId.each( function() {
-              var elemtId = $(this).attr('id');
-              oEditor = CKEDITOR.instances[elemtId];
-              oEditor.setData( htmlContent );
-            });
-            break;
-          case 'tinymce':
-            //get the content of first element
-            var htmlContent = tinyMCE.get( firstElementId ).getContent();
-
-            // copy first element content to all the elements
-            elementId.each( function() {
-              var elemtId = $(this).attr('id');
-              tinyMCE.get( elemtId ).setContent( htmlContent );
-            });
-            break;
-          case 'joomlaeditor':
-          // TO DO
-          case 'drupalwysiwyg':
-          // TO DO
-          default:
-            elementId.val( firstElementValue ).change();
-
-        }
+      else if (elementId.is('textarea')) {
+        var text = CRM.wysiwyg.getVal(firstElement);
+        elementId.each(function() {
+          CRM.wysiwyg.setVal(this, text);
+        });
       }
       else {
         if (elementId.is('select') === true && firstElement.parent().find(':input').select().index() >= 1 && firstElement.parent().find('select').select().index < 1) {
index ad8aef9af7739c2716a9ebc643833a702232b38c..9524e30395504801197f0996788698ee39ea2a84 100644 (file)
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
-{* include wysiwyg related files*}
-{if !$includeWysiwygEditor}
-    {include file="CRM/common/wysiwyg.tpl" includeWysiwygEditor=true}
-{/if}
 {literal}
 <script type="text/javascript">
 CRM.buildCustomData = function( type, subType, subName, cgCount, groupID, isMultiple ) {
index 821a2213712245728dffef3eb0f0082097425d07..ad30a420f4b8d03c24e93837dd7df09b4cbe1656 100644 (file)
@@ -27,9 +27,6 @@
 {include file="CRM/common/debug.tpl"}
 {/if}
 
-{* include wysiwyg related files*}
-{include file="CRM/common/wysiwyg.tpl"}
-
 <div id="crm-container" class="crm-container{if $urlIsPublic} crm-public{/if}" lang="{$config->lcMessages|truncate:2:"":true}" xml:lang="{$config->lcMessages|truncate:2:"":true}">
 
 
index 7fb3edde27b018eb1bb999c3833f8e9cbfb3b351..10ce05cdb03e503dec37b1a646df781b92add22e 100644 (file)
@@ -31,9 +31,6 @@
 
 {crmNavigationMenu is_default=1}
 
-{* include wysiwyg related files*}
-{include file="CRM/common/wysiwyg.tpl"}
-
 {if isset($browserPrint) and $browserPrint}
 {* Javascript window.print link. Used for public pages where we can't do printer-friendly view. *}
 <div id="printer-friendly">
index 96e36ebe880ab54b87ec75bdb4f92b874db6365d..0dbe58fbe593681d8c3cd70ef07e1afd281cd945 100644 (file)
@@ -33,9 +33,6 @@
 <div id="crm-nav-menu-container"></div>
 {crmNavigationMenu is_default=1}
 
-{* include wysiwyg related files*}
-{include file="CRM/common/wysiwyg.tpl"}
-
 <table border="0" cellpadding="0" cellspacing="0" id="crm-content">
   <tr>
 {if $sidebarLeft}
index 04dded0e8c3662aedb4ec9a9cd74a2b77030b8a1..65e0b160bdf443e4edebe5a9678bbaa3d60aa17a 100644 (file)
@@ -42,9 +42,6 @@
     </div>
 {/if}
 
-{* include wysiwyg related files*}
-{include file="CRM/common/wysiwyg.tpl"}
-
 {if isset($browserPrint) and $browserPrint}
 {* Javascript window.print link. Used for public pages where we can't do printer-friendly view. *}
 <div id="printer-friendly">
diff --git a/templates/CRM/common/wysiwyg.tpl b/templates/CRM/common/wysiwyg.tpl
deleted file mode 100644 (file)
index 51d3236..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-{*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM.                                    |
- |                                                                    |
- | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
- |                                                                    |
- | CiviCRM is distributed in the hope that it will be useful, but     |
- | WITHOUT ANY WARRANTY; without even the implied warranty of         |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
- | See the GNU Affero General Public License for more details.        |
- |                                                                    |
- | You should have received a copy of the GNU Affero General Public   |
- | License and the CiviCRM Licensing Exception along                  |
- | with this program; if not, contact CiviCRM LLC                     |
- | at info[AT]civicrm[DOT]org. If you have questions about the        |
- | GNU Affero General Public License or the licensing of CiviCRM,     |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
- +--------------------------------------------------------------------+
-*}
-
-{* include wysiysg editor files *}
-{if $includeWysiwygEditor}
-    {if $defaultWysiwygEditor eq 1}
-        <script>
-          {* this version of tinymce requires jquery *}
-          if (typeof window.jQuery !== 'function') window.jQuery = CRM.$;
-        </script>
-        <script type="text/javascript" src="{$config->resourceBase}packages/tinymce/jscripts/tiny_mce/jquery.tinymce.js"></script>
-        <script type="text/javascript" src="{$config->resourceBase}packages/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
-    {/if}
-{/if}