import rt 3.8.7
[freeside.git] / rt / share / html / NoAuth / RichText / FCKeditor / editor / _source / classes / fcktoolbarspecialcombo.js
diff --git a/rt/share/html/NoAuth/RichText/FCKeditor/editor/_source/classes/fcktoolbarspecialcombo.js b/rt/share/html/NoAuth/RichText/FCKeditor/editor/_source/classes/fcktoolbarspecialcombo.js
new file mode 100644 (file)
index 0000000..c5ea580
--- /dev/null
@@ -0,0 +1,146 @@
+/*\r
+ * FCKeditor - The text editor for Internet - http://www.fckeditor.net\r
+ * Copyright (C) 2003-2009 Frederico Caldeira Knabben\r
+ *\r
+ * == BEGIN LICENSE ==\r
+ *\r
+ * Licensed under the terms of any of the following licenses at your\r
+ * choice:\r
+ *\r
+ *  - GNU General Public License Version 2 or later (the "GPL")\r
+ *    http://www.gnu.org/licenses/gpl.html\r
+ *\r
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")\r
+ *    http://www.gnu.org/licenses/lgpl.html\r
+ *\r
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")\r
+ *    http://www.mozilla.org/MPL/MPL-1.1.html\r
+ *\r
+ * == END LICENSE ==\r
+ *\r
+ * FCKToolbarSpecialCombo Class: This is a "abstract" base class to be used\r
+ * by the special combo toolbar elements like font name, font size, paragraph format, etc...\r
+ *\r
+ * The following properties and methods must be implemented when inheriting from\r
+ * this class:\r
+ *     - Property:     CommandName                                                     [ The command name to be executed ]\r
+ *     - Method:       GetLabel()                                                      [ Returns the label ]\r
+ *     -                       CreateItems( targetSpecialCombo )       [ Add all items in the special combo ]\r
+ */\r
+\r
+var FCKToolbarSpecialCombo = function()\r
+{\r
+       this.SourceView                 = false ;\r
+       this.ContextSensitive   = true ;\r
+       this.FieldWidth                 = null ;\r
+       this.PanelWidth                 = null ;\r
+       this.PanelMaxHeight             = null ;\r
+       //this._LastValue                       = null ;\r
+}\r
+\r
+\r
+FCKToolbarSpecialCombo.prototype.DefaultLabel = '' ;\r
+\r
+function FCKToolbarSpecialCombo_OnSelect( itemId, item )\r
+{\r
+       FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).Execute( itemId, item ) ;\r
+}\r
+\r
+FCKToolbarSpecialCombo.prototype.Create = function( targetElement )\r
+{\r
+       this._Combo = new FCKSpecialCombo( this.GetLabel(), this.FieldWidth, this.PanelWidth, this.PanelMaxHeight, FCKBrowserInfo.IsIE ? window : FCKTools.GetElementWindow( targetElement ).parent ) ;\r
+\r
+       /*\r
+       this._Combo.FieldWidth          = this.FieldWidth               != null ? this.FieldWidth               : 100 ;\r
+       this._Combo.PanelWidth          = this.PanelWidth               != null ? this.PanelWidth               : 150 ;\r
+       this._Combo.PanelMaxHeight      = this.PanelMaxHeight   != null ? this.PanelMaxHeight   : 150 ;\r
+       */\r
+\r
+       //this._Combo.Command.Name = this.Command.Name;\r
+//     this._Combo.Label       = this.Label ;\r
+       this._Combo.Tooltip     = this.Tooltip ;\r
+       this._Combo.Style       = this.Style ;\r
+\r
+       this.CreateItems( this._Combo ) ;\r
+\r
+       this._Combo.Create( targetElement ) ;\r
+\r
+       this._Combo.CommandName = this.CommandName ;\r
+\r
+       this._Combo.OnSelect = FCKToolbarSpecialCombo_OnSelect ;\r
+}\r
+\r
+function FCKToolbarSpecialCombo_RefreshActiveItems( combo, value )\r
+{\r
+       combo.DeselectAll() ;\r
+       combo.SelectItem( value ) ;\r
+       combo.SetLabelById( value ) ;\r
+}\r
+\r
+FCKToolbarSpecialCombo.prototype.RefreshState = function()\r
+{\r
+       // Gets the actual state.\r
+       var eState ;\r
+\r
+//     if ( FCK.EditMode == FCK_EDITMODE_SOURCE && ! this.SourceView )\r
+//             eState = FCK_TRISTATE_DISABLED ;\r
+//     else\r
+//     {\r
+               var sValue = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName ).GetState() ;\r
+\r
+//             FCKDebug.Output( 'RefreshState of Special Combo "' + this.TypeOf + '" - State: ' + sValue ) ;\r
+\r
+               if ( sValue != FCK_TRISTATE_DISABLED )\r
+               {\r
+                       eState = FCK_TRISTATE_ON ;\r
+\r
+                       if ( this.RefreshActiveItems )\r
+                               this.RefreshActiveItems( this._Combo, sValue ) ;\r
+                       else\r
+                       {\r
+                               if ( this._LastValue !== sValue)\r
+                               {\r
+                                       this._LastValue = sValue ;\r
+\r
+                                       if ( !sValue || sValue.length == 0 )\r
+                                       {\r
+                                               this._Combo.DeselectAll() ;\r
+                                               this._Combo.SetLabel( this.DefaultLabel ) ;\r
+                                       }\r
+                                       else\r
+                                               FCKToolbarSpecialCombo_RefreshActiveItems( this._Combo, sValue ) ;\r
+                               }\r
+                       }\r
+               }\r
+               else\r
+                       eState = FCK_TRISTATE_DISABLED ;\r
+//     }\r
+\r
+       // If there are no state changes then do nothing and return.\r
+       if ( eState == this.State ) return ;\r
+\r
+       if ( eState == FCK_TRISTATE_DISABLED )\r
+       {\r
+               this._Combo.DeselectAll() ;\r
+               this._Combo.SetLabel( '' ) ;\r
+       }\r
+\r
+       // Sets the actual state.\r
+       this.State = eState ;\r
+\r
+       // Updates the graphical state.\r
+       this._Combo.SetEnabled( eState != FCK_TRISTATE_DISABLED ) ;\r
+}\r
+\r
+FCKToolbarSpecialCombo.prototype.Enable = function()\r
+{\r
+       this.RefreshState() ;\r
+}\r
+\r
+FCKToolbarSpecialCombo.prototype.Disable = function()\r
+{\r
+       this.State = FCK_TRISTATE_DISABLED ;\r
+       this._Combo.DeselectAll() ;\r
+       this._Combo.SetLabel( '' ) ;\r
+       this._Combo.SetEnabled( false ) ;\r
+}\r