Author: doll
Date: Tue Jan 15 23:17:35 2008
New Revision: 612371
URL: http://svn.apache.org/viewvc?rev=612371&view=rev
Log:
Modified pom.xml to package picture files in addition to the html, css and such
for hosting.
Added some sample opensocial gadgets that work in the sample container, 1 caja
1 non.
Set the non-caja gadget as default in the samplecontainer.html and fxed the
readme to reflect run-war.
Made the basic state file more interesting.
Small todo for the sample gadgets is to have them reference their pictures
properly. They are using relative paths dependant on the setup of the
samplecontainer. Will hopefully fix this soon.
Added:
incubator/shindig/trunk/javascript/samplecontainer/examples/
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld-caja.xml
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml
incubator/shindig/trunk/javascript/samplecontainer/examples/bubble.gif
(with props)
incubator/shindig/trunk/javascript/samplecontainer/examples/nophoto.gif
(with props)
Modified:
incubator/shindig/trunk/java/gadgets/pom.xml
incubator/shindig/trunk/javascript/README
incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html
incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml
Modified: incubator/shindig/trunk/java/gadgets/pom.xml
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/pom.xml?rev=612371&r1=612370&r2=612371&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/pom.xml (original)
+++ incubator/shindig/trunk/java/gadgets/pom.xml Tue Jan 15 23:17:35 2008
@@ -34,6 +34,9 @@
<include>**/*.css</include>
<include>**/*.dtd</include>
<include>**/*.xml</include>
+ <include>**/*.gif</include>
+ <include>**/*.png</include>
+ <include>**/*.jpg</include>
</includes>
</resource>
</webResources>
Modified: incubator/shindig/trunk/javascript/README
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/README?rev=612371&r1=612370&r2=612371&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/README (original)
+++ incubator/shindig/trunk/javascript/README Tue Jan 15 23:17:35 2008
@@ -54,14 +54,8 @@
4) Run the opensocial sample container
A) Set up your own Shindig Gadget Server. See its README for details.
- B) From within the java/gadgets directory run the following commands
- i) Copy the sample container code into the webapp directory so that the
- shindig server will serve it for you.
- cp -r ../../javascript/container/ src/main/webapp/
- cp -r ../../javascript/samplecontainer/ src/main/webapp/
-
- ii) Restart shindig
- mvn jetty:run
+ B) Start shindig using
+ mvn jetty:run-war
C) Hit the sample container at
http://yourserver:yourport/gadgets/samplecontainer/samplecontainer.html
Added:
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld-caja.xml
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld-caja.xml?rev=612371&view=auto
==============================================================================
---
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld-caja.xml
(added)
+++
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld-caja.xml
Tue Jan 15 23:17:35 2008
@@ -0,0 +1,256 @@
+<?xml version="1.0" encoding="UTF-8"?><Module><ModulePrefs title="Social Hello
World"><Require feature="opensocial-samplecontainer"/></ModulePrefs><Content
type="html"><![CDATA[<style type="text/css">
+.DOM-PREFIX #DOM-PREFIX-helloworlds {
+ margin: 20px;
+ font-family: arial , sans-serif;
+ width: 310px
+}
+.DOM-PREFIX div.DOM-PREFIX-person img {
+ margin-bottom: 10px
+}
+.DOM-PREFIX div.DOM-PREFIX-bubble {
+ background-image: url('/bubble.gif');
+ background-repeat: no-repeat;
+ width: 202px;
+ height: 66px;
+ padding: 12px 0px 0px 12px;
+ font-weight: bold;
+ font-size: 18px;
+ float: right
+}
+.DOM-PREFIX .DOM-PREFIX-c0 {
+ color: #008000
+}
+.DOM-PREFIX .DOM-PREFIX-c1 {
+ color: #FF8A00
+}
+.DOM-PREFIX .DOM-PREFIX-c2 {
+ color: #7777CC
+}
+.DOM-PREFIX .DOM-PREFIX-c3 {
+ color: #008000
+}
+.DOM-PREFIX .DOM-PREFIX-c4 {
+ color: #CC0000
+}
+.DOM-PREFIX .DOM-PREFIX-c5 {
+ color: #73A6FF
+}
+.DOM-PREFIX div.DOM-PREFIX-name {
+ width: 150px;
+ text-align: right;
+ font-weight: normal;
+ font-size: 12px;
+ color: #999;
+ position: relative;
+ top: 10px;
+ right: -35px
+}</style>
+<div id="ROOT_DIV_ID"></div>
+<script type="text/javascript">
+{
+ ___.loadModule(function (___OUTERS___) {
+ ___OUTERS___.c_1___ = function (thisNode___, event) {
+ ___.asSimpleFunc(___.primFreeze(___OUTERS___.sayHelloWorld))();
+ ;
+ return false;
+ ;
+ };
+ ___OUTERS___.emitHtml___('\n\n ');
+ ___OUTERS___.hellos = new (___.asCtor(___OUTERS___.Array))('Hello
World', 'Hallo Welt', 'Ciao a tutti', 'Hola mundo',
'Появление на
свет',
'こんにちは世界',
'你好世界', '여러분,
안녕하세요');
+ ___OUTERS___.numberOfStyles = 6;
+ var viewerCount;
+ ___OUTERS___.render = ___.simpleFunc(function (data) {
+ var viewer = (function () {
+ var x___ = (function () {
+ var x___ = data;
+ var x0___ = 'viewer';
+ return x___.get_canCall___ ? x___.get(x0___) :
___.callPub(x___, 'get', [x0___]);
+ })();
+ return x___.getData_canCall___ ? x___.getData() :
___.callPub(x___, 'getData', []);
+ })();
+ var allPeople = (function () {
+ var x___ = (function () {
+ var x___ = (function () {
+ var x___ = data;
+ var x0___ = 'viewerFriends';
+ return x___.get_canCall___ ? x___.get(x0___) :
___.callPub(x___, 'get', [x0___]);
+ })();
+ return x___.getData_canCall___ ? x___.getData() :
___.callPub(x___, 'getData', []);
+ })();
+ return x___.asArray_canCall___ ? x___.asArray() :
___.callPub(x___, 'asArray', []);
+ })() || new (___.asCtor(___OUTERS___.Array))();
+ if (viewer) {
+ (function () {
+ var x___ = allPeople;
+ var x0___ = viewer;
+ return x___.push_canCall___ ? x___.push(x0___) :
___.callPub(x___, 'push', [x0___]);
+ })();
+ }
+ var viewerData = (function () {
+ var x___ = (function () {
+ var x___ = data;
+ var x0___ = 'viewerData';
+ return x___.get_canCall___ ? x___.get(x0___) :
___.callPub(x___, 'get', [x0___]);
+ })();
+ return x___.getData_canCall___ ? x___.getData() :
___.callPub(x___, 'getData', []);
+ })() || {
+ };
+ ___OUTERS___.viewerCount =
___.asSimpleFunc(___.primFreeze(___OUTERS___.getCount))(___.readPub(viewerData,
(function () {
+ var x___ = viewer;
+ return x___.getId_canCall___ ? x___.getId() :
___.callPub(x___, 'getId', []);
+ })()));
+ var viewerFriendData = (function () {
+ var x___ = (function () {
+ var x___ = data;
+ var x0___ = 'viewerFriendData';
+ return x___.get_canCall___ ? x___.get(x0___) :
___.callPub(x___, 'get', [x0___]);
+ })();
+ return x___.getData_canCall___ ? x___.getData() :
___.callPub(x___, 'getData', []);
+ })() || {
+ };
+ ___.setPub(viewerFriendData, (function () {
+ var x___ = viewer;
+ return x___.getId_canCall___ ? x___.getId() :
___.callPub(x___, 'getId', []);
+ })(), ___.readPub(viewerData, (function () {
+ var x___ = viewer;
+ return x___.getId_canCall___ ? x___.getId() :
___.callPub(x___, 'getId', []);
+ })()));
+ var html = '';
+ for (var i = 0; i < (function () {
+ var x___ = allPeople;
+ return x___.length_canRead___ ? x___.length :
___.readPub(x___, 'length');
+ })(); i++) {
+ var count =
___.asSimpleFunc(___.primFreeze(___OUTERS___.getCount))(___.readPub(viewerFriendData,
(function () {
+ var x___ = ___.readPub(allPeople, i);
+ return x___.getId_canCall___ ? x___.getId() :
___.callPub(x___, 'getId', []);
+ })()));
+ if (count == 0) {
+ }
+ html += '\074div class=\"person\"\076';
+ html += '\074div class=\"bubble c' + count %
___OUTERS___.numberOfStyles + '\"\076' + ___.readPub(___OUTERS___.hellos, count
% (function () {
+ var x___ = ___OUTERS___.hellos;
+ return x___.length_canRead___ ? x___.length :
___.readPub(x___, 'length');
+ })());
+ html += '\074div class=\"name\"\076' + (function () {
+ var x___ = ___.readPub(allPeople, i);
+ return x___.getDisplayName_canCall___ ? x___.getDisplayName()
: ___.callPub(x___, 'getDisplayName', []);
+ })() + ' (' + count + ')';
+ html += '\074/div\076\074/div\076';
+ if ((function () {
+ var x___ = ___.readPub(allPeople, i);
+ var x0___ = 'thumbnailUrl';
+ return x___.getField_canCall___ ? x___.getField(x0___) :
___.callPub(x___, 'getField', [x0___]);
+ })() && (function () {
+ var x___ = (function () {
+ var x___ = ___.readPub(allPeople, i);
+ var x0___ = 'thumbnailUrl';
+ return x___.getField_canCall___ ? x___.getField(x0___) :
___.callPub(x___, 'getField', [x0___]);
+ })();
+ var x0___ = 'null';
+ return x___.indexOf_canCall___ ? x___.indexOf(x0___) :
___.callPub(x___, 'indexOf', [x0___]);
+ })() == -1) {
+ html += '\074img src=\"' + (function () {
+ var x___ = ___.readPub(allPeople, i);
+ var x0___ = 'thumbnailUrl';
+ return x___.getField_canCall___ ? x___.getField(x0___) :
___.callPub(x___, 'getField', [x0___]);
+ })() + '\"/\076';
+ } else {
+ html += '\074img
src=\"http://www.corp.google.com/~doll/focus/nophoto.gif\"/\076';
+ }
+ html += '\074br style=\"clear:both\"\076\074/div\076';
+ }
+ (function () {
+ var x___ = (function () {
+ var x___ = ___OUTERS___.document;
+ var x0___ = 'helloworlds';
+ return x___.getElementById_canCall___ ?
x___.getElementById(x0___) : ___.callPub(x___, 'getElementById', [x0___]);
+ })();
+ var x0___ = html;
+ x___.innerHTML_canSet___ ? (x___.innerHTML = x0___) :
___.setPub(x___, 'innerHTML', x0___);
+ })();
+ });
+ ___OUTERS___.getCount = ___.simpleFunc(function (data) {
+ return data && ___.readPub(data, 'count') ?
___.asSimpleFunc(___OUTERS___.Number)(___.readPub(data, 'count')) : 0;
+ });
+ ___OUTERS___.sayHelloWorld = ___.simpleFunc(function () {
+ ___OUTERS___.viewerCount++;
+ var req = (function () {
+ var x___ = ___OUTERS___.opensocial;
+ return x___.newDataRequest_canCall___ ? x___.newDataRequest() :
___.callPub(x___, 'newDataRequest', []);
+ })();
+ (function () {
+ var x___ = req;
+ var x0___ = (function () {
+ var x___ = req;
+ var x0___ = 'VIEWER';
+ var x1___ = 'count';
+ var x2___ = ___OUTERS___.viewerCount;
+ return x___.newUpdatePersonAppDataRequest_canCall___ ?
x___.newUpdatePersonAppDataRequest(x0___, x1___, x2___) : ___.callPub(x___,
'newUpdatePersonAppDataRequest', [x0___, x1___, x2___]);
+ })();
+ var x1___ = 'updateData';
+ return x___.add_canCall___ ? x___.add(x0___, x1___) :
___.callPub(x___, 'add', [x0___, x1___]);
+ })();
+ (function () {
+ var x___ = req;
+ var x0___ = ___.primFreeze(___OUTERS___.initData);
+ return x___.send_canCall___ ? x___.send(x0___) :
___.callPub(x___, 'send', [x0___]);
+ })();
+ });
+ ___OUTERS___.initData = ___.simpleFunc(function () {
+ var req = (function () {
+ var x___ = ___OUTERS___.opensocial;
+ return x___.newDataRequest_canCall___ ? x___.newDataRequest() :
___.callPub(x___, 'newDataRequest', []);
+ })();
+ (function () {
+ var x___ = req;
+ var x0___ = (function () {
+ var x___ = req;
+ var x0___ = 'VIEWER';
+ return x___.newFetchPersonRequest_canCall___ ?
x___.newFetchPersonRequest(x0___) : ___.callPub(x___, 'newFetchPersonRequest',
[x0___]);
+ })();
+ var x1___ = 'viewer';
+ return x___.add_canCall___ ? x___.add(x0___, x1___) :
___.callPub(x___, 'add', [x0___, x1___]);
+ })();
+ (function () {
+ var x___ = req;
+ var x0___ = (function () {
+ var x___ = req;
+ var x0___ = 'VIEWER_FRIENDS';
+ return x___.newFetchPeopleRequest_canCall___ ?
x___.newFetchPeopleRequest(x0___) : ___.callPub(x___, 'newFetchPeopleRequest',
[x0___]);
+ })();
+ var x1___ = 'viewerFriends';
+ return x___.add_canCall___ ? x___.add(x0___, x1___) :
___.callPub(x___, 'add', [x0___, x1___]);
+ })();
+ (function () {
+ var x___ = req;
+ var x0___ = (function () {
+ var x___ = req;
+ var x0___ = 'VIEWER';
+ var x1___ = 'count';
+ return x___.newFetchPersonAppDataRequest_canCall___ ?
x___.newFetchPersonAppDataRequest(x0___, x1___) : ___.callPub(x___,
'newFetchPersonAppDataRequest', [x0___, x1___]);
+ })();
+ var x1___ = 'viewerData';
+ return x___.add_canCall___ ? x___.add(x0___, x1___) :
___.callPub(x___, 'add', [x0___, x1___]);
+ })();
+ (function () {
+ var x___ = req;
+ var x0___ = (function () {
+ var x___ = req;
+ var x0___ = 'VIEWER_FRIENDS';
+ var x1___ = 'count';
+ return x___.newFetchPersonAppDataRequest_canCall___ ?
x___.newFetchPersonAppDataRequest(x0___, x1___) : ___.callPub(x___,
'newFetchPersonAppDataRequest', [x0___, x1___]);
+ })();
+ var x1___ = 'viewerFriendData';
+ return x___.add_canCall___ ? x___.add(x0___, x1___) :
___.callPub(x___, 'add', [x0___, x1___]);
+ })();
+ (function () {
+ var x___ = req;
+ var x0___ = ___.primFreeze(___OUTERS___.render);
+ return x___.send_canCall___ ? x___.send(x0___) :
___.callPub(x___, 'send', [x0___]);
+ })();
+ });
+
___.asSimpleFunc(___OUTERS___._IG_RegisterOnloadHandler)(___.primFreeze(___OUTERS___.initData));
+ ___OUTERS___.emitHtml___('\n\n \074div style=\"margin-bottom:
1em\"\076\n \074input type=\"button\" value=\"Say hello\" onclick=\"return
plugin_dispatchEvent___(event || window.event, this, ',
___.getId(___OUTERS___), ', \'c_1___\')\"\076\n \074/div\076\n \074div
id=\"DOM-PREFIX-helloworlds\" style=\"margin: 4px\"\076\n \074/div\076\n \n
');
+ });
+}</script>
+]]></Content></Module>
Added:
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml?rev=612371&view=auto
==============================================================================
---
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml
(added)
+++
incubator/shindig/trunk/javascript/samplecontainer/examples/SocialHelloWorld.xml
Tue Jan 15 23:17:35 2008
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Module>
+ <ModulePrefs title="Social Hello World">
+ <Require feature="opensocial-samplecontainer"></Require>
+ </ModulePrefs>
+ <Content type="html">
+ <![CDATA[
+ <style type="text/css">
+ #helloworlds {
+ margin: 20px;
+ font-family: arial, sans-serif;
+ width: 310px;
+ }
+
+ div.person img {
+ margin-bottom: 10px;
+ }
+
+ div.bubble {
+ background-image: url(/gadgets/samplecontainer/examples/bubble.gif);
+ background-repeat: no-repeat;
+ width: 202px;
+ height: 66px;
+ padding: 12px 0px 0px 12px;
+ font-weight: bold;
+ font-size: 18px;
+ float: right;
+ }
+
+ .c0 { color: #008000; }
+ .c1 { color: #FF8A00; }
+ .c2 { color: #7777CC; }
+ .c3 { color: #008000; }
+ .c4 { color: #CC0000; }
+ .c5 { color: #73A6FF; }
+
+ div.name {
+ width: 150px;
+ text-align: right;
+ font-weight: normal;
+ font-size: 12px;
+ color: #999;
+ position:relative;
+ top: 10px;
+ right: -35px;
+ }
+ </style>
+
+ <script type="text/javascript">
+ var hellos = new Array('Hello World', 'Hallo Welt', 'Ciao a tutti', 'Hola
mundo',
+ 'Появление
на свет',
'こんにちは世界',
'你好世界', '여러분,
안녕하세요');
+ var numberOfStyles = 6;
+ var viewerCount;
+
+ function render(data) {
+ var viewer = data.get('viewer').getData();
+ var 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[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) {
+ //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')
+ && allPeople[i].getField('thumbnailUrl').indexOf('null') == -1) {
+ html += '<img src="' + allPeople[i].getField('thumbnailUrl') +
'"/>';
+ } else {
+ html += '<img
src="/gadgets/samplecontainer/examples/nophoto.gif"/>';
+ }
+ html += '<br style="clear:both"></div>';
+ }
+ document.getElementById('helloworlds').innerHTML = html;
+ }
+
+ function getCount(data) {
+ return data && data['count'] ? Number(data['count']) : 0;
+ }
+
+ function sayHelloWorld() {
+ viewerCount++;
+ var req = opensocial.newDataRequest();
+ req.add(req.newUpdatePersonAppDataRequest('VIEWER', 'count',
viewerCount), 'updateData');
+ req.send(initData);
+ }
+
+ function initData() {
+ var req = opensocial.newDataRequest();
+ req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
+ req.add(req.newFetchPeopleRequest('VIEWER_FRIENDS'), 'viewerFriends');
+ req.add(req.newFetchPersonAppDataRequest('VIEWER', 'count'),
'viewerData');
+ req.add(req.newFetchPersonAppDataRequest('VIEWER_FRIENDS', 'count'),
'viewerFriendData');
+ req.send(render);
+ }
+
+ _IG_RegisterOnloadHandler(initData);
+ </script>
+
+ <div style="margin-bottom: 1em">
+ <input type="button" value="Say hello" onclick="sayHelloWorld(); return
false;"/>
+ </div>
+ <div id="helloworlds" style="margin: 4px">
+ </div>
+ ]]>
+ </Content>
+</Module>
Added: incubator/shindig/trunk/javascript/samplecontainer/examples/bubble.gif
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/examples/bubble.gif?rev=612371&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/shindig/trunk/javascript/samplecontainer/examples/bubble.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: incubator/shindig/trunk/javascript/samplecontainer/examples/nophoto.gif
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/examples/nophoto.gif?rev=612371&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
incubator/shindig/trunk/javascript/samplecontainer/examples/nophoto.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified:
incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html?rev=612371&r1=612370&r2=612371&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html
(original)
+++ incubator/shindig/trunk/javascript/samplecontainer/samplecontainer.html Tue
Jan 15 23:17:35 2008
@@ -33,7 +33,7 @@
<script type="text/javascript" src="../container/gadgets.js"></script>
<script type="text/javascript">
-var specUrl = 'enter_your_gadget_here.xml';
+var specUrl =
'http://localhost:8080/gadgets/samplecontainer/examples/SocialHelloWorld.xml';
var useCaja = false;
var useCache = true;
var gadget;
@@ -47,7 +47,7 @@
document.getElementById("gadgetUrl").value = specUrl;
gadget = gadgets.container.createGadget({'specUrl': specUrl});;
- gadget.setServerBase('http://localhost:8080/gadgets/');
+ gadget.setServerBase('../');
gadgets.container.addGadget(gadget);
gadgets.container.layoutManager.setGadgetChromeIds(['gadget-chrome']);
Modified:
incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml?rev=612371&r1=612370&r2=612371&view=diff
==============================================================================
---
incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml
(original)
+++
incubator/shindig/trunk/javascript/samplecontainer/state-basicfriendlist.xml
Tue Jan 15 23:17:35 2008
@@ -6,8 +6,11 @@
<viewerFriends>
<person id="[EMAIL PROTECTED]" name="Jane Doe"></person>
<person id="[EMAIL PROTECTED]" name="George Doe"></person>
- <person id="[EMAIL PROTECTED]" name="Peter Doe"></person>
- <person id="[EMAIL PROTECTED]" name="Susan Doe"></person>
</viewerFriends>
+
+ <personAppData>
+ <data person="[EMAIL PROTECTED]" field="count">2</data>
+ <data person="[EMAIL PROTECTED]" field="count">7</data>
+ </personAppData>
</container>