You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2003/08/20 20:52:44 UTC
cvs commit: cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/transformation WorkflowMenuTransformer.java UsecaseMenuTransformer.java
andreas 2003/08/20 11:52:44
Modified: src/java/org/apache/lenya/cms/cocoon/transformation
WorkflowMenuTransformer.java
UsecaseMenuTransformer.java
Log:
creating href attribute if it does not exist
Revision Changes Path
1.18 +18 -9 cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/transformation/WorkflowMenuTransformer.java
Index: WorkflowMenuTransformer.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/transformation/WorkflowMenuTransformer.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- WorkflowMenuTransformer.java 5 Aug 2003 11:58:56 -0000 1.17
+++ WorkflowMenuTransformer.java 20 Aug 2003 18:52:44 -0000 1.18
@@ -78,7 +78,6 @@
import java.util.Map;
-
/**
* This transformer disables menu items (by removing the href attribute)
* which are not allowed with respect to the current workflow state.
@@ -112,7 +111,14 @@
attributes.removeAttribute(hrefIndex);
}
} else {
- if (hrefIndex > -1) {
+ if (hrefIndex == -1) {
+ ((AttributesImpl) attributes).addAttribute(
+ "",
+ "href",
+ "href",
+ "CDATA",
+ "?lenya.event=" + event);
+ } else {
String href = attributes.getValue("href");
attributes.setValue(hrefIndex, href + "&lenya.event=" + event);
}
@@ -133,7 +139,10 @@
prefix = raw.substring(0, raw.indexOf(":")) + ":";
}
- super.startElement(uri, "workflow-state", prefix + "workflow-state",
+ super.startElement(
+ uri,
+ "workflow-state",
+ prefix + "workflow-state",
new AttributesImpl());
char[] characters = instance.getCurrentState().toString().toCharArray();
@@ -178,11 +187,11 @@
private boolean hasWorkflow;
private WorkflowInstance instance;
- /**
- * Get the workflow instance.
- *
- * @return a <code>WorkflowInstance</code>
- */
+ /**
+ * Get the workflow instance.
+ *
+ * @return a <code>WorkflowInstance</code>
+ */
protected WorkflowInstance getInstance() {
return instance;
}
1.3 +15 -1 cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/transformation/UsecaseMenuTransformer.java
Index: UsecaseMenuTransformer.java
===================================================================
RCS file: /home/cvs/cocoon-lenya/src/java/org/apache/lenya/cms/cocoon/transformation/UsecaseMenuTransformer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UsecaseMenuTransformer.java 13 Aug 2003 13:14:45 -0000 1.2
+++ UsecaseMenuTransformer.java 20 Aug 2003 18:52:44 -0000 1.3
@@ -117,6 +117,20 @@
((AttributesImpl) attributes).removeAttribute(hrefIndex);
}
}
+
+ // create href attribute if it does not exist
+ else {
+ int hrefIndex = attributes.getIndex("href");
+ if (hrefIndex == -1) {
+ attributes = new AttributesImpl(attr);
+ ((AttributesImpl) attributes).addAttribute(
+ "",
+ "href",
+ "href",
+ "CDATA",
+ "?");
+ }
+ }
} catch (AccessControlException e) {
throw new SAXException(e);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org