[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 /* 2 * FCKeditor - The text editor for internet 3 * Copyright (C) 2003-2005 Frederico Caldeira Knabben 4 * 5 * Licensed under the terms of the GNU Lesser General Public License: 6 * http://www.opensource.org/licenses/lgpl-license.php 7 * 8 * For further information visit: 9 * http://www.fckeditor.net/ 10 * 11 * "Support Open Source software. What about a donation today?" 12 * 13 * File Name: fckpanel_ie.js 14 * FCKPanel Class: Creates and manages floating panels in IE Browsers. 15 * 16 * File Authors: 17 * Frederico Caldeira Knabben (fredck@fckeditor.net) 18 */ 19 20 var FCKPanel = function( parentWindow ) 21 { 22 this.IsRTL = false ; 23 this.IsContextMenu = false ; 24 this._IsOpened = false ; 25 26 this._Window = parentWindow ? parentWindow : window ; 27 28 // Create the Popup that will hold the panel. 29 this._Popup = this._Window.createPopup() ; 30 this.Document = this._Popup.document ; 31 32 33 // Create the main DIV that is used as the panel base. 34 this.PanelDiv = this.Document.body.appendChild( this.Document.createElement('DIV') ) ; 35 this.PanelDiv.className = 'FCK_Panel' ; 36 37 this.EnableContextMenu( false ) ; 38 this.SetDirection( FCKLang.Dir ) ; 39 } 40 41 FCKPanel.prototype.EnableContextMenu = function( enabled ) 42 { 43 this.Document.oncontextmenu = enabled ? null : FCKTools.CancelEvent ; 44 } 45 46 FCKPanel.prototype.AppendStyleSheet = function( styleSheet ) 47 { 48 FCKTools.AppendStyleSheet( this.Document, styleSheet ) ; 49 } 50 51 FCKPanel.prototype.SetDirection = function( dir ) 52 { 53 this.IsRTL = ( dir == 'rtl' ) ; 54 this.Document.dir = dir ; 55 } 56 57 FCKPanel.prototype.Load = function( x, y, relElement ) 58 { 59 // The offsetWidth and offsetHeight properties are not available if the 60 // element is not visible. So we must "show" the popup with no size to 61 // be able to use that values in the second call. 62 this._Popup.show( x, y, 0, 0, relElement ) ; 63 } 64 65 FCKPanel.prototype.Show = function( x, y, relElement, width, height ) 66 { 67 this.Load( x, y, relElement ) ; 68 69 // The following lines must be place after the above "show", otherwise it 70 // doesn't has the desired effect. 71 this.PanelDiv.style.width = width ? width + 'px' : '' ; 72 this.PanelDiv.style.height = height ? height + 'px' : '' ; 73 74 if ( this.IsRTL ) 75 { 76 if ( this.IsContextMenu ) 77 x = x - this.PanelDiv.offsetWidth + 1 ; 78 else if ( relElement ) 79 x = x + ( relElement.offsetWidth - this.PanelDiv.offsetWidth ) ; 80 } 81 82 // Second call: Show the Popup at the specified location, with the correct size. 83 this._Popup.show( x, y, this.PanelDiv.offsetWidth, this.PanelDiv.offsetHeight, relElement ) ; 84 85 if ( this._OnHide ) 86 { 87 if ( FCKPanel_ActivePopupInfo.Timer ) 88 CheckPopupOnHide() ; 89 FCKPanel_ActivePopupInfo.Timer = window.setInterval( CheckPopupOnHide, 200 ) ; 90 FCKPanel_ActivePopupInfo.Panel = this ; 91 } 92 93 this._IsOpened = true ; 94 } 95 96 FCKPanel.prototype.Hide = function() 97 { 98 this._Popup.hide() ; 99 } 100 101 FCKPanel.prototype.CheckIsOpened = function() 102 { 103 return this._Popup.isOpen ; 104 } 105 106 FCKPanel.prototype.AttachToOnHideEvent = function( targetFunction ) 107 { 108 this._OnHide = targetFunction ; 109 } 110 111 var FCKPanel_ActivePopupInfo = new Object() ; 112 113 function CheckPopupOnHide() 114 { 115 var oPanel = FCKPanel_ActivePopupInfo.Panel ; 116 117 if ( oPanel && !oPanel._Popup.isOpen ) 118 { 119 window.clearInterval( FCKPanel_ActivePopupInfo.Timer ) ; 120 121 if ( oPanel._OnHide ) 122 oPanel._OnHide( oPanel ) ; 123 124 FCKPanel_ActivePopupInfo.Timer = null ; 125 FCKPanel_ActivePopupInfo.Panel = null ; 126 } 127 }
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |