Home | Products | Consulting | Forums | Support | Order | 1-800-752-0455
  Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Restricting the wysiwig editor

 

 


Jeffie
User

Nov 22, 2008, 6:52 AM

Post #1 of 9 (1037 views)
Shortcut
Restricting the wysiwig editor Can't Post

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


(This post was edited by Jeffie on Nov 22, 2008, 6:54 AM)


Dave
Staff / Moderator


Nov 24, 2008, 1:15 PM

Post #2 of 9 (1001 views)
Shortcut
Re: [Jeffie] Restricting the wysiwig editor [In reply to] Can't Post

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


Jeffie
User

Nov 25, 2008, 1:30 AM

Post #3 of 9 (991 views)
Shortcut
Re: [Dave] Restricting the wysiwig editor [In reply to] Can't Post

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
});

Code


Code



Djulia
User

Nov 25, 2008, 5:03 AM

Post #4 of 9 (985 views)
Shortcut
Re: [Jeffie] Restricting the wysiwig editor [In reply to] Can't Post

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


Dave
Staff / Moderator


Nov 25, 2008, 9:27 AM

Post #5 of 9 (979 views)
Shortcut
Re: [Jeffie] Restricting the wysiwig editor [In reply to] Can't Post

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


Jeffie
User

Nov 25, 2008, 10:00 AM

Post #6 of 9 (977 views)
Shortcut
Re: [Dave] Restricting the wysiwig editor [In reply to] Can't Post

Thanks both of you. That's sorted it

Jeff


Djulia
User

Nov 27, 2008, 8:33 AM

Post #7 of 9 (950 views)
Shortcut
Re: [Dave] Restricting the wysiwig editor [In reply to] Can't Post

Hi Dave,


Quote
>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


(This post was edited by Djulia on Nov 27, 2008, 2:06 PM)


Dave
Staff / Moderator


Dec 1, 2008, 5:15 PM

Post #8 of 9 (832 views)
Shortcut
Re: [Djulia] Restricting the wysiwig editor [In reply to] Can't Post

I think you need something more like this:


Code
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!

Dave Edis - Senior Developer
interactivetools.com


Djulia
User

Dec 3, 2008, 11:52 AM

Post #9 of 9 (750 views)
Shortcut
Re: [Dave] Restricting the wysiwig editor [In reply to] Can't Post

Hi Dave,

Thanks, that functions perfectly. Smile

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

Djulia

 
 
 


Search for (options)
Products
CMS Builder
Article Manager
Realty Manager
Listings Manager
Order Now
Services
Priority Consulting
Support
Online Documentation
Support Forums
Support Homepage
Company Info
12 reasons to choose us!
Meet the team
Monthly newsletter
Contact Us
Toll Free: 1-800-752-0455
Phone: (604) 689-3347
Sales | Support
Conditions of Use | Privacy Policy | Copyright © interactivetools.com 2008
#201 - 2730 Commercial Drive, Vancouver BC Canada V5N 5P4