cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ovi...@apache.org
Subject cvs commit: xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc calc.js
Date Sat, 30 Mar 2002 05:39:39 GMT
ovidiu      02/03/29 21:39:39

  Modified:    src/scratchpad/schecoon/webapp/examples/calc calc.js
  Log:
  Reimplement using forwardTo().
  
  Revision  Changes    Path
  1.3       +46 -24    xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/calc.js
  
  Index: calc.js
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/calc.js,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- calc.js	25 Mar 2002 07:46:09 -0000	1.2
  +++ calc.js	30 Mar 2002 05:39:39 -0000	1.3
  @@ -4,30 +4,6 @@
     var b = getNumber("b", a);
     var op = getOperator(a, b);
   
  -  function getNumber(name, a, b)
  -  {
  -    sendPage("xsp",
  -             { "source" : "examples/calc/getNumber" + name.toUpperCase() + ".xsp" },
  -             { "a" : a, "b" : b });
  -    return parseFloat(cocoon.request.getParameter(name));
  -  }
  -
  -  function getOperator(a, b)
  -  {
  -    sendPage("xsp",
  -             { "source" : "examples/calc/getOperator.xsp" },
  -             { "a" : a, "b" : b });
  -    return cocoon.request.getParameter("operator");
  -  }
  -
  -  function sendResult(a, b, op, result)
  -  {
  -    sendPage("xsp",
  -             { "source" : "examples/calc/displayResult.xsp" },
  -             { "a" : a, "b" : b, "operator" : op, "result" : result });
  -    return cocoon.request.getParameter("operator");
  -  }
  -
     if (op == "plus")
       sendResult(a, b, op, a + b);
     else if (op == "minus")
  @@ -39,3 +15,49 @@
     else
       sendResult("Error: Unkown operator!");
   }
  +
  +function getNumber(name, a, b)
  +{
  +  var uri = "cocoon:/calc/getNumber" + name.toUpperCase() + ".html";
  +  forwardTo(uri, { "a" : a, "b" : b });
  +  return parseFloat(cocoon.request.getParameter(name));
  +}
  +
  +function getOperator(a, b)
  +{
  +  var uri = "cocoon:/calc/getOperator.html";
  +  forwardTo(uri, { "a" : a, "b" : b });
  +  return cocoon.request.getParameter("operator");
  +}
  +
  +function sendResult(a, b, op, result)
  +{
  +  forwardTo("cocoon:/calc/displayResult.html",
  +            { "a" : a, "b" : b, "operator" : op, "result" : result });
  +}
  +
  +// function getNumber(name, a, b)
  +// {
  +//   var filename = "examples/calc/getNumber" + name.toUpperCase() + ".xsp";
  +
  +//   sendPage("xsp",
  +//            { "source" : filename },
  +//            { "a" : a, "b" : b });
  +//   return parseFloat(cocoon.request.getParameter(name));
  +// }
  +
  +// function getOperator(a, b)
  +// {
  +//   sendPage("xsp",
  +//            { "source" : "examples/calc/getOperator.xsp" },
  +//            { "a" : a, "b" : b });
  +//   return cocoon.request.getParameter("operator");
  +// }
  +
  +// function sendResult(a, b, op, result)
  +// {
  +//   sendPage("xsp",
  +//            { "source" : "examples/calc/displayResult.xsp" },
  +//            { "a" : a, "b" : b, "operator" : op, "result" : result });
  +//   return cocoon.request.getParameter("operator");
  +// }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message