Restricting the wysiwig editor

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

By JeffC - November 22, 2008 - edited: November 22, 2008

Is it possible to restrict the amount of control my end users have with the wysiwig menu? I would like them to be able to make links but not to be able to change font colour and size or add images

Thanks in advance
Jeff
Jeff

Re: [Jeffie] Restricting the wysiwig editor

By Dave - November 24, 2008

Hi Jeff, welcome to the CMS Builder forum! :)

Yes you can. CMS Builder uses the popular tinyMCE WYSIWYG component and it has lots of configuration options.

Have a look in the file: /lib/wysiwyg.php to see the default configuration options and some instructions and links on how to change it. Search for "buttons" to find the options that control which buttons show.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Restricting the wysiwig editor

By JeffC - November 25, 2008

Thanks Dave

One more quick question...

I have the code to disable the various funtions:

tinyMCE.init({
...
theme_advanced_disable : "bold,italic"
});

Where do I put this code? I tried putting it into the wysiwig.php as follows:

<script type="text/javascript" src="tinymce3/tiny_mce_gzip.js"></script>
<script type="text/javascript">
tinyMCE_GZ.init({

plugins: 'inlinepopups,contextmenu,table,fullscreen,paste,media',
themes : 'advanced',
theme_advanced_disable : "bold,italic"
languages : '{$SETTINGS['wysiwyg']['wysiwygLang']}',
disk_cache : true,
debug : false

But this disabled the wysiwig entirely not just the bold and italic buttons.

Sorry to ask what is probably a really stupid question!

Jeff
});

Jeff

Re: [Jeffie] Restricting the wysiwig editor

By Djulia - November 25, 2008

Hi Jeff,

I do not know if that answers your question.
But, you can limit the options with the lines 18 and 47 :

18 - plugins: 'inlinepopups,contextmenu,table,fullscreen,paste,media',
with : plugins: 'inlinepopups,contextmenu,fullscreen,paste,

47 theme_advanced_buttons2 : "forecolor,backcolor,|,link,unlink,anchor,|,hr,image,media,table,|,pastetext,pasteword,|,code",
with : theme_advanced_buttons2 : "forecolor,backcolor|link,unlink,anchor,hr|pastetextpasteword|code",

Djulia

Re: [Jeffie] Restricting the wysiwig editor

By Dave - November 25, 2008

Hi Jeff,

Djulia's got it right. If you just want to remove some of the buttons you can just remove them from the list of button names on these lines:

theme_advanced_buttons1
theme_advanced_buttons2
theme_advanced_buttons3

Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Restricting the wysiwig editor

By JeffC - November 25, 2008

Thanks both of you. That's sorted it

Jeff
Jeff

Re: [Dave] Restricting the wysiwig editor

By Djulia - November 27, 2008 - edited: November 27, 2008

Hi Dave,


>It would be possible to give the possibility of choosing between wysiwyg simple or wysiwyg advanced

It's a good idea. I want to give some more thought to it before I add it. In the meantime, you can add it yourself by editing /lib/wysiwyg.php

Search for "display field". The part the prints the javascript after that. You could put an if around it so it prints a different block of javascript if the field has a certain name or contains "simple", etc.





http://www.interactivetools.com/forum/forum.cgi?post=67015

I try to apply your suggestion, but I have a problem.

Here my approach:

1) In Field Editor, I add a Field Type == list (name == selectWysiwyg).
2) and for List Options : "simple" or "avanced".
3) and in the file wysiwyg.php, I use the following condition :

$GLOBALS['listRecords']['selectwysiwyg']);
if ($valueWysiwyg == "simple")
{..} else {..}

But, my problem is that the value of SelectWysiwyg is in [listRecords], and the variable [listRecords] is not available in action=edit (via modify).

It seems that I do not have the good approach.


Or then, there would be a solution to obtain the [listRecords] variable ?

Thanks for your assistance.

Djulia

Re: [Dave] Restricting the wysiwig editor

By Djulia - December 3, 2008

Hi Dave,

Thanks, that functions perfectly. [:)]

I would like to continue with another discussion : Web Color Picker input.

Djulia