You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wookie.apache.org by ps...@apache.org on 2011/11/11 14:59:57 UTC

svn commit: r1200887 - /incubator/wookie/trunk/scratchpad/widgets/warp/scripts/controller.js

Author: psharples
Date: Fri Nov 11 13:59:57 2011
New Revision: 1200887

URL: http://svn.apache.org/viewvc?rev=1200887&view=rev
Log:
Removed /wookie references. See WOOKIE-289. Additionally the widget was not working due to updates in the server side controller. The xml datatype needed to be specified differently in jquery, as the warpcontroller mechanism has changed slightly

Modified:
    incubator/wookie/trunk/scratchpad/widgets/warp/scripts/controller.js

Modified: incubator/wookie/trunk/scratchpad/widgets/warp/scripts/controller.js
URL: http://svn.apache.org/viewvc/incubator/wookie/trunk/scratchpad/widgets/warp/scripts/controller.js?rev=1200887&r1=1200886&r2=1200887&view=diff
==============================================================================
--- incubator/wookie/trunk/scratchpad/widgets/warp/scripts/controller.js (original)
+++ incubator/wookie/trunk/scratchpad/widgets/warp/scripts/controller.js Fri Nov 11 13:59:57 2011
@@ -21,12 +21,16 @@
  */ 
 var Controller = {
 
-	init:function() {
+	contextPath: 'wookie',
+	
+	init:function() {
+		var pathArray = window.location.pathname.split( '/' );
+		this.contextPath = pathArray[1];		
         Controller.update();
 	},
 
 	update:function() {
-        $.get("/wookie/warp?format=xml", Controller.parseTopLevel);
+		$.ajax({ type: 'GET', url: '/' + this.contextPath+'/warp', dataType: 'xml', success: Controller.parseTopLevel});	
 	},
     
     // Parse the complete policy list for all Widgets
@@ -82,7 +86,7 @@ var Controller = {
         Controller.widget = widget;
         $(".widget-title").text(widget.title);
         $.mobile.changePage("#widget");
-        $.get("/wookie/warp?format=xml&widgetId="+widget.id, Controller.parseWidgetLevel);
+		$.ajax({ type: 'GET', url: '/' + this.contextPath+'/warp?widgetId='+widget.id, dataType: 'xml', success: Controller.parseWidgetLevel});
     },
     
     // Refresh the list view of policies for the current Widget
@@ -155,10 +159,10 @@ var Controller = {
     put: function(state){
         $.ajax({
           type: "PUT",
-          url: '/wookie/warp/'+Controller.policy_id+'?granted='+state,
+          url: '/' + this.contextPath + '/warp/' + Controller.policy_id + '?granted=' + state,
           datatype:'json',
           success: function(msg) {
-            $.get("/wookie/warp?format=xml&widgetId="+Controller.widget.id, Controller.parseWidgetLevel);
+        	  $.ajax({ type: 'GET', url: '/' + this.contextPath + '/warp?widgetId='+Controller.widget.id, dataType: 'xml', success: Controller.parseWidgetLevel});
           }
         });
     }