rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfrank...@apache.org
Subject svn commit: r1145678 - in /incubator/rave/trunk/rave-portal/src/main/webapp/script: rave.js rave_api.js
Date Tue, 12 Jul 2011 17:08:37 GMT
Author: mfranklin
Date: Tue Jul 12 17:08:37 2011
New Revision: 1145678

URL: http://svn.apache.org/viewvc?rev=1145678&view=rev
Log:
Removed widget-region mapping on client side.  Cleaned up delete operation (Fixes RAVE-58)

Modified:
    incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js
    incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_api.js

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js?rev=1145678&r1=1145677&r2=1145678&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js Tue Jul 12 17:08:37 2011
@@ -19,10 +19,6 @@
 var rave = rave || (function() {
     var providerList = [];
     var context = "";
-    
-    // map widget id to region id
-    var widgetRegionMap = {};
-
 
     /**
      * Separate sub-namespace for isolating UI functions and state management
@@ -115,14 +111,16 @@ var rave = rave || (function() {
 				alert("Maximize button not yet implemented");
 		  }
 		  function deleteAction(button,args) {
-				rave.api.rpc.removeWidget({
-					 regionWidgetId: args.myRegionWidgetId,
-					 successCallback: function() {
-						  $("#widget-wrapper-"+args.myRegionWidgetId).remove();
-					 }
-				});
-		  }
-		  return {
+              if (confirm("Are you sure you want to remove this gadget from your page"))
{
+                  rave.api.rpc.removeWidget({
+                      regionWidgetId: args.myRegionWidgetId,
+                      successCallback: function() {
+                          $("#widget-wrapper-" + args.myRegionWidgetId).remove();
+                      }
+                  });
+              }
+          }
+         return {
 				maximizeAction : maximizeAction,
 				deleteAction : deleteAction
 		  }
@@ -195,34 +193,12 @@ var rave = rave || (function() {
             regionElement.children("div[id^='widget-wrapper-']").each(function(wrapperIndex)
{
                 var widgetElement = $(this);
                 var widgetId = widgetElement.attr("id").substr("widget-wrapper-".length);
-                mapGadgetToRegion(widgetId, regionId);
                 styleGadgetButtons(widgetId);
             });
         });
     }
 
     /**
-	  * Map a widget to the region where it is located.
-	  * 
-	  * @param widgetId: id of the widget (not DOM id)
-	  * @param regionId: if it is non null, it is mapped. It it is null or not present, delete
the map entry.
-	  */
-	 function mapGadgetToRegion(widgetId, regionId) {
-	     delete widgetRegionMap[widgetId];
-	     if (arguments.length > 1 && regionId != null) {
-	         widgetRegionMap[widgetId] = regionId;
-		  }
-	 }
-	 
-	 /**
-      * Get the region where a widget/gadget belongs to.
-      * @param widgetId: id of the widget. (not DOM id)
-      */
-	 function getGadgetRegion(widgetId) {
-         return widgetRegionMap[widgetId];
-     }
-
-    /**
      * Applies styling to the several buttons in the widget / gadget toolbar
      * @param widgetId identifier of the widget / gadget
      */
@@ -305,17 +281,6 @@ var rave = rave || (function() {
 
         initGadgetUI : initGadgetUI,
 
-
-    	/**
-    	 * Change or delete gadget to region map entry.
-    	 */
-    	mapGadgetToRegion : mapGadgetToRegion,
-    	
-    	/**
-    	 * Get the region where a widget/gadget belongs to.
-    	 */
-    	  getGadgetRegion : getGadgetRegion,
-
 		  /**
 			* These are exposed toolbar actions, associated with widget toolbar buttons
 			*/

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_api.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_api.js?rev=1145678&r1=1145677&r2=1145678&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_api.js (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_api.js Tue Jul 12 17:08:37
2011
@@ -41,8 +41,6 @@ rave.api = rave.api || (function() {
                 function(result) {
                     if (result.error) {
                         handleRpcError(result);
-                    } else {
-                        rave.mapGadgetToRegion(widgetObjectId, toRegionObjectId);
                     }
                 }
             ).error(handleError);



Mime
View raw message