I am trying to do the same thing, using version 2.0. The Toolbar Customization Doc refers to older versions, such as 1.6. Since this is the "version 2.0" forum, I would appreciate it if someone could respond to the toolbar question with an answer relevant to version 2.0.
ok.. seems that adding a plugin iwth this version is much easier... !! oh yea!
I have added the ability to add a push button (button) to open a window like the achor tag. and then query a db for a list of values (formated), select it, and instert into fck editor window. instructions follows:
______________ Create a folder in this case (Classify) under the plugins dir.
___________________ Create a page .. in this case fck_Classify.php: code:
<?
include ("../../../../../functions/db.php");
include("../../../../../functions/variables.php");
//include("../functions/stripslashes.php");
include("../../../../../functions/functions.php");
$classification_result2 = mssql_query("SELECT * FROM classification order by name");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for internet * Copyright (C) 2003-2005 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * File Name: fck_Classify.html * Classify dialog window. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) -->
/* * FCKeditor - The text editor for internet * Copyright (C) 2003-2005 Frederico Caldeira Knabben * * Licensed under the terms of the GNU Lesser General Public License: * http://www.opensource.org/licenses/lgpl-license.php * * For further information visit: * http://www.fckeditor.net/ * * File Name: fckplugin.js * Plugin to insert "Classifys" in the editor. * * File Authors: * Frederico Caldeira Knabben (fredck@fckeditor.net) */
// Register the related command. FCKCommands.RegisterCommand( 'Classify', new FCKDialogCommand( 'Classify', FCKLang.ClassifyDlgTitle, FCKPlugins.Items['Classify'].Path + 'fck_Classify.php', 340, 170 ) ) ;
// Create the "Plaholder" toolbar button. var oClassifyItem = new FCKToolbarButton( 'Classify', FCKLang.ClassifyBtn ) ; oClassifyItem.IconPath = FCKPlugins.Items['Classify'].Path + 'Classify.gif' ; FCKToolbarItems.RegisterItem( 'Classify', oClassifyItem ) ;
// The object used for all Classify operations. var FCKClassifys = new Object() ;
// Add a new Classify at the actual selection. FCKClassifys.Add = function( name ) { var oSpan = FCK.CreateElement( 'SPAN' ) ; this.SetupSpan( oSpan, name ) ; }
FCKClassifys.SetupSpan = function( span, name ) { span.innerHTML = '[[ ' + name + ' ]]' ;
if ( FCKBrowserInfo.IsGecko ) span.style.cursor = 'default' ;
span._fckClassify = name ; span.contentEditable = false ;
// To avoid it to be resized. span.onresizestart = function() { FCK.EditorWindow.event.returnValue = false ; return false ; } }
// On Gecko we must do this trick so the user select all the SPAN when clicking on it. FCKClassifys._SetupClickListener = function() { FCKClassifys._ClickListener = function( e ) { if ( e.target.tagName == 'SPAN' && e.target._fckClassify ) FCKSelection.SelectNode( e.target ) ; }
// Check if a Placholder name is already in use. FCKClassifys.Exist = function( name ) { var aSpans = FCK.EditorDocument.getElementsByTagName( 'SPAN' )
for ( var i = 0 ; i < aSpans.length ; i++ ) { if ( aSpans[i]._fckClassify == name ) return true ; } }
if ( FCKBrowserInfo.IsIE ) { FCKClassifys.Redraw = function() { var aPlaholders = FCK.EditorDocument.body.innerText.match( /\[\[[^\[\]]+\]\]/g ) ; if ( !aPlaholders ) return ;
var oRange = FCK.EditorDocument.body.createTextRange() ;
// The "Redraw" method must be called on startup. FCKClassifys.Redraw() ;
// We must process the SPAN tags to replace then with the real resulting value of the Classify. FCKXHtml.TagProcessors['span'] = function( node, htmlNode ) { if ( htmlNode._fckClassify ) node = FCKXHtml.XML.createTextNode( '' + htmlNode._fckClassify + '' ) ; else FCKXHtml._AppendChildNodes( node, htmlNode, false ) ;
return node ; } ________________________________ create a graphic called Classify.gif 21x20 ____________________________
not sure if you need the lang files.. u can copy the lang directory from the placeholder plugin dir.
___________________
add this to your fckconfig.js FCKConfig.Plugins.Add( 'Classify', 'en' ) ;
add the ['Classify'] to your tool bar on the this same js. file..
RE: Customize toolbars
Is it possible to remove some buttons?
please help me..
RE: Customize toolbars
can you tell me if is possible/legal to do something similar to modify a toolbar?
RE: Customize toolbars
RE: Customize toolbars
Thanks.
RE: Customize toolbars
fckconfig.js is a file in the main directory, and it has all of the things described in the documentation mentioned by jdorner.
Yay!
RE: Customize toolbars - close to getting it!
ok.. seems that adding a plugin iwth this version is much easier... !! oh yea!
I have added the ability to add a push button (button) to open a window like the achor tag. and then query a db for a list of values (formated), select it, and instert into fck editor window. instructions follows:
______________
Create a folder in this case (Classify) under the plugins dir.
___________________
Create a page .. in this case fck_Classify.php:
code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<!--
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fck_Classify.html
* Classify dialog window.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
-->
<html> <head> <title>Classify Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="noindex, nofollow" name="robots"> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var oEditor = window.parent.InnerDialogLoaded() ; // Gets the document DOM var oDOM = oEditor.FCK.EditorDocument ; var oActiveEl = oEditor.FCKSelection.GetSelectedElement() ; window.onload = function() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; if ( oActiveEl && oActiveEl.tagName == 'A' && oActiveEl.name.length > 0 && oActiveEl.getAttribute('href').length == 0 ) document.getElementById('txtName').value = oActiveEl.name ; else oActiveEl = null ; window.parent.SetOkButton( true ) ; } function Ok() { if ( document.getElementById('txtName').value.length == 0 ) { alert( oEditor.FCKLang.DlgClassifyErrorName ) ; return false ; } //oEditor.FCK.InsertHtml( '<a name="' + GetE('txtName').value + '"><\/a>' ) ; oEditor.FCK.InsertHtml( '<b>'+ document.getElementById('txtName').value + '</b>  ' ) ; return true ; } </script> </head> <body style="OVERFLOW: hidden" scroll="no"> <table height="100%" width="100%"> <tr> <td align="center"> <table border="0" cellpadding="0" cellspacing="0" width="80%"> <tr> <td> <span fckLang="ClassifyDlgName">Classification Picker</span><BR> <select id="txtName" name="txtName" style="WIDTH: 100%"> <option value="">----Classification Picker----</option> <? while($row1=mssql_fetch_array($classification_result2)) { echo "<option value=\"$row1[name]\">$row1[name]</option>"; }; ?> </select> </td> </tr> </table> </td> </tr> </table> </body> </html>
_______________________
create another file call fckplugin.js:
code:
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2005 Frederico Caldeira Knabben
*
* Licensed under the terms of the GNU Lesser General Public License:
* http://www.opensource.org/licenses/lgpl-license.php
*
* For further information visit:
* http://www.fckeditor.net/
*
* File Name: fckplugin.js
* Plugin to insert "Classifys" in the editor.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
// Register the related command.
FCKCommands.RegisterCommand( 'Classify', new FCKDialogCommand( 'Classify', FCKLang.ClassifyDlgTitle, FCKPlugins.Items['Classify'].Path + 'fck_Classify.php', 340, 170 ) ) ;
// Create the "Plaholder" toolbar button.
var oClassifyItem = new FCKToolbarButton( 'Classify', FCKLang.ClassifyBtn ) ;
oClassifyItem.IconPath = FCKPlugins.Items['Classify'].Path + 'Classify.gif' ;
FCKToolbarItems.RegisterItem( 'Classify', oClassifyItem ) ;
// The object used for all Classify operations.
var FCKClassifys = new Object() ;
// Add a new Classify at the actual selection.
FCKClassifys.Add = function( name )
{
var oSpan = FCK.CreateElement( 'SPAN' ) ;
this.SetupSpan( oSpan, name ) ;
}
FCKClassifys.SetupSpan = function( span, name )
{
span.innerHTML = '[[ ' + name + ' ]]' ;
span.style.backgroundColor = '#ffff00' ;
span.style.color = '#000000' ;
if ( FCKBrowserInfo.IsGecko )
span.style.cursor = 'default' ;
span._fckClassify = name ;
span.contentEditable = false ;
// To avoid it to be resized.
span.onresizestart = function()
{
FCK.EditorWindow.event.returnValue = false ;
return false ;
}
}
// On Gecko we must do this trick so the user select all the SPAN when clicking on it.
FCKClassifys._SetupClickListener = function()
{
FCKClassifys._ClickListener = function( e )
{
if ( e.target.tagName == 'SPAN' && e.target._fckClassify )
FCKSelection.SelectNode( e.target ) ;
}
FCK.EditorDocument.addEventListener( 'click', FCKClassifys._ClickListener, true ) ;
}
// Open the Classify dialog on double click.
FCKClassifys.OnDoubleClick = function( span )
{
if ( span.tagName == 'SPAN' && span._fckClassify )
FCKCommands.GetCommand( 'Classify' ).Execute() ;
}
FCK.RegisterDoubleClickHandler( FCKClassifys.OnDoubleClick, 'SPAN' ) ;
// Check if a Placholder name is already in use.
FCKClassifys.Exist = function( name )
{
var aSpans = FCK.EditorDocument.getElementsByTagName( 'SPAN' )
for ( var i = 0 ; i < aSpans.length ; i++ )
{
if ( aSpans[i]._fckClassify == name )
return true ;
}
}
if ( FCKBrowserInfo.IsIE )
{
FCKClassifys.Redraw = function()
{
var aPlaholders = FCK.EditorDocument.body.innerText.match( /\[\[[^\[\]]+\]\]/g ) ;
if ( !aPlaholders )
return ;
var oRange = FCK.EditorDocument.body.createTextRange() ;
for ( var i = 0 ; i < aPlaholders.length ; i++ )
{
if ( oRange.findText( aPlaholders[i] ) )
{
var sName = aPlaholders[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ;
// oRange.pasteHTML( '<span style="color: #000000; background-color: #ffff00" contenteditable="false" _fckClassify="' + sName + '">' + aPlaholders[i] + '</span>' ) ;
oRange.pasteHTML( '<span style="font-weight: bold; contenteditable="false" _fckClassify="' + sName + '">' + aPlaholders[i] + '</span>' ) ;
}
}
}
}
else
{
FCKClassifys.Redraw = function()
{
var oInteractor = FCK.EditorDocument.createTreeWalker( FCK.EditorDocument.body, NodeFilter.SHOW_TEXT, FCKClassifys._AcceptNode, true ) ;
var aNodes = new Array() ;
while ( oNode = oInteractor.nextNode() )
{
aNodes[ aNodes.length ] = oNode ;
}
for ( var n = 0 ; n < aNodes.length ; n++ )
{
var aPieces = aNodes[n].nodeValue.split( /(\[\[[^\[\]]+\]\])/g ) ;
for ( var i = 0 ; i < aPieces.length ; i++ )
{
if ( aPieces[i].length > 0 )
{
if ( aPieces[i].indexOf( '[[' ) == 0 )
{
var sName = aPieces[i].match( /\[\[\s*([^\]]*?)\s*\]\]/ )[1] ;
var oSpan = FCK.EditorDocument.createElement( 'span' ) ;
FCKClassifys.SetupSpan( oSpan, sName ) ;
aNodes[n].parentNode.insertBefore( oSpan, aNodes[n] ) ;
}
else
aNodes[n].parentNode.insertBefore( FCK.EditorDocument.createTextNode( aPieces[i] ) , aNodes[n] ) ;
}
}
aNodes[n].parentNode.removeChild( aNodes[n] ) ;
}
FCKClassifys._SetupClickListener() ;
}
FCKClassifys._AcceptNode = function( node )
{
if ( /\[\[[^\[\]]+\]\]/.test( node.nodeValue ) )
return NodeFilter.FILTER_ACCEPT ;
else
return NodeFilter.FILTER_SKIP ;
}
}
FCK.Events.AttachEvent( 'OnAfterSetHTML', FCKClassifys.Redraw ) ;
// The "Redraw" method must be called on startup.
FCKClassifys.Redraw() ;
// We must process the SPAN tags to replace then with the real resulting value of the Classify.
FCKXHtml.TagProcessors['span'] = function( node, htmlNode )
{
if ( htmlNode._fckClassify )
node = FCKXHtml.XML.createTextNode( '' + htmlNode._fckClassify + '' ) ;
else
FCKXHtml._AppendChildNodes( node, htmlNode, false ) ;
return node ;
}
________________________________
create a graphic called Classify.gif
21x20
____________________________
not sure if you need the lang files.. u can copy the lang directory from the placeholder plugin dir.
___________________
add this to your fckconfig.js
FCKConfig.Plugins.Add( 'Classify', 'en' ) ;
add the ['Classify'] to your tool bar on the this same js. file..
Thaks hsould be it!!