Changing the way the wysiwyg shows in the Multi Record List of Records

9 posts by 3 authors in: Forums > CMS Builder
Last Post: December 18, 2013   (RSS)

Hi,

Can someone help me with the wysiwyg of CMS Builder v. 2.53 (Build 1040),

I added two field Labels "Title" and "Description" with field type "wysiwyg" in a Multi Record Section, but when I see my records in the CMS Builder interface I see the tags with the text.

E.g. for "title" I see:
<h2><em><strong>Testing 2</strong></em></h2>

E.g. for "description" I see:
<p><span style="font-size: small;">Ucim enducias es modi que comnis porerchil imincil igenitatem velis del es mod qui ommodis et lam nobis ea simus alicide rumque cuscius acerendi ut pa quam, sus rate doluptat ut rem hilisque pel iur?</span><br /><span style="font-size: small;">Re nulparum, torestiis ma ius rem ad ut aut renimus aut adi beatur, odion rehendem etur? Qui ut aliquam.</span></p>

Is their a way to see the list of records in the interface without tags (plain text) or formated the way it should look (bold, italic, size etc.)?
I also attached a jpg for preview.

Regards,

Tim

Attachments:

wysiwyg-question.jpg 278K

By Damon - December 6, 2013

Hi,

The multi-record list in the CMS Builder admin will show the full contents of whichever field you choose to display.

So if there is html content in a field, that will be display. It is usually best to display fields that are using a textfield
for adding contents as html isn't usually displayed in that.

An alternative is to add additional fields that are just used for displaying content in the admin. This is extra work for the user
as they will need to enter this content.

Is it possible for at least the Title field to use a plain textfield instead of WYSIWYG editor for content. In the template you can set the
html tags as needed (<h2><em> etc.)?

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Damon,

I would have liked the client to be able to put bold, underlined, italic text where he would like.
It's a pity and strange that this is not possible!

That best way would have been if this had an option to display text with or without tags.
Another great option would be formatted and/or formatted text with an option for a number of characters.
And for both option where there are graphics and or files there should appear a small icon with file type (extension) with a mouse over option to see the name of the file.

You guys should really add this to the WYSIWYG editor.

Regards,

Tim

By Dave - December 8, 2013

Hi Tim, 

Creating snippets or text only versions of wysiwyg content is notoriously tricky and very difficult to do consistently.  You have to deal with all kinds of issues such as image only content, content that starts with tables, truncating content without malforming the html, etc.

That said, if you'd like to update the code to show the wysiwyg code inline so bold appears as bold, etc, try making these code changes (backup first):

  1. Open /cmsAdmin/lib/menus/default/list_functions.php
  2. Search for: nl2br
  3. Add the code in red:

  // v2.50 - display formatted textbox content
  if (@$fieldSchema['type'] == 'textbox') {
    if ($fieldSchema['autoFormat']) {
      $displayValue = @$record[$fieldname]; // overwrite previous htmlencoded value
      $displayValue = preg_replace("/<br\s*\/?>\r?\n/", "\n", $displayValue);  // remove autoformat break tags
      $displayValue = htmlencode($displayValue); // html encode content
    }
    $displayValue = nl2br($displayValue); // re-add break tags after nextlines
  }

  // v2.54 - display wysiwyg content
  if (@$fieldSchema['type'] == 'wysiwyg') {
    $displayValue = @$record[$fieldname]; // overwrite previous htmlspecialchars encoded value
  }

  // return display value
  return array($displayValue, $tdAttributes);
}

Let me know if that works for you.  You might find that it expands the list page too much, but you can add any other code inside the if {} block if needed to convert to text, truncate, etc.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

Hi Dave,

Today I got a chance to test the way the wysiwyg shows.
It does show all formating.

It shows size, bold and underline.
It does not show color in conbination with bold formatting...!!!

Is this possible?
I would also like the option to display plain text (NO-FORMATTING) when viewed in the Records list.
I attached 2 screen shots as refference.

Regards,

Tim

By Damon - December 17, 2013

Hi Tim,

It shows size, bold and underline.
It does not show color in conbination with bold formatting...!!!

In both screenshots, the text "omni blacea" appear bold and pink.  Can you give me an example?

I would also like the option to display plain text (NO-FORMATTING) when viewed in the Records list.

It may be a little tricky to strip out all the HTML and CSS perfectly but it probably could be done with some custom coding and through a plugin. That way there won't be any issue when upgrading in the future Send an email into consulting@interactivetools.com and reference this forum post and we can get back to you with details(time and price).

Thanks!

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

By Damon - December 18, 2013

Hi Tim,

The problem that is happening is that the WYSIWYG content that is displayed in the Multi Records list is picking up some styles from the CMS Builder admin CSS.

Maybe there is another way to get the results that you are after outside of the admin. What about creating a password protected multi record list page on the front end of the site with links to edit?

You could have the content display exactly as needed and the user would already be logged in, so when they clicked an edit button, they would go right into the admin edit screen for that record.

Let me know if this makes sense and may be an option.

Cheers,
Damon Edis - interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Damon,

Yeap seams better.
If this works back and forth would be even better!!!

Regards,

Tim