CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • tinymce and ckeditor break Civi URLs
Pages: [1]

Author Topic: tinymce and ckeditor break Civi URLs  (Read 927 times)

Shai

  • I post frequently
  • ***
  • Posts: 202
  • Karma: 8
    • Content2zero
  • CiviCRM version: 4.3.x, 4.4.x, 4.5.x
  • CMS version: Drupal 7
  • MySQL version: 5.5.x
  • PHP version: 5.3.x, 5.4.x
tinymce and ckeditor break Civi URLs
October 18, 2013, 06:04:30 am
Folks,

In tinymce and ckeditor both, they are converting urls like

https://example.com/civicrm/contribute/transact?reset=1&id=2&{contact.checksum}&cid={contact.contact_id}

to

https://example.com/civicrm/contribute/transact?reset=1&id=2&{contact.checksum}&cid={contact.contact_id}

converting ampersands to their html entity code.

Firefox on a Mac handles it okay, but most other browsers do not; the result error message from Civi says the link is broken or the back button was used.
I tried editing sites/all/modules/civicrm/packages/ckeditor/config.js by adding
Quote
config.basicEntities = false;
but it didn't work.

I'd appreciate any help in pointing me toward how I can fix this problem.

Thanks so much,

Shai Gluskin
« Last Edit: October 18, 2013, 06:06:22 am by Shai »
Don't miss out! Sign up now for free expert advice on CiviCRM's new StackExchange help site.

Rajesh

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 10
  • CiviCRM version: 4.2.x, 4.3.x, 4.4.x
  • CMS version: Drupal 7.xx, Wordpress 3.5.x - 3.6.x, Joomla 3.1
  • MySQL version: 5.5.20
  • PHP version: 5.3.10
Re: tinymce and ckeditor break Civi URLs
October 18, 2013, 06:28:51 am
Hi shai

For CKEditor you can add the below line to the config file to stop replacing & with &. Not sure how to do it in tinymce editor.

Code: [Select]
config.forceSimpleAmpersand = true;
Below is my CKEditor config file for you reference

Code: [Select]
CKEDITOR.editorConfig = function( config ) {
    // Define changes to default configuration here.
    // For the complete reference:
    // http://docs.ckeditor.com/#!/api/CKEDITOR.config

    // The toolbar groups arrangement, optimized for two toolbar rows.
    config.toolbarGroups = [
        { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
        { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
        { name: 'links' },
        { name: 'insert' },
        { name: 'forms' },
        { name: 'tools' },
        { name: 'document',       groups: [ 'mode', 'document', 'doctools' ] },
        { name: 'others' },
        '/',
        { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
        { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align' ] },
        { name: 'styles' },
        { name: 'colors' },
        { name: 'about' }
    ];

    // Remove some buttons, provided by the standard plugins, which we don't
    // need to have in the Standard(s) toolbar.
    config.removeButtons = 'Underline,Subscript,Superscript';
   
    // Do NOT replace instances of ampersands ('&') with &
    config.forceSimpleAmpersand = true;
};
« Last Edit: October 18, 2013, 06:32:29 am by Rajesh »

Shai

  • I post frequently
  • ***
  • Posts: 202
  • Karma: 8
    • Content2zero
  • CiviCRM version: 4.3.x, 4.4.x, 4.5.x
  • CMS version: Drupal 7
  • MySQL version: 5.5.x
  • PHP version: 5.3.x, 5.4.x
Re: tinymce and ckeditor break Civi URLs
November 12, 2013, 01:10:31 pm
@Rajesh,

Thanks so much for the suggestion.

I did exactly what you said. I added

// Do NOT replace instances of ampersands ('&') with &
    config.forceSimpleAmpersand = true;


to sites/all/modules/civicrm/packages/ckeditor/config.js

I cleared caches... but no change, & always converts to &

Any ideas? Is there something in the php config that could be doing this?

Thanks for your help.

Shai Gluskin



Don't miss out! Sign up now for free expert advice on CiviCRM's new StackExchange help site.

Shai

  • I post frequently
  • ***
  • Posts: 202
  • Karma: 8
    • Content2zero
  • CiviCRM version: 4.3.x, 4.4.x, 4.5.x
  • CMS version: Drupal 7
  • MySQL version: 5.5.x
  • PHP version: 5.3.x, 5.4.x
Re: tinymce and ckeditor break Civi URLs
November 12, 2013, 02:39:30 pm
@Rajesh,

Never mind. I hadn't cleared my browser caches after I made the change. My bad.

I have a follow up question.

I made the change to sites/all/modules/civicrm/packages/ckeditor/config.js so I need to create documentation to change it on every civi upgrade.

Is there a way, like in Drupal's hook system, to make the change in a custom module or somewhere else that has a chance of surviving a Civi upgrade?

Thanks,

Shai
Don't miss out! Sign up now for free expert advice on CiviCRM's new StackExchange help site.

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: tinymce and ckeditor break Civi URLs
November 14, 2013, 11:20:22 pm
"Break" links for "most other browsers"?

Shai, this link works: https://civicrm.org/civicrm/contribute/transact?reset=1&id=2  for the following browsers:

1. firefox
2. chrome
3. ie10

Before you intensify your situation with custom code, I suggest you expand your browser testing.  Most browsers are capable of recognizing and converting HTML codes in urls.
« Last Edit: November 14, 2013, 11:30:53 pm by CiviTeacher.com »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Rajesh

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 10
  • CiviCRM version: 4.2.x, 4.3.x, 4.4.x
  • CMS version: Drupal 7.xx, Wordpress 3.5.x - 3.6.x, Joomla 3.1
  • MySQL version: 5.5.20
  • PHP version: 5.3.10
Re: tinymce and ckeditor break Civi URLs
November 19, 2013, 01:00:19 am
@Shai

Not sure about how to make the change in a module or extension, as ckeditor is in CiviCRM's packages directory and i dont think we can override the directory. There is a drupal hook(drupal_add_js) to add custom js files in specific pages, but still that will be CMS specific and will not working in Joomla/Wordpress.

Anyone have any better idea or do we make this change in the core?

Thanks
Rajesh

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • tinymce and ckeditor break Civi URLs

This forum was archived on 2017-11-26.