Author: doll
Date: Fri Mar  7 05:45:06 2008
New Revision: 634672

URL: http://svn.apache.org/viewvc?rev=634672&view=rev
Log:
The opensocial-samplecontainer feature is now dead! 
(yea! hacks be gone!)

The samplecontainer.html file still exists and will work with gadgets using the 
more proper opensocial-0.7 feature. 

Note: This is a feature regression. You can not change the state file url yet 
nor dump the current state to the page. The do evil flag also no longer works. 
opensocial-0.7 does not allow updating of app data. These will all come back in 
subsequent changes. (hopefully very shortly)

The opensocial-0.7 js code is much more advanced, so if you were relying on 
samplecontainer.js now is a good time to switch your code over. 



Removed:
    incubator/shindig/trunk/features/opensocial-samplecontainer/
Modified:
    incubator/shindig/trunk/features/features.txt
    
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml
    incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html

Modified: incubator/shindig/trunk/features/features.txt
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/features.txt?rev=634672&r1=634671&r2=634672&view=diff
==============================================================================
--- incubator/shindig/trunk/features/features.txt (original)
+++ incubator/shindig/trunk/features/features.txt Fri Mar  7 05:45:06 2008
@@ -8,7 +8,6 @@
 features/opensocial-0.6/feature.xml
 features/opensocial-0.7/feature.xml
 features/opensocial-reference/feature.xml
-features/opensocial-samplecontainer/feature.xml
 features/rpc/feature.xml
 features/ifpc/feature.xml
 features/setprefs/feature.xml

Modified: 
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml?rev=634672&r1=634671&r2=634672&view=diff
==============================================================================
--- 
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml
 (original)
+++ 
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml
 Fri Mar  7 05:45:06 2008
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Module>
  <ModulePrefs title="Social Hello World">
-   <Require feature="opensocial-samplecontainer"></Require>
+   <Require feature="opensocial-0.7"></Require>
+   <Require feature="dynamic-height"></Require>
  </ModulePrefs>
  <Content type="html">
    <![CDATA[
@@ -24,7 +25,7 @@
        padding: 12px 0px 0px 12px;
        font-weight: bold;
        font-size: 18px;
-       float: right;   
+       float: right;
     }
 
     .c0 { color: #008000; }
@@ -47,37 +48,38 @@
    </style>
 
    <script type="text/javascript">
-     var hellos = new Array('Hello World', 'Hallo Welt', 'Ciao a tutti', 'Hola 
mundo', 
+     var hellos = new Array('Hello World', 'Hallo Welt', 'Ciao a tutti', 'Hola 
mundo',
        '&#1055;&#1086;&#1103;&#1074;&#1083;&#1077;&#1085;&#1080;&#1077; 
&#1085;&#1072; &#1089;&#1074;&#1077;&#1090;', 
'&#12371;&#12435;&#12395;&#12385;&#12399;&#19990;&#30028;', 
'&#20320;&#22909;&#19990;&#30028;', '&#50668;&#47084;&#48516;, 
&#50504;&#45397;&#54616;&#49464;&#50836;');
      var numberOfStyles = 6;
      var viewerCount;
 
+     var allPeople, viewerFriendData;
      function render(data) {
        var viewer = data.get('viewer').getData();
-       var allPeople = data.get('viewerFriends').getData().asArray() || new 
Array();
+       allPeople = data.get('viewerFriends').getData().asArray() || new 
Array();
        if (viewer) {
          allPeople.push(viewer);
        }
 
        var viewerData = data.get('viewerData').getData() || {};
        viewerCount = getCount(viewerData[viewer.getId()]);
-       
-       var viewerFriendData = data.get('viewerFriendData').getData() || {};
+
+       viewerFriendData = data.get('viewerFriendData').getData() || {};
        viewerFriendData[viewer.getId()] = viewerData[viewer.getId()];
 
        var html = '';
        for (var i = 0; i < allPeople.length; i++) {
          var count = getCount(viewerFriendData[allPeople[i].getId()]);
-         if (count == 0) { 
+         if (count == 0) {
            //continue;
          }
-         
+
          html += '<div class="person">';
          html += '<div class="bubble c' + count % numberOfStyles + '">' + 
hellos[count % hellos.length];
          html += '<div class="name">' + allPeople[i].getDisplayName() + ' (' + 
count + ')';
          html += '</div></div>';
-     
-         if (allPeople[i].getField('thumbnailUrl') 
+
+         if (allPeople[i].getField('thumbnailUrl')
              && allPeople[i].getField('thumbnailUrl').indexOf('null') == -1) {
            html += '<img src="' + allPeople[i].getField('thumbnailUrl') + 
'"/>';
          } else {
@@ -86,6 +88,8 @@
          html += '<br style="clear:both"></div>';
        }
        document.getElementById('helloworlds').innerHTML = html;
+
+       gadgets.window.adjustHeight();
      }
 
      function getCount(data) {
@@ -98,7 +102,7 @@
        req.add(req.newUpdatePersonAppDataRequest('VIEWER', 'count', 
viewerCount), 'updateData');
        req.send(initData);
      }
-     
+
      function initData() {
        var req = opensocial.newDataRequest();
        req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');

Modified: 
incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html?rev=634672&r1=634671&r2=634672&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html 
(original)
+++ incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html Fri 
Mar  7 05:45:06 2008
@@ -7,11 +7,6 @@
     font-family: arial, sans-serif;
   }
 
-  .gadgets-gadget {
-    height: 100%;
-    width: 100%;
-  }
-
   #headerDiv {
     padding: 10px;
     margin-bottom: 20px;
@@ -32,21 +27,43 @@
 <script type="text/javascript" src="../container/gadgets.js"></script>
 <script type="text/javascript">
 
-var specUrl = 
'http://hosting.gmodules.com/ig/gadgets/file/117247905274371511495/SocialHelloWorld.xml';
+var parentUrl = document.location.href;
+var baseUrl = parentUrl.substring(0, parentUrl.indexOf('samplecontainer.html'))
+
+var gadgetUrl = baseUrl + 'examples/SocialHelloWorld.xml';
+var gadgetUrlCookie = 'sampleContainerGadgetUrl';
+
+var stateFileUrl = baseUrl + 'state-basicfriendlist.xml';
+var stateFileUrlCookie = 'sampleContainerStateFileUrl';
+
 var useCaja = false;
 var useCache = true;
 var usePermissive = false;
+var doEvil = false;  // TODO: make evilness work.
 var gadget;
 
+// TODO: Should be able to dump the state somehow
+
 function initGadget() {
-  var cookieUrl = 
decodeURIComponent(goog.net.cookies.get('sampleContainerGadgetUrl'));
-  if (cookieUrl && cookieUrl != "undefined") {
-    specUrl = cookieUrl;
+  // Fetch cookies
+  var cookieGadgetUrl = 
decodeURIComponent(goog.net.cookies.get(gadgetUrlCookie));
+  if (cookieGadgetUrl && cookieGadgetUrl != "undefined") {
+    gadgetUrl = cookieGadgetUrl;
+  }
+
+  var cookieStateFileUrl = 
decodeURIComponent(goog.net.cookies.get(stateFileUrlCookie));
+  if (cookieStateFileUrl && cookieStateFileUrl != "undefined") {
+    stateFileUrl = cookieStateFileUrl;
   }
 
-  document.getElementById("gadgetUrl").value = specUrl;
+  // Pass state file to server
+  document.getElementById("stateFileUrl").value = stateFileUrl;
+  // TODO: Pass the state file to the server
 
-  gadget = gadgets.container.createGadget({'specUrl': specUrl});;
+  // Render gadget
+  document.getElementById("gadgetUrl").value = gadgetUrl;
+
+  gadget = gadgets.container.createGadget({'specUrl': gadgetUrl});;
   gadget.setServerBase('../../');
 
   gadgets.container.addGadget(gadget);
@@ -58,10 +75,15 @@
   useCaja = document.getElementById("useCajaCheckbox").checked;
   useCache = document.getElementById("useCacheCheckbox").checked;
   usePermissive = document.getElementById("usePermissiveCheckbox").checked;
+  doEvil = document.getElementById("doEvilCheckbox").checked;
 
-  specUrl = document.getElementById("gadgetUrl").value;
-  gadget.specUrl = specUrl;
-  goog.net.cookies.set('sampleContainerGadgetUrl', 
encodeURIComponent(specUrl));
+  stateFileUrl = document.getElementById("stateFileUrl").value;
+  // TODO: reset the state file
+  goog.net.cookies.set(stateFileUrlCookie, encodeURIComponent(stateFileUrl));
+
+  gadgetUrl = document.getElementById("gadgetUrl").value;
+  gadget.specUrl = gadgetUrl;
+  goog.net.cookies.set(gadgetUrlCookie, encodeURIComponent(gadgetUrl));
 
   gadgets.container.renderGadgets();
 };
@@ -97,16 +119,23 @@
   <div id="headerDiv">
     <div style="float:left">Gadget testing container</div>
     <div class="subTitle">
-      Displaying gadget:
-      <input type="text" size="75" id="gadgetUrl"/>
+      Displaying gadget: <input type="text" size="75" id="gadgetUrl"/>
+      <input type="checkbox" id="useCacheCheckbox" checked="true"/>use cache
       <input type="checkbox" id="useCajaCheckbox"/>use caja
       <input type="checkbox" id="usePermissiveCheckbox"/>use permissive
-      <input type="checkbox" id="useCacheCheckbox" checked="true"/>use cache
-      <input type="button" value="reset" onclick="changeGadgetUrl();"/>
+
+      <br/>
+
+      Using state: <input type="text" size="75" id="stateFileUrl"/>
+      <input type="checkbox" id="doEvilCheckbox" checked="true"/>do evil
+
+      <br/>
+
+      <input type="button" value="reset all" onclick="changeGadgetUrl();"/>
     </div>
     <div style="clear:both; height: 1px;">&nbsp;</div>
   </div>
 
-  <div id="gadget-chrome" class="gadgets-gadget-chrome" style="width:80%; 
height:100%"></div>
+  <div id="gadget-chrome" class="gadgets-gadget-chrome" 
style="width:80%;"></div>
 </body>
 </html>


Reply via email to