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 displayResult.xsp getNumberA.xsp getNumberB.xsp getOperator.xsp
Date Mon, 25 Mar 2002 07:46:10 GMT
ovidiu      02/03/24 23:46:10

  Modified:    src/scratchpad/schecoon/webapp/examples/calc calc.js
                        displayResult.xsp getNumberA.xsp getNumberB.xsp
                        getOperator.xsp
  Log:
  Updated to work correctly.
  
  Revision  Changes    Path
  1.2       +10 -18    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- calc.js	24 Mar 2002 07:30:40 -0000	1.1
  +++ calc.js	25 Mar 2002 07:46:09 -0000	1.2
  @@ -1,7 +1,5 @@
   function calculator()
   {
  -  print ("cocoon = " + cocoon);
  -
     var a = getNumber("a");
     var b = getNumber("b", a);
     var op = getOperator(a, b);
  @@ -22,7 +20,7 @@
       return cocoon.request.getParameter("operator");
     }
   
  -  function sendResult(result)
  +  function sendResult(a, b, op, result)
     {
       sendPage("xsp",
                { "source" : "examples/calc/displayResult.xsp" },
  @@ -30,20 +28,14 @@
       return cocoon.request.getParameter("operator");
     }
   
  -  switch (op) {
  -  case "+":
  -    sendResult(a + b);
  -    break;
  -  case "-":
  -    sendResult(a - b);
  -    break;
  -  case "*":
  -    sendResult(a * b);
  -    break;
  -  case "/":
  -    sendResult(a / b);
  -    break;
  -  default:
  +  if (op == "plus")
  +    sendResult(a, b, op, a + b);
  +  else if (op == "minus")
  +    sendResult(a, b, op, a - b);
  +  else if (op == "multiply")
  +    sendResult(a, b, op, a * b);
  +  else if (op == "divide")
  +    sendResult(a, b, op, a / b);
  +  else
       sendResult("Error: Unkown operator!");
  -  }
   }
  
  
  
  1.2       +1 -1      xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/displayResult.xsp
  
  Index: displayResult.xsp
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/displayResult.xsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- displayResult.xsp	24 Mar 2002 07:30:40 -0000	1.1
  +++ displayResult.xsp	25 Mar 2002 07:46:09 -0000	1.2
  @@ -14,7 +14,7 @@
     
     <html>
   
  -    <form action="/calc">
  +    <form action="../../calc/">
   
         <p><b>a</b> = <jpath:value-of select="a"/></p><br/>
         <p><b>b</b> = <jpath:value-of select="b"/></p><br/>
  
  
  
  1.2       +1 -1      xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/getNumberA.xsp
  
  Index: getNumberA.xsp
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/getNumberA.xsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- getNumberA.xsp	24 Mar 2002 07:30:40 -0000	1.1
  +++ getNumberA.xsp	25 Mar 2002 07:46:09 -0000	1.2
  @@ -16,7 +16,7 @@
   
       <form><xsp:attribute name="action"><xsp:expr>"kont/" + <jpath:continuation/></xsp:expr></xsp:attribute>
   
  -      <p>Enter value of <b>a</b>: <input type="text" name="a"/></p><br/>
  +      <p>Enter value of <b>a</b>: <input type="text" name="a"/></p>
         <input type="submit" name="submit" value="Enter"/>
       </form>
   
  
  
  
  1.2       +3 -3      xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/getNumberB.xsp
  
  Index: getNumberB.xsp
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/getNumberB.xsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- getNumberB.xsp	24 Mar 2002 07:30:40 -0000	1.1
  +++ getNumberB.xsp	25 Mar 2002 07:46:09 -0000	1.2
  @@ -14,10 +14,10 @@
     
     <html>
   
  -    <form><xsp:attribute name="action">/kont/<jpath:continuation/></xsp:attribute>
  +    <form><xsp:attribute name="action"><xsp:expr><jpath:continuation/></xsp:expr></xsp:attribute>
   
  -      <p><b>a</b> = <jpath:value-of select="a"/></p><br/>
  -      <p>Enter value of <b>b</b>: <input type="text" name="b"/></p><br/>
  +      <p><b>a</b> = <jpath:value-of select="a"/></p>
  +      <p>Enter value of <b>b</b>: <input type="text" name="b"/></p>
         <input type="submit" name="submit" value="Enter"/>
   
       </form>
  
  
  
  1.2       +8 -8      xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/getOperator.xsp
  
  Index: getOperator.xsp
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/schecoon/webapp/examples/calc/getOperator.xsp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- getOperator.xsp	24 Mar 2002 07:30:40 -0000	1.1
  +++ getOperator.xsp	25 Mar 2002 07:46:09 -0000	1.2
  @@ -14,18 +14,18 @@
     
     <html>
   
  -    <form><xsp:attribute name="action">/kont/<jpath:continuation/></xsp:attribute>
  +    <form><xsp:attribute name="action"><xsp:expr><jpath:continuation/></xsp:expr></xsp:attribute>
   
  -      <p><b>a</b> = <jpath:value-of select="a"/></p><br/>
  -      <p><b>b</b> = <jpath:value-of select="b"/></p><br/>
  +      <p><b>a</b> = <jpath:value-of select="a"/></p>
  +      <p><b>b</b> = <jpath:value-of select="b"/></p>
         <p>Enter operator
           <select name="operator">
  -          <option>+</option>
  -          <option>-</option>
  -          <option>*</option>
  -          <option>/</option>
  +          <option>plus</option>
  +          <option>minus</option>
  +          <option>multiply</option>
  +          <option>divide</option>
           </select>
  -      </p><br/>
  +      </p>
         <input type="submit" name="submit" value="Do it"/>
   
       </form>
  
  
  

----------------------------------------------------------------------
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