You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Gary Stevens <gs...@us.ibm.com> on 2009/04/30 22:15:02 UTC

How far has support for REST been implemented


Hello all,

I have been trying to get one gadget within one running version of Shindig
to pass data through the OpenSocial REST calls into a database within
another running copy of Shindig.  The problem I am having is that when I
try to use a gadgets.io.RequestParameters.METHOD of
gadgets.io.MethodType.POST or gadgets.io.MethodType.PUT it seems like a GET
is executed instead.  I have read online (at
http://sites.google.com/site/opensocialarticles/Home/shindig-rest-java)
that as of August 2008 only GET had been implemented in the OpenSocial REST
implementation while POST, PUT, and DELETE had not.  Which of the REST
calls are currently supported in the Java version of Shindig?

Thank you,
Gary F Stevens

Re: Template JS API

Posted by Lev Epshteyn <le...@google.com>.
FYI, client-side library support is up for review in a patch:

http://codereview.appspot.com/59046 and
https://issues.apache.org/jira/browse/SHINDIG-1046

This is currently limited to only loading one library due to the way
Shindig implements parameters
(see https://issues.apache.org/jira/browse/SHINDIG-997)

On Tue, May 5, 2009 at 1:13 PM, Terlecki, Stephen
<st...@lmco.com> wrote:
> I like the parameter approach better.
>
> Another question along this line:
>
> Are OpenSocial Template Libraries fully implemented within Shindig as it
> stands now?  I haven't been able to get template libraries to show in
> the client side opensocial.template api.  I just pulled down the current
> trunk this morning.  I have been stepping through the code and I can see
> that my Template Libraries are being read into the TagRegistry, but
> can't seem to find where the read-in template libraries go after that.
>
> -----Original Message-----
> From: Lev Epshteyn [mailto:levik@google.com]
> Sent: Tuesday, May 05, 2009 11:47 AM
> To: shindig-dev@incubator.apache.org
> Cc: Adam Winer; Evan Gilbert
> Subject: Re: Template JS API
>
> I'm probably going to be adding functionality to Shindig to control
> the removal/availability of client-side templating
>
> Do you think this should be done via
>
> A) Optional opensocial-templates-client feature
> B) <Param name="client">true|false|{auto}</Param> on
> opensocial-templates feature
>   - where true requests that client code be left in always, false
> requests its removal and auto preserves current logic
>
> ?
>
>>>> We should probably add a feature to Shindig to always enable
> client-side
>>>> processing.
>

Re: Template JS API

Posted by Lev Epshteyn <le...@google.com>.
At the moment the client doesn't fully support template libraries.

There exist a client-based opensocal.template.Loader which can load
libraries via URL, but as of yet, this is not integrated with the
server, nor does it auto-load libraries based on feature params.

The latter functionality is something I'm working on right now, and
hope to have a patch for it today or thursday.

On Tue, May 5, 2009 at 1:13 PM, Terlecki, Stephen
<st...@lmco.com> wrote:
> I like the parameter approach better.
>
> Another question along this line:
>
> Are OpenSocial Template Libraries fully implemented within Shindig as it
> stands now?  I haven't been able to get template libraries to show in
> the client side opensocial.template api.  I just pulled down the current
> trunk this morning.  I have been stepping through the code and I can see
> that my Template Libraries are being read into the TagRegistry, but
> can't seem to find where the read-in template libraries go after that.
>
> -----Original Message-----
> From: Lev Epshteyn [mailto:levik@google.com]
> Sent: Tuesday, May 05, 2009 11:47 AM
> To: shindig-dev@incubator.apache.org
> Cc: Adam Winer; Evan Gilbert
> Subject: Re: Template JS API
>
> I'm probably going to be adding functionality to Shindig to control
> the removal/availability of client-side templating
>
> Do you think this should be done via
>
> A) Optional opensocial-templates-client feature
> B) <Param name="client">true|false|{auto}</Param> on
> opensocial-templates feature
>   - where true requests that client code be left in always, false
> requests its removal and auto preserves current logic
>
> ?
>
>>>> We should probably add a feature to Shindig to always enable
> client-side
>>>> processing.
>

RE: Template JS API

Posted by "Terlecki, Stephen" <st...@lmco.com>.
I like the parameter approach better.

Another question along this line:

Are OpenSocial Template Libraries fully implemented within Shindig as it
stands now?  I haven't been able to get template libraries to show in
the client side opensocial.template api.  I just pulled down the current
trunk this morning.  I have been stepping through the code and I can see
that my Template Libraries are being read into the TagRegistry, but
can't seem to find where the read-in template libraries go after that.

-----Original Message-----
From: Lev Epshteyn [mailto:levik@google.com] 
Sent: Tuesday, May 05, 2009 11:47 AM
To: shindig-dev@incubator.apache.org
Cc: Adam Winer; Evan Gilbert
Subject: Re: Template JS API

I'm probably going to be adding functionality to Shindig to control
the removal/availability of client-side templating

Do you think this should be done via

A) Optional opensocial-templates-client feature
B) <Param name="client">true|false|{auto}</Param> on
opensocial-templates feature
   - where true requests that client code be left in always, false
requests its removal and auto preserves current logic

?

>>> We should probably add a feature to Shindig to always enable
client-side
>>> processing.

Re: Template JS API

Posted by Lev Epshteyn <le...@google.com>.
Yes, if the automatic heuristic of Shindig caused undesired behavior
by default (such as removing templates when they are needed or leaving
them in when they are not).

But I imagine other implementations would be faced with similar
constraints - so this could become a de-facto standard and make it
into the next version of the spec. Even if it doesn't, don't
containers ignore params they don't understand?

Finally, I don't believe there is a large body of existing gadgets
that would need to be modified...

On Tue, May 5, 2009 at 2:14 PM, Jordan Zimmerman <jo...@shop.com> wrote:
>>I'm not sure what you mean by "changing the gadget module". What I
>>meant for (B) was support for
>
> This would require each gadget hosted in a Shindig container to be
> changed. Or am I misunderstanding?
>
> Jordan Zimmerman
> Principal Software Architect
> 831.647.4712
> 831.214.2990 (cell)
> jordanz@shop.com
>
> SHOP*COMTM
> Shop Smart, Save Big(tm)
> www.shop.com
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.
>

RE: Template JS API

Posted by Jordan Zimmerman <jo...@shop.com>.
>I'm not sure what you mean by "changing the gadget module". What I
>meant for (B) was support for

This would require each gadget hosted in a Shindig container to be
changed. Or am I misunderstanding?

Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com 

SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com

This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this 
message
immediately if this is an electronic communication.

Thank you.

Re: Template JS API

Posted by Lev Epshteyn <le...@google.com>.
I'm not sure what you mean by "changing the gadget module". What I
meant for (B) was support for

<Require feature="opensocial-templates">
  <Param name="client">true</Param>
</Require>

as a way of preventing Shindig from stripping away client-side
templating support as an optimization.

You could also do

<Require feature="opensocial-templates">
  <Param name="client">false</Param>
</Require>

if you are sure you won't need client templating.

"auto" would be the default value which would mean Shindig would try
to use some heuristics to see if client templating should be left in.

On Tue, May 5, 2009 at 2:00 PM, Jordan Zimmerman <jo...@shop.com> wrote:
>>A) Optional opensocial-templates-client feature
>>B) <Param name="client">true|false|{auto}</Param> on
>>opensocial-templates feature
>
> For (B) do you mean changing the gadget module? If so, then I think this
> is a very bad idea. I vote for (A).
>
> Jordan Zimmerman
> Principal Software Architect
> 831.647.4712
> 831.214.2990 (cell)
> jordanz@shop.com
>
> SHOP*COMTM
> Shop Smart, Save Big(tm)
> www.shop.com
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.
>

RE: Template JS API

Posted by Jordan Zimmerman <jo...@shop.com>.
>A) Optional opensocial-templates-client feature
>B) <Param name="client">true|false|{auto}</Param> on
>opensocial-templates feature

For (B) do you mean changing the gadget module? If so, then I think this
is a very bad idea. I vote for (A).

Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com 

SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com

This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this 
message
immediately if this is an electronic communication.

Thank you.

Re: Template JS API

Posted by Lev Epshteyn <le...@google.com>.
I'm probably going to be adding functionality to Shindig to control
the removal/availability of client-side templating

Do you think this should be done via

A) Optional opensocial-templates-client feature
B) <Param name="client">true|false|{auto}</Param> on
opensocial-templates feature
   - where true requests that client code be left in always, false
requests its removal and auto preserves current logic

?

>>> We should probably add a feature to Shindig to always enable client-side
>>> processing.

Re: Template JS API

Posted by Lev Epshteyn <le...@google.com>.
The current logic in Shindig removes the client-side feature if it
determines that it can successfully process all the inline templates
on the server (that is, templates without a @tag attribute which have
all their data requirements met). Unfortunately this heuristic
includes the use case where there are NO inline templates but some
@tag-ed templates.

This is probably too agressive, and needs to be throttled back.

In the end, I don't think we can correctly infer all the use cases so
a param is probably needed. (The other solution is to make client-side
templating a separate, explicit feature)

On Sun, May 3, 2009 at 5:54 PM, Steve Terlecki <st...@gmail.com> wrote:
> I had a feeling something like this might have been happening because the
> exact same is in another gadget without tenplates works fine. Thanks for the
> help. I have something else to try.
>
> Steve T.
>
> On May 1, 2009, at 6:58 PM, Evan Gilbert <ui...@google.com> wrote:
>
>> Templates that can be entirely processed on the server side may strip out
>> the template JS (see
>>
>> http://www.google.com/codesearch/p?hl=en#MSH8LMSqi38/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/TemplateRewriter.java&q=%22opensocial-templates%22%20shindig&l=255
>> ).
>>
>> If this is a problem, a hack solution might be to add
>> <script type="text/os-template" autoUpdate="true"></script> to your HTML -
>> there is code that prevents stripping the feature out if there is a
>> template
>> with autoUpdate enabled.
>>
>> We should probably add a feature to Shindig to always enable client-side
>> processing.
>>
>> Evan
>>
>> On Fri, May 1, 2009 at 11:28 AM, Terlecki, Stephen <
>> stephen.terlecki@lmco.com> wrote:
>>
>>> I have been looking into this as well, and I think I am seeing the same
>>> issue.
>>>
>>> If I have an example gadget with only a default view that looks
>>> something like this:
>>>
>>> <?xml version="1.0" encoding="UTF-8"?>
>>> <Module>
>>> <ModulePrefs title="Basic Gadget">
>>>  <Require feature="opensocial-0.8"></Require>
>>>  <Require feature="dynamic-height"></Require>
>>>  <Require feature="opensocial-data"></Require>
>>>  <Require feature="opensocial-data-context"></Require>
>>>  <Require feature="opensocial-templates"></Require>
>>>  <Require feature="xmlutil"></Require>
>>>  <Optional feature="content-rewrite">
>>>      <Param name="include-tags"></Param>
>>>  </Optional>
>>> </ModulePrefs>
>>> <Content type="html">
>>>  <![CDATA[
>>>      <script type="text/os-data"
>>> xmlns:os="http://ns.opensocial.org/2008/markup">
>>>          <os:ViewerRequest key="databindviewer"/>
>>>          <os:OwnerRequest key="databindowner"/>
>>>          <os:PersonAppDataRequest key="ownerdata" userId="@owner"
>>> appId="@app"/>
>>>      </script>
>>>      <script type="text/os-template"
>>> xmlns:os="http://ns.opensocial.org/2008/markup"
>>> xmlns:example="http://example.org" tag="example:myTemplate">
>>>          <b>Hello ${databindviewer.displayName}</b><br>
>>>              Welcome to ${databindowner.displayName}'s gadget<br>
>>>          <b>Owner id is ${databindowner.id}</b><br>
>>>          <b>Owner Data Key=name1
>>> value=${ownerdata[databindowner.id]["name1"]}</b><br>
>>>      </script>
>>>      <script type="text/javascript">
>>>          //var templateForMe =
>>> opensocial.template.getTemplate("example:myTemplate");
>>>          var templateForMe = os.getTemplate("example:myTemplate");
>>>          templateForMe.process();
>>>      </script>
>>>  ]]>
>>> </Content>
>>> </Module>
>>>
>>> I can't get the opensocial javascript template api to actually render
>>> out the template.  I receive a js error that opensocial.template is not
>>> defined.  Do I have to have that template in a separate file for the
>>> opensocial.template api to work?
>>>
>>> -----Original Message-----
>>> From: Stephens, Christopher
>>> Sent: Thursday, April 30, 2009 6:08 PM
>>> To: shindig-dev@incubator.apache.org
>>> Subject: Template JS API
>>>
>>> SO I've been working for a few days to get some template logic working
>>> and I have come to the conclusion that I think the opensocial.template
>>> object isn't in the opensocial-templates feature library.  I checked the
>>> mailing list for awhile and couldn't find anything to confirm this.  I
>>> also brought up my gadget using the irf page and in firebug under DOM I
>>> don't see a template object under the opensocial object.  I suppose I
>>> might be missing a feature or something but can someone confirm if the
>>> JS API is implemented in shindig?
>>>
>

Re: Template JS API

Posted by Steve Terlecki <st...@gmail.com>.
I had a feeling something like this might have been happening because  
the exact same is in another gadget without tenplates works fine.  
Thanks for the help. I have something else to try.

Steve T.

On May 1, 2009, at 6:58 PM, Evan Gilbert <ui...@google.com> wrote:

> Templates that can be entirely processed on the server side may  
> strip out
> the template JS (see
> http://www.google.com/codesearch/p?hl=en#MSH8LMSqi38/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/TemplateRewriter.java&q=%22opensocial-templates%22%20shindig&l=255
> ).
>
> If this is a problem, a hack solution might be to add
> <script type="text/os-template" autoUpdate="true"></script> to your  
> HTML -
> there is code that prevents stripping the feature out if there is a  
> template
> with autoUpdate enabled.
>
> We should probably add a feature to Shindig to always enable client- 
> side
> processing.
>
> Evan
>
> On Fri, May 1, 2009 at 11:28 AM, Terlecki, Stephen <
> stephen.terlecki@lmco.com> wrote:
>
>> I have been looking into this as well, and I think I am seeing the  
>> same
>> issue.
>>
>> If I have an example gadget with only a default view that looks
>> something like this:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <Module>
>> <ModulePrefs title="Basic Gadget">
>>  <Require feature="opensocial-0.8"></Require>
>>  <Require feature="dynamic-height"></Require>
>>  <Require feature="opensocial-data"></Require>
>>  <Require feature="opensocial-data-context"></Require>
>>  <Require feature="opensocial-templates"></Require>
>>  <Require feature="xmlutil"></Require>
>>  <Optional feature="content-rewrite">
>>       <Param name="include-tags"></Param>
>>  </Optional>
>> </ModulePrefs>
>> <Content type="html">
>>  <![CDATA[
>>       <script type="text/os-data"
>> xmlns:os="http://ns.opensocial.org/2008/markup">
>>           <os:ViewerRequest key="databindviewer"/>
>>           <os:OwnerRequest key="databindowner"/>
>>           <os:PersonAppDataRequest key="ownerdata" userId="@owner"
>> appId="@app"/>
>>       </script>
>>       <script type="text/os-template"
>> xmlns:os="http://ns.opensocial.org/2008/markup"
>> xmlns:example="http://example.org" tag="example:myTemplate">
>>           <b>Hello ${databindviewer.displayName}</b><br>
>>               Welcome to ${databindowner.displayName}'s gadget<br>
>>           <b>Owner id is ${databindowner.id}</b><br>
>>           <b>Owner Data Key=name1
>> value=${ownerdata[databindowner.id]["name1"]}</b><br>
>>       </script>
>>       <script type="text/javascript">
>>           //var templateForMe =
>> opensocial.template.getTemplate("example:myTemplate");
>>           var templateForMe = os.getTemplate("example:myTemplate");
>>           templateForMe.process();
>>       </script>
>>  ]]>
>> </Content>
>> </Module>
>>
>> I can't get the opensocial javascript template api to actually render
>> out the template.  I receive a js error that opensocial.template is  
>> not
>> defined.  Do I have to have that template in a separate file for the
>> opensocial.template api to work?
>>
>> -----Original Message-----
>> From: Stephens, Christopher
>> Sent: Thursday, April 30, 2009 6:08 PM
>> To: shindig-dev@incubator.apache.org
>> Subject: Template JS API
>>
>> SO I've been working for a few days to get some template logic  
>> working
>> and I have come to the conclusion that I think the  
>> opensocial.template
>> object isn't in the opensocial-templates feature library.  I  
>> checked the
>> mailing list for awhile and couldn't find anything to confirm  
>> this.  I
>> also brought up my gadget using the irf page and in firebug under  
>> DOM I
>> don't see a template object under the opensocial object.  I suppose I
>> might be missing a feature or something but can someone confirm if  
>> the
>> JS API is implemented in shindig?
>>

Re: Template JS API

Posted by Evan Gilbert <ui...@google.com>.
Templates that can be entirely processed on the server side may strip out
the template JS (see
http://www.google.com/codesearch/p?hl=en#MSH8LMSqi38/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/TemplateRewriter.java&q=%22opensocial-templates%22%20shindig&l=255
).

If this is a problem, a hack solution might be to add
<script type="text/os-template" autoUpdate="true"></script> to your HTML -
there is code that prevents stripping the feature out if there is a template
with autoUpdate enabled.

We should probably add a feature to Shindig to always enable client-side
processing.

Evan

On Fri, May 1, 2009 at 11:28 AM, Terlecki, Stephen <
stephen.terlecki@lmco.com> wrote:

> I have been looking into this as well, and I think I am seeing the same
> issue.
>
> If I have an example gadget with only a default view that looks
> something like this:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Module>
>  <ModulePrefs title="Basic Gadget">
>   <Require feature="opensocial-0.8"></Require>
>   <Require feature="dynamic-height"></Require>
>   <Require feature="opensocial-data"></Require>
>   <Require feature="opensocial-data-context"></Require>
>   <Require feature="opensocial-templates"></Require>
>   <Require feature="xmlutil"></Require>
>   <Optional feature="content-rewrite">
>        <Param name="include-tags"></Param>
>   </Optional>
>  </ModulePrefs>
>  <Content type="html">
>   <![CDATA[
>        <script type="text/os-data"
> xmlns:os="http://ns.opensocial.org/2008/markup">
>            <os:ViewerRequest key="databindviewer"/>
>            <os:OwnerRequest key="databindowner"/>
>            <os:PersonAppDataRequest key="ownerdata" userId="@owner"
> appId="@app"/>
>        </script>
>        <script type="text/os-template"
> xmlns:os="http://ns.opensocial.org/2008/markup"
> xmlns:example="http://example.org" tag="example:myTemplate">
>            <b>Hello ${databindviewer.displayName}</b><br>
>                Welcome to ${databindowner.displayName}'s gadget<br>
>            <b>Owner id is ${databindowner.id}</b><br>
>            <b>Owner Data Key=name1
> value=${ownerdata[databindowner.id]["name1"]}</b><br>
>        </script>
>        <script type="text/javascript">
>            //var templateForMe =
> opensocial.template.getTemplate("example:myTemplate");
>            var templateForMe = os.getTemplate("example:myTemplate");
>            templateForMe.process();
>        </script>
>   ]]>
>  </Content>
> </Module>
>
> I can't get the opensocial javascript template api to actually render
> out the template.  I receive a js error that opensocial.template is not
> defined.  Do I have to have that template in a separate file for the
> opensocial.template api to work?
>
> -----Original Message-----
> From: Stephens, Christopher
> Sent: Thursday, April 30, 2009 6:08 PM
> To: shindig-dev@incubator.apache.org
> Subject: Template JS API
>
> SO I've been working for a few days to get some template logic working
> and I have come to the conclusion that I think the opensocial.template
> object isn't in the opensocial-templates feature library.  I checked the
> mailing list for awhile and couldn't find anything to confirm this.  I
> also brought up my gadget using the irf page and in firebug under DOM I
> don't see a template object under the opensocial object.  I suppose I
> might be missing a feature or something but can someone confirm if the
> JS API is implemented in shindig?
>

Re: Template JS API

Posted by Steve Terlecki <st...@gmail.com>.
So you aren't using the tag attribute as described in the 0.9 spec. I  
will give this a shot thanks.

Steve T.

On May 1, 2009, at 4:32 PM, "Jordan Zimmerman" <jo...@shop.com> wrote:

> Here's the start of a template we use:
>
> <script name="FriendsProfile" type="text/os-template"><div
> if="${Top.ownerFriends.length gt 0}"><div class="div"
> repeat="ownerFriends"><table border="0" cellpadding="0"  
> cellspacing="0"
> width="100%">
> <tr if="${Index % 2 == 0 and Index lt 5}" valign="top">
> <td align="left" class="myfriends_white_row" valign="middle"
> width="50px"><img alt="" border="0"
> src="http://ccimg.shop.com${thumbnailUrl}" title=""/></td><td
> align="left" class="myfriends_white_row" valign="top"><b class=" ccvvs
> color_tx_333">${displayName}</b><br/>
> <span class="ccvvs
> color_tx_5f9637">(${name.unstructured})</span></td><td align="right"
> class="myfriends_white_row" valign="top"><table border="0"
> cellpadding="0" cellspacing="0">
>        ** snip **
>
> Then as one of the last calls in our gadget we have this:
> <script language="javascript">
> <!--
> sc_gadget_draw_friends_profile();
> // -->
> </script>
>
> The body of the function is:
>
> function sc_gadget_draw_friends_profile()
> {
>  function _handler(data)
>  {
>    var friends = { 'owner': data.get('owner').getData(),
>            'viewer': data.get('viewer').getData(),
>             
> 'ownerFriends':data.get('ownerFriends').getData().asArray()}
>
> os. 
> getTemplate(TEMPLATE_FRIENDS_PROFILE).renderInto(document.getElementB
> yId(SC_GADGETCONTAINER),friends);
>  }
>
>  var params = {};
>  params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
> [opensocial.Person.Field.ALL];
>
>  var req = opensocial.newDataRequest();
>
> req. 
> add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER,para
> ms), 'viewer');
>
> req. 
> add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER,param
> s), 'owner');
>  req.add(req.newFetchPeopleRequest(opensocial.newIdSpec({ "userId" :
> "OWNER", "groupId" : "FRIENDS" }),params), 'ownerFriends');
>  req.send(_handler);
> }
>
> Jordan Zimmerman
> Principal Software Architect
> 831.647.4712
> 831.214.2990 (cell)
> jordanz@shop.com
>
> SHOP*COMTM
> Shop Smart, Save Big(tm)
> www.shop.com
>
> This message (including any attachments) is intended only for
> the use of the individual or entity to which it is addressed and
> may contain information that is non-public, proprietary,
> privileged, confidential, and exempt from disclosure under
> applicable law or may constitute as attorney work product.
> If you are not the intended recipient, you are hereby notified
> that any use, dissemination, distribution, or copying of this
> communication is strictly prohibited. If you have received this
> communication in error, notify us immediately by telephone and
> (i) destroy this message if a facsimile or (ii) delete this
> message
> immediately if this is an electronic communication.
>
> Thank you.

RE: Template JS API

Posted by Jordan Zimmerman <jo...@shop.com>.
Here's the start of a template we use:

<script name="FriendsProfile" type="text/os-template"><div
if="${Top.ownerFriends.length gt 0}"><div class="div"
repeat="ownerFriends"><table border="0" cellpadding="0" cellspacing="0"
width="100%">
<tr if="${Index % 2 == 0 and Index lt 5}" valign="top">
<td align="left" class="myfriends_white_row" valign="middle"
width="50px"><img alt="" border="0"
src="http://ccimg.shop.com${thumbnailUrl}" title=""/></td><td
align="left" class="myfriends_white_row" valign="top"><b class=" ccvvs
color_tx_333">${displayName}</b><br/>
<span class="ccvvs
color_tx_5f9637">(${name.unstructured})</span></td><td align="right"
class="myfriends_white_row" valign="top"><table border="0"
cellpadding="0" cellspacing="0">
		** snip **

Then as one of the last calls in our gadget we have this:
<script language="javascript">
<!--
sc_gadget_draw_friends_profile();
// -->
</script>

The body of the function is:

function sc_gadget_draw_friends_profile()
{
  function _handler(data)
  {
    var friends = { 'owner': data.get('owner').getData(),
            'viewer': data.get('viewer').getData(),
            'ownerFriends':data.get('ownerFriends').getData().asArray()}
 
os.getTemplate(TEMPLATE_FRIENDS_PROFILE).renderInto(document.getElementB
yId(SC_GADGETCONTAINER),friends);
  }

  var params = {};
  params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
[opensocial.Person.Field.ALL];

  var req = opensocial.newDataRequest();
 
req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER,para
ms), 'viewer');
 
req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.OWNER,param
s), 'owner');
  req.add(req.newFetchPeopleRequest(opensocial.newIdSpec({ "userId" :
"OWNER", "groupId" : "FRIENDS" }),params), 'ownerFriends');
  req.send(_handler);
}

Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com 

SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com

This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this 
message
immediately if this is an electronic communication.

Thank you.

RE: Template JS API

Posted by "Terlecki, Stephen" <st...@lmco.com>.
But you have been successful in using the tag approach to rendering
templates?  Up until now, we haven't been able to get it going.

Do you have an example of you are using it that you can share?

Steve T.

-----Original Message-----
From: Jordan Zimmerman [mailto:jordanz@shop.com] 
Sent: Friday, May 01, 2009 2:33 PM
To: shindig-dev@incubator.apache.org
Subject: RE: Template JS API

>I can't get the opensocial javascript template api to actually render
>out the template.  I receive a js error that opensocial.template is not
>defined.  

We've been getting this problem too. It's intermittent. What we've found
is that you can't render the template as an on load handler. But, I
don't know why.

Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com 

SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com

This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this
message
immediately if this is an electronic communication.

Thank you.

RE: Template JS API

Posted by Jordan Zimmerman <jo...@shop.com>.
>I can't get the opensocial javascript template api to actually render
>out the template.  I receive a js error that opensocial.template is not
>defined.  

We've been getting this problem too. It's intermittent. What we've found
is that you can't render the template as an on load handler. But, I
don't know why.

Jordan Zimmerman
Principal Software Architect
831.647.4712
831.214.2990 (cell)
jordanz@shop.com 

SHOP*COMTM
Shop Smart, Save Big(tm)
www.shop.com

This message (including any attachments) is intended only for
the use of the individual or entity to which it is addressed and
may contain information that is non-public, proprietary,
privileged, confidential, and exempt from disclosure under
applicable law or may constitute as attorney work product.
If you are not the intended recipient, you are hereby notified
that any use, dissemination, distribution, or copying of this
communication is strictly prohibited. If you have received this
communication in error, notify us immediately by telephone and
(i) destroy this message if a facsimile or (ii) delete this 
message
immediately if this is an electronic communication.

Thank you.

RE: Template JS API

Posted by "Terlecki, Stephen" <st...@lmco.com>.
I have been looking into this as well, and I think I am seeing the same
issue.

If I have an example gadget with only a default view that looks
something like this:

<?xml version="1.0" encoding="UTF-8"?>
<Module>
 <ModulePrefs title="Basic Gadget">
   <Require feature="opensocial-0.8"></Require>
   <Require feature="dynamic-height"></Require>
   <Require feature="opensocial-data"></Require>
   <Require feature="opensocial-data-context"></Require>
   <Require feature="opensocial-templates"></Require>
   <Require feature="xmlutil"></Require>
   <Optional feature="content-rewrite">
        <Param name="include-tags"></Param>
   </Optional>
 </ModulePrefs>
 <Content type="html">
   <![CDATA[  
        <script type="text/os-data"
xmlns:os="http://ns.opensocial.org/2008/markup">
            <os:ViewerRequest key="databindviewer"/>
            <os:OwnerRequest key="databindowner"/>
            <os:PersonAppDataRequest key="ownerdata" userId="@owner"
appId="@app"/>
        </script>
        <script type="text/os-template"
xmlns:os="http://ns.opensocial.org/2008/markup"
xmlns:example="http://example.org" tag="example:myTemplate">
            <b>Hello ${databindviewer.displayName}</b><br>
		Welcome to ${databindowner.displayName}'s gadget<br>
            <b>Owner id is ${databindowner.id}</b><br>
            <b>Owner Data Key=name1
value=${ownerdata[databindowner.id]["name1"]}</b><br>
        </script>
        <script type="text/javascript">
            //var templateForMe =
opensocial.template.getTemplate("example:myTemplate");
            var templateForMe = os.getTemplate("example:myTemplate");
            templateForMe.process(); 
        </script>
   ]]>
  </Content>
</Module>

I can't get the opensocial javascript template api to actually render
out the template.  I receive a js error that opensocial.template is not
defined.  Do I have to have that template in a separate file for the
opensocial.template api to work?

-----Original Message-----
From: Stephens, Christopher 
Sent: Thursday, April 30, 2009 6:08 PM
To: shindig-dev@incubator.apache.org
Subject: Template JS API

SO I've been working for a few days to get some template logic working
and I have come to the conclusion that I think the opensocial.template
object isn't in the opensocial-templates feature library.  I checked the
mailing list for awhile and couldn't find anything to confirm this.  I
also brought up my gadget using the irf page and in firebug under DOM I
don't see a template object under the opensocial object.  I suppose I
might be missing a feature or something but can someone confirm if the
JS API is implemented in shindig?

Template JS API

Posted by "Stephens, Christopher" <ch...@lmco.com>.
SO I've been working for a few days to get some template logic working
and I have come to the conclusion that I think the opensocial.template
object isn't in the opensocial-templates feature library.  I checked the
mailing list for awhile and couldn't find anything to confirm this.  I
also brought up my gadget using the irf page and in firebug under DOM I
don't see a template object under the opensocial object.  I suppose I
might be missing a feature or something but can someone confirm if the
JS API is implemented in shindig?

Re: How far has support for REST been implemented

Posted by Louis Ryan <lr...@google.com>.
Gary

I think your are conflating two things that arent strictly related.
gadgets.io.RequestParameters.* are used to control how
gadgets.io.makeRequest will execute the proxied request to the specified URL
target. The OpenSocial REST APIs almost universally support GET operations.
Some APIs support POST/PUT/DELETE on a container by container basis. E.g
POST of AppData or Activities work on most containers.

Regards

-Louis

On Thu, Apr 30, 2009 at 1:15 PM, Gary Stevens <gs...@us.ibm.com> wrote:

>
>
> Hello all,
>
> I have been trying to get one gadget within one running version of Shindig
> to pass data through the OpenSocial REST calls into a database within
> another running copy of Shindig.  The problem I am having is that when I
> try to use a gadgets.io.RequestParameters.METHOD of
> gadgets.io.MethodType.POST or gadgets.io.MethodType.PUT it seems like a GET
> is executed instead.  I have read online (at
> http://sites.google.com/site/opensocialarticles/Home/shindig-rest-java)
> that as of August 2008 only GET had been implemented in the OpenSocial REST
> implementation while POST, PUT, and DELETE had not.  Which of the REST
> calls are currently supported in the Java version of Shindig?
>
> Thank you,
> Gary F Stevens