cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Curdt <tcu...@dff.st>
Subject Re: [RT] Flowmaps
Date Mon, 17 Jun 2002 11:30:44 GMT
>  /xml-cocoon2/src/webapp/samples/flow/examples/calc/
>
> which is a sample about a very simple web application that implements a
> calculator using the flowmap.
>
> First of all, I'll outline the 'procedural flow logic' of this
> application using highly-pseudo code:
>
>  1) tell me the first operand
>  2) tell me the second operand
>  3) tell me the operation to apply
>  4) here is your result
>
> You'll see how much similar to the actual implementing code this will
> look like. This is probably already a great advantage over anything that
> we had before.

Everyone is so enthusiastic about the new flowmap implementation (indeed great 
work!) but I am actually wondering how a more complex application could look 
like:

for the xmlform / precept stuff we aggreed on the following requirements for a 
more complex example (IIRC):

 - 3 page form
 - should be possible to go back and forth
 - a summary page at the end
 - and a result page (success/failed)
 - validation against a schema
 - everything should be i18n aware

How could this look like implemented with the current flowmap? 
Here is my first try: (please bear with me - a lot is NYI ;-)

function wizard(uriPrefix) {
  var id = cocoon.request.getParameter("someid");
  
  var factory = SchemaFactory.getInstance("ns");
  //maybe we can get the schema from a pipeline??
  var schema = factory.compile("someschema.xsd.dtd.rng.sch"); 
  var validator = schema.createValidator();
  var instance = new Instance();

  loadInstance(instance,id);
  
  do {
   do {
    sendPage(uriPrefix + "page1.html");
    Instance.populate(instance,cocoon.request);
   } while(!validator.isValid(instance, "page1"));

   do {
    sendPage(uriPrefix + "page2.html");
    Instance.populate(instance,cocoon.request);
   } while(!validator.isValid(instance, "page2"));

   do {
    sendPage(uriPrefix + "page3.html");
    Instance.populate(instance,cocoon.request);
   } while(!validator.isValid(instance, "page3"));

  } while(!validator.isValid(instance));

  if(saveInstance(instance,id)) {
   sendPage("success.html");
  }
  else {
   sendPage("failed.html");
  }
}

function loadInstance( instance, id ) {
  // how to get the values from the pipeline into the instance?
  callPipeline("loadInstance.xsp",input,output);
}

function saveInstance( instance, id ) {
  // same here...
  callPipeline("saveInstance.xsp",input,output);
}


A lot of details are still missing. Maybe someone can help out here...
Especially how would you implement the "go back" button?

If have still dozens of thoughts in head (what about sub-flows? flow-2-flow 
communications,..) need to sort them first.


> This is *NOT* possible with any other FSM-based approach.

Sorry, for the (maybe) stupid question but... why not?

cheers
--
Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message