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 2006/12/09 06:07:11 UTC

svn commit: r484919 - /portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js

Author: smilek
Date: Fri Dec  8 21:07:10 2006
New Revision: 484919

URL: http://svn.apache.org/viewvc?view=rev&rev=484919
Log:
PortletWindowDragMoveObject.onDragStart changed to incorporate code from HtmlDragMoveObject.onDragStart due to aggressive changes in dojo 0.4.1; PortletWindow.setPortletContent now avoids calling ContentPane._executeScripts when script array is empty (due to IE choke job); support remove-portlet in page editor via PortletWindow close box

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

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=484919&r1=484918&r2=484919
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js (original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/widget/PortletWindow.js Fri Dec  8 21:07:10 2006
@@ -320,7 +320,7 @@
     // dojo.widget.Widget create protocol
     postMixInProperties: function( args, fragment, parentComp )
     {
-        jetspeed.widget.PortletWindow.superclass.postMixInProperties.call( this );
+        jetspeed.widget.PortletWindow.superclass.postMixInProperties.apply( this, arguments );
 
         this.portletIndex = this._getNextIndex();
 
@@ -784,9 +784,21 @@
                 this.windowActionButtonSync();
             }
         }
+        else if ( actionName == jetspeed.id.ACTION_NAME_REMOVEPORTLET )
+        {
+            if ( this.portlet )
+            {
+                var pageEditorWidget = dojo.widget.byId( jetspeed.id.PAGE_EDITOR_WIDGET_ID );
+                if ( pageEditorWidget != null )
+                {
+                    pageEditorWidget.deletePortlet( this.portlet.entityId, this.title );
+                }
+            }
+        }
         else
         {
-            this.portlet.renderAction( actionName );
+            if ( this.portlet )
+                this.portlet.renderAction( actionName );
         }
     },
 
@@ -825,7 +837,12 @@
             var actionDef = this.portlet.getAction( actionName );
             if ( actionDef != null )
             {
-                if ( actionDef.type == jetspeed.id.PORTLET_ACTION_TYPE_MODE )
+                if ( actionDef.id == jetspeed.id.ACTION_NAME_REMOVEPORTLET )
+                {
+                    if ( jetspeed.page.editMode )
+                        enabled = true;
+                }
+                else if ( actionDef.type == jetspeed.id.PORTLET_ACTION_TYPE_MODE )
                 {
                     if ( actionName != currentPortletActionMode )
                     {
@@ -1650,10 +1667,11 @@
         */
 
         var setContentObj = this._splitAndFixPaths_scriptsonly( initialHtmlStr, url );
-        
         this.setContent( setContentObj );
-        this._executeScripts( setContentObj.scripts );
-
+        if ( setContentObj.scripts != null && setContentObj.scripts.length != null && setContentObj.scripts.length > 0 )
+        {
+            this._executeScripts( setContentObj.scripts );
+        }
         if ( jetspeed.debug.setPortletContent )
             dojo.debug( "setPortletContent [" + ( this.portlet ? this.portlet.entityId : this.widgetId ) + "]" );
 
@@ -1835,7 +1853,31 @@
         this.initialStyleWidth = portletWindowNode.style.width;
         this.initialOffsetWidth = portletWindowNode.offsetWidth;
 
-        jetspeed.widget.PortletWindowDragMoveObject.superclass.onDragStart.call( this, e );
+        /* start HtmlDragMoveObject.onDragStart from dojo-0.4.0 - copied due to agressive changes in dojo-0.4.1 */
+        /* used to call superclass.onDragStart: */
+        /* jetspeed.widget.PortletWindowDragMoveObject.superclass.onDragStart.call( this, e ); */
+
+        dojo.html.clearSelection();
+
+		this.dragClone = this.domNode;
+
+		this.scrollOffset = dojo.html.getScroll().offset;
+		this.dragStartPosition = dojo.html.abs(this.domNode, true);
+		
+		this.dragOffset = {y: this.dragStartPosition.y - e.pageY,
+			x: this.dragStartPosition.x - e.pageX};
+
+		this.containingBlockPosition = this.domNode.offsetParent ? 
+			dojo.html.abs(this.domNode.offsetParent, true) : {x:0, y:0};
+
+		this.dragClone.style.position = "absolute";
+
+		if (this.constrainToContainer) {
+			this.constraints = this.getConstraints();
+		}
+
+        /* end HtmlDragMoveObject.onDragStart from dojo-0.4.0 */
+
 
         // ghost placement - must happen after superclass.onDragStart
         var pwGhost = jetspeed.widget.pwGhost;
@@ -1856,7 +1898,7 @@
             for ( var i = 0 ; i < jetspeed.page.columns.length ; i++ )
             {
                 var col = jetspeed.page.columns[i];
-                if ( ! col.columnContainer )
+                if ( ! col.columnContainer && ! col.layoutHeader )
                 {
                     var colAbsPos = dojo.html.getAbsolutePosition( col.domNode, true );
                     var marginBox = dojo.html.getMarginBox( col.domNode );



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