You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2007/08/02 20:30:30 UTC
svn commit: r562215 - in
/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar:
DatePicker.java DatePicker.js
Author: ehillenius
Date: Thu Aug 2 11:30:29 2007
New Revision: 562215
URL: http://svn.apache.org/viewvc?view=rev&rev=562215
Log:
WICKET-809
Modified:
wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.js
Modified: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java?view=diff&rev=562215&r1=562214&r2=562215
==============================================================================
--- wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java (original)
+++ wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java Thu Aug 2 11:30:29 2007
@@ -118,7 +118,7 @@
Response response = component.getResponse();
response
.write("\n<span> <div style=\"display:none;position:absolute;z-index: 99999;\" id=\"");
- response.write(getComponentMarkupId());
+ response.write(getEscapedComponentMarkupId());
response.write("Dp\"></div><img style=\"");
response.write(getIconStyle());
response.write("\" id=\"");
@@ -151,7 +151,8 @@
// variables for the initialization script
Map variables = new HashMap();
- String widgetId = getComponentMarkupId();
+ String widgetId = getEscapedComponentMarkupId();
+ variables.put("componentId", getComponentMarkupId());
variables.put("widgetId", widgetId);
variables.put("datePattern", getDatePattern());
variables.put("fireChangeEvent", Boolean.valueOf(notifyComponentOnDateSelected()));
@@ -346,11 +347,12 @@
return (String[])l.toArray(new String[l.size()]);
}
+
/**
- * Gets the DOM id that the calendar widget will get attached to.
+ * Gets the id of the component that the calendar widget will get attached
+ * to.
*
- * @return The DOM id of the calendar widget - same as the component's
- * markup id + 'Dp'}
+ * @return The DOM id of the component
*/
protected final String getComponentMarkupId()
{
@@ -358,6 +360,17 @@
}
/**
+ * Gets the escaped DOM id that the calendar widget will get attached to.
+ * All non word characters (\W) will be removed from the string.
+ *
+ * @return the escaped DOM id
+ */
+ protected final String getEscapedComponentMarkupId()
+ {
+ return component.getMarkupId().replaceAll("\\W", "");
+ }
+
+ /**
* Gets the date pattern to use for putting selected values in the coupled
* component.
*
@@ -394,7 +407,7 @@
*/
protected final String getIconId()
{
- return component.getMarkupId() + "Icon";
+ return getEscapedComponentMarkupId() + "Icon";
}
/**
Modified: wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.js
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.js?view=diff&rev=562215&r1=562214&r2=562215
==============================================================================
--- wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.js (original)
+++ wicket/trunk/jdk-1.4/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.js Thu Aug 2 11:30:29 2007
@@ -21,19 +21,19 @@
YAHOO.wicket.${widgetId}DpJs = new YAHOO.widget.Calendar("${widgetId}DpJs","${widgetId}Dp", { ${calendarInit} });
YAHOO.wicket.${widgetId}DpJs.isVisible = function() { return YAHOO.wicket.${widgetId}DpJs.oDomContainer.style.display == 'block'; }
-
+
function showCalendar() {
- Wicket.DateTime.showCalendar(YAHOO.wicket.${widgetId}DpJs, YAHOO.util.Dom.get("${widgetId}").value, '${datePattern}');
+ Wicket.DateTime.showCalendar(YAHOO.wicket.${widgetId}DpJs, YAHOO.util.Dom.get("${componentId}").value, '${datePattern}');
if (${alignWithIcon}) Wicket.DateTime.positionRelativeTo(YAHOO.wicket.${widgetId}DpJs.oDomContainer, "${widgetId}Icon");
}
YAHOO.util.Event.addListener("${widgetId}Icon", "click", showCalendar, YAHOO.wicket.${widgetId}DpJs, true);
function selectHandler(type, args, cal) {
- YAHOO.util.Dom.get("${widgetId}").value = Wicket.DateTime.substituteDate('${datePattern}', args[0][0]);
+ YAHOO.util.Dom.get("${componentId}").value = Wicket.DateTime.substituteDate('${datePattern}', args[0][0]);
cal.hide();
if (${fireChangeEvent} && YAHOO.wicket.${widgetId}DpJs.isVisible()) {
- var field = YAHOO.util.Dom.get("${widgetId}");
+ var field = YAHOO.util.Dom.get("${componentId}");
if (typeof(field.onchange) != 'undefined') field.onchange();
}
}