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 E7CB77942 for ; Wed, 20 Jul 2011 08:43:01 +0000 (UTC) Received: (qmail 38214 invoked by uid 500); 20 Jul 2011 08:42:58 -0000 Delivered-To: apmail-shindig-commits-archive@shindig.apache.org Received: (qmail 38182 invoked by uid 500); 20 Jul 2011 08:42:49 -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 38162 invoked by uid 99); 20 Jul 2011 08:42:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Jul 2011 08:42:47 +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:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8C15F2388A19; 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 [1/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.8C15F2388A19@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: lindner Date: Wed Jul 20 08:42:09 2011 New Revision: 1148651 URL: http://svn.apache.org/viewvc?rev=1148651&view=rev Log: fixjsstyle fixes, spacing fixes Modified: shindig/trunk/content/container/rpctest_perf.js shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamsRender.js shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialWrapper.js shindig/trunk/content/samplecontainer/examples/commoncontainer/assembler.js shindig/trunk/content/samplecontainer/examples/commoncontainer/layout.js shindig/trunk/content/samplecontainer/examples/commoncontainer/search.js shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js shindig/trunk/content/samplecontainer/examples/conservcontainer/ConServContainer.js shindig/trunk/content/samplecontainer/examples/conservcontainer/layout.js shindig/trunk/content/samplecontainer/examples/conservcontainer/viewController.js shindig/trunk/content/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml shindig/trunk/content/samplecontainer/examples/embeddedexperiences/EEContainer.js shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml shindig/trunk/content/samplecontainer/examples/media/MediaUI.js shindig/trunk/content/samplecontainer/examples/media/Social.js shindig/trunk/content/samplecontainer/examples/rewriter/rewriter1.js shindig/trunk/content/samplecontainer/examples/rewriter/rewriter2.js shindig/trunk/content/samplecontainer/samplecontainer.js shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_holder.js shindig/trunk/features/src/main/javascript/features/container.gadget/gadget_site.js shindig/trunk/features/src/main/javascript/features/container.url/url_holder.js shindig/trunk/features/src/main/javascript/features/container.url/url_site.js shindig/trunk/features/src/main/javascript/features/container.util/constant.js shindig/trunk/features/src/main/javascript/features/container.util/util.js shindig/trunk/features/src/main/javascript/features/container/container.js shindig/trunk/features/src/main/javascript/features/container/service.js shindig/trunk/features/src/main/javascript/features/core.util/util.js shindig/trunk/features/src/main/javascript/features/gadgets.json.ext/json-xmltojson.js shindig/trunk/features/src/main/javascript/features/shindig.sha1/sha1.js shindig/trunk/features/src/main/javascript/features/views/views.js shindig/trunk/features/src/test/javascript/features/embeddedexperiences/embedded_experiences_container_test.js shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomId.xml shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryAtomIds.xml shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlId.xml shindig/trunk/java/social-api/src/test/java/org/apache/shindig/social/dataservice/integration/fixtures/ActivityEntryXmlIds.xml Modified: shindig/trunk/content/container/rpctest_perf.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/container/rpctest_perf.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/container/rpctest_perf.js (original) +++ shindig/trunk/content/container/rpctest_perf.js Wed Jul 20 08:42:09 2011 @@ -25,7 +25,7 @@ function perfService(message) { perfStats.firstMsg = message; // stored since it has "real" start time } perfStats.bytesReceived += message.length; -}; +} function clearPerfStats(inOrOut) { perfStats = { @@ -34,11 +34,11 @@ function clearPerfStats(inOrOut) { firstMsg: null }; - document.getElementById("in_or_out").innerHTML = inOrOut; + document.getElementById('in_or_out').innerHTML = inOrOut; // hide results fields - document.getElementById("results").style.display = "none"; -}; + document.getElementById('results').style.display = 'none'; +} function completePerfStats() { perfStats.timeEnded = new Date().getTime(); @@ -49,36 +49,36 @@ function completePerfStats() { var timeUsedMs = perfStats.timeEnded - perfStats.timeStarted; // fill in fields - document.getElementById("results_num_received").innerHTML = perfStats.numResults; - document.getElementById("results_bytes_received").innerHTML = perfStats.bytesReceived; - document.getElementById("results_time_used").innerHTML = timeUsedMs + "ms"; - document.getElementById("results_msgs_per_sec").innerHTML = (perfStats.numResults / (timeUsedMs / 1000)); - document.getElementById("results_bytes_per_sec").innerHTML = (perfStats.bytesReceived / (timeUsedMs / 1000)); - document.getElementById("results_referrer").innerHTML = (this['referer'] || "n/a") + " -- config: " + - (gadgets.config.get("rpc")["passReferrer"] || ""); - document.getElementById("test_running").style.display = "none"; - document.getElementById("results").style.display = ""; -}; + document.getElementById('results_num_received').innerHTML = perfStats.numResults; + document.getElementById('results_bytes_received').innerHTML = perfStats.bytesReceived; + document.getElementById('results_time_used').innerHTML = timeUsedMs + 'ms'; + document.getElementById('results_msgs_per_sec').innerHTML = (perfStats.numResults / (timeUsedMs / 1000)); + document.getElementById('results_bytes_per_sec').innerHTML = (perfStats.bytesReceived / (timeUsedMs / 1000)); + document.getElementById('results_referrer').innerHTML = (this['referer'] || 'n/a') + ' -- config: ' + + (gadgets.config.get('rpc')['passReferrer'] || ''); + document.getElementById('test_running').style.display = 'none'; + document.getElementById('results').style.display = ''; +} function syncCallbackService(toEcho) { return toEcho; -}; +} function asyncCallbackService(toEcho) { var self = this; window.setTimeout(function() { self.callback(toEcho); }, 0); -}; +} function initPerfTest() { clearPerfStats(); - gadgets.rpc.register("perf_service", perfService); - gadgets.rpc.register("clear_perf_stats", clearPerfStats); - gadgets.rpc.register("complete_perf_stats", completePerfStats); - gadgets.rpc.register("sync_callback_service", syncCallbackService); - gadgets.rpc.register("async_callback_service", asyncCallbackService); -}; + gadgets.rpc.register('perf_service', perfService); + gadgets.rpc.register('clear_perf_stats', clearPerfStats); + gadgets.rpc.register('complete_perf_stats', completePerfStats); + gadgets.rpc.register('sync_callback_service', syncCallbackService); + gadgets.rpc.register('async_callback_service', asyncCallbackService); +} var alphabet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 _-*&(){}'"; @@ -89,22 +89,22 @@ function sendPerfMessage() { msgToSend = nowString + currentRun.msg.substring(nowString.length); } - gadgets.rpc.call(currentRun.targetId, "perf_service", null, msgToSend); + gadgets.rpc.call(currentRun.targetId, 'perf_service', null, msgToSend); if (currentRun.curMsgId < currentRun.endMsgId) { // loop, giving up execution in case rpc technique demands it window.setTimeout(sendPerfMessage, 0); } else { // send finisher - window.setTimeout(function() { gadgets.rpc.call(currentRun.targetId, "complete_perf_stats", null); }, 0); + window.setTimeout(function() { gadgets.rpc.call(currentRun.targetId, 'complete_perf_stats', null); }, 0); } -}; +} function runPerfTest(targetId) { - document.getElementById("test_running").style.display = ""; + document.getElementById('test_running').style.display = ''; // initialize the current run - var num_msgs = document.getElementById("num_msgs").value; - var msg_size = document.getElementById("msg_size").value; + var num_msgs = document.getElementById('num_msgs').value; + var msg_size = document.getElementById('msg_size').value; currentRun.targetId = targetId; currentRun.curMsgId = 0; @@ -117,21 +117,21 @@ function runPerfTest(targetId) { currentRun.msg = msg.join(''); // clear local perf stats - clearPerfStats("(outbound)"); + clearPerfStats('(outbound)'); // clear target perf stats - gadgets.rpc.call(targetId, "clear_perf_stats", null, "(inbound)"); + gadgets.rpc.call(targetId, 'clear_perf_stats', null, '(inbound)'); // kick off the send loop sendPerfMessage(); -}; +} function runCallbackTest(targetId, isSync) { - document.getElementById("echo_test_result").innerHTML = ""; - var service = (isSync ? "" : "a") + "sync_callback_service"; - var echoValue = document.getElementById("echo_test_input").value; + document.getElementById('echo_test_result').innerHTML = ''; + var service = (isSync ? '' : 'a') + 'sync_callback_service'; + var echoValue = document.getElementById('echo_test_input').value; var callback = function(response) { - document.getElementById("echo_test_result").innerHTML = response + " at " + new Date().toUTCString() + " from referer: " + this['referer']; + document.getElementById('echo_test_result').innerHTML = response + ' at ' + new Date().toUTCString() + ' from referer: ' + this['referer']; }; gadgets.rpc.call(targetId, service, callback, echoValue); -}; +} Modified: shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamsRender.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamsRender.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamsRender.js (original) +++ shindig/trunk/content/samplecontainer/examples/ActivityStreams/ActivityStreamsRender.js Wed Jul 20 08:42:09 2011 @@ -20,7 +20,7 @@ function ActivityStreamsRender() { // Private member that wraps the OpenSocial API var social = new OpenSocialWrapper(); - + // =================== PUBLIC ==================== // Renders the welcome text (viewer, owner, and friends) @@ -30,46 +30,46 @@ function ActivityStreamsRender() { owner = response.owner; var viewerFriends = response.viewerFriends; var ownerFriends = response.ownerFriends; - - var html = "

Welcome " + viewer.name.formatted + "!

"; - html += "You are viewing " + owner.name.formatted + "'s data.

"; - html += "Here is a list of your friends:
"; - html += ""; - for(i = 0; i < viewerFriends.list.length; i++) { - html += "
  • " + viewerFriends.list[i].name.formatted + "
  • "; + + var html = '

    Welcome ' + viewer.name.formatted + '!

    '; + html += 'You are viewing ' + owner.name.formatted + "'s data.

    "; + html += 'Here is a list of your friends:
    '; + html += ''; + for (i = 0; i < viewerFriends.list.length; i++) { + html += '
  • ' + viewerFriends.list[i].name.formatted + '
  • '; } - html += "
    "; + html += '
    '; document.getElementById(div).innerHTML = html; callback(); }); } - + // Renders the activities this.renderActivities = function(div, callback) { social.loadActivities(function(response) { var viewerActivities = response.viewerActivities.list; var ownerActivities = response.ownerActivities.list; var friendActivities = response.friendActivities.list; - - var html = "

    Activities

    "; - html += "Demonstrates use of the Activities service in Apache Shindig. The ActivityStreams service does not interfere with this service.

    "; - html += "Activities for you and " + owner.name.formatted + ":
    "; + + var html = '

    Activities

    '; + html += 'Demonstrates use of the Activities service in Apache Shindig. The ActivityStreams service does not interfere with this service.

    '; + html += 'Activities for you and ' + owner.name.formatted + ':
    '; html += ""; - html += ""; - html += ""; - html += ""; - html += ""; - html += ""; - html += "" + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; + html += ''; html += processActivities(viewerActivities); html += processActivities(ownerActivities); html += processActivities(friendActivities); - html += "
    NameTitleBodyImages
    NameTitleBodyImages
    "; + html += ''; document.getElementById(div).innerHTML = html; callback(); }); } - + // Renders activity entries this.renderActivityEntries = function(div, callback) { social.loadActivityEntries(function(response) { @@ -77,58 +77,58 @@ function ActivityStreamsRender() { viewerEntries = response.viewerEntries.list; //ownerEntries = response.ownerEntries.list; //friendEntries = response.friendEntries.list; - html = "

    ActivityEntries

    "; + html = '

    ActivityEntries

    '; html += processActivityEntries(viewerEntries); //html += processActivityEntries(ownerEntries); //html += processActivityEntries(friendEntries); if (viewerEntries.length == 0) { - html += "No entries to show!"; + html += 'No entries to show!'; } - html += "

    "; + html += '

    '; document.getElementById(div).innerHTML = html; callback(); }); } - + // ================== PRIVATE ===================== - + // Processes activities and returns the rendered HTML function processActivities(activities) { var html = ''; - for(idx = 0; idx < activities.length; idx++) { - html += ""; - html += "" + activities[idx].userId + ""; - html += "" + activities[idx].title + ""; - html += "" + activities[idx].body + ""; + for (idx = 0; idx < activities.length; idx++) { + html += ''; + html += '' + activities[idx].userId + ''; + html += '' + activities[idx].title + ''; + html += '' + activities[idx].body + ''; var mediaItems = activities[idx].mediaItems; - if(mediaItems != null) { - for(itemIdx = 0; itemIdx < mediaItems.length; itemIdx++) { - if(mediaItems[itemIdx].type == "image") { + if (mediaItems != null) { + for (itemIdx = 0; itemIdx < mediaItems.length; itemIdx++) { + if (mediaItems[itemIdx].type == 'image') { html += ""; } } } - html += ""; + html += ''; } return html; } - + // Processes activity entries and returns the rendered HTML function processActivityEntries(entries) { var html = ''; - for(idx = 0; idx < entries.length; idx++) { - if(entries[idx].object.url && entries[idx].object.url != "null") { - html += "

    " + entries[idx].title + "

    "; + for (idx = 0; idx < entries.length; idx++) { + if (entries[idx].object.url && entries[idx].object.url != 'null') { + html += "

    " + entries[idx].title + '

    '; } else { - html += "

    " + entries[idx].title + "

    "; + html += '

    ' + entries[idx].title + '

    '; } - html += "ID: " + entries[idx].id + "
    "; - html += "Actor: " + entries[idx].actor.displayName + "
    "; - html += "Posted: " + entries[idx].published + "
    "; - if(entries[idx].content && entries[idx].content != "null") { - html += "Content: " + entries[idx].content + "
    "; + html += 'ID: ' + entries[idx].id + '
    '; + html += 'Actor: ' + entries[idx].actor.displayName + '
    '; + html += 'Posted: ' + entries[idx].published + '
    '; + if (entries[idx].content && entries[idx].content != 'null') { + html += 'Content: ' + entries[idx].content + '
    '; } } return html; } -} \ No newline at end of file +} Modified: shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialWrapper.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialWrapper.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialWrapper.js (original) +++ shindig/trunk/content/samplecontainer/examples/ActivityStreams/OpenSocialWrapper.js Wed Jul 20 08:42:09 2011 @@ -17,14 +17,14 @@ */ function OpenSocialWrapper() { - + // =============================== PEOPLE =============================== - + /* * Loads the owner, the viewer, the owner's friends, and the viewer's * friends. Response data is put into the variables owner, viewer, * ownerFriends, and viewerFriends, respectively. - * + * * @param callback is the function to return the response to */ this.loadPeople = function(callback) { @@ -35,15 +35,15 @@ function OpenSocialWrapper() { batch.add('ownerFriends', osapi.people.getOwnerFriends()); batch.execute(callback); } - + this.loadViewerFriends = function(callback) { osapi.people.getViewerFriends().execute(callback); } - + this.loadOwnerFriends = function(callback) { osapi.people.getOwnerFriends().execute(callback); } - + // ========================= ACTIVITIES ============================= this.loadActivities = function(callback) { var batch = osapi.newBatch(); @@ -52,23 +52,23 @@ function OpenSocialWrapper() { batch.add('friendActivities', osapi.activities.get({userId: '@viewer', groupId: '@friend'})); batch.execute(callback); } - + this.loadViewerActivities = function(callback) { var req = osapi.activities.get({userId: '@viewer', groupId: '@self'}); req.execute(callback); } - + this.loadViewerFriendsActivities = function(callback) { var req = osapi.activities.get({userId: '@viewer', groupId: '@friends'}); req.execute(this.onLoadActivitiesFriends); } - + this.loadOwnerActivities = function(callback) { var req = osapi.activities.get({userId: '@owner', groupId: '@self'}); req.execute(callback); } - + // ========================= ACTIVITY STREAMS ============================= this.loadActivityEntries = function(callback) { var batch = osapi.newBatch(); @@ -77,24 +77,24 @@ function OpenSocialWrapper() { //batch.add('friendEntries', osapi.activitystreams.get({userId: '@viewer', groupId: '@friend'})); batch.execute(callback); } - + this.loadViewerActivityEntries = function(callback) { - var params = {userId: '@viewer', groupId: '@self'} + var params = {userId: '@viewer', groupId: '@self'}; osapi.activitystreams.get(params).execute(callback); } - + this.loadOwnerActivityEntries = function(callback) { - var params = {userId: '@owner', groupId: '@self'} + var params = {userId: '@owner', groupId: '@self'}; osapi.activitystreams.get(params).execute(callback); } - + this.loadViewerFriendsActivityEntries = function(callback) { - var params = {userId: '@viewer', groupId: '@friends'} + var params = {userId: '@viewer', groupId: '@friends'}; osapi.activitystreams.get(params).execute(callback); } - + this.postActivityEntry = function(title, content, verb, actorId, actorName, objectName, objectSummary, - objectPermalink, objectType, callback) { + objectPermalink, objectType, callback) { var params = { userId: '@viewer', groupId: '@self', @@ -115,21 +115,21 @@ function OpenSocialWrapper() { summary: objectSummary } } - } + }; osapi.activitystreams.create(params).execute(callback); } - + this.deleteActivityEntryById = function(activityEntryId, callback) { var params = { userId: '@viewer', groupId: '@self', activityId: activityEntryId - } + }; osapi.activitystreams.delete(params).execute(callback); } - + this.getActivityEntryById = function(activityEntryId, callback) { var params = {activityId: activityEntryId}; osapi.activitystreams.get(params).execute(callback); } -} \ No newline at end of file +} Modified: shindig/trunk/content/samplecontainer/examples/commoncontainer/assembler.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/commoncontainer/assembler.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/commoncontainer/assembler.js (original) +++ shindig/trunk/content/samplecontainer/examples/commoncontainer/assembler.js Wed Jul 20 08:42:09 2011 @@ -18,14 +18,14 @@ */ // url base should be :// -var urlBase = location.href.substr(0,location.href.indexOf("/samplecontainer/examples/commoncontainer/")); -var contextRoot = urlBase.substr(urlBase.indexOf(location.port)+location.port.length); - -var testConfig = testConfig || {}; -testConfig[osapi.container.ServiceConfig.API_PATH] = contextRoot+'/rpc'; -testConfig[osapi.container.ContainerConfig.RENDER_DEBUG] = "1"; +var urlBase = location.href.substr(0, location.href.indexOf('/samplecontainer/examples/commoncontainer/')); +var contextRoot = urlBase.substr(urlBase.indexOf(location.port) + location.port.length); -// Create the new CommonContainer +var testConfig = testConfig || {}; +testConfig[osapi.container.ServiceConfig.API_PATH] = contextRoot + '/rpc'; +testConfig[osapi.container.ContainerConfig.RENDER_DEBUG] = '1'; + +// Create the new CommonContainer var CommonContainer = new osapi.container.Container(testConfig); // Default the security token for the container. Using this example security token requires enabling @@ -59,46 +59,46 @@ CommonContainer.init = function() { // Connect to the ManagedHub CommonContainer.inlineClient = - new OpenAjax.hub.InlineContainer(CommonContainer.managedHub, "container", + new OpenAjax.hub.InlineContainer(CommonContainer.managedHub, 'container', { Container: { onSecurityAlert: function(source, alertType) { /* Handle client-side security alerts */ }, - onConnect: function(container){ /* Called when client connects */ }, - onDisconnect: function(container){ /* Called when client connects */ } + onConnect: function(container) { /* Called when client connects */ }, + onDisconnect: function(container) { /* Called when client connects */ } } }); //connect to the inline client CommonContainer.inlineClient.connect(); - } catch(e) { + } catch (e) { // TODO: error handling should be consistent with other OS gadget initialization error handling - alert("ERROR creating or connecting InlineClient in CommonContainer.managedHub [" + e.message + "]"); + alert('ERROR creating or connecting InlineClient in CommonContainer.managedHub [' + e.message + ']'); } }; //Wrapper function to set the gadget site/id and default width. Currently have some inconsistency with width actually being set. This //seems to be related to the pubsub2 feature. CommonContainer.renderGadget = function(gadgetURL, gadgetId) { - //going to hardcode these values for width. - var el = document.getElementById("gadget-site-" + gadgetId); - var parms ={}; - parms[osapi.container.RenderParam.WIDTH]="100%"; + //going to hardcode these values for width. + var el = document.getElementById('gadget-site-' + gadgetId); + var parms = {}; + parms[osapi.container.RenderParam.WIDTH] = '100%'; var gadgetSite = CommonContainer.newGadgetSite(el); CommonContainer.navigateGadget(gadgetSite, gadgetURL, {}, parms); return gadgetSite; - + }; //TODO: To be implemented. Identify where to hook this into the page (in the gadget title bar/gadget management, etc) CommonContainer.navigateView = function(gadgetSite, gadgetURL, view) { - var renderParms ={}; - if(view===null || view===""){ - view="default"; + var renderParms = {}; + if (view === null || view === '') { + view = 'default'; } //TODO Evaluate Parms based on configuration - renderParms[osapi.container.RenderParam.WIDTH]="100%"; - renderParms['view']=view; + renderParms[osapi.container.RenderParam.WIDTH] = '100%'; + renderParms['view'] = view; - CommonContainer.navigateGadget(gadgetSite, gadgetURL, {}, renderParms); + CommonContainer.navigateGadget(gadgetSite, gadgetURL, {}, renderParms); }; //TODO: Add in UI controls in portlet header to remove gadget from the canvas @@ -108,6 +108,6 @@ CommonContainer.colapseGadget = function //display the pubsub 2 event details function log(message) { - document.getElementById("output").innerHTML = gadgets.util.escapeString(message) + "
    " + document.getElementById("output").innerHTML; -}; + document.getElementById('output').innerHTML = gadgets.util.escapeString(message) + '
    ' + document.getElementById('output').innerHTML; +} Modified: shindig/trunk/content/samplecontainer/examples/commoncontainer/layout.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/commoncontainer/layout.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/commoncontainer/layout.js (original) +++ shindig/trunk/content/samplecontainer/examples/commoncontainer/layout.js Wed Jul 20 08:42:09 2011 @@ -19,78 +19,78 @@ // Setup the base container objects for managing layout, gadget, and container configuration $(function() { - + //TODO: enable drag and drop with the portlet at some point - $(".column").sortable({ + $('.column').sortable({ connectWith: '.column', - update: function(event, ui) { - //TODO: There is an issue with drag & drop + update: function(event, ui) { + //TODO: There is an issue with drag & drop } }); - $(".portlet").addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all") - .find(".portlet-header") - .addClass("ui-widget-header ui-corner-all") + $('.portlet').addClass('ui-widget ui-widget-content ui-helper-clearfix ui-corner-all') + .find('.portlet-header') + .addClass('ui-widget-header ui-corner-all') .prepend('') .end() - .find(".portlet-content"); - $(".portlet-header .ui-icon").click(function() { - $(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick"); - $(this).parents(".portlet:first").find(".portlet-content").toggle(); + .find('.portlet-content'); + $('.portlet-header .ui-icon').click(function() { + $(this).toggleClass('ui-icon-minusthick').toggleClass('ui-icon-plusthick'); + $(this).parents('.portlet:first').find('.portlet-content').toggle(); }); - $(".column").disableSelection(); + $('.column').disableSelection(); }); - + $(function() { - $( "#accordion" ).accordion({ + $('#accordion').accordion({ fillSpace: true, collapsible: true - + }); }); $(function() { - $( "#accordionResizer" ).resizable({ + $('#accordionResizer').resizable({ minHeight: 140, resize: function() { - $( "#accordion" ).accordion( "resize" ); + $('#accordion').accordion('resize'); } }); }); $(function() { - $( "#accordionEvents" ).accordion({ + $('#accordionEvents').accordion({ fillSpace: true, collapsible: true - + }); }); $(function() { - $( "#accordionResizerEvents" ).resizable({ + $('#accordionResizerEvents').resizable({ minHeight: 140, resize: function() { - $( "#accordionEvents" ).accordion( "resize" ); + $('#accordionEvents').accordion('resize'); } }); }); $(function() { - $( "#accordionGadgetControls" ).accordion({ + $('#accordionGadgetControls').accordion({ fillSpace: true, collapsible: true - + }); }); $(function() { - $( "#accordionContainerControls" ).accordion({ + $('#accordionContainerControls').accordion({ fillSpace: true, collapsible: true - + }); }); $(function() { - $( "#accordionResizerControls" ).resizable({ + $('#accordionResizerControls').resizable({ minHeight: 140, resize: function() { - $( "#accordionGadgetControls" ).accordion( "resize" ); + $('#accordionGadgetControls').accordion('resize'); } }); }); Modified: shindig/trunk/content/samplecontainer/examples/commoncontainer/search.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/commoncontainer/search.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/commoncontainer/search.js (original) +++ shindig/trunk/content/samplecontainer/examples/commoncontainer/search.js Wed Jul 20 08:42:09 2011 @@ -20,20 +20,20 @@ var currentEngines = []; var templateMap = []; /** - * Helper function to extract create map of new engines, keyed by template url - * @param searchURLs template search urls + * Helper function to extract create map of new engines, keyed by template url + * @param searchURLs template search urls. * @param description - * opensearch description being added or removed + * opensearch description being added or removed. * @param added * true if new description, false if removed. */ extractURLs = function(searchUrls, description, added) { var newEngines = []; for (var i in searchUrls) { - var template = searchUrls[i]["@template"]; + var template = searchUrls[i]['@template']; if (template != null) { - var descType = searchUrls[i]["@type"]; - if (descType == "application/atom+xml") { + var descType = searchUrls[i]['@type']; + if (descType == 'application/atom+xml') { if (added) { if (currentEngines[template] == null) { newEngines[template] = description.OpenSearchDescription.ShortName; @@ -56,14 +56,14 @@ extractURLs = function(searchUrls, descr } } return newEngines; -} +}; /** * Callback passed to the opensearch feature to react to addition/removal of * gadgets containing OpenSearch descriptions. - * + * * @param description - * opensearch description being added or removed + * opensearch description being added or removed. * @param added * true if new description, false if removed. */ @@ -78,49 +78,49 @@ updateEngines = function(description, ad var newEngines = extractURLs(searchUrls, description, added); - var span = document.getElementById("engineList"); + var span = document.getElementById('engineList'); for (templateUrl in newEngines) { var current = newEngines[templateUrl]; span.innerHTML = span.innerHTML - + "" + current; - span.innerHTML = span.innerHTML + "
    "; + + '' + current; + span.innerHTML = span.innerHTML + '
    '; currentEngines[templateUrl] = current; } -} +}; CommonContainer.opensearch.addOpenSearchCallback(updateEngines); /** * Clears old search results, and fetches new ones. - * + * */ function updateSearchURLs() { // clear the old results $(function() { - $("#results").dialog( { - autoOpen : false + $('#results').dialog({ + autoOpen: false }); }); - $("#results").dialog("option", "minWidth", 1000); - $("#results").dialog('open'); + $('#results').dialog('option', 'minWidth', 1000); + $('#results').dialog('open'); //var div = document.getElementById("results"); /*while (div.hasChildNodes()) { div.removeChild(div.firstChild); }*/ - $("#results").empty(); + $('#results').empty(); //div.innerHTML = document.getElementById("query").value; - $("#results").innerHTML = document.getElementById("query").value; + $('#results').innerHTML = document.getElementById('query').value; // fetch new results. - getSearchResults(currentEngines, document.getElementById("query").value); + getSearchResults(currentEngines, document.getElementById('query').value); } /** * Iterates over template urls and fetches search results. - * + * * @param urls - * all the opensearch template urls in the container + * all the opensearch template urls in the container. * @param query * query string. */ @@ -128,56 +128,56 @@ function getSearchResults(urls, query) { // callback function to be called by the fetching code. /** * @param obj - * the result data object, should be XML + * the result data object, should be XML. * @param engineTitle - * title of the engine being searched + * title of the engine being searched. */ function urlResponse(obj, engineTitle) { // create placeholder for results - var su = document.getElementById("results"); - var resultDiv = document.createElement("div"); + var su = document.getElementById('results'); + var resultDiv = document.createElement('div'); su.appendChild(resultDiv); // if there are no errors, parse the results if (obj.errors.length == 0) { - resultDiv.className = "searchEngine"; + resultDiv.className = 'searchEngine'; var domdata = obj.data; if (domdata != null) { - var entries = domdata.getElementsByTagName("entry"); - resultDiv.innerHTML = resultDiv.innerHTML + engineTitle + ":
    "; + var entries = domdata.getElementsByTagName('entry'); + resultDiv.innerHTML = resultDiv.innerHTML + engineTitle + ':
    '; if (entries.legnth == 0) { - resultDiv.innerHTML = resultDiv.innerHTML + ("No results found"); + resultDiv.innerHTML = resultDiv.innerHTML + ('No results found'); } else { var resultCount = entries.length; if (resultCount > 15) { resultCount = 15; } for (i = 0; i < resultCount; i++) { - if (entries[i].getElementsByTagName("title").length > 0) { - titles = entries[i].getElementsByTagName("title") - title = titles[0].childNodes[0].nodeValue; + if (entries[i].getElementsByTagName('title').length > 0) { + titles = entries[i].getElementsByTagName('title'); + title = titles[0].childNodes[0].nodeValue; } else { - title = "Untitled"; + title = 'Untitled'; } var link = null; //for standard atom results, we can extract the link - if (entries[i].getElementsByTagName("link").length > 0) { - links = entries[i].getElementsByTagName("link"); + if (entries[i].getElementsByTagName('link').length > 0) { + links = entries[i].getElementsByTagName('link'); link = links[0].attributes.href.nodeValue; - } - var summaryNode = entries[i].getElementsByTagName("summary")[0]; + } + var summaryNode = entries[i].getElementsByTagName('summary')[0]; if (summaryNode == null) { - summaryNode = entries[i].getElementsByTagName("description")[0]; + summaryNode = entries[i].getElementsByTagName('description')[0]; } if (link == null) { resultDiv.innerHTML = resultDiv.innerHTML - + "

    " + + '

    ' + gadgets.util.escapeString(title); } else { resultDiv.innerHTML = resultDiv.innerHTML - + "

    " - + "" + + '

    ' + + '' + gadgets.util.escapeString(title) - + ""; + + ''; } if (summaryNode != null) { var summary = summaryNode.textContent; @@ -191,7 +191,7 @@ function getSearchResults(urls, query) { } } else { // errors occured, notify the user. resultDiv.innerHTML = resultDiv.innerHTML + engineTitle - + "
    An error has occured:" + obj.errors[0]; + + '
    An error has occured:' + obj.errors[0]; } } var params = {}; @@ -208,7 +208,7 @@ function getSearchResults(urls, query) { var callback = function() { var myTitle = '' + title; return function(response) { - urlResponse(response, myTitle) + urlResponse(response, myTitle); }; }(); // go fetch the results. @@ -218,4 +218,4 @@ function getSearchResults(urls, query) { } } -}; +} Modified: shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js (original) +++ shindig/trunk/content/samplecontainer/examples/commoncontainer/viewController.js Wed Jul 20 08:42:09 2011 @@ -17,158 +17,158 @@ */ $(function() { - + // Input field that contains gadget urls added by the user manually - var newGadgetUrl= $( "#gadgetUrl" ); - + var newGadgetUrl = $('#gadgetUrl'); + // Input fields for container event testing - var newEventTopic = $( "#eventTopic" ); - var newEventPayload = $( "#eventPayload" ); - + var newEventTopic = $('#eventTopic'); + var newEventPayload = $('#eventPayload'); + // Base html template that is used for the gadget wrapper and site - var gadgetTemplate ='

    ' + - '
    sample to replace
    '+ + var gadgetTemplate = '
    ' + + '
    sample to replace
    ' + '
    ' + '
    '; - + //variable to keep track of gadget current view for collapse and expand gadget actions. - var currentView="default"; - + var currentView = 'default'; + // ID used to associate gadget site var curId = 0; - + // Load the default collections stored and update the options with the collection name $.ajax({ url: './gadgetCollections.json', dataType: 'json', success: function(data) { - $.each(data.collections, function(i,data){ + $.each(data.collections, function(i,data) { var optionVal = []; - $.each(data.apps, function(i,data){ - if (data.url.indexOf("http") < 0 && data.url.indexOf("/") == 0 ){ - optionVal.push(urlBase+data.url); - }else{ + $.each(data.apps, function(i,data) { + if (data.url.indexOf('http') < 0 && data.url.indexOf('/') == 0) { + optionVal.push(urlBase + data.url); + }else { optionVal.push(data.url); } }); - $('#gadgetCollection').append(''); + $('#gadgetCollection').append(''); }); } - }); - + }); + $.ajax({ url: './viewsMenu.json', dataType: 'json', success: function(data) { - $.each(data.views, function(i,selection){ - $('#viewOptions').append(''); + $.each(data.views, function(i,selection) { + $('#viewOptions').append(''); }); } }); - + //navigate to the new view and save it as current view - navigateView=function(gadgetSite, gadgetURL, toView){ + navigateView = function(gadgetSite, gadgetURL, toView) { //save the current view for collapse, expand gadget currentView = toView; - CommonContainer.navigateView(gadgetSite,gadgetURL,toView); + CommonContainer.navigateView(gadgetSite, gadgetURL, toView); }; - + //handle gadget collapse, expand, and remove gadget actions - handleNavigateAction=function(portlet,gadgetSite,gadgetURL,actionId){ + handleNavigateAction = function(portlet,gadgetSite,gadgetURL,actionId) { //remove button was click, remove the portlet/gadget - if(actionId==="remove"){ - if(confirm('This gadget will be removed, ok?')) { + if (actionId === 'remove') { + if (confirm('This gadget will be removed, ok?')) { portlet.remove(); - } - }else if (actionId==="expand" ){ + } + }else if (actionId === 'expand') { //navigate to currentView prior to colapse gadget - CommonContainer.navigateView(gadgetSite,gadgetURL,currentView); - }else if (actionId==="collapse"){ + CommonContainer.navigateView(gadgetSite, gadgetURL, currentView); + }else if (actionId === 'collapse') { CommonContainer.colapseGadget(gadgetSite); - } + } }; - + //create a gadget with navigation tool bar header enabling gadget collapse, expand, remove, navigate to view actions. - buildGadget=function(result,gadgetURL){ - var gadgetSiteString="$(this).closest(\'.portlet\').find(\'.portlet-content\').data(\'gadgetSite\')"; - var viewItems = ""; + buildGadget = function(result,gadgetURL) { + var gadgetSiteString = "$(this).closest(\'.portlet\').find(\'.portlet-content\').data(\'gadgetSite\')"; + var viewItems = ''; var gadgetViews = result[gadgetURL].views; - for(var aView in gadgetViews){ - viewItems = viewItems+'
  • '+aView+'
  • '; + for (var aView in gadgetViews) { + viewItems = viewItems + '
  • ' + aView + '
  • '; } var newGadgetSite = gadgetTemplate; - newGadgetSite = newGadgetSite.replace(/(gadget-site)/g,'$1-'+ curId); - $(newGadgetSite).appendTo($( '#gadgetArea' )).addClass("ui-widget ui-widget-content ui-helper-clearfix ui-corner-all") - .find(".portlet-header") - .addClass("ui-widget-header ui-corner-all") + newGadgetSite = newGadgetSite.replace(/(gadget-site)/g, '$1-' + curId); + $(newGadgetSite).appendTo($('#gadgetArea')).addClass('ui-widget ui-widget-content ui-helper-clearfix ui-corner-all') + .find('.portlet-header') + .addClass('ui-widget-header ui-corner-all') .text(result[gadgetURL]['modulePrefs'].title) - .append('
      '+ - '
    • '+ - ''+ - '
        '+ + .append('
          ' + + '
        • ' + + '' + + '
            ' + viewItems + - '
          '+ - '
        • '+ + '
        ' + + '' + '
      ') - .append('') + .append('') .append('') .append('') .end() - .find(".portlet-content") - .data("gadgetSite", CommonContainer.renderGadget(gadgetURL, curId)); - + .find('.portlet-content') + .data('gadgetSite', CommonContainer.renderGadget(gadgetURL, curId)); + //determine which button was click and handle the appropriate event. - $(".portlet-header .ui-icon").click(function(){ - handleNavigateAction($(this).closest('.portlet'),$(this).closest('.portlet').find(".portlet-content").data("gadgetSite"),gadgetURL,this.id); - }); + $('.portlet-header .ui-icon').click(function() { + handleNavigateAction($(this).closest('.portlet'), $(this).closest('.portlet').find('.portlet-content').data('gadgetSite'), gadgetURL, this.id); + }); }; - + // Publish the container event - $( "#pubEvent" ).click(function() { + $('#pubEvent').click(function() { CommonContainer.inlineClient.publish(newEventTopic.val(), newEventPayload.val()); - + //TODO: Need to add in some additional logic in the Container to enable point to point for things like Embedded Experience... - + //var ppcont = CommonContainer.managedHub.getContainer("__gadget_1"); //CommonContainer.managedHub.publishForClient(ppcont, newEventTopic.val(), newEventPayload.val()); //ppcont.sendToClient('org.apache.shindig.random-number', '1111', ppcont.getClientID()); //clear values - newEventTopic.val( "" ); - newEventPayload.val( "" ); - return true; + newEventTopic.val(''); + newEventPayload.val(''); + return true; }); - + // Load single gadgets entered by user - $( "#addGadget" ).click(function() { - CommonContainer.preloadGadget(newGadgetUrl.val(), function(result){ + $('#addGadget').click(function() { + CommonContainer.preloadGadget(newGadgetUrl.val(), function(result) { for (var gadgetURL in result) { - buildGadget(result,gadgetURL); + buildGadget(result, gadgetURL); curId++; } //Clear Values - newGadgetUrl.val( "" ); + newGadgetUrl.val(''); }); - - return true; + + return true; }); - + // Load the select collection of gadgets and render them the gadget test area - $( "#addGadgets" ).click(function() { - + $('#addGadgets').click(function() { + //TODO: This just provides and example to load configurations //var testGadgets=["http://localhost:8080/container/sample-pubsub-2-publisher.xml","http://localhost:8080/container/sample-pubsub-2-subscriber.xml"]; - var testGadgets = $('#gadgetCollection').val().split(","); - CommonContainer.preloadGadgets(testGadgets, function(result){ + var testGadgets = $('#gadgetCollection').val().split(','); + CommonContainer.preloadGadgets(testGadgets, function(result) { for (var gadgetURL in result) { - buildGadget(result,gadgetURL); + buildGadget(result, gadgetURL); curId++; } - + }); - return true; - + return true; + }); - -}); \ No newline at end of file + +}); Modified: shindig/trunk/content/samplecontainer/examples/conservcontainer/ConServContainer.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/conservcontainer/ConServContainer.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/conservcontainer/ConServContainer.js (original) +++ shindig/trunk/content/samplecontainer/examples/conservcontainer/ConServContainer.js Wed Jul 20 08:42:09 2011 @@ -4,42 +4,42 @@ var CommonContainer = new osapi.containe // Wrapper function to set the gadget site/id and default width. CommonContainer.renderGadget = function(gadgetURL, gadgetId) { // going to hardcode these values for width. - var el = document.getElementById("gadget-site-" + gadgetId); + var el = document.getElementById('gadget-site-' + gadgetId); var parms = {}; - parms[osapi.container.RenderParam.WIDTH] = "100%"; + parms[osapi.container.RenderParam.WIDTH] = '100%'; var gadgetSite = CommonContainer.newGadgetSite(el); CommonContainer.navigateGadget(gadgetSite, gadgetURL, {}, parms); return gadgetSite; }; // Function for pre-rendering gadgets. Gadget pre-rendering -// occurs when an action contributed by a pre-loaded gadget +// occurs when an action contributed by a pre-loaded gadget // is executed. function preRenderGadget(gadgetUrl, opt_metadata) { var gadgetId = getGadgetId(gadgetUrl); - var el = $("#gadget-site-" + gadgetId); + var el = $('#gadget-site-' + gadgetId); var gadgetSite = CommonContainer.renderGadget(gadgetUrl, gadgetId); - el.data("gadgetSite", gadgetSite); + el.data('gadgetSite', gadgetSite); return gadgetSite; -}; +} // Common container init function. -CommonContainer.init = new function(){ +CommonContainer.init = new function() { // Map needed for lazy loading of gadgets urlsToGadgetIdMap = {}; - + // Register our rendering functions with the action service if (CommonContainer.actions) { // Called when an action should be displayed in the container CommonContainer.actions.registerShowActionHandler(showAction); - + // Called when a action should be removed from the container CommonContainer.actions.registerHideActionHandler(hideAction); - + // Called for actions contributed by pre-loaded gadgets (lazy load) CommonContainer.actions.registerNavigateGadgetHandler(preRenderGadget); } -}; +} // Support for lazy loading gadgets function getGadgetId(url) { @@ -56,10 +56,10 @@ CommonContainer.addGadgetToPage = functi // Wrapper function to expand a gadget CommonContainer.navigateView = function(gadgetSite, gadgetURL, view) { var renderParms = {}; - if (view === null || view === "") { - view = "default"; + if (view === null || view === '') { + view = 'default'; } - renderParms[osapi.container.RenderParam.WIDTH] = "100%"; + renderParms[osapi.container.RenderParam.WIDTH] = '100%'; renderParms['view'] = view; CommonContainer.navigateGadget(gadgetSite, gadgetURL, {}, renderParms); }; @@ -80,15 +80,15 @@ osapi.people.getViewerFriends = function return osapi.people.get(options); }; -// Function to display actions -function showAction(itemObj) { +// Function to display actions +function showAction(itemObj) { if (!itemObj.path && !itemObj.dataType) { // object is invalid! return; } // bind the action to the specified data object type if (itemObj.dataType) { - if (itemObj.dataType == "opensocial.Person") { + if (itemObj.dataType == 'opensocial.Person') { addPersonAction(itemObj); } } @@ -96,78 +96,78 @@ function showAction(itemObj) { if (itemObj.path && itemObj.path.length > 0) { addContainerAction(itemObj); } -}; +} // Adds the specified action to a person element. function addPersonAction(itemObj) { // select all person elements - var personActionDiv = $(".personActions"); - + var personActionDiv = $('.personActions'); + // create a link and append it to each person element var actionStr = ''; if (itemObj.icon && itemObj.icon.length > 0) { - actionStr += ''; + actionStr += ''; } - actionStr += ''+itemObj.label+''; - actionStr = ''+actionStr+''; + actionStr += '' + itemObj.label + ''; + actionStr = '' + actionStr + ''; var actionLink = $(actionStr); - + // add a separator if needed if (personActionDiv.children().length > 0) { - personActionDiv.append(" | "); - } - + personActionDiv.append(' | '); + } + // select all links that were added and set the click handler personActionDiv.append(actionLink); - $('a[name="person-action-'+itemObj.id+'"]').each(function(i) { + $('a[name="person-action-' + itemObj.id + '"]').each(function(i) { $(this).click(function() { CommonContainer.actions.runAction(itemObj.id); }); - }); -}; + }); +} // Adds an action to the container UI function addContainerAction(itemObj) { - var pathParts = itemObj.path.split("/"); + var pathParts = itemObj.path.split('/'); var pathType = pathParts.shift(); var pathScope = pathParts.shift(); - var remainingPath = pathParts.join("/"); + var remainingPath = pathParts.join('/'); var contributionBar; - + // right now we support contributing to the global menubar - if (pathType == "container" && pathScope == "navigationLinks") { + if (pathType == 'container' && pathScope == 'navigationLinks') { contributionBar = $('#globalMenubar'); contributionBar.show(); } - + // create the action element var actionStr = ''; if (itemObj.icon && itemObj.icon.length > 0) { - actionStr += ''; + actionStr += ''; } - actionStr += '' - +itemObj.label+''; - actionStr = ''+actionStr+''; + actionStr += '' + + itemObj.label + ''; + actionStr = '' + actionStr + ''; var actionLink = $(actionStr); - + // add a separator if needed if (contributionBar.children().length > 0) { - contributionBar.append(" | "); + contributionBar.append(' | '); } - + // add the new action - contributionBar.append(actionLink); - actionLink.click(function(){ + contributionBar.append(actionLink); + actionLink.click(function() { CommonContainer.actions.runAction(itemObj.id); }); -}; +} -// Function to hide actions -function hideAction(itemObj) { +// Function to hide actions +function hideAction(itemObj) { if (itemObj.path || itemObj.dataType) { // remove the action from the specified data object type - if (itemObj.dataType && itemObj.dataType == "opensocial.Person") { + if (itemObj.dataType && itemObj.dataType == 'opensocial.Person') { removePersonAction(itemObj); } // remove the action to the specified path (container UI elements) @@ -175,17 +175,17 @@ function hideAction(itemObj) { removeContainerAction(itemObj); } } -}; +} // Removes the specified action from a person element. function removePersonAction(itemObj) { // hack - actions should be removed individually - $(".personActions").empty(); -}; + $('.personActions').empty(); +} // Removes the specified action from the container UI function removeContainerAction(itemObj) { // hack - actions should be removed individually $('#globalMenubar').empty(); $('#globalMenubar').hide(); -}; +} Modified: shindig/trunk/content/samplecontainer/examples/conservcontainer/layout.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/conservcontainer/layout.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/conservcontainer/layout.js (original) +++ shindig/trunk/content/samplecontainer/examples/conservcontainer/layout.js Wed Jul 20 08:42:09 2011 @@ -20,22 +20,22 @@ // Setup the base container objects for managing layout, gadget, and container configuration $(function() { // TODO: enable drag and drop with the portlet at some point - $(".column").sortable({ - connectWith : '.column', - update : function(event, ui) { + $('.column').sortable({ + connectWith: '.column', + update: function(event, ui) { // TODO: There is an issue with drag & drop } }); - $(".portlet").addClass( - "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all").find( - ".portlet-header").addClass("ui-widget-header ui-corner-all").prepend( + $('.portlet').addClass( + 'ui-widget ui-widget-content ui-helper-clearfix ui-corner-all').find( + '.portlet-header').addClass('ui-widget-header ui-corner-all').prepend( '').end().find( - ".portlet-content"); - $(".portlet-header .ui-icon").click(function() { - $(this).toggleClass("ui-icon-minusthick").toggleClass("ui-icon-plusthick"); - $(this).parents(".portlet:first").find(".portlet-content").toggle(); + '.portlet-content'); + $('.portlet-header .ui-icon').click(function() { + $(this).toggleClass('ui-icon-minusthick').toggleClass('ui-icon-plusthick'); + $(this).parents('.portlet:first').find('.portlet-content').toggle(); }); - $(".column").disableSelection(); + $('.column').disableSelection(); }); Modified: shindig/trunk/content/samplecontainer/examples/conservcontainer/viewController.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/conservcontainer/viewController.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/conservcontainer/viewController.js (original) +++ shindig/trunk/content/samplecontainer/examples/conservcontainer/viewController.js Wed Jul 20 08:42:09 2011 @@ -1,30 +1,30 @@ $(function() { - + // Base html template that is used for the gadget wrapper and site - var gadgetTemplate ='
      ' + + var gadgetTemplate = '
      ' + '
      ' + 'sample to replace
      ' + '
      ' + '
      '; - - // Variable to keep track of gadget current view + + // Variable to keep track of gadget current view // for collapse and expand gadget actions. - var currentView="default"; - + var currentView = 'default'; + // ID used to associate gadget site var curId = 0; - + // Navigate to the new view and save it as current view - navigateView = function(gadgetSite, gadgetURL, toView){ + navigateView = function(gadgetSite, gadgetURL, toView) { // Save the current view for collapse, expand gadget currentView = toView; - CommonContainer.navigateView(gadgetSite,gadgetURL,toView); + CommonContainer.navigateView(gadgetSite, gadgetURL, toView); }; - + // Handle gadget collapse, expand, and remove gadget actions handleNavigateAction = function(portlet, gadgetSite, gadgetURL, actionId) { // Remove button was click, remove the portlet/gadget - if (actionId === "remove") { + if (actionId === 'remove') { if (confirm('This gadget will be removed, ok?')) { if (gadgetSite) { CommonContainer.closeGadget(gadgetSite); @@ -35,7 +35,7 @@ $(function() { } portlet.remove(); } - } else if (actionId === "expand") { + } else if (actionId === 'expand') { // Navigate to currentView prior to collapse gadget if (gadgetSite) { CommonContainer.navigateView(gadgetSite, gadgetURL, currentView); @@ -43,59 +43,59 @@ $(function() { else { preRenderGadget(gadgetURL); } - } else if (actionId === "collapse") { + } else if (actionId === 'collapse') { CommonContainer.closeGadget(gadgetSite); } }; - - // Create a gadget with navigation tool bar header + + // Create a gadget with navigation tool bar header // enabling gadget collapse, expand and remove. buildGadget = function(result,gadgetURL,lazyload) { - var gadgetSiteString="$(this).closest(\'.portlet\')." + - "find(\'.portlet-content\').data(\'gadgetSite\')"; + var gadgetSiteString = "$(this).closest(\'.portlet\')." + + "find(\'.portlet-content\').data(\'gadgetSite\')"; var newGadgetSite = gadgetTemplate; - newGadgetSite = newGadgetSite.replace(/(portlet-id)/g,'$1-'+ curId); - newGadgetSite = newGadgetSite.replace(/(gadget-site)/g,'$1-'+ curId); + newGadgetSite = newGadgetSite.replace(/(portlet-id)/g, '$1-' + curId); + newGadgetSite = newGadgetSite.replace(/(gadget-site)/g, '$1-' + curId); var gadgetSiteData = null; - $(newGadgetSite).appendTo($( '#gadgetArea' )).addClass( - "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all") - .find(".portlet-header") - .addClass("ui-widget-header ui-corner-all") + $(newGadgetSite).appendTo($('#gadgetArea')).addClass( + 'ui-widget ui-widget-content ui-helper-clearfix ui-corner-all') + .find('.portlet-header') + .addClass('ui-widget-header ui-corner-all') .text(result[gadgetURL]['modulePrefs'].title) - .append('') + .append('') .append('') .append('') .end() - .find(".portlet-content") - .data("gadgetSite", lazyload ? null : + .find('.portlet-content') + .data('gadgetSite', lazyload ? null : CommonContainer.renderGadget(gadgetURL, curId)); - + // determine which button was clicked and handle the appropriate event. - $("#portlet-id-"+curId+" > .ui-icon").click( + $('#portlet-id-'+ curId + ' > .ui-icon').click( function() { handleNavigateAction( - $(this).closest('.portlet'), - $(this).closest('.portlet').find(".portlet-content") - .data("gadgetSite"), - gadgetURL,this.id); + $(this).closest('.portlet'), + $(this).closest('.portlet').find('.portlet-content') + .data('gadgetSite'), + gadgetURL, this.id); } - ); - + ); + var gadgetId = urlsToGadgetIdMap[gadgetURL]; if (!gadgetId) { urlsToGadgetIdMap[gadgetURL] = curId; } }; - - // Add single gadget - addGadget=function(gadgetUrl, lazyload) { - CommonContainer.preloadGadget(gadgetUrl, function(result){ + + // Add single gadget + addGadget = function(gadgetUrl, lazyload) { + CommonContainer.preloadGadget(gadgetUrl, function(result) { for (var gadgetURL in result) { - buildGadget(result,gadgetURL, lazyload); + buildGadget(result, gadgetURL, lazyload); curId++; } }); - return true; + return true; }; - -}); \ No newline at end of file + +}); Modified: shindig/trunk/content/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml (original) +++ shindig/trunk/content/samplecontainer/examples/embeddedexperiences/AlbumViewer.xml Wed Jul 20 08:42:09 2011 @@ -50,8 +50,8 @@ clear: both; } - - + + - +
      Modified: shindig/trunk/content/samplecontainer/examples/embeddedexperiences/EEContainer.js URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/embeddedexperiences/EEContainer.js?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/embeddedexperiences/EEContainer.js (original) +++ shindig/trunk/content/samplecontainer/examples/embeddedexperiences/EEContainer.js Wed Jul 20 08:42:09 2011 @@ -17,16 +17,16 @@ */ //The URL to request the activity stream -var ACTIVITY_STREAMS_URL = "http://localhost:8080/social/rest/activitystreams/john.doe/"; +var ACTIVITY_STREAMS_URL = 'http://localhost:8080/social/rest/activitystreams/john.doe/'; //When the document is ready kick off the request so we can render the activity stream $(document).ready(function() { - var makeRequestParams = {"CONTENT_TYPE" : "JSON", "METHOD" : "GET", "POST_DATA" : {}}; + var makeRequestParams = {'CONTENT_TYPE' : 'JSON', 'METHOD' : 'GET', 'POST_DATA' : {}}; gadgets.io.makeNonProxiedRequest( - ACTIVITY_STREAMS_URL, + ACTIVITY_STREAMS_URL, function(response) {renderAS(response.data);}, makeRequestParams, - "application/javascript" + 'application/javascript' ); }); @@ -34,31 +34,31 @@ $(document).ready(function() { //Initiate the common container code and register any RPC listeners for embedded experiences var CommonContainer = new osapi.container.Container({}); -CommonContainer.init = new function(){ - +CommonContainer.init = new function() { + CommonContainer.rpcRegister('ee_gadget_rendered', gadgetRendered); - - CommonContainer.views.createElementForEmbeddedExperience = function(opt_viewTarget){ + + CommonContainer.views.createElementForEmbeddedExperience = function(opt_viewTarget) { return document.getElementById('preview'); }; - - CommonContainer.views.destroyElement = function(site){ + + CommonContainer.views.destroyElement = function(site) { CommonContainer.ee.close(site); }; } /** * Handles the RPC request letting the container know that the embedded experience gadget is rendered. - * @param rpcArgs the RPC args from the request - * @param data any data passed in from the caller - * @return void + * @param rpcArgs the RPC args from the request. + * @param data any data passed in from the caller. + * @return void. */ -function gadgetRendered(rpcArgs, data){ +function gadgetRendered(rpcArgs, data) { var gadgetSite = rpcArgs.gs; var renderParams = gadgetSite.currentGadgetHolder_.renderParams_; var eeDataModel = renderParams.eeDataModel; var context = null; - if(eeDataModel){ + if (eeDataModel) { context = eeDataModel.context; } rpcArgs.callback(context); @@ -66,15 +66,15 @@ function gadgetRendered(rpcArgs, data){ /** * Renders the activity stream on the page - * @param stream the activity stream json - * @return void + * @param stream the activity stream json. + * @return void. */ -function renderAS(stream){ +function renderAS(stream) { jQuery.each(stream.entry, createAccordianEntry); - $("#accordion").accordion({ + $('#accordion').accordion({ clearStyle: true, active: false, - change: function(event, ui){ + change: function(event, ui) { closeCurrentGadget(); onAccordionChange(stream, event, ui); } @@ -86,13 +86,13 @@ function renderAS(stream){ * Closes the current gadget when a new accordian is selected. */ var currentEESite; -function closeCurrentGadget(){ - if(currentEESite) +function closeCurrentGadget() { + if (currentEESite) CommonContainer.ee.close(currentEESite); - + var preview = document.getElementById('preview'); var previewChildren = preview.childNodes; - if(previewChildren.length > 0){ + if (previewChildren.length > 0) { var iframe = previewChildren[0]; var iframeId = iframe.getAttribute('id'); var site = CommonContainer.getGadgetSiteByIframeId_(iframeId); @@ -102,28 +102,28 @@ function closeCurrentGadget(){ /** * Called when a new accordian pane is opened. - * @param stream the activity stream for the accordian - * @param event the event that occurred - * @param ui the ui elements changing - * @return void + * @param stream the activity stream for the accordian. + * @param event the event that occurred. + * @param ui the ui elements changing. + * @return void. */ -function onAccordionChange(stream, event, ui){ +function onAccordionChange(stream, event, ui) { var id = ui.newHeader.context.id; var localStream = stream; var entry = localStream.entry[id]; var extensions = entry.openSocial; - if(extensions){ + if (extensions) { var embed = extensions.embed; - if(embed){ - var eeElement = document.getElementById("ee" + id); + if (embed) { + var eeElement = document.getElementById('ee' + id); var urlRenderingParams = { 'height' : 400, 'width' : 650 }; - currentEESite = CommonContainer.ee.navigate(eeElement, embed, - {'urlRenderParams' : urlRenderingParams}, function(site, metaData){ - console.log("Embedded Experiences callback called"); + currentEESite = CommonContainer.ee.navigate(eeElement, embed, + {'urlRenderParams' : urlRenderingParams}, function(site, metaData) { + console.log('Embedded Experiences callback called'); console.log(gadgets.json.stringify(metaData)); }); } @@ -134,15 +134,15 @@ function onAccordionChange(stream, event /** * Called for each activity entry and adds the necessary HTML to the page. - * @param i the item in the activity stream we are currently rendering - * @param entry the activity stream entry json - * @return void + * @param i the item in the activity stream we are currently rendering. + * @param entry the activity stream entry json. + * @return void. */ -function createAccordianEntry(i, entry){ +function createAccordianEntry(i, entry) { var result = '

      ' + entry.title + '

      '; - if(entry.body) + if (entry.body) result = result + '

      ' + entry.body + '

      '; result = result + '
      '; $('#accordion').append(result); -} \ No newline at end of file +} Modified: shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml URL: http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml?rev=1148651&r1=1148650&r2=1148651&view=diff ============================================================================== --- shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml (original) +++ shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml Wed Jul 20 08:42:09 2011 @@ -34,27 +34,25 @@ padding: 2px 2px 2px 2px; border: 1px solid black; } - + #wrapper{ border: 1px solid black; } - + #header{ font-size: 120%; padding: 10px 10px 10px 10px; color: #0F67A1; - } - + } + .clear{ clear: both; - } + } - - - - +