cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Evans <jon.ev...@misgl.com>
Subject Re: CachingURICoplet and Flowscript / CForms
Date Wed, 24 Mar 2004 15:49:26 GMT
Hi,

On 24 Mar 2004, at 03:54, Alex Romayev wrote:

> I do remember your first post on this and I think you
>  are phrasing it very clear now.  Having said this, I
>  don't know if anyone here really has the answer, given
>  that the CachingURICoplet is fairly new.  I would like
>  to know the answer as well, as I can see myself having
>  to solve the same problem shortly.
>
> It is highly possible that no one except for Carsten
>  really has the answer.  Have you tried posting on the
> dev list, as he is more likely to take a notice of it
>  there.

Thanks, you are probably right, I'll give the dev list a try.

Devs, my original message is below, here's hoping someone can point me 
in the right direction. :-)

Thanks.

Jon

Hi everyone,

I'm still having problems implementing a cforms-based coplet in
flowscript, and I think maybe in previous messages to this list I've
not been very clear as to what my problem is, so I'm going to try
again. :-)

Lets say I have a form that lets the user update their details. 
Pseudo-flow-code would be:

function show(form) {
     populate(form);
     form.showForm("display-pipeline");
     saveToDB(form);

   cocoon.sendPage("success-pipeline");
  }

So the coplet starts off by displaying an "update your details" form,
then when you click submit it says "updates saved" or something.

In order for it to work properly with the portal engine, it is a
CachingURICoplet.  This means that if you switch away to a different
tab in the site, then back again, the coplet will load from the cache. 
This is normally what you want, except after you've displayed the final
page ("Your updates have been saved to the database") you actually want
it to reset itself, so that the next time the portal needs to render
the coplet it regenerates itself from scratch.  Otherwise you update
your details once, and after that you always get the "success" page.

I can fudge it by changing the flowscript to a while(true){} loop, and
rendering the success page with sendPageAndWait, and putting a "Make
another change" button on the success page.  But that user interface
needs taking out and shooting. :-)  What I want to be able to do is:

function show(form) {
     populate(form);
     form.showForm("display-pipeline");
     saveToDB(form);

   cocoon.sendPage("success-pipeline");
     reset();
  }

function reset() {
     // this is pseudo code remember!
     thisCoplet.reset();
     thisCoplet.clearCache();
     // Now the next time this coplet is displayed,
     // it will be generated from scratch as if it
     // had never been displayed before
  }



Also, I'm still looking for a code snippet that would let me do this
from my flowscript:

var myValue = thisCoplet.get("attributes/myValue");
  // where myValue is defined in my copletdata/portal.xml file

Thanks,

Jon


Mime
View raw message