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/09/24 21:08:30 UTC
svn commit: r578909 [3/3] -
/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=578909&r1=578908&r2=578909&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 Mon Sep 24 12:08:29 2007
@@ -17,66 +17,62 @@
* author: Steve Milek
*/
-jetspeed.widget.ie6PostDragAddDelay = 60; jetspeed.widget.ie6PostDragRmDelay = 120;
dojo.provide("jetspeed.widget.PortletWindow");
-
dojo.require("jetspeed.desktop.core");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.widget.FloatingPane");
jetspeed.widget.PortletWindow = function()
{
- dojo.widget.FloatingPane.call( this );
- this.widgetType = "PortletWindow";
- this.resizable = true;
- this.movable = true;
- this.portletInitialized = false;
+ this.windowInitialized = false;
this.actionButtons = {};
this.actionMenus = {};
+ this.actionMenuWidget = null;
this.tooltips = [];
this.subWidgetStartIndex = -1;
this.subWidgetEndIndex = -1;
+
+ // content load vars
+ this._onLoadStack = [];
+ this._onUnloadStack = [];
+ this._callOnUnload = false;
};
-dojo.inherits( jetspeed.widget.PortletWindow, dojo.widget.FloatingPane );
-dojo.lang.extend( jetspeed.widget.PortletWindow, {
- title: "Unknown Portlet",
- contentWrapper: "layout",
- displayCloseAction: true,
- displayMinimizeAction: true,
- displayMaximizeAction: true,
- displayRestoreAction: true,
- taskBarId: null,
+dojo.extend( jetspeed.widget.PortletWindow, {
+ title: "",
nextIndex: 1,
- windowDecorationName: null,
- windowDecorationConfig: null,
+ resizable: true,
+ movable: true,
+
+ decName: null, // decoration name
+ decConfig: null, // decoration config
+
+ posStatic: false,
+ heightToFit: false,
- windowPositionStatic: false,
- windowHeightToFit: false,
titleMouseIn: 0,
titleLit: false,
portlet: null,
- jsAltInitParams: null,
+ altInitParams: null,
- templateDomNodeClassName: null,
- templateContainerNodeClassName: null,
-
- processingContentChanged: false,
+ inContentChgd: false,
- lastUntiledPositionInfo: null,
- lastTiledPositionInfo: null,
+ exclPContent: false,
- minimizeWindowTemporarilyRestoreTo: null,
+ minimizeTempRestore: null,
// see setPortletContent for info on these ContentPane settings:
executeScripts: false,
scriptSeparation: false,
adjustPaths: false,
+ parseContent: true,
- /* static */
- staticDefineAsAltInitParameters: function( defineIn, params )
+ dbProfile: (djConfig.isDebug && jetspeed.debug.profile),
+ dbOn: djConfig.isDebug,
+ dbMenuDims: "Dump Dimensions",
+
+ /* static */
+ altInitParamsDef: function( defineIn, params )
{
if ( ! defineIn )
{
@@ -84,16 +80,11 @@
getProperty: function( propertyName )
{
if ( ! propertyName ) return null;
- return this.jsAltInitParams[ propertyName ];
- },
- putProperty: function( propertyName, propertyValue )
- {
- if ( ! propertyName ) return;
- this.jsAltInitParams[ propertyName ] = propertyValue;
+ return this.altInitParams[ propertyName ];
},
retrieveContent: function( contentListener, bindArgs )
{
- var contentRetriever = this.getProperty( jetspeed.id.PORTLET_PROP_CONTENT_RETRIEVER );
+ var contentRetriever = this.altInitParams[ jetspeed.id.PP_CONTENT_RETRIEVER ];
if ( contentRetriever )
{
contentRetriever.getContent( bindArgs, contentListener, this, jetspeed.debugPortletDumpRawContent );
@@ -107,577 +98,669 @@
}
if ( ! params )
params = {};
- if ( params.jsAltInitParams )
- defineIn.jsAltInitParams = params.jsAltInitParams;
+ if ( params.altInitParams )
+ defineIn.altInitParams = params.altInitParams;
else
- defineIn.jsAltInitParams = params;
+ defineIn.altInitParams = params;
return defineIn;
},
- // init properties - to facilitate initialization with or without a jetspeed.om.Portlet object
- getInitProperty: function( propertyName, altPropertyName )
- {
- var propVal = null;
- if ( this.portlet )
- {
- propVal = this.portlet.getProperty( propertyName );
- if ( propVal == null && altPropertyName )
- propVal = this.portlet.getProperty( altPropertyName );
- }
- else if ( this.jsAltInitParams )
- {
- propVal = this.jsAltInitParams[ propertyName ];
- if ( propVal == null && altPropertyName )
- propVal = this.jsAltInitParams[ altPropertyName ];
- }
- return propVal;
- },
- setInitProperty: function( propertyName, propertyValue )
+ build: function( createWinParams, winContainerNode )
{
- if ( this.portlet )
- {
- dojo.raise( "PortletWindow.setInitProperty cannot be called when the window is bound to a portlet" );
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
+ var jsPrefs = jsObj.prefs;
+ var jsPage = jsObj.page;
+ var jsCss = jsObj.css;
+ var jsUI = jsObj.ui;
+ var doc = document;
+ var docBody = jsObj.docBody;
+ var djObj = dojo;
+
+ var winIndex = jsObj.widget.PortletWindow.prototype.nextIndex;
+ this.portletIndex = winIndex;
+ var ie6 = jsObj.UAie6;
+ this.ie6 = ie6;
+
+ var printMode = false;
+ if ( createWinParams )
+ {
+ if ( createWinParams.portlet )
+ this.portlet = createWinParams.portlet;
+ if ( createWinParams.altInitParams )
+ this.altInitParams = createWinParams.altInitParams;
+ if ( createWinParams.printMode )
+ printMode = true;
}
- else
- {
- if ( ! this.jsAltInitParams )
- {
- this.jsAltInitParams = {};
- }
- this.jsAltInitParams[ propertyName ] = propertyValue;
- }
- },
+ var tPortlet = this.portlet;
+ var iP = ( tPortlet ? tPortlet.getProperties() : ( this.altInitParams ? this.altInitParams : {} ) ) ;
- initWindowDecoration: function( fragment )
- {
- var decorationName = this.getInitProperty( jetspeed.id.PORTLET_PROP_WINDOW_DECORATION );
- if ( ! decorationName )
+ var initWidgetId = iP[ jsId.PP_WIDGET_ID ];
+ if ( ! initWidgetId )
{
- if ( this.portletDecorationName )
- decorationName = this.portletDecorationName;
+ if ( tPortlet )
+ djObj.raise( "PortletWindow is null for portlet: " + tPortlet.entityId );
else
- decorationName = jetspeed.page.getPortletDecorationDefault();
+ initWidgetId = jsId.PW_ID_PREFIX + winIndex;
}
- this.windowDecorationName = decorationName ;
- var pdConfig = jetspeed.loadPortletDecorationStyles( decorationName );
- this.windowDecorationConfig = pdConfig;
+ this.widgetId = initWidgetId;
+ jsObj.widget.PortletWindow.prototype.nextIndex++;
- this.templateCssPath = ""; // clear this so dojo default will not be loaded
- this.templatePath = pdConfig.templatePath; // jetspeed.ui.getDefaultFloatingPaneTemplate();
- },
- initWindowTitle: function( fragment )
- {
- var windowtitle = this.getInitProperty( jetspeed.id.PORTLET_PROP_WINDOW_TITLE );
- this.setPortletTitle( windowtitle );
- },
- initWindowIcon: function( fragment )
- {
+ // ... initWindowDecoration
+ var decNm = iP[ jsId.PP_WINDOW_DECORATION ];
+ if ( ! decNm )
+ {
+ decNm = this.portletDecorationName;
+ if ( ! decNm )
+ decNm = jsPage.getPortletDecorationDefault();
+ }
+ this.decName = decNm ;
+ var wDC = jsObj.loadPortletDecorationStyles( decNm );
+ if ( wDC == null ) wDC = {}; // this should not occur
+ this.decConfig = wDC;
- if ( this.windowDecorationConfig != null && this.windowDecorationConfig.windowIconEnabled && this.windowDecorationConfig.windowIconPath != null )
+ var dNodeClass = wDC.dNodeClass;
+ var cNodeClass = wDC.cNodeClass;
+ if ( dNodeClass == null || cNodeClass == null )
{
- var windowicon = this.getInitProperty( jetspeed.id.PORTLET_PROP_WINDOW_ICON );
- if ( ! windowicon )
- windowicon = "document.gif";
- this.iconSrc = new dojo.uri.Uri(jetspeed.url.basePortalDesktopUrl() + this.windowDecorationConfig.windowIconPath + windowicon ) ;
- if ( this.portletInitialized && this.titleBarIcon )
+ dNodeClass = jsId.PWIN_CLASS;
+ cNodeClass = "portletWindowClient";
+ if ( decNm )
{
- this.titleBarIcon.src = this.iconSrc.toString();
+ dNodeClass = decNm + " " + dNodeClass;
+ cNodeClass = decNm + " " + cNodeClass;
}
+ dNodeClass = jsId.P_CLASS + " " + dNodeClass;
+ cNodeClass = jsId.P_CLASS + " " + cNodeClass;
+ wDC.dNodeClass = dNodeClass;
+ wDC.cNodeClass = cNodeClass;
}
- else
+
+ // ... create window nodes
+ var dNode = doc.createElement( "div" );
+ dNode.id = initWidgetId;
+ dNode.className = dNodeClass;
+ dNode.style.display = "none";
+
+ var cNode = doc.createElement( "div" );
+ cNode.className = cNodeClass;
+
+ var tbNode = null, rbNode = null, tbIconNode = null, tbNodeCss = null;
+ if ( ! printMode )
{
- this.iconSrc = null;
+ tbNode = doc.createElement( "div" );
+ tbNode.className = "portletWindowTitleBar";
+
+ tbIconNode = doc.createElement( "img" );
+ tbIconNode.className = "portletWindowTitleBarIcon";
+
+ var tbTextNode = doc.createElement( "div" );
+ tbTextNode.className = "portletWindowTitleText";
+
+ tbNode.appendChild( tbIconNode );
+ tbNode.appendChild( tbTextNode );
+
+ rbNode = doc.createElement( "div" );
+ rbNode.className = "portletWindowResizebar";
+
+ this.tbNode = tbNode;
+ tbNodeCss = jsCss.cssBase.concat();
+ this.tbNodeCss = tbNodeCss;
+ this.tbIconNode = tbIconNode;
+ this.tbTextNode = tbTextNode;
+ this.rbNode = rbNode;
+ this.rbNodeCss = jsCss.cssBase.concat();
}
- },
+
+ if ( tbNode != null )
+ dNode.appendChild( tbNode );
+
+ dNode.appendChild( cNode );
+
+ if ( rbNode != null )
+ dNode.appendChild( rbNode );
+
+ this.domNode = dNode;
+ var dNodeCss = jsCss.cssPosition.concat();
+ this.dNodeCss = dNodeCss;
+ this.containerNode = cNode;
+ var cNodeCss = jsCss.cssOverflow.concat();
+ this.cNodeCss = cNodeCss;
- initWindowDimensions: function( fragment )
- {
- this.windowPositionStatic = this.getInitProperty( jetspeed.id.PORTLET_PROP_WINDOW_POSITION_STATIC );
- this.windowHeightToFit = this.getInitProperty( jetspeed.id.PORTLET_PROP_WINDOW_HEIGHT_TO_FIT );
- this.windowColumnSpan = this.getInitProperty( jetspeed.id.PORTLET_PROP_COLUMN_SPAN );
- this.constrainToContainer = 0;
+ // ... initWindowTitle
+ this.setPortletTitle( iP[ jsId.PP_WINDOW_TITLE ] );
- var windowWidth = null, windowHeight = null, windowLeft = null, windowTop = null;
- if ( this.portlet )
+ // ... initWindowDimensions
+ var posStatic = iP[ jsId.PP_WINDOW_POSITION_STATIC ];
+ this.posStatic = this.preMaxPosStatic = posStatic;
+ var heightToFit = iP[ jsId.PP_WINDOW_HEIGHT_TO_FIT ];
+ this.heightToFit = this.preMaxHeightToFit = heightToFit;
+
+ var wWidth = null, wHeight = null, wLeft = null, wTop = null;
+ if ( tPortlet )
{
- var portletWindowDimensions = this.portlet.getInitialWindowDimensions();
- windowWidth = portletWindowDimensions.width;
- windowHeight = portletWindowDimensions.height;
- windowLeft = portletWindowDimensions.left;
- windowTop = portletWindowDimensions.top;
- // NOTE: portletWindowDimensions.zIndex; - should be dealt with in the creation order
+ var pWDims = tPortlet.getInitialWinDims();
+ wWidth = pWDims.width;
+ wHeight = pWDims.height;
+ wLeft = pWDims.left;
+ wTop = pWDims.top;
+ // NOTE: pWDims.zIndex; - should be dealt with in the creation order
}
else
{
- windowWidth = this.getInitProperty( jetspeed.id.PORTLET_PROP_WIDTH );
- windowHeight = this.getInitProperty( jetspeed.id.PORTLET_PROP_HEIGHT );
- windowLeft = this.getInitProperty( jetspeed.id.PORTLET_PROP_LEFT );
- windowTop = this.getInitProperty( jetspeed.id.PORTLET_PROP_TOP );
+ wWidth = iP[ jsId.PP_WIDTH ];
+ wHeight = iP[ jsId.PP_HEIGHT ];
+ wLeft = iP[ jsId.PP_LEFT ];
+ wTop = iP[ jsId.PP_TOP ];
}
- this.lastUntiledPositionInfo = {};
- this.lastTiledPositionInfo = { width: "" };
+ var untiledDims = {}; // untiled
+ var tiledDims = { width: null }; // tiled
// to allow for an initial untiled placement based on tiled position,
- // only record lastUntiledPositionInfo when value is specified (not defaulted) or if window is already untiled
- if ( windowWidth != null && windowWidth > 0 )
- {
- windowWidth = Math.floor(windowWidth);
- this.lastUntiledPositionInfo.width = windowWidth;
- }
+ // 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 );
else
- {
- windowWidth = jetspeed.prefs.windowWidth;
- if ( ! this.windowPositionStatic )
- this.lastUntiledPositionInfo.width = windowWidth;
- }
+ untiledDims.width = wWidth = jsPrefs.windowWidth;
- if ( windowHeight != null && windowHeight > 0 )
- {
- windowHeight = Math.floor(windowHeight);
- this.lastUntiledPositionInfo.height = windowHeight;
- this.lastTiledPositionInfo.height = windowHeight;
- }
+ if ( wHeight != null && wHeight > 0 )
+ untiledDims.height = tiledDims.height = wHeight = Math.floor(wHeight);
else
- {
- windowHeight = jetspeed.prefs.windowHeight;
- this.lastTiledPositionInfo.height = windowHeight;
- if ( ! this.windowPositionStatic )
- this.lastUntiledPositionInfo.height = windowHeight;
- }
+ untiledDims.height = tiledDims.height = wHeight = jsPrefs.windowHeight;
- if ( windowLeft != null && windowLeft >= 0 )
- {
- windowLeft = Math.floor(windowLeft);
- this.lastUntiledPositionInfo.left = windowLeft;
- }
- else
- {
- windowLeft = (((this.portletIndex -2) * 30 ) + 200);
- if ( ! this.windowPositionStatic )
- this.lastUntiledPositionInfo.left = windowLeft;
- }
+ if ( wLeft != null && wLeft >= 0 )
+ untiledDims.left = Math.floor( wLeft );
+ else if ( ! posStatic )
+ untiledDims.left = (((winIndex -2) * 30 ) + 200);
- if ( windowTop != null && windowTop >= 0 )
- {
- windowTop = Math.floor(windowTop);
- this.lastUntiledPositionInfo.top = windowTop;
- }
- else
- {
- windowTop = (((this.portletIndex -2) * 30 ) + 170);
- if ( ! this.windowPositionStatic )
- this.lastUntiledPositionInfo.top = windowTop;
- }
+ if ( wTop != null && wTop >= 0 )
+ untiledDims.top = Math.floor(wTop);
+ else if ( ! posStatic )
+ untiledDims.top = (((winIndex -2) * 30 ) + 170);
- windowWidth = windowWidth + "px";
- windowHeight = windowHeight + "px";
- windowLeft = windowLeft + "px";
- windowTop = windowTop + "px";
+ this.dimsUntiled = untiledDims;
+ this.dimsTiled = tiledDims;
- if ( ! this.portletInitialized )
- {
- var source = this.getFragNodeRef( fragment );
- var dimensionsCss = "width: " + windowWidth + ( ( windowHeight != null && windowHeight.length > 0 ) ? ( "; height: " + windowHeight ) : "");
- if ( ! this.windowPositionStatic )
- dimensionsCss += "; left: " + windowLeft + "; top: " + windowTop + ";";
-
- source.style.cssText = dimensionsCss;
- }
- else
- { // update dimensions
- this.domNode.style.position = "absolute";
- this.domNode.style.width = windowWidth;
- this.domNode.style.height = windowHeight;
- if ( ! this.windowPositionStatic )
- {
- this.domNode.style.left = windowLeft;
- this.domNode.style.top = windowTop;
- }
- }
- },
+ // 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;
- portletMixinProperties: function( fragment )
- {
- this.initWindowDecoration( fragment );
- this.initWindowTitle( fragment );
- this.initWindowIcon( fragment );
- this.initWindowDimensions( fragment );
- },
+ this.exclPContent = iP[ jsId.PP_EXCLUDE_PCONTENT ];
- // dojo.widget.Widget create protocol
- postMixInProperties: function( args, fragment, parentComp )
- {
- jetspeed.widget.PortletWindow.superclass.postMixInProperties.apply( this, arguments );
+ // --- former end of preBuild()
- this.portletIndex = this._getNextIndex();
+ jsPage.putPWin( this );
- var initWidgetId = this.getInitProperty( jetspeed.id.PORTLET_PROP_WIDGET_ID );
- if ( this.portlet )
- {
- if ( this.widgetId )
- {
- dojo.raise( "PortletWindow.widgetId (" + this.widgetId + ") should not be assigned directly" );
- }
- if ( ! initWidgetId )
- {
- dojo.raise( "PortletWindow.widgetId is not defined for portlet [" + this.portlet.entityId + "] - Portlet.initialize may not have been called" );
- }
- this.widgetId = initWidgetId;
- }
- else
- {
- if ( initWidgetId )
- this.widgetId = initWidgetId;
- else if ( ! this.widgetId )
- this.widgetId = jetspeed.id.PORTLET_WINDOW_ID_PREFIX + this.portletIndex;
- }
- this._incrementNextIndex();
-
- this.portletMixinProperties( fragment );
- },
+ // --- former beginning of build()
- _incrementNextIndex: function()
- {
- var nextI = jetspeed.widget.PortletWindow.prototype.nextIndex;
- if ( ! nextI )
- jetspeed.widget.PortletWindow.prototype.nextIndex = 1;
- jetspeed.widget.PortletWindow.prototype.nextIndex++;
- return nextI;
- },
- _getNextIndex: function()
- {
- return jetspeed.widget.PortletWindow.prototype.nextIndex;
- },
+ // necessary for safari, khtml (for computing width/height)
+ docBody.appendChild( dNode );
- portletInitDragHandle: function()
- {
- var isResizable = this.resizable;
- if ( isResizable && this.resizeBar )
+ // ... initWindowIcon
+ if ( tbIconNode )
{
- this.resizeBar.style.display = "block";
- var rhWidgetId = this.widgetId + "_resize";
- if ( ! this.portletInitialized )
- this.resizeHandle = dojo.widget.createWidget( "jetspeed:PortletWindowResizeHandle", { targetElmId: this.widgetId, id: rhWidgetId, portletWindow: this } );
+ var tbIconSrc = null;
+ if ( wDC.windowIconEnabled && wDC.windowIconPath != null )
+ {
+ var wI = iP[ jsId.PP_WINDOW_ICON ];
+ if ( ! wI )
+ wI = "document.gif";
+ tbIconSrc = new djObj.uri.Uri( jsObj.url.basePortalDesktopUrl() + wDC.windowIconPath + wI ) ;
+ tbIconSrc = tbIconSrc.toString();
+ if ( tbIconSrc.length == 0 )
+ tbIconSrc = null;
+ this.iconSrc = tbIconSrc;
+ }
+ // <img src=""> can hang IE! better get rid of it
+ if ( tbIconSrc )
+ tbIconNode.src = tbIconSrc;
else
- this.resizeHandle = dojo.widget.byId( rhWidgetId );
- if ( this.resizeHandle )
{
- //if ( this.windowPositionStatic && dojo.render.html.mozilla ) // dojo.render.html.ie
- this.resizeHandle.domNode.style.position = "static"; // until 2006-11-15, was set to absolute for all but dojo.render.html.mozilla
- // but setting to static for all seems to fix IE failure to initially display resize handle
- //else
- // this.resizeHandle.domNode.style.position = "absolute";
- if ( ! this.portletInitialized )
- this.resizeBar.appendChild( this.resizeHandle.domNode );
+ djObj.dom.removeNode( tbIconNode );
+ this.tbIconNode = tbIconNode = null;
}
}
- else
- {
- this.resizable = false;
- }
- },
-
- // dojo.widget.Widget create->buildRendering protocol
- fillInTemplate: function(args, frag) /* copied from FloatingPane.js 0.3.1 with changes as noted */
- {
- //dojo.debug( "fillInTemplate-begin [" + this.widgetId + "] containerNode-outerwidth: " + dojo.html.getMarginBox( this.containerNode ).width + " containerNode-contentwidth: " + dojo.html.getContentBox( this.containerNode ).width + " domNode-outerwidth: " + dojo.html.getMarginBox( this.domNode ).width );
-
- // Copy style info from input node to output node
- var source = this.getFragNodeRef(frag);
- dojo.html.copyStyle(this.domNode, source);
-
- // necessary for safari, khtml (for computing width/height)
- document.body.appendChild(this.domNode);
-
- // if display:none then state=minimized, otherwise state=normal
- if(!this.isShowing()){
- this.windowState = jetspeed.id.ACTION_NAME_MINIMIZE;
- }
-
- // <img src=""> can hang IE! better get rid of it
- if ( this.titleBarIcon )
- {
- if ( this.iconSrc == null || this.iconSrc == "" )
- dojo.dom.removeNode( this.titleBarIcon );
- else
- this.titleBarIcon.src = this.iconSrc.toString();
- }
- if ( this.titleBarDisplay && this.titleBar )
+ if ( tbNode )
{
- this.titleBar.style.display = "";
- dojo.html.disableSelection( this.titleBar );
-
- this.titleBarIcon.style.display = ( this.iconSrc == "" ? "none" : "" );
-
- var windowTitleBarButtons = null;
-
- if ( this.windowDecorationConfig != null )
+ if ( jsObj.UAmoz || jsObj.UAsaf )
{
- var menuActionNames = new Array();
- var menuActionNoImage = false;
- if ( this.windowDecorationConfig.windowActionButtonOrder != null )
- {
- // all possible button actions must be added here (no support for adding action buttons after init)
- // this including buttons for the current mode and state (which will be initially hidden)
- var btnActionNames = new Array();
- if ( this.portlet )
- {
- for ( var actionIdx = (this.windowDecorationConfig.windowActionButtonOrder.length-1) ; actionIdx >= 0 ; actionIdx-- )
+ if ( jsObj.UAmoz )
+ tbNodeCss[ jsCss.cssNoSelNm ] = " -moz-user-select: ";
+ else
+ tbNodeCss[ jsCss.cssNoSelNm ] = " -khtml-user-select: ";
+ tbNodeCss[ jsCss.cssNoSel ] = "none";
+ tbNodeCss[ jsCss.cssNoSelEnd ] = ";";
+ }
+ else if ( jsObj.UAie )
+ {
+ tbNode.unselectable = "on";
+ }
+ 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 )
{
- var actionName = this.windowDecorationConfig.windowActionButtonOrder[ actionIdx ];
- var includeAction = false;
- if ( this.portlet.getAction( actionName ) != null || jetspeed.prefs.windowActionDesktop[ actionName ] != null )
- {
- includeAction = true;
- }
- else if ( actionName == jetspeed.id.ACTION_NAME_RESTORE || actionName == jetspeed.id.ACTION_NAME_MENU )
- {
- includeAction = true;
- }
- if ( includeAction )
- {
- btnActionNames.push( actionName );
- }
+ incl = true;
}
- }
- else
- {
- for ( var actionIdx = (this.windowDecorationConfig.windowActionButtonOrder.length-1) ; actionIdx >= 0 ; actionIdx-- )
+ else if ( aNm == jsId.ACT_RESTORE || aNm == jsId.ACT_MENU )
{
- var actionName = this.windowDecorationConfig.windowActionButtonOrder[ actionIdx ];
- var includeAction = false;
- if ( actionName == jetspeed.id.ACTION_NAME_MINIMIZE || actionName == jetspeed.id.ACTION_NAME_MAXIMIZE || actionName == jetspeed.id.ACTION_NAME_RESTORE || actionName == jetspeed.id.ACTION_NAME_MENU || jetspeed.prefs.windowActionDesktop[ actionName ] != null )
- {
- includeAction = true;
- }
- if ( includeAction )
- {
- btnActionNames.push( actionName );
- }
+ incl = true;
}
- } // if ( this.portlet )
- var btnMax = ( this.windowDecorationConfig.windowActionButtonMax == null ? -1 : this.windowDecorationConfig.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 ( incl )
{
- if ( btnActionNames[i] != jetspeed.id.ACTION_NAME_MENU )
- {
- menuActionNames.push( btnActionNames[i] );
- btnActionNames[i] = null;
- removedBtns++;
- }
+ btnActionNames.push( aNm );
}
}
- if ( this.windowDecorationConfig.windowActionNoImage != null )
+ }
+ else
+ {
+ for ( var aI = (wDC.windowActionButtonOrder.length-1) ; aI >= 0 ; aI-- )
{
- for ( var i = 0 ; i < btnActionNames.length ; i++ )
+ 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 )
{
- if ( this.windowDecorationConfig.windowActionNoImage[ btnActionNames[ i ] ] != null )
- {
- if ( btnActionNames[ i ] == jetspeed.id.ACTION_NAME_MENU )
- {
- menuActionNoImage = true;
- }
- else
- {
- menuActionNames.push( btnActionNames[i] );
- }
- btnActionNames[ i ] = null;
- }
+ incl = true;
+ }
+ if ( incl )
+ {
+ btnActionNames.push( aNm );
}
}
- for ( var i = 0 ; i < btnActionNames.length ; i++ )
+ } // 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] != null )
+ if ( btnActionNames[i] != jsId.ACT_MENU )
{
- this._createActionButtonNode( btnActionNames[i] );
+ mANms.push( btnActionNames[i] );
+ btnActionNames[i] = null;
+ removedBtns++;
}
}
- } // if ( this.windowDecorationConfig.windowActionButtonOrder != null )
-
- if ( this.windowDecorationConfig.windowActionMenuOrder != null )
+ }
+ if ( wDC.windowActionNoImage )
{
- if ( this.portlet )
+ for ( var i = 0 ; i < btnActionNames.length ; i++ )
{
- for ( var actionIdx = 0 ; actionIdx < this.windowDecorationConfig.windowActionMenuOrder.length ; actionIdx++ )
+ if ( wDC.windowActionNoImage[ btnActionNames[ i ] ] != null )
{
- var actionName = this.windowDecorationConfig.windowActionMenuOrder[ actionIdx ];
- var includeAction = false;
- if ( this.portlet.getAction( actionName ) != null || jetspeed.prefs.windowActionDesktop[ actionName ] != null )
+ if ( btnActionNames[ i ] == jsId.ACT_MENU )
{
- includeAction = true;
+ noImg = true;
}
- if ( includeAction )
+ else
{
- menuActionNames.push( actionName );
+ mANms.push( btnActionNames[i] );
}
+ btnActionNames[ i ] = null;
}
}
- else
+ }
+ var tooltipMgr = jsPage.tooltipMgr;
+ for ( var i = 0 ; i < btnActionNames.length ; i++ )
+ {
+ if ( btnActionNames[i] != null )
{
- for ( var actionIdx = 0 ; actionIdx < this.windowDecorationConfig.windowActionMenuOrder.length ; actionIdx++ )
- {
- var actionName = this.windowDecorationConfig.windowActionMenuOrder[ actionIdx ];
- if ( jetspeed.prefs.windowActionDesktop[ actionName ] != null )
- {
- menuActionNames.push( actionName );
- }
- }
- } // if ( this.portlet )
- } // if ( this.windowDecorationConfig.windowActionMenuOrder != null )
-
- if ( menuActionNames.length > 0 )
+ this._createActionButtonNode( btnActionNames[i], doc, docBody, tooltipMgr, jsObj, jsPrefs, jsUI, djEvtObj );
+ }
+ }
+ } // if ( wDC.windowActionButtonOrder != null )
+
+ if ( wDC.windowActionMenuOrder )
+ {
+ if ( tPortlet )
{
- var addedActionNames = new Object();
- var finalMenuActionNames = new Array();
- for ( var i = 0 ; i < menuActionNames.length ; i++ )
+ for ( var aI = 0 ; aI < wDC.windowActionMenuOrder.length ; aI++ )
{
- var actionName = menuActionNames[i];
- if ( actionName != null && addedActionNames[ actionName ] == null && this.actionButtons[ actionName ] == null )
+ aNm = wDC.windowActionMenuOrder[ aI ];
+ incl = false;
+ if ( tPortlet.getAction( aNm ) != null || jsPrefs.windowActionDesktop[ aNm ] != null )
+ {
+ incl = true;
+ }
+ if ( incl )
{
- finalMenuActionNames.push( actionName );
- addedActionNames[ actionName ] = true;
+ mANms.push( aNm );
}
}
- if ( finalMenuActionNames.length > 0 )
+ }
+ else
+ {
+ for ( var aI = 0 ; aI < wDC.windowActionMenuOrder.length ; aI++ )
{
- this._createActionMenu( finalMenuActionNames );
- if ( menuActionNoImage )
+ aNm = wDC.windowActionMenuOrder[ aI ];
+ if ( jsPrefs.windowActionDesktop[ aNm ] != null )
{
- dojo.event.kwConnect({
- srcObj: this.titleBar,
- srcFunc: "oncontextmenu",
- targetObj: this,
- targetFunc: "windowActionMenuOpen",
- once: true
- });
+ mANms.push( aNm );
}
}
- }
-
- this.windowActionButtonSync();
+ } // if ( tPortlet )
+ } // if ( wDC.windowActionMenuOrder != null )
- if ( this.windowDecorationConfig.windowDisableResize )
- this.resizable = false;
- if ( this.windowDecorationConfig.windowDisableMove )
- this.movable = false;
+ if ( mANms.length > 0 || this.dbOn )
+ {
+ 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 );
+ }
+ }
}
-
- // j2o - deletion - initialization of HtmlDragMoveSource and call to setDragHandle
- // equivalent is done in postCreate with PortletWindowDragMoveSource
+ this.windowActionButtonSync();
+
+ if ( wDC.windowDisableResize )
+ this.resizable = false;
+ if ( wDC.windowDisableMove )
+ this.movable = false;
+ }
- // j2o - deletion - dojo.event.topic.publish floatingPaneMove for dragMove event
+ // --- init drag handle
+ var isResizable = this.resizable;
+ var rhWidget = null;
+ if ( isResizable && rbNode )
+ {
+ var rhWidgetId = initWidgetId + "_resize";
+ var rhWidget = jsObj.widget.CreatePortletWindowResizeHandler( this, jsObj );
+ 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 );
+ }
}
+ else
+ {
+ this.resizable = false;
+ }
- // j2o - deletion - creation of ResizeHandle - done by portletInitDragHandle()
+ // Prevent IE bleed-through problem
+ if ( ie6 )
+ this.bgIframe = new djObj.html.BackgroundIframe( dNode );
- this.portletInitDragHandle(); // j2o addition
+ // counteract body.appendChild above
+ docBody.removeChild( dNode );
- // Prevent IE bleed-through problem
- this.bgIframe = new dojo.html.BackgroundIframe(this.domNode);
+ // --- former end of build()
+
+ winContainerNode.appendChild( dNode );
+
+ // --- former beginning of postBuild()
+
+ //dNode.style.display = ""; // xxxx
- if( this.taskBarId ){
- this.taskBarSetup();
- }
+ if ( ! wDC.layoutExtents )
+ {
+ var dimCss = "display: block; 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 );
+ }
+
+ if ( this.movable && tbNode )
+ {
+ this.drag = new djObj.dnd.Moveable( this, {handle: tbNode});
+ this._setTitleBarDragging( true, jsCss );
+ }
- this.resetLostHeightWidth(); // j2o addition
+ this._setAsTopZIndex( jsPage, jsCss, dNodeCss, posStatic );
+ this._alterCss( true, true );
- if (dojo.hostenv.post_load_) {
- this._setInitialWindowState();
- } else {
- dojo.addOnLoad(this, "_setInitialWindowState");
- }
+ if ( ! posStatic )
+ this._addUntiledEvents();
- // counteract body.appendChild above
- document.body.removeChild(this.domNode);
+ this.windowInitialized = true;
- // j2o - deletion - call to super fillInTemplate (we've replaced FloatingPane version, and no other superclass defines an implementation)
+ 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 ) ;
- //dojo.debug( "fillInTemplate-end [" + this.widgetId + "] containerNode-outerwidth: " + dojo.html.getMarginBox( this.containerNode ).width + " containerNode-contentwidth: " + dojo.html.getContentBox( this.containerNode ).width + " domNode-outerwidth: " + dojo.html.getMarginBox( this.domNode ).width );
- },
- _createActionButtonNode: function( actionName )
- {
- if ( actionName != null )
+ var iWS = null;
+ if ( tPortlet )
+ iWS = tPortlet.getCurrentActionState();
+ else
+ iWS = iP[ jsId.PP_WINDOW_STATE ];
+
+ 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 actionButton = document.createElement( "div" );
- actionButton.className = "portletWindowActionButton";
- actionButton.style.backgroundImage = "url(" + jetspeed.prefs.getPortletDecorationBaseUrl( this.windowDecorationName ) + "/images/desktop/" + actionName + ".gif)";
- actionButton.actionName = actionName;
+ var ie6Helper = doc.createElement("span");
+ ie6Helper.id = "ie6ZappedContentHelper";
+ jsObj.widget.ie6ZappedContentHelper = ie6Helper;
+ }
- this.actionButtons[ actionName ] = actionButton;
- this.titleBar.appendChild( actionButton );
+ if ( jsObj.widget.pwGhost == null && jsPage != null )
+ { // ... PortletWindow 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.style.position = "static";
+ pwGhost.style.width = "";
+ pwGhost.style.left = "auto";
+ pwGhost.style.top = "auto";
+ jsObj.widget.pwGhost = pwGhost;
+ }
+ }, // build()
- dojo.event.connect( actionButton, "onclick", this, "windowActionButtonClick" );
- if ( this.windowDecorationConfig != null && this.windowDecorationConfig.windowActionButtonTooltip )
- { // setting isContainer=false and fastMixIn=true to avoid recursion hell when connectId is a node (could give each an id instead)
- var tooltip = dojo.widget.createWidget( "Tooltip", { isContainer: false, fastMixIn: true, caption: this._getActionLabel( actionName ), connectId: actionButton, delay: "100" } );
- document.body.appendChild( tooltip.domNode );
- this.tooltips.push( tooltip );
+ // 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 );
+
+ jsUI.evtConnect( "after", aBtn, "onclick", this, "windowActionButtonClick", djEvtObj );
+ if ( this.decConfig != null && this.decConfig.windowActionButtonTooltip )
+ {
+ this.tooltips.push( tooltipMgr.addNode( aBtn, this._getActionLabel( aNm ), true, jsObj, jsUI, djEvtObj ) );
+ }
+ else
+ {
+ jsUI.evtConnect( "after", aBtn, "onmousedown", djEvtObj.browser, "stopEvent", djEvtObj );
}
}
},
- _getActionMenuPopupWidget: function()
- {
- return dojo.widget.byId( this.widgetId + "_ctxmenu" );
- },
- _getActionLabel: function( actionName )
+ _getActionLabel: function( aNm )
{
- if ( actionName == null ) return null;
+ if ( aNm == null ) return null;
var actionlabel = null;
var actionLabelPrefs = jetspeed.prefs.desktopActionLabels;
if ( actionLabelPrefs != null )
- actionlabel = actionLabelPrefs[ actionName ];
+ actionlabel = actionLabelPrefs[ aNm ];
if ( actionlabel == null || actionlabel.length == 0 )
{
if ( this.portlet )
{
- var portletActionDef = this.portlet.getAction( actionName );
+ var portletActionDef = this.portlet.getAction( aNm );
if ( portletActionDef != null )
actionlabel = portletActionDef.label;
}
}
if ( actionlabel == null || actionlabel.length == 0 )
{
- actionlabel = dojo.string.capitalize( actionName );
+ actionlabel = dojo.string.capitalize( aNm );
}
return actionlabel;
},
- _createActionMenu: function( /* Array */ menuActionNames )
+ _createActionMenu: function( menuActionNames, docBody )
{
if ( menuActionNames == null || menuActionNames.length == 0 ) return;
- var portletWindow = this;
-
- var titleBarContextMenu = dojo.widget.createWidget( "PopupMenu2", { id: this.widgetId + "_ctxmenu", contextMenuForWindow: false }, null );
+ 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++ )
{
- var actionName = menuActionNames[i];
- var menulabel = this._getActionLabel( actionName );
- var menuitem = this._createActionMenuItem( portletWindow, menulabel, actionName );
+ aNm = menuActionNames[i];
+ isDev = false;
+ if ( ! aNm.dev )
+ menulabel = this._getActionLabel( aNm );
+ else
+ {
+ isDev = true;
+ menulabel = aNm = aNm.aNm;
+ }
+ 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;
+ },
- this.actionMenus[ actionName ] = menuitem;
+ // layout extents static methods - used for defining cached portlet decorator layoutExtents object
- titleBarContextMenu.addChild( menuitem );
+ /* static */
+ _createLayoutExtents: function( decorationConfig, forIFrameStyles, dNode, cNode, tbNode, rbNode, djObj, jsObj )
+ { // 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 ) };
+ if ( tbNode )
+ {
+ tbNodeCompStyle = djObj.gcs( tbNode );
+ layoutExtents.tbNode = this._createNodeLEs( tbNode, tbNodeCompStyle, djObj, jsObj );
+ var dragCursor = tbNodeCompStyle.cursor;
+ if ( dragCursor == null || dragCursor.length == 0 )
+ dragCursor = "move";
+ decorationConfig.dragCursor = dragCursor;
+ }
+
+ if ( rbNode )
+ {
+ rbNodeCompStyle = djObj.gcs( rbNode );
+ layoutExtents.rbNode = this._createNodeLEs( rbNode, rbNodeCompStyle, djObj, jsObj );
}
- document.body.appendChild( titleBarContextMenu.domNode );
+ 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;
+
+ if ( ! forIFrameStyles )
+ decorationConfig.layoutExtents = layoutExtents;
+ else
+ decorationConfig.layoutExtentsIFrame = layoutExtents;
},
- _createActionMenuItem: function( portletWindow, menulabel, actionName )
+
+ testLost: function()
{
- var menuitem = dojo.widget.createWidget( "MenuItem2", { caption: menulabel } );
- dojo.event.connect( menuitem, "onClick", function(e) { portletWindow.windowActionProcess( actionName ); } );
- return menuitem;
+ 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 ) };
},
+
+ // action functions
+
windowActionButtonClick: function( evt )
{
if ( evt == null || evt.target == null ) return;
@@ -685,17 +768,17 @@
},
windowActionMenuOpen: function( evt )
{
- var currentPortletActionState = null;
- var currentPortletActionMode = null;
+ var aState = null;
+ var aMode = null;
if ( this.portlet )
{
- currentPortletActionState = this.portlet.getCurrentActionState();
- currentPortletActionMode = this.portlet.getCurrentActionMode();
+ aState = this.portlet.getCurrentActionState();
+ aMode = this.portlet.getCurrentActionMode();
}
- for ( var actionName in this.actionMenus )
+ for ( var aNm in this.actionMenus )
{
- var menuitem = this.actionMenus[ actionName ];
- if ( this._isWindowActionEnabled( actionName, currentPortletActionState, currentPortletActionMode ) )
+ var menuitem = this.actionMenus[ aNm ];
+ if ( this._isWindowActionEnabled( aNm, aState, aMode ) )
{
menuitem.domNode.style.display = ""; // instead of menuitem.enable();
}
@@ -704,53 +787,66 @@
menuitem.domNode.style.display = "none"; // instead of menuitem.disable();
}
}
- this._getActionMenuPopupWidget().onOpen( evt );
+ this.actionMenuWidget.onOpen( evt );
},
- windowActionProcess: function( /* String */ actionName, evt )
+ windowActionProcessDev: function( /* String */ aNm, evt )
+ {
+ if ( aNm == this.dbMenuDims )
+ {
+ this.dumpPos();
+ }
+ },
+ windowActionProcess: 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=" + actionName );
- if ( actionName == null ) return;
- if ( jetspeed.prefs.windowActionDesktop[ actionName ] != null )
+ //dojo.debug( "windowActionProcess [" + ( this.portlet ? this.portlet.entityId : this.widgetId ) + ( this.portlet ? (" / " + this.widgetId) : "" ) + "]" + " actionName=" + aNm );
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
+ if ( aNm == null ) return;
+ if ( jsObj.prefs.windowActionDesktop[ aNm ] != null )
{
- if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_TILE )
+ if ( aNm == jsId.ACT_DESKTOP_TILE )
{
this.makeTiled();
}
- else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_UNTILE )
+ else if ( aNm == jsId.ACT_DESKTOP_UNTILE )
{
this.makeUntiled();
}
- else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_EXPAND )
+ else if ( aNm == jsId.ACT_DESKTOP_HEIGHT_EXPAND )
{
this.makeHeightToFit( false );
}
- else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_NORMAL )
+ else if ( aNm == jsId.ACT_DESKTOP_HEIGHT_NORMAL )
{
- this.makeHeightVariable( false );
+ this.makeHeightVariable( false, false );
}
}
- else if ( actionName == jetspeed.id.ACTION_NAME_MENU )
+ else if ( aNm == jsId.ACT_MENU )
{
this.windowActionMenuOpen( evt );
}
- else if ( actionName == jetspeed.id.ACTION_NAME_MINIMIZE )
+ else if ( aNm == jsId.ACT_MINIMIZE )
{ // make no associated content request - just notify server of change
+ if ( this.portlet && this.windowState == jsId.ACT_MAXIMIZE )
+ {
+ this.needsRenderOnRestore = true;
+ }
this.minimizeWindow();
if ( this.portlet )
{
- jetspeed.changeActionForPortlet( this.portlet.getId(), jetspeed.id.ACTION_NAME_MINIMIZE, null );
+ jsObj.changeActionForPortlet( this.portlet.getId(), jsId.ACT_MINIMIZE, null );
}
if ( ! this.portlet )
{
this.windowActionButtonSync();
}
}
- else if ( actionName == jetspeed.id.ACTION_NAME_RESTORE )
+ else if ( aNm == jsId.ACT_RESTORE )
{ // if minimized, make no associated content request - just notify server of change
var deferRestoreWindow = false;
if ( this.portlet )
{
- if ( this.windowState == jetspeed.id.ACTION_NAME_MAXIMIZE || this.needsRenderOnRestore )
+ if ( this.windowState == jsId.ACT_MAXIMIZE || this.needsRenderOnRestore )
{
if ( this.needsRenderOnRestore )
{
@@ -758,11 +854,13 @@
this.restoreOnNextRender = true;
this.needsRenderOnRestore = false;
}
- this.portlet.renderAction( actionName );
+ if ( this.iframesInfo )
+ this.iframesInfo.iframesSize = [];
+ this.portlet.renderAction( aNm );
}
else
{
- jetspeed.changeActionForPortlet( this.portlet.getId(), jetspeed.id.ACTION_NAME_RESTORE, null );
+ jsObj.changeActionForPortlet( this.portlet.getId(), jsId.ACT_RESTORE, null );
}
}
if ( ! deferRestoreWindow )
@@ -774,23 +872,29 @@
this.windowActionButtonSync();
}
}
- else if ( actionName == jetspeed.id.ACTION_NAME_MAXIMIZE )
+ else if ( aNm == jsId.ACT_MAXIMIZE )
{
- if ( this.portlet )
+ if ( this.portlet && this.iframesInfo )
{
- this.portlet.renderAction( actionName );
+ this.iframesInfo.iframesSize = [];
}
+
this.maximizeWindow();
- if ( ! this.portlet )
+
+ if ( this.portlet )
+ {
+ this.portlet.renderAction( aNm );
+ }
+ else
{
this.windowActionButtonSync();
}
}
- else if ( actionName == jetspeed.id.ACTION_NAME_REMOVEPORTLET )
+ else if ( aNm == jsId.ACT_REMOVEPORTLET )
{
if ( this.portlet )
{
- var pageEditorWidget = dojo.widget.byId( jetspeed.id.PG_ED_WID );
+ var pageEditorWidget = dojo.widget.byId( jsId.PG_ED_WID );
if ( pageEditorWidget != null )
{
pageEditorWidget.deletePortlet( this.portlet.entityId, this.title );
@@ -800,273 +904,180 @@
else
{
if ( this.portlet )
- this.portlet.renderAction( actionName );
+ this.portlet.renderAction( aNm );
}
},
- _isWindowActionEnabled: function( actionName, currentPortletActionState, currentPortletActionMode )
+ _isWindowActionEnabled: function( aNm, aState, aMode )
{
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
var enabled = false;
- if ( this.minimizeWindowTemporarilyRestoreTo != null )
+ if ( this.minimizeTempRestore != null )
{
if ( this.portlet )
{
- var actionDef = this.portlet.getAction( actionName );
+ var actionDef = this.portlet.getAction( aNm );
if ( actionDef != null )
{
- if ( actionDef.id == jetspeed.id.ACTION_NAME_REMOVEPORTLET )
+ if ( actionDef.id == jsId.ACT_REMOVEPORTLET )
{
- if ( jetspeed.page.editMode && this.getLayoutActionsEnabled() )
+ if ( jsObj.page.editMode && this.getLayoutActionsEnabled() )
enabled = true;
}
}
}
}
- else if ( actionName == jetspeed.id.ACTION_NAME_MENU )
+ else if ( aNm == jsId.ACT_MENU )
{
if ( ! this._windowActionMenuIsEmpty() )
enabled = true;
}
- else if ( jetspeed.prefs.windowActionDesktop[ actionName ] != null )
+ else if ( jsObj.prefs.windowActionDesktop[ aNm ] != null )
{
- var layoutActionsEnabled = this.getLayoutActionsEnabled();
- if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_EXPAND )
- {
- if ( ! this.windowHeightToFit && layoutActionsEnabled )
- enabled = true;
- }
- else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_NORMAL )
+ if ( this.getLayoutActionsEnabled() )
{
- if ( this.windowHeightToFit && layoutActionsEnabled )
- enabled = true;
- }
- else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_TILE && jetspeed.prefs.windowTiling )
- {
- if ( ! this.windowPositionStatic && layoutActionsEnabled )
- enabled = true;
- }
- else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_UNTILE )
- {
- if ( this.windowPositionStatic && layoutActionsEnabled )
- enabled = true;
+ if ( aNm == jsId.ACT_DESKTOP_HEIGHT_EXPAND )
+ {
+ if ( ! this.heightToFit )
+ enabled = true;
+ }
+ else if ( aNm == jsId.ACT_DESKTOP_HEIGHT_NORMAL )
+ {
+ if ( this.heightToFit )
+ enabled = true;
+ }
+ else if ( aNm == jsId.ACT_DESKTOP_TILE && jsObj.prefs.windowTiling )
+ {
+ if ( ! this.posStatic )
+ enabled = true;
+ }
+ else if ( aNm == jsId.ACT_DESKTOP_UNTILE )
+ {
+ if ( this.posStatic )
+ enabled = true;
+ }
}
}
else if ( this.portlet )
{
- var actionDef = this.portlet.getAction( actionName );
+ var actionDef = this.portlet.getAction( aNm );
if ( actionDef != null )
{
- if ( actionDef.id == jetspeed.id.ACTION_NAME_REMOVEPORTLET )
+ if ( actionDef.id == jsId.ACT_REMOVEPORTLET )
{
- if ( jetspeed.page.editMode && this.getLayoutActionsEnabled() )
+ if ( jsObj.page.editMode && this.getLayoutActionsEnabled() )
enabled = true;
}
- else if ( actionDef.type == jetspeed.id.PORTLET_ACTION_TYPE_MODE )
+ else if ( actionDef.type == jsId.PORTLET_ACTION_TYPE_MODE )
{
- if ( actionName != currentPortletActionMode )
+ if ( aNm != aMode )
{
enabled = true;
}
}
else
- { // assume actionDef.type == jetspeed.id.PORTLET_ACTION_TYPE_STATE
- if ( actionName != currentPortletActionState )
+ { // assume actionDef.type == jsId.PORTLET_ACTION_TYPE_STATE
+ if ( aNm != aState )
{
enabled = true;
}
}
}
+ else
+ {
+ enabled = true; // BOZO:NOW: debug menu item
+ }
}
else
{ // adjust visible action buttons - BOZO:NOW: this non-portlet case needs more attention
- if ( actionName == jetspeed.id.ACTION_NAME_MAXIMIZE )
+ if ( aNm == jsId.ACT_MAXIMIZE )
{
- if ( actionName != this.windowState && this.minimizeWindowTemporarilyRestoreTo == null )
+ if ( aNm != this.windowState && this.minimizeTempRestore == null )
{
enabled = true;
}
}
- else if ( actionName == jetspeed.id.ACTION_NAME_MINIMIZE )
+ else if ( aNm == jsId.ACT_MINIMIZE )
{
- if ( actionName != this.windowState )
+ if ( aNm != this.windowState )
{
enabled = true;
}
}
- else if ( actionName == jetspeed.id.ACTION_NAME_RESTORE )
+ else if ( aNm == jsId.ACT_RESTORE )
{
- if ( this.windowState == jetspeed.id.ACTION_NAME_MAXIMIZE || this.windowState == jetspeed.id.ACTION_NAME_MINIMIZE )
+ if ( this.windowState == jsId.ACT_MAXIMIZE || this.windowState == jsId.ACT_MINIMIZE )
{
enabled = true;
}
}
- }
- return enabled;
- },
- _windowActionMenuIsEmpty: function()
- { // meant to be called from within _isWindowActionEnabled call for ACTION_NAME_MENU
- var currentPortletActionState = null;
- var currentPortletActionMode = null;
- if ( this.portlet )
- {
- currentPortletActionState = this.portlet.getCurrentActionState();
- currentPortletActionMode = this.portlet.getCurrentActionMode();
- }
- var actionMenuIsEmpty = true;
- for ( var actionName in this.actionMenus )
- {
- var menuitem = this.actionMenus[ actionName ];
- if ( actionName != jetspeed.id.ACTION_NAME_MENU && this._isWindowActionEnabled( actionName, currentPortletActionState, currentPortletActionMode ) )
+ else
{
- actionMenuIsEmpty = false;
- break;
+ enabled = true; // BOZO:NOW: debug menu item
}
}
- return actionMenuIsEmpty ;
+ return enabled;
},
-
- windowActionButtonSync: function()
- {
- var hideButtons = this.windowDecorationConfig.windowActionButtonHide;
- var currentPortletActionState = null;
- var currentPortletActionMode = null;
+ _windowActionMenuIsEmpty: function()
+ { // meant to be called from within _isWindowActionEnabled call for ACT_MENU
+ var aState = null;
+ var aMode = null;
if ( this.portlet )
{
- currentPortletActionState = this.portlet.getCurrentActionState();
- currentPortletActionMode = this.portlet.getCurrentActionMode();
- }
- for ( var actionName in this.actionButtons )
- {
- var showBtn = false;
- if ( ! hideButtons || this.titleLit )
- {
- showBtn = this._isWindowActionEnabled( actionName, currentPortletActionState, currentPortletActionMode );
- }
- var buttonNode = this.actionButtons[ actionName ];
- if ( showBtn )
- buttonNode.style.display = "";
- else
- buttonNode.style.display = "none";
- }
- },
-
- portletInitDimensions: function()
- {
- if ( ! this.templateDomNodeClassName )
- this.templateDomNodeClassName = this.domNode.className;
- var domNodeClassName = this.templateDomNodeClassName;
- if ( this.windowDecorationName )
- {
- domNodeClassName = this.windowDecorationName + ( domNodeClassName ? ( " " + domNodeClassName ) : "" );
- }
- this.domNode.className = jetspeed.id.PORTLET_STYLE_CLASS + ( domNodeClassName ? ( " " + domNodeClassName ) : "" );
-
- if ( jetspeed.widget.pwGhost == null && jetspeed.page != null )
- { // ... PortletWindow drag ghost
- var pwGhost = document.createElement("div");
- pwGhost.id = "pwGhost";
- var defaultWndC = jetspeed.page.getPortletDecorationDefault();
- if ( ! defaultWndC ) defaultWndC = this.windowDecorationName;
- pwGhost.className = jetspeed.id.PORTLET_STYLE_CLASS + ( defaultWndC ? ( " " + defaultWndC ) : "" ) + ( this.templateDomNodeClassName ? ( " " + this.templateDomNodeClassName ) : "" );
- pwGhost.style.position = "static";
- pwGhost.style.width = "";
- pwGhost.style.left = "auto";
- pwGhost.style.top = "auto";
- jetspeed.widget.pwGhost = pwGhost;
- }
-
- if ( dojo.render.html.ie60 && jetspeed.widget.ie6ZappedContentHelper == null )
- {
- var ie6Helper = document.createElement("span");
- ie6Helper.id = "ie6ZappedContentHelper";
- jetspeed.widget.ie6ZappedContentHelper = ie6Helper;
+ aState = this.portlet.getCurrentActionState();
+ aMode = this.portlet.getCurrentActionMode();
}
-
- if ( this.containerNode )
+ var actionMenuIsEmpty = true;
+ for ( var aNm in this.actionMenus )
{
- if ( ! this.templateContainerNodeClassName )
- this.templateContainerNodeClassName = this.containerNode.className;
- var containerNodeClassName = this.templateContainerNodeClassName;
- if ( this.windowDecorationName )
+ var menuitem = this.actionMenus[ aNm ];
+ if ( aNm != jetspeed.id.ACT_MENU && this._isWindowActionEnabled( aNm, aState, aMode ) )
{
- containerNodeClassName = this.windowDecorationName + ( containerNodeClassName ? ( " " + containerNodeClassName ) : "" );
+ actionMenuIsEmpty = false;
+ break;
}
- this.containerNode.className = jetspeed.id.PORTLET_STYLE_CLASS + ( containerNodeClassName ? ( " " + containerNodeClassName ) : "" );
}
-
- this._adjustPositionToDesktopState();
-
- //this.resizeTo( null, null, true );
-
- //dojo.debug( "portletInitDimensions [" + this.widgetId + "] completed - domNode.style.width=" + this.domNode.style.width + " domNode.style.height=" + this.domNode.style.height );
+ return actionMenuIsEmpty ;
},
- // resetWindow: function( /* Portlet */ portlet )
- resetWindow: function( portlet )
+ windowActionButtonSync: function()
{
- this.portlet = portlet;
- this.portletMixinProperties();
- this.portletInitDragHandle();
- this.portletInitDimensions();
- },
-
- // dojo.widget.Widget create protocol
- postCreate: function( args, fragment, parentComp )
- { // FloatingPane 0.3.1 essentially calls resizeTo - this is done in portletInitDimensions()
- if ( this.movable && this.titleBar )
- {
- this.drag = new dojo.dnd.Moveable( this, {handle: this.titleBar});
- this.setTitleBarDragging();
- }
-
- this.domNode.id = this.widgetId; // BOZO: must set the id here - it gets defensively cleared by dojo
-
- this.portletInitDimensions();
-
- if ( jetspeed.debug.createWindow )
- dojo.debug( "createdWindow [" + ( this.portlet ? this.portlet.entityId : this.widgetId ) + ( this.portlet ? (" / " + this.widgetId) : "" ) + "]" + " width=" + this.domNode.style.width + " height=" + this.domNode.style.height + " left=" + this.domNode.style.left + " top=" + this.domNode.style.top ) ;
-
- this.portletInitialized = true;
-
- var initWindowState = null;
+ var hideButtons = this.decConfig.windowActionButtonHide;
+ var aState = null;
+ var aMode = null;
if ( this.portlet )
- initWindowState = this.portlet.getCurrentActionState();
- else
- initWindowState = this.getInitProperty( jetspeed.id.PORTLET_PROP_WINDOW_STATE );
- if ( initWindowState == jetspeed.id.ACTION_NAME_MINIMIZE )
{
- this.minimizeWindow();
- this.windowActionButtonSync();
- this.needsRenderOnRestore = true;
+ aState = this.portlet.getCurrentActionState();
+ aMode = this.portlet.getCurrentActionMode();
}
- else if ( initWindowState == jetspeed.id.ACTION_NAME_MAXIMIZE )
- { // needs delay so that widths are fully realized before maximize occurs
- dojo.lang.setTimeout( this, this._postCreateMaximizeWindow, 1500 );
- return;
+ for ( var aNm in this.actionButtons )
+ {
+ var showBtn = false;
+ if ( ! hideButtons || this.titleLit )
+ {
+ showBtn = this._isWindowActionEnabled( aNm, aState, aMode );
+ }
+ var buttonNode = this.actionButtons[ aNm ];
+ if ( showBtn )
+ buttonNode.style.display = "";
+ else
+ buttonNode.style.display = "none";
}
},
+
_postCreateMaximizeWindow: function()
{
this.maximizeWindow();
this.windowActionButtonSync();
},
-
- // dojo.widget.ContentPane protocol
- loadContents: function()
- { // do nothing
- },
-
- isPortletWindowInitialized: function()
- {
- return this.portletInitialized;
- },
minimizeWindowTemporarily: function()
{
- if ( this.minimizeWindowTemporarilyRestoreTo == null )
+ if ( this.minimizeTempRestore == null )
{
- this.minimizeWindowTemporarilyRestoreTo = this.windowState;
- if ( this.windowState != jetspeed.id.ACTION_NAME_MINIMIZE )
+ this.minimizeTempRestore = this.windowState;
+ if ( this.windowState != jetspeed.id.ACT_MINIMIZE )
{
this.minimizeWindow();
}
@@ -1075,11 +1086,11 @@
},
restoreFromMinimizeWindowTemporarily: function()
{
- var restoreToWindowState = this.minimizeWindowTemporarilyRestoreTo;
- this.minimizeWindowTemporarilyRestoreTo = null;
+ var restoreToWindowState = this.minimizeTempRestore;
+ this.minimizeTempRestore = null;
if ( restoreToWindowState )
{
- if ( restoreToWindowState != jetspeed.id.ACTION_NAME_MINIMIZE )
+ if ( restoreToWindowState != jetspeed.id.ACT_MINIMIZE )
{
this.restoreWindow();
}
@@ -1089,26 +1100,43 @@
minimizeWindow: function( evt )
{
- if ( ! this.titleBar )
+ if ( ! this.tbNode )
return;
- if ( this.windowState == jetspeed.id.ACTION_NAME_MAXIMIZE )
+ var jsObj = jetspeed;
+ if ( this.windowState == jetspeed.id.ACT_MAXIMIZE )
{
this.showAllPortletWindows() ;
this.restoreWindow( evt );
}
- this._setLastPositionInfo();
+
+ 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.resizeBar )
- this.resizeBar.style.display = "none";
- dojo.html.setContentBox( this.domNode, { height: dojo.html.getMarginBox( this.titleBar ).height } );
+ 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 = jetspeed.id.ACTION_NAME_MINIMIZE;
+ this.windowState = jsObj.id.ACT_MINIMIZE;
},
showAllPortletWindows: function()
{
- var allPWwidgets = dojo.widget.manager.getWidgetsByType( this.getNamespacedType() ) ;
+ var allPWwidgets = jetspeed.page.getPWins( false );
for ( var i = 0 ; i < allPWwidgets.length ; i++ )
{
var showPWwidget = allPWwidgets[i] ;
@@ -1120,7 +1148,7 @@
},
hideAllPortletWindows: function( excludeWidgetIds )
{
- var allPWwidgets = dojo.widget.manager.getWidgetsByType( this.getNamespacedType() ) ;
+ var allPWwidgets = jetspeed.page.getPWins( false );
for ( var i = 0 ; i < allPWwidgets.length ; i++ )
{
var hidePWwidget = allPWwidgets[i] ;
@@ -1129,7 +1157,10 @@
for ( var exclI = 0 ; exclI < excludeWidgetIds.length ; exclI++ )
{
if ( hidePWwidget.widgetId == excludeWidgetIds[exclI] )
- hidePWwidget = null ;
+ {
+ hidePWwidget = null;
+ break;
+ }
}
}
if ( hidePWwidget )
@@ -1140,537 +1171,670 @@
},
maximizeWindow: function( evt )
{
- this.hideAllPortletWindows( [ this.widgetId ] ) ;
- if ( this.windowState == jetspeed.id.ACTION_NAME_MINIMIZE )
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
+ var dNode = this.domNode;
+ var hideAllBut = [ this.widgetId ];
+ //if ( this.dbOn )
+ // hideAllBut.push( jetspeed.debugWindowId() );
+ this.hideAllPortletWindows( hideAllBut ) ;
+ if ( this.windowState == jsId.ACT_MINIMIZE )
{
this.restoreWindow( evt );
}
- var tiledStateIsChanging = this.windowPositionStatic;
- this._setLastPositionInfo( tiledStateIsChanging, true );
-
- var jetspeedDesktop = document.getElementById( jetspeed.id.DESKTOP );
- if ( this.windowPositionStatic )
- {
- this.domNode.style.position = "absolute";
- jetspeedDesktop.appendChild( this.domNode );
- }
+ var preMaxPosStatic = this.posStatic;
+ this.preMaxPosStatic = preMaxPosStatic;
+ this.preMaxHeightToFit = this.heightToFit;
+ var tiledStateWillChange = preMaxPosStatic;
- // disable resize and drag
- this.setTitleBarDragging( false );
+ this._updtDimsObj( tiledStateWillChange );
- jetspeed.widget.PortletWindow.superclass.bringToTop.call( this, evt );
+ 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)
+ var viewport = dojo.html.getViewport();
+ var docPadding = dojo.html.getPadding( jsObj.docBody );
// hardcoded to fill document.body width leaving 1px on each side
- var yPos = dojo.html.getAbsolutePosition( jetspeedDesktop, true ).y; // passing true to fix position at top (so not affected by vertically scrolled window)
- this.domNode.style.left = "1px";
- this.domNode.style.top = yPos;
+ this.dimsUntiledTemp = { width: viewport.width - docPadding.width - 2,
+ height: viewport.height - docPadding.height - yPos,
+ left: 1,
+ top: yPos };
- this.windowPositionStatic = false;
+ this._setTitleBarDragging( true, jsObj.css, false );
- var jetspeedPage = document.getElementById( jetspeed.id.PAGE );
+ this.posStatic = false;
+ this.heightToFit = false;
- var viewport = dojo.html.getViewport();
- var padding = dojo.html.getPadding( dojo.body() );
-
- this.resizeTo( viewport.width - padding.width - 2, viewport.height - padding.height - yPos );
+ this._alterCss( true, true );
+
+ if ( preMaxPosStatic )
+ jetspeedDesktop.appendChild( dNode );
- this.windowState = jetspeed.id.ACTION_NAME_MAXIMIZE;
+ this.windowState = jsId.ACT_MAXIMIZE;
},
restoreWindow: function( evt )
{
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
+ var jsCss = jsObj.css;
+ var dNode = this.domNode;
var currentlyAbsolute = false;
- if ( this.domNode.style.position == "absolute" )
+ if ( dNode.style.position == "absolute" )
{
currentlyAbsolute = true;
}
- var lastPositionInfo = null;
- if ( this.windowState == jetspeed.id.ACTION_NAME_MAXIMIZE )
+ var lastPI = null;
+ if ( this.windowState == jsId.ACT_MAXIMIZE )
{
this.showAllPortletWindows() ;
- this.windowPositionStatic = ( this.lastWindowPositionStatic != null ? this.lastWindowPositionStatic : false );
+ this.posStatic = this.preMaxPosStatic;
+ this.heightToFit = this.preMaxHeightToFit;
+ this.dimsUntiledTemp = null;
}
+
+ var disIdx = jsCss.cssDis;
+ this.cNodeCss[ disIdx ] = "block";
+ if ( this.rbNodeCss )
+ this.rbNodeCss[ disIdx ] = "block";
+
+ var dimsPrevious = this.getDimsObj( this.posStatic );
+
+ this.windowState = jsId.ACT_RESTORE; // "normal"
- this.containerNode.style.display = "";
- if ( this.resizeBar )
- this.resizeBar.style.display = "";
-
- var lastPositionInfo = this.getLastPositionInfo();
+ this._setTitleBarDragging( true, jsObj.css );
- var lpiWidth = null;
- var lpiHeight = null;
- if ( lastPositionInfo != null )
- {
- lpiWidth = lastPositionInfo.width;
- lpiHeight = lastPositionInfo.height;
- for ( var attr in lastPositionInfo )
- {
- if ( attr != "columnInfo" )
- this.domNode.style[ attr ] = lastPositionInfo[ attr ];
- }
- }
+ this._alterCss( true, true );
- this._adjustPositionToDesktopState();
-
- if ( this.windowPositionStatic && currentlyAbsolute )
+ if ( this.posStatic && currentlyAbsolute )
{ // tiled window in maximized needs to be placed back in previous column/row
- if ( lastPositionInfo != null && lastPositionInfo.columnInfo != null && lastPositionInfo.columnInfo.columnIndex != null )
+ if ( dimsPrevious != null && dimsPrevious.columnInfo != null && dimsPrevious.columnInfo.columnIndex != null )
{
- var columnElmt = jetspeed.page.columns[ lastPositionInfo.columnInfo.columnIndex ];
- if ( lastPositionInfo.columnInfo.previousSibling )
- dojo.dom.insertAfter( this.domNode, lastPositionInfo.columnInfo.previousSibling );
- else if ( lastPositionInfo.columnInfo.nextSibling )
- dojo.dom.insertBefore( this.domNode, lastPositionInfo.columnInfo.nextSibling );
+ 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( this.domNode );
+ columnElmt.domNode.appendChild( dNode );
}
else
{
- if ( jetspeed.page.columns != null && jetspeed.page.columns.length > 0 )
- dojo.dom.prependChild( this.domNode, jetspeed.page.columns[ 0 ].domNode );
+ if ( jsObj.page.columns != null && jsObj.page.columns.length > 0 )
+ dojo.dom.prependChild( dNode, jsObj.page.columns[ 0 ].domNode );
}
- this.domNode.style.position = "static";
}
-
- this.resizeTo( lpiWidth, lpiHeight, true );
-
- this._adjustPositionToDesktopState();
-
- this.windowState = jetspeed.id.ACTION_NAME_RESTORE; // "normal"
-
- this.setTitleBarDragging();
},
- getLastPositionInfo: function()
- {
- if ( this.windowPositionStatic )
- return this.lastTiledPositionInfo;
- return this.lastUntiledPositionInfo;
- },
- _setLastPositionInfo: function( tiledStateIsChanging, changingToMaximized )
+ _updtDimsObj: function( tiledStateWillChange )
{
- if ( changingToMaximized )
+ var jsObj = jetspeed;
+ var jsId = jsObj.id;
+ var djObj = dojo;
+ var dNode = this.domNode;
+ var posStatic = this.posStatic;
+ var dimsCurrent = this.getDimsObj( posStatic );
+ if ( posStatic )
{
- this.lastWindowPositionStatic = this.windowPositionStatic;
- }
- if ( this.windowPositionStatic )
- {
- if ( this.lastTiledPositionInfo == null )
- {
- this.lastTiledPositionInfo = {};
- }
- if ( tiledStateIsChanging )
+ if ( tiledStateWillChange )
{ // record col/row location
var columnInfo = {};
- var sibling = dojo.dom.getPreviousSiblingElement( this.domNode );
+ var sibling = djObj.dom.getPreviousSiblingElement( dNode );
if ( sibling )
columnInfo.previousSibling = sibling;
else
{
- sibling = dojo.dom.getNextSiblingElement( this.domNode );
+ sibling = djObj.dom.getNextSiblingElement( dNode );
if ( sibling )
columnInfo.nextSibling = sibling;
}
columnInfo.columnIndex = this.getPageColumnIndex();
- this.lastTiledPositionInfo.columnInfo = columnInfo;
+ dimsCurrent.columnInfo = columnInfo;
}
- if ( this.windowState != jetspeed.id.ACTION_NAME_MINIMIZE && this.windowState != jetspeed.id.ACTION_NAME_MAXIMIZE )
+ /*
+ if ( this.windowState != jsId.ACT_MINIMIZE && this.windowState != jsId.ACT_MAXIMIZE )
{
- this.lastTiledPositionInfo.height = this.domNode.style.height;
- }
- this.lastTiledPositionInfo.width = "";
+ 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;
+ }
+ dimsCurrent.width = null;
+ */
}
else
{
- if ( this.windowState != jetspeed.id.ACTION_NAME_MINIMIZE && this.windowState != jetspeed.id.ACTION_NAME_MAXIMIZE )
- {
- var domNodeMarginBox = dojo.html.getMarginBox( this.domNode ) ;
- this.lastUntiledPositionInfo =
- {
- width: domNodeMarginBox.width,
- height: domNodeMarginBox.height,
- left: this.domNode.style.left,
- top: this.domNode.style.top,
[... 2553 lines stripped ...]
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org