Review Board 1.7.22


EE sample gadget doesn't work out of box if deployed with context other than root or deployed on port other than 8080

Review Request #1616 - Created Aug. 22, 2011 and submitted

li xu
shindig-1592
Reviewers
shindig
hsaputra, lindner, rbaxter
shindig
This fix enables EE sample page to work out of box even if it's deployed with a context root other than root or port other than 8080

we added two tokens at sample db: canonicaldb.json
%contextroot%
%origin%
it's resolved by JsonDBOpensocialService.java based on injected hostProvider
This is a generic change... any other opensocial object could use the same token in sample json db.

Opensocial sample context is updated to include an additional attribute since photogadget.xml need to refer to AlbumViewer.xml
            "eeGadget" : "%origin%%contextroot%/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml",
fixed related junit tests.

Thanks to Ryan's help on this! 
Passed JUnit tests.
Tested with /embeddedexperiences/index.html
/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml
Revision 1160372 New Change
[20] 64 lines
[+20]
65
             this.context=context;
65
             this.context=context;
66
             var photos = context.photoUrls;
66
             var photos = context.photoUrls;
67
             var result = "";
67
             var result = "";
68
             for(var i = 0; i < photos.length; i++){
68
             for(var i = 0; i < photos.length; i++){
69
                 count = i+1;
69
                 count = i+1;
70
                 result = result + '<li style="text-decoration: underline; color: blue; cursor: pointer" onclick="showPreviewPhoto(\''+i+'\')">Photo '+count+'</li></br>';
70
                 result = result + '<li style="text-decoration: underline; color: blue; cursor: pointer" onclick="showPreviewPhoto(\''+i+'\',\''+context.eeGadget+'\')">Photo '+count+'</li></br>';
71
             }
71
             }
72
             document.getElementById('header').innerHTML = context.albumName;
72
             document.getElementById('header').innerHTML = context.albumName;
73
             document.getElementById("album").innerHTML = result;
73
             document.getElementById("album").innerHTML = result;
74
         };
74
         };
75

    
   
75

   
76
         gadgets.util.registerOnLoadHandler(initAlbum);
76
         gadgets.util.registerOnLoadHandler(initAlbum);
77

    
   
77

   
78
         function showPreviewPhoto(index) {
78
         function showPreviewPhoto(index, eeGadget) {
79

    
   
79

   
80
            var eeDataModel = {
80
            var eeDataModel = {
81
                'gadget' : 'http://localhost:8080/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml',
81
                'gadget' : eeGadget,
82
                'context' : {
82
                'context' : {
83
                  "albumName": context.albumName,
83
                  "albumName": context.albumName,
84
                  "photoUrls": [context.photoUrls[index]]
84
                  "photoUrls": [context.photoUrls[index]]
85
              }
85
              }
86
            };
86
            };
[+20] [20] 33 lines
/trunk/content/samplecontainer/examples/embeddedexperiences/index.html
Revision 1160372 New Change
 
/trunk/content/sampledata/canonicaldb.json
Revision 1160372 New Change
 
/trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java
Revision 1160372 New Change
 
/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml
Revision 1160372 New Change
 
/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonGroup.json
Revision 1160372 New Change
 
/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonId.json
Revision 1160372 New Change
 
/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonIds.json
Revision 1160372 New Change
 
/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml
Revision 1160372 New Change
 
  1. /trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml: Loading...
  2. /trunk/content/samplecontainer/examples/embeddedexperiences/index.html: Loading...
  3. /trunk/content/sampledata/canonicaldb.json: Loading...
  4. /trunk/java/social-api/src/main/java/org/apache/shindig/social/sample/spi/JsonDbOpensocialService.java: Loading...
  5. /trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml: Loading...
  6. /trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonGroup.json: Loading...
  7. /trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonId.json: Loading...
  8. /trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryJsonIds.json: Loading...
  9. /trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml: Loading...