You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Terlecki, Stephen" <st...@lmco.com> on 2009/05/06 21:45:31 UTC

How to output App Data within an Opensocial Template using client side processing

I have a template that I am now using client side processing (thanks
Lev) to output.  I am making opensocial data requests to retrieve data
and then render into the template.  When I try to process App Data,
however, there is no way to represent data for a single person using
opensocial templates.

 

Here is an example of what I am doing:

 

<script type="text/os-template" name="basictemplate"
xmlns:os=http://ns.opensocial.org/2008/markup>

                <div>Owner id is ${ownerinfo.displayName}</div>

                <div>Owner data key=key1 value=${ownerdata.2.key1}</div>

</script>

 

<div id="renderhere"></div>

 

<script type="text/javascript">

                function getData()

                {

                                var req = opensocial.newDataRequest();

 
req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER),
'ownerinfo');

 
req.add(req.newFetchPersonAppDataRequest(opensocial.newIdSpec({userId :
'OWNER'}), 'key1'), 'ownerdata');

                                req.send(render);

                }

 

                function render(data)

{

                var basicTemplate =
opensocial.template.getTemplate('basictemplate');

 
basicTemplate.renderInto(document.getElementById("renderhere"), data);

                gadgets.window.adjustHeight();

                }

 

                gadgets.util.registerOnLoadHandler(getData);

</script>

 

The request returns a JSON dataset that looks like this:

 

[{"id":"ownerinfo","data":{"id":"1","name":{"formatted":"Steve
Here"},"displayName":"Steve"

}},{"id":"ownerdata","data":{"1":{"key3":"value3","key4":"value4","key1"
:"value1","key2":"value2"

}}}]

 

Owner info displays fine in the opensocial template, but notice the App
Data for the owner it has the person id in the middle, so within the
opensocial template I have to refer to it this way ${ownerdata.2.key1}.
Does anyone know another way of doing this, obviously the "2" in the
middle is no good.  Am I requesting the data wrong?

 

Any help would be appreciated.

 

Steve T.


Re: OpenSocialHelp Community

Posted by Lane LiaBraaten <ll...@google.com>.
Have you seen opensocial.org?  It's also running on Ning and provides a lot
of the same resources.

-Lane

On Wed, May 6, 2009 at 12:51 PM, Fisher, Tim <Ti...@compuware.com>wrote:

> A little while ago, I started a community site with the intention of
> providing a place for developers working on any aspect of OpenSocial
> development to collaborate and share knowledge.  The site is a Ning
> community and includes forums, profiles, groups, blogs, and more.
>
> I think it can provide an excellent opportunity for those of us in the
> trenches to work together and help each other out.
>
> If you are interested in joining, you can sign up at:
>
> http://opensocialhelp.ning.com
>
>
> Thanks,
> Timothy Fisher
> Systems Architect
> Covisint, a subsidiary of Compuware
> The contents of this e-mail are intended for the named addressee only. It
> contains information that may be confidential. Unless you are the named
> addressee or an authorized designee, you may not copy or use it, or disclose
> it to anyone else. If you received it in error please notify us immediately
> and then destroy it.
>

Re: OpenSocialHelp Community

Posted by Leandro Milmanda Perez <le...@gmail.com>.
This is a very good idea...  We should have our own social network to
communicate btw socialsite members (powered by Socialsite :) ).

Leo.

On Wed, May 6, 2009 at 4:51 PM, Fisher, Tim <Ti...@compuware.com> wrote:
> A little while ago, I started a community site with the intention of
> providing a place for developers working on any aspect of OpenSocial
> development to collaborate and share knowledge.  The site is a Ning
> community and includes forums, profiles, groups, blogs, and more.
>
> I think it can provide an excellent opportunity for those of us in the
> trenches to work together and help each other out.
>
> If you are interested in joining, you can sign up at:
>
> http://opensocialhelp.ning.com
>
>
> Thanks,
> Timothy Fisher
> Systems Architect
> Covisint, a subsidiary of Compuware
> The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@socialsite.dev.java.net
> For additional commands, e-mail: dev-help@socialsite.dev.java.net
>
>

OpenSocialHelp Community

Posted by "Fisher, Tim" <Ti...@compuware.com>.
A little while ago, I started a community site with the intention of
providing a place for developers working on any aspect of OpenSocial
development to collaborate and share knowledge.  The site is a Ning
community and includes forums, profiles, groups, blogs, and more.

I think it can provide an excellent opportunity for those of us in the
trenches to work together and help each other out.

If you are interested in joining, you can sign up at:

http://opensocialhelp.ning.com


Thanks,
Timothy Fisher
Systems Architect
Covisint, a subsidiary of Compuware
The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.

RE: How to output App Data within an Opensocial Template using client side processing

Posted by "Terlecki, Stephen" <st...@lmco.com>.
I gave that a shot and the entire div doesn't get rendered.  I am not
getting any javascript errors, but the jscontent attribute of the tag
seems to be incorrect.  It appears that the template compiler is not
recognizing the embedded references correctly.  It is close, and it
looks like it might just be a parsing issue.  I will look into this a
little closer.

-----Original Message-----
From: Lane LiaBraaten [mailto:lliabraa@google.com]
Sent: Wednesday, May 06, 2009 4:21 PM
To: shindig-dev@incubator.apache.org
Subject: Re: How to output App Data within an Opensocial Template using
client side processing

You should be able to do it like this:

<div>Owner data key=key1 value=${ownerdata[owner.id].key1}</div>


-Lane


On Wed, May 6, 2009 at 12:45 PM, Terlecki, Stephen <
stephen.terlecki@lmco.com> wrote:

> I have a template that I am now using client side processing (thanks
> Lev) to output.  I am making opensocial data requests to retrieve data

> and then render into the template.  When I try to process App Data, 
> however, there is no way to represent data for a single person using 
> opensocial templates.
>
>
>
> Here is an example of what I am doing:
>
>
>
> <script type="text/os-template" name="basictemplate"
> xmlns:os=http://ns.opensocial.org/2008/markup>
>
>                <div>Owner id is ${ownerinfo.displayName}</div>
>
>                <div>Owner data key=key1 
> value=${ownerdata.2.key1}</div>
>
> </script>
>
>
>
> <div id="renderhere"></div>
>
>
>
> <script type="text/javascript">
>
>                function getData()
>
>                {
>
>                                var req = opensocial.newDataRequest();
>
>
> req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER),
> 'ownerinfo');
>
>
> req.add(req.newFetchPersonAppDataRequest(opensocial.newIdSpec({userId
:
> 'OWNER'}), 'key1'), 'ownerdata');
>
>                                req.send(render);
>
>                }
>
>
>
>                function render(data)
>
> {
>
>                var basicTemplate =
> opensocial.template.getTemplate('basictemplate');
>
>
> basicTemplate.renderInto(document.getElementById("renderhere"), data);
>
>                gadgets.window.adjustHeight();
>
>                }
>
>
>
>                gadgets.util.registerOnLoadHandler(getData);
>
> </script>
>
>
>
> The request returns a JSON dataset that looks like this:
>
>
>
> [{"id":"ownerinfo","data":{"id":"1","name":{"formatted":"Steve
> Here"},"displayName":"Steve"
>
>
}},{"id":"ownerdata","data":{"1":{"key3":"value3","key4":"value4","key1"
> :"value1","key2":"value2"
>
> }}}]
>
>
>
> Owner info displays fine in the opensocial template, but notice the 
> App Data for the owner it has the person id in the middle, so within 
> the opensocial template I have to refer to it this way
${ownerdata.2.key1}.
> Does anyone know another way of doing this, obviously the "2" in the 
> middle is no good.  Am I requesting the data wrong?
>
>
>
> Any help would be appreciated.
>
>
>
> Steve T.
>
>

Re: How to output App Data within an Opensocial Template using client side processing

Posted by Lane LiaBraaten <ll...@google.com>.
You should be able to do it like this:

<div>Owner data key=key1 value=${ownerdata[owner.id].key1}</div>


-Lane


On Wed, May 6, 2009 at 12:45 PM, Terlecki, Stephen <
stephen.terlecki@lmco.com> wrote:

> I have a template that I am now using client side processing (thanks
> Lev) to output.  I am making opensocial data requests to retrieve data
> and then render into the template.  When I try to process App Data,
> however, there is no way to represent data for a single person using
> opensocial templates.
>
>
>
> Here is an example of what I am doing:
>
>
>
> <script type="text/os-template" name="basictemplate"
> xmlns:os=http://ns.opensocial.org/2008/markup>
>
>                <div>Owner id is ${ownerinfo.displayName}</div>
>
>                <div>Owner data key=key1 value=${ownerdata.2.key1}</div>
>
> </script>
>
>
>
> <div id="renderhere"></div>
>
>
>
> <script type="text/javascript">
>
>                function getData()
>
>                {
>
>                                var req = opensocial.newDataRequest();
>
>
> req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER),
> 'ownerinfo');
>
>
> req.add(req.newFetchPersonAppDataRequest(opensocial.newIdSpec({userId :
> 'OWNER'}), 'key1'), 'ownerdata');
>
>                                req.send(render);
>
>                }
>
>
>
>                function render(data)
>
> {
>
>                var basicTemplate =
> opensocial.template.getTemplate('basictemplate');
>
>
> basicTemplate.renderInto(document.getElementById("renderhere"), data);
>
>                gadgets.window.adjustHeight();
>
>                }
>
>
>
>                gadgets.util.registerOnLoadHandler(getData);
>
> </script>
>
>
>
> The request returns a JSON dataset that looks like this:
>
>
>
> [{"id":"ownerinfo","data":{"id":"1","name":{"formatted":"Steve
> Here"},"displayName":"Steve"
>
> }},{"id":"ownerdata","data":{"1":{"key3":"value3","key4":"value4","key1"
> :"value1","key2":"value2"
>
> }}}]
>
>
>
> Owner info displays fine in the opensocial template, but notice the App
> Data for the owner it has the person id in the middle, so within the
> opensocial template I have to refer to it this way ${ownerdata.2.key1}.
> Does anyone know another way of doing this, obviously the "2" in the
> middle is no good.  Am I requesting the data wrong?
>
>
>
> Any help would be appreciated.
>
>
>
> Steve T.
>
>