Dynamic redirection to sub-app?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Dynamic redirection to sub-app?

ncrofts
Hi,

I'm an trying to figure out how to dynamically redirect to a sub-application of an Orbeon Forms application.

My starting point is that I have several different applications deployed under the "resources/apps" folder of a webapp e.g.

.../WEB-INF/resources/apps/alpha
.../WEB-INF/resources/apps/beta
... more apps


From my home XForms page I want to be able to list the available apps and then click on a link to redirect to that sub-app. To start with I have an XForm page with an instance that contains the names of the apps e.g.

<xforms:instance id="apps">
    <apps>
        <app><name>alpha</name><app>
        <app><name>beta</name><app>
         ....
    </apps>
</xforms:instance>


.... and in the XForm I use a repeat element to generate a series of (links) submissions to the selected app e.g.

<xforms:repeat nodeset="instance('apps')/app" id="app-index">

    <xxforms:variable name="app" select"."/>

    <xforms:submission submit="go-app" appearance="minimal">
        <xforms:label ref="$app/name"/>
    </xforms:submission>

</xforms:repeat>


...and the XForm page contains a submission as follows:

<xforms:submission id="go-app" resource="app-redirect" ref="instance('apps')/app[index('app-index')]"/>

This submission works, but I can't seem to figure out (if it is indeed possible) how to then redirect to the correct sub-application?


Effectively what I want to end up with is the ability to dynamically redirect to "/alpha", "/beta" etc. based on the instance value.

By the way, if I manually navigate to the sub-application I have been able to redirect to the page flow of each application by adding a rule to the main page flow i.e.
<c:page id="apps" path-info="/([^/]+)/.*" matcher="oxf:perl5-matcher" model="apps/${1}/page-flow.xml"/>

However I just can seem to figure out how extract the app/name from the instance submitted to /app-redirect and then get it to build the appropriate URL based on this before redirecting to the appropriate sub-flow.

<c:page id="app-redirect" path-info="/app-redirect">

    ????

</c:page>


I hope what I am trying to achieve is clear from this description? Can anyone advise on the way to handle the dynamic submission to the pages?
 
Regards,
Neil
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic redirection to sub-app?

Erik Bruchez
Administrator
Neil,

Could you just use a link for that?

E.g.:

<xhtml:a href="/{$app}"> <xforms:outout ref="$app/name"/></xhtml:a>

This is probably better than using a submission, unless you need to do a POST.

-Erik

On Fri, Feb 11, 2011 at 9:22 AM, ncrofts <[hidden email]> wrote:

Hi,

I'm an trying to figure out how to dynamically redirect to a sub-application
of an Orbeon Forms application.

My starting point is that I have several different applications deployed
under the "resources/apps" folder of a webapp e.g.

.../WEB-INF/resources/apps/alpha
.../WEB-INF/resources/apps/beta
... more apps


From my home XForms page I want to be able to list the available apps and
then click on a link to redirect to that sub-app. To start with I have an
XForm page with an instance that contains the names of the apps e.g.

<xforms:instance id="apps">
   <apps>
       <app><name>alpha</name><app>
       <app><name>beta</name><app>
        ....
   </apps>
</xforms:instance>


.... and in the XForm I use a repeat element to generate a series of (links)
submissions to the selected app e.g.

<xforms:repeat nodeset="instance('apps')/app" id="app-index">

   <xxforms:variable name="app" select"."/>

   <xforms:submission submit="go-app" appearance="minimal">
       <xforms:label ref="$app/name"/>
   </xforms:submission>

</xforms:repeat>


...and the XForm page contains a submission as follows:

<xforms:submission id="go-app" resource="app-redirect"
ref="instance('apps')/app[index('app-index')]"/>

This submission works, but I can't seem to figure out (if it is indeed
possible) how to then redirect to the correct sub-application?


Effectively what I want to end up with is the ability to dynamically
redirect to "/alpha", "/beta" etc. based on the instance value.

By the way, if I manually navigate to the sub-application I have been able
to redirect to the page flow of each application by adding a rule to the
main page flow i.e.
<c:page id="apps" path-info="/([^/]+)/.*" matcher="oxf:perl5-matcher"
model="apps/${1}/page-flow.xml"/>

However I just can seem to figure out how extract the app/name from the
instance submitted to /app-redirect and then get it to build the appropriate
URL based on this before redirecting to the appropriate sub-flow.

<c:page id="app-redirect" path-info="/app-redirect">

   ????

</c:page>


I hope what I am trying to achieve is clear from this description? Can
anyone advise on the way to handle the dynamic submission to the pages?

Regards,
Neil
--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Dynamic-redirection-to-sub-app-tp3301659p3301659.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Dynamic redirection to sub-app?

ncrofts
Hi Erik,

Ah, I didn't realise you could access xforms instances from standard xhtml elements. As an alternative I had been looking at using the redirect processor, but your approach would be much simpler. I'll give that a go. Thanks for the suggestion.

Neil