You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by ra...@apache.org on 2012/06/29 18:03:59 UTC
svn commit: r1355454 - in /rave/trunk:
rave-demo-gadgets/src/main/webapp/friends.xml
rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql
Author: raminder
Date: Fri Jun 29 16:03:57 2012
New Revision: 1355454
URL: http://svn.apache.org/viewvc?rev=1355454&view=rev
Log:
adding friend gadget for RAVE-690.
Added:
rave/trunk/rave-demo-gadgets/src/main/webapp/friends.xml
Modified:
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql
Added: rave/trunk/rave-demo-gadgets/src/main/webapp/friends.xml
URL: http://svn.apache.org/viewvc/rave/trunk/rave-demo-gadgets/src/main/webapp/friends.xml?rev=1355454&view=auto
==============================================================================
--- rave/trunk/rave-demo-gadgets/src/main/webapp/friends.xml (added)
+++ rave/trunk/rave-demo-gadgets/src/main/webapp/friends.xml Fri Jun 29 16:03:57 2012
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+ $Id:$
+-->
+<Module>
+ <ModulePrefs title="Friends" author="Viknes Balasubramanee"
+description="This gadget display the list of friends for a particular user">
+ <Require feature="opensocial-0.9"/>
+ <Require feature="dynamic-height" />
+ </ModulePrefs>
+ <Content type="html">
+ <![CDATA[
+ <script type="text/javascript">
+ function loadFriends() {
+ var req = opensocial.newDataRequest();
+ req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), 'viewer');
+ req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER), 'owner');
+ var viewerFriends = opensocial.newIdSpec({ "userId" : "VIEWER", "groupId" : "FRIENDS" });
+ var ownerFriends = opensocial.newIdSpec({ "userId" : "OWNER", "groupId" : "FRIENDS" });
+ var opt_params = {};
+ opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100;
+ req.add(req.newFetchPeopleRequest(viewerFriends, opt_params), 'viewerFriends');
+ req.add(req.newFetchPeopleRequest(ownerFriends, opt_params), 'ownerFriends');
+
+ req.send(onLoadFriends);
+ }
+
+ function onLoadFriends(data) {
+ var viewer = data.get('viewer').getData();
+ var viewerFriends = data.get('viewerFriends').getData();
+ var owner = data.get('viewer').getData();
+ var ownerFriends = data.get('ownerFriends').getData();
+
+ html = new Array();
+ html.push(owner.getDisplayName() + '\'s Friends('+ownerFriends.size()+') <br>');
+ html.push('<ul>');
+ ownerFriends.each(function(person) {
+ if (person.getId()) {
+ html.push('<li>', person.getDisplayName(), '</li>');
+ }
+ });
+ html.push('</ul>');
+ document.getElementById('friends').innerHTML = html.join('');
+ gadgets.window.adjustHeight();
+ }
+
+ function init() {
+ loadFriends();
+ }
+
+ gadgets.util.registerOnLoadHandler(init);
+ </script>
+ <div id='friends'/>
+ ]]>
+ </Content>
+</Module>
Modified: rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql
URL: http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql?rev=1355454&r1=1355453&r2=1355454&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql (original)
+++ rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql Fri Jun 29 16:03:57 2012
@@ -402,6 +402,13 @@ insert into widget (entity_id, title, ur
values(@pubsub_subscriber_widget_id, 'OpenAJAX Hub Subscriber', 'http://localhost:8080/container/sample-pubsub-2-subscriber.xml', 'OpenSocial', 'PUBLISHED', 'OpenAJAX Hub subscriber gadget from Shindig', 'Apache Shindig', @user_id_1);
UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @widget_seq;
+-- Friends Gadget
+set @friends_widget_id = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @widget_seq);
+insert into widget (entity_id, title, url, type, widget_status, description, author, owner_id)
+values(@friends_widget_id, 'Friends', 'http://localhost:8080/demogadgets/friends.xml', 'OpenSocial', 'PUBLISHED', 'This gadget display the list of friends for a particular user', 'Viknes Balasubramanee', @user_id_1);
+UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @widget_seq;
+
+
-- end gadget data ----
-- W3C Widget data