Author: zhen
Date: Thu Jan 10 18:28:57 2008
New Revision: 611022

URL: http://svn.apache.org/viewvc?rev=611022&view=rev
Log:
Added support for the "setprefs" feature.
Added a "setprefs" sample page.
Removed the link to a remote ifpc.js file from 
javascript/container/ifpc_relay.html.


Added:
    incubator/shindig/trunk/javascript/container/sample5.html   (with props)
Modified:
    incubator/shindig/trunk/features/setprefs/setprefs.js
    incubator/shindig/trunk/javascript/container/ifpc_relay.html

Modified: incubator/shindig/trunk/features/setprefs/setprefs.js
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/setprefs/setprefs.js?rev=611022&r1=611021&r2=611022&view=diff
==============================================================================
--- incubator/shindig/trunk/features/setprefs/setprefs.js (original)
+++ incubator/shindig/trunk/features/setprefs/setprefs.js Thu Jan 10 18:28:57 
2008
@@ -40,7 +40,14 @@
   } else {
     gadgets.PrefStore_.setPref(this.moduleId_, key, value);
   }
-  // TODO: Update user pref store somehow.
+
+  var modId = 'remote_module_' + this.getModuleId();
+  var params = gadgets.util.getUrlParameters();
+  var ifpcRelay = (params.parent || '') + '/ig/ifpc_relay';
+  var ifpcArgs = Array.prototype.slice.call(arguments);
+  ifpcArgs.unshift(''); // security token placeholder
+  ifpcArgs.unshift(modId);
+  gadgets.IFPC_.call(modId, 'set_pref', ifpcArgs, ifpcRelay, null, '');
 };
 
 /**
@@ -58,8 +65,6 @@
   for (var i = 0, j = val.length; i < j; ++i) {
     val[i] = val[i].replace(/\|/g, "%7C");
   }
-  gadgets.PrefStore_.setPref(this.moduleId_, key, val.join("|"));
-
-  // TODO: Update user pref store somehow. Where do we hook into the container?
+  this.set(key, val.join('|'));
 };
 

Modified: incubator/shindig/trunk/javascript/container/ifpc_relay.html
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/ifpc_relay.html?rev=611022&r1=611021&r2=611022&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/container/ifpc_relay.html (original)
+++ incubator/shindig/trunk/javascript/container/ifpc_relay.html Thu Jan 10 
18:28:57 2008
@@ -1 +1 @@
-<html><head><script 
src='http://www.google.com/ig/ifpc.js'></script><script>var 
l=window.location+'';_IFPC.processRequest(l.substring(l.indexOf('#')+1));if(!window.ActiveXObject){window.location='about:blank';}</script></head></html>
+<html><head><script src='json.js'></script><script 
src='ifpc.js'></script><script>var 
l=window.location+'';_IFPC.processRequest(l.substring(l.indexOf('#')+1));if(!window.ActiveXObject){window.location='about:blank';}</script></head></html>

Added: incubator/shindig/trunk/javascript/container/sample5.html
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/sample5.html?rev=611022&view=auto
==============================================================================
--- incubator/shindig/trunk/javascript/container/sample5.html (added)
+++ incubator/shindig/trunk/javascript/container/sample5.html Thu Jan 10 
18:28:57 2008
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Sample: set-pref support</title>
+<!-- default container look and feel -->
+<link rel="stylesheet" href="gadgets.css">
+<script type="text/javascript" src="json.js"></script>
+<script type="text/javascript" src="ifpc.js"></script>
+<script type="text/javascript" src="cookies.js"></script>
+<script type="text/javascript" src="gadgets.js"></script>
+<script type="text/javascript">
+var specUrl0 = 
'http://www.google.com/ig/modules/test_setprefs_multiple_ifpc.xml';
+
+function init() {
+  gadgets.container.layoutManager =
+      new gadgets.FloatLeftLayoutManager('gadget-parent');
+
+  gadgets.container.setParentUrl('ifpc_relay.html');
+  var gadget = gadgets.container.createGadget({specUrl: specUrl0});
+  gadget.setServerBase('http://localhost:8080/gadgets/'); 
+  gadgets.container.addGadget(gadget);
+};
+
+function renderGadgets() {
+  gadgets.container.renderGadgets();
+};
+</script>
+</head>
+<body onLoad="init();renderGadgets()">
+  <h2>Sample: set-pref support</h2>
+  <div>(Requires a Shindig server running at http://localhost:8080)</div>
+  <div id="gadget-parent" class="gadgets-gadget-parent"></div>
+</body>
+</html>

Propchange: incubator/shindig/trunk/javascript/container/sample5.html
------------------------------------------------------------------------------
    svn:executable = *


Reply via email to