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 <[email protected]> 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 <[email protected]> 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 <
>> [email protected]> 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: [email protected]
>>> 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?
>>>
>

Reply via email to