Index: branches/RC/admin/editor/cmseditor/editor/_source/classes/fckspecialcombo.js =================================================================== diff -u -N --- branches/RC/admin/editor/cmseditor/editor/_source/classes/fckspecialcombo.js (revision 8929) +++ branches/RC/admin/editor/cmseditor/editor/_source/classes/fckspecialcombo.js (revision 0) @@ -1,210 +0,0 @@ -/* - * FCKeditor - The text editor for internet - * Copyright (C) 2003-2004 Frederico Caldeira Knabben - * - * Licensed under the terms of the GNU Lesser General Public License: - * http://www.opensource.org/licenses/lgpl-license.php - * - * For further information visit: - * http://www.fckeditor.net/ - * - * File Name: fckspecialcombo.js - * FCKSpecialCombo Class: represents a special combo. - * - * Version: 2.0 RC3 - * Modified: 2005-02-23 18:56:39 - * - * File Authors: - * Frederico Caldeira Knabben (fredck@fckeditor.net) - */ - -var FCKSpecialCombo = function( caption ) -{ - // Default properties values. - this.FieldWidth = 80 ; - this.PanelWidth = 130 ; - this.PanelMaxHeight = 150 ; - this.Label = ' ' ; - this.Caption = caption ; - - this.Enabled = true ; - - this.Items = new Object() ; - - this._Panel = new FCKPanel() ; - this._Panel.StyleSheet = FCKConfig.SkinPath + 'fck_contextmenu.css' ; - this._Panel.Create() ; - this._Panel.PanelDiv.className += ' SC_Panel' ; - this._Panel.PanelDiv.innerHTML = '
' ; - - this._ItemsHolderEl = this._Panel.PanelDiv.getElementsByTagName('TD')[0] ; -} - -FCKSpecialCombo.prototype.AddItem = function( id, html, label ) -{ - //
Bold 1
- var oDiv = this._ItemsHolderEl.appendChild( this._Panel.Document.createElement( 'DIV' ) ) ; - oDiv.className = oDiv.originalClass = 'SC_Item' ; - oDiv.innerHTML = html ; - oDiv.FCKItemID = id ; - oDiv.FCKItemLabel = label ? label : id ; - oDiv.FCKSpecialCombo = this ; - oDiv.Selected = false ; - - oDiv.onmouseover = function() - { - this.className += ' SC_ItemOver' ; - } - - oDiv.onmouseout = function() - { - this.className = this.originalClass ; - } - - oDiv.onclick = function() - { - this.FCKSpecialCombo._Panel.Hide() ; - - this.FCKSpecialCombo.SetLabel( this.FCKItemLabel ) ; - - if ( typeof( this.FCKSpecialCombo.OnSelect ) == 'function' ) - this.FCKSpecialCombo.OnSelect( this.FCKItemID, this ) ; - } - - this.Items[ id.toString().toLowerCase() ] = oDiv ; - - return oDiv ; -} - -FCKSpecialCombo.prototype.SelectItem = function( itemId ) -{ - itemId = itemId ? itemId.toString().toLowerCase() : '' ; - - var oDiv = this.Items[ itemId ] ; - if ( oDiv ) - { - oDiv.className = oDiv.originalClass = 'SC_ItemSelected' ; - oDiv.Selected = true ; - } -} - -FCKSpecialCombo.prototype.DeselectAll = function() -{ - for ( var i in this.Items ) - { - this.Items[i].className = this.Items[i].originalClass = 'SC_Item' ; - this.Items[i].Selected = false ; - } -} - -FCKSpecialCombo.prototype.SetLabelById = function( id ) -{ - FCKDebug.Output( this.Caption + ': ' + id, '#0000FF' ) ; - - id = id ? id.toString().toLowerCase() : '' ; - - var oDiv = this.Items[ id ] ; - this.SetLabel( oDiv ? oDiv.FCKItemLabel : '' ) ; -} - -FCKSpecialCombo.prototype.SetLabel = function( text ) -{ - this.Label = text.length == 0 ? ' ' : text ; - - if ( this._LabelEl ) - this._LabelEl.innerHTML = this.Label ; -} - -FCKSpecialCombo.prototype.SetEnabled = function( isEnabled ) -{ - this.Enabled = isEnabled ; - - this._OuterTable.className = isEnabled ? '' : 'SC_FieldDisabled' ; -} - -FCKSpecialCombo.prototype.Create = function( targetElement ) -{ - this._OuterTable = targetElement.appendChild( document.createElement( 'TABLE' ) ) ; - this._OuterTable.cellPadding = 0 ; - this._OuterTable.cellSpacing = 0 ; - - this._OuterTable.insertRow(-1) ; - - if ( this.Caption && this.Caption.length > 0 ) - { - var oCaptionCell = this._OuterTable.rows[0].insertCell(-1) ; - oCaptionCell.unselectable = 'on' ; - oCaptionCell.innerHTML = this.Caption ; - oCaptionCell.className = 'SC_FieldCaption' ; - } - - // Create the main DIV element. - var oField = this._OuterTable.rows[0].insertCell(-1).appendChild( document.createElement( 'DIV' ) ) ; - oField.className = 'SC_Field' ; - oField.style.width = this.FieldWidth + 'px' ; - oField.innerHTML = '
 
' ; - - this._LabelEl = oField.getElementsByTagName('label')[0] ; - this._LabelEl.innerHTML = this.Label ; - - /* Events Handlers */ - - oField.SpecialCombo = this ; - - oField.onmouseover = function() - { - if ( this.SpecialCombo.Enabled ) - this.className='SC_Field SC_FieldOver' ; - } - - oField.onmouseout = function() - { - this.className='SC_Field' ; - } - - oField.onclick = function( e ) - { - // For Mozilla we must stop the event propagation to avoid it hiding - // the panel because of a click outside of it. - if ( e ) - { - e.stopPropagation() ; - FCKPanelEventHandlers.OnDocumentClick( e ) ; - } - - if ( this.SpecialCombo.Enabled ) - { - if ( typeof( this.SpecialCombo.OnBeforeClick ) == 'function' ) - this.SpecialCombo.OnBeforeClick( this.SpecialCombo ) ; - - if ( this.SpecialCombo._ItemsHolderEl.offsetHeight > this.SpecialCombo.PanelMaxHeight ) - this.SpecialCombo._Panel.PanelDiv.style.height = this.SpecialCombo.PanelMaxHeight + 'px' ; - else - this.SpecialCombo._Panel.PanelDiv.style.height = this.SpecialCombo._ItemsHolderEl.offsetHeight + 'px' ; - - this.SpecialCombo._Panel.PanelDiv.style.width = this.SpecialCombo.PanelWidth + 'px' ; - - if ( FCKBrowserInfo.IsGecko ) - this.SpecialCombo._Panel.PanelDiv.style.overflow = '-moz-scrollbars-vertical' ; - - this.SpecialCombo._Panel.Show( 0, this.offsetHeight, this, null, this.SpecialCombo.PanelMaxHeight, true ) ; - } - - return false ; - } -} - -/* -Sample Combo Field HTML output: - -
- - - - - - - -
 
-
-*/ \ No newline at end of file