portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smi...@apache.org
Subject svn commit: r472356 - /portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js
Date Wed, 08 Nov 2006 01:09:55 GMT
Author: smilek
Date: Tue Nov  7 17:09:55 2006
New Revision: 472356

URL: http://svn.apache.org/viewvc?view=rev&rev=472356
Log:
added psmlUrl override to jetspeed.addNewPortletDefinition

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

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=472356&r1=472355&r2=472356
==============================================================================
--- portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js (original)
+++ portals/jetspeed-2/trunk/src/webapp/javascript/jetspeed/desktop/core.js Tue Nov  7 17:09:55
2006
@@ -480,11 +480,18 @@
     jetspeed.url.retrieveContent( { url: getPortletsUrl, mimetype: mimetype }, contentListener,
ajaxApiContext, jetspeed.debugContentDumpIds );
 };
 
-jetspeed.addNewPortletDefinition = function( /* jetspeed.om.PortletDef */ portletDef, windowWidgetId
)
+jetspeed.addNewPortletDefinition = function( /* jetspeed.om.PortletDef */ portletDef, windowWidgetId,
/* String */ psmlUrl )
 {
-    var contentListener = new jetspeed.om.PortletAddAjaxApiCallbackContentListener( portletDef,
windowWidgetId );
+    var addToCurrentPage = true;
+    if ( psmlUrl != null )
+        addToCurrentPage = false;
+    var contentListener = new jetspeed.om.PortletAddAjaxApiCallbackContentListener( portletDef,
windowWidgetId, addToCurrentPage );
     var queryString = "?action=add&id=" + escape( portletDef.getPortletName() );
-    var addPortletUrl = jetspeed.page.getPsmlUrl() + queryString;   //  http://localhost:8080/jetspeed/ajaxapi/google-maps.psml
+    var addPortletUrl = null;
+    if ( psmlUrl != null )
+        addPortletUrl = psmlUrl + queryString;   //  psmlUrl example: http://localhost:8080/jetspeed/ajaxapi/google-maps.psml
+    else
+        addPortletUrl = jetspeed.page.getPsmlUrl() + queryString;
     var mimetype = "text/xml";
     var ajaxApiContext = new jetspeed.om.Id( "addportlet", { } );
     jetspeed.url.retrieveContent( { url: addPortletUrl, mimetype: mimetype }, contentListener,
ajaxApiContext, jetspeed.debugContentDumpIds );
@@ -1771,7 +1778,7 @@
     },
     removePortletFromPage: function( /* Portlet */ portlet )
     {
-        var contentListener = new jetspeed.om.PortletAddAjaxApiCallbackContentListener( portletDef,
windowWidgetId );
+        var contentListener = new jetspeed.om.PortletAddAjaxApiCallbackContentListener( portletDef,
windowWidgetId, false );
         var queryString = "?action=remove&id=" + escape( portletDef.getPortletName()
);
         var addPortletUrl = jetspeed.page.getPsmlUrl() + queryString;
         var mimetype = "text/xml";
@@ -3086,10 +3093,11 @@
 
 
 // ... jetspeed.om.PortletAddAjaxApiCallbackContentListener
-jetspeed.om.PortletAddAjaxApiCallbackContentListener = function(  /* jetspeed.om.PortletDef
*/ portletDef, windowWidgetId )
+jetspeed.om.PortletAddAjaxApiCallbackContentListener = function(  /* jetspeed.om.PortletDef
*/ portletDef, windowWidgetId, addToCurrentPage )
 {
     this.portletDef = portletDef;
     this.windowWidgetId = windowWidgetId;
+    this.addToCurrentPage = addToCurrentPage;
 };
 dojo.lang.extend( jetspeed.om.PortletAddAjaxApiCallbackContentListener,
 {
@@ -3098,8 +3106,10 @@
         if ( jetspeed.url.checkAjaxApiResponse( requestUrl, data, true, "add-portlet" ) )
         {
             var entityId = this.parseAddPortletResponse( data );
-            if ( entityId )
+            if ( entityId && this.addToCurrentPage )
+            {
                 jetspeed.page.addNewPortlet( this.portletDef.getPortletName(), entityId,
this.windowWidgetId );
+            }
         }
     },
     parseAddPortletResponse: function( /* XMLNode */ node )



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