﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3486	fckpanel statick zindex problem	Odd-Henrik Aasen		"Our AJAX framework uses a “bringElementToFront” function/algorithm witch job it is to make sure that a panel, window or such that should be on top in the zindex stack will be on top/have the highest zindex. The algorithm basically traverses the relevant stacking context of the DOM and finds the highest zindex, then return that + 1 (can provide code if you need it).
 
I then have two windows/panels with FCKeditor, and up on loading the second window the above mentioned algorithm will find the FloatingPanelsZIndex in the stacking context and give the new window a higher zindex. This will then in turn result in style, format etc. drop down panels being displayed with a lower zindex and such behind the editor/current window/panel as seen in the picture.
     
So the FloatingPanelsZIndex setting is not the best all round solution. This should probably be found dynamically as described above. Or at leaset this could be an option. 

Sugested solution:
So I implementet a somwhat crude function getNextHighestZindex (Thanks to Jason J. Jaeger http://greengeckodesign.com/blog/2007/07/get-highest-z-index-in-javascript.html):

{{{
function getNextHighestZindex(obj) {
    var highestIndex = 0;
    var currentIndex = 0;
    var elArray = Array();
    if (obj) { elArray = obj.getElementsByTagName('*'); } else { elArray = document.getElementsByTagName('*'); }
    for (var i = 0; i < elArray.length; i++) {
        if (elArray[i].currentStyle) {
            currentIndex = parseFloat(elArray[i].currentStyle['zIndex']);
        } else if (window.getComputedStyle) {
            currentIndex = parseFloat(document.defaultView.getComputedStyle(elArray[i], null).getPropertyValue('z-index'));
        }
        if (!isNaN(currentIndex) && currentIndex > highestIndex) { highestIndex = currentIndex; }
    }
    return (highestIndex + 1);
}
}}}

Then changed fckpanel.js line 78, old code:

{{{
FCKDomTools.SetElementStyles( oIFrame,
{
	position	: 'absolute',
	zIndex		: FCKConfig.FloatingPanelsZIndex
} ) ;
}}}

New code:
{{{
FCKDomTools.SetElementStyles(D,
{ 
    position: 'absolute',
    zIndex: getNextHighestZindex(this._Window.document)
});
}}}

This solves the problem. However as I said this implementation is more to the point of proof of concept. The function getNextHighestZindex is not a very efficient way to do this. Using the concept of stacking context to eliminate traversing all of the DOM is a better approach but more complicated. Also maybe the root of the problem is to where in the DOM the new panel is appended??

Hope you can look into this and find a good, robust and efficient solution. "	Bug	closed	Normal		UI : Floating Panel	FCKeditor 2.6.4	invalid		t.bussmann@…
