Author: michiel
Date: 2010-04-27 14:37:32 +0200 (Tue, 27 Apr 2010)
New Revision: 42052
Modified:
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/datatype.jspx
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/get.datatype.jspxf
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/valid.jspx
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/validation.js.jsp
Log:
MMB-1955
Modified:
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/datatype.jspx
===================================================================
---
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/datatype.jspx
2010-04-27 12:36:19 UTC (rev 42051)
+++
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/datatype.jspx
2010-04-27 12:37:32 UTC (rev 42052)
@@ -1,36 +1,39 @@
-<mm:content
- expires="300"
- type="application/xml"
- postprocessor="none"
+<jsp:root
+ version="2.0"
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0" >
- <mm:cloud uri="${param.uri}" name="${param.cloud}">
- <!--
- Returns XML describing a certain MMBase DataType.
- This can be used in (AJAX based) javascript validation of form entries.
+ <mm:content
+ expires="${param.origin eq 'datatypetag' ? 0 : 300}"
+ type="application/xml"
+ postprocessor="none">
+ <mm:cloud uri="${param.uri}" name="${param.cloud}">
+ <!--
+ Returns XML describing a certain MMBase DataType.
+ This can be used in (AJAX based) javascript validation of form
entries.
- @todo: This JSP must accept a 'language' attribute, and all restriction
error message must be included.
- That way, also those can be used in javascript.
+ @todo: This JSP must accept a 'language' attribute, and all
restriction error message must be included.
+ That way, also those can be used in javascript.
- $Id$
- author: Michiel Meeuwissen
- -->
- <jsp:output omit-xml-declaration="true" />
- <jsp:directive.include file="get.datatype.jspxf" />
+ $Id$
+ author: Michiel Meeuwissen
+ -->
+ <jsp:output omit-xml-declaration="true" />
+ <jsp:directive.include file="get.datatype.jspxf" />
- <jsp:scriptlet>
- if (dataType == null) {
- response.setStatus(404);
- </jsp:scriptlet>
- <notfound />
- <jsp:scriptlet>
- } else {
- </jsp:scriptlet>
-
<jsp:expression>org.mmbase.util.xml.XMLWriter.write(DataTypes.toXml(dataType),
false, true)</jsp:expression>
+ <jsp:scriptlet>
+ if (dataType == null) {
+ response.setStatus(404);
+ </jsp:scriptlet>
+ <notfound />
+ <jsp:scriptlet>
+ } else {
+ </jsp:scriptlet>
+
<jsp:expression>org.mmbase.util.xml.XMLWriter.write(DataTypes.toXml(dataType),
false, true)</jsp:expression>
- <!-- <mm:escape><jsp:expression>dataType</jsp:expression></mm:escape>
-->
- <jsp:scriptlet>
- }
- </jsp:scriptlet>
- </mm:cloud>
-</mm:content>
+ <!-- <mm:escape><jsp:expression>dataType</jsp:expression></mm:escape>
-->
+ <jsp:scriptlet>
+ }
+ </jsp:scriptlet>
+ </mm:cloud>
+ </mm:content>
+</jsp:root>
Modified:
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/get.datatype.jspxf
===================================================================
---
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/get.datatype.jspxf
2010-04-27 12:36:19 UTC (rev 42051)
+++
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/get.datatype.jspxf
2010-04-27 12:37:32 UTC (rev 42052)
@@ -1,13 +1,16 @@
<jsp:root
version="2.0"
xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:mm="http://www.mmbase.org/mmbase-taglib-2.0" >
<jsp:directive.page
- import="org.mmbase.bridge.*,org.mmbase.datatypes.*,java.util.*"
- session="false" />
-
+ session="false"
+
import="org.mmbase.bridge.*,org.mmbase.datatypes.*,java.util.*,org.mmbase.bridge.jsp.taglib.DataTypeTag"
+ />
<mm:import externid="datatype" jspvar="dt" vartype="string" />
+ <mm:import externid="origin" jspvar="origin" vartype="string" />
<mm:import externid="node" jspvar="n" vartype="string" />
+
<jsp:scriptlet>
Node node = null;
Field field = null;
@@ -20,7 +23,18 @@
locale = cloud.getLocale();
</jsp:scriptlet>
<mm:present referid="datatype">
- <jsp:scriptlet>dataType =
DataTypes.getSystemCollector().getDataType(dt);</jsp:scriptlet>
+ <jsp:scriptlet>
+ DataTypeCollector collector;
+ if (origin.equals("datatypetag")) {
+ collector = (DataTypeCollector)
(((javax.servlet.http.HttpServletRequest)
pageContext.getRequest()).getSession().getAttribute(DataTypeTag.KEY));
+ if (collector == null) {
+ throw new IllegalStateException("No collector found in session");
+ }
+ } else {
+ collector = DataTypes.getSystemCollector();
+ }
+ dataType = collector.getDataType(dt);
+ </jsp:scriptlet>
</mm:present>
<mm:notpresent referid="datatype">
<mm:import externid="field" required="true" />
Modified:
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/valid.jspx
===================================================================
---
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/valid.jspx
2010-04-27 12:36:19 UTC (rev 42051)
+++
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/valid.jspx
2010-04-27 12:37:32 UTC (rev 42052)
@@ -16,7 +16,7 @@
-->
<jsp:directive.page
import="org.mmbase.datatypes.*,org.mmbase.util.LocalizedString"
- session="false" />
+ />
<jsp:directive.include file="get.datatype.jspxf" />
<mm:import externid="value" required="true" vartype="string" jspvar="value"/>
<mm:cloud method="asis" sessionname="${param.sessionname}"
uri="${param.uri}" name="${param.name}">
Modified:
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/validation.js.jsp
===================================================================
---
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/validation.js.jsp
2010-04-27 12:36:19 UTC (rev 42051)
+++
mmbase/branches/MMBase-1_9/base-webapp/src/main/webapp/mmbase/validation/validation.js.jsp
2010-04-27 12:37:32 UTC (rev 42052)
@@ -664,9 +664,10 @@
this.nodeManager = null;
this.field = null;
this.datatype = null;
+ this.origin = "field";
}
Key.prototype.string = function() {
- return this.cloud + "@" + this.uri + "," + this.dataType + "," +
this.field + "," + this.nodeManager;
+ return this.cloud + "@" + this.uri + "," + this.dataType + "," +
this.field + "," + this.nodeManager + "," + this.origin;
};
/**
@@ -687,6 +688,8 @@
var className = classNames[i];
if (className.indexOf("mm_dt_") == 0) {
result.dataType = className.substring(6);
+ } else if (className.indexOf("mm_dto_") == 0) {
+ result.origin = className.substring(7);
} else if (className.indexOf("mm_f_") == 0) {
result.field = className.substring(5);
} else if (className.indexOf("mm_nm_") == 0) {
@@ -784,7 +787,7 @@
*/
MMBaseValidator.prototype.getDataTypeArguments = function(key) {
if (key.dataType != null) {
- return {datatype: key.dataType, uri: key.uri, cloud: key.cloud};
+ return {datatype: key.dataType, uri: key.uri, cloud: key.cloud,
origin: key.origin};
} else {
return {field: key.field, nodemanager: key.nodeManager, uri: key.uri,
cloud: key.cloud};
}
@@ -1109,7 +1112,9 @@
MMBaseValidator.prototype.showServerErrors = function(element, serverXml, id) {
var valid = this.validResult(serverXml);
- if (id == null) id = element.id;
+ if (id == null) {
+ id = element.id;
+ }
if (id != null) {
var errorDiv = document.getElementById("mm_check_" + id.substring(3));
if (errorDiv != null) {
@@ -1128,7 +1133,11 @@
}
}
}
+ } else {
+ console.log("No error div " + "mm_check_" + id.substring(3));
}
+ } else {
+ console.log("No element " + id);
}
this.updateValidity(element, valid);
};
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs