Return-Path: X-Original-To: apmail-shindig-commits-archive@www.apache.org Delivered-To: apmail-shindig-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 76EB4793E for ; Wed, 20 Jul 2011 08:42:48 +0000 (UTC) Received: (qmail 38147 invoked by uid 500); 20 Jul 2011 08:42:47 -0000 Delivered-To: apmail-shindig-commits-archive@shindig.apache.org Received: (qmail 37967 invoked by uid 500); 20 Jul 2011 08:42:43 -0000 Mailing-List: contact commits-help@shindig.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@shindig.apache.org Delivered-To: mailing list commits@shindig.apache.org Received: (qmail 37949 invoked by uid 99); 20 Jul 2011 08:42:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jul 2011 08:42:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jul 2011 08:42:34 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 902152388A1C; Wed, 20 Jul 2011 08:42:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1148651 [2/2] - in /shindig/trunk: content/container/ content/samplecontainer/ content/samplecontainer/examples/ActivityStreams/ content/samplecontainer/examples/commoncontainer/ content/samplecontainer/examples/conservcontainer/ content/s... Date: Wed, 20 Jul 2011 08:42:12 -0000 To: commits@shindig.apache.org From: lindner@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110720084214.902152388A1C@eris.apache.org> Modified: shindig/trunk/content/samplecontainer/examples/media/MediaUI.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/media/MediaUI.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/media/MediaUI.js (original) +++ shindig/trunk/content/samplecontainer/examples/media/MediaUI.js Wed Jul 20 08:42:09 2011 @@ -33,20 +33,20 @@ function MediaUI(social) { var viewer = null; var divManager = null; - - var folderUrl = "http://www.clker.com/cliparts/2/b/b/3/1194983972976950993blue_folder_seth_yastrov_01.svg.med.png"; - var docUrl = "http://www.plastyc.com/images/document-icon.png"; - + + var folderUrl = 'http://www.clker.com/cliparts/2/b/b/3/1194983972976950993blue_folder_seth_yastrov_01.svg.med.png'; + var docUrl = 'http://www.plastyc.com/images/document-icon.png'; + /* * Initializes the gadget. */ this.init = function() { - console.log("initializing AlbumsUI"); - + console.log('initializing AlbumsUI'); + // Manages high-level divs divManager = new DivManager(); divManager.init(); - + // Load data and render loadData(function() { social.getAlbumsByUser(viewer.id, function(response) { @@ -55,7 +55,7 @@ function MediaUI(social) { }); }); } - + /* * Pre-load data for gadget. */ @@ -65,16 +65,16 @@ function MediaUI(social) { callback(); }); } - + /* * Manages the gadgets main DIV elements. - * + * * TODO: use dojo.query() & classes rather than divs[] * TODO: showOnly() function to avoid flashing/pauses */ function DivManager() { var divs = []; - + this.init = function() { console.log('DivManager.init'); addDiv('albumsDiv'); @@ -82,39 +82,39 @@ function MediaUI(social) { addDiv('mediaItemDiv'); hideAll(); } - + this.showAlbums = function() { console.log('DivManager.showAlbums'); hideAll(); divs['albumsDiv'].style.display = 'block'; this.refreshWindow(); } - + this.showMediaItems = function() { console.log('DivManager.showMediaItems'); hideAll(); divs['mediaItemsDiv'].style.display = 'block'; this.refreshWindow(); } - + this.showMediaItem = function() { console.log('DivManager.showMediaItem'); hideAll(); divs['mediaItemDiv'].style.display = 'block'; this.refreshWindow(); } - + this.refreshWindow = function() { gadgets.window.adjustHeight(500); } - + function hideAll() { for (key in divs) { divs[key].style.display = 'none'; } } - + function addDiv(id) { divs[id] = dojo.create('div', {id: id}, dojo.body()); } } - + /* * Renders a list of the given albums. */ @@ -123,14 +123,14 @@ function MediaUI(social) { dojo.empty('albumsDiv'); var albumsDiv = dojo.byId('albumsDiv'); - + var albumsBanner = dojo.create('div', null, albumsDiv); var table = dojo.create('table', null, albumsBanner); var tbody = dojo.create('tbody', null, table); var tr = dojo.create('tr', null, tbody); dojo.create('td', {innerHTML: viewer.name.formatted + "'s Albums", className: 'albumsTitle'}, tr); dojo.create('td', null, tr).appendChild(new dijit.form.Button({label: '+ New Album', onClick: dojo.hitch(this, editAlbumPopup, null)}).domNode); - + var albumsList = dojo.create('div', null, albumsDiv); if (albums.length > 0) { var table = dojo.create('table', {className: 'albumsTable'}, albumsList); @@ -138,11 +138,11 @@ function MediaUI(social) { for (i = 0; i < albums.length; i++) { var albumRow = dojo.create('tr', null, tbody); var albumLeft = dojo.create('td', {className: 'albumListThumbnail'}, albumRow); - var imgLink = dojo.create('a', {href: "javascript:;", onclick: dojo.hitch(this, onClickAlbum, viewer.id, albums[i])}, albumLeft); + var imgLink = dojo.create('a', {href: 'javascript:;', onclick: dojo.hitch(this, onClickAlbum, viewer.id, albums[i])}, albumLeft); dojo.create('img', {src: albums[i].thumbnailUrl, onerror: "this.src='" + folderUrl + "';", width: '100%'}, imgLink); var albumRight = dojo.create('td', {className: 'albumListRight'}, albumRow); var albumTitleRow = dojo.create('tr', null, albumRight); - var titleTd = dojo.create('td', {className: 'albumListTitle'}, albumTitleRow); + var titleTd = dojo.create('td', {className: 'albumListTitle'}, albumTitleRow); dojo.create('a', {innerHTML: albums[i].title, href: 'javascript:;', onclick: dojo.hitch(this, onClickAlbum, viewer.id, albums[i])}, titleTd); var editTd = dojo.create('td', {className: 'actionLinks', style: 'text-align: right'}, albumTitleRow); dojo.create('a', {innerHTML: 'edit', href: 'javascript:;', onclick: dojo.hitch(this, editAlbumPopup, albums[i])}, editTd); @@ -157,10 +157,10 @@ function MediaUI(social) { //dojo.create('td', {innerHTML: infoStr, className: 'albumListInfo', colspan: '2'}, albumInfo); } } else { - albumsDiv.appendChild(dojo.doc.createTextNode("No albums found.")); + albumsDiv.appendChild(dojo.doc.createTextNode('No albums found.')); } divManager.refreshWindow(); - + // Handles when user clicks an album function onClickAlbum(userId, album) { social.getMediaItemsByAlbum(userId, album.id, function(response) { @@ -169,7 +169,7 @@ function MediaUI(social) { }); } } - + /* * Convenience function to retrieve albums and render. */ @@ -180,10 +180,10 @@ function MediaUI(social) { if (callback != null) callback(); }); } - + /* * Renders a grid of the given MediaItems. - * + * * TODO: simplify this by simply taking in 'album', retrieving MediaItems here */ function renderMediaItems(album, mediaItems) { @@ -191,7 +191,7 @@ function MediaUI(social) { dojo.empty('mediaItemsDiv'); var mediaItemsDiv = dojo.byId('mediaItemsDiv'); var numCols = 5; - + // Div to display navation bar and Create button var topDiv = dojo.create('div', null, mediaItemsDiv); var table = dojo.create('table', null, topDiv); @@ -203,7 +203,7 @@ function MediaUI(social) { td = dojo.create('td', {style: 'width:100%'}, tr); var createButton = new dijit.form.Button({label: '+ New MediaItem', onClick: dojo.hitch(this, editMediaItemPopup, album, null)}); td.appendChild(createButton.domNode); - + // Div to display MediaItems in a grid var gridDiv = dojo.create('div', null, mediaItemsDiv); if (mediaItems.length > 0) { @@ -217,10 +217,10 @@ function MediaUI(social) { var td = dojo.create('td', {className: 'mediaItemBox'}, tr); var imageTd = dojo.create('tr', null, td).appendChild(dojo.create('td', {className: 'mediaItemThumbnail'})); if (mediaItems[i].url) { - var imageLink = dojo.create('a', {href: "javascript:;", onclick: dojo.hitch(this, renderMediaItem, album, mediaItems[i])}, imageTd); - imageLink.appendChild(dojo.create('img', {src: mediaItems[i].thumbnailUrl, onerror: "this.src='" + docUrl + "';", style:'height:100px;'})); + var imageLink = dojo.create('a', {href: 'javascript:;', onclick: dojo.hitch(this, renderMediaItem, album, mediaItems[i])}, imageTd); + imageLink.appendChild(dojo.create('img', {src: mediaItems[i].thumbnailUrl, onerror: "this.src='" + docUrl + "';", style: 'height:100px;'})); } else { - dojo.create('img', {src: mediaItems[i].thumbnailUrl, onerror: "this.src='" + docUrl + "';", style:'height:100px;'}, imageTd); + dojo.create('img', {src: mediaItems[i].thumbnailUrl, onerror: "this.src='" + docUrl + "';", style: 'height:100px;'}, imageTd); } var titleTd = dojo.create('tr', null, td).appendChild(dojo.create('td', {style: "text-align:center; font-family:'comic sans ms';white-space:nowrap;"})); titleTd.appendChild(dojo.doc.createTextNode(mediaItems[i].title)); @@ -234,7 +234,7 @@ function MediaUI(social) { } divManager.refreshWindow(); } - + /* * Convenience function to retriev & render MediaItems by Album. */ @@ -244,7 +244,7 @@ function MediaUI(social) { renderMediaItems(album, response.list); }); } - + /* * Renders the view for a single MediaItem. */ @@ -252,7 +252,7 @@ function MediaUI(social) { console.log('renderMediaItem'); dojo.empty('mediaItemDiv'); var mediaItemDiv = dojo.byId('mediaItemDiv'); - + // Div to display navation bar and Create button var topDiv = dojo.create('div', null, mediaItemDiv); var table = dojo.create('table', null, topDiv); @@ -260,10 +260,10 @@ function MediaUI(social) { var tr = dojo.create('tr', null, tbody); var td = dojo.create('td', {style: 'width:100%'}, tr); dojo.create('a', {innerHTML: 'Albums', href: 'javascript:;', onclick: dojo.hitch(this, renderAlbumsByUser, viewer.id, null)}, td); - td.appendChild(dojo.doc.createTextNode(" > ")); - dojo.create('a', {innerHTML: album.title, href: "javascript:;", onclick: dojo.hitch(this, retrieveAndRenderMediaItems, album)}, td); - td.appendChild(dojo.doc.createTextNode(" > " + mediaItem.title)); - + td.appendChild(dojo.doc.createTextNode(' > ')); + dojo.create('a', {innerHTML: album.title, href: 'javascript:;', onclick: dojo.hitch(this, retrieveAndRenderMediaItems, album)}, td); + td.appendChild(dojo.doc.createTextNode(' > ' + mediaItem.title)); + // Div to show MediaItem var itemDiv = dojo.create('div', null, mediaItemDiv); var table = dojo.create('table', null, itemDiv); @@ -276,20 +276,20 @@ function MediaUI(social) { td = dojo.create('td', null, tr); td.appendChild(dojo.doc.createTextNode(mediaItem.description)); } - + divManager.showMediaItem(); } - + /* * Popup to edit album. */ function editAlbumPopup(album) { console.log('editAlbumPopup: ' + JSON.stringify(album)); - + var title = (album == null ? 'Create' : 'Edit') + ' Album'; var dialog = new dijit.Dialog({id: 'editAlbumPopup', title: title, onCancel: destroyDialog}); dojo.body().appendChild(dialog.domNode); - + var formDiv = dojo.create('div', {id: 'editAlbumFormDiv'}); var form = new dijit.form.Form({id: 'editAlbumForm'}); formDiv.appendChild(form.domNode); @@ -331,10 +331,10 @@ function MediaUI(social) { onClick: destroyDialog }).domNode ); - + dialog.set('content', formDiv); dialog.show(); - + function saveForm() { console.log('saveForm'); var values = form.get('value'); @@ -346,20 +346,20 @@ function MediaUI(social) { }; if (album == null) { social.createAlbum(viewer.id, newAlbum, function(response) { - publish("org.apache.shindig.album.created", newAlbum); + publish('org.apache.shindig.album.created', newAlbum); console.log('created album response: ' + JSON.stringify(response)); renderAlbumsByUser(viewer.id); }); } else { social.updateAlbum(viewer.id, album.id, newAlbum, function(response) { - publish("org.apache.shindig.album.updated", newAlbum); + publish('org.apache.shindig.album.updated', newAlbum); console.log('updated album response: ' + JSON.stringify(response)); renderAlbumsByUser(viewer.id); }); } destroyDialog(); } - + // Handles destroying the dialog popup function destroyDialog() { console.log('destroyDialog'); @@ -368,18 +368,18 @@ function MediaUI(social) { dialog.destroy(false); } } - + /* * Popup to edit MediaItem. */ function editMediaItemPopup(album, mediaItem) { console.log('editMediaItemPopup: ' + JSON.stringify(mediaItem)); - + var albumId = mediaItem == null ? album.id : mediaItem.albumId; var title = (mediaItem == null ? 'Create' : 'Edit') + ' MediaItem'; var dialog = new dijit.Dialog({id: 'editMediaItemPopup', title: title, onCancel: destroyDialog}); dojo.body().appendChild(dialog.domNode); - + // Form div var formDiv = dojo.create('div', {id: 'editMediaItemFormDiv'}); var form = new dijit.form.Form({id: 'editMediaItemForm'}); @@ -438,25 +438,25 @@ function MediaUI(social) { onClick: destroyDialog }).domNode ); - + // Textarea div for JSON - var textAreaDiv = dojo.create('div', {style: "width:100%; height:100%;", id: 'textAreaDiv'}); - var textArea = new dijit.form.Textarea({value: JSON.stringify(mediaItem), rows: "20"}); + var textAreaDiv = dojo.create('div', {style: 'width:100%; height:100%;', id: 'textAreaDiv'}); + var textArea = new dijit.form.Textarea({value: JSON.stringify(mediaItem), rows: '20'}); textAreaDiv.appendChild(textArea.domNode); - + // Put divs together - var tabContainer = new dijit.layout.TabContainer({style: "width:400px; height:300px;"}); - var formContentPane = new dijit.layout.ContentPane({title: "Form", content: formDiv}); + var tabContainer = new dijit.layout.TabContainer({style: 'width:400px; height:300px;'}); + var formContentPane = new dijit.layout.ContentPane({title: 'Form', content: formDiv}); tabContainer.addChild(formContentPane); - var textAreaContentPane = new dijit.layout.ContentPane({title: "JSON", content: textAreaDiv}); + var textAreaContentPane = new dijit.layout.ContentPane({title: 'JSON', content: textAreaDiv}); tabContainer.addChild(textAreaContentPane); tabContainer.startup(); var dialogDiv = dojo.create('div', null); dialogDiv.appendChild(tabContainer.domNode); - + dialog.set('content', dialogDiv); dialog.show(); - + function saveForm() { console.log('saveForm mediaItem'); var values = form.get('value'); @@ -467,10 +467,10 @@ function MediaUI(social) { thumbnailUrl: values.thumbnailUrl, url: values.url }; - if (newMediaItem.type == null || newMediaItem.type == "") newMediaItem.type = "image"; + if (newMediaItem.type == null || newMediaItem.type == '') newMediaItem.type = 'image'; if (mediaItem == null) { social.createMediaItem(viewer.id, albumId, newMediaItem, function(response) { - publish("org.apache.shindig.mediaItem.created", newMediaItem); + publish('org.apache.shindig.mediaItem.created', newMediaItem); console.log('created MediaItem response: ' + JSON.stringify(response)); social.getMediaItemsByAlbum(viewer.id, album.id, function(response) { renderMediaItems(album, response.list); @@ -478,7 +478,7 @@ function MediaUI(social) { }); } else { social.updateMediaItem(viewer.id, albumId, mediaItem.id, newMediaItem, function(response) { - publish("org.apache.shindig.mediaItem.updated", newMediaItem); + publish('org.apache.shindig.mediaItem.updated', newMediaItem); console.log('updated MediaItem response: ' + JSON.stringify(response)); social.getMediaItemsByAlbum(viewer.id, album.id, function(response) { renderMediaItems(album, response.list); @@ -487,7 +487,7 @@ function MediaUI(social) { } destroyDialog(); } - + // Handles destroying the dialog popup function destroyDialog() { console.log('destroyDialog'); @@ -496,7 +496,7 @@ function MediaUI(social) { dialog.destroy(false); } } - + /* * Popup to confirm that the user wants to delete album. */ @@ -504,13 +504,13 @@ function MediaUI(social) { console.log('deleteAlbumPopup'); if (confirm("Delete '" + album.title + "'?")) { social.deleteAlbum(viewer.id, album.id, function(response) { - publish("org.apache.shindig.album.deleted", album); + publish('org.apache.shindig.album.deleted', album); console.log('delete album response: ' + JSON.stringify(response)); renderAlbumsByUser(viewer.id); }); } } - + /* * Popup to confirm user wants to delete MediaItem. */ @@ -519,7 +519,7 @@ function MediaUI(social) { var albumId = mediaItem.albumId; if (confirm("Delete '" + mediaItem.title + "'?")) { social.deleteMediaItem(viewer.id, albumId, mediaItem.id, function(response) { - publish("org.apache.shindig.mediaItem.deleted", mediaItem); + publish('org.apache.shindig.mediaItem.deleted', mediaItem); console.log('delete mediaItem response: ' + JSON.stringify(response)); social.getMediaItemsByAlbum(viewer.id, albumId, function(response) { renderMediaItems(album, response.list); @@ -527,11 +527,11 @@ function MediaUI(social) { }); } } - + /* * Publishers. */ function publish(topic, payload) { gadgets.Hub.publish(topic, payload); } -} \ No newline at end of file +} Modified: shindig/trunk/content/samplecontainer/examples/media/Social.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/media/Social.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/media/Social.js (original) +++ shindig/trunk/content/samplecontainer/examples/media/Social.js Wed Jul 20 08:42:09 2011 @@ -27,14 +27,14 @@ function SocialWrapper() { this.getViewer = function(callback) { osapi.people.getViewer().execute(callback); } - + /* * Retrieves the current owner. */ this.getOwner = function(callback) { osapi.people.getOwner().execute(callback); } - + //------------------------ ALBUMS ---------------------- /* * Retrieves albums by ID(s). @@ -43,21 +43,21 @@ function SocialWrapper() { var params = {userId: userId, albumId: albumId}; osapi.albums.get(params).execute(callback); } - + /* * Retrieves albums by user. */ this.getAlbumsByUser = function(userId, callback) { osapi.albums.get({userId: userId}).execute(callback); } - + /* * Retrieves albums by group. */ this.getAlbumsByGroup = function(userId, groupId, callback) { osapi.albums.get({userId: userId, groupId: groupId}).execute(callback); } - + /* * Creates an album for the given user. */ @@ -68,7 +68,7 @@ function SocialWrapper() { }; osapi.albums.create(params).execute(callback); } - + /* * Updates an album by ID. */ @@ -80,7 +80,7 @@ function SocialWrapper() { }; osapi.albums.update(params).execute(callback); } - + /* * Deletes an album by ID. */ @@ -88,7 +88,7 @@ function SocialWrapper() { var params = {userId: userId, albumId: albumId}; osapi.albums.delete(params).execute(callback); } - + //------------------------------- MEDIAITEMS ---------------------------- /* * Creates a MediaItem. @@ -101,7 +101,7 @@ function SocialWrapper() { }; osapi.mediaItems.create(params).execute(callback); } - + /* * Updates a MediaItem by ID. */ @@ -112,10 +112,10 @@ function SocialWrapper() { mediaItemId: mediaItemId, mediaItem: mediaItem }; - console.log("PARAMS: " + JSON.stringify(params)); + console.log('PARAMS: ' + JSON.stringify(params)); osapi.mediaItems.update(params).execute(callback); } - + /* * Retrieves MediaItems by ID(s). */ @@ -127,21 +127,21 @@ function SocialWrapper() { }; osapi.mediaItems.get(params).execute(callback); } - + /* * Retrieves MediaItems by album. */ this.getMediaItemsByAlbum = function(userId, albumId, callback) { osapi.mediaItems.get({userId: userId, albumId: albumId}).execute(callback); } - + /* * Retrieves MediaItems by user and group. */ this.getMediaItemsByUser = function(userId, groupId, callback) { osapi.mediaItems.get({userId: userId, groupId: groupId}).execute(callback); } - + /* * Deletes a MediaItem by ID. */ @@ -153,4 +153,4 @@ function SocialWrapper() { }; osapi.mediaItems.delete(params).execute(callback); } -} \ No newline at end of file +} Modified: shindig/trunk/content/samplecontainer/examples/rewriter/rewriter1.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/rewriter/rewriter1.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/rewriter/rewriter1.js (original) +++ shindig/trunk/content/samplecontainer/examples/rewriter/rewriter1.js Wed Jul 20 08:42:09 2011 @@ -1,19 +1,19 @@ -document.getElementById('jstarget1').innerHTML = "This content was loaded from rewriter1.js"; \ No newline at end of file +document.getElementById('jstarget1').innerHTML = 'This content was loaded from rewriter1.js'; Modified: shindig/trunk/content/samplecontainer/examples/rewriter/rewriter2.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/rewriter/rewriter2.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/rewriter/rewriter2.js (original) +++ shindig/trunk/content/samplecontainer/examples/rewriter/rewriter2.js Wed Jul 20 08:42:09 2011 @@ -1,19 +1,19 @@ -document.getElementById('jstarget2').innerHTML= "This content was loaded from rewriter2.js"; \ No newline at end of file +document.getElementById('jstarget2').innerHTML = 'This content was loaded from rewriter2.js'; Modified: shindig/trunk/content/samplecontainer/samplecontainer.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/samplecontainer.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/samplecontainer.js (original) +++ shindig/trunk/content/samplecontainer/samplecontainer.js Wed Jul 20 08:42:09 2011 @@ -30,7 +30,7 @@ shindig.samplecontainer = {}; * Hide our functions and variables from other javascript */ -(function(){ +(function() { /** * Private Variables @@ -40,7 +40,7 @@ shindig.samplecontainer = {}; var baseUrl = parentUrl.substring(0, parentUrl.indexOf('samplecontainer')); // TODO: This is gross, it needs to use the config just like the gadget js does - var socialDataPath = baseUrl + "social/rest/samplecontainer/"; + var socialDataPath = baseUrl + 'social/rest/samplecontainer/'; var gadgetUrlMatches = /[?&]url=((?:[^#&]+|&)+)/.exec(parentUrl); var gadgetUrl = (gadgetUrlMatches) @@ -58,13 +58,13 @@ shindig.samplecontainer = {}; var doEvil; var gadget; - var viewerId = "john.doe"; - var ownerId = "canonical"; + var viewerId = 'john.doe'; + var ownerId = 'canonical'; var viewMatches = /[?&]view=((?:[^#&]+|&)+)/.exec(parentUrl); var current_view = (viewMatches) ? viewMatches[1] - : "default"; + : 'default'; /** * Public Variables @@ -80,12 +80,12 @@ shindig.samplecontainer = {}; for (var i = 0; i < gadgetUrl.length; i++) { appId += gadgetUrl.charCodeAt(i); } - var fields = [ownerId, viewerId, appId, "shindig", gadgetUrl, "0", "default"]; + var fields = [ownerId, viewerId, appId, 'shindig', gadgetUrl, '0', 'default']; for (var i = 0; i < fields.length; i++) { // escape each field individually, for metachars in URL fields[i] = escape(fields[i]); } - return fields.join(":"); + return fields.join(':'); } SampleContainerGadget = function(opt_params) { @@ -103,10 +103,10 @@ shindig.samplecontainer = {}; var params = ''; if (useCaja) { - params += "&caja=1&libs=caja"; + params += '&caja=1&libs=caja'; } if (useDebug) { - params += "&debug=1"; + params += '&debug=1'; } return params; }; @@ -119,7 +119,7 @@ shindig.samplecontainer = {}; function reloadStateFile(opt_callback) { sendRequestToServer('setstate', 'POST', - gadgets.json.stringify({"fileurl" : stateFileUrl}), + gadgets.json.stringify({'fileurl' : stateFileUrl}), opt_callback); }; @@ -128,12 +128,12 @@ shindig.samplecontainer = {}; opt_postParams = opt_postParams || {}; var makeRequestParams = { - "CONTENT_TYPE" : "JSON", - "METHOD" : method, - "POST_DATA" : opt_postParams}; + 'CONTENT_TYPE' : 'JSON', + 'METHOD' : method, + 'POST_DATA' : opt_postParams}; if (!opt_excludeSecurityToken) { - url = socialDataPath + url + "?st=" + gadget.secureToken; + url = socialDataPath + url + '?st=' + gadget.secureToken; } gadgets.io.makeNonProxiedRequest(url, @@ -144,7 +144,7 @@ shindig.samplecontainer = {}; } }, makeRequestParams, - "application/javascript" + 'application/javascript' ); }; @@ -156,9 +156,9 @@ shindig.samplecontainer = {}; gadget = shindig.container.createGadget({'specUrl': metadata.gadgets[i].url, 'title': metadata.gadgets[i].title, 'userPrefs': metadata.gadgets[i].userPrefs}); // Shindigs rpc code uses direct javascript calls when running on the same domain - // to simulate cross-domain when running sample container we replace - // 'localhost' with '127.0.0.1' - var iframeBaseUrl = baseUrl.replace("localhost", "127.0.0.1") + 'gadgets/'; + // to simulate cross-domain when running sample container we replace + // 'localhost' with '127.0.0.1' + var iframeBaseUrl = baseUrl.replace('localhost', '127.0.0.1') + 'gadgets/'; gadget.setServerBase(iframeBaseUrl); gadget.secureToken = escape(generateSecureToken()); @@ -188,10 +188,10 @@ shindig.samplecontainer = {}; function requestGadgetMetaData(opt_callback) { var request = { context: { - country: "default", - language: "default", + country: 'default', + language: 'default', view: current_view, - container: "default" + container: 'default' }, gadgets: [{ url: gadgetUrl, @@ -199,7 +199,7 @@ shindig.samplecontainer = {}; }] }; - sendRequestToServer(baseUrl+"gadgets/metadata", "POST", + sendRequestToServer(baseUrl + 'gadgets/metadata', 'POST', gadgets.json.stringify(request), opt_callback, true); } @@ -210,8 +210,8 @@ shindig.samplecontainer = {}; // Upon initial load, check for the cache query parameter (we don't want // to overwrite when clicking "refresh all") var cacheUrlMatches = /[?&]cache=([01])/.exec(parentUrl); - if (cacheUrlMatches && cacheUrlMatches[1] == "0") { - document.getElementById("useCacheCheckbox").checked = false; + if (cacheUrlMatches && cacheUrlMatches[1] == '0') { + document.getElementById('useCacheCheckbox').checked = false; } gadgets.pubsubrouter.init(function() { return gadgetUrl; }); }; @@ -219,33 +219,33 @@ shindig.samplecontainer = {}; shindig.samplecontainer.initGadget = function() { // Fetch cookies var cookieGadgetUrl = decodeURIComponent(shindig.cookies.get(gadgetUrlCookie)); - if (cookieGadgetUrl && cookieGadgetUrl != "undefined") { + if (cookieGadgetUrl && cookieGadgetUrl != 'undefined') { gadgetUrl = cookieGadgetUrl; } var cookieStateFileUrl = decodeURIComponent(shindig.cookies.get(stateFileUrlCookie)); - if (cookieStateFileUrl && cookieStateFileUrl != "undefined") { + if (cookieStateFileUrl && cookieStateFileUrl != 'undefined') { stateFileUrl = cookieStateFileUrl; } // Setup state file - document.getElementById("stateFileUrl").value = stateFileUrl; + document.getElementById('stateFileUrl').value = stateFileUrl; // Render gadget - document.getElementById("gadgetUrl").value = gadgetUrl; + document.getElementById('gadgetUrl').value = gadgetUrl; // Viewer and Owner - document.getElementById("viewerId").value = viewerId; - document.getElementById("ownerId").value = ownerId; + document.getElementById('viewerId').value = viewerId; + document.getElementById('ownerId').value = ownerId; requestGadgetMetaData(generateGadgets); }; shindig.samplecontainer.unpackFormState = function() { - useCaja = document.getElementById("useCajaCheckbox").checked; - useCache = document.getElementById("useCacheCheckbox").checked; - useDebug = document.getElementById("useDebugCheckbox").checked; - doEvil = document.getElementById("doEvilCheckbox").checked; + useCaja = document.getElementById('useCajaCheckbox').checked; + useCache = document.getElementById('useCacheCheckbox').checked; + useDebug = document.getElementById('useDebugCheckbox').checked; + doEvil = document.getElementById('doEvilCheckbox').checked; }; shindig.samplecontainer.changeGadgetUrl = function() { @@ -255,12 +255,12 @@ shindig.samplecontainer = {}; // TODO(felix8a): implement in server //setEvilBit(); - stateFileUrl = document.getElementById("stateFileUrl").value; + stateFileUrl = document.getElementById('stateFileUrl').value; shindig.cookies.set(stateFileUrlCookie, encodeURIComponent(stateFileUrl)); - viewerId = document.getElementById("viewerId").value; - ownerId = document.getElementById("ownerId").value; - gadgetUrl = document.getElementById("gadgetUrl").value; + viewerId = document.getElementById('viewerId').value; + ownerId = document.getElementById('ownerId').value; + gadgetUrl = document.getElementById('gadgetUrl').value; shindig.cookies.set(gadgetUrlCookie, encodeURIComponent(gadgetUrl)); @@ -271,7 +271,7 @@ shindig.samplecontainer = {}; sendRequestToServer('dumpstate', 'GET', null, function(data) { if (!data) { - alert("Could not dump the current state."); + alert('Could not dump the current state.'); } document.getElementById('gadgetState').innerHTML = gadgets.json.stringify(data); @@ -285,17 +285,17 @@ shindig.samplecontainer = {}; osapi.messages = {}; osapi.messages.requestSend = function(request, callback) { - alert("osapi.messages.requestSend called"); + alert('osapi.messages.requestSend called'); callback({}); }; osapi.requestShareApp = function(request, callback) { - alert("osapi.requestShareApp called"); + alert('osapi.requestShareApp called'); callback({}); }; osapi.requestPermission = function(request, callback) { - alert("osapi.requestPermission called"); + alert('osapi.requestPermission called'); callback({}); }; Modified: shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_holder.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_holder.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_holder.js (original) +++ shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_holder.js Wed Jul 20 08:42:09 2011 @@ -156,7 +156,7 @@ osapi.container.GadgetHolder.prototype.g /** * @param {string} value The value to set this social/security token to. - * @return {osapi.container.GadgetHolder} the current GadgetHolder + * @return {osapi.container.GadgetHolder} the current GadgetHolder. */ osapi.container.GadgetHolder.prototype.setSecurityToken = function(value) { this.securityToken_ = value; Modified: shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_site.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_site.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_site.js (original) +++ shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_site.js Wed Jul 20 08:42:09 2011 @@ -196,7 +196,7 @@ osapi.container.GadgetSite.prototype.nav var callback = opt_callback || function() {}; var request = osapi.container.util.newMetadataRequest([gadgetUrl]); var self = this; - + this.service_.getGadgetMetadata(request, function(response) { var xrt = (!cached) ? (osapi.container.util.getCurrentTimeMs() - start) : 0; var gadgetInfo = response[gadgetUrl]; Modified: shindig/trunk/features/src/main/javascript/features/container.url/url_holder.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.url/url_holder.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/container.url/url_holder.js (original) +++ shindig/trunk/features/src/main/javascript/features/container.url/url_holder.js Wed Jul 20 08:42:09 2011 @@ -19,8 +19,8 @@ /** * @fileoverview Constructs a new URL holder. This class is similar in * functionality to GadgetHolder from the common container. - * @param {number} siteId The id of the URL site - * @param {Element} el The element to contain the URL renders in + * @param {number} siteId The id of the URL site. + * @param {Element} el The element to contain the URL renders in. */ osapi.container.UrlHolder = function(siteId, el) { @@ -55,7 +55,7 @@ osapi.container.UrlHolder = function(sit this.renderParams_ = null; this.onConstructed(); -} +}; /** * Callback for when the holder is constructed. Modified: shindig/trunk/features/src/main/javascript/features/container.url/url_site.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.url/url_site.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/container.url/url_site.js (original) +++ shindig/trunk/features/src/main/javascript/features/container.url/url_site.js Wed Jul 20 08:42:09 2011 @@ -17,10 +17,10 @@ */ /** - * @fileoverview Constructs a new URL site. This class is very similar in functionality to + * @fileoverview Constructs a new URL site. This class is very similar in functionality to * the GadgetSite class which is part of the common container. * @param {Object} args containing DOM element to rende the iFrame in, and URL - * to render in the iFrame + * to render in the iFrame. * @constructor */ osapi.container.UrlSite = function(args) { @@ -52,7 +52,7 @@ osapi.container.UrlSite = function(args) * @type {string} * @private */ - this.url_ = null + this.url_ = null; this.onConstructed(); }; @@ -141,14 +141,14 @@ osapi.container.UrlSite.prototype.close /** * Renders the URL in this site - * @param {string} url to render in the iFrame - * @param {object} the parameters to render the site + * @param {string} url to render in the iFrame. + * @param {object} the parameters to render the site. */ osapi.container.UrlSite.prototype.render = function(url, renderParams) { this.holder_ = new osapi.container.UrlHolder(this.id_, this.el_); var localRenderParams = {}; - for ( var key in renderParams) { + for (var key in renderParams) { localRenderParams[key] = renderParams[key]; } Modified: shindig/trunk/features/src/main/javascript/features/container.util/constant.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.util/constant.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/container.util/constant.js (original) +++ shindig/trunk/features/src/main/javascript/features/container.util/constant.js Wed Jul 20 08:42:09 2011 @@ -141,7 +141,7 @@ osapi.container.ViewParam = { }; /** - * Constants to define lifecycle callback + * Constants to define lifecycle callback */ osapi.container.CallbackType = {}; osapi.container.CallbackType.ON_PRELOADED = 'onPreloaded'; Modified: shindig/trunk/features/src/main/javascript/features/container.util/util.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.util/util.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/container.util/util.js (original) +++ shindig/trunk/features/src/main/javascript/features/container.util/util.js Wed Jul 20 08:42:09 2011 @@ -125,7 +125,7 @@ osapi.container.util.toArrayOfJsonKeys = * @return {boolean} If obj is an array. */ osapi.container.util.isArray = function(obj) { - return Object.prototype.toString.call(obj) == "[object Array]"; + return Object.prototype.toString.call(obj) == '[object Array]'; }; @@ -162,7 +162,7 @@ osapi.container.util.getCurrentTimeMs = /** * Crates the HTML for the iFrame * @param {iframeParams} iframe Params. - * @return the HTML for the iFrame + * @return the HTML for the iFrame. */ osapi.container.util.createIframeHtml = function(iframeParams) { @@ -172,7 +172,7 @@ osapi.container.util.createIframeHtml = // variants. var out = []; out.push(''); return out.join(''); -}; \ No newline at end of file +}; Modified: shindig/trunk/features/src/main/javascript/features/container/container.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container/container.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/container/container.js (original) +++ shindig/trunk/features/src/main/javascript/features/container/container.js Wed Jul 20 08:42:09 2011 @@ -29,25 +29,25 @@ */ osapi.container.Container = function(opt_config) { var config = this.config_ = opt_config || {}; - + /** - * A list of objects containing functions to be invoked when gadgets are + * A list of objects containing functions to be invoked when gadgets are * preloaded, navigated, closed or unloaded. Sample object: - * + * * var callback = new Object(); - * callback[osapi.container.CallbackType.ON_PRELOADED] - * = function(response){}; - * callback[osapi.container.CallbackType.ON_CLOSED] + * callback[osapi.container.CallbackType.ON_PRELOADED] + * = function(response){}; + * callback[osapi.container.CallbackType.ON_CLOSED] * = function(gadgetSite){}; - * callback[osapi.container.CallbackType.ON_NAVIGATED] + * callback[osapi.container.CallbackType.ON_NAVIGATED] * = function(gadgetSite){}; - * callback[osapi.container.CallbackType.ON_UNLOADED] - * = function(gadgetURL){}; - * @type {Array} + * callback[osapi.container.CallbackType.ON_UNLOADED] + * = function(gadgetURL){}; + * @type {Array} * @private */ this.gadgetLifecycleCallbacks_ = {}; - + /** * A JSON list of preloaded gadget URLs. * @type {Object} @@ -176,7 +176,7 @@ osapi.container.Container.prototype.navi var callback = opt_callback || function() {}, ContainerConfig = osapi.container.ContainerConfig, RenderParam = osapi.container.RenderParam; - + if (this.allowDefaultView_) { renderParams[RenderParam.ALLOW_DEFAULT_VIEW] = true; } @@ -192,13 +192,13 @@ osapi.container.Container.prototype.navi } this.refreshService_(); - + // Try to retrieve preferences for the gadget if no preferences were explicitly provided. if (this.config_[ContainerConfig.GET_PREFERENCES] && !renderParams[RenderParam.USER_PREFS]) { - renderParams[RenderParam.USER_PREFS] = - this.config_[ContainerConfig.GET_PREFERENCES](site.getId(), gadgetUrl); + renderParams[RenderParam.USER_PREFS] = + this.config_[ContainerConfig.GET_PREFERENCES](site.getId(), gadgetUrl); } - + var self = this; var selfSite = site; // TODO: Lifecycle, add ability for current gadget to cancel nav. @@ -212,8 +212,8 @@ osapi.container.Container.prototype.navi } else if (gadgetInfo[osapi.container.MetadataResponse.NEEDS_TOKEN_REFRESH]) { self.scheduleRefreshTokens_(); } - - self.applyLifecycleCallbacks_(osapi.container.CallbackType.ON_NAVIGATED, + + self.applyLifecycleCallbacks_(osapi.container.CallbackType.ON_NAVIGATED, selfSite); callback(gadgetInfo); }); @@ -235,9 +235,9 @@ osapi.container.Container.prototype.clos /** * Add a callback to be called when one or more gadgets are preloaded, navigated to or closed. - * @param {Object} callback object to call back when a gadget is preloaded, navigated to or closed. - * called via preloaded, navigated and closed methods - * @return true if added successfully, false if a callback with that name is already registered. + * @param {Object} callback object to call back when a gadget is preloaded, navigated to or closed. + * called via preloaded, navigated and closed methods. + * @return true if added successfully, false if a callback with that name is already registered. */ osapi.container.Container.prototype.addGadgetLifecycleCallback = function(name, lifeCycleCallback) { if (!this.gadgetLifecycleCallbacks_[name]) { @@ -249,7 +249,7 @@ osapi.container.Container.prototype.addG /** * remove a lifecycle callback previously registered with the container - * @param {Object} callback object to be removed + * @param {Object} callback object to be removed. */ osapi.container.Container.prototype.removeGadgetLifecycleCallback = function(name) { delete this.gadgetLifecycleCallbacks_[name]; @@ -280,9 +280,9 @@ osapi.container.Container.prototype.prel this.refreshService_(); this.service_.getGadgetMetadata(request, function(response) { self.addPreloadGadgets_(response); - self.applyLifecycleCallbacks_(osapi.container.CallbackType.ON_PRELOADED, + self.applyLifecycleCallbacks_(osapi.container.CallbackType.ON_PRELOADED, response); - callback(response); + callback(response); }); }; @@ -304,7 +304,7 @@ osapi.container.Container.prototype.unlo for (var i = 0; i < gadgetUrls.length; i++) { var url = gadgetUrls[i]; delete this.preloadedGadgetUrls_[url]; - this.applyLifecycleCallbacks_(osapi.container.CallbackType.ON_UNLOADED, + this.applyLifecycleCallbacks_(osapi.container.CallbackType.ON_UNLOADED, url); } }; @@ -611,14 +611,14 @@ osapi.container.Container.prototype.isRe */ osapi.container.Container.prototype.registerRpcServices_ = function() { var self = this; - + this.rpcRegister('resize_iframe', function(rpcArgs, data) { var site = rpcArgs[osapi.container.GadgetSite.RPC_ARG_KEY]; if (site) { // Check if site is not already closed. site.setHeight(data); } }); - + /** * @see setprefs.js setprefs feature. */ @@ -629,7 +629,7 @@ osapi.container.Container.prototype.regi var data = {}; for (var i = 2, j = arguments.length; i < j; i += 2) { data[arguments[i]] = arguments[i + 1]; - } + } setPrefs(site.getId(), site.getActiveGadgetHolder().getUrl(), data); } }); @@ -727,10 +727,10 @@ osapi.container.Container.prototype.refr /** - * invokes methods on the gadget lifecycle callback registered with the + * invokes methods on the gadget lifecycle callback registered with the * container. * @param {string} name of the callback method to be called. - * @param {Object} data to be passed to the callback method + * @param {Object} data to be passed to the callback method. * @private */ osapi.container.Container.prototype.applyLifecycleCallbacks_ = function( @@ -740,14 +740,14 @@ osapi.container.Container.prototype.appl if (method) { method(data); } - } + } }; /** * Creates a new URL site - * @param {Element} element the element to put the site in + * @param {Element} element the element to put the site in. */ -osapi.container.Container.prototype.newUrlSite = function(element){ +osapi.container.Container.prototype.newUrlSite = function(element) { var args = {}; args[osapi.container.UrlSite.URL_ELEMENT] = element; return new osapi.container.UrlSite(args); @@ -756,13 +756,13 @@ osapi.container.Container.prototype.newU /** * Navigates to a URL - * @param {osapi.container.UrlSite} site the URL site to render the URL in - * @param {String} url the URL to render + * @param {osapi.container.UrlSite} site the URL site to render the URL in. + * @param {String} url the URL to render. * @param {object} renderParams params to augment the rendering. * Valid rendering parameters include osapi.container.RenderParam.CLASS, - * osapi.container.RenderParam.HEIGHT, and osapi.container.RenderParam.WIDTH + * osapi.container.RenderParam.HEIGHT, and osapi.container.RenderParam.WIDTH. */ -osapi.container.Container.prototype.navigateUrl = function(site, url, renderParams){ +osapi.container.Container.prototype.navigateUrl = function(site, url, renderParams) { site.render(url, renderParams); return site; -}; \ No newline at end of file +}; Modified: shindig/trunk/features/src/main/javascript/features/container/service.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container/service.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/container/service.js (original) +++ shindig/trunk/features/src/main/javascript/features/container/service.js Wed Jul 20 08:42:09 2011 @@ -57,14 +57,14 @@ osapi.container.Service = function(opt_c * @private */ this.cachedTokens_ = {}; - + /** * @see osapi.container.Container.prototype.getLanguage */ if (config.GET_LANGUAGE) { this.getLanguage = config.GET_LANGUAGE; } - + /** * @see osapi.container.Container.prototype.getCountry */ @@ -337,44 +337,44 @@ osapi.container.Service.prototype.filter /** - * @returns {string} Best-guess locale for current browser. + * @return {string} Best-guess locale for current browser. */ osapi.container.Service.prototype.getLocale_ = function() { var nav = window.navigator; return nav.userLanguage || nav.systemLanguage || nav.language; -}; +}; /** - * A callback function that will return the correct language locale part to use when + * A callback function that will return the correct language locale part to use when * asking the server to render a gadget or when asking the server for 1 or more - * gadget's metadata. + * gadget's metadata. *
* May be overridden by passing in a config parameter during container construction. - * * @returns {string} Language locale part. + * * @return {string} Language locale part. */ osapi.container.Service.prototype.getLanguage = function() { try { - return this.getLocale_().split('-')[0] || "ALL"; + return this.getLocale_().split('-')[0] || 'ALL'; } catch (e) { - return "ALL"; + return 'ALL'; } }; /** - * A callback function that will return the correct country locale part to use when + * A callback function that will return the correct country locale part to use when * asking the server to render a gadget or when asking the server for 1 or more - * gadget's metadata. + * gadget's metadata. *
* May be overridden by passing in a config parameter during container construction. - * @returns {string} Country locale part. + * @return {string} Country locale part. */ osapi.container.Service.prototype.getCountry = function() { try { - return this.getLocale_().split('-')[1] || "ALL"; + return this.getLocale_().split('-')[1] || 'ALL'; } catch (e) { - return "ALL"; + return 'ALL'; } }; Modified: shindig/trunk/features/src/main/javascript/features/core.util/util.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/core.util/util.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/core.util/util.js (original) +++ shindig/trunk/features/src/main/javascript/features/core.util/util.js Wed Jul 20 08:42:09 2011 @@ -28,8 +28,8 @@ */ gadgets.util = gadgets.util || {}; -(function() { - +(function() { + var features = {}; var services = {}; Modified: shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/json-xmltojson.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/json-xmltojson.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/json-xmltojson.js (original) +++ shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/json-xmltojson.js Wed Jul 20 08:42:09 2011 @@ -27,29 +27,29 @@ * @class Translates arbitrary XML to JSON * @name gadgets.json.convertXmlToJson */ -gadgets.json.xml = (function(){ - +gadgets.json.xml = (function() { + //Integer which represents a text node var TEXT_NODE = 3; /** * Parses all the child nodes of a specific DOM element and adds them to the JSON object * passed in. - * - * @param childNodes an array of DOM nodes + * + * @param childNodes an array of DOM nodes. * @param json The JSON object to use for the conversion. The DOM nodes will be added to * this JSON object. */ - function parseChildNodes(childNodes, json){ - for(var index = 0; index < childNodes.length; index++){ + function parseChildNodes(childNodes, json) { + for (var index = 0; index < childNodes.length; index++) { var node = childNodes[index]; - if(node.nodeType == TEXT_NODE){ + if (node.nodeType == TEXT_NODE) { setTextNodeValue(json, node.nodeName, node); } - else{ + else { - if(node.childNodes.length == 0){ - if(node.attributes != null && node.attributes.length != 0){ + if (node.childNodes.length == 0) { + if (node.attributes != null && node.attributes.length != 0) { /* * If there are no children but there are attributes set the value for * this node in the JSON object to the JSON for the attributes. There is nothing @@ -57,25 +57,25 @@ gadgets.json.xml = (function(){ */ setAttributes(node, json); } - else{ + else { /* * If there are no children and no attributes set the value to null. */ json[node.nodeName] = null; } } - else{ - if(node.childNodes.length == 1 && node.firstChild.nodeType == TEXT_NODE && (node.attributes == null || node.attributes.length == 0)){ + else { + if (node.childNodes.length == 1 && node.firstChild.nodeType == TEXT_NODE && (node.attributes == null || node.attributes.length == 0)) { /* * There is only one child node and it is a text node AND we have no attributes so * just extract the text value from the text node and set it in the JSON object. */ setTextNodeValue(json, node.nodeName, node.firstChild); } - else{ + else { /* - * There are both children and attributes, so recursively call this method until we have - * reached the end. + * There are both children and attributes, so recursively call this method until we have + * reached the end. */ setChildrenValues(json, node); } @@ -83,21 +83,21 @@ gadgets.json.xml = (function(){ } } }; - + /** * Sets the JSON values for the children of a specified DOM element. - * @param json the JSON object to set the values in - * @param node the DOM node containing children + * @param json the JSON object to set the values in. + * @param node the DOM node containing children. */ - function setChildrenValues(json, node){ + function setChildrenValues(json, node) { var currentValue = json[node.nodeName]; - if(currentValue == null){ + if (currentValue == null) { /* - * If there is no value for this property (node name) than + * If there is no value for this property (node name) than * add the attributes and parse the children. */ json[node.nodeName] = {}; - if(node.attributes != null && node.attributes.length != 0){ + if (node.attributes != null && node.attributes.length != 0) { setAttributesValues(node.attributes, json[node.nodeName]); } parseChildNodes(node.childNodes, json[node.nodeName]); @@ -110,60 +110,60 @@ gadgets.json.xml = (function(){ * an array from the result. */ var temp = {}; - if(node.attributes != null && node.attributes.length != 0){ + if (node.attributes != null && node.attributes.length != 0) { setAttributesValues(node.attributes, temp); } parseChildNodes(node.childNodes, temp); json[node.nodeName] = createValue(currentValue, temp); } }; - + /** * Sets the JSON value for a text node. - * @param json the JSON object to set the values in - * @param nodeName the node name to set the value to - * @param textNode the text node containing the value to set + * @param json the JSON object to set the values in. + * @param nodeName the node name to set the value to. + * @param textNode the text node containing the value to set. */ - function setTextNodeValue(json, nodeName, textNode){ + function setTextNodeValue(json, nodeName, textNode) { var currentValue = json[nodeName]; - if(currentValue != null){ + if (currentValue != null) { json[nodeName] = createValue(currentValue, textNode.nodeValue); } - else{ + else { json[nodeName] = textNode.nodeValue; } }; - + /** - * Handles creating the text node value. In some cases you may want to - * create an array for the value if the node already has a value in the + * Handles creating the text node value. In some cases you may want to + * create an array for the value if the node already has a value in the * JSON object. - * @param currentValue the current value from the JSON object - * @param node the text node containing the value + * @param currentValue the current value from the JSON object. + * @param node the text node containing the value. */ - function createValue(currentValue, value){ - if(currentValue instanceof Array){ + function createValue(currentValue, value) { + if (currentValue instanceof Array) { currentValue[currentValue.length] = value; return currentValue; } - else{ + else { return new Array(currentValue, value); } }; - + /** * Sets the attributes from a DOM node in a JSON object. - * @param node the node to add the attributes are on - * @param json the json object to set the attributes in + * @param node the node to add the attributes are on. + * @param json the json object to set the attributes in. */ - function setAttributes(node, json){ + function setAttributes(node, json) { var currentValue = json[node.nodeName]; - if(currentValue == null){ + if (currentValue == null) { json[node.nodeName] = {}; setAttributesValues(node.attributes, json[node.nodeName]); } - else{ + else { var temp = {}; setAttributesValues(node.attributes, temp); json[node.nodeName] = createValue(currentValue, temp); @@ -172,19 +172,19 @@ gadgets.json.xml = (function(){ /** * Sets the values from attributes from a DOM node in a JSON object. - * @param attributes the DOM node's attributes - * @param json the JSON object to set the values in + * @param attributes the DOM node's attributes. + * @param json the JSON object to set the values in. */ - function setAttributesValues(attributes, json){ + function setAttributesValues(attributes, json) { var attribute = null; - for(var attrIndex = 0; attrIndex < attributes.length; attrIndex++){ + for (var attrIndex = 0; attrIndex < attributes.length; attrIndex++) { attribute = attributes[attrIndex]; - json["@" + attribute.nodeName] = attribute.nodeValue; + json['@' + attribute.nodeName] = attribute.nodeValue; } }; - - return { - convertXmlToJson : function(xmlDoc){ + + return { + convertXmlToJson: function(xmlDoc) { var childNodes = xmlDoc.childNodes; var result = {}; parseChildNodes(childNodes, result); @@ -192,4 +192,4 @@ gadgets.json.xml = (function(){ } }; -})(); \ No newline at end of file +})(); Modified: shindig/trunk/features/src/main/javascript/features/shindig.sha1/sha1.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/shindig.sha1/sha1.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/shindig.sha1/sha1.js (original) +++ shindig/trunk/features/src/main/javascript/features/shindig.sha1/sha1.js Wed Jul 20 08:42:09 2011 @@ -39,7 +39,7 @@ */ shindig.sha1 = (function() { var hex = '0123456789ABCDEF'; - + /** * Holds the previous values of accumulated variables a-e in the compress_ * function. Modified: shindig/trunk/features/src/main/javascript/features/views/views.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/views/views.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/main/javascript/features/views/views.js (original) +++ shindig/trunk/features/src/main/javascript/features/views/views.js Wed Jul 20 08:42:09 2011 @@ -325,7 +325,7 @@ gadgets.views = function() { getParams: function() { return params; }, - + ViewType: _viewType }; }(); Modified: shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js URL: http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js (original) +++ shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js Wed Jul 20 08:42:09 2011 @@ -18,7 +18,7 @@ */ /** - * @fileoverview Tests for container APIs for embedded experiences + * @fileoverview Tests for container APIs for embedded experiences. */ function EEContainerTest(name) { @@ -46,7 +46,7 @@ EEContainerTest.prototype.tearDown = fun gadgets.rpc = this.gadgetsRpc; }; -EEContainerTest.prototype.testNavigateGadget = function(){ +EEContainerTest.prototype.testNavigateGadget = function() { this.setupGadgetsRpcRegister(); var container = new osapi.container.Container({ 'allowDefaultView' : true, @@ -54,23 +54,23 @@ EEContainerTest.prototype.testNavigateGa 'renderDebug' : true, 'renderTest' : true }); - - var eeDataModel = {"gadget" : "http://example.com/gadget.xml", "context" : "123"}; + + var eeDataModel = {'gadget' : 'http://example.com/gadget.xml', 'context' : '123'}; this.setupGadgetSite(1, {}, null); this.setupPreload(); container.ee.navigate({}, eeDataModel, {}); var renderParamDataModel = this.site_navigateTo_renderParams['eeDataModel']; - this.assertEquals("http://example.com/gadget.xml", renderParamDataModel.gadget); - this.assertEquals("123", renderParamDataModel.context); + this.assertEquals('http://example.com/gadget.xml', renderParamDataModel.gadget); + this.assertEquals('123', renderParamDataModel.context); this.assertEquals('embedded', this.site_navigateTo_renderParams['view']); - this.assertEquals("http://example.com/gadget.xml", this.site_navigateTo_gadgetUrl); + this.assertEquals('http://example.com/gadget.xml', this.site_navigateTo_gadgetUrl); this.assertTrue(this.site_navigateTo_renderParams['allowDefaultView']); this.assertTrue(this.site_navigateTo_renderParams['cajole']); this.assertTrue(this.site_navigateTo_renderParams['debug']); this.assertTrue(this.site_navigateTo_renderParams['nocache']); this.assertTrue(this.site_navigateTo_renderParams['testmode']); - + }; EEContainerTest.prototype.setupGadgetsRpcRegister = function() { @@ -100,14 +100,14 @@ EEContainerTest.prototype.setupGadgetSit }; }; -EEContainerTest.prototype.setupUrlSite = function(id, url, urlHolder){ +EEContainerTest.prototype.setupUrlSite = function(id, url, urlHolder) { var self = this; - osapi.container.UrlSite = function(){ + osapi.container.UrlSite = function() { return { - "getId" : function(){ + 'getId' : function() { return id; }, - "render" : function(url, renderParams){ + 'render' : function(url, renderParams) { self.urlsite_render_url = url; self.urlsite_render_renderParams = renderParams; } @@ -115,10 +115,10 @@ EEContainerTest.prototype.setupUrlSite = }; }; -EEContainerTest.prototype.setupPreload = function(){ - osapi.container.Container.prototype.preloadGadget = function(gadgetUrl, func){ +EEContainerTest.prototype.setupPreload = function() { + osapi.container.Container.prototype.preloadGadget = function(gadgetUrl, func) { var ret = []; ret[gadgetUrl] = {}; func(ret); }; -}; \ No newline at end of file +}; Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml (original) +++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml Wed Jul 20 08:42:09 2011 @@ -79,9 +79,8 @@ http://farm1.static.flickr.com/36/98407782_9c4c5866d1_t.jpg http://farm1.static.flickr.com/48/180544479_bb0d0f6559_t.jpg http://farm3.static.flickr.com/2668/3858018351_1e7b73c0b7_t.jpg - + - @@ -91,4 +90,4 @@ 1 1 - \ No newline at end of file + Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml (original) +++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml Wed Jul 20 08:42:09 2011 @@ -61,7 +61,7 @@ http://farm1.static.flickr.com/36/98407782_9c4c5866d1_t.jpg http://farm1.static.flickr.com/48/180544479_bb0d0f6559_t.jpg http://farm3.static.flickr.com/2668/3858018351_1e7b73c0b7_t.jpg - + http://localhost:8080/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml @@ -81,7 +81,7 @@ photo-album http://example.org/album/ - John posted a new photo album. + John posted a new photo album. post @@ -123,7 +123,7 @@ http://farm1.static.flickr.com/36/98407782_9c4c5866d1.jpg http://farm1.static.flickr.com/48/180544479_bb0d0f6559.jpg http://farm3.static.flickr.com/2668/3858018351_1e7b73c0b7.jpg - + http://localhost:8080/samplecontainer/examples/embeddedexperiences/PhotoList.xml @@ -145,4 +145,4 @@ 2 ? ??? - \ No newline at end of file + Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml (original) +++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml Wed Jul 20 08:42:09 2011 @@ -56,7 +56,7 @@ http://farm1.static.flickr.com/36/98407782_9c4c5866d1_t.jpg http://farm1.static.flickr.com/48/180544479_bb0d0f6559_t.jpg http://farm3.static.flickr.com/2668/3858018351_1e7b73c0b7_t.jpg - + http://localhost:8080/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml @@ -81,4 +81,4 @@ John posted a new photo album. post - \ No newline at end of file + Modified: shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml URL: http://svn.apache.org/viewvc/shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml (original) +++ shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml Wed Jul 20 08:42:09 2011 @@ -47,7 +47,7 @@ http://farm1.static.flickr.com/36/98407782_9c4c5866d1.jpg http://farm1.static.flickr.com/48/180544479_bb0d0f6559.jpg http://farm3.static.flickr.com/2668/3858018351_1e7b73c0b7.jpg - + http://localhost:8080/samplecontainer/examples/embeddedexperiences/PhotoList.xml @@ -134,11 +134,11 @@ http://farm1.static.flickr.com/36/98407782_9c4c5866d1_t.jpg http://farm1.static.flickr.com/48/180544479_bb0d0f6559_t.jpg http://farm3.static.flickr.com/2668/3858018351_1e7b73c0b7_t.jpg - + http://localhost:8080/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml - \ No newline at end of file +