portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smi...@apache.org
Subject svn commit: r542774 - in /portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed: common.js desktop/core.js widget/PortletWindow.js
Date Wed, 30 May 2007 08:21:36 GMT
Author: smilek
Date: Wed May 30 01:21:32 2007
New Revision: 542774

URL: http://svn.apache.org/viewvc?view=rev&rev=542774
Log:
addresses JS2-698 (Minimized mode functions only in un-tiled state on desktop), JS2-697 (Maximized
mode overlaps as popup on desktop) and JS2-695 (The Desktop does NOT support the no-action
layouts) - lots of changes related to minimize/maximize/restore of PortletWindows (addressing
many long standing issues)

Modified:
    portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js
    portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js
    portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js

Modified: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js?view=diff&rev=542774&r1=542773&r2=542774
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js (original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js Wed May 30 01:21:32
2007
@@ -659,37 +659,46 @@
             //dojo.debugShallow( type ) ;
             //dojo.debug( "  http:" );
             //dojo.debugShallow( http ) ;
-            var dmId = null;
-            if ( this.debugContentDumpIds )
+            try
             {
-                dmId = ( ( this.domainModelObject && dojo.lang.isFunction( this.domainModelObject.getId
) ) ? this.domainModelObject.getId() : "" );
-                for ( var debugContentIndex = 0 ; debugContentIndex < this.debugContentDumpIds.length;
debugContentIndex++ )
+                var dmId = null;
+                if ( this.debugContentDumpIds )
                 {
-                    if ( dmId.match( new RegExp( this.debugContentDumpIds[ debugContentIndex
] ) ) )
+                    dmId = ( ( this.domainModelObject && dojo.lang.isFunction( this.domainModelObject.getId
) ) ? this.domainModelObject.getId() : "" );
+                    for ( var debugContentIndex = 0 ; debugContentIndex < this.debugContentDumpIds.length;
debugContentIndex++ )
                     {
-                        if ( dojo.lang.isString( data ) )
-                            dojo.debug( "retrieveContent [" + ( dmId ? dmId : this.url )
+ "] content: " + data );
-                        else
+                        if ( dmId.match( new RegExp( this.debugContentDumpIds[ debugContentIndex
] ) ) )
                         {
-                            var textContent = dojo.dom.innerXML( data );
-                            if ( ! textContent )
-                                textContent = ( data != null ? "!= null (IE no XMLSerializer)"
: "null" );
-                            dojo.debug( "retrieveContent [" + ( dmId ? dmId : this.url )
+ "] xml-content: " + textContent );
+                            if ( dojo.lang.isString( data ) )
+                                dojo.debug( "retrieveContent [" + ( dmId ? dmId : this.url
) + "] content: " + data );
+                            else
+                            {
+                                var textContent = dojo.dom.innerXML( data );
+                                if ( ! textContent )
+                                    textContent = ( data != null ? "!= null (IE no XMLSerializer)"
: "null" );
+                                dojo.debug( "retrieveContent [" + ( dmId ? dmId : this.url
) + "] xml-content: " + textContent );
+                            }
                         }
                     }
                 }
+                if ( this.contentListener && dojo.lang.isFunction( this.contentListener.notifySuccess
) )
+                {
+                    this.contentListener.notifySuccess( data, this.url, this.domainModelObject,
http ) ;
+                }
+                else
+                {
+                    dmId = ( ( this.domainModelObject && dojo.lang.isFunction( this.domainModelObject.getId
) ) ? this.domainModelObject.getId() : "" );
+                    dojo.debug( "retrieveContent [" + ( dmId ? dmId : this.url ) + "] no
valid contentListener" );
+                }
+                if ( this.hideLoadingIndicator )
+                    jetspeed.url.loadingIndicatorHide();
             }
-            if ( this.contentListener && dojo.lang.isFunction( this.contentListener.notifySuccess
) )
-            {
-                this.contentListener.notifySuccess( data, this.url, this.domainModelObject,
http ) ;
-            }
-            else
+            catch(e)
             {
-                dmId = ( ( this.domainModelObject && dojo.lang.isFunction( this.domainModelObject.getId
) ) ? this.domainModelObject.getId() : "" );
-                dojo.debug( "retrieveContent [" + ( dmId ? dmId : this.url ) + "] no valid
contentListener" );
+                if ( this.hideLoadingIndicator )
+                    jetspeed.url.loadingIndicatorHide();
+                throw e;
             }
-            if ( this.hideLoadingIndicator )
-                jetspeed.url.loadingIndicatorHide();
         },
     
         error: function( type, error )
@@ -699,12 +708,21 @@
             //dojo.debugShallow( type ) ;
             //dojo.debug( "  error:" );
             //dojo.debugShallow( error ) ;
-            if ( this.contentListener && dojo.lang.isFunction( this.contentListener.notifyFailure
) )
+            try
+            {
+                if ( this.contentListener && dojo.lang.isFunction( this.contentListener.notifyFailure
) )
+                {
+                    this.contentListener.notifyFailure( type, error, this.url, this.domainModelObject
);
+                }
+                if ( this.hideLoadingIndicator )
+                    jetspeed.url.loadingIndicatorHide();
+            }
+            catch(e)
             {
-                this.contentListener.notifyFailure( type, error, this.url, this.domainModelObject
);
+                if ( this.hideLoadingIndicator )
+                    jetspeed.url.loadingIndicatorHide();
+                throw e;
             }
-            if ( this.hideLoadingIndicator )
-                jetspeed.url.loadingIndicatorHide();
         }
     });
     

Modified: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js?view=diff&rev=542774&r1=542773&r2=542774
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js (original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js Wed May 30 01:21:32
2007
@@ -187,6 +187,7 @@
     setPortletContent: false,
     doRenderDoAction: false,
     postParseAnnotateHtml: false,
+    postParseAnnotateHtmlDisableAnchors: false,
     confirmOnSubmit: false,
     createWindow: false,
     initializeWindowState: false,
@@ -1138,6 +1139,7 @@
     shortTitle: null,
     layoutDecorator: null,
     portletDecorator: null,
+    layoutActionsDisabled: false,
 
     layouts: null,
     columns: null,
@@ -1330,7 +1332,16 @@
             dojo.raise( "No root fragment in PSML." );
             return null;
         }
-        
+
+        var rootFragNameAttr = rootFragment.getAttribute( "name" );
+        if ( rootFragNameAttr != null )
+        {
+            rootFragNameAttr = rootFragNameAttr.toLowerCase();
+            if ( rootFragNameAttr.indexOf( "noactions" ) != -1 )
+            {
+                this.layoutActionsDisabled = true;
+            }
+        }
         var parsedRootLayoutFragment = this._parsePSMLLayoutFragment( rootFragment, 0 );
   // rootFragment must be a layout fragment - /portal requires this as well
         return parsedRootLayoutFragment;
     },
@@ -2816,6 +2827,7 @@
             var cNode = containerNode;
             var formList = cNode.getElementsByTagName( "form" );
             var debugOn = jetspeed.debug.postParseAnnotateHtml;
+            var disableAnchorConversion = jetspeed.debug.postParseAnnotateHtmlDisableAnchors;
             if ( formList )
             {
                 for ( var i = 0 ; i < formList.length ; i++ )
@@ -2837,7 +2849,7 @@
                         //  ^^^ formBind serves as an event hook up - retained ref is not
needed
                         
                         if ( debugOn )
-                            dojo.debug( "postParseAnnotateHtml [" + this.entityId + "] adding
FormBind (portlet-" + submitOperation + ") and setting form action to: " + replacementActionUrl
);
+                            dojo.debug( "postParseAnnotateHtml [" + this.entityId + "] adding
FormBind (" + submitOperation + ") for form with action: " + cFormAction );
                     }
                     else if ( cFormAction == null || cFormAction.length == 0 )
                     {
@@ -2863,7 +2875,9 @@
                     var aHref = aNode.href;
                     
                     var parsedPseudoUrl = jetspeed.portleturl.parseContentUrlForDesktopActionRender(
aHref );
-                    var replacementHref = jetspeed.portleturl.generateJSPseudoUrlActionRender(
parsedPseudoUrl );
+                    var replacementHref = null;
+                    if ( ! disableAnchorConversion )
+                        replacementHref = jetspeed.portleturl.generateJSPseudoUrlActionRender(
parsedPseudoUrl );
 
                     if ( ! replacementHref )
                     {
@@ -3557,13 +3571,13 @@
         if ( parsedPseudoUrl.operation == jetspeed.portleturl.PORTLET_REQUEST_ACTION || parsedPseudoUrl.operation
== jetspeed.portleturl.PORTLET_REQUEST_RENDER )
         {
             if ( jetspeed.debug.doRenderDoAction )
-                dojo.debug( "PortletActionContentListener extracted from javascript-pseudo-url:
" + portletContent + "  url: " + parsedPseudoUrl.url + " operation: " + parsedPseudoUrl.operation
+ " entity-id: " + parsedPseudoUrl.portletEntityId ) ;
+                dojo.debug( "PortletActionContentListener " + parsedPseudoUrl.operation +
"-url in response body: " + portletContent + "  url: " + parsedPseudoUrl.url + " entity-id:
" + parsedPseudoUrl.portletEntityId ) ;
             renderUrl = parsedPseudoUrl.url;
         }
         else
         {
             if ( jetspeed.debug.doRenderDoAction )
-                dojo.debug( "PortletActionContentListener: " + portletContent )
+                dojo.debug( "PortletActionContentListener other-url in response body: " +
portletContent )
             renderUrl = portletContent;
             if ( renderUrl )
             {
@@ -4378,11 +4392,14 @@
     notifySuccess: function( /* String */ data, /* String */ requestUrl, domainModelObject
)
     {
         dojo.lang.mixin( domainModelObject.portlet.lastSavedWindowState, this.changedState
);
-        jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, ("move-portlet [" + domainModelObject.portlet.entityId
+ "]"), jetspeed.debug.submitChangedWindowState );
+        var reportError = false;
+        if ( djConfig.isDebug && jetspeed.debug.submitChangedWindowState )
+            reportError = true;
+        jetspeed.url.checkAjaxApiResponse( requestUrl, data, reportError, ("move-portlet
[" + domainModelObject.portlet.entityId + "]"), jetspeed.debug.submitChangedWindowState );
     },
     notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl,
domainModelObject )
     {
-        dojo.raise( "submitChangedWindowState error [" + domainModelObject.entityId + "]
url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
+        dojo.debug( "submitChangedWindowState error [" + domainModelObject.entityId + "]
url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
     }
 };
 

Modified: portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js?view=diff&rev=542774&r1=542773&r2=542774
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js (original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js Wed May
30 01:21:32 2007
@@ -712,6 +712,26 @@
         }
         this._getActionMenuPopupWidget().onOpen( evt );        
     },
+    windowActionMenuIsEmpty: function()
+    {
+        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 ( this._isWindowActionEnabled( actionName, currentPortletActionState, currentPortletActionMode
) )
+            {
+                actionMenuIsEmpty = true;
+                break;
+            }
+        }
+    },
     windowActionProcess: function( /* String */ actionName, 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 );
@@ -753,10 +773,17 @@
         }
         else if ( actionName == jetspeed.id.ACTION_NAME_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 )
+                if ( this.windowState == jetspeed.id.ACTION_NAME_MAXIMIZE || this.needsRenderOnRestore
)
                 {
+                    if ( this.needsRenderOnRestore )
+                    {
+                        deferRestoreWindow = true;
+                        this.restoreOnNextRender = true;
+                        this.needsRenderOnRestore = false;
+                    }
                     this.portlet.renderAction( actionName );
                 }
                 else
@@ -764,7 +791,10 @@
                     jetspeed.changeActionForPortlet( this.portlet.getId(), jetspeed.id.ACTION_NAME_RESTORE,
null );
                 }
             }
-            this.restoreWindow();
+            if ( ! deferRestoreWindow )
+            {
+                this.restoreWindow();
+            }
             if ( ! this.portlet )
             {
                 this.windowActionButtonSync();
@@ -819,29 +849,33 @@
         }
         else if ( actionName == jetspeed.id.ACTION_NAME_MENU )
         {
-            enabled = true;
+            if ( this.windowState != jetspeed.id.ACTION_NAME_MAXIMIZE || this.windowActionMenuIsEmpty()
)
+                enabled = true;
         }
         else if ( jetspeed.prefs.windowActionDesktop[ actionName ] != null )
         {
-            if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_EXPAND )
-            {
-                if ( ! this.windowHeightToFit )
-                    enabled = true;
-            }
-            else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_NORMAL )
-            {
-                if ( this.windowHeightToFit )
-                    enabled = true;
-            }
-            else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_TILE && jetspeed.prefs.windowTiling
)
+            if ( this.windowState != jetspeed.id.ACTION_NAME_MAXIMIZE )
             {
-                if ( ! this.windowPositionStatic )
-                    enabled = true;
-            }
-            else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_UNTILE )
-            {
-                if ( this.windowPositionStatic )
-                    enabled = true;
+                if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_EXPAND )
+                {
+                    if ( ! this.windowHeightToFit )
+                        enabled = true;
+                }
+                else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_NORMAL )
+                {
+                    if ( this.windowHeightToFit )
+                        enabled = true;
+                }
+                else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_TILE && jetspeed.prefs.windowTiling
)
+                {
+                    if ( ! this.windowPositionStatic )
+                        enabled = true;
+                }
+                else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_UNTILE )
+                {
+                    if ( this.windowPositionStatic )
+                        enabled = true;
+                }
             }
         }
         else if ( this.portlet )
@@ -969,7 +1003,10 @@
             this.drag = new jetspeed.widget.PortletWindowDragMoveSource( this );
             if ( this.constrainToContainer )
                 this.drag.constrainTo();
-            this.drag.setDragHandle( this.titleBar );
+            if ( ! this.portlet || ! jetspeed.page.layoutActionsDisabled )
+                this.setTitleBarDragging( true );
+            else
+                this.setTitleBarDragging( false );
         }
         
         this.domNode.id = this.widgetId;  // BOZO: must set the id here - it gets defensively
cleared by dojo
@@ -981,14 +1018,28 @@
 
         this.portletInitialized = true;
 
-        var initWindowState = this.getInitProperty( jetspeed.id.PORTLET_PROP_WINDOW_STATE
);
+        var initWindowState = 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;
+        }
+        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 );
         }
     },
-
+    _postCreateMaximizeWindow: function()
+    {
+        this.maximizeWindow();
+        this.windowActionButtonSync();
+    },
+    
     // dojo.widget.ContentPane protocol
     loadContents: function()
     {   // do nothing
@@ -1027,6 +1078,10 @@
     
     minimizeWindow: function( evt )
     {
+        if ( this.windowState == jetspeed.id.ACTION_NAME_MAXIMIZE )
+        {
+            this.restoreWindow( evt );
+        }
         this._setLastPositionInfo();
 
         this.containerNode.style.display = "none";
@@ -1037,6 +1092,10 @@
     },
     maximizeWindow: function( evt )
     {
+        if ( this.windowState == jetspeed.id.ACTION_NAME_MINIMIZE )
+        {
+            this.restoreWindow( evt );
+        }
         var tiledStateIsChanging = this.windowPositionStatic;
         this._setLastPositionInfo( tiledStateIsChanging, true );
         
@@ -1046,6 +1105,10 @@
             this.domNode.style.position = "absolute";
             jetspeedDesktop.appendChild( this.domNode );
         }
+
+        // disable resize and drag
+        this.setTitleBarDragging( false );
+
         jetspeed.widget.PortletWindow.superclass.bringToTop.call( this, evt );
         
         // hardcoded to fill document.body width leaving 1px on each side
@@ -1083,6 +1146,9 @@
             this.windowPositionStatic = ( this.lastWindowPositionStatic != null ? this.lastWindowPositionStatic
: false );
         }
 
+        if ( ! this.portlet || ! jetspeed.page.layoutActionsDisabled )
+            this.setTitleBarDragging( true );
+
         this.containerNode.style.display = "";
         this.resizeBar.style.display = "";
 
@@ -1125,6 +1191,8 @@
         
 		this.resizeTo( lpiWidth, lpiHeight, true );
 
+        this._adjustPositionToDesktopState();
+
 		this.windowState = jetspeed.id.ACTION_NAME_RESTORE;  // "normal"
 	},
     getLastPositionInfo: function()
@@ -1192,6 +1260,27 @@
         }
     },
 
+    setTitleBarDragging: function( enableDrag )
+    {
+        if ( enableDrag )
+        {
+            if ( this.normalTitleBarCursor != null )
+                this.titleBar.style.cursor = this.normalTitleBarCursor;
+            if ( this.resizeHandle )
+                this.resizeHandle.domNode.style.display="";
+            this.drag.setDragHandle( this.titleBar );
+        }
+        else
+        {
+            if ( this.normalTitleBarCursor == null )
+                this.normalTitleBarCursor = dojo.html.getComputedStyle( this.titleBar, "cursor"
);
+            this.titleBar.style.cursor = "default";
+            if ( this.resizeHandle )
+                this.resizeHandle.domNode.style.display="none";
+            this.drag.setDragHandle( null );
+        }
+    },
+
     bringToTop: function( evt )
     {
         var beforeZIndex = this.domNode.style.zIndex;
@@ -1275,6 +1364,8 @@
     
         this.resizeTo( null, null, true );
 
+        this._adjustPositionToDesktopState();
+
         if ( ! suppressSubmitChange && this.portlet )
             this.portlet.submitChangedWindowState();
     },
@@ -1289,7 +1380,12 @@
         //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 );
         
-        this.resizeTo( null, null, true );
+        
+        var domNodeMarginBox = dojo.html.getMarginBox( this.domNode ) ;
+        var w = domNodeMarginBox.width;
+        var h = domNodeMarginBox.height + 3;   // the plus 3 is mysteriously useful for avoiding
initial scrollbar
+
+        this.resizeTo( w, h, true );
     
         if ( dojo.render.html.ie )
             dojo.lang.setTimeout( this, this._IEPostResize, 10 );
@@ -1367,8 +1463,7 @@
         if ( h < ( this.lostHeight + 60 ) )
         {
             h = this.lostHeight + 60;
-        }
-
+        }        
         dojo.html.setMarginBox( this.domNode, { height: h } );
         dojo.html.setMarginBox( this.containerNode, { height: h-this.lostHeight } );
 
@@ -1734,6 +1829,12 @@
 
         if ( this.portlet )
             this.portlet.postParseAnnotateHtml( this.containerNode );
+
+        if ( this.restoreOnNextRender )
+        {
+            this.restoreOnNextRender = false;
+            this.restoreWindow();
+        }
     },
     setPortletTitle: function( newPortletTitle )
     {



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message