Opensocial.requestCreateActivity()

Opensocial.requestCreateActivity() Description: Makes a request to the container to create the activity. Parameters include activity (instance of opensocial.Activity), p (priority, specified by opensocial .CreateActivityPriority.HIGH or LOW), and opt_callback (optional callback function to be called when activity is created). Object: Opensocial
Continue reading…

Enjoyed this post? Share it!

 
 

Opensocial.newNavigationalParameters()

Opensocial.newNavigationalParameters() Description: Redirects the user. Parameters include p (parameter map keyed with opensocial.NavagationalParameters.Field.* values that specify where to navigate to and when). Returns: opensocial.NavagationalParameters Object: Opensocial
Continue reading…

Enjoyed this post? Share it!

 
 

Opensocial.newMediaItem()

Opensocial.newMediaItem() Description: Creates a media item. Parameters include mt (type of media, specified by opensocial.MediaItem.Field.*), url (location of media, a string), and opt_params (optional parameters specifying additional fields). Returns: opensocial.MediaItem Object: Opensocial Example: var myVideo = opensocial.newMediaItem(opensocial.MediaItem.Field.VIDEO,"http://w3mentor.com/Video.mpg")
Continue reading…

Enjoyed this post? Share it!

 
 

Display a Drop-down List of Viewer’s Friends in Open Social

Complete example to Display a Drop-down List of Viewer’s Friends in Open Social var dataReqObj; var heading = ‘’; var friends_html; var TheFriends = new Array(); //function called initially in XML file, this makes data request //for friend.     function init() { //Create Data Request dataReqObj = opensocial.newDataRequest(); //create viewer request var viewerReq = […]
Continue reading…

Enjoyed this post? Share it!

 
 

Request and Display Basic Viewer Data in Open Social

Step 1. Request data: a. Create DataRequest object by calling opensocial.newDataRequest. b. For each request you wish to make, create it using one of the opensocial.new* methods. c. For each piece of data you want to request, add a request via DataRequest.add(request). d. Make a request by registering the callback function, DataRequest.send(callback). Step 2. Create […]
Continue reading…

Enjoyed this post? Share it!

 
 

Types of users in Open Social

Owner — This is the person who owns the account and has installed your application. Depending on container support, this can be specified with the string ‘OWNER’, opensocial.DataRequest.PersonId.OWNER, or opensocial.IdSpec.PersonId.OWNER. The latter is the accepted standard for the latest version of OpenSocial. Viewer — A viewer is a person logged in to the social network […]
Continue reading…

Enjoyed this post? Share it!

 
 

Multiple content tags in Open Social applications

<?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="Another Multiple Views Example"> <Require feature="opensocial-0.8"/> </ModulePrefs> <Content type="html" view="home"><![CDATA[ <h1>Home</h1> ]]></Content> <Content type="html" view="profile"><![CDATA[ <h1>Profile</h1> ]]></Content> <Content type="html" view="canvas"><![CDATA[ <h1>Canvas</h1> ]]></Content> <Content type="html" view="canvas,profile"><![CDATA[ I am in both the canvas and profile view but, NOT in the home view. ]]></Content> <Content type="html"><![CDATA[ I am in any view that is […]
Continue reading…

Enjoyed this post? Share it!

 
 

Multiple views in Open Social applications

<?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="Multiple Views Example"> <Require feature="opensocial-0.8"/> </ModulePrefs> <Content type="html" view="profile"><![CDATA[ <h1>Profile Content</h1> ]]></Content> <Content type="html" view="canvas"><![CDATA[ <h1>Canvas Content</h1> ]]></Content> </Module> Other Combinations: <Content views="canvas, home"> This means the contained content will be displayed for both ‘‘canvas’’ and ‘‘home’’ views. <Content> This will be the default content displayed for all views not […]
Continue reading…

Enjoyed this post? Share it!

 
 

Adjust the Height of an Open Social application

<?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="Hello World!" description="Hello World" title_url="http://www.hi5.com" author="w3mentor" author_email="w3mentor@w3m.com" author_affiliation="w3mentor" author_location="usa" thumbnail="http://w3mentor.com/Logo.png"> <Icon>http://w3mentor.com/Logo-16×16.png</Icon> <Require feature="dynamic-height"/> <Require feature="opensocial-0.8"/> </ModulePrefs> <Content type="html"><![CDATA[ Hello World! <script> // Call the init function onLoad gadgets.util.registerOnLoadHandler(init); function init() { gadgets.window.adjustHeight(50); } </script> ]]></Content> </Module>
Continue reading…

Enjoyed this post? Share it!

 
 

Detect user’s language in Open Social applications

<?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="Hello World!" description="Hello World" title_url="http://www.hi5.com" author="w3mentor" author_email="w3mentor@w3m.com" author_affiliation="w3mentor" author_location="usa" thumbnail="http://w3mentor.com/Logo.png"> <Icon>http://w3mentor.com/Logo-16×16.png</Icon> <Require feature="opensocial-0.8"/> </ModulePrefs> <Content type="html"><![CDATA[ Hello World! <div id="greeting" style="background: red;"> </div> <script> // Call the init function onLoad gadgets.util.registerOnLoadHandler(init); // function to learn users language and display it. function init() { var lang = "Not Known "; try{ […]
Continue reading…

Enjoyed this post? Share it!

 
 

Advanced Hello World in Open Social

<?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="Hello World!" description="Hello World" title_url="http://www.hi5.com" author="w3mentor" author_email="w3m@w3mentor.com" author_affiliation="w3m" author_location="USA" thumbnail="http://w3mentor.com/Logo.png"> <Icon>http://Me.com/Logo-16×16.png</Icon> <Require feature="opensocial-0.8"/> </ModulePrefs> <Content type="html"><![CDATA[ Hello, world! ]]></Content> </Module>
Continue reading…

Enjoyed this post? Share it!

 
 

ModulePrefs Elements and Attributes

title The short name associated with the application. This attribute is required to create/update an application. Minimum length is 1 character. Maximum length is 64 characters. Must use only the following characters: a-z, A-Z, 0-9, ‘,&, !, ., -, _, ?, [space]. Must start with a letter. description A short description of the application, used […]
Continue reading…

Enjoyed this post? Share it!

 
 

preferredHeight in content xml tag for open social

The following applies to <Content preferredHeight=""> tag: It Specifies the initial height desired for the surface. If not provided, then the height attribute from element is used. preferredHeight has a minimum value is 20 and a maximum value is 1000. If the preferredHeight is specified multiple times for the same view/surface, then the last one […]
Continue reading…

Enjoyed this post? Share it!