diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index b86884bc3d..afe24d1dc4 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -571,6 +571,38 @@ class html .''; } + /** + * this function is a wrapper for tinymce to create some reuseable layouts + * + * Please note: if you did not run init_tinymce already you this function need to be called before the call to phpgw_header() !!! + * + * @param string $_name name and id of the input-field + * @param string $_mode display mode of the tinymce editor can be: simple, extended or advanced + * @param string $_content='' of the tinymce (will be run through htmlspecialchars !!!), default '' + * @param string $style='' initial css for the style attribute + * @param string $base_href='' + * @return string the necessary html for the textarea + */ + function fckEditorQuick($_name, $_mode, $_content='', $_style='', $base_href='') { + include_once(EGW_INCLUDE_ROOT."/phpgwapi/js/fckeditor/fckeditor.php"); + + $oFCKeditor = new FCKeditor($_name) ; + $oFCKeditor->BasePath = $GLOBALS['egw_info']['server']['webserver_url'].'/phpgwapi/js/fckeditor/' ; + $oFCKeditor->Value = $_content; + $oFCKeditor->Width = '100%' ; + $oFCKeditor->Height = '400px' ; + switch($_mode) { + case 'ascii': + return ""; + break; + case 'simple': + $oFCKeditor->ToolbarSet = 'egw_simple'; + return $oFCKeditor->CreateHTML() ; + break; + } + + } + /** * this function is a wrapper for tinymce to create some reuseable layouts * diff --git a/phpgwapi/js/fckeditor/_documentation.html b/phpgwapi/js/fckeditor/_documentation.html new file mode 100644 index 0000000000..3eb8398dc7 --- /dev/null +++ b/phpgwapi/js/fckeditor/_documentation.html @@ -0,0 +1,30 @@ + + + +
++ You can find the official documentation for FCKeditor online, at + http://wiki.fckeditor.net/.
+ + diff --git a/phpgwapi/js/fckeditor/_samples/_plugins/findreplace/fckplugin.js b/phpgwapi/js/fckeditor/_samples/_plugins/findreplace/fckplugin.js new file mode 100644 index 0000000000..15b782d2a2 --- /dev/null +++ b/phpgwapi/js/fckeditor/_samples/_plugins/findreplace/fckplugin.js @@ -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: fckplugin.js + * This is the sample plugin definition file. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +// Register the related commands. +FCKCommands.RegisterCommand( 'My_Find' , new FCKDialogCommand( FCKLang['DlgMyFindTitle'] , FCKLang['DlgMyFindTitle'] , FCKConfig.PluginsPath + 'findreplace/find.html' , 340, 170 ) ) ; +FCKCommands.RegisterCommand( 'My_Replace' , new FCKDialogCommand( FCKLang['DlgMyReplaceTitle'], FCKLang['DlgMyReplaceTitle'] , FCKConfig.PluginsPath + 'findreplace/replace.html', 340, 200 ) ) ; + +// Create the "Find" toolbar button. +var oFindItem = new FCKToolbarButton( 'My_Find', FCKLang['DlgMyFindTitle'] ) ; +oFindItem.IconPath = FCKConfig.PluginsPath + 'findreplace/find.gif' ; + +FCKToolbarItems.RegisterItem( 'My_Find', oFindItem ) ; // 'My_Find' is the name used in the Toolbar config. + +// Create the "Replace" toolbar button. +var oReplaceItem = new FCKToolbarButton( 'My_Replace', FCKLang['DlgMyReplaceTitle'] ) ; +oReplaceItem.IconPath = FCKConfig.PluginsPath + 'findreplace/replace.gif' ; + +FCKToolbarItems.RegisterItem( 'My_Replace', oReplaceItem ) ; // 'My_Replace' is the name used in the Toolbar config. \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/_samples/_plugins/findreplace/find.gif b/phpgwapi/js/fckeditor/_samples/_plugins/findreplace/find.gif new file mode 100644 index 0000000000..81915f4f63 Binary files /dev/null and b/phpgwapi/js/fckeditor/_samples/_plugins/findreplace/find.gif differ diff --git a/phpgwapi/js/fckeditor/_samples/_plugins/findreplace/find.html b/phpgwapi/js/fckeditor/_samples/_plugins/findreplace/find.html new file mode 100644 index 0000000000..4df5ac92d8 --- /dev/null +++ b/phpgwapi/js/fckeditor/_samples/_plugins/findreplace/find.html @@ -0,0 +1,168 @@ + + + + + + + + + ++ + | ++ + | ++ + | +
+
+ +
+
+
+ |
+
+ | ++ | ++ | +
+ | ++ | ++ | +
+ + + |
+
Field Name | +Value | +
]+lcVariable+[ = | ]+lcWert+[ |
+ Select a language: + | ++ + | +
+ Select the toolbar to load: + | ++ + | +
+ Select the skin to load: + | ++ + | +
Field Name | +Value | +
<%=sForm%> | +<%=Server.HTMLEncode( Request.Form(sForm) )%> | +
Dump of FORM Variables | +|
---|---|
FieldNames | +#FORM.fieldNames# | +
#key# | +#HTMLEditFormat(evaluate("FORM.#key#"))# | +
+ Select a language: + | ++ + | ++ + | +
+ Select the toolbar to load: + | ++ + | +
+ Select the skin to load: + | ++ + | +
+ Field Name | ++ Value | +
+ + <%=sForm%> + + | +
+ <%=ModifyForOutput( Request.Form(sForm) )%>+ |
+
+ Field | ++ Value | +
+ Select a language: + | ++ + | +
+ Select the toolbar to load: + | ++ + | +
+ Select the skin to load: + | ++ + | +
Field Name | +Value | +
[#this->first] | +[#this->second] | +
+ Select a language: + | ++ + | +
+ Select the toolbar to load: + | ++ + | +
+ Select the skin to load: + | ++ + | +
Field Name | +Value | +
$key | +$postedValue | +
+ Select a language: + | ++ + | +
+ Select the toolbar to load: + | ++ + | +
+ Select the skin to load: + | ++ + | +
Field Name | +Value | +
=$sForm?> | +=$postedValue?> | +
Field Name | +Value | +
%s | +%s | +
+ Please select the sample you want to view:
+ + + |
+
+ Expected results: The editor content must be loaded and the submit
+ button must post the editors html.
+ Configurations: Default
+ Steps to Reproduce:
+
+
Expected results: The editor must work correctly when not value
+ has been set
+ Configurations: Default
+ Steps to Reproduce:
+
+
Expected results: The user must be able to edit the complete
+ page html.
+ Configurations: FullPage = true ;
+ Steps to Reproduce:
+
+
+ Expected results : The editor must still work when hidding it
+ programmatically (through javascript).
+ Configurations: Default
+ Steps to Reproduce:
+
+
+ Expected results: The editor content must be loaded and the
+ submit button must post the editors html. No javascript errors should be thrown
+ (security errors).
+ Configurations: BaseHref = http://www.fckeditor.net
+
+ Steps to Reproduce:
+
+
+ Expected results: The editor content must be loaded and the
+ submit button must post the editors html. No javascript errors should be thorwn
+ (security errors).
+ Configurations: BaseHref = http://www.fckeditor.net / FullPage
+ = true
+
+ Steps to Reproduce:
+
+
+ Expected results: The editor content must be loaded and the
+ submit button must post the editor's html.
+ Configurations: Default
+ Steps to Reproduce:
+
+
+ Expected results: The editor content must be loaded and the submit
+ button must post the editors html.
+ Configurations: Default
+ Steps to Reproduce:
+
+
+
+ + + diff --git a/phpgwapi/js/fckeditor/_testcases/009.html b/phpgwapi/js/fckeditor/_testcases/009.html new file mode 100644 index 0000000000..60dd623b4f --- /dev/null +++ b/phpgwapi/js/fckeditor/_testcases/009.html @@ -0,0 +1,109 @@ + + + + +
+ Expected results : The user should be able to background color
+ of the editor by code.
+ Configurations: Default
+ Steps to Reproduce:
+
+
+ Select a color for the background:
+
+
+ Expected results: The editor content must be loaded and the the
+ user must be able to change the toolbar dinamically (without reloading the page).
+ Configurations: Default
+ Steps to Reproduce:
+
+ Select the toolbar you want to load:
+
+
+ Field Name | ++ Value | +
+ + <%=sForm%> + + | +
+ <%=ModifyForOutput( Request.Form(sForm) )%>+ |
+
+ New Features and Improvements:
++ Fixed Bugs:
++ Fixed Bugs:
++ New Features and Improvements:
++ Fixed Bugs:
++ * This version has been partially sponsored by Footsteps + and Kentico.
++ New Features and Improvements:
++ Fixed Bugs:
+
+ * This version has been partially sponsored by Footsteps
+ and Kentico.
+
+ ** This version has been partially sponsored by Nextide.
+ New Features and Improvements:
++ Fixed Bugs:
++ Special thanks to + Alfonso Martinez, who have provided many patches and suggestions for the + following features / fixes present in this version. I encourage all you to + donate to Alfonso, as a way to say thanks for his nice open source approach. + Thanks Alfonso!. Check out his contributions:
++ * This version has been partially sponsored by + Alkacon Software.
++ New Features and Improvements:
++ Fixed Bugs:
++ * This version has been partially sponsored by + Acctive Software S.A..
++ New Features and Improvements:
++ Fixed Bugs:
++ New Features and Improvements:
++ Fixed Bugs:
+
+ * This version has been partially sponsored by
+ Infineon Technologies AG.
+ ** This version has been partially sponsored by
+ Visualsoft Web Solutions.
+ *** This version has been partially sponsored by
+ Web Crossing, Inc.
+ New Features and Improvements:
++ Fixed Bugs:
+
+ * This version has been partially sponsored by the
+ Hamilton College.
+ ** This version has been partially sponsored by
+ Infineon Technologies AG.
+ New Features and Improvements:
++ Fixed Bugs:
+
+ This is the first beta of the 2.x series. It brings a lot of new and important things.
+ Beta versions will be released until all features available on version 1.x will
+ be introduced in the 2.0.
+
+ Note: As it is a beta, it is not yet completely developed. Future
+ versions can bring new features that can break backward compatibility with this
+ version.
+
+ * This version has been partially sponsored by Genuitec, + LLC.
++ * This version has been partially sponsored by Genuitec, + LLC.
+' + + ' | ' + + ' | ' + this.Caption + ' | ' + + '' + + ' | ' + + ' | ' + + ' |
+ | + |
{Image} | Toolbar Button |
Toolbar Button |
{Image} | Toolbar Button |
Toolbar Button |
' ) ; + else if ( formatName == 'div' && FCKBrowserInfo.IsGecko ) + FCK.ExecuteNamedCommand( 'FormatBlock', 'div' ) ; + 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 ; + + if ( typeof( oForm.onsubmit ) == 'function' ) + { + var bRet = oForm.onsubmit() ; + if ( bRet != null && bRet === false ) + return ; + } + + // Submit the form. + oForm.submit() ; +} + +FCKSaveCommand.prototype.GetState = function() +{ + return FCK_TRISTATE_OFF ; +} + +// ### NewPage +var FCKNewPageCommand = function() +{ + this.Name = 'NewPage' ; +} + +FCKNewPageCommand.prototype.Execute = function() +{ + FCKUndo.SaveUndoStep() ; + FCK.SetHTML( '' ) ; + FCKUndo.Typing = true ; +// FCK.SetHTML( FCKBrowserInfo.IsGecko ? ' ' : '' ) ; +// FCK.SetHTML( FCKBrowserInfo.IsGecko ? GECKO_BOGUS : '' ) ; +} + +FCKNewPageCommand.prototype.GetState = function() +{ + return FCK_TRISTATE_OFF ; +} + +// ### Source button +var FCKSourceCommand = function() +{ + this.Name = 'Source' ; +} + +FCKSourceCommand.prototype.Execute = function() +{ + if ( FCKConfig.SourcePopup ) // Until v2.2, it was mandatory for FCKBrowserInfo.IsGecko. + { + var iWidth = FCKConfig.ScreenWidth * 0.65 ; + var iHeight = FCKConfig.ScreenHeight * 0.65 ; + FCKDialog.OpenDialog( 'FCKDialog_Source', FCKLang.Source, 'dialog/fck_source.html', iWidth, iHeight, null, null, true ) ; + } + else + FCK.SwitchEditMode() ; +} + +FCKSourceCommand.prototype.GetState = function() +{ + return ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ? FCK_TRISTATE_OFF : FCK_TRISTATE_ON ) ; +} + +// ### Undo +var FCKUndoCommand = function() +{ + this.Name = 'Undo' ; +} + +FCKUndoCommand.prototype.Execute = function() +{ + if ( FCKBrowserInfo.IsIE ) + FCKUndo.Undo() ; + else + FCK.ExecuteNamedCommand( 'Undo' ) ; +} + +FCKUndoCommand.prototype.GetState = function() +{ + if ( FCKBrowserInfo.IsIE ) + return ( FCKUndo.CheckUndoState() ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ; + else + return FCK.GetNamedCommandState( 'Undo' ) ; +} + +// ### Redo +var FCKRedoCommand = function() +{ + this.Name = 'Redo' ; +} + +FCKRedoCommand.prototype.Execute = function() +{ + if ( FCKBrowserInfo.IsIE ) + FCKUndo.Redo() ; + else + FCK.ExecuteNamedCommand( 'Redo' ) ; +} + +FCKRedoCommand.prototype.GetState = function() +{ + if ( FCKBrowserInfo.IsIE ) + return ( FCKUndo.CheckRedoState() ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ) ; + else + return FCK.GetNamedCommandState( 'Redo' ) ; +} + +// ### Page Break +var FCKPageBreakCommand = function() +{ + this.Name = 'PageBreak' ; +} + +FCKPageBreakCommand.prototype.Execute = function() +{ +// var e = FCK.EditorDocument.createElement( 'CENTER' ) ; +// e.style.pageBreakAfter = 'always' ; + + // Tidy was removing the empty CENTER tags, so the following solution has + // been found. It also validates correctly as XHTML 1.0 Strict. + var e = FCK.EditorDocument.createElement( 'DIV' ) ; + e.style.pageBreakAfter = 'always' ; + e.innerHTML = ' ' ; + + var oFakeImage = FCKDocumentProcessor_CreateFakeImage( 'FCK__PageBreak', e ) ; + oFakeImage = FCK.InsertElement( oFakeImage ) ; +} + +FCKPageBreakCommand.prototype.GetState = function() +{ + return 0 ; // FCK_TRISTATE_OFF +} + +// FCKUnlinkCommand - by Johnny Egeland (johnny@coretrek.com) +var FCKUnlinkCommand = function() +{ + this.Name = 'Unlink' ; +} + +FCKUnlinkCommand.prototype.Execute = function() +{ + if ( FCKBrowserInfo.IsGecko ) + { + var oLink = FCK.Selection.MoveToAncestorNode( 'A' ) ; + if ( oLink ) + FCK.Selection.SelectNode( oLink ) ; + } + + FCK.ExecuteNamedCommand( this.Name ) ; + + if ( FCKBrowserInfo.IsGecko ) + FCK.Selection.Collapse( true ) ; +} + +FCKUnlinkCommand.prototype.GetState = function() +{ + return FCK.GetNamedCommandState( this.Name ) ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckfitwindow.js b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckfitwindow.js new file mode 100644 index 0000000000..0f5c5bedf4 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckfitwindow.js @@ -0,0 +1,164 @@ +/* + * 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: fckfitwindow.js + * Stretch the editor to full window size and back. + * + * File Authors: + * Paul Moers (mail@saulmade.nl) + * Thanks to Christian Fecteau (webmaster@christianfecteau.com) + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKFitWindow = function() +{ + this.Name = 'FitWindow' ; +} + +FCKFitWindow.prototype.Execute = function() +{ + var eEditorFrame = window.frameElement ; + var eEditorFrameStyle = eEditorFrame.style ; + + var eMainWindow = parent ; + var eDocEl = eMainWindow.document.documentElement ; + var eBody = eMainWindow.document.body ; + var eBodyStyle = eBody.style ; + + // No original style properties known? Go fullscreen. + if ( !this.IsMaximized ) + { + // Registering an event handler when the window gets resized. + if( FCKBrowserInfo.IsIE ) + eMainWindow.attachEvent( 'onresize', FCKFitWindow_Resize ) ; + else + eMainWindow.addEventListener( 'resize', FCKFitWindow_Resize, true ) ; + + // Save the scrollbars position. + this._ScrollPos = FCKTools.GetScrollPosition( eMainWindow ) ; + + // Save and reset the styles for the entire node tree. They could interfere in the result. + var eParent = eEditorFrame ; + while( eParent = eParent.parentNode ) + { + if ( eParent.nodeType == 1 ) + eParent._fckSavedStyles = FCKTools.SaveStyles( eParent ) ; + } + + // Hide IE scrollbars (in strict mode). + if ( FCKBrowserInfo.IsIE ) + { + this.documentElementOverflow = eDocEl.style.overflow ; + eDocEl.style.overflow = 'hidden' ; + eBodyStyle.overflow = 'hidden' ; + } + else + { + // Hide the scroolbars in Firefox. + eBodyStyle.overflow = 'hidden' ; + eBodyStyle.width = '0px' ; + eBodyStyle.height = '0px' ; + } + + // Save the IFRAME styles. + this._EditorFrameStyles = FCKTools.SaveStyles( eEditorFrame ) ; + + // Resize. + var oViewPaneSize = FCKTools.GetViewPaneSize( eMainWindow ) ; + + eEditorFrameStyle.position = "absolute"; + eEditorFrameStyle.zIndex = FCKConfig.FloatingPanelsZIndex - 1; + eEditorFrameStyle.left = "0px"; + eEditorFrameStyle.top = "0px"; + eEditorFrameStyle.width = oViewPaneSize.Width + "px"; + eEditorFrameStyle.height = oViewPaneSize.Height + "px"; + + // Giving the frame some (huge) borders on his right and bottom + // side to hide the background that would otherwise show when the + // editor is in fullsize mode and the window is increased in size + // not for IE, because IE immediately adapts the editor on resize, + // without showing any of the background oddly in firefox, the + // editor seems not to fill the whole frame, so just setting the + // background of it to white to cover the page laying behind it anyway. + if ( !FCKBrowserInfo.IsIE ) + { + eEditorFrameStyle.borderRight = eEditorFrameStyle.borderBottom = "9999px solid white" ; + eEditorFrameStyle.backgroundColor = "white"; + } + + // Scroll to top left. + eMainWindow.scrollTo(0, 0); + + this.IsMaximized = true ; + } + else // Resize to original size. + { + // Remove the event handler of window resizing. + if( FCKBrowserInfo.IsIE ) + eMainWindow.detachEvent( "onresize", FCKFitWindow_Resize ) ; + else + eMainWindow.removeEventListener( "resize", FCKFitWindow_Resize, true ) ; + + // Restore the CSS position for the entire node tree. + var eParent = eEditorFrame ; + while( eParent = eParent.parentNode ) + { + if ( eParent._fckSavedStyles ) + { + FCKTools.RestoreStyles( eParent, eParent._fckSavedStyles ) ; + eParent._fckSavedStyles = null ; + } + } + + // Restore IE scrollbars + if ( FCKBrowserInfo.IsIE ) + eDocEl.style.overflow = this.documentElementOverflow ; + + // Restore original size + FCKTools.RestoreStyles( eEditorFrame, this._EditorFrameStyles ) ; + + // Restore the window scroll position. + eMainWindow.scrollTo( this._ScrollPos.X, this._ScrollPos.Y ) ; + + this.IsMaximized = false ; + } + + FCKToolbarItems.GetItem('FitWindow').RefreshState() ; + + // It seams that Firefox restarts the editing area when making this changes. + // On FF 1.0.x, the area is not anymore editable. On FF 1.5+, the special + //configuration, like DisableFFTableHandles and DisableObjectResizing get + //lost, so we must reset it. Also, the cursor position and selection are + //also lost, even if you comment the following line (MakeEditable). + // if ( FCKBrowserInfo.IsGecko10 ) // Initially I thought it was a FF 1.0 only problem. + FCK.EditingArea.MakeEditable() ; + + FCK.Focus() ; +} + +FCKFitWindow.prototype.GetState = function() +{ + if ( FCKConfig.ToolbarLocation != 'In' ) + return FCK_TRISTATE_DISABLED ; + else + return ( this.IsMaximized ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF ); +} + +function FCKFitWindow_Resize() +{ + var oViewPaneSize = FCKTools.GetViewPaneSize( parent ) ; + + var eEditorFrameStyle = window.frameElement.style ; + + eEditorFrameStyle.width = oViewPaneSize.Width + 'px' ; + eEditorFrameStyle.height = oViewPaneSize.Height + 'px' ; +} diff --git a/phpgwapi/js/fckeditor/editor/_source/commandclasses/fcknamedcommand.js b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fcknamedcommand.js new file mode 100644 index 0000000000..d11c7bfca8 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fcknamedcommand.js @@ -0,0 +1,33 @@ +/* + * 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: fcknamedcommand.js + * FCKNamedCommand Class: represents an internal browser command. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKNamedCommand = function( commandName ) +{ + this.Name = commandName ; +} + +FCKNamedCommand.prototype.Execute = function() +{ + FCK.ExecuteNamedCommand( this.Name ) ; +} + +FCKNamedCommand.prototype.GetState = function() +{ + return FCK.GetNamedCommandState( this.Name ) ; +} diff --git a/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckpasteplaintextcommand.js b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckpasteplaintextcommand.js new file mode 100644 index 0000000000..2e7c5f80b7 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckpasteplaintextcommand.js @@ -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: fckpasteplaintextcommand.js + * FCKPastePlainTextCommand Class: represents the + * "Paste as Plain Text" command. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKPastePlainTextCommand = function() +{ + this.Name = 'PasteText' ; +} + +FCKPastePlainTextCommand.prototype.Execute = function() +{ + FCK.PasteAsPlainText() ; +} + +FCKPastePlainTextCommand.prototype.GetState = function() +{ + return FCK.GetNamedCommandState( 'Paste' ) ; +} diff --git a/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckpastewordcommand.js b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckpastewordcommand.js new file mode 100644 index 0000000000..ebe2ce8a11 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckpastewordcommand.js @@ -0,0 +1,36 @@ +/* + * 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: fckpastewordcommand.js + * FCKPasteWordCommand Class: represents the "Paste from Word" command. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKPasteWordCommand = function() +{ + this.Name = 'PasteWord' ; +} + +FCKPasteWordCommand.prototype.Execute = function() +{ + FCK.PasteFromWord() ; +} + +FCKPasteWordCommand.prototype.GetState = function() +{ + if ( FCKConfig.ForcePasteAsPlainText ) + return FCK_TRISTATE_DISABLED ; + else + return FCK.GetNamedCommandState( 'Paste' ) ; +} diff --git a/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckspellcheckcommand_gecko.js b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckspellcheckcommand_gecko.js new file mode 100644 index 0000000000..897b6b6a4b --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckspellcheckcommand_gecko.js @@ -0,0 +1,35 @@ +/* + * 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: fckspellcheckcommand_gecko.js + * FCKStyleCommand Class: represents the "Spell Check" command. + * (Gecko specific implementation) + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKSpellCheckCommand = function() +{ + this.Name = 'SpellCheck' ; + this.IsEnabled = ( FCKConfig.SpellChecker == 'SpellerPages' ) ; +} + +FCKSpellCheckCommand.prototype.Execute = function() +{ + FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'dialog/fck_spellerpages.html', 440, 480 ) ; +} + +FCKSpellCheckCommand.prototype.GetState = function() +{ + return this.IsEnabled ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckspellcheckcommand_ie.js b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckspellcheckcommand_ie.js new file mode 100644 index 0000000000..a43bf3df18 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckspellcheckcommand_ie.js @@ -0,0 +1,63 @@ +/* + * 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: fckspellcheckcommand_ie.js + * FCKStyleCommand Class: represents the "Spell Check" command. + * (IE specific implementation) + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKSpellCheckCommand = function() +{ + this.Name = 'SpellCheck' ; + this.IsEnabled = ( FCKConfig.SpellChecker == 'ieSpell' || FCKConfig.SpellChecker == 'SpellerPages' ) ; +} + +FCKSpellCheckCommand.prototype.Execute = function() +{ + switch ( FCKConfig.SpellChecker ) + { + case 'ieSpell' : + this._RunIeSpell() ; + break ; + + case 'SpellerPages' : + FCKDialog.OpenDialog( 'FCKDialog_SpellCheck', 'Spell Check', 'dialog/fck_spellerpages.html', 440, 480 ) ; + break ; + } +} + +FCKSpellCheckCommand.prototype._RunIeSpell = function() +{ + try + { + var oIeSpell = new ActiveXObject( "ieSpell.ieSpellExtension" ) ; + oIeSpell.CheckAllLinkedDocuments( FCK.EditorDocument ) ; + } + catch( e ) + { + if( e.number == -2146827859 ) + { + if ( confirm( FCKLang.IeSpellDownload ) ) + window.open( FCKConfig.IeSpellDownloadUrl , 'IeSpellDownload' ) ; + } + else + alert( 'Error Loading ieSpell: ' + e.message + ' (' + e.number + ')' ) ; + } +} + +FCKSpellCheckCommand.prototype.GetState = function() +{ + return this.IsEnabled ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckstylecommand.js b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckstylecommand.js new file mode 100644 index 0000000000..e832347d8c --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fckstylecommand.js @@ -0,0 +1,95 @@ +/* + * 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: fckstylecommand.js + * FCKStyleCommand Class: represents the "Style" command. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKStyleCommand = function() +{ + this.Name = 'Style' ; + + // Load the Styles defined in the XML file. + this.StylesLoader = new FCKStylesLoader() ; + this.StylesLoader.Load( FCKConfig.StylesXmlPath ) ; + this.Styles = this.StylesLoader.Styles ; +} + +FCKStyleCommand.prototype.Execute = function( styleName, styleComboItem ) +{ + FCKUndo.SaveUndoStep() ; + + if ( styleComboItem.Selected ) + styleComboItem.Style.RemoveFromSelection() ; + else + styleComboItem.Style.ApplyToSelection() ; + + FCKUndo.SaveUndoStep() ; + + FCK.Focus() ; + + FCK.Events.FireEvent( "OnSelectionChange" ) ; +} + +FCKStyleCommand.prototype.GetState = function() +{ + if ( !FCK.EditorDocument ) + return FCK_TRISTATE_DISABLED ; + + var oSelection = FCK.EditorDocument.selection ; + + if ( FCKSelection.GetType() == 'Control' ) + { + var e = FCKSelection.GetSelectedElement() ; + if ( e ) + return this.StylesLoader.StyleGroups[ e.tagName ] ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ; + } + + return FCK_TRISTATE_OFF ; +} + +FCKStyleCommand.prototype.GetActiveStyles = function() +{ + var aActiveStyles = new Array() ; + + if ( FCKSelection.GetType() == 'Control' ) + this._CheckStyle( FCKSelection.GetSelectedElement(), aActiveStyles, false ) ; + else + this._CheckStyle( FCKSelection.GetParentElement(), aActiveStyles, true ) ; + + return aActiveStyles ; +} + +FCKStyleCommand.prototype._CheckStyle = function( element, targetArray, checkParent ) +{ + if ( ! element ) + return ; + + if ( element.nodeType == 1 ) + { + var aStyleGroup = this.StylesLoader.StyleGroups[ element.tagName ] ; + if ( aStyleGroup ) + { + for ( var i = 0 ; i < aStyleGroup.length ; i++ ) + { + if ( aStyleGroup[i].IsEqual( element ) ) + targetArray[ targetArray.length ] = aStyleGroup[i] ; + } + } + } + + if ( checkParent ) + this._CheckStyle( element.parentNode, targetArray, checkParent ) ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/commandclasses/fcktablecommand.js b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fcktablecommand.js new file mode 100644 index 0000000000..04aaf7324e --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fcktablecommand.js @@ -0,0 +1,67 @@ +/* + * 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: fcktablecommand.js + * FCKPastePlainTextCommand Class: represents the + * "Paste as Plain Text" command. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKTableCommand = function( command ) +{ + this.Name = command ; +} + +FCKTableCommand.prototype.Execute = function() +{ + FCKUndo.SaveUndoStep() ; + + switch ( this.Name ) + { + case 'TableInsertRow' : + FCKTableHandler.InsertRow() ; + break ; + case 'TableDeleteRows' : + FCKTableHandler.DeleteRows() ; + break ; + case 'TableInsertColumn' : + FCKTableHandler.InsertColumn() ; + break ; + case 'TableDeleteColumns' : + FCKTableHandler.DeleteColumns() ; + break ; + case 'TableInsertCell' : + FCKTableHandler.InsertCell() ; + break ; + case 'TableDeleteCells' : + FCKTableHandler.DeleteCells() ; + break ; + case 'TableMergeCells' : + FCKTableHandler.MergeCells() ; + break ; + case 'TableSplitCell' : + FCKTableHandler.SplitCell() ; + break ; + case 'TableDelete' : + FCKTableHandler.DeleteTable() ; + break ; + default : + alert( FCKLang.UnknownCommand.replace( /%1/g, this.Name ) ) ; + } +} + +FCKTableCommand.prototype.GetState = function() +{ + return FCK_TRISTATE_OFF ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/commandclasses/fcktextcolorcommand.js b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fcktextcolorcommand.js new file mode 100644 index 0000000000..6b524dd4e3 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/commandclasses/fcktextcolorcommand.js @@ -0,0 +1,171 @@ +/* + * 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: fcktextcolorcommand.js + * FCKTextColorCommand Class: represents the text color comand. It shows the + * color selection panel. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +// FCKTextColorCommand Contructor +// type: can be 'ForeColor' or 'BackColor'. +var FCKTextColorCommand = function( type ) +{ + this.Name = type == 'ForeColor' ? 'TextColor' : 'BGColor' ; + this.Type = type ; + + var oWindow ; + + if ( FCKBrowserInfo.IsIE ) + oWindow = window ; + else if ( FCK.ToolbarSet._IFrame ) + oWindow = FCKTools.GetElementWindow( FCK.ToolbarSet._IFrame ) ; + else + oWindow = window.parent ; + + this._Panel = new FCKPanel( oWindow, true ) ; + this._Panel.AppendStyleSheet( FCKConfig.SkinPath + 'fck_editor.css' ) ; + this._Panel.MainNode.className = 'FCK_Panel' ; + this._CreatePanelBody( this._Panel.Document, this._Panel.MainNode ) ; + + FCKTools.DisableSelection( this._Panel.Document.body ) ; +} + +FCKTextColorCommand.prototype.Execute = function( panelX, panelY, relElement ) +{ + // We must "cache" the actual panel type to be used in the SetColor method. + FCK._ActiveColorPanelType = this.Type ; + + // Show the Color Panel at the desired position. + this._Panel.Show( panelX, panelY, relElement ) ; +} + +FCKTextColorCommand.prototype.SetColor = function( color ) +{ + if ( FCK._ActiveColorPanelType == 'ForeColor' ) + FCK.ExecuteNamedCommand( 'ForeColor', color ) ; + else if ( FCKBrowserInfo.IsGeckoLike ) + { + if ( FCKBrowserInfo.IsGecko && !FCKConfig.GeckoUseSPAN ) + FCK.EditorDocument.execCommand( 'useCSS', false, false ) ; + + FCK.ExecuteNamedCommand( 'hilitecolor', color ) ; + + if ( FCKBrowserInfo.IsGecko && !FCKConfig.GeckoUseSPAN ) + FCK.EditorDocument.execCommand( 'useCSS', false, true ) ; + } + else + FCK.ExecuteNamedCommand( 'BackColor', color ) ; + + // Delete the "cached" active panel type. + delete FCK._ActiveColorPanelType ; +} + +FCKTextColorCommand.prototype.GetState = function() +{ + return FCK_TRISTATE_OFF ; +} + +function FCKTextColorCommand_OnMouseOver() { this.className='ColorSelected' ; } + +function FCKTextColorCommand_OnMouseOut() { this.className='ColorDeselected' ; } + +function FCKTextColorCommand_OnClick() +{ + this.className = 'ColorDeselected' ; + this.Command.SetColor( '#' + this.Color ) ; + this.Command._Panel.Hide() ; +} + +function FCKTextColorCommand_AutoOnClick() +{ + this.className = 'ColorDeselected' ; + this.Command.SetColor( '' ) ; + this.Command._Panel.Hide() ; +} + +function FCKTextColorCommand_MoreOnClick() +{ + this.className = 'ColorDeselected' ; + this.Command._Panel.Hide() ; + FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 400, 330, this.Command.SetColor ) ; +} + +FCKTextColorCommand.prototype._CreatePanelBody = function( targetDocument, targetDiv ) +{ + function CreateSelectionDiv() + { + var oDiv = targetDocument.createElement( "DIV" ) ; + oDiv.className = 'ColorDeselected' ; + oDiv.onmouseover = FCKTextColorCommand_OnMouseOver ; + oDiv.onmouseout = FCKTextColorCommand_OnMouseOut ; + + return oDiv ; + } + + // Create the Table that will hold all colors. + var oTable = targetDiv.appendChild( targetDocument.createElement( "TABLE" ) ) ; + oTable.className = 'ForceBaseFont' ; // Firefox 1.5 Bug. + oTable.style.tableLayout = 'fixed' ; + oTable.cellPadding = 0 ; + oTable.cellSpacing = 0 ; + oTable.border = 0 ; + oTable.width = 150 ; + + var oCell = oTable.insertRow(-1).insertCell(-1) ; + oCell.colSpan = 8 ; + + // Create the Button for the "Automatic" color selection. + var oDiv = oCell.appendChild( CreateSelectionDiv() ) ; + oDiv.innerHTML = + '
' + FCKLang.ColorAutomatic + ' | \ +
' + FCKLang.ColorMoreColors + ' |
' ) + sXHTML = '' ; + else + sXHTML = FCKXHtml.GetXHTML( oDoc.body, false, format ) ; + } + + // Restore protected attributes. + sXHTML = FCK.ProtectEventsRestore( sXHTML ) ; + + if ( FCKBrowserInfo.IsIE ) + sXHTML = sXHTML.replace( FCKRegexLib.ToReplace, '$1' ) ; + + if ( FCK.DocTypeDeclaration && FCK.DocTypeDeclaration.length > 0 ) + sXHTML = FCK.DocTypeDeclaration + '\n' + sXHTML ; + + if ( FCK.XmlDeclaration && FCK.XmlDeclaration.length > 0 ) + sXHTML = FCK.XmlDeclaration + '\n' + sXHTML ; + + return FCKConfig.ProtectedSource.Revert( sXHTML ) ; +} + +FCK.UpdateLinkedField = function() +{ + FCK.LinkedField.value = FCK.GetXHTML( FCKConfig.FormatOutput ) ; + FCK.Events.FireEvent( 'OnAfterLinkedFieldUpdate' ) ; +} + +FCK.RegisteredDoubleClickHandlers = new Object() ; + +FCK.OnDoubleClick = function( element ) +{ + var oHandler = FCK.RegisteredDoubleClickHandlers[ element.tagName ] ; + if ( oHandler ) + oHandler( element ) ; +} + +// Register objects that can handle double click operations. +FCK.RegisterDoubleClickHandler = function( handlerFunction, tag ) +{ + FCK.RegisteredDoubleClickHandlers[ tag.toUpperCase() ] = handlerFunction ; +} + +FCK.OnAfterSetHTML = function() +{ + FCKDocumentProcessor.Process( FCK.EditorDocument ) ; + FCKUndo.SaveUndoStep() ; + FCK.Events.FireEvent( 'OnSelectionChange' ) ; + FCK.Events.FireEvent( 'OnAfterSetHTML' ) ; +} + +// Saves URLs on links and images on special attributes, so they don't change when +// moving around. +FCK.ProtectUrls = function( html ) +{ + // href + html = html.replace( FCKRegexLib.ProtectUrlsA , '$1$4$2$3$5$2 _fcksavedurl=$2$3$5$2' ) ; + + // src + html = html.replace( FCKRegexLib.ProtectUrlsImg , '$1$4$2$3$5$2 _fcksavedurl=$2$3$5$2' ) ; + + return html ; +} + +// Saves event attributes (like onclick) so they don't get executed while +// editing. +FCK.ProtectEvents = function( html ) +{ + return html.replace( FCKRegexLib.TagsWithEvent, _FCK_ProtectEvents_ReplaceTags ) ; +} + +// Replace all events attributes (like onclick). +function _FCK_ProtectEvents_ReplaceTags( tagMatch ) +{ + return tagMatch.replace( FCKRegexLib.EventAttributes, _FCK_ProtectEvents_ReplaceEvents ) ; +} + +// Replace an event attribute with its respective __fckprotectedatt attribute. +// The original event markup will be encoded and saved as the value of the new +// attribute. +function _FCK_ProtectEvents_ReplaceEvents( eventMatch, attName ) +{ + return ' ' + attName + '_fckprotectedatt="' + eventMatch.ReplaceAll( [/&/g,/'/g,/"/g,/=/g,//g,/\r/g,/\n/g], [''',''','"','=','<','>',' ',' '] ) + '"' ; +} + +FCK.ProtectEventsRestore = function( html ) +{ + return html.replace( FCKRegexLib.ProtectedEvents, _FCK_ProtectEvents_RestoreEvents ) ; +} + +function _FCK_ProtectEvents_RestoreEvents( match, encodedOriginal ) +{ + return encodedOriginal.ReplaceAll( [/'/g,/"/g,/=/g,/</g,/>/g,/ /g,/ /g,/'/g], ["'",'"','=','<','>','\r','\n','&'] ) ; +} + +FCK.IsDirty = function() +{ + return ( FCK_StartupValue != FCK.EditorDocument.body.innerHTML ) ; +} + +FCK.ResetIsDirty = function() +{ + if ( FCK.EditorDocument.body ) + FCK_StartupValue = FCK.EditorDocument.body.innerHTML ; +} + +FCK.SetHTML = function( html ) +{ + this.EditingArea.Mode = FCK.EditMode ; + + if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ) + { + html = FCKConfig.ProtectedSource.Protect( html ) ; + html = FCK.ProtectEvents( html ) ; + html = FCK.ProtectUrls( html ) ; + + // Firefox can't handle correctly the editing of the STRONG and EM tags. + // We must replace them with B and I. + if ( FCKBrowserInfo.IsGecko ) + { + html = html.replace( FCKRegexLib.StrongOpener, '' ) ; + html = html.replace( FCKRegexLib.EmOpener, '' ) ; + } + else if ( FCKBrowserInfo.IsIE ) + { + // IE doesn't support and it breaks it. Let's protect it. + html = html.replace( FCKRegexLib.AbbrOpener, '
]*>)([\s\S]*?)(<\/PRE>)/gi ; +} + +FCKCodeFormatter._ProtectData = function( outer, opener, data, closer ) +{ + return opener + '___FCKpd___' + FCKCodeFormatter.ProtectedData.AddItem( data ) + closer ; +} + +FCKCodeFormatter.Format = function( html ) +{ + if ( !this.Regex ) + this.Init() ; + + // Protected content that remain untouched during the + // process go in the following array. + FCKCodeFormatter.ProtectedData = new Array() ; + + var sFormatted = html.replace( this.Regex.ProtectedTags, FCKCodeFormatter._ProtectData ) ; + + // Line breaks. + sFormatted = sFormatted.replace( this.Regex.BlocksOpener, '\n$&' ) ; ; + sFormatted = sFormatted.replace( this.Regex.BlocksCloser, '$&\n' ) ; + sFormatted = sFormatted.replace( this.Regex.NewLineTags, '$&\n' ) ; + sFormatted = sFormatted.replace( this.Regex.MainTags, '\n$&\n' ) ; + + // Indentation. + var sIndentation = '' ; + + var asLines = sFormatted.split( this.Regex.LineSplitter ) ; + sFormatted = '' ; + + for ( var i = 0 ; i < asLines.length ; i++ ) + { + var sLine = asLines[i] ; + + if ( sLine.length == 0 ) + continue ; + + if ( this.Regex.DecreaseIndent.test( sLine ) ) + sIndentation = sIndentation.replace( this.Regex.FormatIndentatorRemove, '' ) ; + + sFormatted += sIndentation + sLine + '\n' ; + + if ( this.Regex.IncreaseIndent.test( sLine ) ) + sIndentation += FCKConfig.FormatIndentator ; + } + + // Now we put back the protected data. + for ( var i = 0 ; i < FCKCodeFormatter.ProtectedData.length ; i++ ) + { + var oRegex = new RegExp( '___FCKpd___' + i ) ; + sFormatted = sFormatted.replace( oRegex, FCKCodeFormatter.ProtectedData[i].replace( /\$/g, '$$$$' ) ) ; + } + + return sFormatted.trim() ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fckcommands.js b/phpgwapi/js/fckeditor/editor/_source/internals/fckcommands.js new file mode 100644 index 0000000000..cbf35b5e10 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fckcommands.js @@ -0,0 +1,126 @@ +/* + * 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: fckcommands.js + * Define all commands available in the editor. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKCommands = FCK.Commands = new Object() ; +FCKCommands.LoadedCommands = new Object() ; + +FCKCommands.RegisterCommand = function( commandName, command ) +{ + this.LoadedCommands[ commandName ] = command ; +} + +FCKCommands.GetCommand = function( commandName ) +{ + var oCommand = FCKCommands.LoadedCommands[ commandName ] ; + + if ( oCommand ) + return oCommand ; + + switch ( commandName ) + { + case 'DocProps' : oCommand = new FCKDialogCommand( 'DocProps' , FCKLang.DocProps , 'dialog/fck_docprops.html' , 400, 390, FCKCommands.GetFullPageState ) ; break ; + case 'Templates' : oCommand = new FCKDialogCommand( 'Templates' , FCKLang.DlgTemplatesTitle , 'dialog/fck_template.html' , 380, 450 ) ; break ; + case 'Link' : oCommand = new FCKDialogCommand( 'Link' , FCKLang.DlgLnkWindowTitle , 'dialog/fck_link.html' , 400, 330, FCK.GetNamedCommandState, 'CreateLink' ) ; break ; + case 'Unlink' : oCommand = new FCKUnlinkCommand() ; break ; + case 'Anchor' : oCommand = new FCKDialogCommand( 'Anchor' , FCKLang.DlgAnchorTitle , 'dialog/fck_anchor.html' , 370, 170 ) ; break ; + case 'BulletedList' : oCommand = new FCKDialogCommand( 'BulletedList', FCKLang.BulletedListProp , 'dialog/fck_listprop.html' , 370, 170 ) ; break ; + case 'NumberedList' : oCommand = new FCKDialogCommand( 'NumberedList', FCKLang.NumberedListProp , 'dialog/fck_listprop.html' , 370, 170 ) ; break ; + case 'About' : oCommand = new FCKDialogCommand( 'About' , FCKLang.About , 'dialog/fck_about.html' , 400, 330 ) ; break ; + + case 'Find' : oCommand = new FCKDialogCommand( 'Find' , FCKLang.DlgFindTitle , 'dialog/fck_find.html' , 340, 170 ) ; break ; + case 'Replace' : oCommand = new FCKDialogCommand( 'Replace' , FCKLang.DlgReplaceTitle , 'dialog/fck_replace.html' , 340, 200 ) ; break ; + + case 'Image' : oCommand = new FCKDialogCommand( 'Image' , FCKLang.DlgImgTitle , 'dialog/fck_image.html' , 450, 400 ) ; break ; + case 'Flash' : oCommand = new FCKDialogCommand( 'Flash' , FCKLang.DlgFlashTitle , 'dialog/fck_flash.html' , 450, 400 ) ; break ; + case 'SpecialChar' : oCommand = new FCKDialogCommand( 'SpecialChar', FCKLang.DlgSpecialCharTitle , 'dialog/fck_specialchar.html' , 400, 320 ) ; break ; + case 'Smiley' : oCommand = new FCKDialogCommand( 'Smiley' , FCKLang.DlgSmileyTitle , 'dialog/fck_smiley.html' , FCKConfig.SmileyWindowWidth, FCKConfig.SmileyWindowHeight ) ; break ; + case 'Table' : oCommand = new FCKDialogCommand( 'Table' , FCKLang.DlgTableTitle , 'dialog/fck_table.html' , 450, 250 ) ; break ; + case 'TableProp' : oCommand = new FCKDialogCommand( 'Table' , FCKLang.DlgTableTitle , 'dialog/fck_table.html?Parent', 400, 250 ) ; break ; + case 'TableCellProp': oCommand = new FCKDialogCommand( 'TableCell' , FCKLang.DlgCellTitle , 'dialog/fck_tablecell.html' , 550, 250 ) ; break ; + case 'UniversalKey' : oCommand = new FCKDialogCommand( 'UniversalKey', FCKLang.UniversalKeyboard , 'dialog/fck_universalkey.html', 415, 300 ) ; break ; + + case 'Style' : oCommand = new FCKStyleCommand() ; break ; + + case 'FontName' : oCommand = new FCKFontNameCommand() ; break ; + case 'FontSize' : oCommand = new FCKFontSizeCommand() ; break ; + case 'FontFormat' : oCommand = new FCKFormatBlockCommand() ; break ; + + case 'Source' : oCommand = new FCKSourceCommand() ; break ; + case 'Preview' : oCommand = new FCKPreviewCommand() ; break ; + case 'Save' : oCommand = new FCKSaveCommand() ; break ; + case 'NewPage' : oCommand = new FCKNewPageCommand() ; break ; + case 'PageBreak' : oCommand = new FCKPageBreakCommand() ; break ; + + case 'TextColor' : oCommand = new FCKTextColorCommand('ForeColor') ; break ; + case 'BGColor' : oCommand = new FCKTextColorCommand('BackColor') ; break ; + + case 'PasteText' : oCommand = new FCKPastePlainTextCommand() ; break ; + case 'PasteWord' : oCommand = new FCKPasteWordCommand() ; break ; + + case 'TableInsertRow' : oCommand = new FCKTableCommand('TableInsertRow') ; break ; + case 'TableDeleteRows' : oCommand = new FCKTableCommand('TableDeleteRows') ; break ; + case 'TableInsertColumn' : oCommand = new FCKTableCommand('TableInsertColumn') ; break ; + case 'TableDeleteColumns' : oCommand = new FCKTableCommand('TableDeleteColumns') ; break ; + case 'TableInsertCell' : oCommand = new FCKTableCommand('TableInsertCell') ; break ; + case 'TableDeleteCells' : oCommand = new FCKTableCommand('TableDeleteCells') ; break ; + case 'TableMergeCells' : oCommand = new FCKTableCommand('TableMergeCells') ; break ; + case 'TableSplitCell' : oCommand = new FCKTableCommand('TableSplitCell') ; break ; + case 'TableDelete' : oCommand = new FCKTableCommand('TableDelete') ; break ; + + case 'Form' : oCommand = new FCKDialogCommand( 'Form' , FCKLang.Form , 'dialog/fck_form.html' , 380, 230 ) ; break ; + case 'Checkbox' : oCommand = new FCKDialogCommand( 'Checkbox' , FCKLang.Checkbox , 'dialog/fck_checkbox.html' , 380, 230 ) ; break ; + case 'Radio' : oCommand = new FCKDialogCommand( 'Radio' , FCKLang.RadioButton , 'dialog/fck_radiobutton.html' , 380, 230 ) ; break ; + case 'TextField' : oCommand = new FCKDialogCommand( 'TextField' , FCKLang.TextField , 'dialog/fck_textfield.html' , 380, 230 ) ; break ; + case 'Textarea' : oCommand = new FCKDialogCommand( 'Textarea' , FCKLang.Textarea , 'dialog/fck_textarea.html' , 380, 230 ) ; break ; + case 'HiddenField' : oCommand = new FCKDialogCommand( 'HiddenField', FCKLang.HiddenField , 'dialog/fck_hiddenfield.html' , 380, 230 ) ; break ; + case 'Button' : oCommand = new FCKDialogCommand( 'Button' , FCKLang.Button , 'dialog/fck_button.html' , 380, 230 ) ; break ; + case 'Select' : oCommand = new FCKDialogCommand( 'Select' , FCKLang.SelectionField, 'dialog/fck_select.html' , 400, 380 ) ; break ; + case 'ImageButton' : oCommand = new FCKDialogCommand( 'ImageButton', FCKLang.ImageButton , 'dialog/fck_image.html?ImageButton', 450, 400 ) ; break ; + + case 'SpellCheck' : oCommand = new FCKSpellCheckCommand() ; break ; + case 'FitWindow' : oCommand = new FCKFitWindow() ; break ; + + case 'Undo' : oCommand = new FCKUndoCommand() ; break ; + case 'Redo' : oCommand = new FCKRedoCommand() ; break ; + + // Generic Undefined command (usually used when a command is under development). + case 'Undefined' : oCommand = new FCKUndefinedCommand() ; break ; + + // By default we assume that it is a named command. + default: + if ( FCKRegexLib.NamedCommands.test( commandName ) ) + oCommand = new FCKNamedCommand( commandName ) ; + else + { + alert( FCKLang.UnknownCommand.replace( /%1/g, commandName ) ) ; + return null ; + } + } + + FCKCommands.LoadedCommands[ commandName ] = oCommand ; + + return oCommand ; +} + +// Gets the state of the "Document Properties" button. It must be enabled only +// when "Full Page" editing is available. +FCKCommands.GetFullPageState = function() +{ + return FCKConfig.FullPage ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ; +} diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fckconfig.js b/phpgwapi/js/fckeditor/editor/_source/internals/fckconfig.js new file mode 100644 index 0000000000..c72c8e2bd3 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fckconfig.js @@ -0,0 +1,195 @@ +/* + * 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: fckconfig.js + * Creates and initializes the FCKConfig object. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKConfig = FCK.Config = new Object() ; + +/* + For the next major version (probably 3.0) we should move all this stuff to + another dedicated object and leave FCKConfig as a holder object for settings only). +*/ + +// Editor Base Path +if ( document.location.protocol == 'file:' ) +{ + FCKConfig.BasePath = unescape( document.location.pathname.substr(1) ) ; + FCKConfig.BasePath = FCKConfig.BasePath.replace( /\\/gi, '/' ) ; + FCKConfig.BasePath = 'file://' + FCKConfig.BasePath.substring(0,FCKConfig.BasePath.lastIndexOf('/')+1) ; + FCKConfig.FullBasePath = FCKConfig.BasePath ; +} +else +{ + FCKConfig.BasePath = document.location.pathname.substring(0,document.location.pathname.lastIndexOf('/')+1) ; + FCKConfig.FullBasePath = document.location.protocol + '//' + document.location.host + FCKConfig.BasePath ; +} + +FCKConfig.EditorPath = FCKConfig.BasePath.replace( /editor\/$/, '' ) ; + +// There is a bug in Gecko. If the editor is hidden on startup, an error is +// thrown when trying to get the screen dimentions. +try +{ + FCKConfig.ScreenWidth = screen.width ; + FCKConfig.ScreenHeight = screen.height ; +} +catch (e) +{ + FCKConfig.ScreenWidth = 800 ; + FCKConfig.ScreenHeight = 600 ; +} + +// Override the actual configuration values with the values passed throw the +// hidden field "___Config". +FCKConfig.ProcessHiddenField = function() +{ + this.PageConfig = new Object() ; + + // Get the hidden field. + var oConfigField = window.parent.document.getElementById( FCK.Name + '___Config' ) ; + + // Do nothing if the config field was not defined. + if ( ! oConfigField ) return ; + + var aCouples = oConfigField.value.split('&') ; + + for ( var i = 0 ; i < aCouples.length ; i++ ) + { + if ( aCouples[i].length == 0 ) + continue ; + + var aConfig = aCouples[i].split( '=' ) ; + var sKey = unescape( aConfig[0] ) ; + var sVal = unescape( aConfig[1] ) ; + + if ( sKey == 'CustomConfigurationsPath' ) // The Custom Config File path must be loaded immediately. + FCKConfig[ sKey ] = sVal ; + + else if ( sVal.toLowerCase() == "true" ) // If it is a boolean TRUE. + this.PageConfig[ sKey ] = true ; + + else if ( sVal.toLowerCase() == "false" ) // If it is a boolean FALSE. + this.PageConfig[ sKey ] = false ; + + else if ( sVal.length > 0 && !isNaN( sVal ) ) // If it is a number. + this.PageConfig[ sKey ] = parseInt( sVal ) ; + + else // In any other case it is a string. + this.PageConfig[ sKey ] = sVal ; + } +} + +function FCKConfig_LoadPageConfig() +{ + var oPageConfig = FCKConfig.PageConfig ; + for ( var sKey in oPageConfig ) + FCKConfig[ sKey ] = oPageConfig[ sKey ] ; +} + +function FCKConfig_PreProcess() +{ + var oConfig = FCKConfig ; + + // Force debug mode if fckdebug=true in the QueryString (main page). + if ( oConfig.AllowQueryStringDebug ) + { + try + { + if ( (/fckdebug=true/i).test( window.top.location.search ) ) + oConfig.Debug = true ; + } + catch (e) { /* Ignore it. Much probably we are inside a FRAME where the "top" is in another domain (security error). */ } + } + + // Certifies that the "PluginsPath" configuration ends with a slash. + if ( !oConfig.PluginsPath.endsWith('/') ) + oConfig.PluginsPath += '/' ; + + // EditorAreaCSS accepts an array of paths or a single path (as string). + // In the last case, transform it in an array. + if ( typeof( oConfig.EditorAreaCSS ) == 'string' ) + oConfig.EditorAreaCSS = [ oConfig.EditorAreaCSS ] ; + + var sComboPreviewCSS = oConfig.ToolbarComboPreviewCSS ; + if ( !sComboPreviewCSS || sComboPreviewCSS.length == 0 ) + oConfig.ToolbarComboPreviewCSS = oConfig.EditorAreaCSS ; + else if ( typeof( sComboPreviewCSS ) == 'string' ) + oConfig.ToolbarComboPreviewCSS = [ sComboPreviewCSS ] ; +} + +// Define toolbar sets collection. +FCKConfig.ToolbarSets = new Object() ; + +// Defines the plugins collection. +FCKConfig.Plugins = new Object() ; +FCKConfig.Plugins.Items = new Array() ; + +FCKConfig.Plugins.Add = function( name, langs, path ) +{ + FCKConfig.Plugins.Items.AddItem( [name, langs, path] ) ; +} + +// FCKConfig.ProtectedSource: object that holds a collection of Regular +// Expressions that defined parts of the raw HTML that must remain untouched +// like custom tags, scripts, server side code, etc... +FCKConfig.ProtectedSource = new Object() ; + +// Initialize the regex array with the default ones. +FCKConfig.ProtectedSource.RegexEntries = [ + // First of any other protection, we must protect all comments to avoid + // loosing them (of course, IE related). + //g , + + // Script tags will also be forced to be protected, otherwise IE will execute them. + /' + document.getElementById( 'xToolbarSpace' ).innerHTML + '' ) ; + eTargetDocument.close() ; + + eTargetDocument.oncontextmenu = FCKTools.CancelEvent ; + + // Load external resources (must be done here, otherwise Firefox will not + // have the document DOM ready to be used right away. + FCKTools.AppendStyleSheet( eTargetDocument, FCKConfig.SkinPath + 'fck_editor.css' ) ; + + oToolbarSet = eToolbarTarget.__FCKToolbarSet = new FCKToolbarSet( eTargetDocument ) ; + oToolbarSet._IFrame = eToolbarIFrame ; + + if ( FCK.IECleanup ) + FCK.IECleanup.AddItem( eToolbarTarget, FCKToolbarSet_Target_Cleanup ) ; + } + + oToolbarSet.CurrentInstance = FCK ; + + FCK.AttachToOnSelectionChange( oToolbarSet.RefreshItemsState ) ; + + return oToolbarSet ; +} + +function FCK_OnBlur( editorInstance ) +{ + var eToolbarSet = editorInstance.ToolbarSet ; + + if ( eToolbarSet.CurrentInstance == editorInstance ) + eToolbarSet.Disable() ; +} + +function FCK_OnFocus( editorInstance ) +{ + var oToolbarset = editorInstance.ToolbarSet ; + var oInstance = editorInstance || FCK ; + + // Unregister the toolbar window from the current instance. + oToolbarset.CurrentInstance.FocusManager.RemoveWindow( oToolbarset._IFrame.contentWindow ) ; + + // Set the new current instance. + oToolbarset.CurrentInstance = oInstance ; + + // Register the toolbar window in the current instance. + oInstance.FocusManager.AddWindow( oToolbarset._IFrame.contentWindow, true ) ; + + oToolbarset.Enable() ; +} + +function FCKToolbarSet_Cleanup() +{ + this._TargetElement = null ; + this._IFrame = null ; +} + +function FCKToolbarSet_Target_Cleanup() +{ + this.__FCKToolbarSet = null ; +} + +var FCKToolbarSet = function( targetDocument ) +{ + this._Document = targetDocument ; + + // Get the element that will hold the elements structure. + this._TargetElement = targetDocument.getElementById( 'xToolbar' ) ; + + // Setup the expand and collapse handlers. + var eExpandHandle = targetDocument.getElementById( 'xExpandHandle' ) ; + var eCollapseHandle = targetDocument.getElementById( 'xCollapseHandle' ) ; + + eExpandHandle.title = FCKLang.ToolbarExpand ; + eExpandHandle.onclick = FCKToolbarSet_Expand_OnClick ; + + eCollapseHandle.title = FCKLang.ToolbarCollapse ; + eCollapseHandle.onclick = FCKToolbarSet_Collapse_OnClick ; + + // Set the toolbar state at startup. + if ( !FCKConfig.ToolbarCanCollapse || FCKConfig.ToolbarStartExpanded ) + this.Expand() ; + else + this.Collapse() ; + + // Enable/disable the collapse handler + eCollapseHandle.style.display = FCKConfig.ToolbarCanCollapse ? '' : 'none' ; + + if ( FCKConfig.ToolbarCanCollapse ) + eCollapseHandle.style.display = '' ; + else + targetDocument.getElementById( 'xTBLeftBorder' ).style.display = '' ; + + // Set the default properties. + this.Toolbars = new Array() ; + this.IsLoaded = false ; + + if ( FCK.IECleanup ) + FCK.IECleanup.AddItem( this, FCKToolbarSet_Cleanup ) ; +} + +function FCKToolbarSet_Expand_OnClick() +{ + FCK.ToolbarSet.Expand() ; +} + +function FCKToolbarSet_Collapse_OnClick() +{ + FCK.ToolbarSet.Collapse() ; +} + +FCKToolbarSet.prototype.Expand = function() +{ + this._ChangeVisibility( false ) ; +} + +FCKToolbarSet.prototype.Collapse = function() +{ + this._ChangeVisibility( true ) ; +} + +FCKToolbarSet.prototype._ChangeVisibility = function( collapse ) +{ + this._Document.getElementById( 'xCollapsed' ).style.display = collapse ? '' : 'none' ; + this._Document.getElementById( 'xExpanded' ).style.display = collapse ? 'none' : '' ; + + if ( FCKBrowserInfo.IsGecko ) + { + // I had to use "setTimeout" because Gecko was not responding in a right + // way when calling window.onresize() directly. + FCKTools.RunFunction( window.onresize ) ; + } +} + +FCKToolbarSet.prototype.Load = function( toolbarSetName ) +{ + this.Name = toolbarSetName ; + + this.Items = new Array() ; + + // Reset the array of toolbat items that are active only on WYSIWYG mode. + this.ItemsWysiwygOnly = new Array() ; + + // Reset the array of toolbar items that are sensitive to the cursor position. + this.ItemsContextSensitive = new Array() ; + + // Cleanup the target element. + this._TargetElement.innerHTML = '' ; + + var ToolbarSet = FCKConfig.ToolbarSets[toolbarSetName] ; + + if ( !ToolbarSet ) + { + alert( FCKLang.UnknownToolbarSet.replace( /%1/g, toolbarSetName ) ) ; + return ; + } + + this.Toolbars = new Array() ; + + for ( var x = 0 ; x < ToolbarSet.length ; x++ ) + { + var oToolbarItems = ToolbarSet[x] ; + + var oToolbar ; + + if ( typeof( oToolbarItems ) == 'string' ) + { + if ( oToolbarItems == '/' ) + oToolbar = new FCKToolbarBreak() ; + } + else + { + oToolbar = new FCKToolbar() ; + + for ( var j = 0 ; j < oToolbarItems.length ; j++ ) + { + var sItem = oToolbarItems[j] ; + + if ( sItem == '-') + oToolbar.AddSeparator() ; + else + { + var oItem = FCKToolbarItems.GetItem( sItem ) ; + if ( oItem ) + { + oToolbar.AddItem( oItem ) ; + + this.Items.push( oItem ) ; + + if ( !oItem.SourceView ) + this.ItemsWysiwygOnly.push( oItem ) ; + + if ( oItem.ContextSensitive ) + this.ItemsContextSensitive.push( oItem ) ; + } + } + } + + // oToolbar.AddTerminator() ; + } + + oToolbar.Create( this._TargetElement ) ; + + this.Toolbars[ this.Toolbars.length ] = oToolbar ; + } + + FCKTools.DisableSelection( this._Document.getElementById( 'xCollapseHandle' ).parentNode ) ; + + if ( FCK.Status != FCK_STATUS_COMPLETE ) + FCK.Events.AttachEvent( 'OnStatusChange', this.RefreshModeState ) ; + else + this.RefreshModeState() ; + + this.IsLoaded = true ; + this.IsEnabled = true ; + + FCKTools.RunFunction( this.OnLoad ) ; +} + +FCKToolbarSet.prototype.Enable = function() +{ + if ( this.IsEnabled ) + return ; + + this.IsEnabled = true ; + + var aItems = this.Items ; + for ( var i = 0 ; i < aItems.length ; i++ ) + aItems[i].RefreshState() ; +} + +FCKToolbarSet.prototype.Disable = function() +{ + if ( !this.IsEnabled ) + return ; + + this.IsEnabled = false ; + + var aItems = this.Items ; + for ( var i = 0 ; i < aItems.length ; i++ ) + aItems[i].Disable() ; +} + +FCKToolbarSet.prototype.RefreshModeState = function( editorInstance ) +{ + if ( FCK.Status != FCK_STATUS_COMPLETE ) + return ; + + var oToolbarSet = editorInstance ? editorInstance.ToolbarSet : this ; + var aItems = oToolbarSet.ItemsWysiwygOnly ; + + if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ) + { + // Enable all buttons that are available on WYSIWYG mode only. + for ( var i = 0 ; i < aItems.length ; i++ ) + aItems[i].Enable() ; + + // Refresh the buttons state. + oToolbarSet.RefreshItemsState( editorInstance ) ; + } + else + { + // Refresh the buttons state. + oToolbarSet.RefreshItemsState( editorInstance ) ; + + // Disable all buttons that are available on WYSIWYG mode only. + for ( var i = 0 ; i < aItems.length ; i++ ) + aItems[i].Disable() ; + } +} + +FCKToolbarSet.prototype.RefreshItemsState = function( editorInstance ) +{ + + var aItems = ( editorInstance ? editorInstance.ToolbarSet : this ).ItemsContextSensitive ; + + for ( var i = 0 ; i < aItems.length ; i++ ) + aItems[i].RefreshState() ; +} diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fcktools.js b/phpgwapi/js/fckeditor/editor/_source/internals/fcktools.js new file mode 100644 index 0000000000..157da1ae8c --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fcktools.js @@ -0,0 +1,236 @@ +/* + * 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: fcktools.js + * Utility functions. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKTools = new Object() ; + +FCKTools.AppendStyleSheet = function( documentElement, cssFileUrlOrArray ) +{ + if ( typeof( cssFileUrlOrArray ) == 'string' ) + return this._AppendStyleSheet( documentElement, cssFileUrlOrArray ) ; + else + { + for ( var i = 0 ; i < cssFileUrlOrArray.length ; i++ ) + this._AppendStyleSheet( documentElement, cssFileUrlOrArray[i] ) ; + } +} + +/** + * Gets the value of the hidden INPUT element that is associated to the editor. + * This element has its ID set to the editor's instance name so the user refers + * to the instance name when getting the posted data. + */ +FCKTools.GetLinkedFieldValue = function() +{ + return FCK.LinkedField.value ; +} + +/** + * Attachs a function call to the submit event of the linked field form. This + * function us generally used to update the linked field value before + * submitting the form. + */ +FCKTools.AttachToLinkedFieldFormSubmit = function( functionPointer ) +{ + // Gets the linked field form + var oForm = FCK.LinkedField.form ; + + // Return now if no form is available + if (!oForm) return ; + + // Attaches the functionPointer call to the onsubmit event + if ( FCKBrowserInfo.IsIE ) + oForm.attachEvent( "onsubmit", functionPointer ) ; + else + oForm.addEventListener( 'submit', functionPointer, false ) ; + + //** + // Attaches the functionPointer call to the submit method + // This is done because IE doesn't fire onsubmit when the submit method is called + // BEGIN -- + + // Creates a Array in the form object that will hold all Attached function call + // (in the case there are more than one editor in the same page) + if (! oForm.updateFCKeditor) oForm.updateFCKeditor = new Array() ; + + // Adds the function pointer to the array of functions to call when "submit" is called + oForm.updateFCKeditor[oForm.updateFCKeditor.length] = functionPointer ; + + // Switches the original submit method with a new one that first call all functions + // on the above array and the call the original submit + // IE sees it oForm.submit function as an 'object'. + if (! oForm.originalSubmit && ( typeof( oForm.submit ) == 'function' || ( !oForm.submit.tagName && !oForm.submit.length ) ) ) + { + // Creates a copy of the original submit + oForm.originalSubmit = oForm.submit ; + + // Creates our replacement for the submit + oForm.submit = FCKTools_SubmitReplacer ; + } + // END -- +} + +function FCKTools_SubmitReplacer() +{ + if (this.updateFCKeditor) + { + // Calls all functions in the functions array + for (var i = 0 ; i < this.updateFCKeditor.length ; i++) + this.updateFCKeditor[i]() ; + } + // Calls the original "submit" + this.originalSubmit() ; +} + +// Get the window object where the element is placed in. +FCKTools.GetElementWindow = function( element ) +{ + return this.GetDocumentWindow( this.GetElementDocument( element ) ) ; +} + +FCKTools.GetDocumentWindow = function( doc ) +{ + // With Safari, there is not way to retrieve the window from the document, so we must fix it. + if ( FCKBrowserInfo.IsSafari && !doc.parentWindow ) + this.FixDocumentParentWindow( window.top ) ; + + return doc.parentWindow || doc.defaultView ; +} + +/* + This is a Safari specific function that fix the reference to the parent + window from the document object. +*/ +FCKTools.FixDocumentParentWindow = function( targetWindow ) +{ + targetWindow.document.parentWindow = targetWindow ; + + for ( var i = 0 ; i < targetWindow.frames.length ; i++ ) + FCKTools.FixDocumentParentWindow( targetWindow.frames[i] ) ; +} + +FCKTools.GetParentWindow = function( document ) +{ + return document.contentWindow ? document.contentWindow : document.parentWindow ; +} + +FCKTools.HTMLEncode = function( text ) +{ + if ( !text ) + return '' ; + + text = text.replace( /&/g, '&' ) ; + text = text.replace( //g, '>' ) ; + + return text ; +} + +/** + * Adds an option to a SELECT element. + */ +FCKTools.AddSelectOption = function( selectElement, optionText, optionValue ) +{ + var oOption = FCKTools.GetElementDocument( selectElement ).createElement( "OPTION" ) ; + + oOption.text = optionText ; + oOption.value = optionValue ; + + selectElement.options.add(oOption) ; + + return oOption ; +} + +FCKTools.RunFunction = function( func, thisObject, paramsArray, timerWindow ) +{ + if ( func ) + this.SetTimeout( func, 0, thisObject, paramsArray, timerWindow ) ; +} + +FCKTools.SetTimeout = function( func, milliseconds, thisObject, paramsArray, timerWindow ) +{ + return ( timerWindow || window ).setTimeout( + function() + { + if ( paramsArray ) + func.apply( thisObject, [].concat( paramsArray ) ) ; + else + func.apply( thisObject ) ; + }, + milliseconds ) ; +} + +FCKTools.SetInterval = function( func, milliseconds, thisObject, paramsArray, timerWindow ) +{ + return ( timerWindow || window ).setInterval( + function() + { + func.apply( thisObject, paramsArray || [] ) ; + }, + milliseconds ) ; +} + +FCKTools.ConvertStyleSizeToHtml = function( size ) +{ + return size.endsWith( '%' ) ? size : parseInt( size ) ; +} + +FCKTools.ConvertHtmlSizeToStyle = function( size ) +{ + return size.endsWith( '%' ) ? size : ( size + 'px' ) ; +} + +// START iCM MODIFICATIONS +// Amended to accept a list of one or more ascensor tag names +// Amended to check the element itself before working back up through the parent hierarchy +FCKTools.GetElementAscensor = function( element, ascensorTagNames ) +{ +// var e = element.parentNode ; + var e = element ; + var lstTags = "," + ascensorTagNames.toUpperCase() + "," ; + + while ( e ) + { + if ( lstTags.indexOf( "," + e.nodeName.toUpperCase() + "," ) != -1 ) + return e ; + + e = e.parentNode ; + } + return null ; +} +// END iCM MODIFICATIONS + +FCKTools.CreateEventListener = function( func, params ) +{ + var f = function() + { + var aAllParams = [] ; + + for ( var i = 0 ; i < arguments.length ; i++ ) + aAllParams.push( arguments[i] ) ; + + func.apply( this, aAllParams.concat( params ) ) ; + } + + return f ; +} + +FCKTools.GetElementDocument = function ( element ) +{ + return element.ownerDocument || element.document ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fcktools_gecko.js b/phpgwapi/js/fckeditor/editor/_source/internals/fcktools_gecko.js new file mode 100644 index 0000000000..718d492909 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fcktools_gecko.js @@ -0,0 +1,231 @@ +/* + * 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: fcktools_gecko.js + * Utility functions. (Gecko version). + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +// Constant for the Gecko Bogus Node. +var GECKO_BOGUS = FCKBrowserInfo.IsGecko ? '
' : '' ; + +FCKTools.CancelEvent = function( e ) +{ + if ( e ) + e.preventDefault() ; +} + +FCKTools.DisableSelection = function( element ) +{ + if ( FCKBrowserInfo.IsGecko ) + element.style.MozUserSelect = 'none' ; // Gecko only. + else + element.style.userSelect = 'none' ; // CSS3 (not supported yet). +} + +// Appends a CSS file to a document. +FCKTools._AppendStyleSheet = function( documentElement, cssFileUrl ) +{ + var e = documentElement.createElement( 'LINK' ) ; + e.rel = 'stylesheet' ; + e.type = 'text/css' ; + e.href = cssFileUrl ; + documentElement.getElementsByTagName("HEAD")[0].appendChild( e ) ; + return e ; +} + +// Removes all attributes and values from the element. +FCKTools.ClearElementAttributes = function( element ) +{ + // Loop throw all attributes in the element + for ( var i = 0 ; i < element.attributes.length ; i++ ) + { + // Remove the element by name. + element.removeAttribute( element.attributes[i].name, 0 ) ; // 0 : Case Insensitive + } +} + +// Returns an Array of strings with all defined in the elements inside another element. +FCKTools.GetAllChildrenIds = function( parentElement ) +{ + // Create the array that will hold all Ids. + var aIds = new Array() ; + + // Define a recursive function that search for the Ids. + var fGetIds = function( parent ) + { + for ( var i = 0 ; i < parent.childNodes.length ; i++ ) + { + var sId = parent.childNodes[i].id ; + + // Check if the Id is defined for the element. + if ( sId && sId.length > 0 ) aIds[ aIds.length ] = sId ; + + // Recursive call. + fGetIds( parent.childNodes[i] ) ; + } + } + + // Start the recursive calls. + fGetIds( parentElement ) ; + + return aIds ; +} + +FCKTools.RemoveOuterTags = function( e ) +{ + var oFragment = e.ownerDocument.createDocumentFragment() ; + + for ( var i = 0 ; i < e.childNodes.length ; i++ ) + oFragment.appendChild( e.childNodes[i] ) ; + + e.parentNode.replaceChild( oFragment, e ) ; +} + +FCKTools.CreateXmlObject = function( object ) +{ + switch ( object ) + { + case 'XmlHttp' : + return new XMLHttpRequest() ; + case 'DOMDocument' : + return document.implementation.createDocument( '', '', null ) ; + } + return null ; +} + +FCKTools.GetScrollPosition = function( relativeWindow ) +{ + return { X : relativeWindow.pageXOffset, Y : relativeWindow.pageYOffset } ; +} + +FCKTools.AddEventListener = function( sourceObject, eventName, listener ) +{ + sourceObject.addEventListener( eventName, listener, false ) ; +} + +FCKTools.RemoveEventListener = function( sourceObject, eventName, listener ) +{ + sourceObject.removeEventListener( eventName, listener, false ) ; +} + +// Listeners attached with this function cannot be detached. +FCKTools.AddEventListenerEx = function( sourceObject, eventName, listener, paramsArray ) +{ + sourceObject.addEventListener( + eventName, + function( e ) + { + listener.apply( sourceObject, [ e ].concat( paramsArray || [] ) ) ; + }, + false + ) ; +} + +// Returns and object with the "Width" and "Height" properties. +FCKTools.GetViewPaneSize = function( win ) +{ + return { Width : win.innerWidth, Height : win.innerHeight } ; +} + +FCKTools.SaveStyles = function( element ) +{ + var oSavedStyles = new Object() ; + + if ( element.className.length > 0 ) + { + oSavedStyles.Class = element.className ; + element.className = '' ; + } + + var sInlineStyle = element.getAttribute( 'style' ) ; + + if ( sInlineStyle && sInlineStyle.length > 0 ) + { + oSavedStyles.Inline = sInlineStyle ; + element.setAttribute( 'style', '', 0 ) ; // 0 : Case Insensitive + } + + return oSavedStyles ; +} + +FCKTools.RestoreStyles = function( element, savedStyles ) +{ + element.className = savedStyles.Class || '' ; + + if ( savedStyles.Inline ) + element.setAttribute( 'style', savedStyles.Inline, 0 ) ; // 0 : Case Insensitive + else + element.removeAttribute( 'style', 0 ) ; +} + +FCKTools.RegisterDollarFunction = function( targetWindow ) +{ + targetWindow.$ = function( id ) + { + return this.document.getElementById( id ) ; + } ; +} + +FCKTools.AppendElement = function( target, elementName ) +{ + return target.appendChild( target.ownerDocument.createElement( elementName ) ) ; +} + +// Get the coordinates of an element. +// @el : The element to get the position. +// @relativeWindow: The window to which we want the coordinates relative to. +FCKTools.GetElementPosition = function( el, relativeWindow ) +{ + // Initializes the Coordinates object that will be returned by the function. + var c = { X:0, Y:0 } ; + + var oWindow = relativeWindow || window ; + + var oOwnerWindow = FCKTools.GetElementWindow( el ) ; + + // Loop throw the offset chain. + while ( el ) + { + var sPosition = oOwnerWindow.getComputedStyle(el, '').position ; + + // Check for non "static" elements. + // 'FCKConfig.FloatingPanelsZIndex' -- Submenus are under a positioned IFRAME. + if ( sPosition && sPosition != 'static' && el.style.zIndex != FCKConfig.FloatingPanelsZIndex ) + break ; + + c.X += el.offsetLeft - el.scrollLeft ; + c.Y += el.offsetTop - el.scrollTop ; + + if ( el.offsetParent ) + el = el.offsetParent ; + else + { + if ( oOwnerWindow != oWindow ) + { + if ( el = oOwnerWindow.frameElement ) + oOwnerWindow = FCKTools.GetElementWindow( el ) ; + } + else + { + c.X += el.scrollLeft ; + c.Y += el.scrollTop ; + break ; + } + } + } + + // Return the Coordinates object + return c ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fcktools_ie.js b/phpgwapi/js/fckeditor/editor/_source/internals/fcktools_ie.js new file mode 100644 index 0000000000..641dae9078 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fcktools_ie.js @@ -0,0 +1,202 @@ +/* + * 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: fcktools_ie.js + * Utility functions. (IE version). + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +FCKTools.CancelEvent = function( e ) +{ + return false ; +} + +// Appends one or more CSS files to a document. +FCKTools._AppendStyleSheet = function( documentElement, cssFileUrl ) +{ + return documentElement.createStyleSheet( cssFileUrl ).owningElement ; +} + +// Removes all attributes and values from the element. +FCKTools.ClearElementAttributes = function( element ) +{ + element.clearAttributes() ; +} + +FCKTools.GetAllChildrenIds = function( parentElement ) +{ + var aIds = new Array() ; + for ( var i = 0 ; i < parentElement.all.length ; i++ ) + { + var sId = parentElement.all[i].id ; + if ( sId && sId.length > 0 ) + aIds[ aIds.length ] = sId ; + } + return aIds ; +} + +FCKTools.RemoveOuterTags = function( e ) +{ + e.insertAdjacentHTML( 'beforeBegin', e.innerHTML ) ; + e.parentNode.removeChild( e ) ; +} + +FCKTools.CreateXmlObject = function( object ) +{ + var aObjs ; + + switch ( object ) + { + case 'XmlHttp' : + aObjs = [ 'MSXML2.XmlHttp', 'Microsoft.XmlHttp' ] ; + break ; + + case 'DOMDocument' : + aObjs = [ 'MSXML2.DOMDocument', 'Microsoft.XmlDom' ] ; + break ; + } + + for ( var i = 0 ; i < 2 ; i++ ) + { + try { return new ActiveXObject( aObjs[i] ) ; } + catch (e) + {} + } + + if ( FCKLang.NoActiveX ) + { + alert( FCKLang.NoActiveX ) ; + FCKLang.NoActiveX = null ; + } +} + +FCKTools.DisableSelection = function( element ) +{ + element.unselectable = 'on' ; + + var e, i = 0 ; + while ( e = element.all[ i++ ] ) + { + switch ( e.tagName ) + { + case 'IFRAME' : + case 'TEXTAREA' : + case 'INPUT' : + case 'SELECT' : + /* Ignore the above tags */ + break ; + default : + e.unselectable = 'on' ; + } + } +} + +FCKTools.GetScrollPosition = function( relativeWindow ) +{ + var oDoc = relativeWindow.document ; + + // Try with the doc element. + var oPos = { X : oDoc.documentElement.scrollLeft, Y : oDoc.documentElement.scrollTop } ; + + if ( oPos.X > 0 || oPos.Y > 0 ) + return oPos ; + + // If no scroll, try with the body. + return { X : oDoc.body.scrollLeft, Y : oDoc.body.scrollTop } ; +} + +FCKTools.AddEventListener = function( sourceObject, eventName, listener ) +{ + sourceObject.attachEvent( 'on' + eventName, listener ) ; +} + +FCKTools.RemoveEventListener = function( sourceObject, eventName, listener ) +{ + sourceObject.detachEvent( 'on' + eventName, listener ) ; +} + +// Listeners attached with this function cannot be detached. +FCKTools.AddEventListenerEx = function( sourceObject, eventName, listener, paramsArray ) +{ + // Ok... this is a closures party, but is the only way to make it clean of memory leaks. + var o = new Object() ; + o.Source = sourceObject ; + o.Params = paramsArray || [] ; // Memory leak if we have DOM objects here. + o.Listener = function( ev ) + { + return listener.apply( o.Source, [ ev ].concat( o.Params ) ) ; + } + + if ( FCK.IECleanup ) + FCK.IECleanup.AddItem( null, function() { o.Source = null ; o.Params = null ; } ) ; + + sourceObject.attachEvent( 'on' + eventName, o.Listener ) ; + + sourceObject = null ; // Memory leak cleaner (because of the above closure). + paramsArray = null ; // Memory leak cleaner (because of the above closure). +} + +// Returns and object with the "Width" and "Height" properties. +FCKTools.GetViewPaneSize = function( win ) +{ + var oSizeSource ; + + var oDoc = win.document.documentElement ; + if ( oDoc && oDoc.clientWidth ) // IE6 Strict Mode + oSizeSource = oDoc ; + else + oSizeSource = top.document.body ; // Other IEs + + if ( oSizeSource ) + return { Width : oSizeSource.clientWidth, Height : oSizeSource.clientHeight } ; + else + return { Width : 0, Height : 0 } ; +} + +FCKTools.SaveStyles = function( element ) +{ + var oSavedStyles = new Object() ; + + if ( element.className.length > 0 ) + { + oSavedStyles.Class = element.className ; + element.className = '' ; + } + + var sInlineStyle = element.style.cssText ; + + if ( sInlineStyle.length > 0 ) + { + oSavedStyles.Inline = sInlineStyle ; + element.style.cssText = '' ; + } + + return oSavedStyles ; +} + +FCKTools.RestoreStyles = function( element, savedStyles ) +{ + element.className = savedStyles.Class || '' ; + element.style.cssText = savedStyles.Inline || '' ; +} + +FCKTools.RegisterDollarFunction = function( targetWindow ) +{ + targetWindow.$ = targetWindow.document.getElementById ; +} + +FCKTools.AppendElement = function( target, elementName ) +{ + return target.appendChild( this.GetElementDocument( target ).createElement( elementName ) ) ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fckundo_gecko.js b/phpgwapi/js/fckeditor/editor/_source/internals/fckundo_gecko.js new file mode 100644 index 0000000000..73f8473a0d --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fckundo_gecko.js @@ -0,0 +1,23 @@ +/* + * 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: fckundo_gecko.js + * Fake implementation to ignore calls on Gecko. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKUndo = new Object() ; + +FCKUndo.SaveUndoStep = function() +{} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fckundo_ie.js b/phpgwapi/js/fckeditor/editor/_source/internals/fckundo_ie.js new file mode 100644 index 0000000000..df08b12b54 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fckundo_ie.js @@ -0,0 +1,119 @@ +/* + * 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: fckundo_ie.js + * IE specific implementation for the Undo/Redo system. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKUndo = new Object() ; + +FCKUndo.SavedData = new Array() ; +FCKUndo.CurrentIndex = -1 ; +FCKUndo.TypesCount = FCKUndo.MaxTypes = 25 ; +FCKUndo.Typing = false ; + +FCKUndo.SaveUndoStep = function() +{ + if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) + return ; + + // Shrink the array to the current level. + FCKUndo.SavedData = FCKUndo.SavedData.slice( 0, FCKUndo.CurrentIndex + 1 ) ; + + // Get the Actual HTML. + var sHtml = FCK.EditorDocument.body.innerHTML ; + + // Cancel operation if the new step is identical to the previous one. + if ( FCKUndo.CurrentIndex >= 0 && sHtml == FCKUndo.SavedData[ FCKUndo.CurrentIndex ][0] ) + return ; + + // If we reach the Maximun number of undo levels, we must remove the first + // entry of the list shifting all elements. + if ( FCKUndo.CurrentIndex + 1 >= FCKConfig.MaxUndoLevels ) + FCKUndo.SavedData.shift() ; + else + FCKUndo.CurrentIndex++ ; + + // Get the actual selection. + var sBookmark ; + if ( FCK.EditorDocument.selection.type == 'Text' ) + sBookmark = FCK.EditorDocument.selection.createRange().getBookmark() ; + + // Save the new level in front of the actual position. + FCKUndo.SavedData[ FCKUndo.CurrentIndex ] = [ sHtml, sBookmark ] ; + + FCK.Events.FireEvent( "OnSelectionChange" ) ; +} + +FCKUndo.CheckUndoState = function() +{ + return ( FCKUndo.Typing || FCKUndo.CurrentIndex > 0 ) ; +} + +FCKUndo.CheckRedoState = function() +{ + return ( !FCKUndo.Typing && FCKUndo.CurrentIndex < ( FCKUndo.SavedData.length - 1 ) ) ; +} + +FCKUndo.Undo = function() +{ + if ( FCKUndo.CheckUndoState() ) + { + // If it is the first step. + if ( FCKUndo.CurrentIndex == ( FCKUndo.SavedData.length - 1 ) ) + { + // Save the actual state for a possible "Redo" call. + FCKUndo.SaveUndoStep() ; + } + + // Go a step back. + FCKUndo._ApplyUndoLevel( --FCKUndo.CurrentIndex ) ; + + FCK.Events.FireEvent( "OnSelectionChange" ) ; + } +} + +FCKUndo.Redo = function() +{ + if ( FCKUndo.CheckRedoState() ) + { + // Go a step forward. + FCKUndo._ApplyUndoLevel( ++FCKUndo.CurrentIndex ) ; + + FCK.Events.FireEvent( "OnSelectionChange" ) ; + } +} + +FCKUndo._ApplyUndoLevel = function(level) +{ + var oData = FCKUndo.SavedData[ level ] ; + + if ( !oData ) + return ; + + // Update the editor contents with that step data. + FCK.SetInnerHtml( oData[0] ) ; +// FCK.EditorDocument.body.innerHTML = oData[0] ; + + if ( oData[1] ) + { + var oRange = FCK.EditorDocument.selection.createRange() ; + oRange.moveToBookmark( oData[1] ) ; + oRange.select() ; + } + + FCKUndo.TypesCount = 0 ; + FCKUndo.Typing = false ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fckurlparams.js b/phpgwapi/js/fckeditor/editor/_source/internals/fckurlparams.js new file mode 100644 index 0000000000..56a398d5c0 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fckurlparams.js @@ -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: fckurlparams.js + * Defines the FCKURLParams object that is used to get all parameters + * passed by the URL QueryString (after the "?"). + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +// #### URLParams: holds all URL passed parameters (like ?Param1=Value1&Param2=Value2) +var FCKURLParams = new Object() ; + +var aParams = document.location.search.substr(1).split('&') ; +for ( var i = 0 ; i < aParams.length ; i++ ) +{ + var aParam = aParams[i].split('=') ; + var sParamName = aParam[0] ; + var sParamValue = aParam[1] ; + + FCKURLParams[ sParamName ] = sParamValue ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fckxhtml.js b/phpgwapi/js/fckeditor/editor/_source/internals/fckxhtml.js new file mode 100644 index 0000000000..8307dc654b --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fckxhtml.js @@ -0,0 +1,390 @@ +/* + * 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: fckxhtml.js + * Defines the FCKXHtml object, responsible for the XHTML operations. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +var FCKXHtml = new Object() ; + +FCKXHtml.CurrentJobNum = 0 ; + +FCKXHtml.GetXHTML = function( node, includeNode, format ) +{ + FCKXHtmlEntities.Initialize() ; + + // Save the current IsDirty state. The XHTML processor may change the + // original HTML, dirtying it. + var bIsDirty = FCK.IsDirty() ; + + this._CreateNode = FCKConfig.ForceStrongEm ? FCKXHtml_CreateNode_StrongEm : FCKXHtml_CreateNode_Normal ; + + // Special blocks are blocks of content that remain untouched during the + // process. It is used for SCRIPTs and STYLEs. + FCKXHtml.SpecialBlocks = new Array() ; + + // Create the XML DOMDocument object. + this.XML = FCKTools.CreateXmlObject( 'DOMDocument' ) ; + + // Add a root element that holds all child nodes. + this.MainNode = this.XML.appendChild( this.XML.createElement( 'xhtml' ) ) ; + + FCKXHtml.CurrentJobNum++ ; + + if ( includeNode ) + this._AppendNode( this.MainNode, node ) ; + else + this._AppendChildNodes( this.MainNode, node, false ) ; + + // Get the resulting XHTML as a string. + var sXHTML = this._GetMainXmlString() ; + + this.XML = null ; + + // Strip the "XHTML" root node. + sXHTML = sXHTML.substr( 7, sXHTML.length - 15 ).trim() ; + + // Remove the trailing
added by Gecko. + if ( FCKBrowserInfo.IsGecko ) + sXHTML = sXHTML.replace( /
$/, '' ) ; + + // Add a space in the tags with no closing tags, like
->
+ sXHTML = sXHTML.replace( FCKRegexLib.SpaceNoClose, ' />'); + + if ( FCKConfig.ForceSimpleAmpersand ) + sXHTML = sXHTML.replace( FCKRegexLib.ForceSimpleAmpersand, '&' ) ; + + if ( format ) + sXHTML = FCKCodeFormatter.Format( sXHTML ) ; + + // Now we put back the SpecialBlocks contents. + for ( var i = 0 ; i < FCKXHtml.SpecialBlocks.length ; i++ ) + { + var oRegex = new RegExp( '___FCKsi___' + i ) ; + sXHTML = sXHTML.replace( oRegex, FCKXHtml.SpecialBlocks[i] ) ; + } + + // Replace entities marker with the ampersand. + sXHTML = sXHTML.replace( FCKRegexLib.GeckoEntitiesMarker, '&' ) ; + + // Restore the IsDirty state if it was not dirty. + if ( !bIsDirty ) + FCK.ResetIsDirty() ; + + return sXHTML +} + +FCKXHtml._AppendAttribute = function( xmlNode, attributeName, attributeValue ) +{ + if ( FCKConfig.ForceSimpleAmpersand && attributeValue.replace ) + attributeValue = attributeValue.replace( /&/g, '___FCKAmp___' ) ; + + try + { + // Create the attribute. + var oXmlAtt = this.XML.createAttribute( attributeName ) ; + + oXmlAtt.value = attributeValue ? attributeValue : '' ; + + // Set the attribute in the node. + xmlNode.attributes.setNamedItem( oXmlAtt ) ; + } + catch (e) + {} +} + +FCKXHtml._AppendChildNodes = function( xmlNode, htmlNode, isBlockElement ) +{ + var iCount = 0 ; + + var oNode = htmlNode.firstChild ; + + while ( oNode ) + { + if ( this._AppendNode( xmlNode, oNode ) ) + iCount++ ; + + oNode = oNode.nextSibling ; + } + + if ( iCount == 0 ) + { + if ( isBlockElement && FCKConfig.FillEmptyBlocks ) + { + this._AppendEntity( xmlNode, 'nbsp' ) ; + return ; + } + + // We can't use short representation of empty elements that are not marked + // as empty in th XHTML DTD. + if ( !FCKRegexLib.EmptyElements.test( htmlNode.nodeName ) ) + xmlNode.appendChild( this.XML.createTextNode('') ) ; + } +} + +FCKXHtml._AppendNode = function( xmlNode, htmlNode ) +{ + if ( !htmlNode ) + return ; + + switch ( htmlNode.nodeType ) + { + // Element Node. + case 1 : + + // Here we found an element that is not the real element, but a + // fake one (like the Flash placeholder image), so we must get the real one. + if ( htmlNode.getAttribute('_fckfakelement') ) + return FCKXHtml._AppendNode( xmlNode, FCK.GetRealElement( htmlNode ) ) ; + + // Mozilla insert custom nodes in the DOM. + if ( FCKBrowserInfo.IsGecko && htmlNode.hasAttribute('_moz_editor_bogus_node') ) + return false ; + + // This is for elements that are instrumental to FCKeditor and + // must be removed from the final HTML. + if ( htmlNode.getAttribute('_fcktemp') ) + return false ; + + // Get the element name. + var sNodeName = htmlNode.nodeName ; + + //Add namespace: + if ( FCKBrowserInfo.IsIE && htmlNode.scopeName && htmlNode.scopeName != 'HTML' && htmlNode.scopeName != 'FCK' ) + sNodeName = htmlNode.scopeName + ':' + sNodeName ; + + // Check if the node name is valid, otherwise ignore this tag. + // If the nodeName starts with a slash, it is a orphan closing tag. + // On some strange cases, the nodeName is empty, even if the node exists. + if ( !FCKRegexLib.ElementName.test( sNodeName ) ) + return false ; + + sNodeName = sNodeName.toLowerCase() ; + + if ( FCKBrowserInfo.IsGecko && sNodeName == 'br' && htmlNode.hasAttribute('type') && htmlNode.getAttribute( 'type', 2 ) == '_moz' ) + return false ; + + // The already processed nodes must be marked to avoid then to be duplicated (bad formatted HTML). + // So here, the "mark" is checked... if the element is Ok, then mark it. + if ( htmlNode._fckxhtmljob && htmlNode._fckxhtmljob == FCKXHtml.CurrentJobNum ) + return false ; + + var oNode = this._CreateNode( sNodeName ) ; + + // Add all attributes. + FCKXHtml._AppendAttributes( xmlNode, htmlNode, oNode, sNodeName ) ; + + htmlNode._fckxhtmljob = FCKXHtml.CurrentJobNum ; + + // Tag specific processing. + var oTagProcessor = FCKXHtml.TagProcessors[ sNodeName ] ; + + if ( oTagProcessor ) + { + oNode = oTagProcessor( oNode, htmlNode, xmlNode ) ; + if ( !oNode ) break ; + } + else + this._AppendChildNodes( oNode, htmlNode, FCKRegexLib.BlockElements.test( sNodeName ) ) ; + + xmlNode.appendChild( oNode ) ; + + break ; + + // Text Node. + case 3 : + this._AppendTextNode( xmlNode, htmlNode.nodeValue.replaceNewLineChars(' ') ) ; + break ; + + // Comment + case 8 : + // IE catches the as a comment, but it has no + // innerHTML, so we can catch it, and ignore it. + if ( FCKBrowserInfo.IsIE && !htmlNode.innerHTML ) + break ; + + try { xmlNode.appendChild( this.XML.createComment( htmlNode.nodeValue ) ) ; } + catch (e) { /* Do nothing... probably this is a wrong format comment. */ } + break ; + + // Unknown Node type. + default : + xmlNode.appendChild( this.XML.createComment( "Element not supported - Type: " + htmlNode.nodeType + " Name: " + htmlNode.nodeName ) ) ; + break ; + } + return true ; +} + +function FCKXHtml_CreateNode_StrongEm( nodeName ) +{ + switch ( nodeName ) + { + case 'b' : + nodeName = 'strong' ; + break ; + case 'i' : + nodeName = 'em' ; + break ; + } + return this.XML.createElement( nodeName ) ; +} + +function FCKXHtml_CreateNode_Normal( nodeName ) +{ + return this.XML.createElement( nodeName ) ; +} + +// Append an item to the SpecialBlocks array and returns the tag to be used. +FCKXHtml._AppendSpecialItem = function( item ) +{ + return '___FCKsi___' + FCKXHtml.SpecialBlocks.AddItem( item ) ; +} + +FCKXHtml._AppendEntity = function( xmlNode, entity ) +{ + xmlNode.appendChild( this.XML.createTextNode( '#?-:' + entity + ';' ) ) ; +} + +FCKXHtml._AppendTextNode = function( targetNode, textValue ) +{ + targetNode.appendChild( this.XML.createTextNode( textValue.replace( FCKXHtmlEntities.EntitiesRegex, FCKXHtml_GetEntity ) ) ) ; + return ; +} + +// Retrieves a entity (internal format) for a given character. +function FCKXHtml_GetEntity( character ) +{ + // We cannot simply place the entities in the text, because the XML parser + // will translate & to &. So we use a temporary marker which is replaced + // in the end of the processing. + var sEntity = FCKXHtmlEntities.Entities[ character ] || ( '#' + character.charCodeAt(0) ) ; + return '#?-:' + sEntity + ';' ; +} + +// An object that hold tag specific operations. +FCKXHtml.TagProcessors = new Object() ; + +FCKXHtml.TagProcessors['img'] = function( node, htmlNode ) +{ + // The "ALT" attribute is required in XHTML. + if ( ! node.attributes.getNamedItem( 'alt' ) ) + FCKXHtml._AppendAttribute( node, 'alt', '' ) ; + + var sSavedUrl = htmlNode.getAttribute( '_fcksavedurl' ) ; + if ( sSavedUrl != null ) + FCKXHtml._AppendAttribute( node, 'src', sSavedUrl ) ; + + return node ; +} + +FCKXHtml.TagProcessors['a'] = function( node, htmlNode ) +{ + var sSavedUrl = htmlNode.getAttribute( '_fcksavedurl' ) ; + if ( sSavedUrl != null ) + FCKXHtml._AppendAttribute( node, 'href', sSavedUrl ) ; + + FCKXHtml._AppendChildNodes( node, htmlNode, false ) ; + + // Firefox may create empty tags when deleting the selection in some special cases (SF-BUG 1556878). + if ( node.childNodes.length == 0 && !node.getAttribute( 'name' ) ) + return false ; + + return node ; +} + +FCKXHtml.TagProcessors['script'] = function( node, htmlNode ) +{ + // The "TYPE" attribute is required in XHTML. + if ( ! node.attributes.getNamedItem( 'type' ) ) + FCKXHtml._AppendAttribute( node, 'type', 'text/javascript' ) ; + + node.appendChild( FCKXHtml.XML.createTextNode( FCKXHtml._AppendSpecialItem( htmlNode.text ) ) ) ; + + return node ; +} + +FCKXHtml.TagProcessors['style'] = function( node, htmlNode ) +{ + // The "TYPE" attribute is required in XHTML. + if ( ! node.attributes.getNamedItem( 'type' ) ) + FCKXHtml._AppendAttribute( node, 'type', 'text/css' ) ; + + node.appendChild( FCKXHtml.XML.createTextNode( FCKXHtml._AppendSpecialItem( htmlNode.innerHTML ) ) ) ; + + return node ; +} + +FCKXHtml.TagProcessors['title'] = function( node, htmlNode ) +{ + node.appendChild( FCKXHtml.XML.createTextNode( FCK.EditorDocument.title ) ) ; + + return node ; +} + +FCKXHtml.TagProcessors['table'] = function( node, htmlNode ) +{ + // There is a trick to show table borders when border=0. We add to the + // table class the FCK__ShowTableBorders rule. So now we must remove it. + + var oClassAtt = node.attributes.getNamedItem( 'class' ) ; + + if ( oClassAtt && FCKRegexLib.TableBorderClass.test( oClassAtt.nodeValue ) ) + { + var sClass = oClassAtt.nodeValue.replace( FCKRegexLib.TableBorderClass, '' ) ; + + if ( sClass.length == 0 ) + node.attributes.removeNamedItem( 'class' ) ; + else + FCKXHtml._AppendAttribute( node, 'class', sClass ) ; + } + + FCKXHtml._AppendChildNodes( node, htmlNode, false ) ; + + return node ; +} + +// Fix nestedand
. +FCKXHtml.TagProcessors['ol'] = FCKXHtml.TagProcessors['ul'] = function( node, htmlNode, targetNode ) +{ + if ( htmlNode.innerHTML.trim().length == 0 ) + return ; + + var ePSibling = targetNode.lastChild ; + + if ( ePSibling && ePSibling.nodeType == 3 ) + ePSibling = ePSibling.previousSibling ; + + if ( ePSibling && ePSibling.nodeName.toUpperCase() == 'LI' ) + { + htmlNode._fckxhtmljob = null ; + FCKXHtml._AppendNode( ePSibling, htmlNode ) ; + return ; + } + + FCKXHtml._AppendChildNodes( node, htmlNode ) ; + + return node ; +} + +FCKXHtml.TagProcessors['span'] = function( node, htmlNode ) +{ + // Firefox may create empty tags when deleting the selection in some special cases (SF-BUG 1084404). + if ( htmlNode.innerHTML.length == 0 ) + return false ; + + FCKXHtml._AppendChildNodes( node, htmlNode, false ) ; + + return node ; +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fckxhtml_gecko.js b/phpgwapi/js/fckeditor/editor/_source/internals/fckxhtml_gecko.js new file mode 100644 index 0000000000..d1ee68a69b --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fckxhtml_gecko.js @@ -0,0 +1,62 @@ +/* + * 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: fckxhtml_gecko.js + * Defines the FCKXHtml object, responsible for the XHTML operations. + * Gecko specific. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +FCKXHtml._GetMainXmlString = function() +{ + // Create the XMLSerializer. + var oSerializer = new XMLSerializer() ; + + // Return the serialized XML as a string. + return oSerializer.serializeToString( this.MainNode ) ; +} + +FCKXHtml._AppendAttributes = function( xmlNode, htmlNode, node ) +{ + var aAttributes = htmlNode.attributes ; + + for ( var n = 0 ; n < aAttributes.length ; n++ ) + { + var oAttribute = aAttributes[n] ; + + if ( oAttribute.specified ) + { + var sAttName = oAttribute.nodeName.toLowerCase() ; + var sAttValue ; + + // Ignore any attribute starting with "_fck". + if ( sAttName.startsWith( '_fck' ) ) + continue ; + // There is a bug in Mozilla that returns '_moz_xxx' attributes as specified. + else if ( sAttName.indexOf( '_moz' ) == 0 ) + continue ; + // There are one cases (on Gecko) when the oAttribute.nodeValue must be used: + // - for the "class" attribute + else if ( sAttName == 'class' ) + sAttValue = oAttribute.nodeValue ; + // XHTML doens't support attribute minimization like "CHECKED". It must be trasformed to cheched="checked". + else if ( oAttribute.nodeValue === true ) + sAttValue = sAttName ; + else + sAttValue = htmlNode.getAttribute( sAttName, 2 ) ; // We must use getAttribute to get it exactly as it is defined. + + this._AppendAttribute( node, sAttName, sAttValue ) ; + } + } +} \ No newline at end of file diff --git a/phpgwapi/js/fckeditor/editor/_source/internals/fckxhtml_ie.js b/phpgwapi/js/fckeditor/editor/_source/internals/fckxhtml_ie.js new file mode 100644 index 0000000000..ec5185b350 --- /dev/null +++ b/phpgwapi/js/fckeditor/editor/_source/internals/fckxhtml_ie.js @@ -0,0 +1,184 @@ +/* + * 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: fckxhtml_ie.js + * Defines the FCKXHtml object, responsible for the XHTML operations. + * IE specific. + * + * File Authors: + * Frederico Caldeira Knabben (fredck@fckeditor.net) + */ + +FCKXHtml._GetMainXmlString = function() +{ + return this.MainNode.xml ; +} + +FCKXHtml._AppendAttributes = function( xmlNode, htmlNode, node, nodeName ) +{ + var aAttributes = htmlNode.attributes ; + + for ( var n = 0 ; n < aAttributes.length ; n++ ) + { + var oAttribute = aAttributes[n] ; + + if ( oAttribute.specified ) + { + var sAttName = oAttribute.nodeName.toLowerCase() ; + var sAttValue ; + + // Ignore any attribute starting with "_fck". + if ( sAttName.startsWith( '_fck' ) ) + continue ; + // The following must be done because of a bug on IE regarding the style + // attribute. It returns "null" for the nodeValue. + else if ( sAttName == 'style' ) + sAttValue = htmlNode.style.cssText ; + // There are two cases when the oAttribute.nodeValue must be used: + // - for the "class" attribute + // - for events attributes (on IE only). + else if ( sAttName == 'class' || sAttName.indexOf('on') == 0 ) + sAttValue = oAttribute.nodeValue ; + else if ( nodeName == 'body' && sAttName == 'contenteditable' ) + continue ; + // XHTML doens't support attribute minimization like "CHECKED". It must be trasformed to cheched="checked". + else if ( oAttribute.nodeValue === true ) + sAttValue = sAttName ; + // We must use getAttribute to get it exactly as it is defined. + else if ( ! (sAttValue = htmlNode.getAttribute( sAttName, 2 ) ) ) + sAttValue = oAttribute.nodeValue ; + + this._AppendAttribute( node, sAttName, sAttValue ) ; + } + } +} + +FCKXHtml.TagProcessors['meta'] = function( node, htmlNode ) +{ + var oHttpEquiv = node.attributes.getNamedItem( 'http-equiv' ) ; + + if ( oHttpEquiv == null || oHttpEquiv.value.length == 0 ) + { + // Get the http-equiv value from the outerHTML. + var sHttpEquiv = htmlNode.outerHTML.match( FCKRegexLib.MetaHttpEquiv ) ; + + if ( sHttpEquiv ) + { + sHttpEquiv = sHttpEquiv[1] ; + FCKXHtml._AppendAttribute( node, 'http-equiv', sHttpEquiv ) ; + } + } + + return node ; +} + +// IE automaticaly changes tags to . +FCKXHtml.TagProcessors['font'] = function( node, htmlNode ) +{ + if ( node.attributes.length == 0 ) + node = FCKXHtml.XML.createDocumentFragment() ; + + FCKXHtml._AppendChildNodes( node, htmlNode ) ; + + return node ; +} + +// IE doens't see the value attribute as an attribute for the tag. +FCKXHtml.TagProcessors['input'] = function( node, htmlNode ) +{ + if ( htmlNode.name ) + FCKXHtml._AppendAttribute( node, 'name', htmlNode.name ) ; + + if ( htmlNode.value && !node.attributes.getNamedItem( 'value' ) ) + FCKXHtml._AppendAttribute( node, 'value', htmlNode.value ) ; + + if ( !node.attributes.getNamedItem( 'type' ) ) + FCKXHtml._AppendAttribute( node, 'type', 'text' ) ; + + return node ; +} + +// IE ignores the "SELECTED" attribute so we must add it manually. +FCKXHtml.TagProcessors['option'] = function( node, htmlNode ) +{ + if ( htmlNode.selected && !node.attributes.getNamedItem( 'selected' ) ) + FCKXHtml._AppendAttribute( node, 'selected', 'selected' ) ; + + FCKXHtml._AppendChildNodes( node, htmlNode ) ; + + return node ; +} + +// IE ignores the "COORDS" and "SHAPE" attribute so we must add it manually. +FCKXHtml.TagProcessors['area'] = function( node, htmlNode ) +{ + if ( ! node.attributes.getNamedItem( 'coords' ) ) + { + var sCoords = htmlNode.getAttribute( 'coords', 2 ) ; + if ( sCoords && sCoords != '0,0,0' ) + FCKXHtml._AppendAttribute( node, 'coords', sCoords ) ; + } + + if ( ! node.attributes.getNamedItem( 'shape' ) ) + { + var sCoords = htmlNode.getAttribute( 'shape', 2 ) ; + if ( sCoords && sCoords.length > 0 ) + FCKXHtml._AppendAttribute( node, 'shape', sCoords ) ; + } + + return node ; +} + +FCKXHtml.TagProcessors['label'] = function( node, htmlNode ) +{ + if ( htmlNode.htmlFor.length > 0 ) + FCKXHtml._AppendAttribute( node, 'for', htmlNode.htmlFor ) ; + + FCKXHtml._AppendChildNodes( node, htmlNode ) ; + + return node ; +} + +FCKXHtml.TagProcessors['form'] = function( node, htmlNode ) +{ + if ( htmlNode.acceptCharset && htmlNode.acceptCharset.length > 0 && htmlNode.acceptCharset != 'UNKNOWN' ) + FCKXHtml._AppendAttribute( node, 'accept-charset', htmlNode.acceptCharset ) ; + + if ( htmlNode.name ) + FCKXHtml._AppendAttribute( node, 'name', htmlNode.name ) ; + + FCKXHtml._AppendChildNodes( node, htmlNode ) ; + + return node ; +} + +// IE doens't hold the name attribute as an attribute for the