portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smi...@apache.org
Subject svn commit: r545063 - in /portals/jetspeed-2/trunk: components/portal/src/java/org/apache/jetspeed/desktop/impl/ src/webapp/javascript/jetspeed/ src/webapp/javascript/jetspeed/desktop/ src/webapp/javascript/jetspeed/widget/
Date Thu, 07 Jun 2007 04:51:15 GMT
Author: smilek
Date: Wed Jun  6 21:51:15 2007
New Revision: 545063

URL: http://svn.apache.org/viewvc?view=rev&rev=545063
Log:

---------
support loading status by portlet by changing the portlet title, with functions added to jetspeed.om.Portlet
(loadingIndicatorShow, loadingIndicatorHide, loadingIndicatorIsShown) and management added
to PortletChangeActionContentListener, PortletActionsContentListener, PortletContentListener,
PortletActionContentListener, MoveAjaxApiContentListener - these layout decoration resources
are required for loading/updating title change (this example is what has been added to tigris
and blueocean) : 

# if empty string, portlet title bar will not change during ajax calls for portlet render
desktop.action.loadportletrender=Loading ...

# if empty string, portlet title bar will not change during ajax calls for portlet action
submits
desktop.action.loadportletaction=Updating ...

# if empty string, portlet title bar will not change during ajax calls for get-portlet-action,
change-portlet-action, move-portlet
desktop.action.loadportletupdate=

---------
added support for disabling layout actions by layout fragment - if "NoActions" layout is detected,
changes to the layout are prevented - can't move or resize portlets inside the layout, can't
add a portlet to the layout, etc - for nested layouts, the "NoActions" setting is based on
each individual layout fragment.- here are some changes made to each PortletWindow that is
inside a "NoActions" layout:

  - window cannot be moved
  - window cannot be resized
  - window title-bar cursor should be 'default' instead of 'move'
  - window resize-handle should be hidden
  - these actions are disabled: heightexpand, heightnormal, tile, untile - this usually causes
the action-menu button to be hidden (the button is hidden when all menu options are disabled)

---------
added PortletWindow showAllPortletWindows/hideAllPortletWindows to properly support maximize
window mode (all other PortletWindow widgets are now hidden when a window is maximized) -
also, when maximized, we change the window in the same way it is changed when inside a "NoActions"
layout (as listed above)

---------
in tigris and blueocean layout decorators, comment-out page level loading indicator: <div
id="js-showloading" ...

Modified:
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/desktop/impl/JetspeedDesktopImpl.java
    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/components/portal/src/java/org/apache/jetspeed/desktop/impl/JetspeedDesktopImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/desktop/impl/JetspeedDesktopImpl.java?view=diff&rev=545063&r1=545062&r2=545063
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/desktop/impl/JetspeedDesktopImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/desktop/impl/JetspeedDesktopImpl.java
Wed Jun  6 21:51:15 2007
@@ -55,7 +55,7 @@
     private final static String DOJO_CONFIG_PORTLET_DECORATIONS_ALLOWED_VAR_NAME = HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME
+ ".portletDecorationsAllowed";
     private final static String DOJO_CONFIG_ACTION_LABELS_NAME = HeaderResource.HEADER_INTERNAL_DOJO_CONFIG_JETSPEED_VAR_NAME
+ ".desktopActionLabels";
 
-    private final static String[] DESKTOP_ACTIONS = new String[] { "menu", "tile", "untile",
"heightexpand", "heightnormal", "restore", "removeportlet", "addportlet", "editpage", "loading"
};
+    private final static String[] DESKTOP_ACTIONS = new String[] { "menu", "tile", "untile",
"heightexpand", "heightnormal", "restore", "removeportlet", "loadportletrender", "loadportletaction",
"loadportletupdate", "addportlet", "editpage", "loadpage" };
     private final static String DESKTOP_ACTION_RESOURCE_NAME_PREFIX = "desktop.action.";
     
     private static final Log log = LogFactory.getLog( JetspeedDesktopImpl.class );

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=545063&r1=545062&r2=545063
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js (original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/common.js Wed Jun  6 21:51:15
2007
@@ -789,8 +789,10 @@
         }
         return msg;
     };
-    jetspeed.url.loadingIndicatorShow = function()
+    jetspeed.url.loadingIndicatorShow = function( actionName )
     {
+        if ( typeof actionName == "undefined" )
+            actionName = "loadpage";
         var loading = document.getElementById( jetspeed.url.LOADING_INDICATOR_ID );
         if ( loading != null && loading.style )
         {
@@ -798,15 +800,18 @@
             {
                 loading.style[ "display" ] = "";
 
-                var actionlabel = null;
-                if ( jetspeed.prefs != null && jetspeed.prefs.desktopActionLabels
!= null )
-                    actionlabel = jetspeed.prefs.desktopActionLabels[ "loading" ];
-                if ( actionlabel != null )
+                if ( actionName != null )
                 {
-                    var loadingContent = document.getElementById( jetspeed.url.LOADING_INDICATOR_ID
+ "-content" );
-                    if ( loadingContent != null )
+                    var actionlabel = null;
+                    if ( jetspeed.prefs != null && jetspeed.prefs.desktopActionLabels
!= null )
+                        actionlabel = jetspeed.prefs.desktopActionLabels[ actionName ];
+                    if ( actionlabel != null && actionlabel.length > 0 )
                     {
-                        loadingContent.innerHTML = actionlabel;
+                        var loadingContent = document.getElementById( jetspeed.url.LOADING_INDICATOR_ID
+ "-content" );
+                        if ( loadingContent != null )
+                        {
+                            loadingContent.innerHTML = actionlabel;
+                        }
                     }
                 }
                 return true;

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=545063&r1=545062&r2=545063
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js (original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js Wed Jun  6 21:51:15
2007
@@ -104,7 +104,9 @@
     ACTION_NAME_DESKTOP_HEIGHT_EXPAND: "heightexpand",
     ACTION_NAME_DESKTOP_HEIGHT_NORMAL: "heightnormal",
 
-    ACTION_NAME_LOADING: "loading",
+    ACTION_NAME_LOAD_RENDER: "loadportletrender",
+    ACTION_NAME_LOAD_ACTION: "loadportletaction",
+    ACTION_NAME_LOAD_UPDATE: "loadportletupdate",
 
     PORTLET_ACTION_TYPE_MODE: "mode",
     PORTLET_ACTION_TYPE_STATE: "state",
@@ -498,7 +500,7 @@
             else
                 dojo.debug( "doAction [" + portletEntityId + "] url: " + bindArgs.url + "
form: " + jetspeed.debugDumpForm( bindArgs.formNode ) );
         }
-        targetPortlet.retrieveContent( new jetspeed.om.PortletActionContentListener( bindArgs
), bindArgs );
+        targetPortlet.retrieveContent( new jetspeed.om.PortletActionContentListener( targetPortlet,
bindArgs ), bindArgs );
     }
 };
 
@@ -838,18 +840,17 @@
 	var ajaxApiContext = new jetspeed.om.Id( "selectorPortlets", { } );
     jetspeed.url.retrieveContent( { url: getPortletsUrl, mimetype: mimetype }, contentListener,
ajaxApiContext, jetspeed.debugContentDumpIds );
 };
-jetspeed.getActionsForPortlet = function( /* String */ portletEntityId, contentListener )
+jetspeed.getActionsForPortlet = function( /* String */ portletEntityId )
 {
     if ( portletEntityId == null ) return;
-    jetspeed.getActionsForPortlets( [ portletEntityId ], contentListener );
+    jetspeed.getActionsForPortlets( [ portletEntityId ] );
 };
-jetspeed.getActionsForPortlets = function( /* Array */ portletEntityIds, contentListener
)
+jetspeed.getActionsForPortlets = function( /* Array */ portletEntityIds )
 {
-    if ( contentListener == null )
-        contentListener = new jetspeed.om.PortletActionsContentListener();
-    var queryString = "?action=getactions";
     if ( portletEntityIds == null )
         portletEntityIds = jetspeed.page.getPortletIds();
+    var contentListener = new jetspeed.om.PortletActionsContentListener( portletEntityIds
);
+    var queryString = "?action=getactions";
     for ( var i = 0 ; i < portletEntityIds.length ; i++ )
     {
         queryString += "&id=" + portletEntityIds[i];
@@ -1139,7 +1140,6 @@
     shortTitle: null,
     layoutDecorator: null,
     portletDecorator: null,
-    layoutActionsDisabled: false,
 
     layouts: null,
     columns: null,
@@ -1333,15 +1333,6 @@
             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;
     },
@@ -1354,6 +1345,16 @@
             dojo.raise( "_parsePSMLLayoutFragment called with non-layout fragment: " + layoutNode
);
             return null;
         }
+        var layoutActionsDisabled = false;
+        var layoutFragNameAttr = layoutNode.getAttribute( "name" );
+        if ( layoutFragNameAttr != null )
+        {
+            layoutFragNameAttr = layoutFragNameAttr.toLowerCase();
+            if ( layoutFragNameAttr.indexOf( "noactions" ) != -1 )
+            {
+                layoutActionsDisabled = true;
+            }
+        }
 
         var sizes = null, sizesSum = 0;
         var propertiesMap = {};
@@ -1388,7 +1389,7 @@
                             portletProps[ jetspeed.id.PORTLET_PROP_WINDOW_ICON ] = portletIcon;
                         }
                     }
-                    fragChildren.push( { id: child.getAttribute( "id" ), type: fragType,
name: child.getAttribute( "name" ), properties: portletProps, actions: this._parsePSMLActions(
child, null ), currentActionState: this._parsePSMLCurrentActionState( child ), currentActionMode:
this._parsePSMLCurrentActionMode( child ), decorator: child.getAttribute( "decorator" ), documentOrderIndex:
i } );
+                    fragChildren.push( { id: child.getAttribute( "id" ), type: fragType,
name: child.getAttribute( "name" ), properties: portletProps, actions: this._parsePSMLActions(
child, null ), currentActionState: this._parsePSMLCurrentActionState( child ), currentActionMode:
this._parsePSMLCurrentActionMode( child ), decorator: child.getAttribute( "decorator" ), layoutActionsDisabled:
layoutActionsDisabled, documentOrderIndex: i } );
                 }
             }
             else if ( childLName == "property" )
@@ -1440,7 +1441,7 @@
             sizes.push( "100" );
             sizesSum = 100;
         }
-        return { id: layoutNode.getAttribute( "id" ), type: layoutFragType, name: layoutNode.getAttribute(
"name" ), decorator: layoutNode.getAttribute( "decorator" ), columnSizes: sizes, columnSizesSum:
sizesSum, properties: propertiesMap, fragments: fragChildren, layoutFragmentIndexes: layoutFragIndexes,
otherFragmentIndexes: otherFragIndexes, documentOrderIndex: layoutNodeDocumentOrderIndex };
+        return { id: layoutNode.getAttribute( "id" ), type: layoutFragType, name: layoutNode.getAttribute(
"name" ), decorator: layoutNode.getAttribute( "decorator" ), columnSizes: sizes, columnSizesSum:
sizesSum, properties: propertiesMap, fragments: fragChildren, layoutFragmentIndexes: layoutFragIndexes,
otherFragmentIndexes: otherFragIndexes, layoutActionsDisabled: layoutActionsDisabled, documentOrderIndex:
layoutNodeDocumentOrderIndex };
     },
     _parsePSMLActions: function( fragmentNode, actionsMap )
     {
@@ -1687,7 +1688,7 @@
             
             if ( parentColumn != null && ! omitLayoutHeader )
             {
-                var layoutHeaderColModelObj = new jetspeed.om.Column( 0, layoutFragment.id,
( subOneLast ? layoutFragment.columnSizesSum-0.1 : layoutFragment.columnSizesSum ), this.columns.length
);
+                var layoutHeaderColModelObj = new jetspeed.om.Column( 0, layoutFragment.id,
( subOneLast ? layoutFragment.columnSizesSum-0.1 : layoutFragment.columnSizesSum ), this.columns.length,
layoutFragment.layoutActionsDisabled );
                 layoutHeaderColModelObj.layoutHeader = true;
                 this.columns.push( layoutHeaderColModelObj );
                 if ( parentColumn.columnChildren == null )
@@ -1702,7 +1703,7 @@
                 var size = layoutFragment.columnSizes[i];
                 if ( subOneLast && i == (layoutFragment.columnSizes.length - 1) )
                     size = size - 0.1;
-                var colModelObj = new jetspeed.om.Column( i, layoutFragment.id, size, this.columns.length
);
+                var colModelObj = new jetspeed.om.Column( i, layoutFragment.id, size, this.columns.length,
layoutFragment.layoutActionsDisabled );
                 this.columns.push( colModelObj );
                 if ( parentColumn != null )
                 {
@@ -1795,7 +1796,7 @@
                         var portletPageColumnIndex = pageColumnStartIndex + new Number( portletColumnIndex
);
                         portletPageColumnKey = portletPageColumnIndex.toString();
                     }
-                    var portlet = new jetspeed.om.Portlet( pFrag.name, pFrag.id, null, pFrag.properties,
pFrag.actions, pFrag.currentActionState, pFrag.currentActionMode, pFrag.decorator );
+                    var portlet = new jetspeed.om.Portlet( pFrag.name, pFrag.id, null, pFrag.properties,
pFrag.actions, pFrag.currentActionState, pFrag.currentActionMode, pFrag.decorator, pFrag.layoutActionsDisabled
);
                     portlet.initialize();
 
                     this.putPortlet( portlet ) ;
@@ -2637,12 +2638,14 @@
 });
 
 // ... jetspeed.om.Column
-jetspeed.om.Column = function( layoutColumnIndex, layoutId, size, pageColumnIndex )
+jetspeed.om.Column = function( layoutColumnIndex, layoutId, size, pageColumnIndex, layoutActionsDisabled
)
 {
     this.layoutColumnIndex = layoutColumnIndex;
     this.layoutId = layoutId;
     this.size = size;
     this.pageColumnIndex = new Number( pageColumnIndex );
+    if ( typeof layoutActionsDisabled != "undefined" )
+        this.layoutActionsDisabled = layoutActionsDisabled ;
     this.id = "jscol_" + pageColumnIndex; //  + "_" + this.layoutColumnIndex + "_" + this.layoutId;
     this.domNode = null;
 };
@@ -2653,6 +2656,7 @@
     layoutId: null,
     size: null,
     pageColumnIndex: null,
+    layoutActionsDisabled: false,
     domNode: null,
 
     columnContainer: false,
@@ -2731,7 +2735,7 @@
 });
 
 // ... jetspeed.om.Portlet
-jetspeed.om.Portlet = function( portletName, portletEntityId, alternateContentRetriever,
properties, actions, currentActionState, currentActionMode, decorator )
+jetspeed.om.Portlet = function( portletName, portletEntityId, alternateContentRetriever,
properties, actions, currentActionState, currentActionMode, decorator, layoutActionsDisabled
)
 {   // new jetspeed.om.Portlet( pFrag.name, pFrag.id, alternateContentRetriever, pFrag.properties,
pFrag.decorator, portletPageColumnIndex ) ;
     this.name = portletName;
     this.entityId = portletEntityId;
@@ -2760,6 +2764,10 @@
             this.putProperty( jetspeed.id.PORTLET_PROP_WINDOW_DECORATION, decorator );
         }
     }
+
+    this.layoutActionsDisabled = false ;
+    if ( typeof layoutActionsDisabled != "undefined" )
+        this.layoutActionsDisabled = layoutActionsDisabled ;
 };
 dojo.inherits( jetspeed.om.Portlet, jetspeed.om.Id);
 dojo.lang.extend( jetspeed.om.Portlet,
@@ -3172,12 +3180,12 @@
             if ( windowExtendedProperty != null )
                 queryStringFragment += "&" + jetspeed.id.PORTLET_PROP_DESKTOP_EXTENDED
+ "=" + windowExtendedProperty;
 
-            this._submitJetspeedAjaxApi( action, queryStringFragment, new jetspeed.om.MoveAjaxApiContentListener(
changedState ) );
+            this._submitJetspeedAjaxApi( action, queryStringFragment, new jetspeed.om.MoveAjaxApiContentListener(
this, changedState ) );
 
             if ( ! volatileOnly && ! reset )
             {
                 if ( ! windowPositionStatic && changedStateResult.zIndexChanged )
 // current condition for whether 
-                {                                                                       
 // volatile (zIndex) changes are possible
+                {                                                                  // volatile
(zIndex) changes are possible
                     var portletArrayList = jetspeed.page.getPortletArrayList();
                     var autoUpdatePortlets = dojo.collections.Set.difference( portletArrayList,
[ this ] );
                     if ( ! portletArrayList || ! autoUpdatePortlets || ((autoUpdatePortlets.count
+ 1) != portletArrayList.count) )
@@ -3185,7 +3193,7 @@
                     else if ( autoUpdatePortlets && autoUpdatePortlets.count >
0 )
                     {
                         dojo.lang.forEach( autoUpdatePortlets.toArray(),
-                                function( portlet ) { if ( portlet.getProperty( jetspeed.id.PORTLET_PROP_WINDOW_POSITION_STATIC
) ) portlet.submitChangedWindowState( true ); } );
+                                function( portlet ) { if ( ! portlet.getProperty( jetspeed.id.PORTLET_PROP_WINDOW_POSITION_STATIC
) ) portlet.submitChangedWindowState( true ); } );
                     }
                 }
                 else if ( windowPositionStatic )
@@ -3199,7 +3207,7 @@
     retrieveContent: function( contentListener, bindArgs, suppressGetActions )
     {
         if ( contentListener == null )
-            contentListener = new jetspeed.om.PortletContentListener( suppressGetActions,
bindArgs );
+            contentListener = new jetspeed.om.PortletContentListener( this, suppressGetActions,
bindArgs );
 
         if ( ! bindArgs )
             bindArgs = {};
@@ -3215,13 +3223,59 @@
         if ( portletTitle != null && portletTitle.length > 0 )
         {
             this.putProperty( jetspeed.id.PORTLET_PROP_WINDOW_TITLE, portletTitle );
-            windowWidget.setPortletTitle( portletTitle );
+            if ( windowWidget && ! this.loadingIndicatorIsShown() )
+                windowWidget.setPortletTitle( portletTitle );
         }
         if ( windowWidget )
         {
             windowWidget.setPortletContent( portletContent, renderUrl );
         }
     },
+    loadingIndicatorIsShown: function()
+    {
+        var actionlabel1 = this._getLoadingActionLabel( jetspeed.id.ACTION_NAME_LOAD_RENDER
);
+        var actionlabel2 = this._getLoadingActionLabel( jetspeed.id.ACTION_NAME_LOAD_ACTION
);
+        var actionlabel3 = this._getLoadingActionLabel( jetspeed.id.ACTION_NAME_LOAD_UPDATE
);
+        var windowWidget = this.getPortletWindow();
+        if ( windowWidget && ( actionlabel1 || actionlabel2 ) )
+        {
+            var windowTitle = windowWidget.getPortletTitle();
+            if ( windowTitle && ( windowTitle == actionlabel1 || windowTitle == actionlabel2
) )
+                return true;
+        }
+        return false;
+    },
+    _getLoadingActionLabel: function( actionName )
+    {
+        var actionlabel = null;
+        if ( jetspeed.prefs != null && jetspeed.prefs.desktopActionLabels != null
)
+        {
+            actionlabel = jetspeed.prefs.desktopActionLabels[ actionName ];
+            if ( actionlabel != null && actionlabel.length == 0 )
+                actionlabel = null;
+        }
+        return actionlabel;
+    },  
+    loadingIndicatorShow: function( actionName )
+    {
+        if ( actionName && ! this.loadingIndicatorIsShown() )
+        {
+            var actionlabel = this._getLoadingActionLabel( actionName );
+            var windowWidget = this.getPortletWindow();
+            if ( windowWidget && actionlabel )
+            {
+                windowWidget.setPortletTitle( actionlabel );
+            }
+        }
+    },
+    loadingIndicatorHide: function()
+    {
+        var windowWidget = this.getPortletWindow();
+        if ( windowWidget )
+        {
+            windowWidget.setPortletTitle( this.getProperty( jetspeed.id.PORTLET_PROP_WINDOW_TITLE
) );
+        }
+    },
 
     getId: function()  // jetspeed.om.Id protocol
     {
@@ -3515,17 +3569,27 @@
 };
 
 // ... jetspeed.om.PortletContentListener
-jetspeed.om.PortletContentListener = function( suppressGetActions, bindArgs )
+jetspeed.om.PortletContentListener = function( /* Portlet */ portlet, suppressGetActions,
bindArgs )
 {
+    this.portlet = portlet;
     this.suppressGetActions = suppressGetActions;
     this.submittedFormBindObject = null;
     if ( bindArgs != null && bindArgs.submitFormBindObject != null )
     {
         this.submittedFormBindObject = bindArgs.submitFormBindObject;
     }
+    this._setPortletLoading( true );
 };
 jetspeed.om.PortletContentListener.prototype =
 {
+    _setPortletLoading: function( /* boolean */ showLoading )
+    {
+        if ( this.portlet == null ) return;
+        if ( showLoading )
+            this.portlet.loadingIndicatorShow( jetspeed.id.ACTION_NAME_LOAD_RENDER );
+        else
+            this.portlet.loadingIndicatorHide();
+    },
     notifySuccess: function( /* String */ portletContent, /* String */ requestUrl, /* Portlet
*/ portlet, http )
     {
         var portletTitle = null;
@@ -3538,6 +3602,8 @@
         portlet.setPortletContent( portletContent, requestUrl, portletTitle );
         if ( this.suppressGetActions == null || this.suppressGetActions == false )
             jetspeed.getActionsForPortlet( portlet.getId() );
+        else
+            this._setPortletLoading( false );
         if ( this.submittedFormBindObject != null )
         {
             this.submittedFormBindObject.isFormSubmitInProgress( false );
@@ -3545,6 +3611,7 @@
     },
     notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl,
/* Portlet */ portlet )
     {
+        this._setPortletLoading( false );
         if ( this.submittedFormBindObject != null )
         {
             this.submittedFormBindObject.isFormSubmitInProgress( false );
@@ -3554,16 +3621,26 @@
 };
 
 // ... jetspeed.om.PortletActionContentListener
-jetspeed.om.PortletActionContentListener = function( bindArgs )
+jetspeed.om.PortletActionContentListener = function( /* Portlet */ portlet, bindArgs )
 {
+    this.portlet = portlet;
     this.submittedFormBindObject = null;
     if ( bindArgs != null && bindArgs.submitFormBindObject != null )
     {
         this.submittedFormBindObject = bindArgs.submitFormBindObject;
     }
+    this._setPortletLoading( true );
 };
 jetspeed.om.PortletActionContentListener.prototype =
 {
+    _setPortletLoading: function( /* boolean */ showLoading )
+    {
+        if ( this.portlet == null ) return;
+        if ( showLoading )
+            this.portlet.loadingIndicatorShow( jetspeed.id.ACTION_NAME_LOAD_ACTION );
+        else
+            this.portlet.loadingIndicatorHide();
+    },
     notifySuccess: function( /* String */ portletContent, /* String */ requestUrl, /* Portlet
*/ portlet, http )
     {
         var renderUrl = null;
@@ -3591,12 +3668,14 @@
                     }
                     else
                     {
+                        this._setPortletLoading( false );
                         dojo.raise( "PortletActionContentListener cannot interpret action
response: " + portletContent );
                     }
                     renderUrl = null;
                 }
                 else if ( portletUrlPos > 0 )
                 {
+                    this._setPortletLoading( false );
                     dojo.raise( "PortletActionContentListener cannot interpret portlet url
in action response: " + portletContent );
                     renderUrl = null;
                 }
@@ -3609,6 +3688,10 @@
             jetspeed.doRenderAll( renderUrl );    // render all portlets
             //  portlet.retrieveContent(null, { url: renderUrl } );    // render just the
one portlet
         }
+        else
+        {
+            this._setPortletLoading( false );
+        }
         if ( this.submittedFormBindObject != null )
         {
             this.submittedFormBindObject.isFormSubmitInProgress( false );
@@ -3616,6 +3699,7 @@
     },
     notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl,
/* Portlet */ portlet )
     {
+        this._setPortletLoading( false );
         if ( this.submittedFormBindObject != null )
         {
             this.submittedFormBindObject.isFormSubmitInProgress( false );
@@ -3919,18 +4003,31 @@
 jetspeed.om.PortletChangeActionContentListener = function( /* String */ portletEntityId )
 {
     this.portletEntityId = portletEntityId;
+    this._setPortletLoading( true );
 };
 dojo.lang.extend( jetspeed.om.PortletChangeActionContentListener,
 {
     notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, domainModelObject
)
     {
         if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "portlet-change-action"
) )
-        {
             jetspeed.getActionsForPortlet( this.portletEntityId );
+        else
+            this._setPortletLoading( false );
+    },
+    _setPortletLoading: function( /* boolean */ showLoading )
+    {
+        var portlet = jetspeed.page.getPortlet( this.portletEntityId ) ;
+        if ( portlet )
+        {
+            if ( showLoading )
+                portlet.loadingIndicatorShow( jetspeed.id.ACTION_NAME_LOAD_UPDATE );
+            else
+                portlet.loadingIndicatorHide();
         }
     },
     notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl,
domainModelObject )
     {
+        this._setPortletLoading( false );
         dojo.raise( "PortletChangeActionContentListener error [" + domainModelObject.toString()
+ "] url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
     }
 });
@@ -3957,13 +4054,31 @@
 });
 
 // ... jetspeed.om.PortletActionsContentListener
-jetspeed.om.PortletActionsContentListener = function()
+jetspeed.om.PortletActionsContentListener = function( /* String[] */ portletEntityIds )
 {
+    this.portletEntityIds = portletEntityIds;
+    this._setPortletLoading( true );
 };
 dojo.lang.extend( jetspeed.om.PortletActionsContentListener,
 {
+    _setPortletLoading: function( /* boolean */ showLoading )
+    {
+        if ( this.portletEntityIds == null || this.portletEntityIds.length == 0 ) return
;
+        for ( var i = 0 ; i < this.portletEntityIds.length ; i++ )
+        {
+            var portlet = jetspeed.page.getPortlet( this.portletEntityIds[i] ) ;
+            if ( portlet )
+            {
+                if ( showLoading )
+                    portlet.loadingIndicatorShow( jetspeed.id.ACTION_NAME_LOAD_UPDATE );
+                else
+                    portlet.loadingIndicatorHide();
+            }
+        }
+    },
     notifySuccess: function( /* XMLDocument */ data, /* String */ requestUrl, domainModelObject
)
     {
+        this._setPortletLoading( false );
         if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "portlet-actions"
) )
         {
             this.processPortletActionsResponse( data );
@@ -4033,6 +4148,7 @@
     },
     notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl,
domainModelObject )
     {
+        this._setPortletLoading( false );
         dojo.raise( "PortletActionsContentListener error [" + domainModelObject.toString()
+ "] url: " + requestUrl + " type: " + type + jetspeed.url.formatBindError( error ) );
     }
 });
@@ -4383,14 +4499,25 @@
 
 
 // ... jetspeed.om.MoveAjaxApiContentListener
-jetspeed.om.MoveAjaxApiContentListener = function( changedState )
+jetspeed.om.MoveAjaxApiContentListener = function( /* Portlet */ portlet, changedState )
 {
+    this.portlet = portlet;
     this.changedState = changedState;
+    this._setPortletLoading( true );
 };
 jetspeed.om.MoveAjaxApiContentListener.prototype =
 {
+    _setPortletLoading: function( /* boolean */ showLoading )
+    {
+        if ( this.portlet == null ) return;
+        if ( showLoading )
+            this.portlet.loadingIndicatorShow( jetspeed.id.ACTION_NAME_LOAD_UPDATE );
+        else
+            this.portlet.loadingIndicatorHide();
+    },
     notifySuccess: function( /* String */ data, /* String */ requestUrl, domainModelObject
)
     {
+        this._setPortletLoading( false );
         dojo.lang.mixin( domainModelObject.portlet.lastSavedWindowState, this.changedState
);
         var reportError = false;
         if ( djConfig.isDebug && jetspeed.debug.submitChangedWindowState )
@@ -4399,6 +4526,7 @@
     },
     notifyFailure: function( /* String */ type, /* Object */ error, /* String */ requestUrl,
domainModelObject )
     {
+        this._setPortletLoading( false );
         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=545063&r1=545062&r2=545063
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js (original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js Wed Jun
 6 21:51:15 2007
@@ -712,26 +712,6 @@
         }
         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 );
@@ -849,33 +829,31 @@
         }
         else if ( actionName == jetspeed.id.ACTION_NAME_MENU )
         {
-            if ( this.windowState != jetspeed.id.ACTION_NAME_MAXIMIZE || this.windowActionMenuIsEmpty()
)
+            if ( ! this._windowActionMenuIsEmpty() )
                 enabled = true;
         }
         else if ( jetspeed.prefs.windowActionDesktop[ actionName ] != null )
         {
-            if ( this.windowState != jetspeed.id.ACTION_NAME_MAXIMIZE )
+            var layoutActionsEnabled = this.getLayoutActionsEnabled();
+            if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_EXPAND )
             {
-                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;
-                }
+                if ( ! this.windowHeightToFit && layoutActionsEnabled )
+                    enabled = true;
+            }
+            else if ( actionName == jetspeed.id.ACTION_NAME_DESKTOP_HEIGHT_NORMAL )
+            {
+                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;
             }
         }
         else if ( this.portlet )
@@ -930,6 +908,27 @@
         }
         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 ) )
+            {
+                actionMenuIsEmpty = false;
+                break;
+            }
+        }
+        return actionMenuIsEmpty ;
+    },
 
     windowActionButtonSync: function()
     {
@@ -1003,10 +1002,7 @@
             this.drag = new jetspeed.widget.PortletWindowDragMoveSource( this );
             if ( this.constrainToContainer )
                 this.drag.constrainTo();
-            if ( ! this.portlet || ! jetspeed.page.layoutActionsDisabled )
-                this.setTitleBarDragging( true );
-            else
-                this.setTitleBarDragging( false );
+            this.setTitleBarDragging();
         }
         
         this.domNode.id = this.widgetId;  // BOZO: must set the id here - it gets defensively
cleared by dojo
@@ -1080,6 +1076,7 @@
     {
         if ( this.windowState == jetspeed.id.ACTION_NAME_MAXIMIZE )
         {
+            this.showAllPortletWindows() ;
             this.restoreWindow( evt );
         }
         this._setLastPositionInfo();
@@ -1090,8 +1087,41 @@
     
         this.windowState = jetspeed.id.ACTION_NAME_MINIMIZE;
     },
+    showAllPortletWindows: function()
+    {
+        var allPWwidgets = dojo.widget.manager.getWidgetsByType( this.getNamespacedType()
) ;
+        for ( var i = 0 ; i < allPWwidgets.length ; i++ )
+        {
+            var showPWwidget = allPWwidgets[i] ;
+            if ( showPWwidget )
+            {
+                showPWwidget.domNode.style.display = "";
+            }
+        }
+    },
+    hideAllPortletWindows: function( excludeWidgetIds )
+    {
+        var allPWwidgets = dojo.widget.manager.getWidgetsByType( this.getNamespacedType()
) ;
+        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 ;
+                }
+            }
+            if ( hidePWwidget )
+            {
+                hidePWwidget.domNode.style.display = "none";
+            }
+        }
+    },
     maximizeWindow: function( evt )
     {
+        this.hideAllPortletWindows( [ this.widgetId ] ) ;
         if ( this.windowState == jetspeed.id.ACTION_NAME_MINIMIZE )
         {
             this.restoreWindow( evt );
@@ -1143,12 +1173,10 @@
         var lastPositionInfo = null;
         if ( this.windowState == jetspeed.id.ACTION_NAME_MAXIMIZE )
         {
+            this.showAllPortletWindows() ;
             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 = "";
 
@@ -1194,6 +1222,8 @@
         this._adjustPositionToDesktopState();
 
 		this.windowState = jetspeed.id.ACTION_NAME_RESTORE;  // "normal"
+
+        this.setTitleBarDragging();
 	},
     getLastPositionInfo: function()
     {
@@ -1260,8 +1290,16 @@
         }
     },
 
+    getLayoutActionsEnabled: function()
+    {
+        return ( this.windowState != jetspeed.id.ACTION_NAME_MAXIMIZE && ( ! this.portlet
|| ! this.portlet.layoutActionsDisabled ) );
+    },
     setTitleBarDragging: function( enableDrag )
     {
+        if ( typeof enableDrag == "undefined" )
+        {
+            enableDrag = this.getLayoutActionsEnabled();
+        }
         if ( enableDrag )
         {
             if ( this.normalTitleBarCursor != null )
@@ -1336,6 +1374,9 @@
         var addToElmt = document.getElementById( jetspeed.id.DESKTOP );
         addToElmt.appendChild( this.domNode );
 
+        if ( this.windowState == jetspeed.id.ACTION_NAME_MINIMIZE )
+            this.minimizeWindow();
+
         if ( this.portlet )
             this.portlet.submitChangedWindowState();
     },
@@ -1847,6 +1888,10 @@
             this.titleBarText.innerHTML = this.title;
         }
     },
+    getPortletTitle: function()
+    {
+        return this.title;
+    },
 
     _splitAndFixPaths_scriptsonly: function( /* String */ s, /* String */ url )
     {
@@ -1995,7 +2040,9 @@
 dojo.declare( "jetspeed.widget.PortletWindowDragMoveObject", dojo.dnd.HtmlDragMoveObject,
{
     qualifyTargetColumn: function( /* jetspeed.om.Column */ column )
     {
-        return true;
+        if ( column != null && ! column.layoutActionsDisabled )
+            return true;
+        return false;
     },
     onDragStart: function( e )
     {



---------------------------------------------------------------------
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