You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by et...@apache.org on 2008/02/02 01:40:29 UTC

svn commit: r617722 - in /incubator/shindig/trunk/features/views: feature.xml views.js

Author: etnu
Date: Fri Feb  1 16:40:25 2008
New Revision: 617722

URL: http://svn.apache.org/viewvc?rev=617722&view=rev
Log:
Added support for requestNavigateTo to views, using ifpc. IFPC support will be replaced with rpc when rpc is implemented.


Modified:
    incubator/shindig/trunk/features/views/feature.xml
    incubator/shindig/trunk/features/views/views.js

Modified: incubator/shindig/trunk/features/views/feature.xml
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/views/feature.xml?rev=617722&r1=617721&r2=617722&view=diff
==============================================================================
--- incubator/shindig/trunk/features/views/feature.xml (original)
+++ incubator/shindig/trunk/features/views/feature.xml Fri Feb  1 16:40:25 2008
@@ -18,12 +18,20 @@
 -->
 <feature>
   <name>views</name>
-  <!-- <dependency>ifpc</dependency> -->
+  <!-- TODO: Use rpc when it becomes available -->
+  <dependency>ifpc</dependency>
   <gadget>
     <script src="views.js"/>
     <!-- TODO: Clean this up and unify the configuration model -->
-    <script>
-      gadgets.views.init({"default" : false});
+    <script><![CDATA[
+      gadgets.views.init({
+        // Some standard views. Feel free to change these to use whatever
+        // views your container supports.
+        "default" : false,
+        "profile" : false,
+        "canvas" : true
+      });
+    ]]>
     </script>
   </gadget>
 </feature>

Modified: incubator/shindig/trunk/features/views/views.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/views/views.js?rev=617722&r1=617721&r2=617722&view=diff
==============================================================================
--- incubator/shindig/trunk/features/views/views.js (original)
+++ incubator/shindig/trunk/features/views/views.js Fri Feb  1 16:40:25 2008
@@ -48,6 +48,14 @@
     requestNavigateTo : function(view, opt_params) {
       // TODO: Actually implementing this is going to require gadgets.rpc or
       // ifpc or something.
+      var prefs = new gadgets.Prefs();
+      var ifpcRelay = gadgets.util.getUrlParameters().parent || '';
+      gadgets.ifpc_.call("remote_iframe_" + prefs.getModuleId(),
+                         "requestNavigateTo",
+                         [view.getName(), opt_params],
+                         ifpcRelay,
+                         null,
+                         '');
     },
 
     getCurrentView : function() {
@@ -80,10 +88,11 @@
       }
 
       var urlParams = gadgets.util.getUrlParameters();
-      // extract all parameters prefixed with "view-".
-      for (var p in urlParams) if (urlParams.hasOwnProperty(p)) {
-        if (p.substring(0, 5) === "view-") {
-          params[p.substr(5)] = urlParams[p];
+      // View parameters are passed as a single parameter.
+      if (urlParams["view-params"]) {
+        var tmpParams = gadgets.json.parse(urlParams["view-params"]);
+        if (tmpParams) {
+          params = tmpParams;
         }
       }
       currentView = supportedViews[urlParams.view] || supportedViews["default"];