On Thursday, July 3, 2003, at 11:40 AM, Reinhard P�tz wrote:



As promised here a summary of the current status. So if somebody wants to take an issue feel free to change http://wiki.cocoondev.org/Wiki.jsp?page=FinishingFlow.



Many thanks for your summary.


Does anyone object to me adding my recent RT on how parameters are passed to FlowScript functions to this list? (I would not like it to block anything, but I would like it to be considered).

http://marc.theaimsgroup.com/?t=105622202800004&r=1&w=2

Basically, we have named parameters in the SiteMap, but loose that naming when the parameters arrive at the function, relying instead on the *order* of the parameters in the Sitemap. Named parameters should not be order-dependant IMHO.

I find this most unpleasant!

I reduce the problem on my own projects by only having one function where the order of parameters is assumed .....

<map:match pattern="*/*/*">
  <map:call function="main">
  <map:parameter name="action" value="{1}"/>
  <map:parameter name="type" value="{2}"/>
  <map:parameter name="id" value="{3}"/>
  <map:parameter name="uri" value="{0}"/>
  </map:call>
</map:match>

function main(action) {
  // these arguments must be kept in sync with the SiteMap params
  var args = {
    action : arguments[0],
    type : arguments[1],
    id : arguments[2],
    uri : arguments[3],
    klass : Beans[arguments[1].toUpperCase()]
  };
  if (user == null) {
    if (!login(args)) {
      sendPage("screen/util/loginFailure");
      return;
    }
  }
  invoke([args]);
}

function invoke(args) {
  func = this[args[0].action];
  if (func != undefined) {
    func.apply(this,args);
  } else {
    sendPage("screen/util/actionNotExists");
  }
}

// this function does not need to be kept in sync with the order of params in the sitemap
function mySpecificAction (args) {
doSomethingWith( args.type );
}


This IMHO is only a temporary solution.

What do you think?

regards Jeremy

Reply via email to