WYSIWYG Editor, Populating Controls

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
jaytoox
Posts: 5
Joined: Tue Apr 18, 2006 6:58 pm

WYSIWYG Editor, Populating Controls

Post by jaytoox »

In order to keep the entry code as clean as possible, I would like to remove options like "font-size" for when you are editing entries to provent other users from using features I don't want them to use.

I cannot find where "Format Block" is populated (It contains values like: Heading 3/4/5/6, Formatted, Code, Normal, and Address). I found something similar in /admin/record.edit.php, but it isn't it.

Thanks for any insight...
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Re: WYSIWYG Editor, Populating Controls

Post by matteo »

Hi,
jaytoox wrote:I cannot find where "Format Block" is populated (It contains values like: Heading 3/4/5/6, Formatted, Code, Normal, and Address). I found something similar in /admin/record.edit.php, but it isn't it.
please, take a look at admin/footer.php:

Code: Select all

...
    config.toolbar = [ [ "fontname", "space", "fontsize", "space", "formatblock", "space", "bold", "italic", "underline", "strikethrough", "separator", "subscript", "superscript", "separator", "copy", "cut", "paste" ], [ "undo", "redo", "space", "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", "lefttoright", "righttoleft", "separator", "orderedlist", "unorderedlist", "outdent", "indent", "separator", "forecolor", "hilitecolor", "separator", "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode", "space", "removeformat", "killword" ], [ "internalLinks" ] ];
...
and the lines below the quoted one.
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
jaytoox
Posts: 5
Joined: Tue Apr 18, 2006 6:58 pm

Re: WYSIWYG Editor, Populating Controls

Post by jaytoox »

matteo wrote:Hi,
jaytoox wrote:I cannot find where "Format Block" is populated (It contains values like: Heading 3/4/5/6, Formatted, Code, Normal, and Address). I found something similar in /admin/record.edit.php, but it isn't it.
please, take a look at admin/footer.php:

Code: Select all

...
    config.toolbar = [ [ "fontname", "space", "fontsize", "space", "formatblock", "space", "bold", "italic", "underline", "strikethrough", "separator", "subscript", "superscript", "separator", "copy", "cut", "paste" ], [ "undo", "redo", "space", "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", "lefttoright", "righttoleft", "separator", "orderedlist", "unorderedlist", "outdent", "indent", "separator", "forecolor", "hilitecolor", "separator", "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode", "space", "removeformat", "killword" ], [ "internalLinks" ] ];
...
and the lines below the quoted one.
This is what I see in admin/footer.php

Code: Select all

<?php
/**
* $Id: footer.php,v 1.2.2.5 2006/01/02 12:47:10 thorstenr Exp $
*
* Footer of the admin area
*
* @author       Thorsten Rinne <thorsten@phpmyfaq.de>
* @since        2003-02-26
* @copyright    (c) 2001-2006 phpMyFAQ Team
* 
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* 
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
* License for the specific language governing rights and limitations
* under the License.
*/

if (!defined('IS_VALID_PHPMYFAQ_ADMIN')) {
    header('Location: http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']));
    exit();
}
?>
</div>
    
<!-- Footer -->
<div>
    <div id="footer">
        <div><a href="http://www.phpmyfaq.de/" target="_blank">phpMyFAQ</a> <?php print $PMF_CONF["version"]; ?> | &copy; 2001-2005 <a href="http://www.phpmyfaq.de/impressum.php" target="_blank">phpMyFAQ Team</a></div>
    </div>
</div>

</body>
</html>
I realized I made a mistake in my first post. I meant I found something in admin/editor/htmlarea.js that was similar to what I was looking for:

Code: Select all

this.toolbar = [
		[ "bold", "italic", "underline", "strikethrough", "separator",
		  "subscript", "superscript", "separator",
		  "copy", "cut", "paste", "space", "undo", "redo", "space", "removeformat", "killword" ],

		[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
		  "lefttoright", "righttoleft", "separator",
		  "orderedlist", "unorderedlist", "outdent", "indent", "separator",
		  "forecolor", "hilitecolor", "separator",
		  "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode", "separator",
		  "popupeditor", "separator", "showhelp", "about" ]
	];
As you can see I removed the first 3 items I don't want the user to change. The format block seems to still appear. Even after I alter the following code to not exist or be null:

Code: Select all

this.formatblock = {
		"&mdash; format &mdash;"  : "",
		"Heading 1": "h1",
		"Heading 2": "h2",
		"Heading 3": "h3",
		"Heading 4": "h4",
		"Heading 5": "h5",
		"Heading 6": "h6",
		"Normal"   : "p",
		"Address"  : "address",
		"Formatted": "pre"
	};
Is there somewhere else these options are set? In the edit entry, the following options are available (which differ from the quote above), leaving me to believe that there is an array set elsewhere: (taken from source code)

Code: Select all

        config.formatblock = {
		"Heading 3": "h3",
		"Heading 4": "h4",
		"Heading 5": "h5",
		"Heading 6": "h6",
		"Normal": "p",
		"Address": "address",
		"Formatted": "pre",
        	"Code": "code"
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Re: WYSIWYG Editor, Populating Controls

Post by matteo »

Hi,
jaytoox wrote:This is what I see in admin/footer.php
sorry, I was supposing you were working upon PMF 1.6.0 whilst it seems you're working upon PMF 1.5.8, so my previous reference must be changed in:
admin/header.php
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
jaytoox
Posts: 5
Joined: Tue Apr 18, 2006 6:58 pm

Post by jaytoox »

No sorry required... I should have mentioned my setup.

Thanks ... that's what I'm looking for!

8)
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Post by matteo »

Hi,
please change from:

Code: Select all

        config.toolbar = [ [ "fontsize", "space", "formatblock", "space", "bold", "italic", "underline", "strikethrough", "separator", "subscript", "superscript", "separator", "copy", "cut", "paste", "space", "undo", "redo", "space", "removeformat", "killword" ], [ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", "lefttoright", "righttoleft", "separator", "orderedlist", "unorderedlist", "outdent", "indent", "separator", "forecolor", "hilitecolor", "separator", "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode" ], [ "internalLinks" ] ];
to (I've removed the "formatblock" entry) :

Code: Select all

        config.toolbar = [ [ "fontsize", "space", "space", "bold", "italic", "underline", "strikethrough", "separator", "subscript", "superscript", "separator", "copy", "cut", "paste", "space", "undo", "redo", "space", "removeformat", "killword" ], [ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator", "lefttoright", "righttoleft", "separator", "orderedlist", "unorderedlist", "outdent", "indent", "separator", "forecolor", "hilitecolor", "separator", "inserthorizontalrule", "createlink", "insertimage", "inserttable", "htmlmode" ], [ "internalLinks" ] ];
an you'll remove the possibility of using the Format Block.
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
jaytoox
Posts: 5
Joined: Tue Apr 18, 2006 6:58 pm

Post by jaytoox »

Thanks - Everything is how I want it now.
Post Reply