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
Thanks in advance
Jeff
Re: [Jeffie] Restricting the wysiwig editor
By Dave - November 24, 2008
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!
interactivetools.com
Re: [Dave] Restricting the wysiwig editor
By JeffC - November 25, 2008
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
});
Re: [Jeffie] Restricting the wysiwig editor
By Djulia - November 25, 2008
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
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.
interactivetools.com
Re: [Dave] Restricting the wysiwig editor
By JeffC - November 25, 2008
Jeff
Re: [Dave] Restricting the wysiwig editor
By Djulia - November 27, 2008 - edited: November 27, 2008
>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: [Djulia] Restricting the wysiwig editor
By Dave - December 1, 2008
function initWysiwyg($fieldname, $uploadBrowserCallback) {
global $SETTINGS;
$includeDomainsInLinks = $SETTINGS['wysiwyg']['includeDomainInLinks'] ? "remove_script_host : false," : "";
$programUrl = pathinfo($_SERVER['SCRIPT_NAME'], PATHINFO_DIRNAME);
if ($fieldname == "simpleWysiwyg") {
// display field
print <<<__HTML__
...
__HTML__;
}
else {
// display field
print <<<__HTML__
...
__HTML__;
}
I think for v1.24 or 1.25 we'll add a pulldown that lets you choose from a list of wysiwyg config files in /lib/wysiwyg/.
Hope that helps!
interactivetools.com
Re: [Dave] Restricting the wysiwig editor
By Djulia - December 3, 2008
Thanks, that functions perfectly. [:)]
I would like to continue with another discussion : Web Color Picker input.
Djulia