Orkut Application Platform

On-Site Application Developer Guide: Profile View

Contents

What is the Profile View?

Normally, users interact with an application by running it on its own page, where the application occupies most of the screen space. This is called "canvas view", and is what most users and developer mean when they say "running an application." However, this is not the only way the user can view the application: Orkut also has a "profile view", which is rendered when the user configures the application to appear on his profile, as illustrated below:



Profile View

In the current Orkut UI, there is only space for a single slot to display applications on the profile, so the user has to select which one of his applications will show. Only applications that contain a <Content> tag with the attribute view="profile" will appear as choices in that list.

Writing an Application with a Profile View

To provide a profile view on your application, you must provide a <Content> tag with an attribute of view="profile" in your XML. The content in that tag defines the application's Profile View:

<?xml version="1.0" encoding="UTF-8"?>
<Module>
  <ModulePrefs 
     title="Your Title Here"
     author="Your Name Here"
     author_email="you@example.com"
     description="Description of your application goes here"
     screenshot="http://url/of/your/screenshot.jpg"
     thumbnail="http://url/of/your/thumbnail.jpg"
     >

    <Require feature="opensocial-0.8" />
    <Require feature="opensocial-data" />
    <Require feature="opensocial-templates" />
  </ModulePrefs>
  <Content type="html" view="profile">
    <![CDATA[      
     <!-- your profile view content here -->
    ]]>
  </Content>
  <Content type="html">
    <![CDATA[      
     <!-- your canvas view content here -->
    ]]>
  </Content>
</Module>

Notice that we included <Require> tags for both opensocial-data and opensocial-templates, which we will use next.

Important: For security reasons, the Profile View of applications cannot contain arbitrary scripts. Only templates and OpenSocial data pipelining are allowed.

Using Templates and Data Pipelining

You can use OpenSocial templates and data pipelining on the profile view of your Orkut applications, as illustrated below. This example lists the name of all of the viewer's friends.

<?xml version="1.0" encoding="UTF-8"?>
<Module>
  <ModulePrefs 
     title="Your Title Here"
     author="Your Name Here"
     author_email="you@example.com"
     description="Description of your application goes here"
     screenshot="https://url/of/your/screenshot.jpg"
     thumbnail="https://url/of/your/thumbnail.jpg"
     >

    <Require feature="opensocial-0.8" />
    <Require feature="opensocial-data" />
    <Require feature="opensocial-templates" />
  </ModulePrefs>
  <Content type="html" view="profile">
    <![CDATA[      
      <script xmlns:os="http://ns.opensocial.org/2008/markup" type="text/os-data">
        <os:PeopleRequest key="friends" userId="@viewer" groupId="@friends"/>
      </script>

      <script type="text/os-template">
        <ul>
          <li repeat="${friends}">
            <span id="id${Context.Index}">${Cur.name.givenName}</span>
          </li>
        </ul>
     </script>
    ]]>
  </Content>
</Module>

For more information, please consult the OpenSocial Data Pipelining Specification (0.9).

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.