Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 1687 → Rev 1688

/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckeditingarea.js
New file
0,0 → 1,190
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckeditingarea.js
* FCKEditingArea Class: renders an editable area.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
/**
* @constructor
* @param {String} targetElement The element that will hold the editing area. Any child element present in the target will be deleted.
*/
var FCKEditingArea = function( targetElement )
{
this.TargetElement = targetElement ;
this.Mode = FCK_EDITMODE_WYSIWYG ;
 
if ( FCK.IECleanup )
FCK.IECleanup.AddItem( this, FCKEditingArea_Cleanup ) ;
}
 
 
/**
* @param {String} html The complete HTML for the page, including DOCTYPE and the <html> tag.
*/
FCKEditingArea.prototype.Start = function( html, secondCall )
{
var eTargetElement = this.TargetElement ;
var oTargetDocument = FCKTools.GetElementDocument( eTargetElement ) ;
// Remove all child nodes from the target.
while( eTargetElement.childNodes.length > 0 )
eTargetElement.removeChild( eTargetElement.childNodes[0] ) ;
 
if ( this.Mode == FCK_EDITMODE_WYSIWYG )
{
if ( FCKBrowserInfo.IsGecko )
html = html.replace( /(<body[^>]*>)\s*(<\/body>)/i, '$1' + GECKO_BOGUS + '$2' ) ;
// Create the editing area IFRAME.
var oIFrame = this.IFrame = oTargetDocument.createElement( 'iframe' ) ;
oIFrame.src = 'javascript:void(0)' ;
oIFrame.frameBorder = 0 ;
oIFrame.width = oIFrame.height = '100%' ;
// Append the new IFRAME to the target.
eTargetElement.appendChild( oIFrame ) ;
// IE has a bug with the <base> tag... it must have a </base> closer,
// otherwise the all sucessive tags will be set as children nodes of the <base>.
if ( FCKBrowserInfo.IsIE )
html = html.replace( /(<base[^>]*?)\s*\/?>(?!\s*<\/base>)/gi, '$1></base>' ) ;
 
// Get the window and document objects used to interact with the newly created IFRAME.
this.Window = oIFrame.contentWindow ;
// IE: Avoid JavaScript errors thrown by the editing are source (like tags events).
// TODO: This error handler is not being fired.
// this.Window.onerror = function() { alert( 'Error!' ) ; return true ; }
 
var oDoc = this.Document = this.Window.document ;
oDoc.open() ;
oDoc.write( html ) ;
oDoc.close() ;
// Firefox 1.0.x is buggy... ohh yes... so let's do it two times and it
// will magicaly work.
if ( FCKBrowserInfo.IsGecko10 && !secondCall )
{
this.Start( html, true ) ;
return ;
}
this.Window._FCKEditingArea = this ;
// FF 1.0.x is buggy... we must wait a lot to enable editing because
// sometimes the content simply disappears, for example when pasting
// "bla1!<img src='some_url'>!bla2" in the source and then switching
// back to design.
if ( FCKBrowserInfo.IsGecko10 )
this.Window.setTimeout( FCKEditingArea_CompleteStart, 500 ) ;
else
FCKEditingArea_CompleteStart.call( this.Window ) ;
}
else
{
var eTextarea = this.Textarea = oTargetDocument.createElement( 'textarea' ) ;
eTextarea.className = 'SourceField' ;
eTextarea.dir = 'ltr' ;
eTextarea.style.width = eTextarea.style.height = '100%' ;
eTextarea.style.border = 'none' ;
eTargetElement.appendChild( eTextarea ) ;
 
eTextarea.value = html ;
 
// Fire the "OnLoad" event.
FCKTools.RunFunction( this.OnLoad ) ;
}
}
 
// "this" here is FCKEditingArea.Window
function FCKEditingArea_CompleteStart()
{
// Of Firefox, the DOM takes a little to become available. So we must wait for it in a loop.
if ( !this.document.body )
{
this.setTimeout( FCKEditingArea_CompleteStart, 50 ) ;
return ;
}
var oEditorArea = this._FCKEditingArea ;
oEditorArea.MakeEditable() ;
// Fire the "OnLoad" event.
FCKTools.RunFunction( oEditorArea.OnLoad ) ;
}
 
FCKEditingArea.prototype.MakeEditable = function()
{
var oDoc = this.Document ;
 
if ( FCKBrowserInfo.IsIE )
oDoc.body.contentEditable = true ;
else
{
try
{
oDoc.designMode = 'on' ;
 
// Tell Gecko to use or not the <SPAN> tag for the bold, italic and underline.
oDoc.execCommand( 'useCSS', false, !FCKConfig.GeckoUseSPAN ) ;
 
// Analysing Firefox 1.5 source code, it seams that there is support for a
// "insertBrOnReturn" command. Applying it gives no error, but it doesn't
// gives the same behavior that you have with IE. It works only if you are
// already inside a paragraph and it doesn't render correctly in the first enter.
// oDoc.execCommand( 'insertBrOnReturn', false, false ) ;
 
// Tell Gecko (Firefox 1.5+) to enable or not live resizing of objects (by Alfonso Martinez)
oDoc.execCommand( 'enableObjectResizing', false, !FCKConfig.DisableObjectResizing ) ;
// Disable the standard table editing features of Firefox.
oDoc.execCommand( 'enableInlineTableEditing', false, !FCKConfig.DisableFFTableHandles ) ;
}
catch (e) {}
}
}
 
FCKEditingArea.prototype.Focus = function()
{
try
{
if ( this.Mode == FCK_EDITMODE_WYSIWYG )
{
if ( FCKBrowserInfo.IsSafari )
this.IFrame.focus() ;
else
this.Window.focus() ;
}
else
this.Textarea.focus() ;
}
catch(e) {}
}
 
function FCKEditingArea_Cleanup()
{
this.TargetElement = null ;
this.IFrame = null ;
this.Document = null ;
this.Textarea = null ;
if ( this.Window )
{
this.Window._FCKEditingArea = null ;
this.Window = null ;
}
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckxml_ie.js
New file
0,0 → 1,78
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckxml_ie.js
* FCKXml Class: class to load and manipulate XML files.
* (IE specific implementation)
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKXml = function()
{
this.Error = false ;
}
 
FCKXml.prototype.LoadUrl = function( urlToCall )
{
this.Error = false ;
 
var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
 
if ( !oXmlHttp )
{
this.Error = true ;
return ;
}
 
oXmlHttp.open( "GET", urlToCall, false ) ;
oXmlHttp.send( null ) ;
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
this.DOMDocument = oXmlHttp.responseXML ;
else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
{
this.DOMDocument = FCKTools.CreateXmlObject( 'DOMDocument' ) ;
this.DOMDocument.async = false ;
this.DOMDocument.resolveExternals = false ;
this.DOMDocument.loadXML( oXmlHttp.responseText ) ;
}
else
{
this.Error = true ;
alert( 'Error loading "' + urlToCall + '"' ) ;
}
}
 
FCKXml.prototype.SelectNodes = function( xpath, contextNode )
{
if ( this.Error )
return new Array() ;
 
if ( contextNode )
return contextNode.selectNodes( xpath ) ;
else
return this.DOMDocument.selectNodes( xpath ) ;
}
 
FCKXml.prototype.SelectSingleNode = function( xpath, contextNode )
{
if ( this.Error )
return ;
if ( contextNode )
return contextNode.selectSingleNode( xpath ) ;
else
return this.DOMDocument.selectSingleNode( xpath ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarpanelbutton.js
New file
0,0 → 1,87
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarpanelbutton.js
* FCKToolbarPanelButton Class: represents a special button in the toolbar
* that shows a panel when pressed.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarPanelButton = function( commandName, label, tooltip, style, icon )
{
this.CommandName = commandName ;
 
var oIcon ;
if ( icon == null )
oIcon = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ;
else if ( typeof( icon ) == 'number' )
oIcon = [ FCKConfig.SkinPath + 'fck_strip.gif', 16, icon ] ;
var oUIButton = this._UIButton = new FCKToolbarButtonUI( commandName, label, tooltip, oIcon, style ) ;
oUIButton._FCKToolbarPanelButton = this ;
oUIButton.ShowArrow = true ;
oUIButton.OnClick = FCKToolbarPanelButton_OnButtonClick ;
}
 
FCKToolbarPanelButton.prototype.TypeName = 'FCKToolbarPanelButton' ;
 
FCKToolbarPanelButton.prototype.Create = function( parentElement )
{
parentElement.className += 'Menu' ;
 
this._UIButton.Create( parentElement ) ;
var oPanel = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName )._Panel ;
oPanel._FCKToolbarPanelButton = this ;
var eLineDiv = oPanel.Document.body.appendChild( oPanel.Document.createElement( 'div' ) ) ;
eLineDiv.style.position = 'absolute' ;
eLineDiv.style.top = '0px' ;
var eLine = this.LineImg = eLineDiv.appendChild( oPanel.Document.createElement( 'IMG' ) ) ;
eLine.className = 'TB_ConnectionLine' ;
// eLine.style.backgroundColor = 'Red' ;
eLine.src = FCK_SPACER_PATH ;
 
oPanel.OnHide = FCKToolbarPanelButton_OnPanelHide ;
}
 
/*
Events
*/
 
function FCKToolbarPanelButton_OnButtonClick( toolbarButton )
{
var oButton = this._FCKToolbarPanelButton ;
var e = oButton._UIButton.MainElement ;
oButton._UIButton.ChangeState( FCK_TRISTATE_ON ) ;
oButton.LineImg.style.width = ( e.offsetWidth - 2 ) + 'px' ;
 
FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oButton.CommandName ).Execute( 0, e.offsetHeight - 1, e ) ; // -1 to be over the border
}
 
function FCKToolbarPanelButton_OnPanelHide()
{
var oMenuButton = this._FCKToolbarPanelButton ;
oMenuButton._UIButton.ChangeState( FCK_TRISTATE_OFF ) ;
}
 
// The Panel Button works like a normal button so the refresh state functions
// defined for the normal button can be reused here.
FCKToolbarPanelButton.prototype.RefreshState = FCKToolbarButton.prototype.RefreshState ;
FCKToolbarPanelButton.prototype.Enable = FCKToolbarButton.prototype.Enable ;
FCKToolbarPanelButton.prototype.Disable = FCKToolbarButton.prototype.Disable ;
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarbreak_gecko.js
New file
0,0 → 1,32
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarbreak_gecko.js
* FCKToolbarBreak Class: breaks the toolbars.
* It makes it possible to force the toolbar to break to a new line.
* This is the Gecko specific implementation.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarBreak = function()
{}
 
FCKToolbarBreak.prototype.Create = function( targetElement )
{
var oBreakDiv = targetElement.ownerDocument.createElement( 'div' ) ;
oBreakDiv.style.clear = oBreakDiv.style.cssFloat = FCKLang.Dir == 'rtl' ? 'right' : 'left' ;
targetElement.appendChild( oBreakDiv ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckmenublock.js
New file
0,0 → 1,140
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckmenublock.js
* Renders a list of menu items.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
 
var FCKMenuBlock = function()
{
this._Items = new Array() ;
}
 
 
FCKMenuBlock.prototype.Count = function()
{
return this._Items.length ;
}
 
FCKMenuBlock.prototype.AddItem = function( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled )
{
var oItem = new FCKMenuItem( this, name, label, iconPathOrStripInfoArrayOrIndex, isDisabled ) ;
oItem.OnClick = FCKTools.CreateEventListener( FCKMenuBlock_Item_OnClick, this ) ;
oItem.OnActivate = FCKTools.CreateEventListener( FCKMenuBlock_Item_OnActivate, this ) ;
this._Items.push( oItem ) ;
 
return oItem ;
}
 
FCKMenuBlock.prototype.AddSeparator = function()
{
this._Items.push( new FCKMenuSeparator() ) ;
}
 
FCKMenuBlock.prototype.RemoveAllItems = function()
{
this._Items = new Array() ;
var eItemsTable = this._ItemsTable ;
if ( eItemsTable )
{
while ( eItemsTable.rows.length > 0 )
eItemsTable.deleteRow( 0 ) ;
}
}
 
FCKMenuBlock.prototype.Create = function( parentElement )
{
if ( !this._ItemsTable )
{
if ( FCK.IECleanup )
FCK.IECleanup.AddItem( this, FCKMenuBlock_Cleanup ) ;
 
this._Window = FCKTools.GetElementWindow( parentElement ) ;
 
var oDoc = FCKTools.GetElementDocument( parentElement ) ;
 
var eTable = parentElement.appendChild( oDoc.createElement( 'table' ) ) ;
eTable.cellPadding = 0 ;
eTable.cellSpacing = 0 ;
 
FCKTools.DisableSelection( eTable ) ;
var oMainElement = eTable.insertRow(-1).insertCell(-1) ;
oMainElement.className = 'MN_Menu' ;
var eItemsTable = this._ItemsTable = oMainElement.appendChild( oDoc.createElement( 'table' ) ) ;
eItemsTable.cellPadding = 0 ;
eItemsTable.cellSpacing = 0 ;
}
for ( var i = 0 ; i < this._Items.length ; i++ )
this._Items[i].Create( this._ItemsTable ) ;
}
 
/* Events */
 
function FCKMenuBlock_Item_OnClick( clickedItem, menuBlock )
{
FCKTools.RunFunction( menuBlock.OnClick, menuBlock, [ clickedItem ] ) ;
}
 
function FCKMenuBlock_Item_OnActivate( menuBlock )
{
var oActiveItem = menuBlock._ActiveItem ;
if ( oActiveItem && oActiveItem != this )
{
// Set the focus to this menu block window (to fire OnBlur on opened panels).
if ( !FCKBrowserInfo.IsIE && oActiveItem.HasSubMenu && !this.HasSubMenu )
menuBlock._Window.focus() ;
 
oActiveItem.Deactivate() ;
}
 
menuBlock._ActiveItem = this ;
}
 
function FCKMenuBlock_Cleanup()
{
this._Window = null ;
this._ItemsTable = null ;
}
 
// ################# //
 
var FCKMenuSeparator = function()
{}
 
FCKMenuSeparator.prototype.Create = function( parentTable )
{
var oDoc = FCKTools.GetElementDocument( parentTable ) ;
 
var r = parentTable.insertRow(-1) ;
var eCell = r.insertCell(-1) ;
eCell.className = 'MN_Separator MN_Icon' ;
 
eCell = r.insertCell(-1) ;
eCell.className = 'MN_Separator' ;
eCell.appendChild( oDoc.createElement( 'DIV' ) ).className = 'MN_Separator_Line' ;
 
eCell = r.insertCell(-1) ;
eCell.className = 'MN_Separator' ;
eCell.appendChild( oDoc.createElement( 'DIV' ) ).className = 'MN_Separator_Line' ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckstyledef.js
New file
0,0 → 1,55
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckstyledef.js
* FCKStyleDef Class: represents a single style definition.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKStyleDef = function( name, element )
{
this.Name = name ;
this.Element = element.toUpperCase() ;
this.IsObjectElement = FCKRegexLib.ObjectElements.test( this.Element ) ;
this.Attributes = new Object() ;
}
 
FCKStyleDef.prototype.AddAttribute = function( name, value )
{
this.Attributes[ name ] = value ;
}
 
FCKStyleDef.prototype.GetOpenerTag = function()
{
var s = '<' + this.Element ;
for ( var a in this.Attributes )
s += ' ' + a + '="' + this.Attributes[a] + '"' ;
return s + '>' ;
}
 
FCKStyleDef.prototype.GetCloserTag = function()
{
return '</' + this.Element + '>' ;
}
 
 
FCKStyleDef.prototype.RemoveFromSelection = function()
{
if ( FCKSelection.GetType() == 'Control' )
this._RemoveMe( FCK.ToolbarSet.CurrentInstance.Selection.GetSelectedElement() ) ;
else
this._RemoveMe( FCK.ToolbarSet.CurrentInstance.Selection.GetParentElement() ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarfontformatcombo.js
New file
0,0 → 1,102
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarfontformatcombo.js
* FCKToolbarPanelButton Class: Handles the Fonts combo selector.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarFontFormatCombo = function( tooltip, style )
{
this.CommandName = 'FontFormat' ;
this.Label = this.GetLabel() ;
this.Tooltip = tooltip ? tooltip : this.Label ;
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
this.NormalLabel = 'Normal' ;
this.PanelWidth = 190 ;
}
 
// Inherit from FCKToolbarSpecialCombo.
FCKToolbarFontFormatCombo.prototype = new FCKToolbarSpecialCombo ;
 
 
FCKToolbarFontFormatCombo.prototype.GetLabel = function()
{
return FCKLang.FontFormat ;
}
 
FCKToolbarFontFormatCombo.prototype.CreateItems = function( targetSpecialCombo )
{
// Add the Editor Area CSS to the panel to create a realistic preview.
FCKTools.AppendStyleSheet( targetSpecialCombo._Panel.Document, FCKConfig.ToolbarComboPreviewCSS ) ;
 
// Get the format names from the language file.
var aNames = FCKLang['FontFormats'].split(';') ;
var oNames = {
p : aNames[0],
pre : aNames[1],
address : aNames[2],
h1 : aNames[3],
h2 : aNames[4],
h3 : aNames[5],
h4 : aNames[6],
h5 : aNames[7],
h6 : aNames[8],
div : aNames[9]
} ;
 
// Get the available formats from the configuration file.
var aTags = FCKConfig.FontFormats.split(';') ;
for ( var i = 0 ; i < aTags.length ; i++ )
{
// Support for DIV in Firefox has been reintroduced on version 2.2.
// if ( aTags[i] == 'div' && FCKBrowserInfo.IsGecko )
// continue ;
var sTag = aTags[i] ;
var sLabel = oNames[sTag] ;
if ( sTag == 'p' )
this.NormalLabel = sLabel ;
this._Combo.AddItem( sTag, '<div class="BaseFont"><' + sTag + '>' + sLabel + '</' + sTag + '></div>', sLabel ) ;
}
}
 
if ( FCKBrowserInfo.IsIE )
{
FCKToolbarFontFormatCombo.prototype.RefreshActiveItems = function( combo, value )
{
// FCKDebug.Output( 'FCKToolbarFontFormatCombo Value: ' + value ) ;
 
// IE returns normal for DIV and P, so to avoid confusion, we will not show it if normal.
if ( value == this.NormalLabel )
{
if ( combo.Label != '&nbsp;' )
combo.DeselectAll(true) ;
}
else
{
if ( this._LastValue == value )
return ;
 
combo.SelectItemByLabel( value, true ) ;
}
 
this._LastValue = value ;
}
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarspecialcombo.js
New file
0,0 → 1,129
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarspecialcombo.js
* FCKToolbarSpecialCombo Class: This is a "abstract" base class to be used
* by the special combo toolbar elements like font name, font size, paragraph format, etc...
*
* The following properties and methods must be implemented when inheriting from
* this class:
* - Property: CommandName [ The command name to be executed ]
* - Method: GetLabel() [ Returns the label ]
* - CreateItems( targetSpecialCombo ) [ Add all items in the special combo ]
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarSpecialCombo = function()
{
this.SourceView = false ;
this.ContextSensitive = true ;
}
 
 
function FCKToolbarSpecialCombo_OnSelect( itemId, item )
{
FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).Execute( itemId, item ) ;
}
 
FCKToolbarSpecialCombo.prototype.Create = function( targetElement )
{
this._Combo = new FCKSpecialCombo( this.GetLabel(), this.FieldWidth, this.PanelWidth, this.PanelMaxHeight, FCKBrowserInfo.IsIE ? window : FCKTools.GetElementWindow( targetElement ).parent ) ;
/*
this._Combo.FieldWidth = this.FieldWidth != null ? this.FieldWidth : 100 ;
this._Combo.PanelWidth = this.PanelWidth != null ? this.PanelWidth : 150 ;
this._Combo.PanelMaxHeight = this.PanelMaxHeight != null ? this.PanelMaxHeight : 150 ;
*/
//this._Combo.Command.Name = this.Command.Name;
// this._Combo.Label = this.Label ;
this._Combo.Tooltip = this.Tooltip ;
this._Combo.Style = this.Style ;
this.CreateItems( this._Combo ) ;
 
this._Combo.Create( targetElement ) ;
 
this._Combo.CommandName = this.CommandName ;
this._Combo.OnSelect = FCKToolbarSpecialCombo_OnSelect ;
}
 
function FCKToolbarSpecialCombo_RefreshActiveItems( combo, value )
{
combo.DeselectAll() ;
combo.SelectItem( value ) ;
combo.SetLabelById( value ) ;
}
 
FCKToolbarSpecialCombo.prototype.RefreshState = function()
{
// Gets the actual state.
var eState ;
// if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )
// eState = FCK_TRISTATE_DISABLED ;
// else
// {
var sValue = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetState() ;
 
// FCKDebug.Output( 'RefreshState of Special Combo "' + this.TypeOf + '" - State: ' + sValue ) ;
 
if ( sValue != FCK_TRISTATE_DISABLED )
{
eState = FCK_TRISTATE_ON ;
if ( this.RefreshActiveItems )
this.RefreshActiveItems( this._Combo, sValue ) ;
else
{
if ( this._LastValue != sValue )
{
this._LastValue = sValue ;
FCKToolbarSpecialCombo_RefreshActiveItems( this._Combo, sValue ) ;
}
}
}
else
eState = FCK_TRISTATE_DISABLED ;
// }
// If there are no state changes then do nothing and return.
if ( eState == this.State ) return ;
if ( eState == FCK_TRISTATE_DISABLED )
{
this._Combo.DeselectAll() ;
this._Combo.SetLabel( '' ) ;
}
 
// Sets the actual state.
this.State = eState ;
 
// Updates the graphical state.
this._Combo.SetEnabled( eState != FCK_TRISTATE_DISABLED ) ;
}
 
FCKToolbarSpecialCombo.prototype.Enable = function()
{
this.RefreshState() ;
}
 
FCKToolbarSpecialCombo.prototype.Disable = function()
{
this.State = FCK_TRISTATE_DISABLED ;
this._Combo.DeselectAll() ;
this._Combo.SetLabel( '' ) ;
this._Combo.SetEnabled( false ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckmenuitem.js
New file
0,0 → 1,157
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckmenuitem.js
* Defines and renders a menu items in a menu block.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
 
var FCKMenuItem = function( parentMenuBlock, name, label, iconPathOrStripInfoArray, isDisabled )
{
this.Name = name ;
this.Label = label || name ;
this.IsDisabled = isDisabled ;
this.Icon = new FCKIcon( iconPathOrStripInfoArray ) ;
this.SubMenu = new FCKMenuBlockPanel() ;
this.SubMenu.Parent = parentMenuBlock ;
this.SubMenu.OnClick = FCKTools.CreateEventListener( FCKMenuItem_SubMenu_OnClick, this ) ;
 
if ( FCK.IECleanup )
FCK.IECleanup.AddItem( this, FCKMenuItem_Cleanup ) ;
}
 
 
FCKMenuItem.prototype.AddItem = function( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled )
{
this.HasSubMenu = true ;
return this.SubMenu.AddItem( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled ) ;
}
 
FCKMenuItem.prototype.AddSeparator = function()
{
this.SubMenu.AddSeparator() ;
}
 
FCKMenuItem.prototype.Create = function( parentTable )
{
var bHasSubMenu = this.HasSubMenu ;
var oDoc = FCKTools.GetElementDocument( parentTable ) ;
 
// Add a row in the table to hold the menu item.
var r = this.MainElement = parentTable.insertRow(-1) ;
r.className = this.IsDisabled ? 'MN_Item_Disabled' : 'MN_Item' ;
 
// Set the row behavior.
if ( !this.IsDisabled )
{
FCKTools.AddEventListenerEx( r, 'mouseover', FCKMenuItem_OnMouseOver, [ this ] ) ;
FCKTools.AddEventListenerEx( r, 'click', FCKMenuItem_OnClick, [ this ] ) ;
 
if ( !bHasSubMenu )
FCKTools.AddEventListenerEx( r, 'mouseout', FCKMenuItem_OnMouseOut, [ this ] ) ;
}
// Create the icon cell.
var eCell = r.insertCell(-1) ;
eCell.className = 'MN_Icon' ;
eCell.appendChild( this.Icon.CreateIconElement( oDoc ) ) ;
 
// Create the label cell.
eCell = r.insertCell(-1) ;
eCell.className = 'MN_Label' ;
eCell.noWrap = true ;
eCell.appendChild( oDoc.createTextNode( this.Label ) ) ;
// Create the arrow cell and setup the sub menu panel (if needed).
eCell = r.insertCell(-1) ;
if ( bHasSubMenu )
{
eCell.className = 'MN_Arrow' ;
 
// The arrow is a fixed size image.
var eArrowImg = eCell.appendChild( oDoc.createElement( 'IMG' ) ) ;
eArrowImg.src = FCK_IMAGES_PATH + 'arrow_' + FCKLang.Dir + '.gif' ;
eArrowImg.width = 4 ;
eArrowImg.height = 7 ;
this.SubMenu.Create() ;
this.SubMenu.Panel.OnHide = FCKTools.CreateEventListener( FCKMenuItem_SubMenu_OnHide, this ) ;
}
}
 
FCKMenuItem.prototype.Activate = function()
{
this.MainElement.className = 'MN_Item_Over' ;
 
if ( this.HasSubMenu )
{
// Show the child menu block. The ( +2, -2 ) correction is done because
// of the padding in the skin. It is not a good solution because one
// could change the skin and so the final result would not be accurate.
// For now it is ok because we are controlling the skin.
this.SubMenu.Show( this.MainElement.offsetWidth + 2, -2, this.MainElement ) ;
}
 
FCKTools.RunFunction( this.OnActivate, this ) ;
}
 
FCKMenuItem.prototype.Deactivate = function()
{
this.MainElement.className = 'MN_Item' ;
 
if ( this.HasSubMenu )
this.SubMenu.Hide() ;
}
 
/* Events */
 
function FCKMenuItem_SubMenu_OnClick( clickedItem, listeningItem )
{
FCKTools.RunFunction( listeningItem.OnClick, listeningItem, [ clickedItem ] ) ;
}
 
function FCKMenuItem_SubMenu_OnHide( menuItem )
{
menuItem.Deactivate() ;
}
 
function FCKMenuItem_OnClick( ev, menuItem )
{
if ( menuItem.HasSubMenu )
menuItem.Activate() ;
else
{
menuItem.Deactivate() ;
FCKTools.RunFunction( menuItem.OnClick, menuItem, [ menuItem ] ) ;
}
}
 
function FCKMenuItem_OnMouseOver( ev, menuItem )
{
menuItem.Activate() ;
}
 
function FCKMenuItem_OnMouseOut( ev, menuItem )
{
menuItem.Deactivate() ;
}
 
function FCKMenuItem_Cleanup()
{
this.MainElement = null ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarbreak_ie.js
New file
0,0 → 1,34
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarbreak_ie.js
* FCKToolbarBreak Class: breaks the toolbars.
* It makes it possible to force the toolbar to brak to a new line.
* This is the IE specific implementation.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarBreak = function()
{}
 
FCKToolbarBreak.prototype.Create = function( targetElement )
{
var oBreakDiv = FCKTools.GetElementDocument( targetElement ).createElement( 'div' ) ;
oBreakDiv.className = 'TB_Break' ;
oBreakDiv.style.clear = FCKLang.Dir == 'rtl' ? 'left' : 'right' ;
targetElement.appendChild( oBreakDiv ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckstyledef_gecko.js
New file
0,0 → 1,116
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckstyledef_gecko.js
* FCKStyleDef Class: represents a single stylke definition. (Gecko specific)
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
FCKStyleDef.prototype.ApplyToSelection = function()
{
if ( FCKSelection.GetType() == 'Text' && !this.IsObjectElement )
{
var oSelection = FCK.ToolbarSet.CurrentInstance.EditorWindow.getSelection() ;
// Create the main element.
var e = FCK.ToolbarSet.CurrentInstance.EditorDocument.createElement( this.Element ) ;
for ( var i = 0 ; i < oSelection.rangeCount ; i++ )
{
e.appendChild( oSelection.getRangeAt(i).extractContents() ) ;
}
// Set the attributes.
this._AddAttributes( e ) ;
// Remove the duplicated elements.
this._RemoveDuplicates( e ) ;
 
var oRange = oSelection.getRangeAt(0) ;
oRange.insertNode( e ) ;
}
else
{
var oControl = FCK.ToolbarSet.CurrentInstance.Selection.GetSelectedElement() ;
if ( oControl.tagName == this.Element )
this._AddAttributes( oControl ) ;
}
}
 
FCKStyleDef.prototype._AddAttributes = function( targetElement )
{
for ( var a in this.Attributes )
{
switch ( a.toLowerCase() )
{
case 'src' :
targetElement.setAttribute( '_fcksavedurl', this.Attributes[a], 0 ) ;
default :
targetElement.setAttribute( a, this.Attributes[a], 0 ) ;
}
}
}
 
FCKStyleDef.prototype._RemoveDuplicates = function( parent )
{
for ( var i = 0 ; i < parent.childNodes.length ; i++ )
{
var oChild = parent.childNodes[i] ;
if ( oChild.nodeType != 1 )
continue ;
this._RemoveDuplicates( oChild ) ;
if ( this.IsEqual( oChild ) )
FCKTools.RemoveOuterTags( oChild ) ;
}
}
 
FCKStyleDef.prototype.IsEqual = function( e )
{
if ( e.tagName != this.Element )
return false ;
for ( var a in this.Attributes )
{
if ( e.getAttribute( a ) != this.Attributes[a] )
return false ;
}
return true ;
}
 
FCKStyleDef.prototype._RemoveMe = function( elementToCheck )
{
if ( ! elementToCheck )
return ;
 
var oParent = elementToCheck.parentNode ;
 
if ( elementToCheck.nodeType == 1 && this.IsEqual( elementToCheck ) )
{
if ( this.IsObjectElement )
{
for ( var a in this.Attributes )
elementToCheck.removeAttribute( a, 0 ) ;
return ;
}
else
FCKTools.RemoveOuterTags( elementToCheck ) ;
}
this._RemoveMe( oParent ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckicon.js
New file
0,0 → 1,94
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckicon.js
* FCKIcon Class: renders an icon from a single image, a strip or even a
* spacer.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKIcon = function( iconPathOrStripInfoArray )
{
var sTypeOf = iconPathOrStripInfoArray ? typeof( iconPathOrStripInfoArray ) : 'undefined' ;
switch ( sTypeOf )
{
case 'number' :
this.Path = FCKConfig.SkinPath + 'fck_strip.gif' ;
this.Size = 16 ;
this.Position = iconPathOrStripInfoArray ;
break ;
case 'undefined' :
this.Path = FCK_SPACER_PATH ;
break ;
case 'string' :
this.Path = iconPathOrStripInfoArray ;
break ;
default :
// It is an array in the format [ StripFilePath, IconSize, IconPosition ]
this.Path = iconPathOrStripInfoArray[0] ;
this.Size = iconPathOrStripInfoArray[1] ;
this.Position = iconPathOrStripInfoArray[2] ;
}
}
 
FCKIcon.prototype.CreateIconElement = function( document )
{
var eIcon ;
if ( this.Position ) // It is using an icons strip image.
{
var sPos = '-' + ( ( this.Position - 1 ) * this.Size ) + 'px' ;
if ( FCKBrowserInfo.IsIE )
{
// <div class="TB_Button_Image"><img src="strip.gif" style="top:-16px"></div>
eIcon = document.createElement( 'DIV' ) ;
var eIconImage = eIcon.appendChild( document.createElement( 'IMG' ) ) ;
eIconImage.src = this.Path ;
eIconImage.style.top = sPos ;
}
else
{
// <img class="TB_Button_Image" src="spacer.gif" style="background-position: 0px -16px;background-image: url(strip.gif);">
eIcon = document.createElement( 'IMG' ) ;
eIcon.src = FCK_SPACER_PATH ;
eIcon.style.backgroundPosition = '0px ' + sPos ;
eIcon.style.backgroundImage = 'url(' + this.Path + ')' ;
}
}
else // It is using a single icon image.
{
// This is not working well with IE. See notes bellow.
// <img class="TB_Button_Image" src="smiley.gif">
// eIcon = document.createElement( 'IMG' ) ;
// eIcon.src = this.Path ? this.Path : FCK_SPACER_PATH ;
 
// IE makes the button 1px higher if using the <img> directly, so we
// are changing to the <div> system to clip the image correctly.
eIcon = document.createElement( 'DIV' ) ;
var eIconImage = eIcon.appendChild( document.createElement( 'IMG' ) ) ;
eIconImage.src = this.Path ? this.Path : FCK_SPACER_PATH ;
}
eIcon.className = 'TB_Button_Image' ;
 
return eIcon ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarbuttonui.js
New file
0,0 → 1,218
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarbuttonui.js
* FCKToolbarButtonUI Class: interface representation of a toolbar button.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarButtonUI = function( name, label, tooltip, iconPathOrStripInfoArray, style, state )
{
this.Name = name ;
this.Label = label || name ;
this.Tooltip = tooltip || this.Label ;
this.Style = style || FCK_TOOLBARITEM_ONLYICON ;
this.State = state || FCK_TRISTATE_OFF ;
this.Icon = new FCKIcon( iconPathOrStripInfoArray ) ;
 
if ( FCK.IECleanup )
FCK.IECleanup.AddItem( this, FCKToolbarButtonUI_Cleanup ) ;
}
 
 
FCKToolbarButtonUI.prototype._CreatePaddingElement = function( document )
{
var oImg = document.createElement( 'IMG' ) ;
oImg.className = 'TB_Button_Padding' ;
oImg.src = FCK_SPACER_PATH ;
return oImg ;
}
 
FCKToolbarButtonUI.prototype.Create = function( parentElement )
{
var oMainElement = this.MainElement ;
if ( oMainElement )
{
FCKToolbarButtonUI_Cleanup.call(this) ;
if ( oMainElement.parentNode )
oMainElement.parentNode.removeChild( oMainElement ) ;
oMainElement = this.MainElement = null ;
}
 
var oDoc = FCKTools.GetElementDocument( parentElement ) ;
// Create the Main Element.
oMainElement = this.MainElement = oDoc.createElement( 'DIV' ) ;
oMainElement._FCKButton = this ; // IE Memory Leak (Circular reference).
oMainElement.title = this.Tooltip ;
 
// The following will prevent the button from catching the focus.
if ( FCKBrowserInfo.IsGecko )
oMainElement.onmousedown = FCKTools.CancelEvent ;
 
this.ChangeState( this.State, true ) ;
 
if ( this.Style == FCK_TOOLBARITEM_ONLYICON && !this.ShowArrow )
{
// <td><div class="TB_Button_On" title="Smiley">{Image}</div></td>
oMainElement.appendChild( this.Icon.CreateIconElement( oDoc ) ) ;
}
else
{
// <td><div class="TB_Button_On" title="Smiley"><table cellpadding="0" cellspacing="0"><tr><td>{Image}</td><td nowrap>Toolbar Button</td><td><img class="TB_Button_Padding"></td></tr></table></div></td>
// <td><div class="TB_Button_On" title="Smiley"><table cellpadding="0" cellspacing="0"><tr><td><img class="TB_Button_Padding"></td><td nowrap>Toolbar Button</td><td><img class="TB_Button_Padding"></td></tr></table></div></td>
var oTable = oMainElement.appendChild( oDoc.createElement( 'TABLE' ) ) ;
oTable.cellPadding = 0 ;
oTable.cellSpacing = 0 ;
 
var oRow = oTable.insertRow(-1) ;
// The Image cell (icon or padding).
var oCell = oRow.insertCell(-1) ;
if ( this.Style == FCK_TOOLBARITEM_ONLYICON || this.Style == FCK_TOOLBARITEM_ICONTEXT )
oCell.appendChild( this.Icon.CreateIconElement( oDoc ) ) ;
else
oCell.appendChild( this._CreatePaddingElement( oDoc ) ) ;
if ( this.Style == FCK_TOOLBARITEM_ONLYTEXT || this.Style == FCK_TOOLBARITEM_ICONTEXT )
{
// The Text cell.
oCell = oRow.insertCell(-1) ;
oCell.className = 'TB_Button_Text' ;
oCell.noWrap = true ;
oCell.appendChild( oDoc.createTextNode( this.Label ) ) ;
}
if ( this.ShowArrow )
{
if ( this.Style != FCK_TOOLBARITEM_ONLYICON )
{
// A padding cell.
oRow.insertCell(-1).appendChild( this._CreatePaddingElement( oDoc ) ) ;
}
oCell = oRow.insertCell(-1) ;
var eImg = oCell.appendChild( oDoc.createElement( 'IMG' ) ) ;
eImg.src = FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif' ;
eImg.width = 5 ;
eImg.height = 3 ;
}
 
// The last padding cell.
oCell = oRow.insertCell(-1) ;
oCell.appendChild( this._CreatePaddingElement( oDoc ) ) ;
}
parentElement.appendChild( oMainElement ) ;
}
 
FCKToolbarButtonUI.prototype.ChangeState = function( newState, force )
{
if ( !force && this.State == newState )
return ;
 
var e = this.MainElement ;
 
switch ( parseInt( newState ) )
{
case FCK_TRISTATE_OFF :
e.className = 'TB_Button_Off' ;
e.onmouseover = FCKToolbarButton_OnMouseOverOff ;
e.onmouseout = FCKToolbarButton_OnMouseOutOff ;
e.onclick = FCKToolbarButton_OnClick ;
break ;
case FCK_TRISTATE_ON :
e.className = 'TB_Button_On' ;
e.onmouseover = FCKToolbarButton_OnMouseOverOn ;
e.onmouseout = FCKToolbarButton_OnMouseOutOn ;
e.onclick = FCKToolbarButton_OnClick ;
break ;
 
case FCK_TRISTATE_DISABLED :
e.className = 'TB_Button_Disabled' ;
e.onmouseover = null ;
e.onmouseout = null ;
e.onclick = null ;
bEnableEvents = false ;
break ;
}
 
this.State = newState ;
}
 
function FCKToolbarButtonUI_Cleanup()
{
if ( this.MainElement )
{
this.MainElement._FCKButton = null ;
this.MainElement = null ;
}
}
 
// Event Handlers.
 
function FCKToolbarButton_OnMouseOverOn()
{
this.className = 'TB_Button_On_Over' ;
}
 
function FCKToolbarButton_OnMouseOutOn()
{
this.className = 'TB_Button_On' ;
}
 
function FCKToolbarButton_OnMouseOverOff()
{
this.className = 'TB_Button_Off_Over' ;
}
 
function FCKToolbarButton_OnMouseOutOff()
{
this.className = 'TB_Button_Off' ;
}
 
function FCKToolbarButton_OnClick( e )
{
if ( this._FCKButton.OnClick )
this._FCKButton.OnClick( this._FCKButton ) ;
}
 
/*
Sample outputs:
 
This is the base structure. The variation is the image that is marked as {Image}:
<td><div class="TB_Button_On" title="Smiley">{Image}</div></td>
<td><div class="TB_Button_On" title="Smiley"><table cellpadding="0" cellspacing="0"><tr><td>{Image}</td><td nowrap>Toolbar Button</td><td><img class="TB_Button_Padding"></td></tr></table></div></td>
<td><div class="TB_Button_On" title="Smiley"><table cellpadding="0" cellspacing="0"><tr><td><img class="TB_Button_Padding"></td><td nowrap>Toolbar Button</td><td><img class="TB_Button_Padding"></td></tr></table></div></td>
 
These are samples of possible {Image} values:
Strip - IE version:
<div class="TB_Button_Image"><img src="strip.gif" style="top:-16px"></div>
Strip : Firefox, Safari and Opera version
<img class="TB_Button_Image" style="background-position: 0px -16px;background-image: url(strip.gif);">
No-Strip : Browser independent:
<img class="TB_Button_Image" src="smiley.gif">
*/
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckstyledef_ie.js
New file
0,0 → 1,139
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckstyledef_ie.js
* FCKStyleDef Class: represents a single stylke definition. (IE specific)
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
FCKStyleDef.prototype.ApplyToSelection = function()
{
var oSelection = FCK.ToolbarSet.CurrentInstance.EditorDocument.selection ;
if ( oSelection.type == 'Text' )
{
var oRange = oSelection.createRange() ;
// Create the main element.
var e = document.createElement( this.Element ) ;
e.innerHTML = oRange.htmlText ;
// Set the attributes.
this._AddAttributes( e ) ;
// Remove the duplicated elements.
this._RemoveDuplicates( e ) ;
// Replace the selection with the resulting HTML.
oRange.pasteHTML( e.outerHTML ) ;
}
else if ( oSelection.type == 'Control' )
{
var oControl = FCK.ToolbarSet.CurrentInstance.Selection.GetSelectedElement() ;
if ( oControl.tagName == this.Element )
this._AddAttributes( oControl ) ;
}
}
 
FCKStyleDef.prototype._AddAttributes = function( targetElement )
{
for ( var a in this.Attributes )
{
switch ( a.toLowerCase() )
{
case 'style' :
targetElement.style.cssText = this.Attributes[a] ;
break ;
 
case 'class' :
targetElement.setAttribute( 'className', this.Attributes[a], 0 ) ;
break ;
 
case 'src' :
targetElement.setAttribute( '_fcksavedurl', this.Attributes[a], 0 ) ;
 
default :
targetElement.setAttribute( a, this.Attributes[a], 0 ) ;
}
}
}
 
FCKStyleDef.prototype._RemoveDuplicates = function( parent )
{
for ( var i = 0 ; i < parent.children.length ; i++ )
{
var oChild = parent.children[i] ;
this._RemoveDuplicates( oChild ) ;
if ( this.IsEqual( oChild ) )
FCKTools.RemoveOuterTags( oChild ) ;
}
}
 
FCKStyleDef.prototype.IsEqual = function( e )
{
if ( e.tagName != this.Element )
return false ;
for ( var a in this.Attributes )
{
switch ( a.toLowerCase() )
{
case 'style' :
if ( e.style.cssText.toLowerCase() != this.Attributes[a].toLowerCase() )
return false ;
break ;
case 'class' :
if ( e.getAttribute( 'className', 0 ) != this.Attributes[a] )
return false ;
break ;
default :
if ( e.getAttribute( a, 0 ) != this.Attributes[a] )
return false ;
}
}
return true ;
}
 
FCKStyleDef.prototype._RemoveMe = function( elementToCheck )
{
if ( ! elementToCheck )
return ;
 
var oParent = elementToCheck.parentElement ;
 
if ( this.IsEqual( elementToCheck ) )
{
if ( this.IsObjectElement )
{
for ( var a in this.Attributes )
{
switch ( a.toLowerCase() )
{
case 'class' :
elementToCheck.removeAttribute( 'className', 0 ) ;
break ;
default :
elementToCheck.removeAttribute( a, 0 ) ;
}
}
return ;
}
else
FCKTools.RemoveOuterTags( elementToCheck ) ;
}
this._RemoveMe( oParent ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarfontscombo.js
New file
0,0 → 1,43
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarfontscombo.js
* FCKToolbarPanelButton Class: Handles the Fonts combo selector.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarFontsCombo = function( tooltip, style )
{
this.CommandName = 'FontName' ;
this.Label = this.GetLabel() ;
this.Tooltip = tooltip ? tooltip : this.Label ;
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
}
 
// Inherit from FCKToolbarSpecialCombo.
FCKToolbarFontsCombo.prototype = new FCKToolbarSpecialCombo ;
 
 
FCKToolbarFontsCombo.prototype.GetLabel = function()
{
return FCKLang.Font ;
}
 
FCKToolbarFontsCombo.prototype.CreateItems = function( targetSpecialCombo )
{
var aFonts = FCKConfig.FontNames.split(';') ;
for ( var i = 0 ; i < aFonts.length ; i++ )
this._Combo.AddItem( aFonts[i], '<font face="' + aFonts[i] + '" style="font-size: 12px">' + aFonts[i] + '</font>' ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckplugin.js
New file
0,0 → 1,52
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckplugin.js
* FCKPlugin Class: Represents a single plugin.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKPlugin = function( name, availableLangs, basePath )
{
this.Name = name ;
this.BasePath = basePath ? basePath : FCKConfig.PluginsPath ;
this.Path = this.BasePath + name + '/' ;
if ( !availableLangs || availableLangs.length == 0 )
this.AvailableLangs = new Array() ;
else
this.AvailableLangs = availableLangs.split(',') ;
}
 
FCKPlugin.prototype.Load = function()
{
// Load the language file, if defined.
if ( this.AvailableLangs.length > 0 )
{
var sLang ;
// Check if the plugin has the language file for the active language.
if ( this.AvailableLangs.indexOf( FCKLanguageManager.ActiveLanguage.Code ) >= 0 )
sLang = FCKLanguageManager.ActiveLanguage.Code ;
else
// Load the default language file (first one) if the current one is not available.
sLang = this.AvailableLangs[0] ;
// Add the main plugin script.
LoadScript( this.Path + 'lang/' + sLang + '.js' ) ;
}
// Add the main plugin script.
LoadScript( this.Path + 'fckplugin.js' ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarbutton.js
New file
0,0 → 1,70
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarbutton.js
* FCKToolbarButton Class: represents a button in the toolbar.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarButton = function( commandName, label, tooltip, style, sourceView, contextSensitive, icon )
{
this.CommandName = commandName ;
this.Label = label ;
this.Tooltip = tooltip ;
this.Style = style ;
this.SourceView = sourceView ? true : false ;
this.ContextSensitive = contextSensitive ? true : false ;
 
if ( icon == null )
this.IconPath = FCKConfig.SkinPath + 'toolbar/' + commandName.toLowerCase() + '.gif' ;
else if ( typeof( icon ) == 'number' )
this.IconPath = [ FCKConfig.SkinPath + 'fck_strip.gif', 16, icon ] ;
}
 
FCKToolbarButton.prototype.Create = function( targetElement )
{
this._UIButton = new FCKToolbarButtonUI( this.CommandName, this.Label, this.Tooltip, this.IconPath, this.Style ) ;
this._UIButton.OnClick = this.Click ;
this._UIButton._ToolbarButton = this ;
this._UIButton.Create( targetElement ) ;
}
 
FCKToolbarButton.prototype.RefreshState = function()
{
// Gets the actual state.
var eState = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetState() ;
// If there are no state changes than do nothing and return.
if ( eState == this._UIButton.State ) return ;
// Sets the actual state.
this._UIButton.ChangeState( eState ) ;
}
 
FCKToolbarButton.prototype.Click = function()
{
var oToolbarButton = this._ToolbarButton || this ;
FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oToolbarButton.CommandName ).Execute() ;
}
 
FCKToolbarButton.prototype.Enable = function()
{
this.RefreshState() ;
}
 
FCKToolbarButton.prototype.Disable = function()
{
// Sets the actual state.
this._UIButton.ChangeState( FCK_TRISTATE_DISABLED ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckpanel.js
New file
0,0 → 1,295
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckpanel.js
* Component that creates floating panels. It is used by many
* other components, like the toolbar items, context menu, etc...
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
 
var FCKPanel = function( parentWindow )
{
this.IsRTL = ( FCKLang.Dir == 'rtl' ) ;
this.IsContextMenu = false ;
this._LockCounter = 0 ;
this._Window = parentWindow || window ;
var oDocument ;
if ( FCKBrowserInfo.IsIE )
{
// Create the Popup that will hold the panel.
this._Popup = this._Window.createPopup() ;
oDocument = this.Document = this._Popup.document ;
}
else
{
var oIFrame = this._IFrame = this._Window.document.createElement('iframe') ;
oIFrame.src = 'javascript:void(0)' ;
oIFrame.allowTransparency = true ;
oIFrame.frameBorder = '0' ;
oIFrame.scrolling = 'no' ;
oIFrame.style.position = 'absolute';
oIFrame.style.zIndex = FCKConfig.FloatingPanelsZIndex ;
oIFrame.width = oIFrame.height = 0 ;
 
if ( this._Window == window.parent && window.frameElement )
window.frameElement.parentNode.insertBefore( oIFrame, window.frameElement ) ;
else
this._Window.document.body.appendChild( oIFrame ) ;
var oIFrameWindow = oIFrame.contentWindow ;
oDocument = this.Document = oIFrameWindow.document ;
 
// Initialize the IFRAME document body.
oDocument.open() ;
oDocument.write( '<html><head></head><body style="margin:0px;padding:0px;"><\/body><\/html>' ) ;
oDocument.close() ;
 
FCKTools.AddEventListenerEx( oIFrameWindow, 'focus', FCKPanel_Window_OnFocus, this ) ;
FCKTools.AddEventListenerEx( oIFrameWindow, 'blur', FCKPanel_Window_OnBlur, this ) ;
}
 
oDocument.dir = FCKLang.Dir ;
oDocument.oncontextmenu = FCKTools.CancelEvent ;
 
 
// Create the main DIV that is used as the panel base.
this.MainNode = oDocument.body.appendChild( oDocument.createElement('DIV') ) ;
 
// The "float" property must be set so Firefox calculates the size correcly.
this.MainNode.style.cssFloat = this.IsRTL ? 'right' : 'left' ;
 
if ( FCK.IECleanup )
FCK.IECleanup.AddItem( this, FCKPanel_Cleanup ) ;
}
 
 
FCKPanel.prototype.AppendStyleSheet = function( styleSheet )
{
FCKTools.AppendStyleSheet( this.Document, styleSheet ) ;
}
 
FCKPanel.prototype.Preload = function( x, y, relElement )
{
// The offsetWidth and offsetHeight properties are not available if the
// element is not visible. So we must "show" the popup with no size to
// be able to use that values in the second call (IE only).
if ( this._Popup )
this._Popup.show( x, y, 0, 0, relElement ) ;
}
 
FCKPanel.prototype.Show = function( x, y, relElement, width, height )
{
if ( this._Popup )
{
// The offsetWidth and offsetHeight properties are not available if the
// element is not visible. So we must "show" the popup with no size to
// be able to use that values in the second call.
this._Popup.show( x, y, 0, 0, relElement ) ;
 
// The following lines must be place after the above "show", otherwise it
// doesn't has the desired effect.
this.MainNode.style.width = width ? width + 'px' : '' ;
this.MainNode.style.height = height ? height + 'px' : '' ;
var iMainWidth = this.MainNode.offsetWidth ;
 
if ( this.IsRTL )
{
if ( this.IsContextMenu )
x = x - iMainWidth + 1 ;
else if ( relElement )
x = ( x * -1 ) + relElement.offsetWidth - iMainWidth ;
}
// Second call: Show the Popup at the specified location, with the correct size.
this._Popup.show( x, y, iMainWidth, this.MainNode.offsetHeight, relElement ) ;
if ( this.OnHide )
{
if ( this._Timer )
CheckPopupOnHide.call( this, true ) ;
 
this._Timer = FCKTools.SetInterval( CheckPopupOnHide, 100, this ) ;
}
}
else
{
// Do not fire OnBlur while the panel is opened.
if ( typeof( FCKFocusManager ) != 'undefined' )
FCKFocusManager.Lock() ;
 
if ( this.ParentPanel )
this.ParentPanel.Lock() ;
 
this.MainNode.style.width = width ? width + 'px' : '' ;
this.MainNode.style.height = height ? height + 'px' : '' ;
 
var iMainWidth = this.MainNode.offsetWidth ;
 
if ( !width ) this._IFrame.width = 1 ;
if ( !height ) this._IFrame.height = 1 ;
 
// This is weird... but with Firefox, we must get the offsetWidth before
// setting the _IFrame size (which returns "0"), and then after that,
// to return the correct width. Remove the first step and it will not
// work when the editor is in RTL.
iMainWidth = this.MainNode.offsetWidth ;
 
var oPos = FCKTools.GetElementPosition( ( relElement.nodeType == 9 ? relElement.body : relElement), this._Window ) ;
 
if ( this.IsRTL && !this.IsContextMenu )
x = ( x * -1 ) ;
 
x += oPos.X ;
y += oPos.Y ;
 
if ( this.IsRTL )
{
if ( this.IsContextMenu )
x = x - iMainWidth + 1 ;
else if ( relElement )
x = x + relElement.offsetWidth - iMainWidth ;
}
else
{
var oViewPaneSize = FCKTools.GetViewPaneSize( this._Window ) ;
var oScrollPosition = FCKTools.GetScrollPosition( this._Window ) ;
var iViewPaneHeight = oViewPaneSize.Height + oScrollPosition.Y ;
var iViewPaneWidth = oViewPaneSize.Width + oScrollPosition.X ;
 
if ( ( x + iMainWidth ) > iViewPaneWidth )
x -= x + iMainWidth - iViewPaneWidth ;
 
if ( ( y + this.MainNode.offsetHeight ) > iViewPaneHeight )
y -= y + this.MainNode.offsetHeight - iViewPaneHeight ;
}
if ( x < 0 )
x = 0 ;
 
// Set the context menu DIV in the specified location.
this._IFrame.style.left = x + 'px' ;
this._IFrame.style.top = y + 'px' ;
var iWidth = iMainWidth ;
var iHeight = this.MainNode.offsetHeight ;
this._IFrame.width = iWidth ;
this._IFrame.height = iHeight ;
 
// Move the focus to the IFRAME so we catch the "onblur".
this._IFrame.contentWindow.focus() ;
}
 
this._IsOpened = true ;
 
FCKTools.RunFunction( this.OnShow, this ) ;
}
 
FCKPanel.prototype.Hide = function( ignoreOnHide )
{
if ( this._Popup )
this._Popup.hide() ;
else
{
if ( !this._IsOpened )
return ;
// Enable the editor to fire the "OnBlur".
if ( typeof( FCKFocusManager ) != 'undefined' )
FCKFocusManager.Unlock() ;
 
// It is better to set the sizes to 0, otherwise Firefox would have
// rendering problems.
this._IFrame.width = this._IFrame.height = 0 ;
 
this._IsOpened = false ;
if ( this.ParentPanel )
this.ParentPanel.Unlock() ;
 
if ( !ignoreOnHide )
FCKTools.RunFunction( this.OnHide, this ) ;
}
}
 
FCKPanel.prototype.CheckIsOpened = function()
{
if ( this._Popup )
return this._Popup.isOpen ;
else
return this._IsOpened ;
}
 
FCKPanel.prototype.CreateChildPanel = function()
{
var oWindow = this._Popup ? FCKTools.GetParentWindow( this.Document ) : this._Window ;
 
var oChildPanel = new FCKPanel( oWindow, true ) ;
oChildPanel.ParentPanel = this ;
return oChildPanel ;
}
 
FCKPanel.prototype.Lock = function()
{
this._LockCounter++ ;
}
 
FCKPanel.prototype.Unlock = function()
{
if ( --this._LockCounter == 0 && !this.HasFocus )
this.Hide() ;
}
 
/* Events */
 
function FCKPanel_Window_OnFocus( e, panel )
{
panel.HasFocus = true ;
}
 
function FCKPanel_Window_OnBlur( e, panel )
{
panel.HasFocus = false ;
if ( panel._LockCounter == 0 )
FCKTools.RunFunction( panel.Hide, panel ) ;
}
 
function CheckPopupOnHide( forceHide )
{
if ( forceHide || !this._Popup.isOpen )
{
window.clearInterval( this._Timer ) ;
this._Timer = null ;
FCKTools.RunFunction( this.OnHide, this ) ;
}
}
 
function FCKPanel_Cleanup()
{
this._Popup = null ;
this._Window = null ;
this.Document = null ;
this.MainNode = null ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckmenublockpanel.js
New file
0,0 → 1,51
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckmenublockpanel.js
* This class is a menu block that behaves like a panel. It's a mix of the
* FCKMenuBlock and FCKPanel classes.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
 
var FCKMenuBlockPanel = function()
{
// Call the "base" constructor.
FCKMenuBlock.call( this ) ;
}
 
FCKMenuBlockPanel.prototype = new FCKMenuBlock() ;
 
 
// Override the create method.
FCKMenuBlockPanel.prototype.Create = function()
{
var oPanel = this.Panel = ( this.Parent && this.Parent.Panel ? this.Parent.Panel.CreateChildPanel() : new FCKPanel() ) ;
oPanel.AppendStyleSheet( FCKConfig.SkinPath + 'fck_editor.css' ) ;
 
// Call the "base" implementation.
FCKMenuBlock.prototype.Create.call( this, oPanel.MainNode ) ;
}
 
FCKMenuBlockPanel.prototype.Show = function( x, y, relElement )
{
if ( !this.Panel.CheckIsOpened() )
this.Panel.Show( x, y, relElement ) ;
}
 
FCKMenuBlockPanel.prototype.Hide = function()
{
if ( this.Panel.CheckIsOpened() )
this.Panel.Hide() ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckspecialcombo.js
New file
0,0 → 1,351
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckspecialcombo.js
* FCKSpecialCombo Class: represents a special combo.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKSpecialCombo = function( caption, fieldWidth, panelWidth, panelMaxHeight, parentWindow )
{
// Default properties values.
this.FieldWidth = fieldWidth || 100 ;
this.PanelWidth = panelWidth || 150 ;
this.PanelMaxHeight = panelMaxHeight || 150 ;
this.Label = '&nbsp;' ;
this.Caption = caption ;
this.Tooltip = caption ;
this.Style = FCK_TOOLBARITEM_ICONTEXT ;
 
this.Enabled = true ;
this.Items = new Object() ;
this._Panel = new FCKPanel( parentWindow || window, true ) ;
this._Panel.AppendStyleSheet( FCKConfig.SkinPath + 'fck_editor.css' ) ;
this._PanelBox = this._Panel.MainNode.appendChild( this._Panel.Document.createElement( 'DIV' ) ) ;
this._PanelBox.className = 'SC_Panel' ;
this._PanelBox.style.width = this.PanelWidth + 'px' ;
 
this._PanelBox.innerHTML = '<table cellpadding="0" cellspacing="0" width="100%" style="TABLE-LAYOUT: fixed"><tr><td nowrap></td></tr></table>' ;
this._ItemsHolderEl = this._PanelBox.getElementsByTagName('TD')[0] ;
 
if ( FCK.IECleanup )
FCK.IECleanup.AddItem( this, FCKSpecialCombo_Cleanup ) ;
 
// this._Panel.StyleSheet = FCKConfig.SkinPath + 'fck_contextmenu.css' ;
// this._Panel.Create() ;
// this._Panel.PanelDiv.className += ' SC_Panel' ;
// this._Panel.PanelDiv.innerHTML = '<table cellpadding="0" cellspacing="0" width="100%" style="TABLE-LAYOUT: fixed"><tr><td nowrap></td></tr></table>' ;
// this._ItemsHolderEl = this._Panel.PanelDiv.getElementsByTagName('TD')[0] ;
}
 
function FCKSpecialCombo_ItemOnMouseOver()
{
this.className += ' SC_ItemOver' ;
}
 
function FCKSpecialCombo_ItemOnMouseOut()
{
this.className = this.originalClass ;
}
 
function FCKSpecialCombo_ItemOnClick()
{
this.className = this.originalClass ;
 
this.FCKSpecialCombo._Panel.Hide() ;
 
this.FCKSpecialCombo.SetLabel( this.FCKItemLabel ) ;
 
if ( typeof( this.FCKSpecialCombo.OnSelect ) == 'function' )
this.FCKSpecialCombo.OnSelect( this.FCKItemID, this ) ;
}
 
FCKSpecialCombo.prototype.AddItem = function( id, html, label, bgColor )
{
// <div class="SC_Item" onmouseover="this.className='SC_Item SC_ItemOver';" onmouseout="this.className='SC_Item';"><b>Bold 1</b></div>
var oDiv = this._ItemsHolderEl.appendChild( this._Panel.Document.createElement( 'DIV' ) ) ;
oDiv.className = oDiv.originalClass = 'SC_Item' ;
oDiv.innerHTML = html ;
oDiv.FCKItemID = id ;
oDiv.FCKItemLabel = label || id ;
oDiv.FCKSpecialCombo = this ;
oDiv.Selected = false ;
 
// In IE, the width must be set so the borders are shown correctly when the content overflows.
if ( FCKBrowserInfo.IsIE )
oDiv.style.width = '100%' ;
if ( bgColor )
oDiv.style.backgroundColor = bgColor ;
 
oDiv.onmouseover = FCKSpecialCombo_ItemOnMouseOver ;
oDiv.onmouseout = FCKSpecialCombo_ItemOnMouseOut ;
oDiv.onclick = FCKSpecialCombo_ItemOnClick ;
this.Items[ id.toString().toLowerCase() ] = oDiv ;
return oDiv ;
}
 
FCKSpecialCombo.prototype.SelectItem = function( itemId )
{
itemId = itemId ? itemId.toString().toLowerCase() : '' ;
var oDiv = this.Items[ itemId ] ;
if ( oDiv )
{
oDiv.className = oDiv.originalClass = 'SC_ItemSelected' ;
oDiv.Selected = true ;
}
}
 
FCKSpecialCombo.prototype.SelectItemByLabel = function( itemLabel, setLabel )
{
for ( var id in this.Items )
{
var oDiv = this.Items[id] ;
 
if ( oDiv.FCKItemLabel == itemLabel )
{
oDiv.className = oDiv.originalClass = 'SC_ItemSelected' ;
oDiv.Selected = true ;
if ( setLabel )
this.SetLabel( itemLabel ) ;
}
}
}
 
FCKSpecialCombo.prototype.DeselectAll = function( clearLabel )
{
for ( var i in this.Items )
{
this.Items[i].className = this.Items[i].originalClass = 'SC_Item' ;
this.Items[i].Selected = false ;
}
if ( clearLabel )
this.SetLabel( '' ) ;
}
 
FCKSpecialCombo.prototype.SetLabelById = function( id )
{
id = id ? id.toString().toLowerCase() : '' ;
var oDiv = this.Items[ id ] ;
this.SetLabel( oDiv ? oDiv.FCKItemLabel : '' ) ;
}
 
FCKSpecialCombo.prototype.SetLabel = function( text )
{
this.Label = text.length == 0 ? '&nbsp;' : text ;
 
if ( this._LabelEl )
this._LabelEl.innerHTML = this.Label ;
}
 
FCKSpecialCombo.prototype.SetEnabled = function( isEnabled )
{
this.Enabled = isEnabled ;
this._OuterTable.className = isEnabled ? '' : 'SC_FieldDisabled' ;
}
 
FCKSpecialCombo.prototype.Create = function( targetElement )
{
var oDoc = FCKTools.GetElementDocument( targetElement ) ;
var eOuterTable = this._OuterTable = targetElement.appendChild( oDoc.createElement( 'TABLE' ) ) ;
eOuterTable.cellPadding = 0 ;
eOuterTable.cellSpacing = 0 ;
eOuterTable.insertRow(-1) ;
var sClass ;
var bShowLabel ;
switch ( this.Style )
{
case FCK_TOOLBARITEM_ONLYICON :
sClass = 'TB_ButtonType_Icon' ;
bShowLabel = false;
break ;
case FCK_TOOLBARITEM_ONLYTEXT :
sClass = 'TB_ButtonType_Text' ;
bShowLabel = false;
break ;
case FCK_TOOLBARITEM_ICONTEXT :
bShowLabel = true;
break ;
}
 
if ( this.Caption && this.Caption.length > 0 && bShowLabel )
{
var oCaptionCell = eOuterTable.rows[0].insertCell(-1) ;
oCaptionCell.innerHTML = this.Caption ;
oCaptionCell.className = 'SC_FieldCaption' ;
}
// Create the main DIV element.
var oField = FCKTools.AppendElement( eOuterTable.rows[0].insertCell(-1), 'div' ) ;
if ( bShowLabel )
{
oField.className = 'SC_Field' ;
oField.style.width = this.FieldWidth + 'px' ;
oField.innerHTML = '<table width="100%" cellpadding="0" cellspacing="0" style="TABLE-LAYOUT: fixed;"><tbody><tr><td class="SC_FieldLabel"><label>&nbsp;</label></td><td class="SC_FieldButton">&nbsp;</td></tr></tbody></table>' ;
 
this._LabelEl = oField.getElementsByTagName('label')[0] ; // Memory Leak
this._LabelEl.innerHTML = this.Label ;
}
else
{
oField.className = 'TB_Button_Off' ;
//oField.innerHTML = '<span className="SC_FieldCaption">' + this.Caption + '<table cellpadding="0" cellspacing="0" style="TABLE-LAYOUT: fixed;"><tbody><tr><td class="SC_FieldButton" style="border-left: none;">&nbsp;</td></tr></tbody></table>' ;
//oField.innerHTML = '<table cellpadding="0" cellspacing="0" style="TABLE-LAYOUT: fixed;"><tbody><tr><td class="SC_FieldButton" style="border-left: none;">&nbsp;</td></tr></tbody></table>' ;
// Gets the correct CSS class to use for the specified style (param).
oField.innerHTML = '<table title="' + this.Tooltip + '" class="' + sClass + '" cellspacing="0" cellpadding="0" border="0">' +
'<tr>' +
//'<td class="TB_Icon"><img src="' + FCKConfig.SkinPath + 'toolbar/' + this.Command.Name.toLowerCase() + '.gif" width="21" height="21"></td>' +
'<td><img class="TB_Button_Padding" src="' + FCK_SPACER_PATH + '" /></td>' +
'<td class="TB_Text">' + this.Caption + '</td>' +
'<td><img class="TB_Button_Padding" src="' + FCK_SPACER_PATH + '" /></td>' +
'<td class="TB_ButtonArrow"><img src="' + FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif" width="5" height="3"></td>' +
'<td><img class="TB_Button_Padding" src="' + FCK_SPACER_PATH + '" /></td>' +
'</tr>' +
'</table>' ;
}
 
 
// Events Handlers
 
oField.SpecialCombo = this ;
oField.onmouseover = FCKSpecialCombo_OnMouseOver ;
oField.onmouseout = FCKSpecialCombo_OnMouseOut ;
oField.onclick = FCKSpecialCombo_OnClick ;
FCKTools.DisableSelection( this._Panel.Document.body ) ;
}
 
function FCKSpecialCombo_Cleanup()
{
this._LabelEl = null ;
this._OuterTable = null ;
this._ItemsHolderEl = null ;
this._PanelBox = null ;
if ( this.Items )
{
for ( var key in this.Items )
this.Items[key] = null ;
}
}
 
function FCKSpecialCombo_OnMouseOver()
{
if ( this.SpecialCombo.Enabled )
{
switch ( this.SpecialCombo.Style )
{
case FCK_TOOLBARITEM_ONLYICON :
this.className = 'TB_Button_On_Over';
break ;
case FCK_TOOLBARITEM_ONLYTEXT :
this.className = 'TB_Button_On_Over';
break ;
case FCK_TOOLBARITEM_ICONTEXT :
this.className = 'SC_Field SC_FieldOver' ;
break ;
}
}
}
function FCKSpecialCombo_OnMouseOut()
{
switch ( this.SpecialCombo.Style )
{
case FCK_TOOLBARITEM_ONLYICON :
this.className = 'TB_Button_Off';
break ;
case FCK_TOOLBARITEM_ONLYTEXT :
this.className = 'TB_Button_Off';
break ;
case FCK_TOOLBARITEM_ICONTEXT :
this.className='SC_Field' ;
break ;
}
}
function FCKSpecialCombo_OnClick( e )
{
// For Mozilla we must stop the event propagation to avoid it hiding
// the panel because of a click outside of it.
// if ( e )
// {
// e.stopPropagation() ;
// FCKPanelEventHandlers.OnDocumentClick( e ) ;
// }
var oSpecialCombo = this.SpecialCombo ;
 
if ( oSpecialCombo.Enabled )
{
var oPanel = oSpecialCombo._Panel ;
var oPanelBox = oSpecialCombo._PanelBox ;
var oItemsHolder = oSpecialCombo._ItemsHolderEl ;
var iMaxHeight = oSpecialCombo.PanelMaxHeight ;
if ( oSpecialCombo.OnBeforeClick )
oSpecialCombo.OnBeforeClick( oSpecialCombo ) ;
 
// This is a tricky thing. We must call the "Load" function, otherwise
// it will not be possible to retrieve "oItemsHolder.offsetHeight" (IE only).
if ( FCKBrowserInfo.IsIE )
oPanel.Preload( 0, this.offsetHeight, this ) ;
 
if ( oItemsHolder.offsetHeight > iMaxHeight )
// {
oPanelBox.style.height = iMaxHeight + 'px' ;
 
// if ( FCKBrowserInfo.IsGecko )
// oPanelBox.style.overflow = '-moz-scrollbars-vertical' ;
// }
else
oPanelBox.style.height = '' ;
// oPanel.PanelDiv.style.width = oSpecialCombo.PanelWidth + 'px' ;
 
oPanel.Show( 0, this.offsetHeight, this ) ;
}
 
// return false ;
}
 
/*
Sample Combo Field HTML output:
 
<div class="SC_Field" style="width: 80px;">
<table width="100%" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
<tbody>
<tr>
<td class="SC_FieldLabel"><label>&nbsp;</label></td>
<td class="SC_FieldButton">&nbsp;</td>
</tr>
</tbody>
</table>
</div>
*/
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbar.js
New file
0,0 → 1,116
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbar.js
* FCKToolbar Class: represents a toolbar in the toolbarset. It is a group of
* toolbar items.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbar = function()
{
this.Items = new Array() ;
 
if ( FCK.IECleanup )
FCK.IECleanup.AddItem( this, FCKToolbar_Cleanup ) ;
}
 
FCKToolbar.prototype.AddItem = function( item )
{
return this.Items[ this.Items.length ] = item ;
}
 
FCKToolbar.prototype.AddButton = function( name, label, tooltip, iconPathOrStripInfoArrayOrIndex, style, state )
{
if ( typeof( iconPathOrStripInfoArrayOrIndex ) == 'number' )
iconPathOrStripInfoArrayOrIndex = [ this.DefaultIconsStrip, this.DefaultIconSize, iconPathOrStripInfoArrayOrIndex ] ;
 
var oButton = new FCKToolbarButtonUI( name, label, tooltip, iconPathOrStripInfoArrayOrIndex, style, state ) ;
oButton._FCKToolbar = this ;
oButton.OnClick = FCKToolbar_OnItemClick ;
return this.AddItem( oButton ) ;
}
 
function FCKToolbar_OnItemClick( item )
{
var oToolbar = item._FCKToolbar ;
if ( oToolbar.OnItemClick )
oToolbar.OnItemClick( oToolbar, item ) ;
}
 
FCKToolbar.prototype.AddSeparator = function()
{
this.AddItem( new FCKToolbarSeparator() ) ;
}
 
FCKToolbar.prototype.Create = function( parentElement )
{
if ( this.MainElement )
{
// this._Cleanup() ;
if ( this.MainElement.parentNode )
this.MainElement.parentNode.removeChild( this.MainElement ) ;
this.MainElement = null ;
}
 
var oDoc = FCKTools.GetElementDocument( parentElement ) ;
 
var e = this.MainElement = oDoc.createElement( 'table' ) ;
e.className = 'TB_Toolbar' ;
e.style.styleFloat = e.style.cssFloat = ( FCKLang.Dir == 'ltr' ? 'left' : 'right' ) ;
e.dir = FCKLang.Dir ;
e.cellPadding = 0 ;
e.cellSpacing = 0 ;
this.RowElement = e.insertRow(-1) ;
// Insert the start cell.
var eCell ;
if ( !this.HideStart )
{
eCell = this.RowElement.insertCell(-1) ;
eCell.appendChild( oDoc.createElement( 'div' ) ).className = 'TB_Start' ;
}
for ( var i = 0 ; i < this.Items.length ; i++ )
{
this.Items[i].Create( this.RowElement.insertCell(-1) ) ;
}
// Insert the ending cell.
if ( !this.HideEnd )
{
eCell = this.RowElement.insertCell(-1) ;
eCell.appendChild( oDoc.createElement( 'div' ) ).className = 'TB_End' ;
}
 
parentElement.appendChild( e ) ;
}
 
function FCKToolbar_Cleanup()
{
this.MainElement = null ;
this.RowElement = null ;
}
 
var FCKToolbarSeparator = function()
{}
 
FCKToolbarSeparator.prototype.Create = function( parentElement )
{
FCKTools.AppendElement( parentElement, 'div' ).className = 'TB_Separator' ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarstylecombo.js
New file
0,0 → 1,99
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarstylecombo.js
* FCKToolbarPanelButton Class: Handles the Fonts combo selector.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarStyleCombo = function( tooltip, style )
{
this.CommandName = 'Style' ;
this.Label = this.GetLabel() ;
this.Tooltip = tooltip ? tooltip : this.Label ;
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
}
 
// Inherit from FCKToolbarSpecialCombo.
FCKToolbarStyleCombo.prototype = new FCKToolbarSpecialCombo ;
 
 
FCKToolbarStyleCombo.prototype.GetLabel = function()
{
return FCKLang.Style ;
}
 
FCKToolbarStyleCombo.prototype.CreateItems = function( targetSpecialCombo )
{
var oTargetDoc = targetSpecialCombo._Panel.Document ;
// Add the Editor Area CSS to the panel so the style classes are previewed correctly.
FCKTools.AppendStyleSheet( oTargetDoc, FCKConfig.ToolbarComboPreviewCSS ) ;
oTargetDoc.body.className += ' ForceBaseFont' ;
 
// For some reason Gecko is blocking inside the "RefreshVisibleItems" function.
if ( ! FCKBrowserInfo.IsGecko )
targetSpecialCombo.OnBeforeClick = this.RefreshVisibleItems ;
 
// Add the styles to the special combo.
var aCommandStyles = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).Styles ;
for ( var s in aCommandStyles )
{
var oStyle = aCommandStyles[s] ;
var oItem ;
if ( oStyle.IsObjectElement )
oItem = targetSpecialCombo.AddItem( s, s ) ;
else
oItem = targetSpecialCombo.AddItem( s, oStyle.GetOpenerTag() + s + oStyle.GetCloserTag() ) ;
oItem.Style = oStyle ;
}
}
 
FCKToolbarStyleCombo.prototype.RefreshActiveItems = function( targetSpecialCombo )
{
// Clear the actual selection.
targetSpecialCombo.DeselectAll() ;
// Get the active styles.
var aStyles = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetActiveStyles() ;
if ( aStyles.length > 0 )
{
// Select the active styles in the combo.
for ( var i = 0 ; i < aStyles.length ; i++ )
targetSpecialCombo.SelectItem( aStyles[i].Name ) ;
 
// Set the combo label to the first style in the collection.
targetSpecialCombo.SetLabelById( aStyles[0].Name ) ;
}
else
targetSpecialCombo.SetLabel('') ;
}
 
FCKToolbarStyleCombo.prototype.RefreshVisibleItems = function( targetSpecialCombo )
{
if ( FCKSelection.GetType() == 'Control' )
var sTagName = FCKSelection.GetSelectedElement().tagName ;
 
for ( var i in targetSpecialCombo.Items )
{
var oItem = targetSpecialCombo.Items[i] ;
if ( ( sTagName && oItem.Style.Element == sTagName ) || ( ! sTagName && ! oItem.Style.IsObjectElement ) )
oItem.style.display = '' ;
else
oItem.style.display = 'none' ; // For some reason Gecko is blocking here.
}
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckevents.js
New file
0,0 → 1,51
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckevents.js
* FCKEvents Class: used to handle events is a advanced way.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKEvents ;
 
FCKEvents = function( eventsOwner )
{
this.Owner = eventsOwner ;
this.RegisteredEvents = new Object() ;
}
 
FCKEvents.prototype.AttachEvent = function( eventName, functionPointer )
{
var aTargets ;
 
if ( !( aTargets = this.RegisteredEvents[ eventName ] ) )
this.RegisteredEvents[ eventName ] = [ functionPointer ] ;
else
aTargets.push( functionPointer ) ;
}
 
FCKEvents.prototype.FireEvent = function( eventName, params )
{
var bReturnValue = true ;
 
var oCalls = this.RegisteredEvents[ eventName ] ;
 
if ( oCalls )
{
for ( var i = 0 ; i < oCalls.length ; i++ )
bReturnValue = ( oCalls[ i ]( this.Owner, params ) && bReturnValue ) ;
}
 
return bReturnValue ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fcktoolbarfontsizecombo.js
New file
0,0 → 1,48
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fcktoolbarfontsizecombo.js
* FCKToolbarPanelButton Class: Handles the Fonts combo selector.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKToolbarFontSizeCombo = function( tooltip, style )
{
this.CommandName = 'FontSize' ;
this.Label = this.GetLabel() ;
this.Tooltip = tooltip ? tooltip : this.Label ;
this.Style = style ? style : FCK_TOOLBARITEM_ICONTEXT ;
}
 
// Inherit from FCKToolbarSpecialCombo.
FCKToolbarFontSizeCombo.prototype = new FCKToolbarSpecialCombo ;
 
 
FCKToolbarFontSizeCombo.prototype.GetLabel = function()
{
return FCKLang.FontSize ;
}
 
FCKToolbarFontSizeCombo.prototype.CreateItems = function( targetSpecialCombo )
{
targetSpecialCombo.FieldWidth = 70 ;
var aSizes = FCKConfig.FontSizes.split(';') ;
for ( var i = 0 ; i < aSizes.length ; i++ )
{
var aSizeParts = aSizes[i].split('/') ;
this._Combo.AddItem( aSizeParts[0], '<font size="' + aSizeParts[0] + '">' + aSizeParts[1] + '</font>', aSizeParts[1] ) ;
}
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckiecleanup.js
New file
0,0 → 1,51
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckiecleanup.js
* FCKIECleanup Class: a generic class used as a tool to remove IE leaks.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
 
var FCKIECleanup = function( attachWindow )
{
 
this.Items = new Array() ;
 
attachWindow._FCKCleanupObj = this ;
attachWindow.attachEvent( 'onunload', FCKIECleanup_Cleanup ) ;
}
FCKIECleanup.prototype.AddItem = function( dirtyItem, cleanupFunction )
{
this.Items.push( [ dirtyItem, cleanupFunction ] ) ;
}
function FCKIECleanup_Cleanup()
{
var aItems = this._FCKCleanupObj.Items ;
var iLenght = aItems.length ;
 
for ( var i = 0 ; i < iLenght ; i++ )
{
var oItem = aItems[i] ;
oItem[1].call( oItem[0] ) ;
aItems[i] = null ;
}
this._FCKCleanupObj = null ;
if ( CollectGarbage )
CollectGarbage() ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckxml_gecko.js
New file
0,0 → 1,66
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckxml_gecko.js
* FCKXml Class: class to load and manipulate XML files.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKXml = function()
{}
 
FCKXml.prototype.LoadUrl = function( urlToCall )
{
var oFCKXml = this ;
 
var oXmlHttp = FCKTools.CreateXmlObject( 'XmlHttp' ) ;
oXmlHttp.open( "GET", urlToCall, false ) ;
oXmlHttp.send( null ) ;
if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 )
this.DOMDocument = oXmlHttp.responseXML ;
else if ( oXmlHttp.status == 0 && oXmlHttp.readyState == 4 )
this.DOMDocument = oXmlHttp.responseXML ;
else
alert( 'Error loading "' + urlToCall + '"' ) ;
}
 
FCKXml.prototype.SelectNodes = function( xpath, contextNode )
{
var aNodeArray = new Array();
 
var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ;
if ( xPathResult )
{
var oNode = xPathResult.iterateNext() ;
while( oNode )
{
aNodeArray[aNodeArray.length] = oNode ;
oNode = xPathResult.iterateNext();
}
}
return aNodeArray ;
}
 
FCKXml.prototype.SelectSingleNode = function( xpath, contextNode )
{
var xPathResult = this.DOMDocument.evaluate( xpath, contextNode ? contextNode : this.DOMDocument,
this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);
 
if ( xPathResult && xPathResult.singleNodeValue )
return xPathResult.singleNodeValue ;
else
return null ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckcontextmenu.js
New file
0,0 → 1,123
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckcontextmenu.js
* FCKContextMenu Class: renders an control a context menu.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKContextMenu = function( parentWindow, mouseClickWindow, langDir )
{
var oPanel = this._Panel = new FCKPanel( parentWindow, true ) ;
oPanel.AppendStyleSheet( FCKConfig.SkinPath + 'fck_editor.css' ) ;
oPanel.IsContextMenu = true ;
var oMenuBlock = this._MenuBlock = new FCKMenuBlock() ;
oMenuBlock.Panel = oPanel ;
oMenuBlock.OnClick = FCKTools.CreateEventListener( FCKContextMenu_MenuBlock_OnClick, this ) ;
this._Redraw = true ;
this.SetMouseClickWindow( mouseClickWindow || parentWindow ) ;
}
 
 
FCKContextMenu.prototype.SetMouseClickWindow = function( mouseClickWindow )
{
if ( !FCKBrowserInfo.IsIE )
{
this._Document = mouseClickWindow.document ;
this._Document.addEventListener( 'contextmenu', FCKContextMenu_Document_OnContextMenu, false ) ;
}
}
 
FCKContextMenu.prototype.AddItem = function( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled )
{
var oItem = this._MenuBlock.AddItem( name, label, iconPathOrStripInfoArrayOrIndex, isDisabled) ;
this._Redraw = true ;
return oItem ;
}
 
FCKContextMenu.prototype.AddSeparator = function()
{
this._MenuBlock.AddSeparator() ;
this._Redraw = true ;
}
 
FCKContextMenu.prototype.RemoveAllItems = function()
{
this._MenuBlock.RemoveAllItems() ;
this._Redraw = true ;
}
 
FCKContextMenu.prototype.AttachToElement = function( element )
{
if ( FCKBrowserInfo.IsIE )
FCKTools.AddEventListenerEx( element, 'contextmenu', FCKContextMenu_AttachedElement_OnContextMenu, this ) ;
else
element._FCKContextMenu = this ;
 
// element.onmouseup = FCKContextMenu_AttachedElement_OnMouseUp ;
}
 
function FCKContextMenu_Document_OnContextMenu( e )
{
var el = e.target ;
while ( el )
{
if ( el._FCKContextMenu )
{
FCKTools.CancelEvent( e ) ;
FCKContextMenu_AttachedElement_OnContextMenu( e, el._FCKContextMenu, el ) ;
}
el = el.parentNode ;
}
}
 
function FCKContextMenu_AttachedElement_OnContextMenu( ev, fckContextMenu, el )
{
// var iButton = e ? e.which - 1 : event.button ;
 
// if ( iButton != 2 )
// return ;
 
var eTarget = el || this ;
 
if ( fckContextMenu.OnBeforeOpen )
fckContextMenu.OnBeforeOpen.call( fckContextMenu, eTarget ) ;
 
if ( fckContextMenu._MenuBlock.Count() == 0 )
return false ;
if ( fckContextMenu._Redraw )
{
fckContextMenu._MenuBlock.Create( fckContextMenu._Panel.MainNode ) ;
fckContextMenu._Redraw = false ;
}
 
fckContextMenu._Panel.Show(
ev.pageX || ev.screenX,
ev.pageY || ev.screenY,
ev.currentTarget || null
) ;
return false ;
}
 
function FCKContextMenu_MenuBlock_OnClick( menuItem, contextMenu )
{
contextMenu._Panel.Hide() ;
FCKTools.RunFunction( contextMenu.OnItemClick, contextMenu, menuItem ) ;
}
/branches/livraison_aha/api/fckeditor/editor/_source/classes/fckstylesloader.js
New file
0,0 → 1,84
/*
* FCKeditor - The text editor for internet
* Copyright (C) 2003-2006 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/
*
* "Support Open Source software. What about a donation today?"
*
* File Name: fckstylesloader.js
* FCKStylesLoader Class: this class define objects that are responsible
* for loading the styles defined in the XML file.
*
* File Authors:
* Frederico Caldeira Knabben (fredck@fckeditor.net)
*/
 
var FCKStylesLoader = function()
{
this.Styles = new Object() ;
this.StyleGroups = new Object() ;
this.Loaded = false ;
this.HasObjectElements = false ;
}
 
FCKStylesLoader.prototype.Load = function( stylesXmlUrl )
{
// Load the XML file into a FCKXml object.
var oXml = new FCKXml() ;
oXml.LoadUrl( stylesXmlUrl ) ;
// Get the "Style" nodes defined in the XML file.
var aStyleNodes = oXml.SelectNodes( 'Styles/Style' ) ;
// Add each style to our "Styles" collection.
for ( var i = 0 ; i < aStyleNodes.length ; i++ )
{
var sElement = aStyleNodes[i].attributes.getNamedItem('element').value.toUpperCase() ;
// Create the style definition object.
var oStyleDef = new FCKStyleDef( aStyleNodes[i].attributes.getNamedItem('name').value, sElement ) ;
if ( oStyleDef.IsObjectElement )
this.HasObjectElements = true ;
// Get the attributes defined for the style (if any).
var aAttNodes = oXml.SelectNodes( 'Attribute', aStyleNodes[i] ) ;
// Add the attributes to the style definition object.
for ( var j = 0 ; j < aAttNodes.length ; j++ )
{
var sAttName = aAttNodes[j].attributes.getNamedItem('name').value ;
var sAttValue = aAttNodes[j].attributes.getNamedItem('value').value ;
 
// IE changes the "style" attribute value when applied to an element
// so we must get the final resulting value (for comparision issues).
if ( sAttName.toLowerCase() == 'style' )
{
var oTempE = document.createElement( 'SPAN' ) ;
oTempE.style.cssText = sAttValue ;
sAttValue = oTempE.style.cssText ;
}
oStyleDef.AddAttribute( sAttName, sAttValue ) ;
}
 
// Add the style to the "Styles" collection using it's name as the key.
this.Styles[ oStyleDef.Name ] = oStyleDef ;
// Add the style to the "StyleGroups" collection.
var aGroup = this.StyleGroups[sElement] ;
if ( aGroup == null )
{
this.StyleGroups[sElement] = new Array() ;
aGroup = this.StyleGroups[sElement] ;
}
aGroup[aGroup.length] = oStyleDef ;
}
this.Loaded = true ;
}