You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Davies,Douglas" <da...@oclc.org> on 2015/03/25 21:18:00 UTC

EL expressions, Substituters, and Shindig

Hi All,

I want to make a value available to my gadget via substitution of a regular expression.  I know the old format was something like this __MODULE_ID__.  I was able to get my own value working by writing my own Substituter and injecting it.  So for example __MODULE_MY_KEY__ (I couldn’t figure out how to get my own Type, so I first overloaded MODULE).  What I really want is the EL opensocial 2.0 way of doing it ${Module.MyKey} or preferably my own namespace ${Context.institutionId}.  It doesn’t look like this is supported.  I can get it to work with UserPrefs just fine, but that might be all that is supported.  Can anyone shed some light on this?

Thanks,
Doug Davies





Re: EL expressions, Substituters, and Shindig

Posted by Ryan Baxter <rb...@gmail.com>.
Cool Doug!

On Tue, Mar 31, 2015 at 10:34 AM, Davies,Douglas <da...@oclc.org> wrote:

> Ok, it sounds like the right way to do this is with data-pipelining and
> templates.  I just had to create a new request handler.  For example
>
> <Require feature="opensocial-1.0"/>
> <Require feature="opensocial-data"/>
> <Require feature="opensocial-templates"/>
>
> <Content type="html" view="default">
>
>     <![CDATA[
>
>     <script xmlns:os="http://ns.opensocial.org/2008/markup"
> type="text/os-data">
>         <os:DataRequest key="institutionId" method="context.institutionId"
> />
>     </script>
>
>     <script type="text/os-template">
>         institutionId (javascript): <span id="content"></span><br>
>         institutionId (template): ${institutionId}<br>
>     </script>
>
>     <script type="text/javascript">
>         gadgets.util.registerOnLoadHandler(function () {
>             institutionId =
> opensocial.data.getDataContext().getDataSet("institutionId");
>             document.getElementById("content").innerHTML = institutionId;
>         });
>     </script>
>
> Thanks,
> Doug
>
> On Mar 27, 2015, at 4:41 PM, Davies,Douglas <daviesd@oclc.org<mailto:
> daviesd@oclc.org>> wrote:
>
> Thanks.  It seems like Substituters worked on the entire gadget spec
> (replacing any __MODULE_xxx__, __UP_xxx__, etc.).  The templates stuff
> seems to only work in “text/os-data” nodes and no way to plug in your own
> template resolver.  My desire is to have something that more closely
> matched the opensocial 1.0 stuff, but using EL syntax.  But then I’m going
> way outside the opensocial spec if I do that.
>
> Essentially what I’m really trying to do is provide a value that is
> necessary in making future service requests.  In our case it’s called a
> contextInstitutionId.  I initially tied this into the Person service, and
> the gadget writer could call that to get the value and append it to the
> service call request.  But it really seems like an environment type thing.
> The context of where I am running.  So just looking for a way to provide
> this to the gadget developer.
>
> doug
>
> On Mar 27, 2015, at 4:09 PM, Ryan Baxter <rbaxter85@apache.org<mailto:
> rbaxter85@apache.org>> wrote:
>
> Sorry Doug, I never really looked at this portion of Shindig.  Maybe
> someone else knows?
>
> On Wed, Mar 25, 2015 at 4:18 PM, Davies,Douglas <daviesd@oclc.org<mailto:
> daviesd@oclc.org>> wrote:
>
> Hi All,
>
> I want to make a value available to my gadget via substitution of a
> regular expression.  I know the old format was something like this
> __MODULE_ID__.  I was able to get my own value working by writing my own
> Substituter and injecting it.  So for example __MODULE_MY_KEY__ (I couldn’t
> figure out how to get my own Type, so I first overloaded MODULE).  What I
> really want is the EL opensocial 2.0 way of doing it ${Module.MyKey} or
> preferably my own namespace ${Context.institutionId}.  It doesn’t look like
> this is supported.  I can get it to work with UserPrefs just fine, but that
> might be all that is supported.  Can anyone shed some light on this?
>
> Thanks,
> Doug Davies
>
>
>
>
>
>
>
>
>

Re: EL expressions, Substituters, and Shindig

Posted by "Davies,Douglas" <da...@oclc.org>.
Ok, it sounds like the right way to do this is with data-pipelining and templates.  I just had to create a new request handler.  For example

<Require feature="opensocial-1.0"/>
<Require feature="opensocial-data"/>
<Require feature="opensocial-templates"/>

<Content type="html" view="default">

    <![CDATA[

    <script xmlns:os="http://ns.opensocial.org/2008/markup" type="text/os-data">
        <os:DataRequest key="institutionId" method="context.institutionId" />
    </script>

    <script type="text/os-template">
        institutionId (javascript): <span id="content"></span><br>
        institutionId (template): ${institutionId}<br>
    </script>

    <script type="text/javascript">
        gadgets.util.registerOnLoadHandler(function () {
            institutionId = opensocial.data.getDataContext().getDataSet("institutionId");
            document.getElementById("content").innerHTML = institutionId;
        });
    </script>

Thanks,
Doug

On Mar 27, 2015, at 4:41 PM, Davies,Douglas <da...@oclc.org>> wrote:

Thanks.  It seems like Substituters worked on the entire gadget spec (replacing any __MODULE_xxx__, __UP_xxx__, etc.).  The templates stuff seems to only work in “text/os-data” nodes and no way to plug in your own template resolver.  My desire is to have something that more closely matched the opensocial 1.0 stuff, but using EL syntax.  But then I’m going way outside the opensocial spec if I do that.

Essentially what I’m really trying to do is provide a value that is necessary in making future service requests.  In our case it’s called a contextInstitutionId.  I initially tied this into the Person service, and the gadget writer could call that to get the value and append it to the service call request.  But it really seems like an environment type thing.  The context of where I am running.  So just looking for a way to provide this to the gadget developer.

doug

On Mar 27, 2015, at 4:09 PM, Ryan Baxter <rb...@apache.org>> wrote:

Sorry Doug, I never really looked at this portion of Shindig.  Maybe
someone else knows?

On Wed, Mar 25, 2015 at 4:18 PM, Davies,Douglas <da...@oclc.org>> wrote:

Hi All,

I want to make a value available to my gadget via substitution of a
regular expression.  I know the old format was something like this
__MODULE_ID__.  I was able to get my own value working by writing my own
Substituter and injecting it.  So for example __MODULE_MY_KEY__ (I couldn’t
figure out how to get my own Type, so I first overloaded MODULE).  What I
really want is the EL opensocial 2.0 way of doing it ${Module.MyKey} or
preferably my own namespace ${Context.institutionId}.  It doesn’t look like
this is supported.  I can get it to work with UserPrefs just fine, but that
might be all that is supported.  Can anyone shed some light on this?

Thanks,
Doug Davies









Re: EL expressions, Substituters, and Shindig

Posted by "Davies,Douglas" <da...@oclc.org>.
Thanks.  It seems like Substituters worked on the entire gadget spec (replacing any __MODULE_xxx__, __UP_xxx__, etc.).  The templates stuff seems to only work in “text/os-data” nodes and no way to plug in your own template resolver.  My desire is to have something that more closely matched the opensocial 1.0 stuff, but using EL syntax.  But then I’m going way outside the opensocial spec if I do that.

Essentially what I’m really trying to do is provide a value that is necessary in making future service requests.  In our case it’s called a contextInstitutionId.  I initially tied this into the Person service, and the gadget writer could call that to get the value and append it to the service call request.  But it really seems like an environment type thing.  The context of where I am running.  So just looking for a way to provide this to the gadget developer.

doug

On Mar 27, 2015, at 4:09 PM, Ryan Baxter <rb...@apache.org> wrote:

> Sorry Doug, I never really looked at this portion of Shindig.  Maybe
> someone else knows?
> 
> On Wed, Mar 25, 2015 at 4:18 PM, Davies,Douglas <da...@oclc.org> wrote:
> 
>> Hi All,
>> 
>> I want to make a value available to my gadget via substitution of a
>> regular expression.  I know the old format was something like this
>> __MODULE_ID__.  I was able to get my own value working by writing my own
>> Substituter and injecting it.  So for example __MODULE_MY_KEY__ (I couldn’t
>> figure out how to get my own Type, so I first overloaded MODULE).  What I
>> really want is the EL opensocial 2.0 way of doing it ${Module.MyKey} or
>> preferably my own namespace ${Context.institutionId}.  It doesn’t look like
>> this is supported.  I can get it to work with UserPrefs just fine, but that
>> might be all that is supported.  Can anyone shed some light on this?
>> 
>> Thanks,
>> Doug Davies
>> 
>> 
>> 
>> 
>> 



Re: EL expressions, Substituters, and Shindig

Posted by Ryan Baxter <rb...@apache.org>.
Sorry Doug, I never really looked at this portion of Shindig.  Maybe
someone else knows?

On Wed, Mar 25, 2015 at 4:18 PM, Davies,Douglas <da...@oclc.org> wrote:

> Hi All,
>
> I want to make a value available to my gadget via substitution of a
> regular expression.  I know the old format was something like this
> __MODULE_ID__.  I was able to get my own value working by writing my own
> Substituter and injecting it.  So for example __MODULE_MY_KEY__ (I couldn’t
> figure out how to get my own Type, so I first overloaded MODULE).  What I
> really want is the EL opensocial 2.0 way of doing it ${Module.MyKey} or
> preferably my own namespace ${Context.institutionId}.  It doesn’t look like
> this is supported.  I can get it to work with UserPrefs just fine, but that
> might be all that is supported.  Can anyone shed some light on this?
>
> Thanks,
> Doug Davies
>
>
>
>
>