cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 21593] New: - calling jxForm results in function being called twice
Date Mon, 14 Jul 2003 22:14:51 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21593>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21593

calling jxForm results in function being called twice

           Summary: calling jxForm results in function being called twice
           Product: Cocoon 2
           Version: Current CVS 2.1
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: sitemap components
        AssignedTo: dev@cocoon.apache.org
        ReportedBy: u.cei@cbim.it


Given the following sitemap snippet:

----------------------------------------------------------------------
  <map:pipeline internal-only="true">
  
    <map:match pattern="forms/**">
      <map:generate type="jxforms" src="forms/{1}.xml"/>
      <map:transform type="xslt" src="stylesheets/xmlform2html.xsl"/>
      <map:serialize/>
    </map:match>
  
    <map:match pattern="finish">
      <map:generate type="status"/>
      <map:serialize type="xml"/>
    </map:match>
    
  </map:pipeline>

  <map:pipeline>
    
    <map:match pattern="test">
      <map:call function="checkLogin">
      	<map:parameter name="function" value="index"/>
      </map:call>
    </map:match>

    ...

  </map:pipeline>
----------------------------------------------------------------------

And the following flowscript:

----------------------------------------------------------------------
function checkLogin(funArg) {
  print("checkLogin: before jxForm");
  jxForm("loginScreen", "login", null, null, null);
  print("checkLogin: after jxForm");
  var newArgs = new Array(arguments.length - 1);
  for (var i = 1 ; i < arguments.length ; i++) {
          newArgs[i - 1] = "" + arguments[i];
  }
  var fun = this[funArg];
  print("checkLogin: calling " + funArg);
  fun.apply(this, newArgs);
}

function loginScreen(form) {
  var model = {
    "username" : "",
    "password" : ""
  };
  form.setModel(model);
  print("loginScreen: before sendView");
  form.sendView("forms/login");
  print("loginScreen: after sendView");
  form.finish("finish");
  print("loginScreen: after finish");
}

var count = 0;
function index() {
  print("count = " + ++count);
}
----------------------------------------------------------------------

invoking the "test" URI results in the following output:

----------------------------------------------------------------------
checkLogin: before jxForm
loginScreen: before sendView
checkLogin: before jxForm
loginScreen: after sendView
loginScreen: after finish
checkLogin: after jxForm
checkLogin: calling index
count = 1
checkLogin: after jxForm
checkLogin: calling index
count = 2
----------------------------------------------------------------------

Mime
View raw message