Update of /cvsroot/phpslash/phpslash-dev/public_html/scripts/fckeditor/editor/_source/classes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16237/phpslash-dev/public_html/scripts/fckeditor/editor/_source/classes
Added Files:
fck_othercommands.js fckcontextmenugroup.js
fckcontextmenuitem.js fckcontextmenuseparator.js fckevents.js
fcknamedcommand.js fcktoolbar.js fcktoolbarbutton.js
fcktoolbarcombo.js
Log Message:
added fckeditor to comment submittal.
--- NEW FILE: fck_othercommands.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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_othercommands.js
* Definition of other commands that are not available internaly in the
* browser (see FCKNamedCommand).
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:47
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
// ### General Dialog Box Commands.
var FCKDialogCommand = function( name, title, url, width, height, getStateFunction, getStateParam )
{
this.Name = name ;
this.Title = title ;
this.Url = url ;
this.Width = width ;
this.Height = height ;
this.GetStateFunction = getStateFunction ;
this.GetStateParam = getStateParam ;
}
FCKDialogCommand.prototype.Execute = function()
{
FCKDialog.OpenDialog( 'FCKDialog_' + this.Name , this.Title, this.Url, this.Width, this.Height ) ;
}
FCKDialogCommand.prototype.GetState = function()
{
if ( this.GetStateFunction )
{
return this.GetStateFunction( this.GetStateParam ) ;
}
else
{
return FCK_TRISTATE_OFF ;
}
}
// Generic Undefined command (usually used when a command is under development).
var FCKUndefinedCommand = function()
{
this.Name = 'Undefined' ;
}
FCKUndefinedCommand.prototype.Execute = function()
{
alert( 'Undefined command' ) ;
}
FCKUndefinedCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
// ### FontName
var FCKFontNameCommand = function()
{
this.Name = 'FontName' ;
}
FCKFontNameCommand.prototype.Execute = function( fontName )
{
if (fontName == null || fontName == "")
{
// TODO: Remove font name attribute.
}
else
{
FCK.ExecuteNamedCommand( 'FontName', fontName ) ;
}
}
FCKFontNameCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandValue( 'FontName' ) ;
}
// ### FontSize
var FCKFontSizeCommand = function()
{
this.Name = 'FontSize' ;
}
FCKFontSizeCommand.prototype.Execute = function( fontSize )
{
if ( typeof( fontSize ) == 'string' ) fontSize = parseInt(fontSize) ;
if ( fontSize == null || fontSize == '' )
{
// TODO: Remove font size attribute (Now it works with size 3. Will it work forever?)
FCK.ExecuteNamedCommand( 'FontSize', 3 ) ;
}
else
{
FCK.ExecuteNamedCommand( 'FontSize', fontSize ) ;
}
}
FCKFontSizeCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandValue( 'FontSize' ) ;
}
// ### FormatBlock
var FCKFormatBlockCommand = function()
{
this.Name = 'FormatBlock' ;
}
FCKFormatBlockCommand.prototype.Execute = function( formatName )
{
if ( formatName == null || formatName == '' )
{
FCK.ExecuteNamedCommand( 'FormatBlock', '<P>' ) ;
}
else
{
FCK.ExecuteNamedCommand( 'FormatBlock', formatName ) ;
}
}
FCKFormatBlockCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandValue( 'FormatBlock' ) ;
}
// ### Preview
var FCKPreviewCommand = function()
{
this.Name = 'Preview' ;
}
FCKPreviewCommand.prototype.Execute = function()
{
FCK.Preview() ;
}
FCKPreviewCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
// ### Save
var FCKSaveCommand = function()
{
this.Name = 'Save' ;
}
FCKSaveCommand.prototype.Execute = function()
{
// Get the linked field form.
var oForm = FCK.LinkedField.form ;
// Submit the form.
oForm.submit() ;
}
FCKSaveCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
// ### NewPage
var FCKNewPageCommand = function()
{
this.Name = 'NewPage' ;
}
FCKNewPageCommand.prototype.Execute = function()
{
FCK.SetHTML( '' ) ;
}
FCKNewPageCommand.prototype.GetState = function()
{
return FCK_TRISTATE_OFF ;
}
// ### Source button
var FCKSourceCommand = function()
{
this.Name = "Source" ;
}
FCKSourceCommand.prototype.Execute = function()
{
FCK.SwitchEditMode() ;
}
FCKSourceCommand.prototype.GetState = function()
{
return ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_OFF : FCK_TRISTATE_ON ) ;
}
--- NEW FILE: fckcontextmenugroup.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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: fckcontextmenugroup.js
* FCKContextMenuGroup Class: represents a group of items in the context
* menu. Generaly a group of items is directly dependent of the same rules.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:47
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKContextMenuGroup = function()
{
this.IsVisible = true ;
// Array with all available context menu items of this group.
this.Items = new Array() ;
// This OPTIONAL function checks if the group must be shown.
this.ValidationFunction = null ;
}
// Adds an item to the group's items collecion.
FCKContextMenuGroup.prototype.Add = function( contextMenuItem )
{
this.Items[ this.Items.length ] = contextMenuItem ;
}
// Creates the <TR> elements that represent the item in a table (usually the rendered context menu).
FCKContextMenuGroup.prototype.CreateTableRows = function( table )
{
for ( var i = 0 ; i < this.Items.length ; i++ )
{
this.Items[i].CreateTableRow( table ) ;
}
}
FCKContextMenuGroup.prototype.SetVisible = function( isVisible )
{
for ( var i = 0 ; i < this.Items.length ; i++ )
{
this.Items[i].SetVisible( isVisible ) ;
}
this.IsVisible = isVisible ;
}
FCKContextMenuGroup.prototype.RefreshState = function()
{
if ( ! this.IsVisible ) return ;
for ( var i = 0 ; i < this.Items.length ; i++ )
{
this.Items[i].RefreshState() ;
}
}
--- NEW FILE: fckcontextmenuitem.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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: fckcontextmenuitem.js
* FCKContextMenuItem Class: represents a item in the context menu.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:47
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKContextMenuItem = function( contextMenu, commandName, label, hasIcon )
{
this.ContextMenu = contextMenu ;
this.Command = FCKCommands[ commandName ] ;
this.Label = label ? label : commandName ;
this.HasIcon = hasIcon ? true : false ;
}
FCKContextMenuItem.prototype.CreateTableRow = function( targetTable )
{
// Creates the <TR> element.
this._Row = targetTable.insertRow(-1) ;
this._Row.className = 'CM_Disabled' ;
this._Row.FCKContextMenuItem = this ;
// Sets the mouse over event.
this._Row.onmouseover = function()
{
if ( this.className != 'CM_Disabled' )
this.className = 'CM_Over' ;
}
// Sets the mouse out event.
this._Row.onmouseout = function()
{
if ( this.className != 'CM_Disabled' )
this.className = 'CM_Option' ;
}
this._Row.onclick = function()
{
this.FCKContextMenuItem.ContextMenu.Hide() ;
this.FCKContextMenuItem.Command.Execute() ;
return false ;
}
var oCell = this._Row.insertCell(-1) ;
oCell.className = 'CM_Icon' ;
if ( this.HasIcon ) oCell.innerHTML = '<img alt="" src="' + FCKConfig.SkinPath + 'toolbar/button.' + this.Command.Name.toLowerCase() + '.gif" width="21" height="20" unselectable="on">' ;
oCell = this._Row.insertCell(-1) ;
oCell.className = 'CM_Label' ;
oCell.unselectable = 'on' ;
oCell.noWrap = true ;
oCell.innerHTML = this.Label ;
}
FCKContextMenuItem.prototype.SetVisible = function( isVisible )
{
this._Row.style.display = isVisible ? '' : 'none' ;
}
FCKContextMenuItem.prototype.RefreshState = function()
{
switch ( this.Command.GetState() )
{
case FCK_TRISTATE_ON :
case FCK_TRISTATE_OFF :
this._Row.className = 'CM_Option' ;
break ;
default :
this._Row.className = 'CM_Disabled' ;
break ;
}
}
/*
Sample output.
-----------------------------------------
<tr class="CM_Disabled">
<td class="CM_Icon"><img alt="" src="icons/button.cut.gif" width="21" height="20" unselectable="on"></td>
<td class="CM_Label" unselectable="on">Cut</td>
</tr>
-----------------------------------------
<tr class="CM_Option" onmouseover="OnOver(this);" onmouseout="OnOut(this);">
<td class="CM_Icon"></td>
<td class="CM_Label">Do Something</td>
</tr>
*/
--- NEW FILE: fckcontextmenuseparator.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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: fckcontextmenuseparator.js
* FCKContextMenuSeparator Class: represents a separator in the toolbar.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:47
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKContextMenuSeparator = function()
{
}
FCKContextMenuSeparator.prototype.CreateTableRow = function( targetTable )
{
// Creates the <TR> element.
this._Row = targetTable.insertRow(-1) ;
this._Row.className = 'CM_Separator' ;
var oCell = this._Row.insertCell(-1) ;
oCell.className = 'CM_Icon' ;
oCell = this._Row.insertCell(-1) ;
oCell.className = 'CM_Label' ;
oCell.innerHTML = '<div></div>' ;
}
FCKContextMenuSeparator.prototype.SetVisible = function( isVisible )
{
this._Row.style.display = isVisible ? '' : 'none' ;
}
FCKContextMenuSeparator.prototype.RefreshState = function()
{
// Do nothing... its state doesn't change.
}
/*
Sample output.
-----------------------------------------
<tr class="CM_Separator">
<td class="CM_Icon"></td>
<td class="CM_Label"><div></div></td>
</tr>
*/
--- NEW FILE: fckevents.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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: fckevents.js
* FCKEvents Class: used to handle events is a advanced way.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:47
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKEvents = function( eventsOwner )
{
this.Owner = eventsOwner ;
this.RegisteredEvents = new Object() ;
}
FCKEvents.prototype.AttachEvent = function( eventName, functionPointer, params )
{
if ( ! this.RegisteredEvents[ eventName ] ) this.RegisteredEvents[ eventName ] = new Array() ;
this.RegisteredEvents[ eventName ][ this.RegisteredEvents[ eventName ].length ] = functionPointer ;
}
FCKEvents.prototype.FireEvent = function( eventName, params )
{
var bReturnValue = true ;
FCKDebug.Output( 'Firing event: ' + eventName, 'Fuchsia' ) ;
var oCalls = this.RegisteredEvents[ eventName ] ;
if ( oCalls )
{
for ( i in oCalls )
{
if ( typeof( oCalls[ i ] ) == "function" ) // A Function Pointer
{
bReturnValue = ( bReturnValue && oCalls[ i ]( params ) ) ;
}
else // A string (code to run)
{
bReturnValue = ( bReturnValue && eval( oCalls[ i ] ) ) ;
}
}
}
return bReturnValue ;
}
--- NEW FILE: fcknamedcommand.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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: fcknamedcommand.js
* FCKNamedCommand Class: represents a internal browser command.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:47
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKNamedCommand = function( commandName )
{
this.Name = commandName ;
}
FCKNamedCommand.prototype.Execute = function()
{
FCK.ExecuteNamedCommand( this.Name ) ;
}
FCKNamedCommand.prototype.GetState = function()
{
return FCK.GetNamedCommandState( this.Name ) ;
}
--- NEW FILE: fcktoolbar.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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: fcktoolbar.js
* FCKToolbar Class: represents a toolbar. A toolbar is not the complete
* toolbar set visible, but just a strip on it... a group of items.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:47
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKToolbar = function()
{
this.Items = new Array() ;
this.DOMTable = document.createElement( 'table' ) ;
this.DOMTable.className = 'TB_Toolbar' ;
with ( this.DOMTable )
{
// Sets the toolbar direction. IE uses "styleFloat" and Gecko uses "cssFloat".
style.styleFloat = style.cssFloat = FCKLang.Dir == 'rtl' ? 'right' : 'left' ;
cellPadding = 0 ;
cellSpacing = 0 ;
border = 0 ;
}
this.DOMRow = this.DOMTable.insertRow(-1) ;
var oCell = this.DOMRow.insertCell(-1) ;
oCell.className = 'TB_Start' ;
oCell.innerHTML = '<img src="' + FCKConfig.SkinPath + 'images/toolbar.start.gif" width="7" height="21" style="VISIBILITY: hidden" onload="this.style.visibility = \'\';" unselectable="on">' ;
FCKToolbarSet.DOMElement.appendChild( this.DOMTable ) ;
}
FCKToolbar.prototype.AddItem = function( toolbarItem )
{
this.Items[ this.Items.length ] = toolbarItem ;
toolbarItem.CreateInstance( this ) ;
}
FCKToolbar.prototype.AddSeparator = function()
{
var oCell = this.DOMRow.insertCell(-1) ;
oCell.unselectable = 'on' ;
oCell.innerHTML = '<img src="' + FCKConfig.SkinPath + 'images/toolbar.separator.gif" width="5" height="21" style="VISIBILITY: hidden" onload="this.style.visibility = \'\';" unselectable="on">' ;
}
FCKToolbar.prototype.AddTerminator = function()
{
var oCell = this.DOMRow.insertCell(-1) ;
oCell.className = 'TB_End' ;
oCell.innerHTML = '<img src="' + FCKConfig.SkinPath + 'images/toolbar.end.gif" width="12" height="21" style="VISIBILITY: hidden" onload="this.style.visibility = \'\';" unselectable="on">' ;
}
--- NEW FILE: fcktoolbarbutton.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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: fcktoolbarbutton.js
* FCKToolbarButton Class: represents a button in the toolbar.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:47
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKToolbarButton = function( commandName, label, tooltip, style, sourceView )
{
this.Command = FCKCommands[ commandName ] ;
this.Label = label ? label : commandName ;
this.Tooltip = tooltip ? tooltip : ( label ? label : commandName) ;
this.Style = style ? style : FCK_TOOLBARITEM_ONLYICON ;
this.SourceView = sourceView ? true : false ;
this.State = FCK_UNKNOWN ;
}
FCKToolbarButton.prototype.CreateInstance = function( parentToolbar )
{
/*
<td title="Bold" class="TB_Button_Off" unselectable="on" onmouseover="Button_OnMouseOver(this);" onmouseout="Button_OnMouseOut(this);">
<table class="TB_ButtonType_Icon" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="TB_Icon"><img src="icons/button.redo.gif" width="21" height="21" style="VISIBILITY: hidden" onload="this.style.visibility = '';"></td>
<td class="TB_Text" unselectable="on">Redo</td>
</tr>
</table>
</td>
*/
this.DOMDiv = document.createElement( 'div' ) ;
this.DOMDiv.className = 'TB_Button_Off' ;
this.DOMDiv.FCKToolbarButton = this ;
this.DOMDiv.onmouseover = function()
{
if ( this.FCKToolbarButton.State != FCK_TRISTATE_DISABLED )
{
this.className = 'TB_Button_On' ;
}
}
this.DOMDiv.onmouseout = function()
{
if ( this.FCKToolbarButton.State != FCK_TRISTATE_DISABLED && this.FCKToolbarButton.State != FCK_TRISTATE_ON )
{
this.className = 'TB_Button_Off' ;
}
}
this.DOMDiv.onclick = function()
{
if ( this.FCKToolbarButton.State != FCK_TRISTATE_DISABLED )
this.FCKToolbarButton.Command.Execute() ;
return false ;
}
// Gets the correct CSS class to use for the specified style (param).
var sClass ;
switch ( this.Style )
{
case FCK_TOOLBARITEM_ONLYICON :
sClass = 'TB_ButtonType_Icon' ;
break ;
case FCK_TOOLBARITEM_ONLYTEXT :
sClass = 'TB_ButtonType_Text' ;
break ;
case FCK_TOOLBARITEM_ICONTEXT :
sClass = '' ;
break ;
}
this.DOMDiv.innerHTML =
'<table title="' + this.Tooltip + '" class="' + sClass + '" cellspacing="0" cellpadding="0" border="0" unselectable="on">' +
'<tr>' +
'<td class="TB_Icon" unselectable="on"><img src="' + FCKConfig.SkinPath + 'toolbar/button.' + this.Command.Name.toLowerCase() + '.gif" width="21" height="21" style="VISIBILITY: hidden" onload="this.style.visibility = \'\';" unselectable="on"></td>' +
'<td class="TB_Text" unselectable="on">' + this.Label + '</td>' +
'</tr>' +
'</table>' ;
var oCell = parentToolbar.DOMRow.insertCell(-1) ;
oCell.appendChild( this.DOMDiv ) ;
this.RefreshState() ;
}
FCKToolbarButton.prototype.RefreshState = function()
{
// Gets the actual state.
var eState ;
if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )
eState = FCK_TRISTATE_DISABLED ;
else
eState = this.Command.GetState() ;
// If there are no state changes than do nothing and return.
if ( eState == this.State ) return ;
// Sets the actual state.
this.State = eState ;
switch ( this.State )
{
case FCK_TRISTATE_ON :
this.DOMDiv.className = 'TB_Button_On' ;
break ;
case FCK_TRISTATE_OFF :
this.DOMDiv.className = 'TB_Button_Off' ;
break ;
default :
this.DOMDiv.className = 'TB_Button_Disabled' ;
break ;
}
}
--- NEW FILE: fcktoolbarcombo.js ---
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2004 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: fcktoolbarcombo.js
* FCKToolbarCombo Class: represents a combo in the toolbar.
*
* Version: 2.0 Beta 1
* Modified: 2004-05-31 23:07:48
*
* File Authors:
* Frederico Caldeira Knabben (fr...@fc...)
*/
var FCKToolbarCombo = function( commandName, label, itemsValues, itemsNames, tooltip, style, firstIsBlank, itemsSeparator, sourceView )
{
this.Command = FCKCommands[ commandName ] ;
this.Label = label ? label : commandName ;
this.Tooltip = tooltip ? tooltip : ( label ? label : commandName) ;
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
this.SourceView = sourceView ? true : false ;
this.State = FCK_UNKNOWN ;
this.ItemsValues = itemsValues ;
this.ItemsNames = itemsNames ? itemsNames : itemsValues ;
this.ItemsSeparator = itemsSeparator ? itemsSeparator : ';' ;
this.FirstIsBlank = firstIsBlank != null ? firstIsBlank : true ;
}
FCKToolbarCombo.prototype.CreateInstance = function( parentToolbar )
{
/*
<td class="TB_Combo_Disabled" unselectable="on">
<table class="ButtonType_IconText" cellspacing="0" cellpadding="0" border="0">
<tr>
<td class="TB_Text" unselectable="on">Style</td>
<td><select title="Style"><option>Style 1</option><option>Style 2</option></select></td>
</tr>
</table>
</td>
*/
this.DOMDiv = document.createElement( 'div' ) ;
this.DOMDiv.className = 'TB_Combo_Off' ;
// Gets the correct CSS class to use for the specified style (param).
var sClass ;
switch ( this.Style )
{
case FCK_TOOLBARITEM_ONLYICON :
sClass = 'TB_ButtonType_Icon' ;
break ;
case FCK_TOOLBARITEM_ONLYTEXT :
sClass = 'TB_ButtonType_Text' ;
break ;
case FCK_TOOLBARITEM_ICONTEXT :
sClass = '' ;
break ;
}
this.DOMDiv.innerHTML =
'<table class="' + sClass + '" cellspacing="0" cellpadding="0" border="0" unselectable="on">' +
'<tr>' +
'<td class="TB_Text" unselectable="on" nowrap>' + this.Label + '</td>' +
'<td unselectable="on"><select title="' + this.Tooltip + '"></select></td>' +
'</tr>' +
'</table>' ;
// Gets the SELECT element.
this.SelectElement = this.DOMDiv.firstChild.firstChild.firstChild.childNodes.item(1).firstChild ;
this.SelectElement.FCKToolbarCombo = this ;
this.SelectElement.onchange = function()
{
this.FCKToolbarCombo.Command.Execute( this.value ) ;
return false ;
}
var oCell = parentToolbar.DOMRow.insertCell(-1) ;
oCell.appendChild( this.DOMDiv ) ;
// Loads all combo items.
this.RefreshItems() ;
// Sets its initial state (probably disabled).
this.RefreshState() ;
}
FCKToolbarCombo.prototype.RefreshItems = function()
{
// Create the empty arrays of items to add (names and values)
var aNames = FCKTools.GetResultingArray( this.ItemsNames, this.ItemsSeparator ) ;
var aValues = FCKTools.GetResultingArray( this.ItemsValues, this.ItemsSeparator ) ;
// Clean up the combo.
FCKTools.RemoveAllSelectOptions( this.SelectElement ) ;
// Verifies if the first item in the combo must be blank.
if ( this.FirstIsBlank )
FCKTools.AddSelectOption( document, this.SelectElement, '', '' ) ;
// Add all items to the combo.
for ( var i = 0 ; i < aValues.length ; i++ )
{
FCKTools.AddSelectOption( document, this.SelectElement, aNames[i], aValues[i] ) ;
}
}
FCKToolbarCombo.prototype.RefreshState = function()
{
// Gets the actual state.
var eState ;
if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )
{
eState = FCK_TRISTATE_DISABLED ;
// Cleans the actual selection.
this.SelectElement.value = '' ;
}
else
{
var sValue = this.Command.GetState() ;
// Sets the combo value.
FCKTools.SelectNoCase( this.SelectElement, sValue ? sValue : '', '' ) ;
// Gets the actual state.
eState = sValue == null ? FCK_TRISTATE_DISABLED : FCK_TRISTATE_ON ;
}
// If there are no state changes then do nothing and return.
if ( eState == this.State ) return ;
// Sets the actual state.
this.State = eState ;
// Updates the graphical state.
this.DOMDiv.className = ( eState == FCK_TRISTATE_ON ? 'TB_Combo_Off' : 'TB_Combo_Disabled' ) ;
this.SelectElement.disabled = ( eState == FCK_TRISTATE_DISABLED ) ;
}
|