reinhard 2003/07/14 02:30:46
Modified: src/webapp/samples/flow/calc calc.js sitemap.xmap src/webapp/samples/flow/prefs prefs.js sitemap.xmap src/webapp/samples/flow/prefs/screens login.xsp registrationSuccessful.xsp userInfo.xsp welcome.xsp Log: - use FOM in calc and pref example Revision Changes Path 1.3 +12 -6 cocoon-2.1/src/webapp/samples/flow/calc/calc.js Index: calc.js =================================================================== RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/flow/calc/calc.js,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- calc.js 20 May 2003 00:54:12 -0000 1.2 +++ calc.js 14 Jul 2003 09:30:45 -0000 1.3 @@ -21,18 +21,24 @@ function getNumber(name, a, b) { var uri = "page/getNumber" + name.toUpperCase(); - sendPageAndWait(uri, { "a" : a, "b" : b }); - return parseFloat(cocoon.request.getParameter(name)); + cocoon.sendPageAndWait(uri, { "a" : a, "b" : b }); + return parseFloat(cocoon.request.name); } function getOperator(a, b) { - sendPageAndWait("page/getOperator", { "a" : a, "b" : b }); - return cocoon.request.getParameter("operator"); + cocoon.sendPageAndWait("page/getOperator", { "a" : a, "b" : b }); + return cocoon.request.operator; } function sendResult(a, b, op, result) { - sendPage("page/displayResult", - { "a" : a, "b" : b, "operator" : op, "result" : result }); + cocoon.sendPage("page/displayResult", + { + "a" : a, + "b" : b, + "operator" : op, + "result" : result + } + ); } 1.4 +1 -1 cocoon-2.1/src/webapp/samples/flow/calc/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/flow/calc/sitemap.xmap,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- sitemap.xmap 20 May 2003 00:54:12 -0000 1.3 +++ sitemap.xmap 14 Jul 2003 09:30:45 -0000 1.4 @@ -3,7 +3,7 @@ <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> <!-- indicates what flowscript to attach to this sitemap --> - <map:flow language="JavaScript"> + <map:flow language="javascript"> <map:script src="calc.js"/> </map:flow> 1.4 +45 -27 cocoon-2.1/src/webapp/samples/flow/prefs/prefs.js Index: prefs.js =================================================================== RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/flow/prefs/prefs.js,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- prefs.js 20 May 2003 00:54:12 -0000 1.3 +++ prefs.js 14 Jul 2003 09:30:46 -0000 1.4 @@ -45,22 +45,28 @@ // and print an indicator close to where the errors // are. `errorMsg' if not null is printed at the top of the page // as an error message. - sendPageAndWait("page/userInfo", - { "check" : check, "errorMsg" : errorMsg, - "title": "New User Registration", - "button" : "Register", - "login" : login, "password" : password, - "firstName" : firstName, "lastName" : lastName, - "email" : email}); + cocoon.sendPageAndWait("page/userInfo", + { + "check" : check, + "errorMsg" : errorMsg, + "title": "New User Registration", + "button" : "Register", + "login" : login, + "password" : password, + "firstName" : firstName, + "lastName" : lastName, + "email" : email + } + ); check = false; errorMsg = null; - login = cocoon.request.get("login"); - password = cocoon.request.get("password"); - firstName = cocoon.request.get("firstName"); - lastName = cocoon.request.get("lastName"); - email = cocoon.request.get("email"); + login = cocoon.request.login; + password = cocoon.request.password; + firstName = cocoon.request.firstName; + lastName = cocoon.request.lastName; + email = cocoon.request.email; if (login == "" || password == "" || firstName == "" || lastName == "" || email == "") { @@ -92,7 +98,7 @@ // that all the JavaScript global variables are shared among // invocations of top-level functions. Up until this point, each // invocation had a separate global scope for the variables. - cocoon.createSession(); + var session = cocoon.session; // Here we just send a response to the client browser and we don't // wait for any response. This is the last page generated by this @@ -104,7 +110,7 @@ // // In the case of this particular function, this is the only exit // point. - sendPage("page/registrationSuccessful", {"user" : user}); + cocoon.sendPage("page/registrationSuccessful", {"user" : user}); } @@ -115,8 +121,13 @@ var password = ""; while (true) { - sendPageAndWait("page/login", - {"errorMsg" : errorMsg, "login" : login, "password" : password}); + cocoon.sendPageAndWait("page/login", + { + "errorMsg" : errorMsg, + "login" : login, + "password" : password + } + ); errorMsg = null; @@ -137,12 +148,12 @@ // shared among invocations of top-level functions. Up until this // point, each invocation had a separate global scope for the // variables. - cocoon.createSession(); + var session = cocoon.session; // We send to the user a welcome page which contains links back to // what (s)he can do. These links essentially point to other top // level functions in this script. - sendPage("page/welcome", {"user" : user}); + cocoon.sendPage("page/welcome", {"user" : user}); } // This function is called to edit the preferences of an already @@ -168,13 +179,20 @@ // and print an indicator close to where the errors // are. `errorMsg' if not null is printed at the top of the page // as an error message. - sendPageAndWait("page/userInfo", - { "check" : check, "errorMsg" : errorMsg, - "title": "Edit account", - "button" : "Change", "cancel" : true, - "login" : login, "password" : password, - "firstName" : firstName, "lastName" : lastName, - "email" : email}); + cocoon.sendPageAndWait("page/userInfo", + { + "check" : check, + "errorMsg" : errorMsg, + "title": "Edit account", + "button" : "Change", + "cancel" : true, + "login" : login, + "password" : password, + "firstName" : firstName, + "lastName" : lastName, + "email" : email + } + ); if (cocoon.request.get("cancel")) break; @@ -204,7 +222,7 @@ } } - sendPage("page/welcome", {"user" : user}); + cocoon.sendPage("page/welcome", {"user" : user}); } function logout() 1.4 +3 -3 cocoon-2.1/src/webapp/samples/flow/prefs/sitemap.xmap Index: sitemap.xmap =================================================================== RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/flow/prefs/sitemap.xmap,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- sitemap.xmap 20 May 2003 00:54:12 -0000 1.3 +++ sitemap.xmap 14 Jul 2003 09:30:46 -0000 1.4 @@ -1,11 +1,11 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="iso-8859-1"?> <!-- CVS $Id$ --> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> <!-- indicates what flowscript to attach to this sitemap --> - <map:flow language="JavaScript"> + <map:flow language="javascript"> <map:script src="prefs.js"/> </map:flow> 1.4 +2 -2 cocoon-2.1/src/webapp/samples/flow/prefs/screens/login.xsp Index: login.xsp =================================================================== RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/flow/prefs/screens/login.xsp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- login.xsp 20 May 2003 00:54:12 -0000 1.3 +++ login.xsp 14 Jul 2003 09:30:46 -0000 1.4 @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="iso-8859-1"?> <!--+ | CVS: $Id$ 1.3 +2 -2 cocoon-2.1/src/webapp/samples/flow/prefs/screens/registrationSuccessful.xsp Index: registrationSuccessful.xsp =================================================================== RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/flow/prefs/screens/registrationSuccessful.xsp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- registrationSuccessful.xsp 20 May 2003 00:54:12 -0000 1.2 +++ registrationSuccessful.xsp 14 Jul 2003 09:30:46 -0000 1.3 @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="iso-8859-1"?> <!--+ | CVS: $Id$ 1.4 +2 -2 cocoon-2.1/src/webapp/samples/flow/prefs/screens/userInfo.xsp Index: userInfo.xsp =================================================================== RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/flow/prefs/screens/userInfo.xsp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- userInfo.xsp 20 May 2003 00:54:12 -0000 1.3 +++ userInfo.xsp 14 Jul 2003 09:30:46 -0000 1.4 @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="iso-8859-1"?> <!--+ | CVS: $Id$ 1.3 +2 -2 cocoon-2.1/src/webapp/samples/flow/prefs/screens/welcome.xsp Index: welcome.xsp =================================================================== RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/flow/prefs/screens/welcome.xsp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- welcome.xsp 20 May 2003 00:54:12 -0000 1.2 +++ welcome.xsp 14 Jul 2003 09:30:46 -0000 1.3 @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="iso-8859-1"?> <!--+ | CVS: $Id$