Author: thorsten
Date: Thu Sep 1 11:31:15 2005
New Revision: 265761
URL: http://svn.apache.org/viewcvs?rev=265761&view=rev
Log:
added an outro flowscript matcher. This way it possible to e.g. save files to
the file system or do any other action when the form returns to the script.
Modified:
lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseView.java
lenya/trunk/src/webapp/lenya/usecases/usecases.js
Modified: lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseView.java
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseView.java?rev=265761&r1=265760&r2=265761&view=diff
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseView.java
(original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/usecase/UsecaseView.java Thu Sep
1 11:31:15 2005
@@ -48,6 +48,7 @@
protected static final String ELEMENT_CFORM_BINDING = "binding";
protected static final String ELEMENT_AFTER = "after";
protected static final String ELEMENT_BEFORE = "before";
+ protected static final String ELEMENT_CFORM_OUTRO = "outro";
protected static final String ATTRIBUTE_URI = "uri";
protected static final String ATTRIBUTE_GROUP = "group";
@@ -100,6 +101,10 @@
this.cformBindingBefore =
cformBindingConfig.getChild(ELEMENT_BEFORE,false).getValue(null);
this.cformBindingAfter =
cformBindingConfig.getChild(ELEMENT_AFTER,false).getValue(null);
}
+ Configuration cformOutroConfig =
config.getChild(ELEMENT_CFORM_OUTRO, false);
+ if (cformOutroConfig!=null){
+ this.cformOutro = cformOutroConfig.getValue(null);
+ }
}
Configuration[] parameterConfigs =
config.getChildren(ELEMENT_PARAMETER);
@@ -209,6 +214,8 @@
private String cformBindingBefore =null;
private String cformBindingAfter =null;
+
+ private String cformOutro=null;
/**
* @return Returns the cformBindingAfter.
@@ -294,6 +301,20 @@
*/
public void setViewType(String viewType) {
this.viewType = viewType;
+ }
+
+ /**
+ * @return Returns the cformOutro.
+ */
+ public String getCformOutro() {
+ return cformOutro;
+ }
+
+ /**
+ * @param cformOutro The cformOutro to set.
+ */
+ public void setCformOutro(String cformOutro) {
+ this.cformOutro = cformOutro;
}
}
Modified: lenya/trunk/src/webapp/lenya/usecases/usecases.js
URL:
http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/usecases/usecases.js?rev=265761&r1=265760&r2=265761&view=diff
==============================================================================
--- lenya/trunk/src/webapp/lenya/usecases/usecases.js (original)
+++ lenya/trunk/src/webapp/lenya/usecases/usecases.js Thu Sep 1 11:31:15 2005
@@ -17,6 +17,7 @@
/* $Id$ */
cocoon.load("resource://org/apache/cocoon/forms/flow/javascript/Form.js");
+ cocoon.load("usecases-util.js");
/* Helper method to add all request parameters to a usecase */
function passRequestParameters(flowHelper, usecase) {
@@ -98,8 +99,6 @@
var form;
var scriptString;
var evalFunc;
- var genericDoc;
-
/*
* If the usecase has a view, this means we want to display something
@@ -116,6 +115,11 @@
try {
var templateUri = view.getTemplateURI();
if (templateUri) {
+ /* Generic document variable that can be used in all
funtions
+ FIXME: The rhino evalFunc() is broken that makes it
impossible to
+ change this variable from a function.
+ We need to use the usecase java class for it!
+ var genericDoc;*/
var viewUri = "view/" + menu + "/" + view.getTemplateURI();
if (cocoon.log.isDebugEnabled())
cocoon.log.debug("usecases.js::executeUsecase() in
usecase " + usecaseName + ", creating view, calling Cocoon with viewUri = [" +
viewUri + "]");
@@ -149,8 +153,8 @@
// custom flowscript
if (view.getCformBindingBefore()!=null){
- scriptString= view.getCformBindingBefore();
- evalFunc = new Function ("form",scriptString);
+ scriptString= view.getCformBindingBefore();
+ evalFunc = new Function ("form",scriptString);
evalFunc(form);
}
@@ -159,13 +163,21 @@
// custom flowscript
if (view.getCformBindingAfter()!=null){
- scriptString= view.getCformBindingAfter();
- evalFunc = new Function ("form",scriptString);
+ scriptString= view.getCformBindingAfter();
+ evalFunc = new Function ("form",scriptString);
evalFunc(form);
}
// form template
form.showForm(viewUri, {"usecase" : proxy});
+
+ // custom flowscript
+ if (view.getCformOutro()!=null){
+ scriptString= view.getCformOutro();
+ evalFunc = new Function ("form",scriptString);
+ evalFunc(form);
+ }
+
}
}
else{
|