You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by sm...@apache.org on 2007/10/12 02:36:13 UTC
svn commit: r583998 [4/4] -
/portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/widget/
Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/widget/PortletWindow.src.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/widget/PortletWindow.src.js?rev=583998&r1=583997&r2=583998&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/widget/PortletWindow.src.js (original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/javascript/jetspeed/widget/PortletWindow.src.js Thu Oct 11 17:36:12 2007
@@ -24,11 +24,8 @@
{
this.windowInitialized = false;
this.actionButtons = {};
- this.actionMenus = {};
this.actionMenuWidget = null;
this.tooltips = [];
- this.subWidgetStartIndex = -1;
- this.subWidgetEndIndex = -1;
// content load vars
this._onLoadStack = [];
@@ -41,7 +38,8 @@
nextIndex: 1,
resizable: true,
- movable: true,
+ moveable: true,
+ moveAllowTilingChg: true,
decName: null, // decoration name
decConfig: null, // decoration config
@@ -52,6 +50,8 @@
titleMouseIn: 0,
titleLit: false,
+ colWidth_pbE: 0,
+
portlet: null,
altInitParams: null,
@@ -67,6 +67,8 @@
adjustPaths: false,
parseContent: true,
+ childWidgets: null,
+
dbProfile: (djConfig.isDebug && jetspeed.debug.profile),
dbOn: djConfig.isDebug,
dbMenuDims: "Dump Dimensions",
@@ -222,12 +224,17 @@
this.domNode = dNode;
var dNodeCss = jsCss.cssPosition.concat();
+ if ( jsPage.maximizedOnInit != null )
+ {
+ dNodeCss[ jsCss.cssNoSelNm ] = " visibility: ";
+ dNodeCss[ jsCss.cssNoSel ] = "hidden";
+ dNodeCss[ jsCss.cssNoSelEnd ] = ";";
+ }
this.dNodeCss = dNodeCss;
this.containerNode = cNode;
var cNodeCss = jsCss.cssOverflow.concat();
this.cNodeCss = cNodeCss;
-
// ... initWindowTitle
this.setPortletTitle( iP[ jsId.PP_WINDOW_TITLE ] );
@@ -256,49 +263,38 @@
}
var untiledDims = {}; // untiled
- var tiledDims = { width: null }; // tiled
+ var tiledDims = { w: null }; // tiled
// to allow for an initial untiled placement based on tiled position,
// only record dimsUntiled when value is specified (not defaulted) or if window is already untiled
if ( wWidth != null && wWidth > 0 )
- untiledDims.width = wWidth = Math.floor( wWidth );
+ untiledDims.w = wWidth = Math.floor( wWidth );
else
- untiledDims.width = wWidth = jsPrefs.windowWidth;
+ untiledDims.w = wWidth = jsPrefs.windowWidth;
if ( wHeight != null && wHeight > 0 )
- untiledDims.height = tiledDims.height = wHeight = Math.floor(wHeight);
+ untiledDims.h = tiledDims.h = wHeight = Math.floor(wHeight);
else
- untiledDims.height = tiledDims.height = wHeight = jsPrefs.windowHeight;
+ untiledDims.h = tiledDims.h = wHeight = jsPrefs.windowHeight;
if ( wLeft != null && wLeft >= 0 )
- untiledDims.left = Math.floor( wLeft );
+ untiledDims.l = Math.floor( wLeft );
else if ( ! posStatic )
- untiledDims.left = (((winIndex -2) * 30 ) + 200);
+ untiledDims.l = (((winIndex -2) * 30 ) + 200);
if ( wTop != null && wTop >= 0 )
- untiledDims.top = Math.floor(wTop);
+ untiledDims.t = Math.floor(wTop);
else if ( ! posStatic )
- untiledDims.top = (((winIndex -2) * 30 ) + 170);
+ untiledDims.t = (((winIndex -2) * 30 ) + 170);
this.dimsUntiled = untiledDims;
this.dimsTiled = tiledDims;
- // xxx
- //var dimCss = "display: none; width: " + wWidth + "px" + ( ( wHeight != null && wHeight > 0 ) ? ( "; height: " + wHeight + "px" ) : "");
- //if ( ! posStatic )
- // dimCss += "; left: " + wLeft + "px; top: " + wTop + "px;";
- //dNode.style.cssText = dimCss;
-
this.exclPContent = iP[ jsId.PP_EXCLUDE_PCONTENT ];
- // --- former end of preBuild()
-
jsPage.putPWin( this );
- // --- former beginning of build()
-
- // necessary for safari, khtml (for computing width/height)
- docBody.appendChild( dNode );
+ docBody.appendChild( dNode ); // necessary for safari, khtml (for computing width/height)
// ... initWindowIcon
if ( tbIconNode )
@@ -342,160 +338,47 @@
}
var windowTitleBarButtons = null;
var djEvtObj = djObj.event;
- var incl, aNm;
- var mANms = new Array();
- var noImg = false;
- if ( wDC.windowActionButtonOrder != null )
- { // all possible button actions must be added here (no support for adding action buttons after init)
- // this includes buttons for the current mode and state (which will be initially hidden)
- var btnActionNames = new Array();
- if ( tPortlet )
- {
- for ( var aI = (wDC.windowActionButtonOrder.length-1) ; aI >= 0 ; aI-- )
- {
- aNm = wDC.windowActionButtonOrder[ aI ];
- incl = false;
- if ( tPortlet.getAction( aNm ) != null || jsPrefs.windowActionDesktop[ aNm ] != null )
- {
- incl = true;
- }
- else if ( aNm == jsId.ACT_RESTORE || aNm == jsId.ACT_MENU )
- {
- incl = true;
- }
- if ( incl )
- {
- btnActionNames.push( aNm );
- }
- }
- }
- else
- {
- for ( var aI = (wDC.windowActionButtonOrder.length-1) ; aI >= 0 ; aI-- )
- {
- aNm = wDC.windowActionButtonOrder[ aI ];
- incl = false;
- if ( aNm == jsId.ACT_MINIMIZE || aNm == jsId.ACT_MAXIMIZE || aNm == jsId.ACT_RESTORE || aNm == jsId.ACT_MENU || jsPrefs.windowActionDesktop[ aNm ] != null )
- {
- incl = true;
- }
- if ( incl )
- {
- btnActionNames.push( aNm );
- }
- }
- } // if ( tPortlet )
- var btnMax = ( wDC.windowActionButtonMax == null ? -1 : wDC.windowActionButtonMax );
- if ( btnMax != -1 && btnActionNames.length >= btnMax )
- {
- var removedBtns = 0;
- var mustRemoveBtns = btnActionNames.length - btnMax + 1;
- for ( var i = 0 ; i < btnActionNames.length && removedBtns < mustRemoveBtns ; i++ )
- {
- if ( btnActionNames[i] != jsId.ACT_MENU )
- {
- mANms.push( btnActionNames[i] );
- btnActionNames[i] = null;
- removedBtns++;
- }
- }
- }
- if ( wDC.windowActionNoImage )
- {
- for ( var i = 0 ; i < btnActionNames.length ; i++ )
- {
- if ( wDC.windowActionNoImage[ btnActionNames[ i ] ] != null )
- {
- if ( btnActionNames[ i ] == jsId.ACT_MENU )
- {
- noImg = true;
- }
- else
- {
- mANms.push( btnActionNames[i] );
- }
- btnActionNames[ i ] = null;
- }
- }
- }
- var tooltipMgr = jsPage.tooltipMgr;
- for ( var i = 0 ; i < btnActionNames.length ; i++ )
- {
- if ( btnActionNames[i] != null )
- {
- this._createActionButtonNode( btnActionNames[i], doc, docBody, tooltipMgr, jsObj, jsPrefs, jsUI, djEvtObj );
- }
- }
- } // if ( wDC.windowActionButtonOrder != null )
+
+ var tooltipMgr = jsPage.tooltipMgr;
+ if ( wDC.windowActionButtonTooltip )
+ {
+ if ( this.actionLabels[ jsId.ACT_DESKTOP_MOVE_TILED ] != null && this.actionLabels[ jsId.ACT_DESKTOP_MOVE_UNTILED ] != null )
+ this.tooltips.push( tooltipMgr.addNode( tbNode, null, true, 1200, this, "getTitleBarTooltip", jsObj, jsUI, djEvtObj ) );
+ }
- if ( wDC.windowActionMenuOrder )
+ var btnActionNames = ( tPortlet ) ? wDC.windowActionButtonNames : wDC.windowActionButtonNamesNp;
+ if ( btnActionNames == null )
+ {
+ btnActionNames = this._buildActionStructures( wDC, tPortlet, docBody, jsObj, jsId, jsPrefs, djObj );
+ }
+ var aNm;
+ for ( var i = 0 ; i < btnActionNames.length ; i++ )
{
- if ( tPortlet )
+ aNm = btnActionNames[i];
+ if ( aNm != null )
{
- for ( var aI = 0 ; aI < wDC.windowActionMenuOrder.length ; aI++ )
+ if ( ! tPortlet || ( aNm == jsId.ACT_RESTORE || aNm == jsId.ACT_MENU || tPortlet.getAction( aNm ) != null || jsPrefs.windowActionDesktop[ aNm ] != null ) )
{
- aNm = wDC.windowActionMenuOrder[ aI ];
- incl = false;
- if ( tPortlet.getAction( aNm ) != null || jsPrefs.windowActionDesktop[ aNm ] != null )
- {
- incl = true;
- }
- if ( incl )
- {
- mANms.push( aNm );
- }
+ this._createActionButtonNode( aNm, doc, docBody, tooltipMgr, wDC, jsObj, jsPrefs, jsUI, djObj, djEvtObj );
}
}
- else
- {
- for ( var aI = 0 ; aI < wDC.windowActionMenuOrder.length ; aI++ )
- {
- aNm = wDC.windowActionMenuOrder[ aI ];
- if ( jsPrefs.windowActionDesktop[ aNm ] != null )
- {
- mANms.push( aNm );
- }
- }
- } // if ( tPortlet )
- } // if ( wDC.windowActionMenuOrder != null )
+ }
+ this.actionMenuWidget = ( tPortlet ) ? wDC.windowActionMenuWidget : wDC.windowActionMenuWidgetNp;
- if ( mANms.length > 0 || this.dbOn )
+ if ( this.actionMenuWidget && wDC.windowActionMenuHasNoImg )
{
- var added = new Object();
- var finalNms = new Array();
- for ( var i = 0 ; i < mANms.length ; i++ )
- {
- aNm = mANms[i];
- if ( aNm != null && added[ aNm ] == null && this.actionButtons[ aNm ] == null )
- {
- finalNms.push( aNm );
- added[ aNm ] = true;
- }
- }
-
- if ( this.dbOn )
- {
- finalNms.push( { aNm: this.dbMenuDims, dev: true } );
- }
- if ( finalNms.length > 0 )
- {
- this._createActionMenu( finalNms, docBody );
- if ( noImg )
- {
- jsUI.evtConnect( "after", tbNode, "oncontextmenu", this, "windowActionMenuOpen", djEvtObj );
- }
- }
+ jsUI.evtConnect( "after", tbNode, "oncontextmenu", this, "actionMenuOpen", djEvtObj );
}
- this.windowActionButtonSync();
+ this.actionBtnSync( jsObj, jsId );
if ( wDC.windowDisableResize )
this.resizable = false;
if ( wDC.windowDisableMove )
- this.movable = false;
+ this.moveable = false;
}
- // --- init drag handle
+ // ... init drag handle
var isResizable = this.resizable;
var rhWidget = null;
if ( isResizable && rbNode )
@@ -505,11 +388,6 @@
this.resizeHandle = rhWidget;
if ( rhWidget )
{
- //if ( this.posStatic && jsObj.UAmoz ) // jsObj.UAie
- rhWidget.domNode.style.position = "static"; // until 2006-11-15, was set to absolute for all but mozilla
- // but setting to static for all seems to fix IE failure to initially display resize handle
- //else
- // rhWidget.domNode.style.position = "absolute";
rbNode.appendChild( rhWidget.domNode );
}
}
@@ -518,47 +396,76 @@
this.resizable = false;
}
- // Prevent IE bleed-through problem
- if ( ie6 )
- this.bgIframe = new djObj.html.BackgroundIframe( dNode );
+ docBody.removeChild( dNode ); // counteract body.appendChild above
- // counteract body.appendChild above
- docBody.removeChild( dNode );
+ if ( ! wDC.windowTitlebar || ! wDC.windowResizebar )
+ {
+ var disIdx = jsObj.css.cssDis;
+ if ( this.tbNodeCss && ! wDC.windowTitlebar )
+ this.tbNodeCss[ disIdx ] = "none";
- // --- former end of build()
-
- winContainerNode.appendChild( dNode );
-
- // --- former beginning of postBuild()
-
- //dNode.style.display = ""; // xxxx
+ if ( this.rbNodeCss && ! wDC.windowResizebar )
+ this.rbNodeCss[ disIdx ] = "none";
+ }
- if ( ! wDC.layoutExtents )
+ var nodeAdded = false;
+ var winChildNodes = winContainerNode.childNodes;
+ if ( posStatic && winChildNodes )
{
- var dimCss = "display: block; width: " + wWidth + "px" + ( ( wHeight != null && wHeight > 0 ) ? ( "; height: " + wHeight + "px" ) : "");
+ var rowProp = iP[ jsId.PP_ROW ];
+ if ( rowProp != null )
+ {
+ var rowInt = new Number(rowProp);
+ if ( rowInt >= 0 )
+ {
+ var winChildNodesLast = winChildNodes.length -1;
+ if ( winChildNodesLast >= rowInt )
+ {
+ var childAtRowInt = winChildNodes[rowInt];
+ if ( childAtRowInt )
+ {
+ winContainerNode.insertBefore( dNode, childAtRowInt );
+ nodeAdded = true;
+ }
+ }
+ }
+ }
+ }
+ if ( ! nodeAdded )
+ winContainerNode.appendChild( dNode );
+
+ if ( ! wDC.layout )
+ {
+ var dimCss = "display: block; visibility: hidden; width: " + wWidth + "px" + ( ( wHeight != null && wHeight > 0 ) ? ( "; height: " + wHeight + "px" ) : "");
dNode.style.cssText = dimCss;
- //this.testLost();
- this._createLayoutExtents( wDC, false, dNode, cNode, tbNode, rbNode, djObj, jsObj );
+ this._createLayoutInfo( wDC, false, dNode, cNode, tbNode, rbNode, djObj, jsObj, jsUI );
}
- if ( this.movable && tbNode )
+ if ( this.moveable && tbNode )
{
this.drag = new djObj.dnd.Moveable( this, {handle: tbNode});
this._setTitleBarDragging( true, jsCss );
}
+ if ( ie6 && posStatic )
+ tiledDims.w = Math.max( 0, winContainerNode.offsetWidth - this.colWidth_pbE );
+
this._setAsTopZIndex( jsPage, jsCss, dNodeCss, posStatic );
this._alterCss( true, true );
if ( ! posStatic )
this._addUntiledEvents();
+ if ( ie6 ) // prevent IE bleed-through problem
+ this.bgIframe = new jsObj.widget.BackgroundIframe( dNode, null, djObj );
+
this.windowInitialized = true;
if ( jsObj.debug.createWindow )
djObj.debug( "createdWindow [" + ( tPortlet ? tPortlet.entityId : initWidgetId ) + ( tPortlet ? (" / " + initWidgetId) : "" ) + "]" + " width=" + dNode.style.width + " height=" + dNode.style.height + " left=" + dNode.style.left + " top=" + dNode.style.top ) ;
+ this.windowState = jsId.ACT_RESTORE; // "normal"
var iWS = null;
if ( tPortlet )
iWS = tPortlet.getCurrentActionState();
@@ -567,207 +474,310 @@
if ( iWS == jsId.ACT_MINIMIZE )
{
- this.minimizeWindow();
- this.windowActionButtonSync();
- this.needsRenderOnRestore = true;
- }
- else if ( iWS == jsId.ACT_MAXIMIZE )
- { // needs delay so that widths are fully realized before maximize occurs
- djObj.lang.setTimeout( this, this._postCreateMaximizeWindow, 1500 );
- }
-
- if ( ie6 && jsObj.widget.ie6ZappedContentHelper == null )
- {
- var ie6Helper = doc.createElement("span");
- ie6Helper.id = "ie6ZappedContentHelper";
- jsObj.widget.ie6ZappedContentHelper = ie6Helper;
+ this.minimizeOnNextRender = true;
}
+ // jsId.ACT_MAXIMIZE is handled in jetspeed.page.loadPostRender
if ( jsObj.widget.pwGhost == null && jsPage != null )
- { // ... PortletWindow drag ghost
+ { // ... drag ghost
var pwGhost = doc.createElement("div");
pwGhost.id = "pwGhost";
var defaultWndC = jsPage.getPortletDecorationDefault();
if ( ! defaultWndC ) defaultWndC = decNm;
- pwGhost.className = jsId.P_CLASS + ( defaultWndC ? ( " " + defaultWndC ) : "" ) + " " + dNodeClass;
+ pwGhost.className = dNodeClass;
pwGhost.style.position = "static";
pwGhost.style.width = "";
pwGhost.style.left = "auto";
pwGhost.style.top = "auto";
jsObj.widget.pwGhost = pwGhost;
}
+
+ if ( ie6 && jsObj.widget.ie6ZappedContentHelper == null )
+ {
+ var ie6Helper = doc.createElement("span");
+ ie6Helper.id = "ie6ZappedContentHelper";
+ jsObj.widget.ie6ZappedContentHelper = ie6Helper;
+ }
}, // build()
// build functions
- _createActionButtonNode: function( aNm, doc, docBody, tooltipMgr, jsObj, jsPrefs, jsUI, djEvtObj )
- {
- if ( aNm != null )
- {
- var aBtn = doc.createElement( "div" );
- aBtn.className = "portletWindowActionButton";
- aBtn.style.backgroundImage = "url(" + jsPrefs.getPortletDecorationBaseUrl( this.decName ) + "/images/desktop/" + aNm + ".gif)";
- aBtn.actionName = aNm;
-
- this.actionButtons[ aNm ] = aBtn;
- this.tbNode.appendChild( aBtn );
+ /* static */
+ _buildActionStructures: function( wDC, tPortlet, docBody, jsObj, jsId, jsPrefs, djObj )
+ { // should be called once for each used portlet decorator - twice if the decorator is used by a non-portlet window
+ var btnActionNames = new Array();
+ var aNm, incl, noMenuImg = false;
+ var tMenuActionNames = new Array();
+ var tBtnActionNameMap = new Object();
+ if ( wDC.windowActionButtonOrder != null )
+ { // all possible button actions must be added here (no support for adding action buttons after init)
+ // this includes buttons for the current mode and state (which will be initially hidden)
+ if ( tPortlet )
+ {
+ for ( var aI = (wDC.windowActionButtonOrder.length-1) ; aI >= 0 ; aI-- )
+ {
+ aNm = wDC.windowActionButtonOrder[ aI ];
+ btnActionNames.push( aNm );
+ tBtnActionNameMap[ aNm ] = true;
+ }
+ }
+ else
+ {
+ for ( var aI = (wDC.windowActionButtonOrder.length-1) ; aI >= 0 ; aI-- )
+ {
+ aNm = wDC.windowActionButtonOrder[ aI ];
+ incl = false;
+ if ( aNm == jsId.ACT_MINIMIZE || aNm == jsId.ACT_MAXIMIZE || aNm == jsId.ACT_RESTORE || aNm == jsId.ACT_MENU || jsPrefs.windowActionDesktop[ aNm ] != null )
+ {
+ incl = true;
+ }
+ if ( incl )
+ {
+ btnActionNames.push( aNm );
+ tBtnActionNameMap[ aNm ] = true;
+ }
+ }
+ } // if ( tPortlet )
+ var btnMax = ( wDC.windowActionButtonMax == null ? -1 : wDC.windowActionButtonMax );
+ if ( btnMax != -1 && btnActionNames.length >= btnMax )
+ {
+ var removedBtns = 0;
+ var mustRemoveBtns = btnActionNames.length - btnMax + 1;
+ for ( var i = 0 ; i < btnActionNames.length && removedBtns < mustRemoveBtns ; i++ )
+ {
+ aNm = btnActionNames[i];
+ if ( aNm != jsId.ACT_MENU )
+ {
+ tMenuActionNames.push( aNm );
+ btnActionNames[i] = null;
+ delete tBtnActionNameMap[ aNm ];
+ removedBtns++;
+ }
+ }
+ }
+ if ( wDC.windowActionNoImage )
+ {
+ for ( var i = 0 ; i < btnActionNames.length ; i++ )
+ {
+ aNm = btnActionNames[i];
+ if ( wDC.windowActionNoImage[ aNm ] != null )
+ {
+ if ( aNm == jsId.ACT_MENU )
+ {
+ noMenuImg = true;
+ }
+ else
+ {
+ tMenuActionNames.push( aNm );
+ }
+ btnActionNames[i] = null;
+ delete tBtnActionNameMap[ aNm ];
+ }
+ }
+ }
+ } // if ( wDC.windowActionButtonOrder != null )
- jsUI.evtConnect( "after", aBtn, "onclick", this, "windowActionButtonClick", djEvtObj );
- if ( this.decConfig != null && this.decConfig.windowActionButtonTooltip )
+ if ( wDC.windowActionMenuOrder )
+ {
+ if ( tPortlet )
{
- this.tooltips.push( tooltipMgr.addNode( aBtn, this._getActionLabel( aNm ), true, jsObj, jsUI, djEvtObj ) );
+ for ( var aI = 0 ; aI < wDC.windowActionMenuOrder.length ; aI++ )
+ {
+ aNm = wDC.windowActionMenuOrder[ aI ];
+ tMenuActionNames.push( aNm );
+ }
}
else
{
- jsUI.evtConnect( "after", aBtn, "onmousedown", djEvtObj.browser, "stopEvent", djEvtObj );
+ for ( var aI = 0 ; aI < wDC.windowActionMenuOrder.length ; aI++ )
+ {
+ aNm = wDC.windowActionMenuOrder[ aI ];
+ if ( jsPrefs.windowActionDesktop[ aNm ] != null )
+ {
+ tMenuActionNames.push( aNm );
+ }
+ }
+ } // if ( tPortlet )
+ } // if ( wDC.windowActionMenuOrder != null )
+
+ var menuActionNames = new Array();
+ if ( tMenuActionNames.length > 0 || this.dbOn )
+ {
+ var added = new Object();
+ for ( var i = 0 ; i < tMenuActionNames.length ; i++ )
+ {
+ aNm = tMenuActionNames[i];
+ if ( aNm != null && added[ aNm ] == null && tBtnActionNameMap[ aNm ] == null )
+ {
+ menuActionNames.push( aNm );
+ added[ aNm ] = true;
+ }
+ }
+ if ( this.dbOn )
+ {
+ menuActionNames.push( { aNm: this.dbMenuDims, dev: true } );
}
}
- },
- _getActionLabel: function( aNm )
- {
- if ( aNm == null ) return null;
- var actionlabel = null;
- var actionLabelPrefs = jetspeed.prefs.desktopActionLabels;
- if ( actionLabelPrefs != null )
- actionlabel = actionLabelPrefs[ aNm ];
- if ( actionlabel == null || actionlabel.length == 0 )
+ var actionMenuWidget = null;
+ if ( menuActionNames.length > 0 )
{
- if ( this.portlet )
+ var menuItemsByName = {};
+ var aNm, menulabel, menuitem, isDev;
+ actionMenuWidget = djObj.widget.createWidget( "PopupMenu2", { id: this.widgetId + "_ctxmenu", contextMenuForWindow: false }, null );
+ actionMenuWidget.onItemClick = function( mi )
{
- var portletActionDef = this.portlet.getAction( aNm );
- if ( portletActionDef != null )
- actionlabel = portletActionDef.label;
+ var _aN = mi.jsActNm;
+ var _pWin = this.pWin;
+ if ( ! mi.jsActDev )
+ _pWin.actionProcess( _aN );
+ else
+ _pWin.actionProcessDev( _aN );
+ };
+
+ for ( var i = 0 ; i < menuActionNames.length ; i++ )
+ {
+ aNm = menuActionNames[i];
+ isDev = false;
+ if ( ! aNm.dev )
+ menulabel = this.actionLabels[ aNm ];
+ else
+ {
+ isDev = true;
+ menulabel = aNm = aNm.aNm;
+ }
+ menuitem = djObj.widget.createWidget( "MenuItem2", { caption: menulabel, jsActNm: aNm, jsActDev: isDev } );
+ menuItemsByName[ aNm ] = menuitem;
+ actionMenuWidget.addChild( menuitem );
}
+ actionMenuWidget.menuItemsByName = menuItemsByName;
+ docBody.appendChild( actionMenuWidget.domNode );
+ jsObj.ui.addPopupMenuWidget( actionMenuWidget );
+ }
+
+ wDC.windowActionMenuHasNoImg = noMenuImg;
+ if ( tPortlet )
+ {
+ wDC.windowActionButtonNames = btnActionNames;
+ wDC.windowActionMenuNames = menuActionNames;
+ wDC.windowActionMenuWidget = actionMenuWidget;
+ //dojo.debug( "set portlet button names (" + this.widgetId + ") [" + btnActionNames.join( ", " ) + "]" );
+ //dojo.debug( "portlet wDC.windowActionButtonOrder [" + wDC.windowActionButtonOrder.join( ", " ) + "]" );
}
- if ( actionlabel == null || actionlabel.length == 0 )
+ else
{
- actionlabel = dojo.string.capitalize( aNm );
+ wDC.windowActionButtonNamesNp = btnActionNames;
+ wDC.windowActionMenuNamesNp = menuActionNames;
+ wDC.windowActionMenuWidgetNp = actionMenuWidget;
+ //dojo.debug( "set non-portlet button names (" + this.widgetId + ") [" + btnActionNames.join( ", " ) + "]" );
}
- return actionlabel;
+ return btnActionNames;
},
- _createActionMenu: function( menuActionNames, docBody )
+
+ _createActionButtonNode: function( aNm, doc, docBody, tooltipMgr, wDC, jsObj, jsPrefs, jsUI, djObj, djEvtObj )
{
- if ( menuActionNames == null || menuActionNames.length == 0 ) return;
- var pWin = this;
- var aNm, menulabel, menuitem, isDev;
- var miOnClick = function( mi ) { var _aN = mi.jsActNm; if ( ! mi.jsActDev ) pWin.windowActionProcess( _aN ); else pWin.windowActionProcessDev( _aN ); };
- var titleBarContextMenu = dojo.widget.createWidget( "PopupMenu2", { id: this.widgetId + "_ctxmenu", contextMenuForWindow: false, onItemClick: miOnClick }, null );
- for ( var i = 0 ; i < menuActionNames.length ; i++ )
+ if ( aNm != null )
{
- aNm = menuActionNames[i];
- isDev = false;
- if ( ! aNm.dev )
- menulabel = this._getActionLabel( aNm );
+ var aBtn = doc.createElement( "div" );
+ aBtn.className = "portletWindowActionButton";
+ aBtn.style.backgroundImage = "url(" + jsPrefs.getPortletDecorationBaseUrl( this.decName ) + "/images/desktop/" + aNm + ".gif)";
+ aBtn.actionName = aNm;
+
+ this.actionButtons[ aNm ] = aBtn;
+ this.tbNode.appendChild( aBtn );
+
+ jsUI.evtConnect( "after", aBtn, "onclick", this, "actionBtnClick", djEvtObj );
+ if ( wDC.windowActionButtonTooltip )
+ {
+ var actionLabel = this.actionLabels[ aNm ];
+ this.tooltips.push( tooltipMgr.addNode( aBtn, actionLabel, true, null, null, null, jsObj, jsUI, djEvtObj ) );
+ }
else
{
- isDev = true;
- menulabel = aNm = aNm.aNm;
+ jsUI.evtConnect( "after", aBtn, "onmousedown", jsObj, "_stopEvent", djEvtObj );
}
- menuitem = dojo.widget.createWidget( "MenuItem2", { caption: menulabel, jsActNm: aNm, jsActDev: isDev } );
- this.actionMenus[ aNm ] = menuitem;
- titleBarContextMenu.addChild( menuitem );
}
- docBody.appendChild( titleBarContextMenu.domNode );
- this.actionMenuWidget = titleBarContextMenu;
+ },
+ getTitleBarTooltip: function()
+ {
+ if ( ! this.getLayoutActionsEnabled() ) return null;
+ if ( this.posStatic )
+ return this.actionLabels[ jetspeed.id.ACT_DESKTOP_MOVE_TILED ];
+ else
+ return this.actionLabels[ jetspeed.id.ACT_DESKTOP_MOVE_UNTILED ];
},
- // layout extents static methods - used for defining cached portlet decorator layoutExtents object
+ // layout extents static methods - used for defining cached portlet decorator layout object
/* static */
- _createLayoutExtents: function( decorationConfig, forIFrameStyles, dNode, cNode, tbNode, rbNode, djObj, jsObj )
+ _createLayoutInfo: function( decorationConfig, forIFrameStyles, dNode, cNode, tbNode, rbNode, djObj, jsObj, jsUI )
{ // should be called once for each used portlet decorator
var dNodeCompStyle = djObj.gcs( dNode );
var cNodeCompStyle = djObj.gcs( cNode );
- var tbNodeCompStyle = null, rbNodeCompStyle = null;
- var layoutExtents = { dNode: this._createNodeLEs( dNode, dNodeCompStyle, djObj, jsObj ),
- cNode: this._createNodeLEs( cNode, cNodeCompStyle, djObj, jsObj ) };
+ var dLayoutInfo = jsUI.getLayoutExtents( dNode, dNodeCompStyle, djObj, jsObj );
+ var cLayoutInfo = jsUI.getLayoutExtents( cNode, cNodeCompStyle, djObj, jsObj );
+ var layoutInfo = { dNode: dLayoutInfo,
+ cNode: cLayoutInfo };
+
+ var cMarginTop = Math.max( 0, cLayoutInfo.mE.t );
+ var cMarginBottom = Math.max( 0, cLayoutInfo.mE.h - cLayoutInfo.mE.t );
+ var cNode_mBh_adj_tb_mBh = 0;
+ var cNode_mBh_adj_rb_mBh = 0;
+
+ var tbLayoutInfo = null;
if ( tbNode )
{
- tbNodeCompStyle = djObj.gcs( tbNode );
- layoutExtents.tbNode = this._createNodeLEs( tbNode, tbNodeCompStyle, djObj, jsObj );
+ var tbNodeCompStyle = djObj.gcs( tbNode );
+ tbLayoutInfo = jsUI.getLayoutExtents( tbNode, tbNodeCompStyle, djObj, jsObj );
var dragCursor = tbNodeCompStyle.cursor;
if ( dragCursor == null || dragCursor.length == 0 )
dragCursor = "move";
decorationConfig.dragCursor = dragCursor;
+ tbLayoutInfo.mBh = djObj.getMarginBox( tbNode, tbNodeCompStyle, jsObj ).h;
+ var tbMarginBottom = Math.max( 0, tbLayoutInfo.mE.h - tbLayoutInfo.mE.t );
+ cNode_mBh_adj_tb_mBh = ( tbLayoutInfo.mBh - tbMarginBottom ) + Math.max( 0, (tbMarginBottom - cMarginTop) );
+ layoutInfo.tbNode = tbLayoutInfo;
}
+ var rbLayoutInfo = null;
if ( rbNode )
{
- rbNodeCompStyle = djObj.gcs( rbNode );
- layoutExtents.rbNode = this._createNodeLEs( rbNode, rbNodeCompStyle, djObj, jsObj );
+ var rbNodeCompStyle = djObj.gcs( rbNode );
+ rbLayoutInfo = jsUI.getLayoutExtents( rbNode, rbNodeCompStyle, djObj, jsObj );
+ rbLayoutInfo.mBh = djObj.getMarginBox( rbNode, rbNodeCompStyle, jsObj ).h;
+ var rbMarginTop = Math.max( 0, rbLayoutInfo.mE.t );
+ cNode_mBh_adj_rb_mBh = ( rbLayoutInfo.mBh - rbMarginTop ) + Math.max( 0, (rbMarginTop - cMarginBottom) );
+ layoutInfo.rbNode = rbLayoutInfo;
}
- var dNodeMarginBox = djObj.getMarginBox( dNode, dNodeCompStyle, jsObj ) ;
- var dNodeContentBox = djObj.getContentBox( dNode, dNodeCompStyle, jsObj ) ;
-
- layoutExtents.lostHeight=
- ( dNodeMarginBox.h - dNodeContentBox.h )
- + ( tbNode ? djObj.getMarginBox(tbNode, tbNodeCompStyle, jsObj).h : 0 )
- + ( rbNode ? djObj.getMarginBox(rbNode, rbNodeCompStyle, jsObj).h : 0 );
-
- layoutExtents.lostWidth = dNodeMarginBox.w - dNodeContentBox.w;
+ layoutInfo.cNode_mBh_LessBars = cNode_mBh_adj_tb_mBh + cNode_mBh_adj_rb_mBh;
if ( ! forIFrameStyles )
- decorationConfig.layoutExtents = layoutExtents;
+ decorationConfig.layout = layoutInfo;
else
- decorationConfig.layoutExtentsIFrame = layoutExtents;
- },
-
- testLost: function()
- {
- var djObj = dojo;
- var jsObj = jetspeed;
- var dNode = this.domNode;
- var tbNode = this.tbNode;
- var rbNode = this.rbNode;
- var dNodeCompStyle = djObj.gcs( dNode );
- var tbNodeCompStyle = djObj.gcs( tbNode );
- var rbNodeCompStyle = djObj.gcs( rbNode );
- var dNodeMarginBox = djObj.getMarginBox( dNode, dNodeCompStyle, jsObj ) ;
- var dNodeContentBox = djObj.getContentBox( dNode, dNodeCompStyle, jsObj ) ;
-
- var tbmb = djObj.getMarginBox(tbNode, tbNodeCompStyle, jsObj);
- var rbmb = djObj.getMarginBox(rbNode, rbNodeCompStyle, jsObj);
-
- var lost = { id: this.widgetId, dMBw: dNodeMarginBox.w, dMBh: dNodeMarginBox.h, dCBw: dNodeContentBox.h, dCBh: dNodeContentBox.w, tbMBh: tbmb.h, rbMBh: rbmb.h, dNodePos: dNodeCompStyle.position, dNodeDis: dNodeCompStyle.display, dNodeWidth: dNodeCompStyle.width, dNodeHeight: dNodeCompStyle.height };
- lost.lostHeight =
- ( dNodeMarginBox.h - dNodeContentBox.h )
- + ( tbNode ? djObj.getMarginBox(tbNode, tbNodeCompStyle, jsObj).h : 0 )
- + ( rbNode ? djObj.getMarginBox(rbNode, rbNodeCompStyle, jsObj).h : 0 );
-
- lost.lostWidth = dNodeMarginBox.w - dNodeContentBox.w;
-
- var lostStr = jetspeed.printobj( lost );
- if ( jetspeed.lostFirst == null )
- jetspeed.lostFirst = lostStr;
-
- return lostStr;
- },
-
- /* static */
- _createNodeLEs: function( node, nodeCS, djObj, jsObj )
- {
- var padborder = djObj._getPadBorderExtents( node, nodeCS );
- var margin = djObj._getMarginExtents( node, nodeCS, jsObj);
- return { padborder: padborder,
- margin: margin,
- lessW: ( padborder.w + margin.w ),
- lessH: ( padborder.h + margin.h ) };
- },
+ decorationConfig.layoutIFrame = layoutInfo;
+ }, // _createLayoutInfo
// action functions
- windowActionButtonClick: function( evt )
+ actionBtnClick: function( evt )
{
if ( evt == null || evt.target == null ) return;
- this.windowActionProcess( evt.target.actionName, evt );
+ this.actionProcess( evt.target.actionName, evt );
},
- windowActionMenuOpen: function( evt )
+ actionMenuOpen: function( evt )
{
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
+
+ var menuWidget = this.actionMenuWidget;
+ if ( ! menuWidget ) return;
+ if ( menuWidget.isShowingNow )
+ menuWidget.close();
+
var aState = null;
var aMode = null;
if ( this.portlet )
@@ -775,30 +785,28 @@
aState = this.portlet.getCurrentActionState();
aMode = this.portlet.getCurrentActionMode();
}
- for ( var aNm in this.actionMenus )
+
+ var menuItemsByName = menuWidget.menuItemsByName;
+ var menuItem, miDisplay;
+ for ( var aNm in menuItemsByName )
{
- var menuitem = this.actionMenus[ aNm ];
- if ( this._isWindowActionEnabled( aNm, aState, aMode ) )
- {
- menuitem.domNode.style.display = ""; // instead of menuitem.enable();
- }
- else
- {
- menuitem.domNode.style.display = "none"; // instead of menuitem.disable();
- }
+ menuItem = menuItemsByName[ aNm ];
+ miDisplay = ( this._isActionEnabled( aNm, aState, aMode, jsObj, jsId ) ) ? "" : "none";
+ menuItem.domNode.style.display = miDisplay; // instead of menuItem.enable()/disable()
}
- this.actionMenuWidget.onOpen( evt );
+ menuWidget.pWin = this;
+ menuWidget.onOpen( evt );
},
- windowActionProcessDev: function( /* String */ aNm, evt )
+ actionProcessDev: function( /* String */ aNm, evt )
{
- if ( aNm == this.dbMenuDims )
+ if ( aNm == this.dbMenuDims && jetspeed.debugPWinPos )
{
- this.dumpPos();
+ jetspeed.debugPWinPos( this );
}
},
- windowActionProcess: function( /* String */ aNm, evt )
+ actionProcess: function( /* String */ aNm, evt )
{ // evt arg is needed only for opening action menu
- //dojo.debug( "windowActionProcess [" + ( this.portlet ? this.portlet.entityId : this.widgetId ) + ( this.portlet ? (" / " + this.widgetId) : "" ) + "]" + " actionName=" + aNm );
+ //dojo.debug( "actionProcess [" + ( this.portlet ? this.portlet.entityId : this.widgetId ) + ( this.portlet ? (" / " + this.widgetId) : "" ) + "]" + " actionName=" + aNm );
var jsObj = jetspeed;
var jsId = jsObj.id;
if ( aNm == null ) return;
@@ -823,7 +831,7 @@
}
else if ( aNm == jsId.ACT_MENU )
{
- this.windowActionMenuOpen( evt );
+ this.actionMenuOpen( evt );
}
else if ( aNm == jsId.ACT_MINIMIZE )
{ // make no associated content request - just notify server of change
@@ -838,7 +846,7 @@
}
if ( ! this.portlet )
{
- this.windowActionButtonSync();
+ this.actionBtnSyncDefer();
}
}
else if ( aNm == jsId.ACT_RESTORE )
@@ -869,7 +877,7 @@
}
if ( ! this.portlet )
{
- this.windowActionButtonSync();
+ this.actionBtnSyncDefer();
}
}
else if ( aNm == jsId.ACT_MAXIMIZE )
@@ -887,7 +895,7 @@
}
else
{
- this.windowActionButtonSync();
+ this.actionBtnSync( jsObj, jsId );
}
}
else if ( aNm == jsId.ACT_REMOVEPORTLET )
@@ -906,13 +914,14 @@
if ( this.portlet )
this.portlet.renderAction( aNm );
}
- },
+ }, // actionProcess
- _isWindowActionEnabled: function( aNm, aState, aMode )
+ _isActionEnabled: function( aNm, aState, aMode, jsObj, jsId )
{
var jsObj = jetspeed;
var jsId = jsObj.id;
var enabled = false;
+ var winState = this.windowState;
if ( this.minimizeTempRestore != null )
{
if ( this.portlet )
@@ -930,21 +939,22 @@
}
else if ( aNm == jsId.ACT_MENU )
{
- if ( ! this._windowActionMenuIsEmpty() )
+ if ( ! this._actionMenuIsEmpty( jsObj, jsId ) )
enabled = true;
}
else if ( jsObj.prefs.windowActionDesktop[ aNm ] != null )
{
if ( this.getLayoutActionsEnabled() )
{
+ var ie6Minimized = ( this.ie6 && winState == jsId.ACT_MINIMIZE );
if ( aNm == jsId.ACT_DESKTOP_HEIGHT_EXPAND )
{
- if ( ! this.heightToFit )
+ if ( ! this.heightToFit && ! ie6Minimized )
enabled = true;
}
else if ( aNm == jsId.ACT_DESKTOP_HEIGHT_NORMAL )
{
- if ( this.heightToFit )
+ if ( this.heightToFit && ! ie6Minimized )
enabled = true;
}
else if ( aNm == jsId.ACT_DESKTOP_TILE && jsObj.prefs.windowTiling )
@@ -993,21 +1003,21 @@
{ // adjust visible action buttons - BOZO:NOW: this non-portlet case needs more attention
if ( aNm == jsId.ACT_MAXIMIZE )
{
- if ( aNm != this.windowState && this.minimizeTempRestore == null )
+ if ( aNm != winState && this.minimizeTempRestore == null )
{
enabled = true;
}
}
else if ( aNm == jsId.ACT_MINIMIZE )
{
- if ( aNm != this.windowState )
+ if ( aNm != winState )
{
enabled = true;
}
}
else if ( aNm == jsId.ACT_RESTORE )
{
- if ( this.windowState == jsId.ACT_MAXIMIZE || this.windowState == jsId.ACT_MINIMIZE )
+ if ( winState == jsId.ACT_MAXIMIZE || winState == jsId.ACT_MINIMIZE )
{
enabled = true;
}
@@ -1018,31 +1028,45 @@
}
}
return enabled;
- },
- _windowActionMenuIsEmpty: function()
- { // meant to be called from within _isWindowActionEnabled call for ACT_MENU
- var aState = null;
- var aMode = null;
- if ( this.portlet )
- {
- aState = this.portlet.getCurrentActionState();
- aMode = this.portlet.getCurrentActionMode();
- }
+ }, // _isActionEnabled
+
+ _actionMenuIsEmpty: function( jsObj, jsId )
+ { // meant to be called from within _isActionEnabled call for ACT_MENU
var actionMenuIsEmpty = true;
- for ( var aNm in this.actionMenus )
+ var menuWidget = this.actionMenuWidget;
+ if ( menuWidget )
{
- var menuitem = this.actionMenus[ aNm ];
- if ( aNm != jetspeed.id.ACT_MENU && this._isWindowActionEnabled( aNm, aState, aMode ) )
+ var aState = null;
+ var aMode = null;
+ if ( this.portlet )
+ {
+ aState = this.portlet.getCurrentActionState();
+ aMode = this.portlet.getCurrentActionMode();
+ }
+
+ for ( var aNm in menuWidget.menuItemsByName )
{
- actionMenuIsEmpty = false;
- break;
+ if ( aNm != jsId.ACT_MENU && this._isActionEnabled( aNm, aState, aMode, jsObj, jsId ) )
+ {
+ actionMenuIsEmpty = false;
+ break;
+ }
}
}
return actionMenuIsEmpty ;
},
- windowActionButtonSync: function()
+ actionBtnSyncDefer: function()
+ { // delay helps mozilla update btn visibility on minimize and restore-from-minimized
+ dojo.lang.setTimeout( this, this.actionBtnSync, 10 );
+ },
+
+ actionBtnSync: function( jsObj, jsId )
{
+ if ( ! jsObj )
+ {
+ jsObj = jetspeed; jsId = jsObj.id;
+ }
var hideButtons = this.decConfig.windowActionButtonHide;
var aState = null;
var aMode = null;
@@ -1056,49 +1080,59 @@
var showBtn = false;
if ( ! hideButtons || this.titleLit )
{
- showBtn = this._isWindowActionEnabled( aNm, aState, aMode );
+ showBtn = this._isActionEnabled( aNm, aState, aMode, jsObj, jsId );
}
var buttonNode = this.actionButtons[ aNm ];
- if ( showBtn )
- buttonNode.style.display = "";
- else
- buttonNode.style.display = "none";
+ buttonNode.style.display = ( showBtn ) ? "" : "none";
}
},
_postCreateMaximizeWindow: function()
{
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
this.maximizeWindow();
- this.windowActionButtonSync();
+ if ( this.portlet )
+ {
+ this.portlet.renderAction( jsId.ACT_MAXIMIZE );
+ }
+ else
+ {
+ this.actionBtnSync( jsObj, jsId );
+ }
},
minimizeWindowTemporarily: function()
{
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
if ( this.minimizeTempRestore == null )
{
this.minimizeTempRestore = this.windowState;
- if ( this.windowState != jetspeed.id.ACT_MINIMIZE )
+ if ( this.windowState != jsId.ACT_MINIMIZE )
{
- this.minimizeWindow();
+ this.minimizeWindow( false );
}
- this.windowActionButtonSync();
+ this.actionBtnSync( jsObj, jsId );
}
},
restoreFromMinimizeWindowTemporarily: function()
{
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
var restoreToWindowState = this.minimizeTempRestore;
this.minimizeTempRestore = null;
if ( restoreToWindowState )
{
- if ( restoreToWindowState != jetspeed.id.ACT_MINIMIZE )
+ if ( restoreToWindowState != jsId.ACT_MINIMIZE )
{
this.restoreWindow();
}
- this.windowActionButtonSync();
+ this.actionBtnSync( jsObj, jsId );
}
},
- minimizeWindow: function( evt )
+ minimizeWindow: function( minimizeOnLoad )
{
if ( ! this.tbNode )
return;
@@ -1106,88 +1140,44 @@
var jsObj = jetspeed;
if ( this.windowState == jetspeed.id.ACT_MAXIMIZE )
{
- this.showAllPortletWindows() ;
- this.restoreWindow( evt );
+ jsObj.widget.showAllPortletWindows() ;
+ this.restoreWindow();
+ }
+ else if ( ! minimizeOnLoad )
+ {
+ this._updtDimsObj( false, false );
}
- this._updtDimsObj( false );
-
var disIdx = jsObj.css.cssDis;
this.cNodeCss[ disIdx ] = "none";
if ( this.rbNodeCss )
this.rbNodeCss[ disIdx ] = "none";
- //this._alterCss( true, true );
-
- //dojo.html.setContentBox( this.domNode, { height: dojo.html.getMarginBox( this.tbNode ).height } );
-
- // BOZO:WIDGET: xxxx this needs lots of attention!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
-
- this.containerNode.style.display = "none";
- if ( this.rbNode )
- this.rbNode.style.display = "none";
- dojo.html.setContentBox( this.domNode, { height: dojo.html.getMarginBox( this.tbNode ).height } );
-
-
- //this.domNode.style.height = ""; // xxxx hack to avoid setting minimized height in dims object - call to setContentBox was used previously
- //this.containerNode.style.height = ""; // xxxx hack to avoid setting minimized height in dims object - call to setContentBox was used previously
-
this.windowState = jsObj.id.ACT_MINIMIZE;
- },
- showAllPortletWindows: function()
- {
- var allPWwidgets = jetspeed.page.getPWins( false );
- for ( var i = 0 ; i < allPWwidgets.length ; i++ )
- {
- var showPWwidget = allPWwidgets[i] ;
- if ( showPWwidget )
- {
- showPWwidget.domNode.style.display = "";
- }
- }
- },
- hideAllPortletWindows: function( excludeWidgetIds )
- {
- var allPWwidgets = jetspeed.page.getPWins( false );
- for ( var i = 0 ; i < allPWwidgets.length ; i++ )
- {
- var hidePWwidget = allPWwidgets[i] ;
- if ( hidePWwidget && excludeWidgetIds && excludeWidgetIds.length > 0 )
- {
- for ( var exclI = 0 ; exclI < excludeWidgetIds.length ; exclI++ )
- {
- if ( hidePWwidget.widgetId == excludeWidgetIds[exclI] )
- {
- hidePWwidget = null;
- break;
- }
- }
- }
- if ( hidePWwidget )
- {
- hidePWwidget.domNode.style.display = "none";
- }
- }
- },
- maximizeWindow: function( evt )
+ if ( this.ie6 )
+ this.containerNode.style.display = "none"; // in ie6, this needs to happen before bulk changes in alterCss
+ this._alterCss( true, true );
+ }, // minimizeWindow
+
+ maximizeWindow: function()
{
var jsObj = jetspeed;
var jsId = jsObj.id;
var dNode = this.domNode;
var hideAllBut = [ this.widgetId ];
- //if ( this.dbOn )
+ //if ( this.dbOn ) // show debug window when other window is maximized
// hideAllBut.push( jetspeed.debugWindowId() );
- this.hideAllPortletWindows( hideAllBut ) ;
+ jsObj.widget.hideAllPortletWindows( hideAllBut ) ;
if ( this.windowState == jsId.ACT_MINIMIZE )
{
- this.restoreWindow( evt );
+ this.restoreWindow();
}
var preMaxPosStatic = this.posStatic;
this.preMaxPosStatic = preMaxPosStatic;
this.preMaxHeightToFit = this.heightToFit;
var tiledStateWillChange = preMaxPosStatic;
- this._updtDimsObj( tiledStateWillChange );
+ this._updtDimsObj( false, tiledStateWillChange );
var jetspeedDesktop = document.getElementById( jsId.DESKTOP );
var yPos = dojo.html.getAbsolutePosition( jetspeedDesktop, true ).y; // passing true to fix position at top (so not affected by vertically scrolled window)
@@ -1195,10 +1185,10 @@
var docPadding = dojo.html.getPadding( jsObj.docBody );
// hardcoded to fill document.body width leaving 1px on each side
- this.dimsUntiledTemp = { width: viewport.width - docPadding.width - 2,
- height: viewport.height - docPadding.height - yPos,
- left: 1,
- top: yPos };
+ this.dimsUntiledTemp = { w: viewport.width - docPadding.width - 2,
+ h: viewport.height - docPadding.height - yPos,
+ l: 1,
+ t: yPos };
this._setTitleBarDragging( true, jsObj.css, false );
@@ -1211,8 +1201,9 @@
jetspeedDesktop.appendChild( dNode );
this.windowState = jsId.ACT_MAXIMIZE;
- },
- restoreWindow: function( evt )
+ }, // maximizeWindow
+
+ restoreWindow: function()
{
var jsObj = jetspeed;
var jsId = jsObj.id;
@@ -1227,7 +1218,7 @@
var lastPI = null;
if ( this.windowState == jsId.ACT_MAXIMIZE )
{
- this.showAllPortletWindows() ;
+ jsObj.widget.showAllPortletWindows() ;
this.posStatic = this.preMaxPosStatic;
this.heightToFit = this.preMaxHeightToFit;
this.dimsUntiledTemp = null;
@@ -1238,86 +1229,181 @@
if ( this.rbNodeCss )
this.rbNodeCss[ disIdx ] = "block";
- var dimsPrevious = this.getDimsObj( this.posStatic );
-
this.windowState = jsId.ACT_RESTORE; // "normal"
this._setTitleBarDragging( true, jsObj.css );
- this._alterCss( true, true );
+ var ie6 = this.ie6;
+
+ if ( ! ie6 )
+ {
+ this._alterCss( true, true );
+ }
+ else
+ {
+ var iNodeCss = null;
+ if ( this.heightToFit )
+ {
+ iNodeCss = this.iNodeCss;
+ // blank out height so that it can be recalculated based on actual content height
+ this.iNodeCss = null; // if not null, _alterCss will not set content relative height
+ }
+ this._alterCss( true, true );
+ this._updtDimsObj( false, false, true, false, true ); // force update width and height
+ if ( iNodeCss != null )
+ this.iNodeCss = iNodeCss;
+ this._alterCss( false, false, true ); // resize
+ }
if ( this.posStatic && currentlyAbsolute )
- { // tiled window in maximized needs to be placed back in previous column/row
- if ( dimsPrevious != null && dimsPrevious.columnInfo != null && dimsPrevious.columnInfo.columnIndex != null )
- {
- var columnElmt = jsObj.page.columns[ dimsPrevious.columnInfo.columnIndex ];
- if ( dimsPrevious.columnInfo.previousSibling )
- dojo.dom.insertAfter( dNode, dimsPrevious.columnInfo.previousSibling );
- else if ( dimsPrevious.columnInfo.nextSibling )
- dojo.dom.insertBefore( dNode, dimsPrevious.columnInfo.nextSibling );
- else
- columnElmt.domNode.appendChild( dNode );
- }
- else
+ { // tiled window in maximized or window just set from untiled to tiled - needs to be placed back in previous column/row
+ this._tileWindow( jsObj );
+ }
+ }, // restoreWindow
+
+ _tileWindow: function( jsObj )
+ {
+ if ( ! this.posStatic ) return;
+ var dNode = this.domNode;
+ var dimsPrevious = this.getDimsObj( this.posStatic );
+ var cannotPlace = true;
+ if ( dimsPrevious != null )
+ {
+ var colInfo = dimsPrevious.colInfo;
+ if ( colInfo != null && colInfo.colI != null )
{
- if ( jsObj.page.columns != null && jsObj.page.columns.length > 0 )
- dojo.dom.prependChild( dNode, jsObj.page.columns[ 0 ].domNode );
+ var colObj = jsObj.page.columns[ colInfo.colI ];
+ var colNode = ( (colObj != null) ? colObj.domNode : null);
+ if ( colNode != null )
+ {
+ var colChildAtIndex = null;
+ var colNodeChildLen = colNode.childNodes.length;
+ if ( colNodeChildLen == 0 )
+ {
+ colNode.appendChild( dNode );
+ cannotPlace = false;
+ }
+ else
+ {
+ var colChild, colChildId, colChildIndex = 0;
+ if ( colInfo.pSibId != null || colInfo.nSibId != null )
+ {
+ colChild = colNode.firstChild;
+ do
+ {
+ colChildId = colChild.id;
+ if ( colChildId == null ) continue;
+ if ( colChildId == colInfo.pSibId )
+ {
+ dojo.dom.insertAfter( dNode, colChild );
+ cannotPlace = false;
+ }
+ else if ( colChildId == colInfo.nSibId )
+ {
+ dojo.dom.insertBefore( dNode, colChild );
+ cannotPlace = false;
+ }
+ else if ( colChildIndex == colInfo.elmtI )
+ {
+ colChildAtIndex = colChild;
+ }
+ colChild = colChild.nextSibling;
+ colChildIndex++;
+ } while ( cannotPlace && colChild != null )
+ }
+ }
+ if ( cannotPlace )
+ {
+ if ( colChildAtIndex != null )
+ {
+ dojo.dom.insertBefore( dNode, colChildAtIndex );
+ }
+ else
+ {
+ dojo.dom.prependChild( dNode, colNode );
+ }
+ cannotPlace = false;
+ }
+ }
}
}
- },
- _updtDimsObj: function( tiledStateWillChange )
+ if ( cannotPlace )
+ {
+ var defaultColumn = jsObj.page.getColumnDefault();
+ if ( defaultColumn != null )
+ dojo.dom.prependChild( dNode, defaultColumn.domNode );
+ }
+ }, // _tileWindow
+
+ getDimsObj: function( posStatic, doNotReturnTemp )
+ {
+ return ( posStatic ? ( (this.dimsTiledTemp != null && ! doNotReturnTemp) ? this.dimsTiledTemp : this.dimsTiled ) : ( (this.dimsUntiledTemp != null && ! doNotReturnTemp) ? this.dimsUntiledTemp : this.dimsUntiled ) );
+ },
+ _updtDimsObj: function( updtOnlyIfPropIsUndefined, tiledStateWillChange, ltNoTouch, whNoTouch, whForce, copyToAndSetTemp )
{
var jsObj = jetspeed;
- var jsId = jsObj.id;
var djObj = dojo;
var dNode = this.domNode;
var posStatic = this.posStatic;
- var dimsCurrent = this.getDimsObj( posStatic );
+
+ var dimsCurrent = this.getDimsObj( posStatic, copyToAndSetTemp );
+
+ var lORtIsUndef = ( ! ltNoTouch && ! posStatic && ( ! updtOnlyIfPropIsUndefined || dimsCurrent.l == null || dimsCurrent.t == null ) );
+ var wORhIsUndef = ( ! whNoTouch && ( ! updtOnlyIfPropIsUndefined || lORtIsUndef || whForce || dimsCurrent.w == null || dimsCurrent.h == null ) );
+
+ if ( wORhIsUndef || lORtIsUndef )
+ {
+ var dNodeLayoutInfo = this._getLayoutInfo().dNode;
+ if ( wORhIsUndef )
+ {
+ var dNodeMarginSize = jsObj.ui.getMarginBoxSize( dNode, dNodeLayoutInfo );
+ dimsCurrent.w = dNodeMarginSize.w;
+ dimsCurrent.h = dNodeMarginSize.h;
+ if ( ! posStatic ) lORtIsUndef = true;
+ }
+ if ( lORtIsUndef )
+ {
+ var winAbsPos = djObj.html.getAbsolutePosition( dNode, true );
+ dimsCurrent.l = winAbsPos.x - dNodeLayoutInfo.mE.l - dNodeLayoutInfo.pbE.l;
+ dimsCurrent.t = winAbsPos.y - dNodeLayoutInfo.mE.t - dNodeLayoutInfo.pbE.t;
+ }
+ }
if ( posStatic )
{
- if ( tiledStateWillChange )
+ if ( tiledStateWillChange || copyToAndSetTemp && dimsCurrent.colInfo == null )
{ // record col/row location
- var columnInfo = {};
- var sibling = djObj.dom.getPreviousSiblingElement( dNode );
- if ( sibling )
- columnInfo.previousSibling = sibling;
- else
+ var nodeIndex = 0, backNode = dNode.previousSibling, nextNode = dNode.nextSibling;
+ var prevId = ( backNode != null ? backNode.id : null ), nextId = ( nextNode != null ? nextNode.id : null );
+ if ( backNode != null ) prevId = backNode.id;
+ while ( backNode != null )
{
- sibling = djObj.dom.getNextSiblingElement( dNode );
- if ( sibling )
- columnInfo.nextSibling = sibling;
- }
- columnInfo.columnIndex = this.getPageColumnIndex();
- dimsCurrent.columnInfo = columnInfo;
- }
- /*
- if ( this.windowState != jsId.ACT_MINIMIZE && this.windowState != jsId.ACT_MAXIMIZE )
- {
- var h = null, cssH = this.dNodeCss[ jsObj.css.cssH ];
- if ( cssH != null && cssH.length > 0 )
- h = new Number( cssH );
- if ( isNaN( h ) )
- h = null;
- dimsCurrent.height = h;
+ nodeIndex++;
+ backNode = backNode.previousSibling;
+ }
+ dimsCurrent.colInfo = { elmtI: nodeIndex, pSibId: prevId, nSibId: nextId, colI: this.getPageColumnIndex() };
+ }
+
+ if ( copyToAndSetTemp )
+ {
+ this.dimsTiledTemp = { w: dimsCurrent.w,
+ h: dimsCurrent.h,
+ colInfo: dimsCurrent.colInfo };
+ dimsCurrent = this.dimsTiledTemp;
}
- dimsCurrent.width = null;
- */
}
else
{
- //if ( this.windowState != jsId.ACT_MINIMIZE && this.windowState != jsId.ACT_MAXIMIZE )
- //{
- // var domNodeMarginBox = djObj.html.getMarginBox( dNode ) ;
- // this.dimsUntiled =
- // {
- // width: domNodeMarginBox.width,
- // height: domNodeMarginBox.height,
- // left: dNode.style.left,
- // top: dNode.style.top,
- // };
- //}
+ if ( copyToAndSetTemp )
+ {
+ this.dimsUntiledTemp = { w: dimsCurrent.w,
+ h: dimsCurrent.h,
+ l: dimsCurrent.l,
+ t: dimsCurrent.t };
+ dimsCurrent = this.dimsUntiledTemp;
+ }
}
- },
+ return dimsCurrent;
+ }, // _updtDimsObj
getLayoutActionsEnabled: function()
{
@@ -1353,17 +1439,17 @@
this.tbNodeCss[ jsCss.cssCur ] = cursorVal;
if ( ! suppressStyleUpdate )
tbNode.style.cursor = cursorVal;
- },
+ }, // _setTitleBarDragging
onMouseDown: function( /*Event*/ evt )
{ // summary: callback for click anywhere in window
- this.bringToTop();
+ this.bringToTop( evt, false, false, jetspeed );
},
- bringToTop: function( evt, inclStatic )
+
+ bringToTop: function( evt, inclStatic, suppressSubmitChange, jsObj )
{
if ( ! this.posStatic )
{ // bring-to-front
- var jsObj = jetspeed;
var jsPage = jsObj.page;
var jsCss = jsObj.css;
var dNodeCss = this.dNodeCss;
@@ -1374,8 +1460,8 @@
var zTop = this._setAsTopZIndex( jsPage, jsCss, dNodeCss, false );
if ( this.windowInitialized )
{
- this.domNode.style.zIndex = String( zTop );
- if ( this.portlet && this.windowState != jetspeed.id.ACT_MAXIMIZE )
+ this.domNode.style.zIndex = zTop;
+ if ( ! suppressSubmitChange && this.portlet && this.windowState != jetspeed.id.ACT_MAXIMIZE )
this.portlet.submitWinState();
}
//dojo.debug( "bringToTop [" + this.widgetId + "] zIndex before=" + zCur + " after=" + zTop );
@@ -1386,22 +1472,27 @@
var zTop = this._setAsTopZIndex( jsPage, jsCss, dNodeCss, true );
if ( this.windowInitialized )
{
- this.domNode.style.zIndex = String( zTop );
+ this.domNode.style.zIndex = zTop;
}
}
- },
+ }, // bringToTop
+
_setAsTopZIndex: function( jsPage, jsCss, dNodeCss, posStatic )
{
- var zTop = jsPage.getPWinTopZIndex( posStatic );
+ var zTop = String( jsPage.getPWinTopZIndex( posStatic ) );
dNodeCss[ jsCss.cssZIndex ] = zTop;
return zTop;
},
+
makeUntiled: function()
{
var jsObj = jetspeed;
- this._updtDimsObj( true );
+
+ this._updtDimsObj( false, true );
- this._makeUntiledDims();
+ this.posStatic = false;
+ this._updtDimsObj( true, false );
+
this._setAsTopZIndex( jsObj.page, jsObj.css, this.dNodeCss, false );
this._alterCss( true, true );
@@ -1416,43 +1507,26 @@
this.portlet.submitWinState();
this._addUntiledEvents();
- },
- _makeUntiledDims: function()
- {
- var dNode = this.domNode ;
-
- this.posStatic = false;
-
- var dimsUntiled = this.getDimsObj( false );
+ }, // makeUntiled
- if ( dimsUntiled.width == null || dimsUntiled.height == null ||
- dimsUntiled.left == null || dimsUntiled.top == null )
- { // determine initial untiled position based on current tiled position
- var djH = dojo.html;
- var winAbsPos = djH.getAbsolutePosition( dNode, true );
- var winMarginTop = djH.getPixelValue( dNode, "margin-top", true );
- var winMarginLeft = djH.getPixelValue( dNode, "margin-left", true );
- var dNodeMarginBox = djH.getMarginBox( dNode );
- dimsUntiled.width = dNodeMarginBox.width;
- dimsUntiled.height = dNodeMarginBox.height;
- dimsUntiled.left = winAbsPos.x - winMarginTop;
- dimsUntiled.top = winAbsPos.y - winMarginLeft;
- }
- },
makeTiled: function()
{
this.posStatic = true;
var jsObj = jetspeed;
- var zTop = this._setAsTopZIndex( jsObj.page, jsObj.css, this.dNodeCss, true );
+ this._setAsTopZIndex( jsObj.page, jsObj.css, this.dNodeCss, true );
- this.restoreWindow();
+ this._alterCss( true, true );
+
+ //this.restoreWindow();
+ this._tileWindow( jsObj );
if ( this.portlet )
this.portlet.submitWinState();
this._removeUntiledEvents();
- },
+ }, // makeTiled
+
_addUntiledEvents: function()
{
if ( this._untiledEvts == null )
@@ -1469,36 +1543,36 @@
}
},
- makeHeightToFit: function( suppressSubmitChange, suppressLogging )
- { // suppressLogging is to support contentChanged
+ makeHeightToFit: function( suppressSubmitChange )
+ {
var domNodePrevMarginBox = dojo.html.getMarginBox( this.domNode ) ;
this.heightToFit = true;
+ if ( this.ie6 )
+ {
+ var iNodeCss = this.iNodeCss;
+ // blank out height so that it can be recalculated based on actual content height
+ this.iNodeCss = null; // if not null, _alterCss will not set content relative height
+ this._alterCss( false, true );
+ this._updtDimsObj( false, false, true, false, true ); // force update width and height
+ this.iNodeCss = iNodeCss;
+ }
+
this._alterCss( false, true );
- // xxxx previously called adjPosToDeskState twice - once before resize call, and once after
- //if ( suppressLogging == null || suppressLogging != true )
- //{ // flags are to avoid init problems with dojo-debug window when height-to-fit is set (causing stack overflow when dojo.debug() is called)
- //dojo.debug( "makeHeightToFit [" + this.widgetId + "] prev w=" + domNodePrevMarginBox.width + " h=" + domNodePrevMarginBox.height + " new w=" + domNodeMarginBox.width + " h=" + domNodeMarginBox.height );
- //}
-
if ( ! suppressSubmitChange && this.portlet )
this.portlet.submitWinState();
- },
+ }, // makeHeightToFit
+
makeHeightVariable: function( suppressSubmitChange, isResizing )
{
- //var domNodePrevMarginBox = dojo.html.getMarginBox( this.domNode ) ;
- // xxxx previously called getMarginBox twice - once before adjPosToDeskState call, and once after
-
- //dojo.debug( "makeHeightVariable [" + this.widgetId + "] prev w=" + domNodePrevMarginBox.width + " h=" + domNodePrevMarginBox.height + " new w=" + domNodeMarginBox.width + " h=" + domNodeMarginBox.height );
- //dojo.debug( "makeHeightVariable [" + this.widgetId + "] containerNode PREV style.width=" + this.containerNode.style.width + " style.height=" + this.containerNode.style.height );
-
var dimsCurrent = this.getDimsObj( this.posStatic );
- var domNodeMarginBox = dojo.html.getMarginBox( this.domNode ) ;
- dimsCurrent.width = domNodeMarginBox.width;
- dimsCurrent.height = domNodeMarginBox.height + 3; // the plus 3 is mysteriously useful for avoiding initial scrollbar
+ var dNodeLayoutInfo = this._getLayoutInfo().dNode;
+ var dNodeMarginBox = jetspeed.ui.getMarginBoxSize( this.domNode, dNodeLayoutInfo );
+ dimsCurrent.w = dNodeMarginBox.w;
+ dimsCurrent.h = dNodeMarginBox.h;
this.heightToFit = false;
@@ -1511,14 +1585,14 @@
if ( ! suppressSubmitChange && this.portlet )
this.portlet.submitWinState();
- },
+ }, // makeHeightVariable
resizeTo: function( w, h, force )
{
var dimsCurrent = this.getDimsObj( this.posStatic );
- dimsCurrent.width = w;
- dimsCurrent.height = h;
+ dimsCurrent.w = w;
+ dimsCurrent.h = h;
this._alterCss( false, false, true );
@@ -1532,34 +1606,86 @@
this.windowIsSizing = true;
}
}
+ this.resizeNotifyChildWidgets();
+ }, // resizeTo
+
+ resizeNotifyChildWidgets: function()
+ {
+ if ( this.childWidgets )
+ {
+ var childWidgets = this.childWidgets;
+ var childWidgetsLen = childWidgets.length, childWidget;
+ for ( var i = 0 ; i < childWidgetsLen ; i++ )
+ {
+ try
+ {
+ childWidget = childWidgets[i];
+ if ( childWidget )
+ childWidget.checkSize();
+ }
+ catch(e)
+ {
+ }
+ }
+ }
+ },
+
+ _getLayoutInfo: function()
+ {
+ var iframesInfoCur = this.iframesInfo;
+ return ( ( ! ( iframesInfoCur && iframesInfoCur.layout ) ) ? this.decConfig.layout : this.decConfig.layoutIFrame );
+ },
+ _getLayoutInfoMoveable: function()
+ {
+ return this._getLayoutInfo().dNode;
+ },
+
+ onBrowserWindowResize: function()
+ {
+ if ( this.ie6 )
+ {
+ this._resetIE6TiledSize( false );
+ }
},
- getDimsObj: function( posStatic )
+ _resetIE6TiledSize: function( changeTiledState )
{
- return ( posStatic ? ( (this.dimsTiledTemp != null) ? this.dimsTiledTemp : this.dimsTiled ) : ( (this.dimsUntiledTemp != null) ? this.dimsUntiledTemp : this.dimsUntiled ) );
+ var posStatic = this.posStatic;
+ if ( posStatic )
+ {
+ var dNode = this.domNode;
+ var dimsCurrent = this.getDimsObj( posStatic );
+ dimsCurrent.w = Math.max( 0, this.domNode.parentNode.offsetWidth - this.colWidth_pbE );
+ this._alterCss( changeTiledState, false, false, false, true ); // changeWidth
+ }
},
- _alterCss: function( changeTiledState, changeHeightToFit, changeResize, changePosition, suppressStyleUpdate )
+ _alterCss: function( changeTiledState, changeHeightToFit, changeResize, changePosition, changeWidth, suppressStyleUpdate )
{
var jsObj = jetspeed;
var jsCss = jsObj.css;
var iframesInfoCur = this.iframesInfo;
var iframeLayout = ( iframesInfoCur && iframesInfoCur.layout );
- var layoutExtents = ( ! iframeLayout ? this.decConfig.layoutExtents : this.decConfig.layoutExtentsIFrame );
+ var layoutInfo = ( ! iframeLayout ? this.decConfig.layout : this.decConfig.layoutIFrame );
+
+ var dNodeCss = this.dNodeCss, cNodeCss = null, tbNodeCss = null, rbNodeCss = null, iNodeCssSet = false, iNodeCss = this.iNodeCss, iCvrIE6Css = null;
+ if ( iNodeCss && iframeLayout )
+ iCvrIE6Css = iframesInfoCur.iframeCoverIE6Css;
+
var posStatic = this.posStatic;
+ var effectivePosStatic = ( posStatic && iNodeCss == null );
var heightToFit = this.heightToFit;
- var setWidth = ( changeTiledState || ( changeResize && ! posStatic ) );
+ var setWidth = ( changeTiledState || changeWidth || ( changeResize && ! effectivePosStatic ) );
var setHeight = ( changeHeightToFit || changeResize );
var setPosition = ( changeTiledState || changePosition );
var setOverflow = ( changeHeightToFit || ( changeResize && iframeLayout ) );
- var dNodeCss = this.dNodeCss, cNodeCss = null, tbNodeCss = null, rbNodeCss = null;
var dimsCurrent = this.getDimsObj( posStatic );
if ( changeTiledState )
{
- dNodeCss[ jsCss.cssPos ] = ( posStatic ? "static" : "absolute" );
+ dNodeCss[ jsCss.cssPos ] = ( posStatic ? "relative" : "absolute" );
}
var setIFrame = null, setIFrameH = null;
@@ -1610,9 +1736,9 @@
}
else
{
- dNodeCss[ lIdx ] = dimsCurrent.left;
+ dNodeCss[ lIdx ] = dimsCurrent.l;
dNodeCss[ luIdx ] = "px";
- dNodeCss[ tIdx ] = dimsCurrent.top;
+ dNodeCss[ tIdx ] = dimsCurrent.t;
dNodeCss[ tuIdx ] = "px";
}
}
@@ -1621,7 +1747,7 @@
{
cNodeCss = this.cNodeCss;
var hIdx = jsCss.cssH, huIdx = jsCss.cssHU;
- if ( heightToFit )
+ if ( heightToFit && iNodeCss == null )
{
dNodeCss[ hIdx ] = "";
dNodeCss[ huIdx ] = "";
@@ -1630,21 +1756,47 @@
}
else
{
- var h = dimsCurrent.height;
- dNodeCss[ hIdx ] = (h - layoutExtents.dNode.lessH);
+ var h = dimsCurrent.h;
+ var disIdx = jsObj.css.cssDis;
+ var dNodeCBHeight;
+ var cNodeCBHeight;
+ if ( cNodeCss[ disIdx ] == "none" )
+ {
+ dNodeCBHeight = layoutInfo.tbNode.mBh;
+ cNodeCBHeight = "";
+ cNodeCss[ huIdx ] = "";
+ }
+ else
+ {
+ dNodeCBHeight = (h - layoutInfo.dNode.lessH);
+ cNodeCBHeight = dNodeCBHeight - layoutInfo.cNode.lessH - layoutInfo.cNode_mBh_LessBars;
+ cNodeCss[ huIdx ] = "px";
+ }
+ dNodeCss[ hIdx ] = dNodeCBHeight;
dNodeCss[ huIdx ] = "px";
- cNodeCss[ hIdx ] = (h - layoutExtents.cNode.lessH - layoutExtents.lostHeight);
- cNodeCss[ huIdx ] = "px";
+ cNodeCss[ hIdx ] = cNodeCBHeight;
+ if ( iNodeCss )
+ {
+ iNodeCss[ hIdx ] = dNodeCBHeight;
+ iNodeCss[ huIdx ] = "px";
+ iNodeCssSet = true;
+ if ( iCvrIE6Css )
+ {
+ iCvrIE6Css[ hIdx ] = cNodeCBHeight;
+ iCvrIE6Css[ huIdx ] = cNodeCss[ huIdx ];
+ }
+ }
}
}
if ( setWidth )
{
+ var w = dimsCurrent.w;
cNodeCss = this.cNodeCss;
tbNodeCss = this.tbNodeCss;
rbNodeCss = this.rbNodeCss;
var wIdx = jsCss.cssW, wuIdx = jsCss.cssWU;
- if ( posStatic )
+ if ( effectivePosStatic && ( ! this.ie6 || ! w ) )
{
dNodeCss[ wIdx ] = "";
dNodeCss[ wuIdx ] = "";
@@ -1663,22 +1815,32 @@
}
else
{
- var w = dimsCurrent.width;
- var wChild = (w - layoutExtents.lostWidth);
- dNodeCss[ wIdx ] = (w - layoutExtents.dNode.lessW);
+ var dNodeCBWidth = (w - layoutInfo.dNode.lessW);
+ dNodeCss[ wIdx ] = dNodeCBWidth;
dNodeCss[ wuIdx ] = "px";
- cNodeCss[ wIdx ] = (wChild - layoutExtents.cNode.lessW);
+ cNodeCss[ wIdx ] = dNodeCBWidth - layoutInfo.cNode.lessW;
cNodeCss[ wuIdx ] = "px";
if ( tbNodeCss )
{
- tbNodeCss[ wIdx ] = (wChild - layoutExtents.tbNode.lessW);
+ tbNodeCss[ wIdx ] = dNodeCBWidth - layoutInfo.tbNode.lessW;
tbNodeCss[ wuIdx ] = "px";
}
if ( rbNodeCss )
{
- rbNodeCss[ wIdx ] = (wChild - layoutExtents.rbNode.lessW);
+ rbNodeCss[ wIdx ] = dNodeCBWidth- layoutInfo.rbNode.lessW;
rbNodeCss[ wuIdx ] = "px";
}
+ if ( iNodeCss )
+ {
+ iNodeCss[ wIdx ] = dNodeCBWidth;
+ iNodeCss[ wuIdx ] = "px";
+ iNodeCssSet = true;
+ if ( iCvrIE6Css )
+ {
+ iCvrIE6Css[ wIdx ] = cNodeCss[ wIdx ];
+ iCvrIE6Css[ wuIdx ] = cNodeCss[ wuIdx ];
+ }
+ }
}
}
@@ -1691,11 +1853,17 @@
this.tbNode.style.cssText = tbNodeCss.join( "" );
if ( rbNodeCss )
this.rbNode.style.cssText = rbNodeCss.join( "" );
+ if ( iNodeCssSet )
+ {
+ this.bgIframe.iframe.style.cssText = iNodeCss.join( "" );
+ if ( iCvrIE6Css )
+ iframesInfoCur.iframeCover.style.cssText = iCvrIE6Css.join( "" );
+ }
}
if ( setIFrame && setIFrameH )
this._deferSetIFrameH( setIFrame, setIFrameH, false, 50 );
//window.setTimeout( function() { setIFrame.height = setIFrameH; }, 50 ) ;
- },
+ }, // _alterCss
_deferSetIFrameH: function( setIFrame, setIFrameH, forceRefresh, waitFor, forceRefreshWaitFor )
{
@@ -1716,21 +1884,28 @@
}, waitFor ) ;
},
+ _getWindowMarginBox: function( dNodeLayoutInfo, jsObj )
+ {
+ var dNode = this.domNode;
+ if ( dNodeLayoutInfo == null )
+ dNodeLayoutInfo = this._getLayoutInfo().dNode;
+ var parentLayoutInfo = null;
+ if ( jsObj.UAope ) // needs parentNode layout-info
+ parentLayoutInfo = ( this.posStatic ? jsObj.page.layoutInfo.column : jsObj.page.layoutInfo.desktop );
+ return jsObj.ui.getMarginBox( dNode, dNodeLayoutInfo, parentLayoutInfo, jsObj );
+ },
+
_forceRefreshZIndex: function()
{ // attempts to force a refresh with a zIndex change
var jsObj = jetspeed;
var zTop = this._setAsTopZIndex( jsObj.page, jsObj.css, this.dNodeCss, this.posStatic );
- this.domNode.style.zIndex = String( zTop );
+ this.domNode.style.zIndex = zTop;
},
_forceRefreshZIndexAndForget: function()
{ // attempts to force a refresh with a zIndex change - does not record new zIndex value in dNodeCss
var zTop = jetspeed.page.getPWinTopZIndex( this.posStatic );
this.domNode.style.zIndex = String( zTop );
},
- _forceRefreshFromCss: function()
- {
- this.domNode.style.cssText = this.dNodeCss.join( "" );
- },
getIFrames: function( includeSize )
{
@@ -1763,7 +1938,7 @@
this.inContentChgd = true;
if ( this.heightToFit )
{
- this.makeHeightToFit( true, true );
+ this.makeHeightToFit( true );
}
this.inContentChgd = false;
}
@@ -1776,11 +1951,11 @@
var jsPage = jsObj.page;
var djObj = dojo;
var djEvtObj = djObj.event;
- var actionCtxMenu = this.actionMenuWidget;
- if ( actionCtxMenu != null )
+ var wDC = this.decConfig;
+
+ if ( this.actionMenuWidget && wDC && wDC.windowActionMenuHasNoImg )
{
- actionCtxMenu.destroy();
- this.actionMenuWidget = actionCtxMenu = null;
+ jsUI.evtDisconnect( "after", this.tbNode, "oncontextmenu", this, "actionMenuOpen", djEvtObj );
}
jsPage.tooltipMgr.removeNodes( this.tooltips );
@@ -1792,15 +1967,15 @@
var aBtns = this.actionButtons;
if ( aBtns )
{
- var hasTooltip = ( this.decConfig != null && this.decConfig.windowActionButtonTooltip );
+ var hasTooltip = ( wDC && wDC.windowActionButtonTooltip );
for ( var aNm in aBtns )
{
var aBtn = aBtns[ aNm ];
if ( aBtn )
{
- jsUI.evtDisconnect( "after", aBtn, "onclick", this, "windowActionButtonClick", djEvtObj );
+ jsUI.evtDisconnect( "after", aBtn, "onclick", this, "actionBtnClick", djEvtObj );
if ( ! hasTooltip )
- jsUI.evtDisconnect( "after", aBtn, "onmousedown", djEvtObj.browser, "stopEvent", djEvtObj );
+ jsUI.evtDisconnect( "after", aBtn, "onmousedown", jsObj, "_stopEvent", djEvtObj );
}
}
this.actionButtons = aBtns = null;
@@ -1818,29 +1993,7 @@
this.resizeHandle = null;
}
- if ( this.subWidgetEndIndex > this.subWidgetStartIndex )
- {
- djObj.debug( "closeWindow subwidgets " + this.subWidgetStartIndex + " / " + this.subWidgetEndIndex );
- var djWMgr = djObj.widget.manager;
- for ( var i = this.subWidgetEndIndex -1 ; i >= this.subWidgetStartIndex ; i-- )
- {
- try
- {
- if ( djWMgr.widgets.length > i )
- {
- var subWidget = djWMgr.widgets[i];
- if ( subWidget != null )
- {
- var swT = subWidget.widgetType;
- var swI = subWidget.widgetId;
- subWidget.destroy();
- djObj.debug( "destroyed sub-widget[" + i + "]: " + swT + " " + swI ) ;
- }
- }
- }
- catch(e){ }
- }
- }
+ this._destroyChildWidgets( djObj );
this._removeUntiledEvents();
@@ -1854,35 +2007,34 @@
this.containerNode = null;
this.tbNode = null;
this.rbNode = null;
- },
- dumpPos: function()
+ }, // closeWindow
+
+ _destroyChildWidgets: function( djObj )
{
- var djObj = dojo;
- var djH = djObj.html;
- var dNode = this.domNode;
- var cNode = this.containerNode;
- var winAbsPos = djH.getAbsolutePosition( dNode, true );
- var dNodeMarginBox = djH.getMarginBox( dNode );
- var cNodeMarginBox = djH.getMarginBox( cNode );
- var cNodeContentBox = djH.getContentBox( cNode );
- var layoutExtents = this.decConfig.layoutExtents;
- var ind = jetspeed.debugindent;
- djObj.hostenv.println( "wnd-dims [" + this.widgetId + "] abs.x=" + winAbsPos.x + " abs.y=" + winAbsPos.y + " z=" + dNode.style.zIndex );
- djObj.hostenv.println( ind + "mb.width=" + dNodeMarginBox.width + " mb.height=" + dNodeMarginBox.height );
- djObj.hostenv.println( ind + "style.width=" + dNode.style.width + " style.height=" + dNode.style.height );
- djObj.hostenv.println( ind + "cnt.mb.width=" + cNodeMarginBox.width + " cnt.mb.height=" + cNodeMarginBox.height );
- djObj.hostenv.println( ind + "cnt.cb.width=" + cNodeContentBox.width + " cnt.cb.height=" + cNodeContentBox.height );
- djObj.hostenv.println( ind + "cnt.style.width=" + cNode.style.width + " cnt.style.height=" + cNode.style.height );
- djObj.hostenv.println( ind + "dNodeCss=" + this.dNodeCss.join("") );
- djObj.hostenv.println( ind + "cNodeCss=" + this.cNodeCss.join("") );
- djObj.hostenv.println( ind + "layoutExtents: " + "dNode.lessW=" + layoutExtents.dNode.lessW + " dNode.lessH=" + layoutExtents.dNode.lessH + " lostW=" + layoutExtents.lostWidth + " lostH=" + layoutExtents.lostHeight + " cNode.lessW=" + layoutExtents.cNode.lessW + " cNode.lessH=" + layoutExtents.cNode.lessH );
- djObj.hostenv.println( ind + "dimsTiled=" + jetspeed.printobj( this.dimsTiled ) );
- djObj.hostenv.println( ind + "dimsUntiled=" + jetspeed.printobj( this.dimsUntiled ) );
- if ( this.dimsTiledTemp != null )
- djObj.hostenv.println( ind + "dimsTiledTemp=" + jetspeed.printobj( this.dimsTiledTemp ) );
- if ( this.dimsUntiledTemp != null )
- djObj.hostenv.println( ind + "dimsUntiledTemp=" + jetspeed.printobj( this.dimsUntiledTemp ) );
- //" document-width=" + dojo.html.getMarginBox( document[ "body" ] ).width + " document-height=" + dojo.html.getMarginBox( document[ "body" ] ).height
+ if ( this.childWidgets )
+ {
+ var childWidgets = this.childWidgets;
+ var childWidgetsLen = childWidgets.length, childWidget, swT, swI;
+ djObj.debug( "PortletWindow [" + this.widgetId + "] destroy child widgets (" + childWidgetsLen + ")" );
+
+ for ( var i = (childWidgetsLen -1) ; i >= 0 ; i-- )
+ {
+ try
+ {
+ childWidget = childWidgets[i];
+ if ( childWidget )
+ {
+ swT = childWidget.widgetType;
+ swI = childWidget.widgetId;
+ childWidget.destroy();
+ djObj.debug( "destroyed child widget[" + i + "]: " + swT + " " + swI ) ;
+ }
+ childWidgets[i] = null;
+ }
+ catch(e){ }
+ }
+ this.childWidgets = null;
+ }
},
getPageColumnIndex: function()
@@ -1896,29 +2048,56 @@
if ( this.portlet && this.windowState != jetspeed.id.ACT_MAXIMIZE )
this.portlet.submitWinState();
},
- endDragging: function( posObj )
+ endDragging: function( posObj, changeToUntiled, changeToTiled )
{
+ var jsObj = jetspeed;
+ var ie6 = this.ie6;
+ if ( changeToUntiled )
+ this.posStatic = false;
+ else if ( changeToTiled )
+ this.posStatic = true;
var posStatic = this.posStatic;
if ( ! posStatic )
{
+ var dimsCurrent = this.getDimsObj( posStatic );
if ( posObj && posObj.left != null && posObj.top != null )
{
- var dimsCurrent = this.getDimsObj( posStatic );
- dimsCurrent.left = posObj.left;
- dimsCurrent.top = posObj.top;
- this._alterCss( false, false, false, true, true );
+ dimsCurrent.l = posObj.left;
+ dimsCurrent.t = posObj.top;
+ if ( ! changeToUntiled )
+ this._alterCss( false, false, false, true, false, true );
+ }
+ if ( changeToUntiled )
+ {
+ this._updtDimsObj( false, false, true );
+ this._alterCss( true, true, false, true );
+ this._addUntiledEvents();
}
}
else
{
- this._alterCss( true );
+ if ( changeToTiled )
+ {
+ this._setAsTopZIndex( jsObj.page, jsObj.css, this.dNodeCss, posStatic );
+ this._updtDimsObj( false, false );
+ }
+ if ( ! ie6)
+ {
+ this._alterCss( true );
+ this.resizeNotifyChildWidgets();
+ }
+ else
+ {
+ this._resetIE6TiledSize( changeToTiled );
+ }
}
- if ( this.portlet && this.windowState != jetspeed.id.ACT_MAXIMIZE )
+ if ( this.portlet && this.windowState != jsObj.id.ACT_MAXIMIZE )
this.portlet.submitWinState();
[... 1882 lines stripped ...]
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org