diff --git a/NOTICE b/NOTICE
index c2b4544b95b..7cc91f994f0 100644
--- a/NOTICE
+++ b/NOTICE
@@ -59,9 +59,6 @@ src/./wicket-examples
This product includes ASM, released under a BSD style license (http://asm.objectweb.org).
Copyright (c) 2000-2005 INRIA, France Telecom
- This product includes software developed by
- Joda.org (http://www.joda.org/).
-
This product includes jhighlight (https://jhighlight.dev.java.net/)
which is released under CDDL 1.0 license (http://www.opensource.org/licenses/cddl1.php).
@@ -114,9 +111,6 @@ src/./wicket-datetime
http://developer.yahoo.net/yui/license.txt
Copyright (c) 2010, Yahoo! Inc.
- This product includes software developed by
- Joda.org (http://www.joda.org/).
-
---------------------------------------------------------------------------
src/./wicket-metrics
---------------------------------------------------------------------------
diff --git a/README.md b/README.md
index 3ff8f958a9c..a17dd274242 100644
--- a/README.md
+++ b/README.md
@@ -157,10 +157,6 @@ the src/ folder.
As the following projects all depend on wicket, they inherit these
dependencies.
- - wicket-datetime:
-
- Joda-Time 2.4 (http://joda-time.sourceforge.net/)
-
- wicket-velocity:
Apache Velocity 1.7 (http://velocity.apache.org/) and it's dependencies
diff --git a/pom.xml b/pom.xml
index a5cf4dbbd71..3c2657ed2ea 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,7 +89,6 @@
wicketwicket-corewicket-util
- wicket-datetimewicket-requestwicket-devutilswicket-extensions
@@ -247,11 +246,6 @@
javax.inject1
-
- joda-time
- joda-time
- ${joda-time.version}
- log4jlog4j
diff --git a/testing/wicket-common-tests/pom.xml b/testing/wicket-common-tests/pom.xml
index 62ccc6131cf..a8a37507451 100644
--- a/testing/wicket-common-tests/pom.xml
+++ b/testing/wicket-common-tests/pom.xml
@@ -57,11 +57,6 @@
wicket-coretest
-
- org.apache.wicket
- wicket-datetime
- test
- org.apache.wicketwicket-devutils
diff --git a/testing/wicket-js-tests/Gruntfile.js b/testing/wicket-js-tests/Gruntfile.js
index 6cb79bd060f..29b746b4c04 100644
--- a/testing/wicket-js-tests/Gruntfile.js
+++ b/testing/wicket-js-tests/Gruntfile.js
@@ -34,9 +34,6 @@ module.exports = function(grunt) {
"../../wicket-extensions/src/main/java/org/apache/wicket/extensions/ajax/markup/html/modal/res/modal.js",
"../../wicket-extensions/src/main/java/org/apache/wicket/extensions/markup/html/repeater/data/table/filter/wicket-filterform.js"
],
- datetimeJs = [
- "../../wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/wicket-date.js"
- ],
nativeWebSocketJs = [
"../../wicket-native-websocket/wicket-native-websocket-core/src/main/java/org/apache/wicket/protocol/ws/api/res/js/wicket-websocket-jquery.js"
],
@@ -75,7 +72,6 @@ module.exports = function(grunt) {
jshint: {
core: coreJs,
extensions: extensionsJs,
- datetime: datetimeJs,
nativeWebSocket: nativeWebSocketJs,
testsJs: testsJs,
gymTestsJs: gymTestsJs,
diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
index 0112614a017..c85772a59c9 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/html/form/FormComponentPanel.java
@@ -40,8 +40,7 @@
*
* Here is a simple example of a panel with two components that multiplies and sets that as the
* master model object. Note that for this simple example, setting the model value wouldn't make
- * sense, as the lhs and rhs cannot be known. For more complete examples of using this class, see
- * the wicket-datetime project.
+ * sense, as the lhs and rhs cannot be known.
*
*
*
diff --git a/wicket-datetime/pom.xml b/wicket-datetime/pom.xml
deleted file mode 100644
index 26330c38532..00000000000
--- a/wicket-datetime/pom.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
- 4.0.0
-
- org.apache.wicket
- wicket-parent
- 8.0.0-SNAPSHOT
- ../pom.xml
-
- wicket-datetime
- bundle
- Wicket Date/Time
- Date/Time components and utilities for Wicket
-
-
- joda-time
- joda-time
-
-
- org.apache.wicket
- wicket-core
-
-
-
-
-
- org.apache.felix
- maven-bundle-plugin
-
-
- bundle-manifest
- process-classes
-
- manifest
-
-
-
-
- !org.apache.wicket.extensions.yui.yahoo-dom-event,*
-
-
-
-
-
-
-
-
-
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java b/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java
deleted file mode 100644
index 3459397257f..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/datetime/markup/html/basic/DateLabel.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.datetime.markup.html.basic;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.apache.wicket.IGenericComponent;
-import org.apache.wicket.datetime.DateConverter;
-import org.apache.wicket.datetime.PatternDateConverter;
-import org.apache.wicket.datetime.StyleDateConverter;
-import org.apache.wicket.markup.ComponentTag;
-import org.apache.wicket.markup.MarkupStream;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.util.convert.IConverter;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.joda.time.format.DateTimeFormat;
-
-
-/**
- * A label that is mapped to a java.util.Date object and that uses Joda time to format
- * values.
- *
- * You can provide a date pattern in two of the constructors. When not provided,
- * {@link DateTimeFormat#shortDate()} will be used.
- *
- *
- * A special option is applyTimeZoneDifference which is an option that says whether to correct for
- * the difference between the client's time zone and server's time zone. This is true by default.
- *
- *
- * @see DateTime
- * @see DateTimeFormat
- * @see DateTimeZone
- *
- * @author eelcohillenius
- */
-public class DateLabel extends Label implements IGenericComponent
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param datePattern
- * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available
- * patterns.
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forDatePattern(String id, IModel model, String datePattern)
- {
- return new DateLabel(id, model, new PatternDateConverter(datePattern, true));
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param datePattern
- * The pattern to use. Must be not null. See {@link SimpleDateFormat} for available
- * patterns.
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forDatePattern(String id, String datePattern)
- {
- return forDatePattern(id, null, datePattern);
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param dateStyle
- * style to use in case no pattern is provided. Must be two characters from the set
- * {"S", "M", "L", "F", "-"}. Must be not null. See
- * {@link DateTimeFormat#forStyle(String)} for options.
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forDateStyle(String id, IModel model, String dateStyle)
- {
- return new DateLabel(id, model, new StyleDateConverter(dateStyle, true));
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param dateStyle
- * style to use in case no pattern is provided. Must be two characters from the set
- * {"S", "M", "L", "F", "-"}. Must be not null. See
- * {@link DateTimeFormat#forStyle(String)} for options.
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forDateStyle(String id, String dateStyle)
- {
- return forDateStyle(id, null, dateStyle);
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forShortStyle(String id)
- {
- return forShortStyle(id, null);
- }
-
- /**
- * Creates a new DateLabel defaulting to using a short date pattern
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel forShortStyle(String id, IModel model)
- {
- return new DateLabel(id, model, new StyleDateConverter(true));
- }
-
- /**
- * Creates a new DateLabel using the provided converter.
- *
- * @param id
- * The id of the text field
- * @param converter
- * the date converter
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel withConverter(String id, DateConverter converter)
- {
- return withConverter(id, null, converter);
- }
-
- /**
- * Creates a new DateLabel using the provided converter.
- *
- * @param id
- * The id of the text field
- * @param model
- * The model
- * @param converter
- * the date converter
- * @return new instance
- *
- * @see org.apache.wicket.markup.html.form.TextField
- */
- public static DateLabel withConverter(String id, IModel model, DateConverter converter)
- {
- return new DateLabel(id, model, converter);
- }
-
- /** optionally prepend to label. */
- private String after;
-
- /** optionally append to label. */
- private String before;
-
- /**
- * The converter for the Label
- */
- private final DateConverter converter;
-
- /**
- * Construct with a converter.
- *
- * @param id
- * The component id
- * @param converter
- * The converter to use
- */
- public DateLabel(String id, DateConverter converter)
- {
- this(id, null, converter);
- }
-
- /**
- * Construct with a converter.
- *
- * @param id
- * The component id
- * @param model
- * The model
- * @param converter
- * The converter to use
- */
- public DateLabel(String id, IModel model, DateConverter converter)
- {
- super(id, model);
- if (converter == null)
- {
- throw new IllegalStateException("converter may not be null");
- }
- this.converter = converter;
- }
-
- /**
- * @return after append to label or null
- */
- public String getAfter()
- {
- return after;
- }
-
- /**
- * @return before prepend to label or null
- */
- public String getBefore()
- {
- return before;
- }
-
- /**
- * Returns the specialized converter.
- */
- @Override
- protected IConverter> createConverter(Class> type)
- {
- if (Date.class.isAssignableFrom(type))
- {
- return converter;
- }
- return null;
- }
-
- /**
- * @param after
- * append to label
- */
- public void setAfter(String after)
- {
- this.after = after;
- }
-
- /**
- * @param before
- * prepend to label
- */
- public void setBefore(String before)
- {
- this.before = before;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag)
- {
- String s = getDefaultModelObjectAsString();
- if (before != null)
- {
- s = before + s;
- }
- if (after != null)
- {
- s = s + after;
- }
- replaceComponentTagBody(markupStream, openTag, s);
- }
-}
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/VERSION b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/VERSION
deleted file mode 100644
index 094e00c2a0b..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/VERSION
+++ /dev/null
@@ -1,2 +0,0 @@
-http://developer.yahoo.com/yui/
-this version: 2.8.2r1
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java
deleted file mode 100644
index f8cfec5c870..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/YuiLib.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.extensions.yui;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.request.resource.PackageResourceReference;
-import org.apache.wicket.request.resource.ResourceReference;
-
-/**
- * Use the {@link #load(org.apache.wicket.markup.head.IHeaderResponse)} method to initialize the YUI library using the YUI loader.
- * It is OK to call this multiple times.
- *
- * By default the resource stream gets gzipped. You may disable it via
- * Application.get().getResourceSettings().getDisableGZipCompression()
- *
- * @author eelcohillenius
- */
-public final class YuiLib
-{
- private static ResourceReference YUILOADER;
-
- /**
- * Load the YUI loader script. After that, you can declare YUI dependencies using
- * YAHOO.util.YUILoader.
- *
- * @param response
- * header response
- */
- public static void load(IHeaderResponse response)
- {
- response.render(JavaScriptHeaderItem.forReference(getYuiLoader()));
- }
-
- private static ResourceReference getYuiLoader()
- {
- if (YUILOADER == null)
- {
- StringBuilder sb = new StringBuilder("yuiloader/yuiloader");
- if (Application.get().usesDeploymentConfig())
- {
- sb.append("-min");
- }
- sb.append(".js");
- YUILOADER = new PackageResourceReference(YuiLib.class, sb.toString());
- }
- return YUILOADER;
- }
-
- /**
- * Prevent construction.
- */
- private YuiLib()
- {
- }
-}
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/assets/skins/sam/sprite.png b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/assets/skins/sam/sprite.png
deleted file mode 100644
index 73634d6a22c..00000000000
Binary files a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/assets/skins/sam/sprite.png and /dev/null differ
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/AbstractCalendar.java b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/AbstractCalendar.java
deleted file mode 100644
index b448196564e..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/AbstractCalendar.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.extensions.yui.calendar;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-
-import org.apache.wicket.extensions.yui.YuiLib;
-import org.apache.wicket.markup.head.CssHeaderItem;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.markup.html.WebComponent;
-import org.apache.wicket.request.resource.PackageResourceReference;
-
-
-/**
- * Abstract calendar component based on the YUI (Yahoo User Interface library) javascript widget.
- *
- * Although this component by itself is fully functional, it doesn't do much other than just
- * displaying the calendar. Hence, this class is abstract.
- *
- *
- * An easy way to build upon this component is to override
- * {@link #appendToInit(String, String, String, StringBuffer)} and add event handlers etc. in the
- * YUI widget's initialization function.
- *
- * See YUI's calendar documentation for more
- * info.
- *
- * @author eelcohillenius
- *
- * @see DatePicker
- */
-// TODO provide localization strings (base them on the messages of
-// JsDatePicker?)
-public abstract class AbstractCalendar extends WebComponent
-{
- private static final long serialVersionUID = 1L;
-
- private final boolean contributeDependencies;
-
- /**
- * Construct. Contributes packaged dependencies.
- *
- * @param id
- * The component id
- */
- public AbstractCalendar(String id)
- {
- this(id, true);
- }
-
- /**
- * Construct.
- *
- * @param id
- * The component id
- * @param contributeDependencies
- * Whether to contribute the packaged dependencies. Pass false in case you want to
- * include the dependencies manually in your own page, e.g. when you want to keep
- * them in your web application dir. To contribute yourself (in case you want to pass
- * false), your page header should look like:
- *
- *
- */
- public AbstractCalendar(String id, boolean contributeDependencies)
- {
-
- super(id);
- setOutputMarkupId(true);
- this.contributeDependencies = contributeDependencies;
- }
-
- /**
- * Gets the id of the javascript widget. Note that this is the non-namespaced id, so depending
- * on what you want to do with it, you may need to prepend 'YAHOO.wicket.' to it. Or you can
- * call {@link #getJavaScriptWidgetId()}.
- *
- * @return The javascript id
- * @see #getJavaScriptWidgetId()
- */
- public final String getJavaScriptId()
- {
- return getMarkupId() + "Js";
- }
-
- /**
- * The name spaced id of the widget.
- *
- * @return The widget id
- * @see #getJavaScriptId()
- */
- public final String getJavaScriptWidgetId()
- {
- return "YAHOO.wicket." + getJavaScriptId();
- }
-
- /**
- * add header contributions for packaged resources.
- *
- * @param response
- * the header response to contribute to
- */
- private void contributeDependencies(IHeaderResponse response)
- {
- response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(
- YuiLib.class, "yahoodomevent/yahoo-dom-event.js")));
- response.render(JavaScriptHeaderItem.forReference(new PackageResourceReference(
- AbstractCalendar.class, "calendar-min.js")));
- response.render(CssHeaderItem.forReference(new PackageResourceReference(
- AbstractCalendar.class, "assets/skins/sam/calendar.css")));
- }
-
- /**
- * Append javascript to the initialization function for the YUI widget. Can be used by
- * subclasses to conveniently extend configuration without having to write a separate
- * contribution.
- *
- * @param markupId
- * The markup id of the calendar component
- * @param javascriptId
- * the non-name spaced javascript id of the widget
- * @param javascriptWidgetId
- * the name space id of the widget
- * @param b
- * the buffer to append the script to
- */
- protected void appendToInit(String markupId, String javascriptId, String javascriptWidgetId,
- StringBuilder b)
- {
- }
-
- /**
- * Gives overriding classes the option of adding (or even changing/ removing) configuration
- * properties for the javascript widget. See the widget's documentation for the
- * available options. If you want to override/ remove properties, you obviously should call
- * super.configureWidgetProperties(properties).
- *
- * @param widgetProperties
- * the current widget properties
- */
- protected void configureWidgetProperties(Map
- *
- * Markup:
- *
- *
- * <div wicket:id="birthday"></div>
- *
- *
- *
- *
- * @author eelcohillenius
- */
-public class DateField extends DateTimeField
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct.
- *
- * @param id
- */
- public DateField(String id)
- {
- this(id, null);
- }
-
- /**
- * Construct.
- *
- * @param id
- * @param model
- */
- public DateField(String id, IModel model)
- {
- super(id, model);
-
- get(HOURS).setVisibilityAllowed(false);
- get(MINUTES).setVisibilityAllowed(false);
- get(AM_OR_PM_CHOICE).setVisibilityAllowed(false);
- }
-}
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
deleted file mode 100644
index 6b09e7a385b..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.java
+++ /dev/null
@@ -1,890 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.extensions.yui.calendar;
-
-import java.text.DateFormatSymbols;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.apache.wicket.Application;
-import org.apache.wicket.Component;
-import org.apache.wicket.WicketRuntimeException;
-import org.apache.wicket.ajax.AjaxEventBehavior;
-import org.apache.wicket.behavior.Behavior;
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
-import org.apache.wicket.datetime.markup.html.form.DateTextField;
-import org.apache.wicket.extensions.yui.YuiLib;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
-import org.apache.wicket.markup.html.form.AbstractTextComponent.ITextFormatProvider;
-import org.apache.wicket.request.Response;
-import org.apache.wicket.request.cycle.RequestCycle;
-import org.apache.wicket.request.handler.resource.ResourceReferenceRequestHandler;
-import org.apache.wicket.request.resource.JavaScriptResourceReference;
-import org.apache.wicket.request.resource.PackageResourceReference;
-import org.apache.wicket.request.resource.ResourceReference;
-import org.apache.wicket.util.convert.IConverter;
-import org.apache.wicket.util.convert.converter.DateConverter;
-import org.apache.wicket.util.lang.Objects;
-import org.apache.wicket.util.string.Strings;
-import org.apache.wicket.util.template.PackageTextTemplate;
-import org.apache.wicket.util.template.TextTemplate;
-import org.joda.time.DateTime;
-
-/**
- * Pops up a YUI calendar component so that the user can select a date. On selection, the date is
- * set in the component it is coupled to, after which the popup is closed again. This behavior can
- * only be used with components that either implement {@link ITextFormatProvider} or that use
- * {@link DateConverter} configured with an instance of {@link SimpleDateFormat} (like Wicket's
- * default configuration has).
- *
- * To use, simply add a new instance to your component, which would typically a TextField, like
- * {@link DateTextField}.
- *
- * The CalendarNavigator can be configured by overriding {@link #configure(java.util.Map, org.apache.wicket.markup.head.IHeaderResponse, java.util.Map)} and setting the
- * property or by returning true for {@link #enableMonthYearSelection()}.
- *
- * @see http://developer.yahoo.com/yui/calendar/
- *
- * @author eelcohillenius
- */
-public class DatePicker extends Behavior
-{
-
- /**
- * Exception thrown when the bound component does not produce a format this date picker can work
- * with.
- */
- private static final class UnableToDetermineFormatException extends WicketRuntimeException
- {
- private static final long serialVersionUID = 1L;
-
- public UnableToDetermineFormatException()
- {
- super("This behavior can only be added to components that either implement " +
- ITextFormatProvider.class.getName() +
- " AND produce a non-null format, or that use" +
- " converters that this DatePicker can use to determine" +
- " the pattern being used. Alternatively, you can extend " +
- " the DatePicker and override getDatePattern to provide your own.");
- }
- }
-
- /**
- * Format to be used when configuring YUI calendar. Can be used when using the
- * "selected" property.
- */
- // See wicket-1988: SimpleDateFormat is not thread safe. Do not use static final
- // See wicket-2525: SimpleDateFormat consumes a lot of memory
- public static String FORMAT_DATE = "MM/dd/yyyy";
-
- /**
- * For specifying which page (month/year) to show in the calendar, use this format for the date.
- * This is to be used together with the property "pagedate"
- */
- // See wicket-1988: SimpleDateFormat is not thread safe. Do not use static final
- // See wicket-2525: SimpleDateFormat consumes a lot of memory
- public static String FORMAT_PAGEDATE = "MM/yyyy";
-
- private static final ResourceReference YUI = new JavaScriptResourceReference(YuiLib.class, "");
-
- private static final ResourceReference WICKET_DATE = new JavaScriptResourceReference(
- DatePicker.class, "wicket-date.js");
-
- private static final long serialVersionUID = 1L;
-
- /** The target component. */
- private Component component;
-
- private boolean showOnFieldClick = false;
-
- /**
- * A setting that decides whether to close the date picker when the user clicks somewhere else
- * on the document.
- */
- private boolean autoHide = false;
-
- /**
- * The string to use for the close button label.
- */
- private String closeLabel = "";
-
- /**
- * Construct.
- */
- public DatePicker()
- {
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void bind(final Component component)
- {
- this.component = component;
- checkComponentProvidesDateFormat(component);
- component.setOutputMarkupId(true);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void afterRender(final Component component)
- {
- super.afterRender(component);
-
- // Append the span and img icon right after the rendering of the
- // component. Not as pretty as working with a panel etc, but works
- // for behaviors and is more efficient
- Response response = component.getResponse();
- response.write("\n ");
-
- if (renderOnLoad())
- {
- response.write(" ");
- }
- response.write("");
- }
-
- /**
- * Controls whether or not datepicker will contribute YUI libraries to the page as part of its
- * rendering lifecycle.
- *
- * There may be cases when the user wants to use their own version of YUI contribution code, in
- * those cases this method should be overridden to return false.
- *
- * @return a flag whether to contribute YUI libraries to the page. {@code true} by default.
- */
- protected boolean includeYUILibraries()
- {
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void renderHead(Component component, IHeaderResponse response)
- {
- super.renderHead(component, response);
-
- if (includeYUILibraries())
- {
- YuiLib.load(response);
- }
-
- renderHeadInit(response);
-
- // variables for the initialization script
- Map variables = new HashMap<>();
- String widgetId = getEscapedComponentMarkupId();
- variables.put("componentId", getComponentMarkupId());
- variables.put("widgetId", widgetId);
- variables.put("datePattern", getDatePattern());
- variables.put("fireChangeEvent", notifyComponentOnDateSelected());
- variables.put("alignWithIcon", alignWithIcon());
- variables.put("hideOnSelect", hideOnSelect());
- variables.put("showOnFieldClick", showOnFieldClick());
- variables.put("autoHide", autoHide());
- variables.put("closeLabel", closeLabel());
-
- String script = getAdditionalJavaScript();
- if (script != null)
- {
- variables.put("additionalJavascript",
- Strings.replaceAll(script, "${calendar}", "YAHOO.wicket." + widgetId + "DpJs"));
- }
-
- // print out the initialization properties
- Map p = new LinkedHashMap<>();
- configure(p, response, variables);
- if (!p.containsKey("navigator") && enableMonthYearSelection())
- {
- p.put("navigator", Boolean.TRUE);
- }
-
- if (enableMonthYearSelection() && p.containsKey("pages") &&
- Objects.longValue(p.get("pages")) > 1)
- {
- throw new IllegalStateException(
- "You cannot use a CalendarGroup with month/year selection!");
- }
-
- // ${calendarInit}
- StringBuilder calendarInit = new StringBuilder();
- appendMapping(p, calendarInit);
- variables.put("calendarInit", calendarInit.toString());
-
- // render initialization script with the variables interpolated
- TextTemplate datePickerJs = new PackageTextTemplate(DatePicker.class, "DatePicker.js");
- datePickerJs.interpolate(variables);
- response.render(OnDomReadyHeaderItem.forScript(datePickerJs.asString()));
-
- // remove previously generated markup (see onRendered) via javascript in
- // ajax requests to not render the yui calendar multiple times
- component.getRequestCycle().find(IPartialPageRequestHandler.class).ifPresent(target -> {
- String escapedComponentMarkupId = getEscapedComponentMarkupId();
- String javascript = "var e = Wicket.$('" + escapedComponentMarkupId + "Dp" +
- "'); if (e != null && typeof(e.parentNode) != 'undefined' && " +
- "typeof(e.parentNode.parentNode != 'undefined')) {" +
- "e.parentNode.parentNode.removeChild(e.parentNode);" + "YAHOO.wicket." +
- escapedComponentMarkupId + "DpJs.destroy(); delete YAHOO.wicket." +
- escapedComponentMarkupId + "DpJs;}";
-
- target.prependJavaScript(javascript);
- });
- }
-
- /**
- * Renders yui & wicket calendar js module loading. It is done only once per page.
- *
- * @param response
- * header response
- */
- protected void renderHeadInit(IHeaderResponse response)
- {
- String key = "DatePickerInit.js";
- if (response.wasRendered(key))
- {
- return;
- }
-
- // variables for YUILoader
- Map variables = new HashMap<>();
- variables.put("basePath",
- Strings.stripJSessionId(RequestCycle.get().urlFor(YUI, null).toString()) + "/");
- variables.put("Wicket.DateTimeInit.DatePath", RequestCycle.get().urlFor(WICKET_DATE, null));
-
- if (Application.get().usesDevelopmentConfig())
- {
- variables.put("filter", "filter: \"RAW\",");
- variables.put("allowRollup", false);
- }
- else
- {
- variables.put("filter", "");
- variables.put("allowRollup", true);
- }
-
- TextTemplate template = new PackageTextTemplate(DatePicker.class, key);
- response.render(OnDomReadyHeaderItem.forScript(template.asString(variables)));
-
- response.markRendered(key);
- }
-
- /**
- * Check that this behavior can get a date format out of the component it is coupled to. It
- * checks whether {@link #getDatePattern()} produces a non-null value. If that method returns
- * null, and exception will be thrown
- *
- * @param component
- * the component this behavior is being coupled to
- * @throws UnableToDetermineFormatException
- * if this date picker is unable to determine a format.
- */
- private void checkComponentProvidesDateFormat(final Component component)
- {
- if (getDatePattern() == null)
- {
- throw new UnableToDetermineFormatException();
- }
- }
-
- /**
- * Set widget property if the array is null and has a length greater than 0.
- *
- * @param widgetProperties
- * @param key
- * @param array
- */
- private void setWidgetProperty(final Map widgetProperties, final String key,
- final String[] array)
- {
- if (array != null && array.length > 0)
- {
- widgetProperties.put(key, array);
- }
- }
-
- /**
- * Whether to position the date picker relative to the trigger icon.
- *
- * @return If true, the date picker is aligned with the left position of the icon, and with the
- * top right under. If false, the date picker will skip positioning and will let you do
- * the positioning yourself. Returns true by default.
- */
- protected boolean alignWithIcon()
- {
- return true;
- }
-
- /**
- * Gives overriding classes the option of adding (or even changing/ removing) configuration
- * properties for the javascript widget. See the widget's documentation for the
- * available options. If you want to override/ remove properties, you should call
- * super.configure(properties) first. If you don't call that, be aware that you will have to
- * call {@link #localize(java.util.Map, org.apache.wicket.markup.head.IHeaderResponse, java.util.Map)} manually if you like localized strings to be added.
- *
- * @param widgetProperties
- * the current widget properties
- * @param response
- * the header response
- * @param initVariables
- * variables passed to the Wicket.DateTime.init() js method
- */
- protected void configure(final Map widgetProperties,
- final IHeaderResponse response, final Map initVariables)
- {
- widgetProperties.put("close", true);
-
- // localize date fields
- localize(widgetProperties, response, initVariables);
-
- Object modelObject = component.getDefaultModelObject();
- // null and cast check
- if (modelObject instanceof Date)
- {
- Date date = (Date)modelObject;
- widgetProperties.put("selected", new SimpleDateFormat(FORMAT_DATE).format(date));
- widgetProperties.put("pagedate", new SimpleDateFormat(FORMAT_PAGEDATE).format(date));
- }
- }
-
- /**
- * Filter all empty elements (workaround for {@link DateFormatSymbols} returning arrays with
- * empty elements).
- *
- * @param stringArray
- * array to filter
- * @return filtered array (without null or empty string elements)
- */
- protected final String[] filterEmpty(String[] stringArray)
- {
- if (stringArray == null)
- {
- return null;
- }
-
- List list = new ArrayList<>(stringArray.length);
- for (String string : stringArray)
- {
- if (!Strings.isEmpty(string))
- {
- list.add(string);
- }
- }
- return list.toArray(new String[list.size()]);
- }
-
- /**
- * Gets the id of the component that the calendar widget will get attached to.
- *
- * @return The DOM id of the component
- */
- protected final String getComponentMarkupId()
- {
- return component.getMarkupId();
- }
-
- /**
- * Gets the date pattern to use for putting selected values in the coupled component.
- *
- * @return The date pattern
- */
- protected String getDatePattern()
- {
- String format = null;
- if (component instanceof ITextFormatProvider)
- {
- format = ((ITextFormatProvider)component).getTextFormat();
- // it is possible that components implement ITextFormatProvider but
- // don't provide a format
- }
-
- if (format == null)
- {
- IConverter> converter = component.getConverter(DateTime.class);
- if (!(converter instanceof DateConverter))
- {
- converter = component.getConverter(Date.class);
- }
- format = ((SimpleDateFormat)((DateConverter)converter).getDateFormat(component.getLocale())).toPattern();
- }
-
- return format;
- }
-
- /**
- * 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 DOM id of the calendar widget - same as the component's markup id + 'Dp'}
- */
- protected final String getEscapedComponentMarkupId()
- {
- return component.getMarkupId().replaceAll("\\W", "");
- }
-
- /**
- * Gets the id of the icon that triggers the popup.
- *
- * @return The id of the icon
- */
- protected final String getIconId()
- {
- return getEscapedComponentMarkupId() + "Icon";
- }
-
- /**
- * Gets the style of the icon that triggers the popup.
- *
- * @return The style of the icon, e.g. 'cursor: point' etc.
- */
- protected String getIconStyle()
- {
- return "cursor: pointer; border: none;";
- }
-
- /**
- * Gets the title attribute of the datepicker icon
- *
- * @return text
- */
- protected CharSequence getIconTitle()
- {
- return "";
- }
-
- /**
- * Gets the icon alt text for the datepicker icon
- *
- * @return text
- */
- protected CharSequence getIconAltText()
- {
- return "";
- }
-
- /**
- * Gets the url for the popup button. Users can override to provide their own icon URL.
- *
- * @return the url to use for the popup button/ icon
- */
- protected CharSequence getIconUrl()
- {
- return RequestCycle.get().urlFor(
- new ResourceReferenceRequestHandler(new PackageResourceReference(DatePicker.class,
- "icon1.gif")));
- }
-
- /**
- * Gets the locale that should be used to configure this widget.
- *
- * @return By default the locale of the bound component.
- */
- protected Locale getLocale()
- {
- return component.getLocale();
- }
-
- /**
- * Configure the localized strings for the datepicker widget. This implementation uses
- * {@link DateFormatSymbols} and some slight string manipulation to get the strings for months
- * and week days. Also, the first week day is set according to the {@link Locale} returned by
- * {@link #getLocale()}. It should work well for most locales.
- *
- * This method is called from {@link #configure(java.util.Map, org.apache.wicket.markup.head.IHeaderResponse, java.util.Map)} and can be overridden if
- * you want to customize setting up the localized strings but are happy with the rest of
- * {@link #configure(java.util.Map, org.apache.wicket.markup.head.IHeaderResponse, java.util.Map)}'s behavior. Note that you can call (overridable)
- * method {@link #getLocale()} to get the locale that should be used for setting up the widget.
- *
- *
- * See YUI Calendar's
- * German and Japanese examples
- * for more info.
- *
- *
- * @param widgetProperties
- * the current widget properties
- * @param response
- * the header response
- * @param initVariables
- * variables passed to the Wicket.DateTime.init() js method
- */
- protected void localize(Map widgetProperties, IHeaderResponse response,
- Map initVariables)
- {
- Locale locale = getLocale();
- String key = "Wicket.DateTimeInit.CalendarI18n[\"" + locale.toString() + "\"]";
- initVariables.put("i18n", key);
-
- if (response.wasRendered(key))
- {
- return;
- }
-
- DateFormatSymbols dfSymbols = DateFormatSymbols.getInstance(locale);
- if (dfSymbols == null)
- {
- dfSymbols = new DateFormatSymbols(locale);
- }
-
- Map i18nVariables = new LinkedHashMap<>();
- setWidgetProperty(i18nVariables, "MONTHS_SHORT", filterEmpty(dfSymbols.getShortMonths()));
- setWidgetProperty(i18nVariables, "MONTHS_LONG", filterEmpty(dfSymbols.getMonths()));
- setWidgetProperty(i18nVariables, "WEEKDAYS_MEDIUM",
- filterEmpty(dfSymbols.getShortWeekdays()));
- setWidgetProperty(i18nVariables, "WEEKDAYS_LONG", filterEmpty(dfSymbols.getWeekdays()));
-
- i18nVariables.put("START_WEEKDAY", getFirstDayOfWeek(locale));
-
- if (Locale.SIMPLIFIED_CHINESE.equals(locale) || Locale.TRADITIONAL_CHINESE.equals(locale))
- {
- setWidgetProperty(i18nVariables, "WEEKDAYS_1CHAR",
- filterEmpty(substring(dfSymbols.getShortWeekdays(), 2, 1)));
- i18nVariables.put("WEEKDAYS_SHORT",
- filterEmpty(substring(dfSymbols.getShortWeekdays(), 2, 1)));
- }
- else
- {
- setWidgetProperty(i18nVariables, "WEEKDAYS_1CHAR",
- filterEmpty(substring(dfSymbols.getShortWeekdays(), 0, 1)));
- setWidgetProperty(i18nVariables, "WEEKDAYS_SHORT",
- filterEmpty(substring(dfSymbols.getShortWeekdays(), 0, 2)));
- }
-
- StringBuilder i18n = new StringBuilder(key);
- i18n.append('=');
- appendMapping(i18nVariables, i18n);
- i18n.append(';');
-
- response.render(OnDomReadyHeaderItem.forScript(i18n.toString()));
-
- response.wasRendered(key);
- }
-
- /**
- * Gets the first day of week of a given locale.
- *
- * @return By default the first day of week accordingly to Calendar class.
- */
- protected int getFirstDayOfWeek(Locale locale)
- {
- return Calendar.getInstance(locale).getFirstDayOfWeek() - 1;
- }
-
- /**
- * Whether to notify the associated component when a date is selected. Notifying is done by
- * calling the associated component's onchange JavaScript event handler. You can for instance
- * attach an {@link AjaxEventBehavior} to that component to get a call back to the server. The
- * default is true.
- *
- * @return if true, notifies the associated component when a date is selected
- */
- protected boolean notifyComponentOnDateSelected()
- {
- return true;
- }
-
- /**
- * Makes a copy of the provided array and for each element copy the substring 0..len to the new
- * array
- *
- * @param array
- * array to copy from
- * @param len
- * size of substring for each element to copy
- * @return copy of the array filled with substrings.
- */
- protected final String[] substring(final String[] array, final int len)
- {
- return substring(array, 0, len);
- }
-
- /**
- * Makes a copy of the provided array and for each element copy the substring 0..len to the new
- * array
- *
- * @param array
- * array to copy from
- * @param start
- * start position of the substring
- * @param len
- * size of substring for each element to copy
- * @return copy of the array filled with substrings.
- */
- protected final String[] substring(final String[] array, final int start, final int len)
- {
- if (array != null)
- {
- String[] copy = new String[array.length];
- for (int i = 0; i < array.length; i++)
- {
- String el = array[i];
- if (el != null)
- {
- if (el.length() > (start + len))
- {
- copy[i] = el.substring(start, start + len);
- }
- else
- {
- copy[i] = el;
- }
- }
- }
- return copy;
- }
- return null;
- }
-
- /**
- * Indicates whether plain text is rendered or two select boxes are used to allow direct
- * selection of month and year.
- *
- * @return true if select boxes should be rendered to allow month and year
- * selection.
- * false to render just plain text.
- */
- protected boolean enableMonthYearSelection()
- {
- return false;
- }
-
- /**
- * Indicates whether the calendar should be hidden after a date was selected.
- *
- * @return true (default) if the calendar should be hidden after the date selection
- * false if the calendar should remain visible after the date selection.
- */
- protected boolean hideOnSelect()
- {
- return true;
- }
-
- /**
- * Indicates whether the calendar should be shown when corresponding text input is clicked.
- *
- * @return true
- * false (default)
- */
- protected boolean showOnFieldClick()
- {
- return showOnFieldClick;
- }
-
- /**
- * @param show
- * a flag indicating whether to show the picker on click event
- * @return {@code this} instance to be able to chain calls
- * @see {@link #showOnFieldClick()}
- */
- public DatePicker setShowOnFieldClick(boolean show)
- {
- showOnFieldClick = show;
- return this;
- }
-
-
- /**
- * Indicates whether the calendar should be hidden when the user clicks on an area of the
- * document outside of the dialog.
- *
- * @return true
- * false (default)
- */
- protected boolean autoHide()
- {
- return autoHide;
- }
-
- /**
- * @param autoHide
- * a flag indicating whether to hide the picker on click event
- * @return {@code this} instance to be able to chain calls
- * @see {@link #autoHide()}
- */
- public DatePicker setAutoHide(boolean autoHide)
- {
- this.autoHide = autoHide;
- return this;
- }
-
- /**
- * The string to use for the close button label.
- *
- * @return label
- */
- protected String closeLabel()
- {
- return closeLabel;
- }
-
- /**
- * @param closeLabel
- * The string to use for the close button label.
- */
- public void setCloseLabel(String closeLabel)
- {
- this.closeLabel = closeLabel;
- }
-
- /**
- * Indicates whether the calendar should be rendered after it has been loaded.
- *
- * @return true if the calendar should be rendered after it has been loaded.
- * false (default) if it's initially hidden.
- */
- protected boolean renderOnLoad()
- {
- return false;
- }
-
- /**
- * Override this method to further customize the YUI Calendar with additional JavaScript code.
- * The code returned by this method is executed right after the Calendar has been constructed
- * and initialized. To refer to the actual Calendar DOM object, use ${calendar} in
- * your code.
- * See the widget's documentation for
- * more information about the YUI Calendar.
- * Example:
- *
- *
- *
- * @return a String containing additional JavaScript code
- */
- protected String getAdditionalJavaScript()
- {
- return "";
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean isEnabled(final Component component)
- {
- return component.isEnabledInHierarchy();
- }
-
- /**
- *
- * @param map
- * the key-value pairs to be serialized
- * @param json
- * the buffer holding the constructed json
- */
- private void appendMapping(final Map map, final StringBuilder json)
- {
- json.append('{');
- for (Iterator> i = map.entrySet().iterator(); i.hasNext();)
- {
- Entry entry = i.next();
- json.append(entry.getKey());
- Object value = entry.getValue();
- if (value instanceof CharSequence)
- {
- json.append(":\"");
- json.append(Strings.toEscapedUnicode(value.toString()));
- json.append('"');
- }
- else if (value instanceof CharSequence[])
- {
- json.append(":[");
- CharSequence[] valueArray = (CharSequence[])value;
- for (int j = 0; j < valueArray.length; j++)
- {
- CharSequence tmpValue = valueArray[j];
- if (j > 0)
- {
- json.append(',');
- }
- if (tmpValue != null)
- {
- json.append('"');
- json.append(Strings.toEscapedUnicode(tmpValue.toString()));
- json.append('"');
- }
- }
- json.append(']');
- }
- else if (value instanceof Map)
- {
- json.append(':');
- @SuppressWarnings("unchecked")
- Map nmap = (Map)value;
- appendMapping(nmap, json);
- }
- else
- {
- json.append(':');
- json.append(Strings.toEscapedUnicode(String.valueOf(value)));
- }
- if (i.hasNext())
- {
- json.append(',');
- }
- }
- json.append('}');
- }
-}
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.js b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.js
deleted file mode 100644
index e40e0c23d35..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePicker.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-Wicket.DateTimeInit.CalendarAdd(function() {
- Wicket.DateTime.init2("${widgetId}", "${componentId}", ${calendarInit}, "${datePattern}",
- ${alignWithIcon}, ${fireChangeEvent}, ${hideOnSelect}, ${showOnFieldClick}, ${i18n}, ${autoHide}, "${closeLabel}");
- ${additionalJavascript}
-});
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePickerInit.js b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePickerInit.js
deleted file mode 100644
index 61b4056c8eb..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DatePickerInit.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-if (typeof(Wicket) === 'undefined') {
- window.Wicket = {};
-}
-if (typeof(Wicket.DateTimeInit) === 'undefined') {
- Wicket.DateTimeInit = {};
-}
-
-Wicket.DateTimeInit.CalendarInits = [];
-Wicket.DateTimeInit.CalendarInitFinished = false;
-Wicket.DateTimeInit.CalendarI18n = {};
-Wicket.DateTimeInit.CalendarAdd = function(initFn) {
- if (Wicket.DateTimeInit.CalendarInitFinished) {
- // when a DatePicker is added via ajax, the loader is already finished, so
- // we call the init function directly.
- initFn();
- } else {
- // when page is rendered, all calendar components will be initialized after
- // the required js libraries have been loaded.
- Wicket.DateTimeInit.CalendarInits.push(initFn);
- }
-};
-
-Wicket.DateTimeInit.YuiLoader = new YAHOO.util.YUILoader({
- base: "${basePath}",
- ${filter}
- allowRollup: ${allowRollup},
- require: ["wicket-date"],
- onSuccess: function() {
- Wicket.DateTimeInit.CalendarInitFinished = true;
- while (Wicket.DateTimeInit.CalendarInits.length > 0) {
- Wicket.DateTimeInit.CalendarInits.pop()();
- }
- }
-});
-Wicket.DateTimeInit.YuiLoader.addModule({
- name: "wicket-date",
- type: "js",
- requires: ["calendar"],
- fullpath: "${Wicket.DateTimeInit.DatePath}"
-});
-Wicket.DateTimeInit.YuiLoader.insert();
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DateTimeField.java b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DateTimeField.java
deleted file mode 100644
index ecab7b6b382..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/DateTimeField.java
+++ /dev/null
@@ -1,616 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.extensions.yui.calendar;
-
-import java.text.DecimalFormat;
-import java.text.NumberFormat;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Locale;
-import java.util.Map;
-import java.util.TimeZone;
-
-import org.apache.wicket.Session;
-import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
-import org.apache.wicket.core.request.ClientInfo;
-import org.apache.wicket.datetime.markup.html.form.DateTextField;
-import org.apache.wicket.markup.head.IHeaderResponse;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.form.FormComponentPanel;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.protocol.http.request.WebClientInfo;
-import org.apache.wicket.util.convert.IConverter;
-import org.apache.wicket.util.convert.converter.IntegerConverter;
-import org.apache.wicket.validation.validator.RangeValidator;
-import org.joda.time.DateTimeFieldType;
-import org.joda.time.DateTimeZone;
-import org.joda.time.MutableDateTime;
-import org.joda.time.format.DateTimeFormat;
-
-/**
- * Works on a {@link java.util.Date} object. Displays a date field and a {@link DatePicker}, a field
- * for hours and a field for minutes, and an AM/PM field. The format (12h/24h) of the hours field
- * depends on the time format of this {@link DateTimeField}'s {@link Locale}, as does the visibility
- * of the AM/PM field (see {@link DateTimeField#use12HourFormat}).
- *
- * Ajaxifying the DateTimeField: If you want to update a DateTimeField with an
- * {@link AjaxFormComponentUpdatingBehavior}, you have to attach it to the contained
- * {@link DateTextField} by overriding {@link #newDateTextField(String, PropertyModel)} and calling
- * {@link #processInput()}:
- *
- *
- *
- * @author eelcohillenius
- * @see DateField for a variant with just the date field and date picker
- */
-public class DateTimeField extends FormComponentPanel
-{
- /**
- * Enumerated type for different ways of handling the render part of requests.
- */
- public static enum AM_PM {
- /** */
- AM("AM"),
-
- /** */
- PM("PM");
-
- /** */
- private String value;
-
- AM_PM(final String name)
- {
- value = name;
- }
-
- /**
- * @see java.lang.Enum#toString()
- */
- @Override
- public String toString()
- {
- return value;
- }
- }
-
- private static final long serialVersionUID = 1L;
-
- // Component-IDs
- protected static final String DATE = "date";
- protected static final String HOURS = "hours";
- protected static final String MINUTES = "minutes";
- protected static final String AM_OR_PM_CHOICE = "amOrPmChoice";
-
- // PropertyModel string to access getAmOrPm
- private static final String AM_OR_PM = "amOrPm";
-
- private static final IConverter MINUTES_CONVERTER = new IntegerConverter() {
- protected NumberFormat newNumberFormat(Locale locale) {
- return new DecimalFormat("00");
- }
- };
-
- // The dropdown list for AM/PM and it's associated model object
- private DropDownChoice amOrPmChoice;
- private AM_PM amOrPm = AM_PM.AM;
-
- // The date TextField and it's associated model object
- // Note that any time information in date will be ignored
- private DateTextField dateField;
- private Date date;
-
- // The TextField for "hours" and it's associated model object
- private TextField hoursField;
- private Integer hours;
-
- // The TextField for "minutes" and it's associated model object
- private TextField minutesField;
- private Integer minutes;
-
- /**
- * Construct.
- *
- * @param id
- */
- public DateTimeField(final String id)
- {
- this(id, null);
- }
-
- /**
- * Construct.
- *
- * @param id
- * @param model
- */
- public DateTimeField(final String id, final IModel model)
- {
- super(id, model);
-
- // Sets the type that will be used when updating the model for this component.
- setType(Date.class);
-
- // Create and add the date TextField
- PropertyModel dateFieldModel = new PropertyModel<>(this, DATE);
- add(dateField = newDateTextField(DATE, dateFieldModel));
-
- // Add a date picker to the date TextField
- dateField.add(newDatePicker());
-
- // Create and add the "hours" TextField
- add(hoursField = newHoursTextField(HOURS, new PropertyModel(this, HOURS),
- Integer.class));
-
- // Create and add the "minutes" TextField
- add(minutesField = newMinutesTextField(MINUTES, new PropertyModel(this, MINUTES),
- Integer.class));
-
- // Create and add the "AM/PM" Listbox
- add(amOrPmChoice = new DropDownChoice(AM_OR_PM_CHOICE, new PropertyModel(
- this, AM_OR_PM), Arrays.asList(AM_PM.values())));
-
- add(new WebMarkupContainer("hoursSeparator")
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- public boolean isVisible()
- {
- return minutesField.determineVisibility();
- }
- });
- }
-
- /**
- * create a new {@link TextField} instance for hours to be added to this panel.
- *
- * @param id
- * the component id
- * @param model
- * model that should be used by the {@link TextField}
- * @param type
- * the type of the text field
- * @return a new text field instance
- */
- protected TextField newHoursTextField(final String id, IModel model, Class type) {
- TextField hoursTextField = new TextField<>(id, model, type);
- hoursTextField.add(getMaximumHours() == 24 ? RangeValidator.range(0, 23) : RangeValidator
- .range(1, 12));
- hoursTextField.setLabel(new Model<>(HOURS));
- return hoursTextField;
- }
-
- /**
- * create a new {@link TextField} instance for minutes to be added to this panel.
- *
- * @param id
- * the component id
- * @param model
- * model that should be used by the {@link TextField}
- * @param type
- * the type of the text field
- * @return a new text field instance
- */
- protected TextField newMinutesTextField(final String id, IModel model,
- Class type)
- {
- TextField minutesField = new TextField(id, model, type)
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected IConverter> createConverter(Class> type)
- {
- if (Integer.class.isAssignableFrom(type))
- {
- return MINUTES_CONVERTER;
- }
- return null;
- }
- };
- minutesField.add(new RangeValidator<>(0, 59));
- minutesField.setLabel(new Model<>(MINUTES));
- return minutesField;
- }
-
- /**
- *
- * @return The date TextField
- */
- protected final DateTextField getDateTextField()
- {
- return dateField;
- }
-
- /**
- * Gets the amOrPm model object of the drop down choice.
- *
- * @return amOrPm
- *
- * @deprecated valid during rendering only
- */
- public final AM_PM getAmOrPm()
- {
- return amOrPm;
- }
-
- /**
- * Gets the date model object for the date TextField. Any associated time information will be
- * ignored.
- *
- * @return date
- *
- * @deprecated valid during rendering only
- */
- public final Date getDate()
- {
- return date;
- }
-
- /**
- * Gets the hours model object for the TextField
- *
- * @return hours
- *
- * @deprecated valid during rendering only
- */
- public final Integer getHours()
- {
- return hours;
- }
-
- /**
- * Gets the minutes model object for the TextField
- *
- * @return minutes
- *
- * @deprecated valid during rendering only
- */
- public final Integer getMinutes()
- {
- return minutes;
- }
-
- /**
- * Gives overriding classes the option of adding (or even changing/ removing) configuration
- * properties for the javascript widget. See the widget's documentation for the
- * available options. If you want to override/ remove properties, you should call
- * super.configure(properties) first. If you don't call that, be aware that you will have to
- * call {@link #configure(java.util.Map)} manually if you like localized strings to be added.
- *
- * @param widgetProperties
- * the current widget properties
- */
- protected void configure(Map widgetProperties)
- {
- }
-
- @Override
- public String getInput()
- {
- // since we override convertInput, we can let this method return a value
- // that is just suitable for error reporting
- return dateField.getInput() + ", " + hoursField.getInput() + ":" + minutesField.getInput();
- }
-
- /**
- * Sets the amOrPm model object associated with the drop down choice.
- *
- * @param amOrPm
- * amOrPm
- */
- public final void setAmOrPm(final AM_PM amOrPm)
- {
- this.amOrPm = amOrPm;
- }
-
- /**
- * Sets the date model object associated with the date TextField. It does not affect hours or
- * minutes.
- *
- * @param date
- * date
- */
- public final void setDate(final Date date)
- {
- this.date = date;
- }
-
- /**
- * Sets hours.
- *
- * @param hours
- * hours
- */
- public final void setHours(final Integer hours)
- {
- this.hours = hours;
- }
-
- /**
- * Sets minutes.
- *
- * @param minutes
- * minutes
- */
- public final void setMinutes(final Integer minutes)
- {
- this.minutes = minutes;
- }
-
- /**
- * Gets the client's time zone.
- *
- * @return The client's time zone or null
- */
- protected TimeZone getClientTimeZone()
- {
- ClientInfo info = Session.get().getClientInfo();
- if (info instanceof WebClientInfo)
- {
- return ((WebClientInfo)info).getProperties().getTimeZone();
- }
- return null;
- }
-
- /**
- * Sets the converted input, which is an instance of {@link Date}, possibly null. It combines
- * the inputs of the nested date, hours, minutes and am/pm fields and constructs a date from it.
- *
";b[b.length]='';return b;},renderMonth:function(c){var f=YAHOO.widget.CalendarNavigator,g=f.CLASSES;var j=this.id+f.MONTH_SUFFIX,e=this.__getCfg("monthFormat"),a=this.cal.cfg.getProperty((e==YAHOO.widget.Calendar.SHORT)?"MONTHS_SHORT":"MONTHS_LONG"),d=c;if(a&&a.length>0){d[d.length]='";d[d.length]='";}return d;},renderYear:function(b){var d=YAHOO.widget.CalendarNavigator,e=d.CLASSES;var f=this.id+d.YEAR_SUFFIX,a=d.YR_MAX_DIGITS,c=b;c[c.length]='";c[c.length]='';return c;},renderButtons:function(a){var c=YAHOO.widget.CalendarNavigator.CLASSES;var b=a;b[b.length]='';b[b.length]='";b[b.length]="";b[b.length]='';b[b.length]='";b[b.length]="";return b;},applyListeners:function(){var b=YAHOO.util.Event;function a(){if(this.validate()){this.setYear(this._getYearFromUI());}}function c(){this.setMonth(this._getMonthFromUI());}b.on(this.submitEl,"click",this.submit,this,true);b.on(this.cancelEl,"click",this.cancel,this,true);b.on(this.yearEl,"blur",a,this,true);b.on(this.monthEl,"change",c,this,true);if(this.__isIEQuirks){YAHOO.util.Event.on(this.cal.oDomContainer,"resize",this._syncMask,this,true);}this.applyKeyListeners();},purgeListeners:function(){var a=YAHOO.util.Event;a.removeListener(this.submitEl,"click",this.submit);a.removeListener(this.cancelEl,"click",this.cancel);a.removeListener(this.yearEl,"blur");a.removeListener(this.monthEl,"change");if(this.__isIEQuirks){a.removeListener(this.cal.oDomContainer,"resize",this._syncMask);}this.purgeKeyListeners();},applyKeyListeners:function(){var d=YAHOO.util.Event,a=YAHOO.env.ua;var c=(a.ie||a.webkit)?"keydown":"keypress";var b=(a.ie||a.opera||a.webkit)?"keydown":"keypress";d.on(this.yearEl,"keypress",this._handleEnterKey,this,true);d.on(this.yearEl,c,this._handleDirectionKeys,this,true);d.on(this.lastCtrl,b,this._handleTabKey,this,true);d.on(this.firstCtrl,b,this._handleShiftTabKey,this,true);},purgeKeyListeners:function(){var d=YAHOO.util.Event,a=YAHOO.env.ua;var c=(a.ie||a.webkit)?"keydown":"keypress";var b=(a.ie||a.opera||a.webkit)?"keydown":"keypress";d.removeListener(this.yearEl,"keypress",this._handleEnterKey);d.removeListener(this.yearEl,c,this._handleDirectionKeys);d.removeListener(this.lastCtrl,b,this._handleTabKey);d.removeListener(this.firstCtrl,b,this._handleShiftTabKey);},submit:function(){if(this.validate()){this.hide();this.setMonth(this._getMonthFromUI());this.setYear(this._getYearFromUI());var b=this.cal;var a=YAHOO.widget.CalendarNavigator.UPDATE_DELAY;if(a>0){var c=this;window.setTimeout(function(){c._update(b);},a);}else{this._update(b);}}},_update:function(b){var a=YAHOO.widget.DateMath.getDate(this.getYear()-b.cfg.getProperty("YEAR_OFFSET"),this.getMonth(),1);b.cfg.setProperty("pagedate",a);b.render();},cancel:function(){this.hide();},validate:function(){if(this._getYearFromUI()!==null){this.clearErrors();return true;}else{this.setYearError();this.setError(this.__getCfg("invalidYear",true));return false;}},setError:function(a){if(this.errorEl){this.errorEl.innerHTML=a;this._show(this.errorEl,true);}},clearError:function(){if(this.errorEl){this.errorEl.innerHTML="";this._show(this.errorEl,false);}},setYearError:function(){YAHOO.util.Dom.addClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearYearError:function(){YAHOO.util.Dom.removeClass(this.yearEl,YAHOO.widget.CalendarNavigator.CLASSES.INVALID);},clearErrors:function(){this.clearError();this.clearYearError();},setInitialFocus:function(){var a=this.submitEl,c=this.__getCfg("initialFocus");if(c&&c.toLowerCase){c=c.toLowerCase();if(c=="year"){a=this.yearEl;try{this.yearEl.select();}catch(b){}}else{if(c=="month"){a=this.monthEl;}}}if(a&&YAHOO.lang.isFunction(a.focus)){try{a.focus();}catch(d){}}},erase:function(){if(this.__rendered){this.purgeListeners();
-this.yearEl=null;this.monthEl=null;this.errorEl=null;this.submitEl=null;this.cancelEl=null;this.firstCtrl=null;this.lastCtrl=null;if(this.navEl){this.navEl.innerHTML="";}var b=this.navEl.parentNode;if(b){b.removeChild(this.navEl);}this.navEl=null;var a=this.maskEl.parentNode;if(a){a.removeChild(this.maskEl);}this.maskEl=null;this.__rendered=false;}},destroy:function(){this.erase();this._doc=null;this.cal=null;this.id=null;},_show:function(b,a){if(b){YAHOO.util.Dom.setStyle(b,"display",(a)?"block":"none");}},_getMonthFromUI:function(){if(this.monthEl){return this.monthEl.selectedIndex;}else{return 0;}},_getYearFromUI:function(){var b=YAHOO.widget.CalendarNavigator;var a=null;if(this.yearEl){var c=this.yearEl.value;c=c.replace(b.TRIM,"$1");if(b.YR_PATTERN.test(c)){a=parseInt(c,10);}}return a;},_updateYearUI:function(){if(this.yearEl&&this._year!==null){this.yearEl.value=this._year;}},_updateMonthUI:function(){if(this.monthEl){this.monthEl.selectedIndex=this._month;}},_setFirstLastElements:function(){this.firstCtrl=this.monthEl;this.lastCtrl=this.cancelEl;if(this.__isMac){if(YAHOO.env.ua.webkit&&YAHOO.env.ua.webkit<420){this.firstCtrl=this.monthEl;this.lastCtrl=this.yearEl;}if(YAHOO.env.ua.gecko){this.firstCtrl=this.yearEl;this.lastCtrl=this.yearEl;}}},_handleEnterKey:function(b){var a=YAHOO.util.KeyListener.KEY;if(YAHOO.util.Event.getCharCode(b)==a.ENTER){YAHOO.util.Event.preventDefault(b);this.submit();}},_handleDirectionKeys:function(h){var g=YAHOO.util.Event,a=YAHOO.util.KeyListener.KEY,d=YAHOO.widget.CalendarNavigator;var f=(this.yearEl.value)?parseInt(this.yearEl.value,10):null;if(isFinite(f)){var b=false;switch(g.getCharCode(h)){case a.UP:this.yearEl.value=f+d.YR_MINOR_INC;b=true;break;case a.DOWN:this.yearEl.value=Math.max(f-d.YR_MINOR_INC,0);b=true;break;case a.PAGE_UP:this.yearEl.value=f+d.YR_MAJOR_INC;b=true;break;case a.PAGE_DOWN:this.yearEl.value=Math.max(f-d.YR_MAJOR_INC,0);b=true;break;default:break;}if(b){g.preventDefault(h);try{this.yearEl.select();}catch(c){}}}},_handleTabKey:function(d){var c=YAHOO.util.Event,a=YAHOO.util.KeyListener.KEY;if(c.getCharCode(d)==a.TAB&&!d.shiftKey){try{c.preventDefault(d);this.firstCtrl.focus();}catch(b){}}},_handleShiftTabKey:function(d){var c=YAHOO.util.Event,a=YAHOO.util.KeyListener.KEY;if(d.shiftKey&&c.getCharCode(d)==a.TAB){try{c.preventDefault(d);this.lastCtrl.focus();}catch(b){}}},__getCfg:function(d,b){var c=YAHOO.widget.CalendarNavigator.DEFAULT_CONFIG;var a=this.cal.cfg.getProperty("navigator");if(b){return(a!==true&&a.strings&&a.strings[d])?a.strings[d]:c.strings[d];}else{return(a!==true&&a[d])?a[d]:c[d];}},__isMac:(navigator.userAgent.toLowerCase().indexOf("macintosh")!=-1)};YAHOO.register("calendar",YAHOO.widget.Calendar,{version:"2.9.0",build:"2800"});
\ No newline at end of file
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/calendar.js b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/calendar.js
deleted file mode 100644
index 05ce3ce3e11..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/calendar.js
+++ /dev/null
@@ -1,7390 +0,0 @@
-/*
-Copyright (c) 2011, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.html
-version: 2.9.0
-*/
-(function () {
-
- /**
- * Config is a utility used within an Object to allow the implementer to
- * maintain a list of local configuration properties and listen for changes
- * to those properties dynamically using CustomEvent. The initial values are
- * also maintained so that the configuration can be reset at any given point
- * to its initial state.
- * @namespace YAHOO.util
- * @class Config
- * @constructor
- * @param {Object} owner The owner Object to which this Config Object belongs
- */
- YAHOO.util.Config = function (owner) {
-
- if (owner) {
- this.init(owner);
- }
-
-
- };
-
-
- var Lang = YAHOO.lang,
- CustomEvent = YAHOO.util.CustomEvent,
- Config = YAHOO.util.Config;
-
-
- /**
- * Constant representing the CustomEvent type for the config changed event.
- * @property YAHOO.util.Config.CONFIG_CHANGED_EVENT
- * @private
- * @static
- * @final
- */
- Config.CONFIG_CHANGED_EVENT = "configChanged";
-
- /**
- * Constant representing the boolean type string
- * @property YAHOO.util.Config.BOOLEAN_TYPE
- * @private
- * @static
- * @final
- */
- Config.BOOLEAN_TYPE = "boolean";
-
- Config.prototype = {
-
- /**
- * Object reference to the owner of this Config Object
- * @property owner
- * @type Object
- */
- owner: null,
-
- /**
- * Boolean flag that specifies whether a queue is currently
- * being executed
- * @property queueInProgress
- * @type Boolean
- */
- queueInProgress: false,
-
- /**
- * Maintains the local collection of configuration property objects and
- * their specified values
- * @property config
- * @private
- * @type Object
- */
- config: null,
-
- /**
- * Maintains the local collection of configuration property objects as
- * they were initially applied.
- * This object is used when resetting a property.
- * @property initialConfig
- * @private
- * @type Object
- */
- initialConfig: null,
-
- /**
- * Maintains the local, normalized CustomEvent queue
- * @property eventQueue
- * @private
- * @type Object
- */
- eventQueue: null,
-
- /**
- * Custom Event, notifying subscribers when Config properties are set
- * (setProperty is called without the silent flag
- * @event configChangedEvent
- */
- configChangedEvent: null,
-
- /**
- * Initializes the configuration Object and all of its local members.
- * @method init
- * @param {Object} owner The owner Object to which this Config
- * Object belongs
- */
- init: function (owner) {
-
- this.owner = owner;
-
- this.configChangedEvent =
- this.createEvent(Config.CONFIG_CHANGED_EVENT);
-
- this.configChangedEvent.signature = CustomEvent.LIST;
- this.queueInProgress = false;
- this.config = {};
- this.initialConfig = {};
- this.eventQueue = [];
-
- },
-
- /**
- * Validates that the value passed in is a Boolean.
- * @method checkBoolean
- * @param {Object} val The value to validate
- * @return {Boolean} true, if the value is valid
- */
- checkBoolean: function (val) {
- return (typeof val == Config.BOOLEAN_TYPE);
- },
-
- /**
- * Validates that the value passed in is a number.
- * @method checkNumber
- * @param {Object} val The value to validate
- * @return {Boolean} true, if the value is valid
- */
- checkNumber: function (val) {
- return (!isNaN(val));
- },
-
- /**
- * Fires a configuration property event using the specified value.
- * @method fireEvent
- * @private
- * @param {String} key The configuration property's name
- * @param {value} Object The value of the correct type for the property
- */
- fireEvent: function ( key, value ) {
- var property = this.config[key];
-
- if (property && property.event) {
- property.event.fire(value);
- }
- },
-
- /**
- * Adds a property to the Config Object's private config hash.
- * @method addProperty
- * @param {String} key The configuration property's name
- * @param {Object} propertyObject The Object containing all of this
- * property's arguments
- */
- addProperty: function ( key, propertyObject ) {
- key = key.toLowerCase();
-
- this.config[key] = propertyObject;
-
- propertyObject.event = this.createEvent(key, { scope: this.owner });
- propertyObject.event.signature = CustomEvent.LIST;
-
-
- propertyObject.key = key;
-
- if (propertyObject.handler) {
- propertyObject.event.subscribe(propertyObject.handler,
- this.owner);
- }
-
- this.setProperty(key, propertyObject.value, true);
-
- if (! propertyObject.suppressEvent) {
- this.queueProperty(key, propertyObject.value);
- }
-
- },
-
- /**
- * Returns a key-value configuration map of the values currently set in
- * the Config Object.
- * @method getConfig
- * @return {Object} The current config, represented in a key-value map
- */
- getConfig: function () {
-
- var cfg = {},
- currCfg = this.config,
- prop,
- property;
-
- for (prop in currCfg) {
- if (Lang.hasOwnProperty(currCfg, prop)) {
- property = currCfg[prop];
- if (property && property.event) {
- cfg[prop] = property.value;
- }
- }
- }
-
- return cfg;
- },
-
- /**
- * Returns the value of specified property.
- * @method getProperty
- * @param {String} key The name of the property
- * @return {Object} The value of the specified property
- */
- getProperty: function (key) {
- var property = this.config[key.toLowerCase()];
- if (property && property.event) {
- return property.value;
- } else {
- return undefined;
- }
- },
-
- /**
- * Resets the specified property's value to its initial value.
- * @method resetProperty
- * @param {String} key The name of the property
- * @return {Boolean} True is the property was reset, false if not
- */
- resetProperty: function (key) {
- key = key.toLowerCase();
-
- var property = this.config[key];
-
- if (property && property.event) {
- if (key in this.initialConfig) {
- this.setProperty(key, this.initialConfig[key]);
- return true;
- }
- } else {
- return false;
- }
- },
-
- /**
- * Sets the value of a property. If the silent property is passed as
- * true, the property's event will not be fired.
- * @method setProperty
- * @param {String} key The name of the property
- * @param {String} value The value to set the property to
- * @param {Boolean} silent Whether the value should be set silently,
- * without firing the property event.
- * @return {Boolean} True, if the set was successful, false if it failed.
- */
- setProperty: function (key, value, silent) {
-
- var property;
-
- key = key.toLowerCase();
-
- if (this.queueInProgress && ! silent) {
- // Currently running through a queue...
- this.queueProperty(key,value);
- return true;
-
- } else {
- property = this.config[key];
- if (property && property.event) {
- if (property.validator && !property.validator(value)) {
- return false;
- } else {
- property.value = value;
- if (! silent) {
- this.fireEvent(key, value);
- this.configChangedEvent.fire([key, value]);
- }
- return true;
- }
- } else {
- return false;
- }
- }
- },
-
- /**
- * Sets the value of a property and queues its event to execute. If the
- * event is already scheduled to execute, it is
- * moved from its current position to the end of the queue.
- * @method queueProperty
- * @param {String} key The name of the property
- * @param {String} value The value to set the property to
- * @return {Boolean} true, if the set was successful, false if
- * it failed.
- */
- queueProperty: function (key, value) {
-
- key = key.toLowerCase();
-
- var property = this.config[key],
- foundDuplicate = false,
- iLen,
- queueItem,
- queueItemKey,
- queueItemValue,
- sLen,
- supercedesCheck,
- qLen,
- queueItemCheck,
- queueItemCheckKey,
- queueItemCheckValue,
- i,
- s,
- q;
-
- if (property && property.event) {
-
- if (!Lang.isUndefined(value) && property.validator &&
- !property.validator(value)) { // validator
- return false;
- } else {
-
- if (!Lang.isUndefined(value)) {
- property.value = value;
- } else {
- value = property.value;
- }
-
- foundDuplicate = false;
- iLen = this.eventQueue.length;
-
- for (i = 0; i < iLen; i++) {
- queueItem = this.eventQueue[i];
-
- if (queueItem) {
- queueItemKey = queueItem[0];
- queueItemValue = queueItem[1];
-
- if (queueItemKey == key) {
-
- /*
- found a dupe... push to end of queue, null
- current item, and break
- */
-
- this.eventQueue[i] = null;
-
- this.eventQueue.push(
- [key, (!Lang.isUndefined(value) ?
- value : queueItemValue)]);
-
- foundDuplicate = true;
- break;
- }
- }
- }
-
- // this is a refire, or a new property in the queue
-
- if (! foundDuplicate && !Lang.isUndefined(value)) {
- this.eventQueue.push([key, value]);
- }
- }
-
- if (property.supercedes) {
-
- sLen = property.supercedes.length;
-
- for (s = 0; s < sLen; s++) {
-
- supercedesCheck = property.supercedes[s];
- qLen = this.eventQueue.length;
-
- for (q = 0; q < qLen; q++) {
- queueItemCheck = this.eventQueue[q];
-
- if (queueItemCheck) {
- queueItemCheckKey = queueItemCheck[0];
- queueItemCheckValue = queueItemCheck[1];
-
- if (queueItemCheckKey ==
- supercedesCheck.toLowerCase() ) {
-
- this.eventQueue.push([queueItemCheckKey,
- queueItemCheckValue]);
-
- this.eventQueue[q] = null;
- break;
-
- }
- }
- }
- }
- }
-
-
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Fires the event for a property using the property's current value.
- * @method refireEvent
- * @param {String} key The name of the property
- */
- refireEvent: function (key) {
-
- key = key.toLowerCase();
-
- var property = this.config[key];
-
- if (property && property.event &&
-
- !Lang.isUndefined(property.value)) {
-
- if (this.queueInProgress) {
-
- this.queueProperty(key);
-
- } else {
-
- this.fireEvent(key, property.value);
-
- }
-
- }
- },
-
- /**
- * Applies a key-value Object literal to the configuration, replacing
- * any existing values, and queueing the property events.
- * Although the values will be set, fireQueue() must be called for their
- * associated events to execute.
- * @method applyConfig
- * @param {Object} userConfig The configuration Object literal
- * @param {Boolean} init When set to true, the initialConfig will
- * be set to the userConfig passed in, so that calling a reset will
- * reset the properties to the passed values.
- */
- applyConfig: function (userConfig, init) {
-
- var sKey,
- oConfig;
-
- if (init) {
- oConfig = {};
- for (sKey in userConfig) {
- if (Lang.hasOwnProperty(userConfig, sKey)) {
- oConfig[sKey.toLowerCase()] = userConfig[sKey];
- }
- }
- this.initialConfig = oConfig;
- }
-
- for (sKey in userConfig) {
- if (Lang.hasOwnProperty(userConfig, sKey)) {
- this.queueProperty(sKey, userConfig[sKey]);
- }
- }
- },
-
- /**
- * Refires the events for all configuration properties using their
- * current values.
- * @method refresh
- */
- refresh: function () {
-
- var prop;
-
- for (prop in this.config) {
- if (Lang.hasOwnProperty(this.config, prop)) {
- this.refireEvent(prop);
- }
- }
- },
-
- /**
- * Fires the normalized list of queued property change events
- * @method fireQueue
- */
- fireQueue: function () {
-
- var i,
- queueItem,
- key,
- value,
- property;
-
- this.queueInProgress = true;
- for (i = 0;i < this.eventQueue.length; i++) {
- queueItem = this.eventQueue[i];
- if (queueItem) {
-
- key = queueItem[0];
- value = queueItem[1];
- property = this.config[key];
-
- property.value = value;
-
- // Clear out queue entry, to avoid it being
- // re-added to the queue by any queueProperty/supercedes
- // calls which are invoked during fireEvent
- this.eventQueue[i] = null;
-
- this.fireEvent(key,value);
- }
- }
-
- this.queueInProgress = false;
- this.eventQueue = [];
- },
-
- /**
- * Subscribes an external handler to the change event for any
- * given property.
- * @method subscribeToConfigEvent
- * @param {String} key The property name
- * @param {Function} handler The handler function to use subscribe to
- * the property's event
- * @param {Object} obj The Object to use for scoping the event handler
- * (see CustomEvent documentation)
- * @param {Boolean} overrideContext Optional. If true, will override
- * "this" within the handler to map to the scope Object passed into the
- * method.
- * @return {Boolean} True, if the subscription was successful,
- * otherwise false.
- */
- subscribeToConfigEvent: function (key, handler, obj, overrideContext) {
-
- var property = this.config[key.toLowerCase()];
-
- if (property && property.event) {
- if (!Config.alreadySubscribed(property.event, handler, obj)) {
- property.event.subscribe(handler, obj, overrideContext);
- }
- return true;
- } else {
- return false;
- }
-
- },
-
- /**
- * Unsubscribes an external handler from the change event for any
- * given property.
- * @method unsubscribeFromConfigEvent
- * @param {String} key The property name
- * @param {Function} handler The handler function to use subscribe to
- * the property's event
- * @param {Object} obj The Object to use for scoping the event
- * handler (see CustomEvent documentation)
- * @return {Boolean} True, if the unsubscription was successful,
- * otherwise false.
- */
- unsubscribeFromConfigEvent: function (key, handler, obj) {
- var property = this.config[key.toLowerCase()];
- if (property && property.event) {
- return property.event.unsubscribe(handler, obj);
- } else {
- return false;
- }
- },
-
- /**
- * Returns a string representation of the Config object
- * @method toString
- * @return {String} The Config object in string format.
- */
- toString: function () {
- var output = "Config";
- if (this.owner) {
- output += " [" + this.owner.toString() + "]";
- }
- return output;
- },
-
- /**
- * Returns a string representation of the Config object's current
- * CustomEvent queue
- * @method outputEventQueue
- * @return {String} The string list of CustomEvents currently queued
- * for execution
- */
- outputEventQueue: function () {
-
- var output = "",
- queueItem,
- q,
- nQueue = this.eventQueue.length;
-
- for (q = 0; q < nQueue; q++) {
- queueItem = this.eventQueue[q];
- if (queueItem) {
- output += queueItem[0] + "=" + queueItem[1] + ", ";
- }
- }
- return output;
- },
-
- /**
- * Sets all properties to null, unsubscribes all listeners from each
- * property's change event and all listeners from the configChangedEvent.
- * @method destroy
- */
- destroy: function () {
-
- var oConfig = this.config,
- sProperty,
- oProperty;
-
-
- for (sProperty in oConfig) {
-
- if (Lang.hasOwnProperty(oConfig, sProperty)) {
-
- oProperty = oConfig[sProperty];
-
- oProperty.event.unsubscribeAll();
- oProperty.event = null;
-
- }
-
- }
-
- this.configChangedEvent.unsubscribeAll();
-
- this.configChangedEvent = null;
- this.owner = null;
- this.config = null;
- this.initialConfig = null;
- this.eventQueue = null;
-
- }
-
- };
-
-
-
- /**
- * Checks to determine if a particular function/Object pair are already
- * subscribed to the specified CustomEvent
- * @method YAHOO.util.Config.alreadySubscribed
- * @static
- * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check
- * the subscriptions
- * @param {Function} fn The function to look for in the subscribers list
- * @param {Object} obj The execution scope Object for the subscription
- * @return {Boolean} true, if the function/Object pair is already subscribed
- * to the CustomEvent passed in
- */
- Config.alreadySubscribed = function (evt, fn, obj) {
-
- var nSubscribers = evt.subscribers.length,
- subsc,
- i;
-
- if (nSubscribers > 0) {
- i = nSubscribers - 1;
- do {
- subsc = evt.subscribers[i];
- if (subsc && subsc.obj == obj && subsc.fn == fn) {
- return true;
- }
- }
- while (i--);
- }
-
- return false;
-
- };
-
- YAHOO.lang.augmentProto(Config, YAHOO.util.EventProvider);
-
-}());
-/**
-* The datemath module provides utility methods for basic JavaScript Date object manipulation and
-* comparison.
-*
-* @module datemath
-*/
-
-/**
-* YAHOO.widget.DateMath is used for simple date manipulation. The class is a static utility
-* used for adding, subtracting, and comparing dates.
-* @namespace YAHOO.widget
-* @class DateMath
-*/
-YAHOO.widget.DateMath = {
- /**
- * Constant field representing Day
- * @property DAY
- * @static
- * @final
- * @type String
- */
- DAY : "D",
-
- /**
- * Constant field representing Week
- * @property WEEK
- * @static
- * @final
- * @type String
- */
- WEEK : "W",
-
- /**
- * Constant field representing Year
- * @property YEAR
- * @static
- * @final
- * @type String
- */
- YEAR : "Y",
-
- /**
- * Constant field representing Month
- * @property MONTH
- * @static
- * @final
- * @type String
- */
- MONTH : "M",
-
- /**
- * Constant field representing one day, in milliseconds
- * @property ONE_DAY_MS
- * @static
- * @final
- * @type Number
- */
- ONE_DAY_MS : 1000*60*60*24,
-
- /**
- * Constant field representing the date in first week of January
- * which identifies the first week of the year.
- *
- * In the U.S, Jan 1st is normally used based on a Sunday start of week.
- * ISO 8601, used widely throughout Europe, uses Jan 4th, based on a Monday start of week.
- *
- * @property WEEK_ONE_JAN_DATE
- * @static
- * @type Number
- */
- WEEK_ONE_JAN_DATE : 1,
-
- /**
- * Adds the specified amount of time to the this instance.
- * @method add
- * @param {Date} date The JavaScript Date object to perform addition on
- * @param {String} field The field constant to be used for performing addition.
- * @param {Number} amount The number of units (measured in the field constant) to add to the date.
- * @return {Date} The resulting Date object
- */
- add : function(date, field, amount) {
- var d = new Date(date.getTime());
- switch (field) {
- case this.MONTH:
- var newMonth = date.getMonth() + amount;
- var years = 0;
-
- if (newMonth < 0) {
- while (newMonth < 0) {
- newMonth += 12;
- years -= 1;
- }
- } else if (newMonth > 11) {
- while (newMonth > 11) {
- newMonth -= 12;
- years += 1;
- }
- }
-
- d.setMonth(newMonth);
- d.setFullYear(date.getFullYear() + years);
- break;
- case this.DAY:
- this._addDays(d, amount);
- // d.setDate(date.getDate() + amount);
- break;
- case this.YEAR:
- d.setFullYear(date.getFullYear() + amount);
- break;
- case this.WEEK:
- this._addDays(d, (amount * 7));
- // d.setDate(date.getDate() + (amount * 7));
- break;
- }
- return d;
- },
-
- /**
- * Private helper method to account for bug in Safari 2 (webkit < 420)
- * when Date.setDate(n) is called with n less than -128 or greater than 127.
- *
- * Fix approach and original findings are available here:
- * http://brianary.blogspot.com/2006/03/safari-date-bug.html
- *
- * @method _addDays
- * @param {Date} d JavaScript date object
- * @param {Number} nDays The number of days to add to the date object (can be negative)
- * @private
- */
- _addDays : function(d, nDays) {
- if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420) {
- if (nDays < 0) {
- // Ensure we don't go below -128 (getDate() is always 1 to 31, so we won't go above 127)
- for(var min = -128; nDays < min; nDays -= min) {
- d.setDate(d.getDate() + min);
- }
- } else {
- // Ensure we don't go above 96 + 31 = 127
- for(var max = 96; nDays > max; nDays -= max) {
- d.setDate(d.getDate() + max);
- }
- }
- // nDays should be remainder between -128 and 96
- }
- d.setDate(d.getDate() + nDays);
- },
-
- /**
- * Subtracts the specified amount of time from the this instance.
- * @method subtract
- * @param {Date} date The JavaScript Date object to perform subtraction on
- * @param {Number} field The this field constant to be used for performing subtraction.
- * @param {Number} amount The number of units (measured in the field constant) to subtract from the date.
- * @return {Date} The resulting Date object
- */
- subtract : function(date, field, amount) {
- return this.add(date, field, (amount*-1));
- },
-
- /**
- * Determines whether a given date is before another date on the calendar.
- * @method before
- * @param {Date} date The Date object to compare with the compare argument
- * @param {Date} compareTo The Date object to use for the comparison
- * @return {Boolean} true if the date occurs before the compared date; false if not.
- */
- before : function(date, compareTo) {
- var ms = compareTo.getTime();
- if (date.getTime() < ms) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Determines whether a given date is after another date on the calendar.
- * @method after
- * @param {Date} date The Date object to compare with the compare argument
- * @param {Date} compareTo The Date object to use for the comparison
- * @return {Boolean} true if the date occurs after the compared date; false if not.
- */
- after : function(date, compareTo) {
- var ms = compareTo.getTime();
- if (date.getTime() > ms) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Determines whether a given date is between two other dates on the calendar.
- * @method between
- * @param {Date} date The date to check for
- * @param {Date} dateBegin The start of the range
- * @param {Date} dateEnd The end of the range
- * @return {Boolean} true if the date occurs between the compared dates; false if not.
- */
- between : function(date, dateBegin, dateEnd) {
- if (this.after(date, dateBegin) && this.before(date, dateEnd)) {
- return true;
- } else {
- return false;
- }
- },
-
- /**
- * Retrieves a JavaScript Date object representing January 1 of any given year.
- * @method getJan1
- * @param {Number} calendarYear The calendar year for which to retrieve January 1
- * @return {Date} January 1 of the calendar year specified.
- */
- getJan1 : function(calendarYear) {
- return this.getDate(calendarYear,0,1);
- },
-
- /**
- * Calculates the number of days the specified date is from January 1 of the specified calendar year.
- * Passing January 1 to this function would return an offset value of zero.
- * @method getDayOffset
- * @param {Date} date The JavaScript date for which to find the offset
- * @param {Number} calendarYear The calendar year to use for determining the offset
- * @return {Number} The number of days since January 1 of the given year
- */
- getDayOffset : function(date, calendarYear) {
- var beginYear = this.getJan1(calendarYear); // Find the start of the year. This will be in week 1.
-
- // Find the number of days the passed in date is away from the calendar year start
- var dayOffset = Math.ceil((date.getTime()-beginYear.getTime()) / this.ONE_DAY_MS);
- return dayOffset;
- },
-
- /**
- * Calculates the week number for the given date. Can currently support standard
- * U.S. week numbers, based on Jan 1st defining the 1st week of the year, and
- * ISO8601 week numbers, based on Jan 4th defining the 1st week of the year.
- *
- * @method getWeekNumber
- * @param {Date} date The JavaScript date for which to find the week number
- * @param {Number} firstDayOfWeek The index of the first day of the week (0 = Sun, 1 = Mon ... 6 = Sat).
- * Defaults to 0
- * @param {Number} janDate The date in the first week of January which defines week one for the year
- * Defaults to the value of YAHOO.widget.DateMath.WEEK_ONE_JAN_DATE, which is 1 (Jan 1st).
- * For the U.S, this is normally Jan 1st. ISO8601 uses Jan 4th to define the first week of the year.
- *
- * @return {Number} The number of the week containing the given date.
- */
- getWeekNumber : function(date, firstDayOfWeek, janDate) {
-
- // Setup Defaults
- firstDayOfWeek = firstDayOfWeek || 0;
- janDate = janDate || this.WEEK_ONE_JAN_DATE;
-
- var targetDate = this.clearTime(date),
- startOfWeek,
- endOfWeek;
-
- if (targetDate.getDay() === firstDayOfWeek) {
- startOfWeek = targetDate;
- } else {
- startOfWeek = this.getFirstDayOfWeek(targetDate, firstDayOfWeek);
- }
-
- var startYear = startOfWeek.getFullYear();
-
- // DST shouldn't be a problem here, math is quicker than setDate();
- endOfWeek = new Date(startOfWeek.getTime() + 6*this.ONE_DAY_MS);
-
- var weekNum;
- if (startYear !== endOfWeek.getFullYear() && endOfWeek.getDate() >= janDate) {
- // If years don't match, endOfWeek is in Jan. and if the
- // week has WEEK_ONE_JAN_DATE in it, it's week one by definition.
- weekNum = 1;
- } else {
- // Get the 1st day of the 1st week, and
- // find how many days away we are from it.
- var weekOne = this.clearTime(this.getDate(startYear, 0, janDate)),
- weekOneDayOne = this.getFirstDayOfWeek(weekOne, firstDayOfWeek);
-
- // Round days to smoothen out 1 hr DST diff
- var daysDiff = Math.round((targetDate.getTime() - weekOneDayOne.getTime())/this.ONE_DAY_MS);
-
- // Calc. Full Weeks
- var rem = daysDiff % 7;
- var weeksDiff = (daysDiff - rem)/7;
- weekNum = weeksDiff + 1;
- }
- return weekNum;
- },
-
- /**
- * Get the first day of the week, for the give date.
- * @param {Date} dt The date in the week for which the first day is required.
- * @param {Number} startOfWeek The index for the first day of the week, 0 = Sun, 1 = Mon ... 6 = Sat (defaults to 0)
- * @return {Date} The first day of the week
- */
- getFirstDayOfWeek : function (dt, startOfWeek) {
- startOfWeek = startOfWeek || 0;
- var dayOfWeekIndex = dt.getDay(),
- dayOfWeek = (dayOfWeekIndex - startOfWeek + 7) % 7;
-
- return this.subtract(dt, this.DAY, dayOfWeek);
- },
-
- /**
- * Determines if a given week overlaps two different years.
- * @method isYearOverlapWeek
- * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
- * @return {Boolean} true if the date overlaps two different years.
- */
- isYearOverlapWeek : function(weekBeginDate) {
- var overlaps = false;
- var nextWeek = this.add(weekBeginDate, this.DAY, 6);
- if (nextWeek.getFullYear() != weekBeginDate.getFullYear()) {
- overlaps = true;
- }
- return overlaps;
- },
-
- /**
- * Determines if a given week overlaps two different months.
- * @method isMonthOverlapWeek
- * @param {Date} weekBeginDate The JavaScript Date representing the first day of the week.
- * @return {Boolean} true if the date overlaps two different months.
- */
- isMonthOverlapWeek : function(weekBeginDate) {
- var overlaps = false;
- var nextWeek = this.add(weekBeginDate, this.DAY, 6);
- if (nextWeek.getMonth() != weekBeginDate.getMonth()) {
- overlaps = true;
- }
- return overlaps;
- },
-
- /**
- * Gets the first day of a month containing a given date.
- * @method findMonthStart
- * @param {Date} date The JavaScript Date used to calculate the month start
- * @return {Date} The JavaScript Date representing the first day of the month
- */
- findMonthStart : function(date) {
- var start = this.getDate(date.getFullYear(), date.getMonth(), 1);
- return start;
- },
-
- /**
- * Gets the last day of a month containing a given date.
- * @method findMonthEnd
- * @param {Date} date The JavaScript Date used to calculate the month end
- * @return {Date} The JavaScript Date representing the last day of the month
- */
- findMonthEnd : function(date) {
- var start = this.findMonthStart(date);
- var nextMonth = this.add(start, this.MONTH, 1);
- var end = this.subtract(nextMonth, this.DAY, 1);
- return end;
- },
-
- /**
- * Clears the time fields from a given date, effectively setting the time to 12 noon.
- * @method clearTime
- * @param {Date} date The JavaScript Date for which the time fields will be cleared
- * @return {Date} The JavaScript Date cleared of all time fields
- */
- clearTime : function(date) {
- date.setHours(12,0,0,0);
- return date;
- },
-
- /**
- * Returns a new JavaScript Date object, representing the given year, month and date. Time fields (hr, min, sec, ms) on the new Date object
- * are set to 0. The method allows Date instances to be created with the a year less than 100. "new Date(year, month, date)" implementations
- * set the year to 19xx if a year (xx) which is less than 100 is provided.
- *
- * NOTE:Validation on argument values is not performed. It is the caller's responsibility to ensure
- * arguments are valid as per the ECMAScript-262 Date object specification for the new Date(year, month[, date]) constructor.
- *
- * @method getDate
- * @param {Number} y Year.
- * @param {Number} m Month index from 0 (Jan) to 11 (Dec).
- * @param {Number} d (optional) Date from 1 to 31. If not provided, defaults to 1.
- * @return {Date} The JavaScript date object with year, month, date set as provided.
- */
- getDate : function(y, m, d) {
- var dt = null;
- if (YAHOO.lang.isUndefined(d)) {
- d = 1;
- }
- if (y >= 100) {
- dt = new Date(y, m, d);
- } else {
- dt = new Date();
- dt.setFullYear(y);
- dt.setMonth(m);
- dt.setDate(d);
- dt.setHours(0,0,0,0);
- }
- return dt;
- }
-};
-/**
-* The Calendar component is a UI control that enables users to choose one or more dates from a graphical calendar presented in a one-month or
-* multi-month interface. Calendars are generated entirely via script and can be navigated without any page refreshes.
-* @module calendar
-* @title Calendar
-* @namespace YAHOO.widget
-* @requires yahoo,dom,event
-*/
-(function(){
-
- var Dom = YAHOO.util.Dom,
- Event = YAHOO.util.Event,
- Lang = YAHOO.lang,
- DateMath = YAHOO.widget.DateMath;
-
-/**
-* Calendar is the base class for the Calendar widget. In its most basic
-* implementation, it has the ability to render a calendar widget on the page
-* that can be manipulated to select a single date, move back and forth between
-* months and years.
-*
To construct the placeholder for the calendar widget, the code is as
-* follows:
-*
-*
-*
-*
-*
-* NOTE: As of 2.4.0, the constructor's ID argument is optional.
-* The Calendar can be constructed by simply providing a container ID string,
-* or a reference to a container DIV HTMLElement (the element needs to exist
-* in the document).
-*
-* E.g.:
-*
-* var c = new YAHOO.widget.Calendar("calContainer", configOptions);
-*
-* or:
-*
-* var containerDiv = YAHOO.util.Dom.get("calContainer");
-* var c = new YAHOO.widget.Calendar(containerDiv, configOptions);
-*
-*
-*
-* If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix.
-* For example if an ID is not provided, and the container's ID is "calContainer", the Calendar's ID will be set to "calContainer_t".
-*
-*
-* @namespace YAHOO.widget
-* @class Calendar
-* @constructor
-* @param {String} id optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
-* @param {String | HTMLElement} container The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
-* @param {Object} config optional The configuration object containing the initial configuration values for the Calendar.
-*/
-function Calendar(id, containerId, config) {
- this.init.apply(this, arguments);
-}
-
-/**
-* The path to be used for images loaded for the Calendar
-* @property YAHOO.widget.Calendar.IMG_ROOT
-* @static
-* @deprecated You can now customize images by overriding the calclose, calnavleft and calnavright default CSS classes for the close icon, left arrow and right arrow respectively
-* @type String
-*/
-Calendar.IMG_ROOT = null;
-
-/**
-* Type constant used for renderers to represent an individual date (M/D/Y)
-* @property YAHOO.widget.Calendar.DATE
-* @static
-* @final
-* @type String
-*/
-Calendar.DATE = "D";
-
-/**
-* Type constant used for renderers to represent an individual date across any year (M/D)
-* @property YAHOO.widget.Calendar.MONTH_DAY
-* @static
-* @final
-* @type String
-*/
-Calendar.MONTH_DAY = "MD";
-
-/**
-* Type constant used for renderers to represent a weekday
-* @property YAHOO.widget.Calendar.WEEKDAY
-* @static
-* @final
-* @type String
-*/
-Calendar.WEEKDAY = "WD";
-
-/**
-* Type constant used for renderers to represent a range of individual dates (M/D/Y-M/D/Y)
-* @property YAHOO.widget.Calendar.RANGE
-* @static
-* @final
-* @type String
-*/
-Calendar.RANGE = "R";
-
-/**
-* Type constant used for renderers to represent a month across any year
-* @property YAHOO.widget.Calendar.MONTH
-* @static
-* @final
-* @type String
-*/
-Calendar.MONTH = "M";
-
-/**
-* Constant that represents the total number of date cells that are displayed in a given month
-* @property YAHOO.widget.Calendar.DISPLAY_DAYS
-* @static
-* @final
-* @type Number
-*/
-Calendar.DISPLAY_DAYS = 42;
-
-/**
-* Constant used for halting the execution of the remainder of the render stack
-* @property YAHOO.widget.Calendar.STOP_RENDER
-* @static
-* @final
-* @type String
-*/
-Calendar.STOP_RENDER = "S";
-
-/**
-* Constant used to represent short date field string formats (e.g. Tu or Feb)
-* @property YAHOO.widget.Calendar.SHORT
-* @static
-* @final
-* @type String
-*/
-Calendar.SHORT = "short";
-
-/**
-* Constant used to represent long date field string formats (e.g. Monday or February)
-* @property YAHOO.widget.Calendar.LONG
-* @static
-* @final
-* @type String
-*/
-Calendar.LONG = "long";
-
-/**
-* Constant used to represent medium date field string formats (e.g. Mon)
-* @property YAHOO.widget.Calendar.MEDIUM
-* @static
-* @final
-* @type String
-*/
-Calendar.MEDIUM = "medium";
-
-/**
-* Constant used to represent single character date field string formats (e.g. M, T, W)
-* @property YAHOO.widget.Calendar.ONE_CHAR
-* @static
-* @final
-* @type String
-*/
-Calendar.ONE_CHAR = "1char";
-
-/**
-* The set of default Config property keys and values for the Calendar.
-*
-*
-* NOTE: This property is made public in order to allow users to change
-* the default values of configuration properties. Users should not
-* modify the key string, unless they are overriding the Calendar implementation
-*
-*
-*
-* The property is an object with key/value pairs, the key being the
-* uppercase configuration property name and the value being an object
-* literal with a key string property, and a value property, specifying the
-* default value of the property. To override a default value, you can set
-* the value property, for example, YAHOO.widget.Calendar.DEFAULT_CONFIG.MULTI_SELECT.value = true;
-*
-* @property YAHOO.widget.Calendar.DEFAULT_CONFIG
-* @static
-* @type Object
-*/
-
-Calendar.DEFAULT_CONFIG = {
- YEAR_OFFSET : {key:"year_offset", value:0, supercedes:["pagedate", "selected", "mindate","maxdate"]},
- TODAY : {key:"today", value:new Date(), supercedes:["pagedate"]},
- PAGEDATE : {key:"pagedate", value:null},
- SELECTED : {key:"selected", value:[]},
- TITLE : {key:"title", value:""},
- CLOSE : {key:"close", value:false},
- IFRAME : {key:"iframe", value:(YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) ? true : false},
- MINDATE : {key:"mindate", value:null},
- MAXDATE : {key:"maxdate", value:null},
- MULTI_SELECT : {key:"multi_select", value:false},
- OOM_SELECT : {key:"oom_select", value:false},
- START_WEEKDAY : {key:"start_weekday", value:0},
- SHOW_WEEKDAYS : {key:"show_weekdays", value:true},
- SHOW_WEEK_HEADER : {key:"show_week_header", value:false},
- SHOW_WEEK_FOOTER : {key:"show_week_footer", value:false},
- HIDE_BLANK_WEEKS : {key:"hide_blank_weeks", value:false},
- NAV_ARROW_LEFT: {key:"nav_arrow_left", value:null} ,
- NAV_ARROW_RIGHT : {key:"nav_arrow_right", value:null} ,
- MONTHS_SHORT : {key:"months_short", value:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]},
- MONTHS_LONG: {key:"months_long", value:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]},
- WEEKDAYS_1CHAR: {key:"weekdays_1char", value:["S", "M", "T", "W", "T", "F", "S"]},
- WEEKDAYS_SHORT: {key:"weekdays_short", value:["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]},
- WEEKDAYS_MEDIUM: {key:"weekdays_medium", value:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]},
- WEEKDAYS_LONG: {key:"weekdays_long", value:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]},
- LOCALE_MONTHS:{key:"locale_months", value:"long"},
- LOCALE_WEEKDAYS:{key:"locale_weekdays", value:"short"},
- DATE_DELIMITER:{key:"date_delimiter", value:","},
- DATE_FIELD_DELIMITER:{key:"date_field_delimiter", value:"/"},
- DATE_RANGE_DELIMITER:{key:"date_range_delimiter", value:"-"},
- MY_MONTH_POSITION:{key:"my_month_position", value:1},
- MY_YEAR_POSITION:{key:"my_year_position", value:2},
- MD_MONTH_POSITION:{key:"md_month_position", value:1},
- MD_DAY_POSITION:{key:"md_day_position", value:2},
- MDY_MONTH_POSITION:{key:"mdy_month_position", value:1},
- MDY_DAY_POSITION:{key:"mdy_day_position", value:2},
- MDY_YEAR_POSITION:{key:"mdy_year_position", value:3},
- MY_LABEL_MONTH_POSITION:{key:"my_label_month_position", value:1},
- MY_LABEL_YEAR_POSITION:{key:"my_label_year_position", value:2},
- MY_LABEL_MONTH_SUFFIX:{key:"my_label_month_suffix", value:" "},
- MY_LABEL_YEAR_SUFFIX:{key:"my_label_year_suffix", value:""},
- NAV: {key:"navigator", value: null},
- STRINGS : {
- key:"strings",
- value: {
- previousMonth : "Previous Month",
- nextMonth : "Next Month",
- close: "Close"
- },
- supercedes : ["close", "title"]
- }
-};
-
-/**
-* The set of default Config property keys and values for the Calendar
-* @property YAHOO.widget.Calendar._DEFAULT_CONFIG
-* @deprecated Made public. See the public DEFAULT_CONFIG property for details
-* @final
-* @static
-* @private
-* @type Object
-*/
-Calendar._DEFAULT_CONFIG = Calendar.DEFAULT_CONFIG;
-
-var DEF_CFG = Calendar.DEFAULT_CONFIG;
-
-/**
-* The set of Custom Event types supported by the Calendar
-* @property YAHOO.widget.Calendar._EVENT_TYPES
-* @final
-* @static
-* @private
-* @type Object
-*/
-Calendar._EVENT_TYPES = {
- BEFORE_SELECT : "beforeSelect",
- SELECT : "select",
- BEFORE_DESELECT : "beforeDeselect",
- DESELECT : "deselect",
- CHANGE_PAGE : "changePage",
- BEFORE_RENDER : "beforeRender",
- RENDER : "render",
- BEFORE_DESTROY : "beforeDestroy",
- DESTROY : "destroy",
- RESET : "reset",
- CLEAR : "clear",
- BEFORE_HIDE : "beforeHide",
- HIDE : "hide",
- BEFORE_SHOW : "beforeShow",
- SHOW : "show",
- BEFORE_HIDE_NAV : "beforeHideNav",
- HIDE_NAV : "hideNav",
- BEFORE_SHOW_NAV : "beforeShowNav",
- SHOW_NAV : "showNav",
- BEFORE_RENDER_NAV : "beforeRenderNav",
- RENDER_NAV : "renderNav"
-};
-
-/**
-* The set of default style constants for the Calendar
-* @property YAHOO.widget.Calendar.STYLES
-* @static
-* @type Object An object with name/value pairs for the class name identifier/value.
-*/
-Calendar.STYLES = {
- CSS_ROW_HEADER: "calrowhead",
- CSS_ROW_FOOTER: "calrowfoot",
- CSS_CELL : "calcell",
- CSS_CELL_SELECTOR : "selector",
- CSS_CELL_SELECTED : "selected",
- CSS_CELL_SELECTABLE : "selectable",
- CSS_CELL_RESTRICTED : "restricted",
- CSS_CELL_TODAY : "today",
- CSS_CELL_OOM : "oom",
- CSS_CELL_OOB : "previous",
- CSS_HEADER : "calheader",
- CSS_HEADER_TEXT : "calhead",
- CSS_BODY : "calbody",
- CSS_WEEKDAY_CELL : "calweekdaycell",
- CSS_WEEKDAY_ROW : "calweekdayrow",
- CSS_FOOTER : "calfoot",
- CSS_CALENDAR : "yui-calendar",
- CSS_SINGLE : "single",
- CSS_CONTAINER : "yui-calcontainer",
- CSS_NAV_LEFT : "calnavleft",
- CSS_NAV_RIGHT : "calnavright",
- CSS_NAV : "calnav",
- CSS_CLOSE : "calclose",
- CSS_CELL_TOP : "calcelltop",
- CSS_CELL_LEFT : "calcellleft",
- CSS_CELL_RIGHT : "calcellright",
- CSS_CELL_BOTTOM : "calcellbottom",
- CSS_CELL_HOVER : "calcellhover",
- CSS_CELL_HIGHLIGHT1 : "highlight1",
- CSS_CELL_HIGHLIGHT2 : "highlight2",
- CSS_CELL_HIGHLIGHT3 : "highlight3",
- CSS_CELL_HIGHLIGHT4 : "highlight4",
- CSS_WITH_TITLE: "withtitle",
- CSS_FIXED_SIZE: "fixedsize",
- CSS_LINK_CLOSE: "link-close"
-};
-
-/**
-* The set of default style constants for the Calendar
-* @property YAHOO.widget.Calendar._STYLES
-* @deprecated Made public. See the public STYLES property for details
-* @final
-* @static
-* @private
-* @type Object
-*/
-Calendar._STYLES = Calendar.STYLES;
-
-Calendar.prototype = {
-
- /**
- * The configuration object used to set up the calendars various locale and style options.
- * @property Config
- * @private
- * @deprecated Configuration properties should be set by calling Calendar.cfg.setProperty.
- * @type Object
- */
- Config : null,
-
- /**
- * The parent CalendarGroup, only to be set explicitly by the parent group
- * @property parent
- * @type CalendarGroup
- */
- parent : null,
-
- /**
- * The index of this item in the parent group
- * @property index
- * @type Number
- */
- index : -1,
-
- /**
- * The collection of calendar table cells
- * @property cells
- * @type HTMLTableCellElement[]
- */
- cells : null,
-
- /**
- * The collection of calendar cell dates that is parallel to the cells collection. The array contains dates field arrays in the format of [YYYY, M, D].
- * @property cellDates
- * @type Array[](Number[])
- */
- cellDates : null,
-
- /**
- * The id that uniquely identifies this Calendar.
- * @property id
- * @type String
- */
- id : null,
-
- /**
- * The unique id associated with the Calendar's container
- * @property containerId
- * @type String
- */
- containerId: null,
-
- /**
- * The DOM element reference that points to this calendar's container element. The calendar will be inserted into this element when the shell is rendered.
- * @property oDomContainer
- * @type HTMLElement
- */
- oDomContainer : null,
-
- /**
- * A Date object representing today's date.
- * @deprecated Use the "today" configuration property
- * @property today
- * @type Date
- */
- today : null,
-
- /**
- * The list of render functions, along with required parameters, used to render cells.
- * @property renderStack
- * @type Array[]
- */
- renderStack : null,
-
- /**
- * A copy of the initial render functions created before rendering.
- * @property _renderStack
- * @private
- * @type Array
- */
- _renderStack : null,
-
- /**
- * A reference to the CalendarNavigator instance created for this Calendar.
- * Will be null if the "navigator" configuration property has not been set
- * @property oNavigator
- * @type CalendarNavigator
- */
- oNavigator : null,
-
- /**
- * The private list of initially selected dates.
- * @property _selectedDates
- * @private
- * @type Array
- */
- _selectedDates : null,
-
- /**
- * A map of DOM event handlers to attach to cells associated with specific CSS class names
- * @property domEventMap
- * @type Object
- */
- domEventMap : null,
-
- /**
- * Protected helper used to parse Calendar constructor/init arguments.
- *
- * As of 2.4.0, Calendar supports a simpler constructor
- * signature. This method reconciles arguments
- * received in the pre 2.4.0 and 2.4.0 formats.
- *
- * @protected
- * @method _parseArgs
- * @param {Array} Function "arguments" array
- * @return {Object} Object with id, container, config properties containing
- * the reconciled argument values.
- **/
- _parseArgs : function(args) {
- /*
- 2.4.0 Constructors signatures
-
- new Calendar(String)
- new Calendar(HTMLElement)
- new Calendar(String, ConfigObject)
- new Calendar(HTMLElement, ConfigObject)
-
- Pre 2.4.0 Constructor signatures
-
- new Calendar(String, String)
- new Calendar(String, HTMLElement)
- new Calendar(String, String, ConfigObject)
- new Calendar(String, HTMLElement, ConfigObject)
- */
- var nArgs = {id:null, container:null, config:null};
-
- if (args && args.length && args.length > 0) {
- switch (args.length) {
- case 1:
- nArgs.id = null;
- nArgs.container = args[0];
- nArgs.config = null;
- break;
- case 2:
- if (Lang.isObject(args[1]) && !args[1].tagName && !(args[1] instanceof String)) {
- nArgs.id = null;
- nArgs.container = args[0];
- nArgs.config = args[1];
- } else {
- nArgs.id = args[0];
- nArgs.container = args[1];
- nArgs.config = null;
- }
- break;
- default: // 3+
- nArgs.id = args[0];
- nArgs.container = args[1];
- nArgs.config = args[2];
- break;
- }
- } else {
- }
- return nArgs;
- },
-
- /**
- * Initializes the Calendar widget.
- * @method init
- *
- * @param {String} id optional The id of the table element that will represent the Calendar widget. As of 2.4.0, this argument is optional.
- * @param {String | HTMLElement} container The id of the container div element that will wrap the Calendar table, or a reference to a DIV element which exists in the document.
- * @param {Object} config optional The configuration object containing the initial configuration values for the Calendar.
- */
- init : function(id, container, config) {
- // Normalize 2.4.0, pre 2.4.0 args
- var nArgs = this._parseArgs(arguments);
-
- id = nArgs.id;
- container = nArgs.container;
- config = nArgs.config;
-
- this.oDomContainer = Dom.get(container);
-
- this._oDoc = this.oDomContainer.ownerDocument;
-
- if (!this.oDomContainer.id) {
- this.oDomContainer.id = Dom.generateId();
- }
-
- if (!id) {
- id = this.oDomContainer.id + "_t";
- }
-
- this.id = id;
- this.containerId = this.oDomContainer.id;
-
- this.initEvents();
-
- /**
- * The Config object used to hold the configuration variables for the Calendar
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- /**
- * The local object which contains the Calendar's options
- * @property Options
- * @type Object
- */
- this.Options = {};
-
- /**
- * The local object which contains the Calendar's locale settings
- * @property Locale
- * @type Object
- */
- this.Locale = {};
-
- this.initStyles();
-
- Dom.addClass(this.oDomContainer, this.Style.CSS_CONTAINER);
- Dom.addClass(this.oDomContainer, this.Style.CSS_SINGLE);
-
- this.cellDates = [];
- this.cells = [];
- this.renderStack = [];
- this._renderStack = [];
-
- this.setupConfig();
-
- if (config) {
- this.cfg.applyConfig(config, true);
- }
-
- this.cfg.fireQueue();
-
- this.today = this.cfg.getProperty("today");
- },
-
- /**
- * Default Config listener for the iframe property. If the iframe config property is set to true,
- * renders the built-in IFRAME shim if the container is relatively or absolutely positioned.
- *
- * @method configIframe
- */
- configIframe : function(type, args, obj) {
- var useIframe = args[0];
-
- if (!this.parent) {
- if (Dom.inDocument(this.oDomContainer)) {
- if (useIframe) {
- var pos = Dom.getStyle(this.oDomContainer, "position");
-
- if (pos == "absolute" || pos == "relative") {
-
- if (!Dom.inDocument(this.iframe)) {
- this.iframe = document.createElement("iframe");
- this.iframe.src = "javascript:false;";
-
- Dom.setStyle(this.iframe, "opacity", "0");
-
- if (YAHOO.env.ua.ie && YAHOO.env.ua.ie <= 6) {
- Dom.addClass(this.iframe, this.Style.CSS_FIXED_SIZE);
- }
-
- this.oDomContainer.insertBefore(this.iframe, this.oDomContainer.firstChild);
- }
- }
- } else {
- if (this.iframe) {
- if (this.iframe.parentNode) {
- this.iframe.parentNode.removeChild(this.iframe);
- }
- this.iframe = null;
- }
- }
- }
- }
- },
-
- /**
- * Default handler for the "title" property
- * @method configTitle
- */
- configTitle : function(type, args, obj) {
- var title = args[0];
-
- // "" disables title bar
- if (title) {
- this.createTitleBar(title);
- } else {
- var close = this.cfg.getProperty(DEF_CFG.CLOSE.key);
- if (!close) {
- this.removeTitleBar();
- } else {
- this.createTitleBar(" ");
- }
- }
- },
-
- /**
- * Default handler for the "close" property
- * @method configClose
- */
- configClose : function(type, args, obj) {
- var close = args[0],
- title = this.cfg.getProperty(DEF_CFG.TITLE.key);
-
- if (close) {
- if (!title) {
- this.createTitleBar(" ");
- }
- this.createCloseButton();
- } else {
- this.removeCloseButton();
- if (!title) {
- this.removeTitleBar();
- }
- }
- },
-
- /**
- * Initializes Calendar's built-in CustomEvents
- * @method initEvents
- */
- initEvents : function() {
-
- var defEvents = Calendar._EVENT_TYPES,
- CE = YAHOO.util.CustomEvent,
- cal = this; // To help with minification
-
- /**
- * Fired before a date selection is made
- * @event beforeSelectEvent
- */
- cal.beforeSelectEvent = new CE(defEvents.BEFORE_SELECT);
-
- /**
- * Fired when a date selection is made
- * @event selectEvent
- * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
- */
- cal.selectEvent = new CE(defEvents.SELECT);
-
- /**
- * Fired before a date or set of dates is deselected
- * @event beforeDeselectEvent
- */
- cal.beforeDeselectEvent = new CE(defEvents.BEFORE_DESELECT);
-
- /**
- * Fired when a date or set of dates is deselected
- * @event deselectEvent
- * @param {Array} Array of Date field arrays in the format [YYYY, MM, DD].
- */
- cal.deselectEvent = new CE(defEvents.DESELECT);
-
- /**
- * Fired when the Calendar page is changed
- * @event changePageEvent
- * @param {Date} prevDate The date before the page was changed
- * @param {Date} newDate The date after the page was changed
- */
- cal.changePageEvent = new CE(defEvents.CHANGE_PAGE);
-
- /**
- * Fired before the Calendar is rendered
- * @event beforeRenderEvent
- */
- cal.beforeRenderEvent = new CE(defEvents.BEFORE_RENDER);
-
- /**
- * Fired when the Calendar is rendered
- * @event renderEvent
- */
- cal.renderEvent = new CE(defEvents.RENDER);
-
- /**
- * Fired just before the Calendar is to be destroyed
- * @event beforeDestroyEvent
- */
- cal.beforeDestroyEvent = new CE(defEvents.BEFORE_DESTROY);
-
- /**
- * Fired after the Calendar is destroyed. This event should be used
- * for notification only. When this event is fired, important Calendar instance
- * properties, dom references and event listeners have already been
- * removed/dereferenced, and hence the Calendar instance is not in a usable
- * state.
- *
- * @event destroyEvent
- */
- cal.destroyEvent = new CE(defEvents.DESTROY);
-
- /**
- * Fired when the Calendar is reset
- * @event resetEvent
- */
- cal.resetEvent = new CE(defEvents.RESET);
-
- /**
- * Fired when the Calendar is cleared
- * @event clearEvent
- */
- cal.clearEvent = new CE(defEvents.CLEAR);
-
- /**
- * Fired just before the Calendar is to be shown
- * @event beforeShowEvent
- */
- cal.beforeShowEvent = new CE(defEvents.BEFORE_SHOW);
-
- /**
- * Fired after the Calendar is shown
- * @event showEvent
- */
- cal.showEvent = new CE(defEvents.SHOW);
-
- /**
- * Fired just before the Calendar is to be hidden
- * @event beforeHideEvent
- */
- cal.beforeHideEvent = new CE(defEvents.BEFORE_HIDE);
-
- /**
- * Fired after the Calendar is hidden
- * @event hideEvent
- */
- cal.hideEvent = new CE(defEvents.HIDE);
-
- /**
- * Fired just before the CalendarNavigator is to be shown
- * @event beforeShowNavEvent
- */
- cal.beforeShowNavEvent = new CE(defEvents.BEFORE_SHOW_NAV);
-
- /**
- * Fired after the CalendarNavigator is shown
- * @event showNavEvent
- */
- cal.showNavEvent = new CE(defEvents.SHOW_NAV);
-
- /**
- * Fired just before the CalendarNavigator is to be hidden
- * @event beforeHideNavEvent
- */
- cal.beforeHideNavEvent = new CE(defEvents.BEFORE_HIDE_NAV);
-
- /**
- * Fired after the CalendarNavigator is hidden
- * @event hideNavEvent
- */
- cal.hideNavEvent = new CE(defEvents.HIDE_NAV);
-
- /**
- * Fired just before the CalendarNavigator is to be rendered
- * @event beforeRenderNavEvent
- */
- cal.beforeRenderNavEvent = new CE(defEvents.BEFORE_RENDER_NAV);
-
- /**
- * Fired after the CalendarNavigator is rendered
- * @event renderNavEvent
- */
- cal.renderNavEvent = new CE(defEvents.RENDER_NAV);
-
- cal.beforeSelectEvent.subscribe(cal.onBeforeSelect, this, true);
- cal.selectEvent.subscribe(cal.onSelect, this, true);
- cal.beforeDeselectEvent.subscribe(cal.onBeforeDeselect, this, true);
- cal.deselectEvent.subscribe(cal.onDeselect, this, true);
- cal.changePageEvent.subscribe(cal.onChangePage, this, true);
- cal.renderEvent.subscribe(cal.onRender, this, true);
- cal.resetEvent.subscribe(cal.onReset, this, true);
- cal.clearEvent.subscribe(cal.onClear, this, true);
- },
-
- /**
- * The default event handler for clicks on the "Previous Month" navigation UI
- *
- * @method doPreviousMonthNav
- * @param {DOMEvent} e The DOM event
- * @param {Calendar} cal A reference to the calendar
- */
- doPreviousMonthNav : function(e, cal) {
- Event.preventDefault(e);
- // previousMonth invoked in a timeout, to allow
- // event to bubble up, with correct target. Calling
- // previousMonth, will call render which will remove
- // HTML which generated the event, resulting in an
- // invalid event target in certain browsers.
- setTimeout(function() {
- cal.previousMonth();
- var navs = Dom.getElementsByClassName(cal.Style.CSS_NAV_LEFT, "a", cal.oDomContainer);
- if (navs && navs[0]) {
- try {
- navs[0].focus();
- } catch (ex) {
- // ignore
- }
- }
- }, 0);
- },
-
- /**
- * The default event handler for clicks on the "Next Month" navigation UI
- *
- * @method doNextMonthNav
- * @param {DOMEvent} e The DOM event
- * @param {Calendar} cal A reference to the calendar
- */
- doNextMonthNav : function(e, cal) {
- Event.preventDefault(e);
- setTimeout(function() {
- cal.nextMonth();
- var navs = Dom.getElementsByClassName(cal.Style.CSS_NAV_RIGHT, "a", cal.oDomContainer);
- if (navs && navs[0]) {
- try {
- navs[0].focus();
- } catch (ex) {
- // ignore
- }
- }
- }, 0);
- },
-
- /**
- * The default event handler for date cell selection. Currently attached to
- * the Calendar's bounding box, referenced by it's oDomContainer property.
- *
- * @method doSelectCell
- * @param {DOMEvent} e The DOM event
- * @param {Calendar} cal A reference to the calendar
- */
- doSelectCell : function(e, cal) {
- var cell, d, date, index;
-
- var target = Event.getTarget(e),
- tagName = target.tagName.toLowerCase(),
- defSelector = false;
-
- while (tagName != "td" && !Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
-
- if (!defSelector && tagName == "a" && Dom.hasClass(target, cal.Style.CSS_CELL_SELECTOR)) {
- defSelector = true;
- }
-
- target = target.parentNode;
- tagName = target.tagName.toLowerCase();
-
- if (target == this.oDomContainer || tagName == "html") {
- return;
- }
- }
-
- if (defSelector) {
- // Stop link href navigation for default renderer
- Event.preventDefault(e);
- }
-
- cell = target;
-
- if (Dom.hasClass(cell, cal.Style.CSS_CELL_SELECTABLE)) {
- index = cal.getIndexFromId(cell.id);
- if (index > -1) {
- d = cal.cellDates[index];
- if (d) {
- date = DateMath.getDate(d[0],d[1]-1,d[2]);
-
- var link;
-
- if (cal.Options.MULTI_SELECT) {
- link = cell.getElementsByTagName("a")[0];
- if (link) {
- link.blur();
- }
-
- var cellDate = cal.cellDates[index];
- var cellDateIndex = cal._indexOfSelectedFieldArray(cellDate);
-
- if (cellDateIndex > -1) {
- cal.deselectCell(index);
- } else {
- cal.selectCell(index);
- }
-
- } else {
- link = cell.getElementsByTagName("a")[0];
- if (link) {
- link.blur();
- }
- cal.selectCell(index);
- }
- }
- }
- }
- },
-
- /**
- * The event that is executed when the user hovers over a cell
- * @method doCellMouseOver
- * @param {DOMEvent} e The event
- * @param {Calendar} cal A reference to the calendar passed by the Event utility
- */
- doCellMouseOver : function(e, cal) {
- var target;
- if (e) {
- target = Event.getTarget(e);
- } else {
- target = this;
- }
-
- while (target.tagName && target.tagName.toLowerCase() != "td") {
- target = target.parentNode;
- if (!target.tagName || target.tagName.toLowerCase() == "html") {
- return;
- }
- }
-
- if (Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
- Dom.addClass(target, cal.Style.CSS_CELL_HOVER);
- }
- },
-
- /**
- * The event that is executed when the user moves the mouse out of a cell
- * @method doCellMouseOut
- * @param {DOMEvent} e The event
- * @param {Calendar} cal A reference to the calendar passed by the Event utility
- */
- doCellMouseOut : function(e, cal) {
- var target;
- if (e) {
- target = Event.getTarget(e);
- } else {
- target = this;
- }
-
- while (target.tagName && target.tagName.toLowerCase() != "td") {
- target = target.parentNode;
- if (!target.tagName || target.tagName.toLowerCase() == "html") {
- return;
- }
- }
-
- if (Dom.hasClass(target, cal.Style.CSS_CELL_SELECTABLE)) {
- Dom.removeClass(target, cal.Style.CSS_CELL_HOVER);
- }
- },
-
- setupConfig : function() {
-
- var cfg = this.cfg;
-
- /**
- * The date to use to represent "Today".
- *
- * @config today
- * @type Date
- * @default The client side date (new Date()) when the Calendar is instantiated.
- */
- cfg.addProperty(DEF_CFG.TODAY.key, { value: new Date(DEF_CFG.TODAY.value.getTime()), supercedes:DEF_CFG.TODAY.supercedes, handler:this.configToday, suppressEvent:true } );
-
- /**
- * The month/year representing the current visible Calendar date (mm/yyyy)
- * @config pagedate
- * @type String | Date
- * @default Today's date
- */
- cfg.addProperty(DEF_CFG.PAGEDATE.key, { value: DEF_CFG.PAGEDATE.value || new Date(DEF_CFG.TODAY.value.getTime()), handler:this.configPageDate } );
-
- /**
- * The date or range of dates representing the current Calendar selection
- * @config selected
- * @type String
- * @default []
- */
- cfg.addProperty(DEF_CFG.SELECTED.key, { value:DEF_CFG.SELECTED.value.concat(), handler:this.configSelected } );
-
- /**
- * The title to display above the Calendar's month header. The title is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config title
- * @type HTML
- * @default ""
- */
- cfg.addProperty(DEF_CFG.TITLE.key, { value:DEF_CFG.TITLE.value, handler:this.configTitle } );
-
- /**
- * Whether or not a close button should be displayed for this Calendar
- * @config close
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.CLOSE.key, { value:DEF_CFG.CLOSE.value, handler:this.configClose } );
-
- /**
- * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
- * This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be
- * enabled if required.
- *
- * @config iframe
- * @type Boolean
- * @default true for IE6 and below, false for all other browsers
- */
- cfg.addProperty(DEF_CFG.IFRAME.key, { value:DEF_CFG.IFRAME.value, handler:this.configIframe, validator:cfg.checkBoolean } );
-
- /**
- * The minimum selectable date in the current Calendar (mm/dd/yyyy)
- * @config mindate
- * @type String | Date
- * @default null
- */
- cfg.addProperty(DEF_CFG.MINDATE.key, { value:DEF_CFG.MINDATE.value, handler:this.configMinDate } );
-
- /**
- * The maximum selectable date in the current Calendar (mm/dd/yyyy)
- * @config maxdate
- * @type String | Date
- * @default null
- */
- cfg.addProperty(DEF_CFG.MAXDATE.key, { value:DEF_CFG.MAXDATE.value, handler:this.configMaxDate } );
-
- // Options properties
-
- /**
- * True if the Calendar should allow multiple selections. False by default.
- * @config MULTI_SELECT
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.MULTI_SELECT.key, { value:DEF_CFG.MULTI_SELECT.value, handler:this.configOptions, validator:cfg.checkBoolean } );
-
- /**
- * True if the Calendar should allow selection of out-of-month dates. False by default.
- * @config OOM_SELECT
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.OOM_SELECT.key, { value:DEF_CFG.OOM_SELECT.value, handler:this.configOptions, validator:cfg.checkBoolean } );
-
- /**
- * The weekday the week begins on. Default is 0 (Sunday = 0, Monday = 1 ... Saturday = 6).
- * @config START_WEEKDAY
- * @type number
- * @default 0
- */
- cfg.addProperty(DEF_CFG.START_WEEKDAY.key, { value:DEF_CFG.START_WEEKDAY.value, handler:this.configOptions, validator:cfg.checkNumber } );
-
- /**
- * True if the Calendar should show weekday labels. True by default.
- * @config SHOW_WEEKDAYS
- * @type Boolean
- * @default true
- */
- cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key, { value:DEF_CFG.SHOW_WEEKDAYS.value, handler:this.configOptions, validator:cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row headers. False by default.
- * @config SHOW_WEEK_HEADER
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key, { value:DEF_CFG.SHOW_WEEK_HEADER.value, handler:this.configOptions, validator:cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row footers. False by default.
- * @config SHOW_WEEK_FOOTER
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{ value:DEF_CFG.SHOW_WEEK_FOOTER.value, handler:this.configOptions, validator:cfg.checkBoolean } );
-
- /**
- * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
- * @config HIDE_BLANK_WEEKS
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key, { value:DEF_CFG.HIDE_BLANK_WEEKS.value, handler:this.configOptions, validator:cfg.checkBoolean } );
-
- /**
- * The image URL that should be used for the left navigation arrow. The image URL is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config NAV_ARROW_LEFT
- * @type String
- * @deprecated You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"
- * @default null
- */
- cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key, { value:DEF_CFG.NAV_ARROW_LEFT.value, handler:this.configOptions } );
-
- /**
- * The image URL that should be used for the right navigation arrow. The image URL is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config NAV_ARROW_RIGHT
- * @type String
- * @deprecated You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
- * @default null
- */
- cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key, { value:DEF_CFG.NAV_ARROW_RIGHT.value, handler:this.configOptions } );
-
- // Locale properties
-
- /**
- * The short month labels for the current locale. The month labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config MONTHS_SHORT
- * @type HTML[]
- * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
- */
- cfg.addProperty(DEF_CFG.MONTHS_SHORT.key, { value:DEF_CFG.MONTHS_SHORT.value, handler:this.configLocale } );
-
- /**
- * The long month labels for the current locale. The month labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config MONTHS_LONG
- * @type HTML[]
- * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
- */
- cfg.addProperty(DEF_CFG.MONTHS_LONG.key, { value:DEF_CFG.MONTHS_LONG.value, handler:this.configLocale } );
-
- /**
- * The 1-character weekday labels for the current locale. The weekday labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config WEEKDAYS_1CHAR
- * @type HTML[]
- * @default ["S", "M", "T", "W", "T", "F", "S"]
- */
- cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key, { value:DEF_CFG.WEEKDAYS_1CHAR.value, handler:this.configLocale } );
-
- /**
- * The short weekday labels for the current locale. The weekday labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config WEEKDAYS_SHORT
- * @type HTML[]
- * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
- */
- cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key, { value:DEF_CFG.WEEKDAYS_SHORT.value, handler:this.configLocale } );
-
- /**
- * The medium weekday labels for the current locale. The weekday labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config WEEKDAYS_MEDIUM
- * @type HTML[]
- * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
- */
- cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key, { value:DEF_CFG.WEEKDAYS_MEDIUM.value, handler:this.configLocale } );
-
- /**
- * The long weekday labels for the current locale. The weekday labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config WEEKDAYS_LONG
- * @type HTML[]
- * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
- */
- cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key, { value:DEF_CFG.WEEKDAYS_LONG.value, handler:this.configLocale } );
-
- /**
- * Refreshes the locale values used to build the Calendar.
- * @method refreshLocale
- * @private
- */
- var refreshLocale = function() {
- cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);
- cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);
- };
-
- cfg.subscribeToConfigEvent(DEF_CFG.START_WEEKDAY.key, refreshLocale, this, true);
- cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_SHORT.key, refreshLocale, this, true);
- cfg.subscribeToConfigEvent(DEF_CFG.MONTHS_LONG.key, refreshLocale, this, true);
- cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_1CHAR.key, refreshLocale, this, true);
- cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_SHORT.key, refreshLocale, this, true);
- cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_MEDIUM.key, refreshLocale, this, true);
- cfg.subscribeToConfigEvent(DEF_CFG.WEEKDAYS_LONG.key, refreshLocale, this, true);
-
- /**
- * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
- * @config LOCALE_MONTHS
- * @type String
- * @default "long"
- */
- cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key, { value:DEF_CFG.LOCALE_MONTHS.value, handler:this.configLocaleValues } );
-
- /**
- * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
- * @config LOCALE_WEEKDAYS
- * @type String
- * @default "short"
- */
- cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key, { value:DEF_CFG.LOCALE_WEEKDAYS.value, handler:this.configLocaleValues } );
-
- /**
- * The positive or negative year offset from the Gregorian calendar year (assuming a January 1st rollover) to
- * be used when displaying and parsing dates. NOTE: All JS Date objects returned by methods, or expected as input by
- * methods will always represent the Gregorian year, in order to maintain date/month/week values.
- *
- * @config YEAR_OFFSET
- * @type Number
- * @default 0
- */
- cfg.addProperty(DEF_CFG.YEAR_OFFSET.key, { value:DEF_CFG.YEAR_OFFSET.value, supercedes:DEF_CFG.YEAR_OFFSET.supercedes, handler:this.configLocale } );
-
- /**
- * The value used to delimit individual dates in a date string passed to various Calendar functions.
- * @config DATE_DELIMITER
- * @type String
- * @default ","
- */
- cfg.addProperty(DEF_CFG.DATE_DELIMITER.key, { value:DEF_CFG.DATE_DELIMITER.value, handler:this.configLocale } );
-
- /**
- * The value used to delimit date fields in a date string passed to various Calendar functions.
- * @config DATE_FIELD_DELIMITER
- * @type String
- * @default "/"
- */
- cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key, { value:DEF_CFG.DATE_FIELD_DELIMITER.value, handler:this.configLocale } );
-
- /**
- * The value used to delimit date ranges in a date string passed to various Calendar functions.
- * @config DATE_RANGE_DELIMITER
- * @type String
- * @default "-"
- */
- cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key, { value:DEF_CFG.DATE_RANGE_DELIMITER.value, handler:this.configLocale } );
-
- /**
- * The position of the month in a month/year date string
- * @config MY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key, { value:DEF_CFG.MY_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
-
- /**
- * The position of the year in a month/year date string
- * @config MY_YEAR_POSITION
- * @type Number
- * @default 2
- */
- cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key, { value:DEF_CFG.MY_YEAR_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day date string
- * @config MD_MONTH_POSITION
- * @type Number
- * @default 1
- */
- cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key, { value:DEF_CFG.MD_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
-
- /**
- * The position of the day in a month/year date string
- * @config MD_DAY_POSITION
- * @type Number
- * @default 2
- */
- cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key, { value:DEF_CFG.MD_DAY_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day/year date string
- * @config MDY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key, { value:DEF_CFG.MDY_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
-
- /**
- * The position of the day in a month/day/year date string
- * @config MDY_DAY_POSITION
- * @type Number
- * @default 2
- */
- cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key, { value:DEF_CFG.MDY_DAY_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
-
- /**
- * The position of the year in a month/day/year date string
- * @config MDY_YEAR_POSITION
- * @type Number
- * @default 3
- */
- cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key, { value:DEF_CFG.MDY_YEAR_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
-
- /**
- * The position of the month in the month year label string used as the Calendar header
- * @config MY_LABEL_MONTH_POSITION
- * @type Number
- * @default 1
- */
- cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key, { value:DEF_CFG.MY_LABEL_MONTH_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
-
- /**
- * The position of the year in the month year label string used as the Calendar header
- * @config MY_LABEL_YEAR_POSITION
- * @type Number
- * @default 2
- */
- cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key, { value:DEF_CFG.MY_LABEL_YEAR_POSITION.value, handler:this.configLocale, validator:cfg.checkNumber } );
-
- /**
- * The suffix used after the month when rendering the Calendar header. The suffix is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config MY_LABEL_MONTH_SUFFIX
- * @type HTML
- * @default " "
- */
- cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key, { value:DEF_CFG.MY_LABEL_MONTH_SUFFIX.value, handler:this.configLocale } );
-
- /**
- * The suffix used after the year when rendering the Calendar header. The suffix is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config MY_LABEL_YEAR_SUFFIX
- * @type HTML
- * @default ""
- */
- cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key, { value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value, handler:this.configLocale } );
-
- /**
- * Configuration for the Month/Year CalendarNavigator UI which allows the user to jump directly to a
- * specific Month/Year without having to scroll sequentially through months.
- *
- * Setting this property to null (default value) or false, will disable the CalendarNavigator UI.
- *
- *
- * Setting this property to true will enable the CalendarNavigatior UI with the default CalendarNavigator configuration values.
- *
- *
- * This property can also be set to an object literal containing configuration properties for the CalendarNavigator UI.
- * The configuration object expects the the following case-sensitive properties, with the "strings" property being a nested object.
- * Any properties which are not provided will use the default values (defined in the CalendarNavigator class).
- *
- *
- *
strings
- *
Object : An object with the properties shown below, defining the string labels to use in the Navigator's UI. The strings are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
- *
month
HTML : The markup to use for the month label. Defaults to "Month".
- *
year
HTML : The markup to use for the year label. Defaults to "Year".
- *
submit
HTML : The markup to use for the submit button label. Defaults to "Okay".
- *
cancel
HTML : The markup to use for the cancel button label. Defaults to "Cancel".
- *
invalidYear
HTML : The markup to use for invalid year values. Defaults to "Year needs to be a number".
- *
- *
- *
monthFormat
String : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG
- *
initialFocus
String : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"
- * @config navigator
- * @type {Object|Boolean}
- * @default null
- */
- cfg.addProperty(DEF_CFG.NAV.key, { value:DEF_CFG.NAV.value, handler:this.configNavigator } );
-
- /**
- * The map of UI strings which the Calendar UI uses.
- *
- * @config strings
- * @type {Object}
- * @default An object with the properties shown below:
- *
- *
previousMonth
HTML : The markup to use for the "Previous Month" navigation label. Defaults to "Previous Month". The string is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
nextMonth
HTML : The markup to use for the "Next Month" navigation UI. Defaults to "Next Month". The string is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
close
HTML : The markup to use for the close button label. Defaults to "Close". The string is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
- */
- cfg.addProperty(DEF_CFG.STRINGS.key, {
- value:DEF_CFG.STRINGS.value,
- handler:this.configStrings,
- validator: function(val) {
- return Lang.isObject(val);
- },
- supercedes:DEF_CFG.STRINGS.supercedes
- });
- },
-
- /**
- * The default handler for the "strings" property
- * @method configStrings
- */
- configStrings : function(type, args, obj) {
- var val = Lang.merge(DEF_CFG.STRINGS.value, args[0]);
- this.cfg.setProperty(DEF_CFG.STRINGS.key, val, true);
- },
-
- /**
- * The default handler for the "pagedate" property
- * @method configPageDate
- */
- configPageDate : function(type, args, obj) {
- this.cfg.setProperty(DEF_CFG.PAGEDATE.key, this._parsePageDate(args[0]), true);
- },
-
- /**
- * The default handler for the "mindate" property
- * @method configMinDate
- */
- configMinDate : function(type, args, obj) {
- var val = args[0];
- if (Lang.isString(val)) {
- val = this._parseDate(val);
- this.cfg.setProperty(DEF_CFG.MINDATE.key, DateMath.getDate(val[0],(val[1]-1),val[2]));
- }
- },
-
- /**
- * The default handler for the "maxdate" property
- * @method configMaxDate
- */
- configMaxDate : function(type, args, obj) {
- var val = args[0];
- if (Lang.isString(val)) {
- val = this._parseDate(val);
- this.cfg.setProperty(DEF_CFG.MAXDATE.key, DateMath.getDate(val[0],(val[1]-1),val[2]));
- }
- },
-
- /**
- * The default handler for the "today" property
- * @method configToday
- */
- configToday : function(type, args, obj) {
- // Only do this for initial set. Changing the today property after the initial
- // set, doesn't affect pagedate
- var val = args[0];
- if (Lang.isString(val)) {
- val = this._parseDate(val);
- }
- var today = DateMath.clearTime(val);
- if (!this.cfg.initialConfig[DEF_CFG.PAGEDATE.key]) {
- this.cfg.setProperty(DEF_CFG.PAGEDATE.key, today);
- }
- this.today = today;
- this.cfg.setProperty(DEF_CFG.TODAY.key, today, true);
- },
-
- /**
- * The default handler for the "selected" property
- * @method configSelected
- */
- configSelected : function(type, args, obj) {
- var selected = args[0],
- cfgSelected = DEF_CFG.SELECTED.key;
-
- if (selected) {
- if (Lang.isString(selected)) {
- this.cfg.setProperty(cfgSelected, this._parseDates(selected), true);
- }
- }
- if (! this._selectedDates) {
- this._selectedDates = this.cfg.getProperty(cfgSelected);
- }
- },
-
- /**
- * The default handler for all configuration options properties
- * @method configOptions
- */
- configOptions : function(type, args, obj) {
- this.Options[type.toUpperCase()] = args[0];
- },
-
- /**
- * The default handler for all configuration locale properties
- * @method configLocale
- */
- configLocale : function(type, args, obj) {
- this.Locale[type.toUpperCase()] = args[0];
-
- this.cfg.refireEvent(DEF_CFG.LOCALE_MONTHS.key);
- this.cfg.refireEvent(DEF_CFG.LOCALE_WEEKDAYS.key);
- },
-
- /**
- * The default handler for all configuration locale field length properties
- * @method configLocaleValues
- */
- configLocaleValues : function(type, args, obj) {
-
- type = type.toLowerCase();
-
- var val = args[0],
- cfg = this.cfg,
- Locale = this.Locale;
-
- switch (type) {
- case DEF_CFG.LOCALE_MONTHS.key:
- switch (val) {
- case Calendar.SHORT:
- Locale.LOCALE_MONTHS = cfg.getProperty(DEF_CFG.MONTHS_SHORT.key).concat();
- break;
- case Calendar.LONG:
- Locale.LOCALE_MONTHS = cfg.getProperty(DEF_CFG.MONTHS_LONG.key).concat();
- break;
- }
- break;
- case DEF_CFG.LOCALE_WEEKDAYS.key:
- switch (val) {
- case Calendar.ONE_CHAR:
- Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_1CHAR.key).concat();
- break;
- case Calendar.SHORT:
- Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_SHORT.key).concat();
- break;
- case Calendar.MEDIUM:
- Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_MEDIUM.key).concat();
- break;
- case Calendar.LONG:
- Locale.LOCALE_WEEKDAYS = cfg.getProperty(DEF_CFG.WEEKDAYS_LONG.key).concat();
- break;
- }
-
- var START_WEEKDAY = cfg.getProperty(DEF_CFG.START_WEEKDAY.key);
-
- if (START_WEEKDAY > 0) {
- for (var w=0; w < START_WEEKDAY; ++w) {
- Locale.LOCALE_WEEKDAYS.push(Locale.LOCALE_WEEKDAYS.shift());
- }
- }
- break;
- }
- },
-
- /**
- * The default handler for the "navigator" property
- * @method configNavigator
- */
- configNavigator : function(type, args, obj) {
- var val = args[0];
- if (YAHOO.widget.CalendarNavigator && (val === true || Lang.isObject(val))) {
- if (!this.oNavigator) {
- this.oNavigator = new YAHOO.widget.CalendarNavigator(this);
- // Cleanup DOM Refs/Events before innerHTML is removed.
- this.beforeRenderEvent.subscribe(function () {
- if (!this.pages) {
- this.oNavigator.erase();
- }
- }, this, true);
- }
- } else {
- if (this.oNavigator) {
- this.oNavigator.destroy();
- this.oNavigator = null;
- }
- }
- },
-
- /**
- * Defines the class names used by Calendar when rendering to DOM. NOTE: The class names are added to the DOM as HTML and should be escaped by the implementor if coming from an external source.
- * @method initStyles
- */
- initStyles : function() {
-
- var defStyle = Calendar.STYLES;
-
- this.Style = {
- /**
- * @property Style.CSS_ROW_HEADER
- */
- CSS_ROW_HEADER: defStyle.CSS_ROW_HEADER,
- /**
- * @property Style.CSS_ROW_FOOTER
- */
- CSS_ROW_FOOTER: defStyle.CSS_ROW_FOOTER,
- /**
- * @property Style.CSS_CELL
- */
- CSS_CELL : defStyle.CSS_CELL,
- /**
- * @property Style.CSS_CELL_SELECTOR
- */
- CSS_CELL_SELECTOR : defStyle.CSS_CELL_SELECTOR,
- /**
- * @property Style.CSS_CELL_SELECTED
- */
- CSS_CELL_SELECTED : defStyle.CSS_CELL_SELECTED,
- /**
- * @property Style.CSS_CELL_SELECTABLE
- */
- CSS_CELL_SELECTABLE : defStyle.CSS_CELL_SELECTABLE,
- /**
- * @property Style.CSS_CELL_RESTRICTED
- */
- CSS_CELL_RESTRICTED : defStyle.CSS_CELL_RESTRICTED,
- /**
- * @property Style.CSS_CELL_TODAY
- */
- CSS_CELL_TODAY : defStyle.CSS_CELL_TODAY,
- /**
- * @property Style.CSS_CELL_OOM
- */
- CSS_CELL_OOM : defStyle.CSS_CELL_OOM,
- /**
- * @property Style.CSS_CELL_OOB
- */
- CSS_CELL_OOB : defStyle.CSS_CELL_OOB,
- /**
- * @property Style.CSS_HEADER
- */
- CSS_HEADER : defStyle.CSS_HEADER,
- /**
- * @property Style.CSS_HEADER_TEXT
- */
- CSS_HEADER_TEXT : defStyle.CSS_HEADER_TEXT,
- /**
- * @property Style.CSS_BODY
- */
- CSS_BODY : defStyle.CSS_BODY,
- /**
- * @property Style.CSS_WEEKDAY_CELL
- */
- CSS_WEEKDAY_CELL : defStyle.CSS_WEEKDAY_CELL,
- /**
- * @property Style.CSS_WEEKDAY_ROW
- */
- CSS_WEEKDAY_ROW : defStyle.CSS_WEEKDAY_ROW,
- /**
- * @property Style.CSS_FOOTER
- */
- CSS_FOOTER : defStyle.CSS_FOOTER,
- /**
- * @property Style.CSS_CALENDAR
- */
- CSS_CALENDAR : defStyle.CSS_CALENDAR,
- /**
- * @property Style.CSS_SINGLE
- */
- CSS_SINGLE : defStyle.CSS_SINGLE,
- /**
- * @property Style.CSS_CONTAINER
- */
- CSS_CONTAINER : defStyle.CSS_CONTAINER,
- /**
- * @property Style.CSS_NAV_LEFT
- */
- CSS_NAV_LEFT : defStyle.CSS_NAV_LEFT,
- /**
- * @property Style.CSS_NAV_RIGHT
- */
- CSS_NAV_RIGHT : defStyle.CSS_NAV_RIGHT,
- /**
- * @property Style.CSS_NAV
- */
- CSS_NAV : defStyle.CSS_NAV,
- /**
- * @property Style.CSS_CLOSE
- */
- CSS_CLOSE : defStyle.CSS_CLOSE,
- /**
- * @property Style.CSS_CELL_TOP
- */
- CSS_CELL_TOP : defStyle.CSS_CELL_TOP,
- /**
- * @property Style.CSS_CELL_LEFT
- */
- CSS_CELL_LEFT : defStyle.CSS_CELL_LEFT,
- /**
- * @property Style.CSS_CELL_RIGHT
- */
- CSS_CELL_RIGHT : defStyle.CSS_CELL_RIGHT,
- /**
- * @property Style.CSS_CELL_BOTTOM
- */
- CSS_CELL_BOTTOM : defStyle.CSS_CELL_BOTTOM,
- /**
- * @property Style.CSS_CELL_HOVER
- */
- CSS_CELL_HOVER : defStyle.CSS_CELL_HOVER,
- /**
- * @property Style.CSS_CELL_HIGHLIGHT1
- */
- CSS_CELL_HIGHLIGHT1 : defStyle.CSS_CELL_HIGHLIGHT1,
- /**
- * @property Style.CSS_CELL_HIGHLIGHT2
- */
- CSS_CELL_HIGHLIGHT2 : defStyle.CSS_CELL_HIGHLIGHT2,
- /**
- * @property Style.CSS_CELL_HIGHLIGHT3
- */
- CSS_CELL_HIGHLIGHT3 : defStyle.CSS_CELL_HIGHLIGHT3,
- /**
- * @property Style.CSS_CELL_HIGHLIGHT4
- */
- CSS_CELL_HIGHLIGHT4 : defStyle.CSS_CELL_HIGHLIGHT4,
- /**
- * @property Style.CSS_WITH_TITLE
- */
- CSS_WITH_TITLE : defStyle.CSS_WITH_TITLE,
- /**
- * @property Style.CSS_FIXED_SIZE
- */
- CSS_FIXED_SIZE : defStyle.CSS_FIXED_SIZE,
- /**
- * @property Style.CSS_LINK_CLOSE
- */
- CSS_LINK_CLOSE : defStyle.CSS_LINK_CLOSE
- };
- },
-
- /**
- * Builds the date label that will be displayed in the calendar header or
- * footer, depending on configuration.
- * @method buildMonthLabel
- * @return {HTML} The formatted calendar month label
- */
- buildMonthLabel : function() {
- return this._buildMonthLabel(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));
- },
-
- /**
- * Helper method, to format a Month Year string, given a JavaScript Date, based on the
- * Calendar localization settings
- *
- * @method _buildMonthLabel
- * @private
- * @param {Date} date
- * @return {HTML} Formated month, year string
- */
- _buildMonthLabel : function(date) {
- var monthLabel = this.Locale.LOCALE_MONTHS[date.getMonth()] + this.Locale.MY_LABEL_MONTH_SUFFIX,
- yearLabel = (date.getFullYear() + this.Locale.YEAR_OFFSET) + this.Locale.MY_LABEL_YEAR_SUFFIX;
-
- if (this.Locale.MY_LABEL_MONTH_POSITION == 2 || this.Locale.MY_LABEL_YEAR_POSITION == 1) {
- return yearLabel + monthLabel;
- } else {
- return monthLabel + yearLabel;
- }
- },
-
- /**
- * Builds the date digit that will be displayed in calendar cells
- * @method buildDayLabel
- * @param {Date} workingDate The current working date
- * @return {Number} The day
- */
- buildDayLabel : function(workingDate) {
- return workingDate.getDate();
- },
-
- /**
- * Creates the title bar element and adds it to Calendar container DIV. NOTE: The title parameter passed into this method is added to the DOM as HTML and should be escaped by the implementor if coming from an external source.
- *
- * @method createTitleBar
- * @param {HTML} strTitle The title to display in the title bar
- * @return The title bar element
- */
- createTitleBar : function(strTitle) {
- var tDiv = Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || document.createElement("div");
- tDiv.className = YAHOO.widget.CalendarGroup.CSS_2UPTITLE;
- tDiv.innerHTML = strTitle;
- this.oDomContainer.insertBefore(tDiv, this.oDomContainer.firstChild);
-
- Dom.addClass(this.oDomContainer, this.Style.CSS_WITH_TITLE);
-
- return tDiv;
- },
-
- /**
- * Removes the title bar element from the DOM
- *
- * @method removeTitleBar
- */
- removeTitleBar : function() {
- var tDiv = Dom.getElementsByClassName(YAHOO.widget.CalendarGroup.CSS_2UPTITLE, "div", this.oDomContainer)[0] || null;
- if (tDiv) {
- Event.purgeElement(tDiv);
- this.oDomContainer.removeChild(tDiv);
- }
- Dom.removeClass(this.oDomContainer, this.Style.CSS_WITH_TITLE);
- },
-
- /**
- * Creates the close button HTML element and adds it to Calendar container DIV
- *
- * @method createCloseButton
- * @return {HTMLElement} The close HTML element created
- */
- createCloseButton : function() {
- var cssClose = YAHOO.widget.CalendarGroup.CSS_2UPCLOSE,
- cssLinkClose = this.Style.CSS_LINK_CLOSE,
- DEPR_CLOSE_PATH = "us/my/bn/x_d.gif",
-
- lnk = Dom.getElementsByClassName(cssLinkClose, "a", this.oDomContainer)[0],
- strings = this.cfg.getProperty(DEF_CFG.STRINGS.key),
- closeStr = (strings && strings.close) ? strings.close : "";
-
- if (!lnk) {
- lnk = document.createElement("a");
- Event.addListener(lnk, "click", function(e, cal) {
- cal.hide();
- Event.preventDefault(e);
- }, this);
- }
-
- lnk.href = "#";
- lnk.className = cssLinkClose;
-
- if (Calendar.IMG_ROOT !== null) {
- var img = Dom.getElementsByClassName(cssClose, "img", lnk)[0] || document.createElement("img");
- img.src = Calendar.IMG_ROOT + DEPR_CLOSE_PATH;
- img.className = cssClose;
- lnk.appendChild(img);
- } else {
- lnk.innerHTML = '' + closeStr + '';
- }
- this.oDomContainer.appendChild(lnk);
-
- return lnk;
- },
-
- /**
- * Removes the close button HTML element from the DOM
- *
- * @method removeCloseButton
- */
- removeCloseButton : function() {
- var btn = Dom.getElementsByClassName(this.Style.CSS_LINK_CLOSE, "a", this.oDomContainer)[0] || null;
- if (btn) {
- Event.purgeElement(btn);
- this.oDomContainer.removeChild(btn);
- }
- },
-
- /**
- * Renders the calendar header. NOTE: The contents of the array passed into this method are added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @method renderHeader
- * @param {HTML[]} html The current working HTML array
- * @return {HTML[]} The current working HTML array
- */
- renderHeader : function(html) {
-
-
- var colSpan = 7,
- DEPR_NAV_LEFT = "us/tr/callt.gif",
- DEPR_NAV_RIGHT = "us/tr/calrt.gif",
- cfg = this.cfg,
- pageDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),
- strings= cfg.getProperty(DEF_CFG.STRINGS.key),
- prevStr = (strings && strings.previousMonth) ? strings.previousMonth : "",
- nextStr = (strings && strings.nextMonth) ? strings.nextMonth : "",
- monthLabel;
-
- if (cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)) {
- colSpan += 1;
- }
-
- if (cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key)) {
- colSpan += 1;
- }
-
- html[html.length] = "";
- html[html.length] = "
";
- html[html.length] = '
';
- html[html.length] = '
';
-
- var renderLeft, renderRight = false;
-
- if (this.parent) {
- if (this.index === 0) {
- renderLeft = true;
- }
- if (this.index == (this.parent.cfg.getProperty("pages") -1)) {
- renderRight = true;
- }
- } else {
- renderLeft = true;
- renderRight = true;
- }
-
- if (renderLeft) {
- monthLabel = this._buildMonthLabel(DateMath.subtract(pageDate, DateMath.MONTH, 1));
-
- var leftArrow = cfg.getProperty(DEF_CFG.NAV_ARROW_LEFT.key);
- // Check for deprecated customization - If someone set IMG_ROOT, but didn't set NAV_ARROW_LEFT, then set NAV_ARROW_LEFT to the old deprecated value
- if (leftArrow === null && Calendar.IMG_ROOT !== null) {
- leftArrow = Calendar.IMG_ROOT + DEPR_NAV_LEFT;
- }
- var leftStyle = (leftArrow === null) ? "" : ' style="background-image:url(' + leftArrow + ')"';
- html[html.length] = '' + prevStr + ' (' + monthLabel + ')' + '';
- }
-
- var lbl = this.buildMonthLabel();
- var cal = this.parent || this;
- if (cal.cfg.getProperty("navigator")) {
- lbl = "" + lbl + "";
- }
- html[html.length] = lbl;
-
- if (renderRight) {
- monthLabel = this._buildMonthLabel(DateMath.add(pageDate, DateMath.MONTH, 1));
-
- var rightArrow = cfg.getProperty(DEF_CFG.NAV_ARROW_RIGHT.key);
- if (rightArrow === null && Calendar.IMG_ROOT !== null) {
- rightArrow = Calendar.IMG_ROOT + DEPR_NAV_RIGHT;
- }
- var rightStyle = (rightArrow === null) ? "" : ' style="background-image:url(' + rightArrow + ')"';
- html[html.length] = '' + nextStr + ' (' + monthLabel + ')' + '';
- }
-
- html[html.length] = '
\n
\n
';
-
- if (cfg.getProperty(DEF_CFG.SHOW_WEEKDAYS.key)) {
- html = this.buildWeekdays(html);
- }
-
- html[html.length] = '';
-
- return html;
- },
-
- /**
- * Renders the Calendar's weekday headers. NOTE: The contents of the array passed into this method are added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @method buildWeekdays
- * @param {HTML[]} html The current working HTML array
- * @return {HTML[]} The current working HTML array
- */
- buildWeekdays : function(html) {
-
- html[html.length] = '
';
-
- if (this.cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key)) {
- html[html.length] = '
';
-
- return html;
- },
-
- /**
- * Renders the calendar body. NOTE: The contents of the array passed into this method are added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @method renderBody
- * @param {Date} workingDate The current working Date being used for the render process
- * @param {HTML[]} html The current working HTML array
- * @return {HTML[]} The current working HTML array
- */
- renderBody : function(workingDate, html) {
-
- var startDay = this.cfg.getProperty(DEF_CFG.START_WEEKDAY.key);
-
- this.preMonthDays = workingDate.getDay();
- if (startDay > 0) {
- this.preMonthDays -= startDay;
- }
- if (this.preMonthDays < 0) {
- this.preMonthDays += 7;
- }
-
- this.monthDays = DateMath.findMonthEnd(workingDate).getDate();
- this.postMonthDays = Calendar.DISPLAY_DAYS-this.preMonthDays-this.monthDays;
-
-
- workingDate = DateMath.subtract(workingDate, DateMath.DAY, this.preMonthDays);
-
- var weekNum,
- weekClass,
- weekPrefix = "w",
- cellPrefix = "_cell",
- workingDayPrefix = "wd",
- dayPrefix = "d",
- cellRenderers,
- renderer,
- t = this.today,
- cfg = this.cfg,
- oom,
- todayYear = t.getFullYear(),
- todayMonth = t.getMonth(),
- todayDate = t.getDate(),
- useDate = cfg.getProperty(DEF_CFG.PAGEDATE.key),
- hideBlankWeeks = cfg.getProperty(DEF_CFG.HIDE_BLANK_WEEKS.key),
- showWeekFooter = cfg.getProperty(DEF_CFG.SHOW_WEEK_FOOTER.key),
- showWeekHeader = cfg.getProperty(DEF_CFG.SHOW_WEEK_HEADER.key),
- oomSelect = cfg.getProperty(DEF_CFG.OOM_SELECT.key),
- mindate = cfg.getProperty(DEF_CFG.MINDATE.key),
- maxdate = cfg.getProperty(DEF_CFG.MAXDATE.key),
- yearOffset = this.Locale.YEAR_OFFSET;
-
- if (mindate) {
- mindate = DateMath.clearTime(mindate);
- }
- if (maxdate) {
- maxdate = DateMath.clearTime(maxdate);
- }
-
- html[html.length] = '';
-
- var i = 0,
- tempDiv = document.createElement("div"),
- cell = document.createElement("td");
-
- tempDiv.appendChild(cell);
-
- var cal = this.parent || this;
-
- for (var r = 0; r < 6; r++) {
- weekNum = DateMath.getWeekNumber(workingDate, startDay);
- weekClass = weekPrefix + weekNum;
-
- // Local OOM check for performance, since we already have pagedate
- if (r !== 0 && hideBlankWeeks === true && workingDate.getMonth() != useDate.getMonth()) {
- break;
- } else {
- html[html.length] = '
';
-
- if (showWeekHeader) { html = this.renderRowHeader(weekNum, html); }
-
- for (var d=0; d < 7; d++){ // Render actual days
-
- cellRenderers = [];
-
- this.clearElement(cell);
- cell.className = this.Style.CSS_CELL;
- cell.id = this.id + cellPrefix + i;
-
- if (workingDate.getDate() == todayDate &&
- workingDate.getMonth() == todayMonth &&
- workingDate.getFullYear() == todayYear) {
- cellRenderers[cellRenderers.length]=cal.renderCellStyleToday;
- }
-
- var workingArray = [workingDate.getFullYear(),workingDate.getMonth()+1,workingDate.getDate()];
- this.cellDates[this.cellDates.length] = workingArray; // Add this date to cellDates
-
- // Local OOM check for performance, since we already have pagedate
- oom = workingDate.getMonth() != useDate.getMonth();
- if (oom && !oomSelect) {
- cellRenderers[cellRenderers.length]=cal.renderCellNotThisMonth;
- } else {
- Dom.addClass(cell, workingDayPrefix + workingDate.getDay());
- Dom.addClass(cell, dayPrefix + workingDate.getDate());
-
- // Concat, so that we're not splicing from an array
- // which we're also iterating
- var rs = this.renderStack.concat();
-
- for (var s=0, l = rs.length; s < l; ++s) {
-
- renderer = null;
-
- var rArray = rs[s],
- type = rArray[0],
- month,
- day,
- year;
-
- switch (type) {
- case Calendar.DATE:
- month = rArray[1][1];
- day = rArray[1][2];
- year = rArray[1][0];
-
- if (workingDate.getMonth()+1 == month && workingDate.getDate() == day && workingDate.getFullYear() == year) {
- renderer = rArray[2];
- this.renderStack.splice(s,1);
- }
-
- break;
- case Calendar.MONTH_DAY:
- month = rArray[1][0];
- day = rArray[1][1];
-
- if (workingDate.getMonth()+1 == month && workingDate.getDate() == day) {
- renderer = rArray[2];
- this.renderStack.splice(s,1);
- }
- break;
- case Calendar.RANGE:
- var date1 = rArray[1][0],
- date2 = rArray[1][1],
- d1month = date1[1],
- d1day = date1[2],
- d1year = date1[0],
- d1 = DateMath.getDate(d1year, d1month-1, d1day),
- d2month = date2[1],
- d2day = date2[2],
- d2year = date2[0],
- d2 = DateMath.getDate(d2year, d2month-1, d2day);
-
- if (workingDate.getTime() >= d1.getTime() && workingDate.getTime() <= d2.getTime()) {
- renderer = rArray[2];
-
- if (workingDate.getTime()==d2.getTime()) {
- this.renderStack.splice(s,1);
- }
- }
- break;
- case Calendar.WEEKDAY:
- var weekday = rArray[1][0];
- if (workingDate.getDay()+1 == weekday) {
- renderer = rArray[2];
- }
- break;
- case Calendar.MONTH:
- month = rArray[1][0];
- if (workingDate.getMonth()+1 == month) {
- renderer = rArray[2];
- }
- break;
- }
-
- if (renderer) {
- cellRenderers[cellRenderers.length]=renderer;
- }
- }
-
- }
-
- if (this._indexOfSelectedFieldArray(workingArray) > -1) {
- cellRenderers[cellRenderers.length]=cal.renderCellStyleSelected;
- }
-
- if (oom) {
- cellRenderers[cellRenderers.length] = cal.styleCellNotThisMonth;
- }
-
- if ((mindate && (workingDate.getTime() < mindate.getTime())) || (maxdate && (workingDate.getTime() > maxdate.getTime()))) {
- cellRenderers[cellRenderers.length] = cal.renderOutOfBoundsDate;
- } else {
- cellRenderers[cellRenderers.length] = cal.styleCellDefault;
- cellRenderers[cellRenderers.length] = cal.renderCellDefault;
- }
-
- for (var x=0; x < cellRenderers.length; ++x) {
- if (cellRenderers[x].call(cal, workingDate, cell) == Calendar.STOP_RENDER) {
- break;
- }
- }
-
- workingDate.setTime(workingDate.getTime() + DateMath.ONE_DAY_MS);
- // Just in case we crossed DST/Summertime boundaries
- workingDate = DateMath.clearTime(workingDate);
-
- if (i >= 0 && i <= 6) {
- Dom.addClass(cell, this.Style.CSS_CELL_TOP);
- }
- if ((i % 7) === 0) {
- Dom.addClass(cell, this.Style.CSS_CELL_LEFT);
- }
- if (((i+1) % 7) === 0) {
- Dom.addClass(cell, this.Style.CSS_CELL_RIGHT);
- }
-
- var postDays = this.postMonthDays;
- if (hideBlankWeeks && postDays >= 7) {
- var blankWeeks = Math.floor(postDays/7);
- for (var p=0;p= ((this.preMonthDays+postDays+this.monthDays)-7)) {
- Dom.addClass(cell, this.Style.CSS_CELL_BOTTOM);
- }
-
- html[html.length] = tempDiv.innerHTML;
- i++;
- }
-
- if (showWeekFooter) { html = this.renderRowFooter(weekNum, html); }
-
- html[html.length] = '
';
- }
- }
-
- html[html.length] = '';
-
- return html;
- },
-
- /**
- * Renders the calendar footer. In the default implementation, there is no footer. NOTE: The contents of the array passed into this method are added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @method renderFooter
- * @param {HTML[]} html The current working HTML array
- * @return {HTML[]} The current working HTML array
- */
- renderFooter : function(html) { return html; },
-
- /**
- * Renders the calendar after it has been configured. The render() method has a specific call chain that will execute
- * when the method is called: renderHeader, renderBody, renderFooter.
- * Refer to the documentation for those methods for information on individual render tasks.
- * @method render
- */
- render : function() {
- this.beforeRenderEvent.fire();
-
- // Find starting day of the current month
- var workingDate = DateMath.findMonthStart(this.cfg.getProperty(DEF_CFG.PAGEDATE.key));
-
- this.resetRenderers();
- this.cellDates.length = 0;
-
- Event.purgeElement(this.oDomContainer, true);
-
- var html = [],
- table;
-
- html[html.length] = '
';
- html = this.renderHeader(html);
- html = this.renderBody(workingDate, html);
- html = this.renderFooter(html);
- html[html.length] = '
';
-
- this.oDomContainer.innerHTML = html.join("\n");
-
- this.applyListeners();
-
- // Using oDomContainer.ownerDocument, to allow for cross-frame rendering
- table = ((this._oDoc) && this._oDoc.getElementById(this.id)) || (this.id);
-
- this.cells = Dom.getElementsByClassName(this.Style.CSS_CELL, "td", table);
-
- this.cfg.refireEvent(DEF_CFG.TITLE.key);
- this.cfg.refireEvent(DEF_CFG.CLOSE.key);
- this.cfg.refireEvent(DEF_CFG.IFRAME.key);
-
- this.renderEvent.fire();
- },
-
- /**
- * Applies the Calendar's DOM listeners to applicable elements.
- * @method applyListeners
- */
- applyListeners : function() {
- var root = this.oDomContainer,
- cal = this.parent || this,
- anchor = "a",
- click = "click";
-
- var linkLeft = Dom.getElementsByClassName(this.Style.CSS_NAV_LEFT, anchor, root),
- linkRight = Dom.getElementsByClassName(this.Style.CSS_NAV_RIGHT, anchor, root);
-
- if (linkLeft && linkLeft.length > 0) {
- this.linkLeft = linkLeft[0];
- Event.addListener(this.linkLeft, click, this.doPreviousMonthNav, cal, true);
- }
-
- if (linkRight && linkRight.length > 0) {
- this.linkRight = linkRight[0];
- Event.addListener(this.linkRight, click, this.doNextMonthNav, cal, true);
- }
-
- if (cal.cfg.getProperty("navigator") !== null) {
- this.applyNavListeners();
- }
-
- if (this.domEventMap) {
- var el,elements;
- for (var cls in this.domEventMap) {
- if (Lang.hasOwnProperty(this.domEventMap, cls)) {
- var items = this.domEventMap[cls];
-
- if (! (items instanceof Array)) {
- items = [items];
- }
-
- for (var i=0;i 0) {
-
- Event.addListener(navBtns, "click", function (e, obj) {
- var target = Event.getTarget(e);
- // this == navBtn
- if (this === target || Dom.isAncestor(this, target)) {
- Event.preventDefault(e);
- }
- var navigator = calParent.oNavigator;
- if (navigator) {
- var pgdate = cal.cfg.getProperty("pagedate");
- navigator.setYear(pgdate.getFullYear() + cal.Locale.YEAR_OFFSET);
- navigator.setMonth(pgdate.getMonth());
- navigator.show();
- }
- });
- }
- },
-
- /**
- * Retrieves the Date object for the specified Calendar cell
- * @method getDateByCellId
- * @param {String} id The id of the cell
- * @return {Date} The Date object for the specified Calendar cell
- */
- getDateByCellId : function(id) {
- var date = this.getDateFieldsByCellId(id);
- return (date) ? DateMath.getDate(date[0],date[1]-1,date[2]) : null;
- },
-
- /**
- * Retrieves the Date object for the specified Calendar cell
- * @method getDateFieldsByCellId
- * @param {String} id The id of the cell
- * @return {Array} The array of Date fields for the specified Calendar cell
- */
- getDateFieldsByCellId : function(id) {
- id = this.getIndexFromId(id);
- return (id > -1) ? this.cellDates[id] : null;
- },
-
- /**
- * Find the Calendar's cell index for a given date.
- * If the date is not found, the method returns -1.
- *
- * The returned index can be used to lookup the cell HTMLElement
- * using the Calendar's cells array or passed to selectCell to select
- * cells by index.
- *
- *
- * See cells, selectCell.
- *
- * @method getCellIndex
- * @param {Date} date JavaScript Date object, for which to find a cell index.
- * @return {Number} The index of the date in Calendars cellDates/cells arrays, or -1 if the date
- * is not on the curently rendered Calendar page.
- */
- getCellIndex : function(date) {
- var idx = -1;
- if (date) {
- var m = date.getMonth(),
- y = date.getFullYear(),
- d = date.getDate(),
- dates = this.cellDates;
-
- for (var i = 0; i < dates.length; ++i) {
- var cellDate = dates[i];
- if (cellDate[0] === y && cellDate[1] === m+1 && cellDate[2] === d) {
- idx = i;
- break;
- }
- }
- }
- return idx;
- },
-
- /**
- * Given the id used to mark each Calendar cell, this method
- * extracts the index number from the id.
- *
- * @param {String} strId The cell id
- * @return {Number} The index of the cell, or -1 if id does not contain an index number
- */
- getIndexFromId : function(strId) {
- var idx = -1,
- li = strId.lastIndexOf("_cell");
-
- if (li > -1) {
- idx = parseInt(strId.substring(li + 5), 10);
- }
-
- return idx;
- },
-
- // BEGIN BUILT-IN TABLE CELL RENDERERS
-
- /**
- * Renders a cell that falls before the minimum date or after the maximum date.
- * @method renderOutOfBoundsDate
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- * @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
- * should not be terminated
- */
- renderOutOfBoundsDate : function(workingDate, cell) {
- Dom.addClass(cell, this.Style.CSS_CELL_OOB);
- cell.innerHTML = workingDate.getDate();
- return Calendar.STOP_RENDER;
- },
-
- /**
- * Renders the row header HTML for a week.
- *
- * @method renderRowHeader
- * @param {Number} weekNum The week number of the current row
- * @param {HTML[]} cell The current working HTML array
- */
- renderRowHeader : function(weekNum, html) {
- html[html.length] = '
' + weekNum + '
';
- return html;
- },
-
- /**
- * Renders the row footer HTML for a week.
- *
- * @method renderRowFooter
- * @param {Number} weekNum The week number of the current row
- * @param {HTML[]} cell The current working HTML array
- */
- renderRowFooter : function(weekNum, html) {
- html[html.length] = '
' + weekNum + '
';
- return html;
- },
-
- /**
- * Renders a single standard calendar cell in the calendar widget table.
- *
- * All logic for determining how a standard default cell will be rendered is
- * encapsulated in this method, and must be accounted for when extending the
- * widget class.
- *
- * @method renderCellDefault
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- */
- renderCellDefault : function(workingDate, cell) {
- cell.innerHTML = '' + this.buildDayLabel(workingDate) + "";
- },
-
- /**
- * Styles a selectable cell.
- * @method styleCellDefault
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- */
- styleCellDefault : function(workingDate, cell) {
- Dom.addClass(cell, this.Style.CSS_CELL_SELECTABLE);
- },
-
-
- /**
- * Renders a single standard calendar cell using the CSS hightlight1 style
- * @method renderCellStyleHighlight1
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- */
- renderCellStyleHighlight1 : function(workingDate, cell) {
- Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT1);
- },
-
- /**
- * Renders a single standard calendar cell using the CSS hightlight2 style
- * @method renderCellStyleHighlight2
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- */
- renderCellStyleHighlight2 : function(workingDate, cell) {
- Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT2);
- },
-
- /**
- * Renders a single standard calendar cell using the CSS hightlight3 style
- * @method renderCellStyleHighlight3
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- */
- renderCellStyleHighlight3 : function(workingDate, cell) {
- Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT3);
- },
-
- /**
- * Renders a single standard calendar cell using the CSS hightlight4 style
- * @method renderCellStyleHighlight4
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- */
- renderCellStyleHighlight4 : function(workingDate, cell) {
- Dom.addClass(cell, this.Style.CSS_CELL_HIGHLIGHT4);
- },
-
- /**
- * Applies the default style used for rendering today's date to the current calendar cell
- * @method renderCellStyleToday
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- */
- renderCellStyleToday : function(workingDate, cell) {
- Dom.addClass(cell, this.Style.CSS_CELL_TODAY);
- },
-
- /**
- * Applies the default style used for rendering selected dates to the current calendar cell
- * @method renderCellStyleSelected
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- * @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
- * should not be terminated
- */
- renderCellStyleSelected : function(workingDate, cell) {
- Dom.addClass(cell, this.Style.CSS_CELL_SELECTED);
- },
-
- /**
- * Applies the default style used for rendering dates that are not a part of the current
- * month (preceding or trailing the cells for the current month)
- *
- * @method renderCellNotThisMonth
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- * @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
- * should not be terminated
- */
- renderCellNotThisMonth : function(workingDate, cell) {
- this.styleCellNotThisMonth(workingDate, cell);
- cell.innerHTML=workingDate.getDate();
- return Calendar.STOP_RENDER;
- },
-
- /** Applies the style used for rendering out-of-month dates to the current calendar cell
- * @method styleCellNotThisMonth
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- */
- styleCellNotThisMonth : function(workingDate, cell) {
- YAHOO.util.Dom.addClass(cell, this.Style.CSS_CELL_OOM);
- },
-
- /**
- * Renders the current calendar cell as a non-selectable "black-out" date using the default
- * restricted style.
- * @method renderBodyCellRestricted
- * @param {Date} workingDate The current working Date object being used to generate the calendar
- * @param {HTMLTableCellElement} cell The current working cell in the calendar
- * @return {String} YAHOO.widget.Calendar.STOP_RENDER if rendering should stop with this style, null or nothing if rendering
- * should not be terminated
- */
- renderBodyCellRestricted : function(workingDate, cell) {
- Dom.addClass(cell, this.Style.CSS_CELL);
- Dom.addClass(cell, this.Style.CSS_CELL_RESTRICTED);
- cell.innerHTML=workingDate.getDate();
- return Calendar.STOP_RENDER;
- },
-
- // END BUILT-IN TABLE CELL RENDERERS
-
- // BEGIN MONTH NAVIGATION METHODS
-
- /**
- * Adds the designated number of months to the current calendar month, and sets the current
- * calendar page date to the new month.
- * @method addMonths
- * @param {Number} count The number of months to add to the current calendar
- */
- addMonths : function(count) {
- var cfgPageDate = DEF_CFG.PAGEDATE.key,
-
- prevDate = this.cfg.getProperty(cfgPageDate),
- newDate = DateMath.add(prevDate, DateMath.MONTH, count);
-
- this.cfg.setProperty(cfgPageDate, newDate);
- this.resetRenderers();
- this.changePageEvent.fire(prevDate, newDate);
- },
-
- /**
- * Subtracts the designated number of months from the current calendar month, and sets the current
- * calendar page date to the new month.
- * @method subtractMonths
- * @param {Number} count The number of months to subtract from the current calendar
- */
- subtractMonths : function(count) {
- this.addMonths(-1*count);
- },
-
- /**
- * Adds the designated number of years to the current calendar, and sets the current
- * calendar page date to the new month.
- * @method addYears
- * @param {Number} count The number of years to add to the current calendar
- */
- addYears : function(count) {
- var cfgPageDate = DEF_CFG.PAGEDATE.key,
-
- prevDate = this.cfg.getProperty(cfgPageDate),
- newDate = DateMath.add(prevDate, DateMath.YEAR, count);
-
- this.cfg.setProperty(cfgPageDate, newDate);
- this.resetRenderers();
- this.changePageEvent.fire(prevDate, newDate);
- },
-
- /**
- * Subtcats the designated number of years from the current calendar, and sets the current
- * calendar page date to the new month.
- * @method subtractYears
- * @param {Number} count The number of years to subtract from the current calendar
- */
- subtractYears : function(count) {
- this.addYears(-1*count);
- },
-
- /**
- * Navigates to the next month page in the calendar widget.
- * @method nextMonth
- */
- nextMonth : function() {
- this.addMonths(1);
- },
-
- /**
- * Navigates to the previous month page in the calendar widget.
- * @method previousMonth
- */
- previousMonth : function() {
- this.addMonths(-1);
- },
-
- /**
- * Navigates to the next year in the currently selected month in the calendar widget.
- * @method nextYear
- */
- nextYear : function() {
- this.addYears(1);
- },
-
- /**
- * Navigates to the previous year in the currently selected month in the calendar widget.
- * @method previousYear
- */
- previousYear : function() {
- this.addYears(-1);
- },
-
- // END MONTH NAVIGATION METHODS
-
- // BEGIN SELECTION METHODS
-
- /**
- * Resets the calendar widget to the originally selected month and year, and
- * sets the calendar to the initial selection(s).
- * @method reset
- */
- reset : function() {
- this.cfg.resetProperty(DEF_CFG.SELECTED.key);
- this.cfg.resetProperty(DEF_CFG.PAGEDATE.key);
- this.resetEvent.fire();
- },
-
- /**
- * Clears the selected dates in the current calendar widget and sets the calendar
- * to the current month and year.
- * @method clear
- */
- clear : function() {
- this.cfg.setProperty(DEF_CFG.SELECTED.key, []);
- this.cfg.setProperty(DEF_CFG.PAGEDATE.key, new Date(this.today.getTime()));
- this.clearEvent.fire();
- },
-
- /**
- * Selects a date or a collection of dates on the current calendar. This method, by default,
- * does not call the render method explicitly. Once selection has completed, render must be
- * called for the changes to be reflected visually.
- *
- * Any dates which are OOB (out of bounds, not selectable) will not be selected and the array of
- * selected dates passed to the selectEvent will not contain OOB dates.
- *
- * If all dates are OOB, the no state change will occur; beforeSelect and select events will not be fired.
- *
- * @method select
- * @param {String/Date/Date[]} date The date string of dates to select in the current calendar. Valid formats are
- * individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
- * Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
- * This method can also take a JavaScript Date object or an array of Date objects.
- * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
- */
- select : function(date) {
-
- var aToBeSelected = this._toFieldArray(date),
- validDates = [],
- selected = [],
- cfgSelected = DEF_CFG.SELECTED.key;
-
-
- for (var a=0; a < aToBeSelected.length; ++a) {
- var toSelect = aToBeSelected[a];
-
- if (!this.isDateOOB(this._toDate(toSelect))) {
-
- if (validDates.length === 0) {
- this.beforeSelectEvent.fire();
- selected = this.cfg.getProperty(cfgSelected);
- }
- validDates.push(toSelect);
-
- if (this._indexOfSelectedFieldArray(toSelect) == -1) {
- selected[selected.length] = toSelect;
- }
- }
- }
-
-
- if (validDates.length > 0) {
- if (this.parent) {
- this.parent.cfg.setProperty(cfgSelected, selected);
- } else {
- this.cfg.setProperty(cfgSelected, selected);
- }
- this.selectEvent.fire(validDates);
- }
-
- return this.getSelectedDates();
- },
-
- /**
- * Selects a date on the current calendar by referencing the index of the cell that should be selected.
- * This method is used to easily select a single cell (usually with a mouse click) without having to do
- * a full render. The selected style is applied to the cell directly.
- *
- * If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month
- * or out of bounds cells), it will not be selected and in such a case beforeSelect and select events will not be fired.
- *
- * @method selectCell
- * @param {Number} cellIndex The index of the cell to select in the current calendar.
- * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
- */
- selectCell : function(cellIndex) {
-
- var cell = this.cells[cellIndex],
- cellDate = this.cellDates[cellIndex],
- dCellDate = this._toDate(cellDate),
- selectable = Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
-
-
- if (selectable) {
-
- this.beforeSelectEvent.fire();
-
- var cfgSelected = DEF_CFG.SELECTED.key;
- var selected = this.cfg.getProperty(cfgSelected);
-
- var selectDate = cellDate.concat();
-
- if (this._indexOfSelectedFieldArray(selectDate) == -1) {
- selected[selected.length] = selectDate;
- }
- if (this.parent) {
- this.parent.cfg.setProperty(cfgSelected, selected);
- } else {
- this.cfg.setProperty(cfgSelected, selected);
- }
- this.renderCellStyleSelected(dCellDate,cell);
- this.selectEvent.fire([selectDate]);
-
- this.doCellMouseOut.call(cell, null, this);
- }
-
- return this.getSelectedDates();
- },
-
- /**
- * Deselects a date or a collection of dates on the current calendar. This method, by default,
- * does not call the render method explicitly. Once deselection has completed, render must be
- * called for the changes to be reflected visually.
- *
- * The method will not attempt to deselect any dates which are OOB (out of bounds, and hence not selectable)
- * and the array of deselected dates passed to the deselectEvent will not contain any OOB dates.
- *
- * If all dates are OOB, beforeDeselect and deselect events will not be fired.
- *
- * @method deselect
- * @param {String/Date/Date[]} date The date string of dates to deselect in the current calendar. Valid formats are
- * individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
- * Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
- * This method can also take a JavaScript Date object or an array of Date objects.
- * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
- */
- deselect : function(date) {
-
- var aToBeDeselected = this._toFieldArray(date),
- validDates = [],
- selected = [],
- cfgSelected = DEF_CFG.SELECTED.key;
-
-
- for (var a=0; a < aToBeDeselected.length; ++a) {
- var toDeselect = aToBeDeselected[a];
-
- if (!this.isDateOOB(this._toDate(toDeselect))) {
-
- if (validDates.length === 0) {
- this.beforeDeselectEvent.fire();
- selected = this.cfg.getProperty(cfgSelected);
- }
-
- validDates.push(toDeselect);
-
- var index = this._indexOfSelectedFieldArray(toDeselect);
- if (index != -1) {
- selected.splice(index,1);
- }
- }
- }
-
-
- if (validDates.length > 0) {
- if (this.parent) {
- this.parent.cfg.setProperty(cfgSelected, selected);
- } else {
- this.cfg.setProperty(cfgSelected, selected);
- }
- this.deselectEvent.fire(validDates);
- }
-
- return this.getSelectedDates();
- },
-
- /**
- * Deselects a date on the current calendar by referencing the index of the cell that should be deselected.
- * This method is used to easily deselect a single cell (usually with a mouse click) without having to do
- * a full render. The selected style is removed from the cell directly.
- *
- * If the cell is not marked with the CSS_CELL_SELECTABLE class (as is the case by default for out of month
- * or out of bounds cells), the method will not attempt to deselect it and in such a case, beforeDeselect and
- * deselect events will not be fired.
- *
- * @method deselectCell
- * @param {Number} cellIndex The index of the cell to deselect in the current calendar.
- * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
- */
- deselectCell : function(cellIndex) {
- var cell = this.cells[cellIndex],
- cellDate = this.cellDates[cellIndex],
- cellDateIndex = this._indexOfSelectedFieldArray(cellDate);
-
- var selectable = Dom.hasClass(cell, this.Style.CSS_CELL_SELECTABLE);
-
- if (selectable) {
-
- this.beforeDeselectEvent.fire();
-
- var selected = this.cfg.getProperty(DEF_CFG.SELECTED.key),
- dCellDate = this._toDate(cellDate),
- selectDate = cellDate.concat();
-
- if (cellDateIndex > -1) {
- if ((this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getMonth() == dCellDate.getMonth() &&
- this.cfg.getProperty(DEF_CFG.PAGEDATE.key).getFullYear() == dCellDate.getFullYear()) || this.cfg.getProperty(DEF_CFG.OOM_SELECT.key)) {
- Dom.removeClass(cell, this.Style.CSS_CELL_SELECTED);
- }
- selected.splice(cellDateIndex, 1);
- }
-
- if (this.parent) {
- this.parent.cfg.setProperty(DEF_CFG.SELECTED.key, selected);
- } else {
- this.cfg.setProperty(DEF_CFG.SELECTED.key, selected);
- }
-
- this.deselectEvent.fire([selectDate]);
- }
-
- return this.getSelectedDates();
- },
-
- /**
- * Deselects all dates on the current calendar.
- * @method deselectAll
- * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
- * Assuming that this function executes properly, the return value should be an empty array.
- * However, the empty array is returned for the sake of being able to check the selection status
- * of the calendar.
- */
- deselectAll : function() {
- this.beforeDeselectEvent.fire();
-
- var cfgSelected = DEF_CFG.SELECTED.key,
- selected = this.cfg.getProperty(cfgSelected),
- count = selected.length,
- sel = selected.concat();
-
- if (this.parent) {
- this.parent.cfg.setProperty(cfgSelected, []);
- } else {
- this.cfg.setProperty(cfgSelected, []);
- }
-
- if (count > 0) {
- this.deselectEvent.fire(sel);
- }
-
- return this.getSelectedDates();
- },
-
- // END SELECTION METHODS
-
- // BEGIN TYPE CONVERSION METHODS
-
- /**
- * Converts a date (either a JavaScript Date object, or a date string) to the internal data structure
- * used to represent dates: [[yyyy,mm,dd],[yyyy,mm,dd]].
- * @method _toFieldArray
- * @private
- * @param {String/Date/Date[]} date The date string of dates to deselect in the current calendar. Valid formats are
- * individual date(s) (12/24/2005,12/26/2005) or date range(s) (12/24/2005-1/1/2006).
- * Multiple comma-delimited dates can also be passed to this method (12/24/2005,12/11/2005-12/13/2005).
- * This method can also take a JavaScript Date object or an array of Date objects.
- * @return {Array[](Number[])} Array of date field arrays
- */
- _toFieldArray : function(date) {
- var returnDate = [];
-
- if (date instanceof Date) {
- returnDate = [[date.getFullYear(), date.getMonth()+1, date.getDate()]];
- } else if (Lang.isString(date)) {
- returnDate = this._parseDates(date);
- } else if (Lang.isArray(date)) {
- for (var i=0;i maxDate.getTime()));
- },
-
- /**
- * Parses a pagedate configuration property value. The value can either be specified as a string of form "mm/yyyy" or a Date object
- * and is parsed into a Date object normalized to the first day of the month. If no value is passed in, the month and year from today's date are used to create the Date object
- * @method _parsePageDate
- * @private
- * @param {Date|String} date Pagedate value which needs to be parsed
- * @return {Date} The Date object representing the pagedate
- */
- _parsePageDate : function(date) {
- var parsedDate;
-
- if (date) {
- if (date instanceof Date) {
- parsedDate = DateMath.findMonthStart(date);
- } else {
- var month, year, aMonthYear;
- aMonthYear = date.split(this.cfg.getProperty(DEF_CFG.DATE_FIELD_DELIMITER.key));
- month = parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_MONTH_POSITION.key)-1], 10)-1;
- year = parseInt(aMonthYear[this.cfg.getProperty(DEF_CFG.MY_YEAR_POSITION.key)-1], 10) - this.Locale.YEAR_OFFSET;
-
- parsedDate = DateMath.getDate(year, month, 1);
- }
- } else {
- parsedDate = DateMath.getDate(this.today.getFullYear(), this.today.getMonth(), 1);
- }
- return parsedDate;
- },
-
- // END UTILITY METHODS
-
- // BEGIN EVENT HANDLERS
-
- /**
- * Event executed before a date is selected in the calendar widget.
- * @deprecated Event handlers for this event should be susbcribed to beforeSelectEvent.
- */
- onBeforeSelect : function() {
- if (this.cfg.getProperty(DEF_CFG.MULTI_SELECT.key) === false) {
- if (this.parent) {
- this.parent.callChildFunction("clearAllBodyCellStyles", this.Style.CSS_CELL_SELECTED);
- this.parent.deselectAll();
- } else {
- this.clearAllBodyCellStyles(this.Style.CSS_CELL_SELECTED);
- this.deselectAll();
- }
- }
- },
-
- /**
- * Event executed when a date is selected in the calendar widget.
- * @param {Array} selected An array of date field arrays representing which date or dates were selected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
- * @deprecated Event handlers for this event should be susbcribed to selectEvent.
- */
- onSelect : function(selected) { },
-
- /**
- * Event executed before a date is deselected in the calendar widget.
- * @deprecated Event handlers for this event should be susbcribed to beforeDeselectEvent.
- */
- onBeforeDeselect : function() { },
-
- /**
- * Event executed when a date is deselected in the calendar widget.
- * @param {Array} selected An array of date field arrays representing which date or dates were deselected. Example: [ [2006,8,6],[2006,8,7],[2006,8,8] ]
- * @deprecated Event handlers for this event should be susbcribed to deselectEvent.
- */
- onDeselect : function(deselected) { },
-
- /**
- * Event executed when the user navigates to a different calendar page.
- * @deprecated Event handlers for this event should be susbcribed to changePageEvent.
- */
- onChangePage : function() {
- this.render();
- },
-
- /**
- * Event executed when the calendar widget is rendered.
- * @deprecated Event handlers for this event should be susbcribed to renderEvent.
- */
- onRender : function() { },
-
- /**
- * Event executed when the calendar widget is reset to its original state.
- * @deprecated Event handlers for this event should be susbcribed to resetEvemt.
- */
- onReset : function() { this.render(); },
-
- /**
- * Event executed when the calendar widget is completely cleared to the current month with no selections.
- * @deprecated Event handlers for this event should be susbcribed to clearEvent.
- */
- onClear : function() { this.render(); },
-
- /**
- * Validates the calendar widget. This method has no default implementation
- * and must be extended by subclassing the widget.
- * @return Should return true if the widget validates, and false if
- * it doesn't.
- * @type Boolean
- */
- validate : function() { return true; },
-
- // END EVENT HANDLERS
-
- // BEGIN DATE PARSE METHODS
-
- /**
- * Converts a date string to a date field array
- * @private
- * @param {String} sDate Date string. Valid formats are mm/dd and mm/dd/yyyy.
- * @return A date field array representing the string passed to the method
- * @type Array[](Number[])
- */
- _parseDate : function(sDate) {
- var aDate = sDate.split(this.Locale.DATE_FIELD_DELIMITER),
- rArray;
-
- if (aDate.length == 2) {
- rArray = [aDate[this.Locale.MD_MONTH_POSITION-1],aDate[this.Locale.MD_DAY_POSITION-1]];
- rArray.type = Calendar.MONTH_DAY;
- } else {
- rArray = [aDate[this.Locale.MDY_YEAR_POSITION-1] - this.Locale.YEAR_OFFSET, aDate[this.Locale.MDY_MONTH_POSITION-1],aDate[this.Locale.MDY_DAY_POSITION-1]];
- rArray.type = Calendar.DATE;
- }
-
- for (var i=0;iNOTE: The contents of the cell set by the renderer will be added to the DOM as HTML. The custom renderer implementation should
- * escape markup used to set the cell contents, if coming from an external source.
- * @method addRenderer
- * @param {String} sDates A date string to associate with the specified renderer. Valid formats
- * include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
- * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
- */
- addRenderer : function(sDates, fnRender) {
- var aDates = this._parseDates(sDates);
- for (var i=0;iNOTE: The contents of the cell set by the renderer will be added to the DOM as HTML. The custom renderer implementation should
- * escape markup used to set the cell contents, if coming from an external source.
- * @method addMonthRenderer
- * @param {Number} month The month (1-12) to associate with this renderer
- * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
- */
- addMonthRenderer : function(month, fnRender) {
- this._addRenderer(Calendar.MONTH,[month],fnRender);
- },
-
- /**
- * Adds a weekday renderer to the render stack. The function reference passed to this method will be executed
- * when a date cell matches the weekday passed to this method.
- *
- *
NOTE: The contents of the cell set by the renderer will be added to the DOM as HTML. The custom renderer implementation should
- * escape HTML used to set the cell contents, if coming from an external source.
- *
- * @method addWeekdayRenderer
- * @param {Number} weekday The weekday (Sunday = 1, Monday = 2 ... Saturday = 7) to associate with this renderer
- * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
- */
- addWeekdayRenderer : function(weekday, fnRender) {
- this._addRenderer(Calendar.WEEKDAY,[weekday],fnRender);
- },
-
- // END RENDERER METHODS
-
- // BEGIN CSS METHODS
-
- /**
- * Removes all styles from all body cells in the current calendar table.
- * @method clearAllBodyCellStyles
- * @param {style} style The CSS class name to remove from all calendar body cells
- */
- clearAllBodyCellStyles : function(style) {
- for (var c=0;c
-*
-*
-*
-* The tables for the calendars ("cal1_0" and "cal1_1") will be inserted into those containers.
-*
-*
-* NOTE: As of 2.4.0, the constructor's ID argument is optional.
-* The CalendarGroup can be constructed by simply providing a container ID string,
-* or a reference to a container DIV HTMLElement (the element needs to exist
-* in the document).
-*
-* E.g.:
-*
-* var c = new YAHOO.widget.CalendarGroup("calContainer", configOptions);
-*
-* or:
-*
-* var containerDiv = YAHOO.util.Dom.get("calContainer");
-* var c = new YAHOO.widget.CalendarGroup(containerDiv, configOptions);
-*
-*
-*
-* If not provided, the ID will be generated from the container DIV ID by adding an "_t" suffix.
-* For example if an ID is not provided, and the container's ID is "calContainer", the CalendarGroup's ID will be set to "calContainer_t".
-*
-*
-* @namespace YAHOO.widget
-* @class CalendarGroup
-* @constructor
-* @param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
-* @param {String | HTMLElement} container The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.
-* @param {Object} config optional The configuration object containing the initial configuration values for the CalendarGroup.
-*/
-function CalendarGroup(id, containerId, config) {
- if (arguments.length > 0) {
- this.init.apply(this, arguments);
- }
-}
-
-/**
-* The set of default Config property keys and values for the CalendarGroup.
-*
-*
-* NOTE: This property is made public in order to allow users to change
-* the default values of configuration properties. Users should not
-* modify the key string, unless they are overriding the Calendar implementation
-*
-*
-* @property YAHOO.widget.CalendarGroup.DEFAULT_CONFIG
-* @static
-* @type Object An object with key/value pairs, the key being the
-* uppercase configuration property name and the value being an objec
-* literal with a key string property, and a value property, specifying the
-* default value of the property
-*/
-
-/**
-* The set of default Config property keys and values for the CalendarGroup
-* @property YAHOO.widget.CalendarGroup._DEFAULT_CONFIG
-* @deprecated Made public. See the public DEFAULT_CONFIG property for details
-* @private
-* @static
-* @type Object
-*/
-CalendarGroup.DEFAULT_CONFIG = CalendarGroup._DEFAULT_CONFIG = Calendar.DEFAULT_CONFIG;
-CalendarGroup.DEFAULT_CONFIG.PAGES = {key:"pages", value:2};
-
-var DEF_CFG = CalendarGroup.DEFAULT_CONFIG;
-
-CalendarGroup.prototype = {
-
- /**
- * Initializes the calendar group. All subclasses must call this method in order for the
- * group to be initialized properly.
- * @method init
- * @param {String} id optional The id of the table element that will represent the CalendarGroup widget. As of 2.4.0, this argument is optional.
- * @param {String | HTMLElement} container The id of the container div element that will wrap the CalendarGroup table, or a reference to a DIV element which exists in the document.
- * @param {Object} config optional The configuration object containing the initial configuration values for the CalendarGroup.
- */
- init : function(id, container, config) {
-
- // Normalize 2.4.0, pre 2.4.0 args
- var nArgs = this._parseArgs(arguments);
-
- id = nArgs.id;
- container = nArgs.container;
- config = nArgs.config;
-
- this.oDomContainer = Dom.get(container);
-
- if (!this.oDomContainer.id) {
- this.oDomContainer.id = Dom.generateId();
- }
- if (!id) {
- id = this.oDomContainer.id + "_t";
- }
-
- /**
- * The unique id associated with the CalendarGroup
- * @property id
- * @type String
- */
- this.id = id;
-
- /**
- * The unique id associated with the CalendarGroup container
- * @property containerId
- * @type String
- */
- this.containerId = this.oDomContainer.id;
-
- this.initEvents();
- this.initStyles();
-
- /**
- * The collection of Calendar pages contained within the CalendarGroup
- * @property pages
- * @type YAHOO.widget.Calendar[]
- */
- this.pages = [];
-
- Dom.addClass(this.oDomContainer, CalendarGroup.CSS_CONTAINER);
- Dom.addClass(this.oDomContainer, CalendarGroup.CSS_MULTI_UP);
-
- /**
- * The Config object used to hold the configuration variables for the CalendarGroup
- * @property cfg
- * @type YAHOO.util.Config
- */
- this.cfg = new YAHOO.util.Config(this);
-
- /**
- * The local object which contains the CalendarGroup's options
- * @property Options
- * @type Object
- */
- this.Options = {};
-
- /**
- * The local object which contains the CalendarGroup's locale settings
- * @property Locale
- * @type Object
- */
- this.Locale = {};
-
- this.setupConfig();
-
- if (config) {
- this.cfg.applyConfig(config, true);
- }
-
- this.cfg.fireQueue();
-
- },
-
- setupConfig : function() {
-
- var cfg = this.cfg;
-
- /**
- * The number of pages to include in the CalendarGroup. This value can only be set once, in the CalendarGroup's constructor arguments.
- * @config pages
- * @type Number
- * @default 2
- */
- cfg.addProperty(DEF_CFG.PAGES.key, { value:DEF_CFG.PAGES.value, validator:cfg.checkNumber, handler:this.configPages } );
-
- /**
- * The positive or negative year offset from the Gregorian calendar year (assuming a January 1st rollover) to
- * be used when displaying or parsing dates. NOTE: All JS Date objects returned by methods, or expected as input by
- * methods will always represent the Gregorian year, in order to maintain date/month/week values.
- *
- * @config year_offset
- * @type Number
- * @default 0
- */
- cfg.addProperty(DEF_CFG.YEAR_OFFSET.key, { value:DEF_CFG.YEAR_OFFSET.value, handler: this.delegateConfig, supercedes:DEF_CFG.YEAR_OFFSET.supercedes, suppressEvent:true } );
-
- /**
- * The date to use to represent "Today".
- *
- * @config today
- * @type Date
- * @default Today's date
- */
- cfg.addProperty(DEF_CFG.TODAY.key, { value: new Date(DEF_CFG.TODAY.value.getTime()), supercedes:DEF_CFG.TODAY.supercedes, handler: this.configToday, suppressEvent:false } );
-
- /**
- * The month/year representing the current visible Calendar date (mm/yyyy)
- * @config pagedate
- * @type String | Date
- * @default Today's date
- */
- cfg.addProperty(DEF_CFG.PAGEDATE.key, { value: DEF_CFG.PAGEDATE.value || new Date(DEF_CFG.TODAY.value.getTime()), handler:this.configPageDate } );
-
- /**
- * The date or range of dates representing the current Calendar selection
- *
- * @config selected
- * @type String
- * @default []
- */
- cfg.addProperty(DEF_CFG.SELECTED.key, { value:[], handler:this.configSelected } );
-
- /**
- * The title to display above the CalendarGroup's month header. The title is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config title
- * @type HTML
- * @default ""
- */
- cfg.addProperty(DEF_CFG.TITLE.key, { value:DEF_CFG.TITLE.value, handler:this.configTitle } );
-
- /**
- * Whether or not a close button should be displayed for this CalendarGroup
- * @config close
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.CLOSE.key, { value:DEF_CFG.CLOSE.value, handler:this.configClose } );
-
- /**
- * Whether or not an iframe shim should be placed under the Calendar to prevent select boxes from bleeding through in Internet Explorer 6 and below.
- * This property is enabled by default for IE6 and below. It is disabled by default for other browsers for performance reasons, but can be
- * enabled if required.
- *
- * @config iframe
- * @type Boolean
- * @default true for IE6 and below, false for all other browsers
- */
- cfg.addProperty(DEF_CFG.IFRAME.key, { value:DEF_CFG.IFRAME.value, handler:this.configIframe, validator:cfg.checkBoolean } );
-
- /**
- * The minimum selectable date in the current Calendar (mm/dd/yyyy)
- * @config mindate
- * @type String | Date
- * @default null
- */
- cfg.addProperty(DEF_CFG.MINDATE.key, { value:DEF_CFG.MINDATE.value, handler:this.delegateConfig } );
-
- /**
- * The maximum selectable date in the current Calendar (mm/dd/yyyy)
- * @config maxdate
- * @type String | Date
- * @default null
- */
- cfg.addProperty(DEF_CFG.MAXDATE.key, { value:DEF_CFG.MAXDATE.value, handler:this.delegateConfig } );
-
- /**
- * True if the Calendar should allow multiple selections. False by default.
- * @config MULTI_SELECT
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.MULTI_SELECT.key, { value:DEF_CFG.MULTI_SELECT.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
-
- /**
- * True if the Calendar should allow selection of out-of-month dates. False by default.
- * @config OOM_SELECT
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.OOM_SELECT.key, { value:DEF_CFG.OOM_SELECT.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
-
- /**
- * The weekday the week begins on. Default is 0 (Sunday).
- * @config START_WEEKDAY
- * @type number
- * @default 0
- */
- cfg.addProperty(DEF_CFG.START_WEEKDAY.key, { value:DEF_CFG.START_WEEKDAY.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * True if the Calendar should show weekday labels. True by default.
- * @config SHOW_WEEKDAYS
- * @type Boolean
- * @default true
- */
- cfg.addProperty(DEF_CFG.SHOW_WEEKDAYS.key, { value:DEF_CFG.SHOW_WEEKDAYS.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row headers. False by default.
- * @config SHOW_WEEK_HEADER
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.SHOW_WEEK_HEADER.key,{ value:DEF_CFG.SHOW_WEEK_HEADER.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
-
- /**
- * True if the Calendar should show week row footers. False by default.
- * @config SHOW_WEEK_FOOTER
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.SHOW_WEEK_FOOTER.key,{ value:DEF_CFG.SHOW_WEEK_FOOTER.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
-
- /**
- * True if the Calendar should suppress weeks that are not a part of the current month. False by default.
- * @config HIDE_BLANK_WEEKS
- * @type Boolean
- * @default false
- */
- cfg.addProperty(DEF_CFG.HIDE_BLANK_WEEKS.key,{ value:DEF_CFG.HIDE_BLANK_WEEKS.value, handler:this.delegateConfig, validator:cfg.checkBoolean } );
-
- /**
- * The image URL that should be used for the left navigation arrow. The image URL is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config NAV_ARROW_LEFT
- * @type String
- * @deprecated You can customize the image by overriding the default CSS class for the left arrow - "calnavleft"
- * @default null
- */
- cfg.addProperty(DEF_CFG.NAV_ARROW_LEFT.key, { value:DEF_CFG.NAV_ARROW_LEFT.value, handler:this.delegateConfig } );
-
- /**
- * The image URL that should be used for the right navigation arrow. The image URL is inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config NAV_ARROW_RIGHT
- * @type String
- * @deprecated You can customize the image by overriding the default CSS class for the right arrow - "calnavright"
- * @default null
- */
- cfg.addProperty(DEF_CFG.NAV_ARROW_RIGHT.key, { value:DEF_CFG.NAV_ARROW_RIGHT.value, handler:this.delegateConfig } );
-
- // Locale properties
-
- /**
- * The short month labels for the current locale. The month labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config MONTHS_SHORT
- * @type HTML[]
- * @default ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
- */
- cfg.addProperty(DEF_CFG.MONTHS_SHORT.key, { value:DEF_CFG.MONTHS_SHORT.value, handler:this.delegateConfig } );
-
- /**
- * The long month labels for the current locale. The month labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config MONTHS_LONG
- * @type HTML[]
- * @default ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
- */
- cfg.addProperty(DEF_CFG.MONTHS_LONG.key, { value:DEF_CFG.MONTHS_LONG.value, handler:this.delegateConfig } );
-
- /**
- * The 1-character weekday labels for the current locale. The weekday labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config WEEKDAYS_1CHAR
- * @type HTML[]
- * @default ["S", "M", "T", "W", "T", "F", "S"]
- */
- cfg.addProperty(DEF_CFG.WEEKDAYS_1CHAR.key, { value:DEF_CFG.WEEKDAYS_1CHAR.value, handler:this.delegateConfig } );
-
- /**
- * The short weekday labels for the current locale. The weekday labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config WEEKDAYS_SHORT
- * @type HTML[]
- * @default ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
- */
- cfg.addProperty(DEF_CFG.WEEKDAYS_SHORT.key, { value:DEF_CFG.WEEKDAYS_SHORT.value, handler:this.delegateConfig } );
-
- /**
- * The medium weekday labels for the current locale. The weekday labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config WEEKDAYS_MEDIUM
- * @type HTML[]
- * @default ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
- */
- cfg.addProperty(DEF_CFG.WEEKDAYS_MEDIUM.key, { value:DEF_CFG.WEEKDAYS_MEDIUM.value, handler:this.delegateConfig } );
-
- /**
- * The long weekday labels for the current locale. The weekday labels are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- * @config WEEKDAYS_LONG
- * @type HTML[]
- * @default ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
- */
- cfg.addProperty(DEF_CFG.WEEKDAYS_LONG.key, { value:DEF_CFG.WEEKDAYS_LONG.value, handler:this.delegateConfig } );
-
- /**
- * The setting that determines which length of month labels should be used. Possible values are "short" and "long".
- * @config LOCALE_MONTHS
- * @type String
- * @default "long"
- */
- cfg.addProperty(DEF_CFG.LOCALE_MONTHS.key, { value:DEF_CFG.LOCALE_MONTHS.value, handler:this.delegateConfig } );
-
- /**
- * The setting that determines which length of weekday labels should be used. Possible values are "1char", "short", "medium", and "long".
- * @config LOCALE_WEEKDAYS
- * @type String
- * @default "short"
- */
- cfg.addProperty(DEF_CFG.LOCALE_WEEKDAYS.key, { value:DEF_CFG.LOCALE_WEEKDAYS.value, handler:this.delegateConfig } );
-
- /**
- * The value used to delimit individual dates in a date string passed to various Calendar functions.
- * @config DATE_DELIMITER
- * @type String
- * @default ","
- */
- cfg.addProperty(DEF_CFG.DATE_DELIMITER.key, { value:DEF_CFG.DATE_DELIMITER.value, handler:this.delegateConfig } );
-
- /**
- * The value used to delimit date fields in a date string passed to various Calendar functions.
- * @config DATE_FIELD_DELIMITER
- * @type String
- * @default "/"
- */
- cfg.addProperty(DEF_CFG.DATE_FIELD_DELIMITER.key,{ value:DEF_CFG.DATE_FIELD_DELIMITER.value, handler:this.delegateConfig } );
-
- /**
- * The value used to delimit date ranges in a date string passed to various Calendar functions.
- * @config DATE_RANGE_DELIMITER
- * @type String
- * @default "-"
- */
- cfg.addProperty(DEF_CFG.DATE_RANGE_DELIMITER.key,{ value:DEF_CFG.DATE_RANGE_DELIMITER.value, handler:this.delegateConfig } );
-
- /**
- * The position of the month in a month/year date string
- * @config MY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- cfg.addProperty(DEF_CFG.MY_MONTH_POSITION.key, { value:DEF_CFG.MY_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * The position of the year in a month/year date string
- * @config MY_YEAR_POSITION
- * @type Number
- * @default 2
- */
- cfg.addProperty(DEF_CFG.MY_YEAR_POSITION.key, { value:DEF_CFG.MY_YEAR_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day date string
- * @config MD_MONTH_POSITION
- * @type Number
- * @default 1
- */
- cfg.addProperty(DEF_CFG.MD_MONTH_POSITION.key, { value:DEF_CFG.MD_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * The position of the day in a month/year date string
- * @config MD_DAY_POSITION
- * @type Number
- * @default 2
- */
- cfg.addProperty(DEF_CFG.MD_DAY_POSITION.key, { value:DEF_CFG.MD_DAY_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * The position of the month in a month/day/year date string
- * @config MDY_MONTH_POSITION
- * @type Number
- * @default 1
- */
- cfg.addProperty(DEF_CFG.MDY_MONTH_POSITION.key, { value:DEF_CFG.MDY_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * The position of the day in a month/day/year date string
- * @config MDY_DAY_POSITION
- * @type Number
- * @default 2
- */
- cfg.addProperty(DEF_CFG.MDY_DAY_POSITION.key, { value:DEF_CFG.MDY_DAY_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * The position of the year in a month/day/year date string
- * @config MDY_YEAR_POSITION
- * @type Number
- * @default 3
- */
- cfg.addProperty(DEF_CFG.MDY_YEAR_POSITION.key, { value:DEF_CFG.MDY_YEAR_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * The position of the month in the month year label string used as the Calendar header
- * @config MY_LABEL_MONTH_POSITION
- * @type Number
- * @default 1
- */
- cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_POSITION.key, { value:DEF_CFG.MY_LABEL_MONTH_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * The position of the year in the month year label string used as the Calendar header
- * @config MY_LABEL_YEAR_POSITION
- * @type Number
- * @default 2
- */
- cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_POSITION.key, { value:DEF_CFG.MY_LABEL_YEAR_POSITION.value, handler:this.delegateConfig, validator:cfg.checkNumber } );
-
- /**
- * The suffix used after the month when rendering the Calendar header
- * @config MY_LABEL_MONTH_SUFFIX
- * @type String
- * @default " "
- */
- cfg.addProperty(DEF_CFG.MY_LABEL_MONTH_SUFFIX.key, { value:DEF_CFG.MY_LABEL_MONTH_SUFFIX.value, handler:this.delegateConfig } );
-
- /**
- * The suffix used after the year when rendering the Calendar header
- * @config MY_LABEL_YEAR_SUFFIX
- * @type String
- * @default ""
- */
- cfg.addProperty(DEF_CFG.MY_LABEL_YEAR_SUFFIX.key, { value:DEF_CFG.MY_LABEL_YEAR_SUFFIX.value, handler:this.delegateConfig } );
-
- /**
- * Configuration for the Month/Year CalendarNavigator UI which allows the user to jump directly to a
- * specific Month/Year without having to scroll sequentially through months.
- *
- * Setting this property to null (default value) or false, will disable the CalendarNavigator UI.
- *
- *
- * Setting this property to true will enable the CalendarNavigatior UI with the default CalendarNavigator configuration values.
- *
- *
- * This property can also be set to an object literal containing configuration properties for the CalendarNavigator UI.
- * The configuration object expects the the following case-sensitive properties, with the "strings" property being a nested object.
- * Any properties which are not provided will use the default values (defined in the CalendarNavigator class).
- *
- *
- *
strings
- *
Object : An object with the properties shown below, defining the string labels to use in the Navigator's UI. The strings are inserted into the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
- *
month
HTML : The markup to use for the month label. Defaults to "Month".
- *
year
HTML : The markup to use for the year label. Defaults to "Year".
- *
submit
HTML : The markup to use for the submit button label. Defaults to "Okay".
- *
cancel
HTML : The markup to use for the cancel button label. Defaults to "Cancel".
- *
invalidYear
HTML : The markup to use for invalid year values. Defaults to "Year needs to be a number".
- *
- *
- *
monthFormat
String : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG
- *
initialFocus
String : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"
- * @config navigator
- * @type {Object|Boolean}
- * @default null
- */
- cfg.addProperty(DEF_CFG.NAV.key, { value:DEF_CFG.NAV.value, handler:this.configNavigator } );
-
- /**
- * The map of UI strings which the CalendarGroup UI uses.
- *
- * @config strings
- * @type {Object}
- * @default An object with the properties shown below:
- *
- *
previousMonth
HTML : The markup to use for the "Previous Month" navigation label. Defaults to "Previous Month". The string is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
nextMonth
HTML : The markup to use for the "Next Month" navigation UI. Defaults to "Next Month". The string is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
close
HTML : The markup to use for the close button label. Defaults to "Close". The string is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
- */
- cfg.addProperty(DEF_CFG.STRINGS.key, {
- value:DEF_CFG.STRINGS.value,
- handler:this.configStrings,
- validator: function(val) {
- return Lang.isObject(val);
- },
- supercedes: DEF_CFG.STRINGS.supercedes
- });
- },
-
- /**
- * Initializes CalendarGroup's built-in CustomEvents
- * @method initEvents
- */
- initEvents : function() {
-
- var me = this,
- strEvent = "Event",
- CE = YAHOO.util.CustomEvent;
-
- /**
- * Proxy subscriber to subscribe to the CalendarGroup's child Calendars' CustomEvents
- * @method sub
- * @private
- * @param {Function} fn The function to subscribe to this CustomEvent
- * @param {Object} obj The CustomEvent's scope object
- * @param {Boolean} bOverride Whether or not to apply scope correction
- */
- var sub = function(fn, obj, bOverride) {
- for (var p=0;p 0) {
- caldate = new Date(firstPageDate);
- this._setMonthOnDate(caldate, caldate.getMonth() + p);
- childConfig.pageDate = caldate;
- }
-
- var cal = this.constructChild(calId, calContainerId, childConfig);
-
- Dom.removeClass(cal.oDomContainer, this.Style.CSS_SINGLE);
- Dom.addClass(cal.oDomContainer, groupCalClass);
-
- if (p===0) {
- firstPageDate = cal.cfg.getProperty(cfgPageDate);
- Dom.addClass(cal.oDomContainer, firstClass);
- }
-
- if (p==(pageCount-1)) {
- Dom.addClass(cal.oDomContainer, lastClass);
- }
-
- cal.parent = this;
- cal.index = p;
-
- this.pages[this.pages.length] = cal;
- }
- },
-
- /**
- * The default Config handler for the "pagedate" property
- * @method configPageDate
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- */
- configPageDate : function(type, args, obj) {
- var val = args[0],
- firstPageDate;
-
- var cfgPageDate = DEF_CFG.PAGEDATE.key;
-
- for (var p=0;p 0) ? this.pages[0].cfg.getProperty(cfgSelected) : [];
- this.cfg.setProperty(cfgSelected, selected, true);
- },
-
-
- /**
- * Delegates a configuration property to the CustomEvents associated with the CalendarGroup's children
- * @method delegateConfig
- * @param {String} type The CustomEvent type (usually the property name)
- * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
- * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
- */
- delegateConfig : function(type, args, obj) {
- var val = args[0];
- var cal;
-
- for (var p=0;p0) {
- year+=1;
- }
- cal.setYear(year);
- }
- },
-
- /**
- * Calls the render function of all child calendars within the group.
- * @method render
- */
- render : function() {
- this.renderHeader();
- for (var p=0;p
- *
If MULTI_SELECT is false, selectCell will select the cell at the specified index for only the last displayed Calendar page.
- *
If MULTI_SELECT is true, selectCell will select the cell at the specified index, on each displayed Calendar page.
- *
- * @method selectCell
- * @param {Number} cellIndex The index of the cell to be selected.
- * @return {Date[]} Array of JavaScript Date objects representing all individual dates that are currently selected.
- */
- selectCell : function(cellIndex) {
- for (var p=0;p=0;--p) {
- var cal = this.pages[p];
- cal.previousMonth();
- }
- },
-
- /**
- * Navigates to the next year in the currently selected month in the calendar widget.
- * @method nextYear
- */
- nextYear : function() {
- for (var p=0;pNOTE: The contents of the cell set by the renderer will be added to the DOM as HTML. The custom renderer implementation should
- * escape markup used to set the cell contents, if coming from an external source.
- * @method addRenderer
- * @param {String} sDates A date string to associate with the specified renderer. Valid formats
- * include date (12/24/2005), month/day (12/24), and range (12/1/2004-1/1/2005)
- * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
- */
- addRenderer : function(sDates, fnRender) {
- for (var p=0;pNOTE: The contents of the cell set by the renderer will be added to the DOM as HTML. The custom renderer implementation should
- * escape markup used to set the cell contents, if coming from an external source.
- * @method addMonthRenderer
- * @param {Number} month The month (1-12) to associate with this renderer
- * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
- */
- addMonthRenderer : function(month, fnRender) {
- for (var p=0;pNOTE: The contents of the cell set by the renderer will be added to the DOM as HTML. The custom renderer implementation should
- * escape HTML used to set the cell contents, if coming from an external source.
- *
- * @method addWeekdayRenderer
- * @param {Number} weekday The weekday (Sunday = 1, Monday = 2 ... Saturday = 7) to associate with this renderer
- * @param {Function} fnRender The function executed to render cells that match the render rules for this renderer.
- */
- addWeekdayRenderer : function(weekday, fnRender) {
- for (var p=0;p 11)) {
- var newDate = DateMath.add(date, DateMath.MONTH, iMonth-date.getMonth());
- date.setTime(newDate.getTime());
- } else {
- date.setMonth(iMonth);
- }
- },
-
- /**
- * Fixes the width of the CalendarGroup container element, to account for miswrapped floats
- * @method _fixWidth
- * @private
- */
- _fixWidth : function() {
- var w = 0;
- for (var p=0;p 0) {
- this.oDomContainer.style.width = w + "px";
- }
- },
-
- /**
- * Returns a string representation of the object.
- * @method toString
- * @return {String} A string representation of the CalendarGroup object.
- */
- toString : function() {
- return "CalendarGroup " + this.id;
- },
-
- /**
- * Destroys the CalendarGroup instance. The method will remove references
- * to HTML elements, remove any event listeners added by the CalendarGroup.
- *
- * It will also destroy the Config and CalendarNavigator instances created by the
- * CalendarGroup and the individual Calendar instances created for each page.
- *
- * @method destroy
- */
- destroy : function() {
-
- if (this.beforeDestroyEvent.fire()) {
-
- var cal = this;
-
- // Child objects
- if (cal.navigator) {
- cal.navigator.destroy();
- }
-
- if (cal.cfg) {
- cal.cfg.destroy();
- }
-
- // DOM event listeners
- Event.purgeElement(cal.oDomContainer, true);
-
- // Generated markup/DOM - Not removing the container DIV since we didn't create it.
- Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_CONTAINER);
- Dom.removeClass(cal.oDomContainer, CalendarGroup.CSS_MULTI_UP);
-
- for (var i = 0, l = cal.pages.length; i < l; i++) {
- cal.pages[i].destroy();
- cal.pages[i] = null;
- }
-
- cal.oDomContainer.innerHTML = "";
-
- // JS-to-DOM references
- cal.oDomContainer = null;
-
- this.destroyEvent.fire();
- }
- }
-};
-
-/**
-* CSS class representing the container for the calendar
-* @property YAHOO.widget.CalendarGroup.CSS_CONTAINER
-* @static
-* @final
-* @type String
-*/
-CalendarGroup.CSS_CONTAINER = "yui-calcontainer";
-
-/**
-* CSS class representing the container for the calendar
-* @property YAHOO.widget.CalendarGroup.CSS_MULTI_UP
-* @static
-* @final
-* @type String
-*/
-CalendarGroup.CSS_MULTI_UP = "multi";
-
-/**
-* CSS class representing the title for the 2-up calendar
-* @property YAHOO.widget.CalendarGroup.CSS_2UPTITLE
-* @static
-* @final
-* @type String
-*/
-CalendarGroup.CSS_2UPTITLE = "title";
-
-/**
-* CSS class representing the close icon for the 2-up calendar
-* @property YAHOO.widget.CalendarGroup.CSS_2UPCLOSE
-* @static
-* @final
-* @deprecated Along with Calendar.IMG_ROOT and NAV_ARROW_LEFT, NAV_ARROW_RIGHT configuration properties.
-* Calendar's Style.CSS_CLOSE property now represents the CSS class used to render the close icon
-* @type String
-*/
-CalendarGroup.CSS_2UPCLOSE = "close-icon";
-
-YAHOO.lang.augmentProto(CalendarGroup, Calendar, "buildDayLabel",
- "buildMonthLabel",
- "renderOutOfBoundsDate",
- "renderRowHeader",
- "renderRowFooter",
- "renderCellDefault",
- "styleCellDefault",
- "renderCellStyleHighlight1",
- "renderCellStyleHighlight2",
- "renderCellStyleHighlight3",
- "renderCellStyleHighlight4",
- "renderCellStyleToday",
- "renderCellStyleSelected",
- "renderCellNotThisMonth",
- "styleCellNotThisMonth",
- "renderBodyCellRestricted",
- "initStyles",
- "configTitle",
- "configClose",
- "configIframe",
- "configStrings",
- "configToday",
- "configNavigator",
- "createTitleBar",
- "createCloseButton",
- "removeTitleBar",
- "removeCloseButton",
- "hide",
- "show",
- "toDate",
- "_toDate",
- "_parseArgs",
- "browser");
-
-YAHOO.widget.CalGrp = CalendarGroup;
-YAHOO.widget.CalendarGroup = CalendarGroup;
-
-/**
-* @class YAHOO.widget.Calendar2up
-* @extends YAHOO.widget.CalendarGroup
-* @deprecated The old Calendar2up class is no longer necessary, since CalendarGroup renders in a 2up view by default.
-*/
-YAHOO.widget.Calendar2up = function(id, containerId, config) {
- this.init(id, containerId, config);
-};
-
-YAHOO.extend(YAHOO.widget.Calendar2up, CalendarGroup);
-
-/**
-* @deprecated The old Calendar2up class is no longer necessary, since CalendarGroup renders in a 2up view by default.
-*/
-YAHOO.widget.Cal2up = YAHOO.widget.Calendar2up;
-
-})();
-/**
- * The CalendarNavigator is used along with a Calendar/CalendarGroup to
- * provide a Month/Year popup navigation control, allowing the user to navigate
- * to a specific month/year in the Calendar/CalendarGroup without having to
- * scroll through months sequentially
- *
- * @namespace YAHOO.widget
- * @class CalendarNavigator
- * @constructor
- * @param {Calendar|CalendarGroup} cal The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached.
- */
-YAHOO.widget.CalendarNavigator = function(cal) {
- this.init(cal);
-};
-
-(function() {
- // Setup static properties (inside anon fn, so that we can use shortcuts)
- var CN = YAHOO.widget.CalendarNavigator;
-
- /**
- * YAHOO.widget.CalendarNavigator.CLASSES contains constants
- * for the class values applied to the CalendarNaviatgator's
- * DOM elements
- * @property YAHOO.widget.CalendarNavigator.CLASSES
- * @type Object
- * @static
- */
- CN.CLASSES = {
- /**
- * Class applied to the Calendar Navigator's bounding box
- * @property YAHOO.widget.CalendarNavigator.CLASSES.NAV
- * @type String
- * @static
- */
- NAV :"yui-cal-nav",
- /**
- * Class applied to the Calendar/CalendarGroup's bounding box to indicate
- * the Navigator is currently visible
- * @property YAHOO.widget.CalendarNavigator.CLASSES.NAV_VISIBLE
- * @type String
- * @static
- */
- NAV_VISIBLE: "yui-cal-nav-visible",
- /**
- * Class applied to the Navigator mask's bounding box
- * @property YAHOO.widget.CalendarNavigator.CLASSES.MASK
- * @type String
- * @static
- */
- MASK : "yui-cal-nav-mask",
- /**
- * Class applied to the year label/control bounding box
- * @property YAHOO.widget.CalendarNavigator.CLASSES.YEAR
- * @type String
- * @static
- */
- YEAR : "yui-cal-nav-y",
- /**
- * Class applied to the month label/control bounding box
- * @property YAHOO.widget.CalendarNavigator.CLASSES.MONTH
- * @type String
- * @static
- */
- MONTH : "yui-cal-nav-m",
- /**
- * Class applied to the submit/cancel button's bounding box
- * @property YAHOO.widget.CalendarNavigator.CLASSES.BUTTONS
- * @type String
- * @static
- */
- BUTTONS : "yui-cal-nav-b",
- /**
- * Class applied to buttons wrapping element
- * @property YAHOO.widget.CalendarNavigator.CLASSES.BUTTON
- * @type String
- * @static
- */
- BUTTON : "yui-cal-nav-btn",
- /**
- * Class applied to the validation error area's bounding box
- * @property YAHOO.widget.CalendarNavigator.CLASSES.ERROR
- * @type String
- * @static
- */
- ERROR : "yui-cal-nav-e",
- /**
- * Class applied to the year input control
- * @property YAHOO.widget.CalendarNavigator.CLASSES.YEAR_CTRL
- * @type String
- * @static
- */
- YEAR_CTRL : "yui-cal-nav-yc",
- /**
- * Class applied to the month input control
- * @property YAHOO.widget.CalendarNavigator.CLASSES.MONTH_CTRL
- * @type String
- * @static
- */
- MONTH_CTRL : "yui-cal-nav-mc",
- /**
- * Class applied to controls with invalid data (e.g. a year input field with invalid an year)
- * @property YAHOO.widget.CalendarNavigator.CLASSES.INVALID
- * @type String
- * @static
- */
- INVALID : "yui-invalid",
- /**
- * Class applied to default controls
- * @property YAHOO.widget.CalendarNavigator.CLASSES.DEFAULT
- * @type String
- * @static
- */
- DEFAULT : "yui-default"
- };
-
- /**
- * Object literal containing the default configuration values for the CalendarNavigator
- * The configuration object is expected to follow the format below, with the properties being
- * case sensitive.
- *
- *
strings
- *
Object : An object with the properties shown below, defining the string labels to use in the Navigator's UI
- *
- *
month
HTML : The markup to use for the month label. Defaults to "Month".
- *
year
HTML : The markup to use for the year label. Defaults to "Year".
- *
submit
HTML : The markup to use for the submit button label. Defaults to "Okay".
- *
cancel
HTML : The markup to use for the cancel button label. Defaults to "Cancel".
- *
invalidYear
HTML : The markup to use for invalid year values. Defaults to "Year needs to be a number".
- *
- *
- *
monthFormat
String : The month format to use. Either YAHOO.widget.Calendar.LONG, or YAHOO.widget.Calendar.SHORT. Defaults to YAHOO.widget.Calendar.LONG
- *
initialFocus
String : Either "year" or "month" specifying which input control should get initial focus. Defaults to "year"
- *
- * @property DEFAULT_CONFIG
- * @type Object
- * @static
- */
- CN.DEFAULT_CONFIG = {
- strings : {
- month: "Month",
- year: "Year",
- submit: "Okay",
- cancel: "Cancel",
- invalidYear : "Year needs to be a number"
- },
- monthFormat: YAHOO.widget.Calendar.LONG,
- initialFocus: "year"
- };
-
- /**
- * Object literal containing the default configuration values for the CalendarNavigator
- * @property _DEFAULT_CFG
- * @protected
- * @deprecated Made public. See the public DEFAULT_CONFIG property
- * @type Object
- * @static
- */
- CN._DEFAULT_CFG = CN.DEFAULT_CONFIG;
-
-
- /**
- * The suffix added to the Calendar/CalendarGroup's ID, to generate
- * a unique ID for the Navigator and it's bounding box.
- * @property YAHOO.widget.CalendarNavigator.ID_SUFFIX
- * @static
- * @type String
- * @final
- */
- CN.ID_SUFFIX = "_nav";
- /**
- * The suffix added to the Navigator's ID, to generate
- * a unique ID for the month control.
- * @property YAHOO.widget.CalendarNavigator.MONTH_SUFFIX
- * @static
- * @type String
- * @final
- */
- CN.MONTH_SUFFIX = "_month";
- /**
- * The suffix added to the Navigator's ID, to generate
- * a unique ID for the year control.
- * @property YAHOO.widget.CalendarNavigator.YEAR_SUFFIX
- * @static
- * @type String
- * @final
- */
- CN.YEAR_SUFFIX = "_year";
- /**
- * The suffix added to the Navigator's ID, to generate
- * a unique ID for the error bounding box.
- * @property YAHOO.widget.CalendarNavigator.ERROR_SUFFIX
- * @static
- * @type String
- * @final
- */
- CN.ERROR_SUFFIX = "_error";
- /**
- * The suffix added to the Navigator's ID, to generate
- * a unique ID for the "Cancel" button.
- * @property YAHOO.widget.CalendarNavigator.CANCEL_SUFFIX
- * @static
- * @type String
- * @final
- */
- CN.CANCEL_SUFFIX = "_cancel";
- /**
- * The suffix added to the Navigator's ID, to generate
- * a unique ID for the "Submit" button.
- * @property YAHOO.widget.CalendarNavigator.SUBMIT_SUFFIX
- * @static
- * @type String
- * @final
- */
- CN.SUBMIT_SUFFIX = "_submit";
-
- /**
- * The number of digits to which the year input control is to be limited.
- * @property YAHOO.widget.CalendarNavigator.YR_MAX_DIGITS
- * @static
- * @type Number
- */
- CN.YR_MAX_DIGITS = 4;
-
- /**
- * The amount by which to increment the current year value,
- * when the arrow up/down key is pressed on the year control
- * @property YAHOO.widget.CalendarNavigator.YR_MINOR_INC
- * @static
- * @type Number
- */
- CN.YR_MINOR_INC = 1;
-
- /**
- * The amount by which to increment the current year value,
- * when the page up/down key is pressed on the year control
- * @property YAHOO.widget.CalendarNavigator.YR_MAJOR_INC
- * @static
- * @type Number
- */
- CN.YR_MAJOR_INC = 10;
-
- /**
- * Artificial delay (in ms) between the time the Navigator is hidden
- * and the Calendar/CalendarGroup state is updated. Allows the user
- * the see the Calendar/CalendarGroup page changing. If set to 0
- * the Calendar/CalendarGroup page will be updated instantly
- * @property YAHOO.widget.CalendarNavigator.UPDATE_DELAY
- * @static
- * @type Number
- */
- CN.UPDATE_DELAY = 50;
-
- /**
- * Regular expression used to validate the year input
- * @property YAHOO.widget.CalendarNavigator.YR_PATTERN
- * @static
- * @type RegExp
- */
- CN.YR_PATTERN = /^\d+$/;
- /**
- * Regular expression used to trim strings
- * @property YAHOO.widget.CalendarNavigator.TRIM
- * @static
- * @type RegExp
- */
- CN.TRIM = /^\s*(.*?)\s*$/;
-})();
-
-YAHOO.widget.CalendarNavigator.prototype = {
-
- /**
- * The unique ID for this CalendarNavigator instance
- * @property id
- * @type String
- */
- id : null,
-
- /**
- * The Calendar/CalendarGroup instance to which the navigator belongs
- * @property cal
- * @type {Calendar|CalendarGroup}
- */
- cal : null,
-
- /**
- * Reference to the HTMLElement used to render the navigator's bounding box
- * @property navEl
- * @type HTMLElement
- */
- navEl : null,
-
- /**
- * Reference to the HTMLElement used to render the navigator's mask
- * @property maskEl
- * @type HTMLElement
- */
- maskEl : null,
-
- /**
- * Reference to the HTMLElement used to input the year
- * @property yearEl
- * @type HTMLElement
- */
- yearEl : null,
-
- /**
- * Reference to the HTMLElement used to input the month
- * @property monthEl
- * @type HTMLElement
- */
- monthEl : null,
-
- /**
- * Reference to the HTMLElement used to display validation errors
- * @property errorEl
- * @type HTMLElement
- */
- errorEl : null,
-
- /**
- * Reference to the HTMLElement used to update the Calendar/Calendar group
- * with the month/year values
- * @property submitEl
- * @type HTMLElement
- */
- submitEl : null,
-
- /**
- * Reference to the HTMLElement used to hide the navigator without updating the
- * Calendar/Calendar group
- * @property cancelEl
- * @type HTMLElement
- */
- cancelEl : null,
-
- /**
- * Reference to the first focusable control in the navigator (by default monthEl)
- * @property firstCtrl
- * @type HTMLElement
- */
- firstCtrl : null,
-
- /**
- * Reference to the last focusable control in the navigator (by default cancelEl)
- * @property lastCtrl
- * @type HTMLElement
- */
- lastCtrl : null,
-
- /**
- * The document containing the Calendar/Calendar group instance
- * @protected
- * @property _doc
- * @type HTMLDocument
- */
- _doc : null,
-
- /**
- * Internal state property for the current year displayed in the navigator
- * @protected
- * @property _year
- * @type Number
- */
- _year: null,
-
- /**
- * Internal state property for the current month index displayed in the navigator
- * @protected
- * @property _month
- * @type Number
- */
- _month: 0,
-
- /**
- * Private internal state property which indicates whether or not the
- * Navigator has been rendered.
- * @private
- * @property __rendered
- * @type Boolean
- */
- __rendered: false,
-
- /**
- * Init lifecycle method called as part of construction
- *
- * @method init
- * @param {Calendar} cal The instance of the Calendar or CalendarGroup to which this CalendarNavigator should be attached
- */
- init : function(cal) {
- var calBox = cal.oDomContainer;
-
- this.cal = cal;
- this.id = calBox.id + YAHOO.widget.CalendarNavigator.ID_SUFFIX;
- this._doc = calBox.ownerDocument;
-
- /**
- * Private flag, to identify IE Quirks
- * @private
- * @property __isIEQuirks
- */
- var ie = YAHOO.env.ua.ie;
- this.__isIEQuirks = (ie && ((ie <= 6) || (this._doc.compatMode == "BackCompat")));
- },
-
- /**
- * Displays the navigator and mask, updating the input controls to reflect the
- * currently set month and year. The show method will invoke the render method
- * if the navigator has not been renderered already, allowing for lazy rendering
- * of the control.
- *
- * The show method will fire the Calendar/CalendarGroup's beforeShowNav and showNav events
- *
- * @method show
- */
- show : function() {
- var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
-
- if (this.cal.beforeShowNavEvent.fire()) {
- if (!this.__rendered) {
- this.render();
- }
- this.clearErrors();
-
- this._updateMonthUI();
- this._updateYearUI();
- this._show(this.navEl, true);
-
- this.setInitialFocus();
- this.showMask();
-
- YAHOO.util.Dom.addClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
- this.cal.showNavEvent.fire();
- }
- },
-
- /**
- * Hides the navigator and mask
- *
- * The show method will fire the Calendar/CalendarGroup's beforeHideNav event and hideNav events
- * @method hide
- */
- hide : function() {
- var CLASSES = YAHOO.widget.CalendarNavigator.CLASSES;
-
- if (this.cal.beforeHideNavEvent.fire()) {
- this._show(this.navEl, false);
- this.hideMask();
- YAHOO.util.Dom.removeClass(this.cal.oDomContainer, CLASSES.NAV_VISIBLE);
- this.cal.hideNavEvent.fire();
- }
- },
-
-
- /**
- * Displays the navigator's mask element
- *
- * @method showMask
- */
- showMask : function() {
- this._show(this.maskEl, true);
- if (this.__isIEQuirks) {
- this._syncMask();
- }
- },
-
- /**
- * Hides the navigator's mask element
- *
- * @method hideMask
- */
- hideMask : function() {
- this._show(this.maskEl, false);
- },
-
- /**
- * Returns the current month set on the navigator
- *
- * Note: This may not be the month set in the UI, if
- * the UI contains an invalid value.
- *
- * @method getMonth
- * @return {Number} The Navigator's current month index
- */
- getMonth: function() {
- return this._month;
- },
-
- /**
- * Returns the current year set on the navigator
- *
- * Note: This may not be the year set in the UI, if
- * the UI contains an invalid value.
- *
- * @method getYear
- * @return {Number} The Navigator's current year value
- */
- getYear: function() {
- return this._year;
- },
-
- /**
- * Sets the current month on the Navigator, and updates the UI
- *
- * @method setMonth
- * @param {Number} nMonth The month index, from 0 (Jan) through 11 (Dec).
- */
- setMonth : function(nMonth) {
- if (nMonth >= 0 && nMonth < 12) {
- this._month = nMonth;
- }
- this._updateMonthUI();
- },
-
- /**
- * Sets the current year on the Navigator, and updates the UI. If the
- * provided year is invalid, it will not be set.
- *
- * @method setYear
- * @param {Number} nYear The full year value to set the Navigator to.
- */
- setYear : function(nYear) {
- var yrPattern = YAHOO.widget.CalendarNavigator.YR_PATTERN;
- if (YAHOO.lang.isNumber(nYear) && yrPattern.test(nYear+"")) {
- this._year = nYear;
- }
- this._updateYearUI();
- },
-
- /**
- * Renders the HTML for the navigator, adding it to the
- * document and attaches event listeners if it has not
- * already been rendered.
- *
- * @method render
- */
- render: function() {
- this.cal.beforeRenderNavEvent.fire();
- if (!this.__rendered) {
- this.createNav();
- this.createMask();
- this.applyListeners();
- this.__rendered = true;
- }
- this.cal.renderNavEvent.fire();
- },
-
- /**
- * Creates the navigator's containing HTMLElement, it's contents, and appends
- * the containg element to the Calendar/CalendarGroup's container.
- *
- * @method createNav
- */
- createNav : function() {
- var NAV = YAHOO.widget.CalendarNavigator;
- var doc = this._doc;
-
- var d = doc.createElement("div");
- d.className = NAV.CLASSES.NAV;
-
- var htmlBuf = this.renderNavContents([]);
-
- d.innerHTML = htmlBuf.join('');
- this.cal.oDomContainer.appendChild(d);
-
- this.navEl = d;
-
- this.yearEl = doc.getElementById(this.id + NAV.YEAR_SUFFIX);
- this.monthEl = doc.getElementById(this.id + NAV.MONTH_SUFFIX);
- this.errorEl = doc.getElementById(this.id + NAV.ERROR_SUFFIX);
- this.submitEl = doc.getElementById(this.id + NAV.SUBMIT_SUFFIX);
- this.cancelEl = doc.getElementById(this.id + NAV.CANCEL_SUFFIX);
-
- if (YAHOO.env.ua.gecko && this.yearEl && this.yearEl.type == "text") {
- // Avoid XUL error on focus, select [ https://bugzilla.mozilla.org/show_bug.cgi?id=236791,
- // supposedly fixed in 1.8.1, but there are reports of it still being around for methods other than blur ]
- this.yearEl.setAttribute("autocomplete", "off");
- }
-
- this._setFirstLastElements();
- },
-
- /**
- * Creates the Mask HTMLElement and appends it to the Calendar/CalendarGroups
- * container.
- *
- * @method createMask
- */
- createMask : function() {
- var C = YAHOO.widget.CalendarNavigator.CLASSES;
-
- var d = this._doc.createElement("div");
- d.className = C.MASK;
-
- this.cal.oDomContainer.appendChild(d);
- this.maskEl = d;
- },
-
- /**
- * Used to set the width/height of the mask in pixels to match the Calendar Container.
- * Currently only used for IE6 or IE in quirks mode. The other A-Grade browser are handled using CSS (width/height 100%).
- *
- * The method is also registered as an HTMLElement resize listener on the Calendars container element.
- *
- * @protected
- * @method _syncMask
- */
- _syncMask : function() {
- var c = this.cal.oDomContainer;
- if (c && this.maskEl) {
- var r = YAHOO.util.Dom.getRegion(c);
- YAHOO.util.Dom.setStyle(this.maskEl, "width", r.right - r.left + "px");
- YAHOO.util.Dom.setStyle(this.maskEl, "height", r.bottom - r.top + "px");
- }
- },
-
- /**
- * Renders the contents of the navigator. NOTE: The contents of the array passed into this method are added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
- * @method renderNavContents
- *
- * @param {HTML[]} html The HTML buffer to append the HTML to.
- * @return {HTML[]} A reference to the buffer passed in.
- */
- renderNavContents : function(html) {
- var NAV = YAHOO.widget.CalendarNavigator,
- C = NAV.CLASSES,
- h = html; // just to use a shorter name
-
- h[h.length] = '
';
- this.renderMonth(h);
- h[h.length] = '
';
- h[h.length] = '
';
- this.renderYear(h);
- h[h.length] = '
';
- h[h.length] = '
';
- this.renderButtons(h);
- h[h.length] = '
';
- h[h.length] = '';
-
- return h;
- },
-
- /**
- * Renders the month label and control for the navigator. NOTE: The contents of the array passed into this method are added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
- * @method renderNavContents
- * @param {HTML[]} html The HTML buffer to append the HTML to.
- * @return {HTML[]} A reference to the buffer passed in.
- */
- renderMonth : function(html) {
- var NAV = YAHOO.widget.CalendarNavigator,
- C = NAV.CLASSES;
-
- var id = this.id + NAV.MONTH_SUFFIX,
- mf = this.__getCfg("monthFormat"),
- months = this.cal.cfg.getProperty((mf == YAHOO.widget.Calendar.SHORT) ? "MONTHS_SHORT" : "MONTHS_LONG"),
- h = html;
-
- if (months && months.length > 0) {
- h[h.length] = '';
- h[h.length] = '';
- }
- return h;
- },
-
- /**
- * Renders the year label and control for the navigator. NOTE: The contents of the array passed into this method are added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
- * @method renderYear
- * @param {Array} html The HTML buffer to append the HTML to.
- * @return {Array} A reference to the buffer passed in.
- */
- renderYear : function(html) {
- var NAV = YAHOO.widget.CalendarNavigator,
- C = NAV.CLASSES;
-
- var id = this.id + NAV.YEAR_SUFFIX,
- size = NAV.YR_MAX_DIGITS,
- h = html;
-
- h[h.length] = '';
- h[h.length] = '';
- return h;
- },
-
- /**
- * Renders the submit/cancel buttons for the navigator. NOTE: The contents of the array passed into this method are added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- *
- * @method renderButtons
- * @param {Array} html The HTML buffer to append the HTML to.
- * @return {Array} A reference to the buffer passed in.
- */
- renderButtons : function(html) {
- var C = YAHOO.widget.CalendarNavigator.CLASSES;
- var h = html;
-
- h[h.length] = '';
- h[h.length] = '';
- h[h.length] = '';
- h[h.length] = '';
- h[h.length] = '';
- h[h.length] = '';
-
- return h;
- },
-
- /**
- * Attaches DOM event listeners to the rendered elements
- *
- * The method will call applyKeyListeners, to setup keyboard specific
- * listeners
- *
- * @method applyListeners
- */
- applyListeners : function() {
- var E = YAHOO.util.Event;
-
- function yearUpdateHandler() {
- if (this.validate()) {
- this.setYear(this._getYearFromUI());
- }
- }
-
- function monthUpdateHandler() {
- this.setMonth(this._getMonthFromUI());
- }
-
- E.on(this.submitEl, "click", this.submit, this, true);
- E.on(this.cancelEl, "click", this.cancel, this, true);
- E.on(this.yearEl, "blur", yearUpdateHandler, this, true);
- E.on(this.monthEl, "change", monthUpdateHandler, this, true);
-
- if (this.__isIEQuirks) {
- YAHOO.util.Event.on(this.cal.oDomContainer, "resize", this._syncMask, this, true);
- }
-
- this.applyKeyListeners();
- },
-
- /**
- * Removes/purges DOM event listeners from the rendered elements
- *
- * @method purgeListeners
- */
- purgeListeners : function() {
- var E = YAHOO.util.Event;
- E.removeListener(this.submitEl, "click", this.submit);
- E.removeListener(this.cancelEl, "click", this.cancel);
- E.removeListener(this.yearEl, "blur");
- E.removeListener(this.monthEl, "change");
- if (this.__isIEQuirks) {
- E.removeListener(this.cal.oDomContainer, "resize", this._syncMask);
- }
-
- this.purgeKeyListeners();
- },
-
- /**
- * Attaches DOM listeners for keyboard support.
- * Tab/Shift-Tab looping, Enter Key Submit on Year element,
- * Up/Down/PgUp/PgDown year increment on Year element
- *
- * NOTE: MacOSX Safari 2.x doesn't let you tab to buttons and
- * MacOSX Gecko does not let you tab to buttons or select controls,
- * so for these browsers, Tab/Shift-Tab looping is limited to the
- * elements which can be reached using the tab key.
- *
- * @method applyKeyListeners
- */
- applyKeyListeners : function() {
- var E = YAHOO.util.Event,
- ua = YAHOO.env.ua;
-
- // IE/Safari 3.1 doesn't fire keypress for arrow/pg keys (non-char keys)
- var arrowEvt = (ua.ie || ua.webkit) ? "keydown" : "keypress";
-
- // - IE/Safari 3.1 doesn't fire keypress for non-char keys
- // - Opera doesn't allow us to cancel keydown or keypress for tab, but
- // changes focus successfully on keydown (keypress is too late to change focus - opera's already moved on).
- var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown" : "keypress";
-
- // Everyone likes keypress for Enter (char keys) - whoo hoo!
- E.on(this.yearEl, "keypress", this._handleEnterKey, this, true);
-
- E.on(this.yearEl, arrowEvt, this._handleDirectionKeys, this, true);
- E.on(this.lastCtrl, tabEvt, this._handleTabKey, this, true);
- E.on(this.firstCtrl, tabEvt, this._handleShiftTabKey, this, true);
- },
-
- /**
- * Removes/purges DOM listeners for keyboard support
- *
- * @method purgeKeyListeners
- */
- purgeKeyListeners : function() {
- var E = YAHOO.util.Event,
- ua = YAHOO.env.ua;
-
- var arrowEvt = (ua.ie || ua.webkit) ? "keydown" : "keypress";
- var tabEvt = (ua.ie || ua.opera || ua.webkit) ? "keydown" : "keypress";
-
- E.removeListener(this.yearEl, "keypress", this._handleEnterKey);
- E.removeListener(this.yearEl, arrowEvt, this._handleDirectionKeys);
- E.removeListener(this.lastCtrl, tabEvt, this._handleTabKey);
- E.removeListener(this.firstCtrl, tabEvt, this._handleShiftTabKey);
- },
-
- /**
- * Updates the Calendar/CalendarGroup's pagedate with the currently set month and year if valid.
- *
- * If the currently set month/year is invalid, a validation error will be displayed and the
- * Calendar/CalendarGroup's pagedate will not be updated.
- *
- * @method submit
- */
- submit : function() {
- if (this.validate()) {
- this.hide();
-
- this.setMonth(this._getMonthFromUI());
- this.setYear(this._getYearFromUI());
-
- var cal = this.cal;
-
- // Artificial delay, just to help the user see something changed
- var delay = YAHOO.widget.CalendarNavigator.UPDATE_DELAY;
- if (delay > 0) {
- var nav = this;
- window.setTimeout(function(){ nav._update(cal); }, delay);
- } else {
- this._update(cal);
- }
- }
- },
-
- /**
- * Updates the Calendar rendered state, based on the state of the CalendarNavigator
- * @method _update
- * @param cal The Calendar instance to update
- * @protected
- */
- _update : function(cal) {
- var date = YAHOO.widget.DateMath.getDate(this.getYear() - cal.cfg.getProperty("YEAR_OFFSET"), this.getMonth(), 1);
- cal.cfg.setProperty("pagedate", date);
- cal.render();
- },
-
- /**
- * Hides the navigator and mask, without updating the Calendar/CalendarGroup's state
- *
- * @method cancel
- */
- cancel : function() {
- this.hide();
- },
-
- /**
- * Validates the current state of the UI controls
- *
- * @method validate
- * @return {Boolean} true, if the current UI state contains valid values, false if not
- */
- validate : function() {
- if (this._getYearFromUI() !== null) {
- this.clearErrors();
- return true;
- } else {
- this.setYearError();
- this.setError(this.__getCfg("invalidYear", true));
- return false;
- }
- },
-
- /**
- * Displays an error message in the Navigator's error panel.
- *
- * @method setError
- * @param {HTML} msg The markup for the error message to display. NOTE: The msg passed into this method is added to the DOM as HTML, and should be escaped by the implementor if coming from an external source.
- */
- setError : function(msg) {
- if (this.errorEl) {
- this.errorEl.innerHTML = msg;
- this._show(this.errorEl, true);
- }
- },
-
- /**
- * Clears the navigator's error message and hides the error panel
- * @method clearError
- */
- clearError : function() {
- if (this.errorEl) {
- this.errorEl.innerHTML = "";
- this._show(this.errorEl, false);
- }
- },
-
- /**
- * Displays the validation error UI for the year control
- * @method setYearError
- */
- setYearError : function() {
- YAHOO.util.Dom.addClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
- },
-
- /**
- * Removes the validation error UI for the year control
- * @method clearYearError
- */
- clearYearError : function() {
- YAHOO.util.Dom.removeClass(this.yearEl, YAHOO.widget.CalendarNavigator.CLASSES.INVALID);
- },
-
- /**
- * Clears all validation and error messages in the UI
- * @method clearErrors
- */
- clearErrors : function() {
- this.clearError();
- this.clearYearError();
- },
-
- /**
- * Sets the initial focus, based on the configured value
- * @method setInitialFocus
- */
- setInitialFocus : function() {
- var el = this.submitEl,
- f = this.__getCfg("initialFocus");
-
- if (f && f.toLowerCase) {
- f = f.toLowerCase();
- if (f == "year") {
- el = this.yearEl;
- try {
- this.yearEl.select();
- } catch (selErr) {
- // Ignore;
- }
- } else if (f == "month") {
- el = this.monthEl;
- }
- }
-
- if (el && YAHOO.lang.isFunction(el.focus)) {
- try {
- el.focus();
- } catch (focusErr) {
- // TODO: Fall back if focus fails?
- }
- }
- },
-
- /**
- * Removes all renderered HTML elements for the Navigator from
- * the DOM, purges event listeners and clears (nulls) any property
- * references to HTML references
- * @method erase
- */
- erase : function() {
- if (this.__rendered) {
- this.purgeListeners();
-
- // Clear out innerHTML references
- this.yearEl = null;
- this.monthEl = null;
- this.errorEl = null;
- this.submitEl = null;
- this.cancelEl = null;
- this.firstCtrl = null;
- this.lastCtrl = null;
- if (this.navEl) {
- this.navEl.innerHTML = "";
- }
-
- var p = this.navEl.parentNode;
- if (p) {
- p.removeChild(this.navEl);
- }
- this.navEl = null;
-
- var pm = this.maskEl.parentNode;
- if (pm) {
- pm.removeChild(this.maskEl);
- }
- this.maskEl = null;
- this.__rendered = false;
- }
- },
-
- /**
- * Destroys the Navigator object and any HTML references
- * @method destroy
- */
- destroy : function() {
- this.erase();
- this._doc = null;
- this.cal = null;
- this.id = null;
- },
-
- /**
- * Protected implementation to handle how UI elements are
- * hidden/shown.
- *
- * @method _show
- * @protected
- */
- _show : function(el, bShow) {
- if (el) {
- YAHOO.util.Dom.setStyle(el, "display", (bShow) ? "block" : "none");
- }
- },
-
- /**
- * Returns the month value (index), from the month UI element
- * @protected
- * @method _getMonthFromUI
- * @return {Number} The month index, or 0 if a UI element for the month
- * is not found
- */
- _getMonthFromUI : function() {
- if (this.monthEl) {
- return this.monthEl.selectedIndex;
- } else {
- return 0; // Default to Jan
- }
- },
-
- /**
- * Returns the year value, from the Navitator's year UI element
- * @protected
- * @method _getYearFromUI
- * @return {Number} The year value set in the UI, if valid. null is returned if
- * the UI does not contain a valid year value.
- */
- _getYearFromUI : function() {
- var NAV = YAHOO.widget.CalendarNavigator;
-
- var yr = null;
- if (this.yearEl) {
- var value = this.yearEl.value;
- value = value.replace(NAV.TRIM, "$1");
-
- if (NAV.YR_PATTERN.test(value)) {
- yr = parseInt(value, 10);
- }
- }
- return yr;
- },
-
- /**
- * Updates the Navigator's year UI, based on the year value set on the Navigator object
- * @protected
- * @method _updateYearUI
- */
- _updateYearUI : function() {
- if (this.yearEl && this._year !== null) {
- this.yearEl.value = this._year;
- }
- },
-
- /**
- * Updates the Navigator's month UI, based on the month value set on the Navigator object
- * @protected
- * @method _updateMonthUI
- */
- _updateMonthUI : function() {
- if (this.monthEl) {
- this.monthEl.selectedIndex = this._month;
- }
- },
-
- /**
- * Sets up references to the first and last focusable element in the Navigator's UI
- * in terms of tab order (Naviagator's firstEl and lastEl properties). The references
- * are used to control modality by looping around from the first to the last control
- * and visa versa for tab/shift-tab navigation.
- *
- * @protected
- * @method _setFirstLastElements
- */
- _setFirstLastElements : function() {
- this.firstCtrl = this.monthEl;
- this.lastCtrl = this.cancelEl;
-
- // Special handling for MacOSX.
- // - Safari 2.x can't focus on buttons
- // - Gecko can't focus on select boxes or buttons
- if (this.__isMac) {
- if (YAHOO.env.ua.webkit && YAHOO.env.ua.webkit < 420){
- this.firstCtrl = this.monthEl;
- this.lastCtrl = this.yearEl;
- }
- if (YAHOO.env.ua.gecko) {
- this.firstCtrl = this.yearEl;
- this.lastCtrl = this.yearEl;
- }
- }
- },
-
- /**
- * Default Keyboard event handler to capture Enter
- * on the Navigator's year control (yearEl)
- *
- * @method _handleEnterKey
- * @protected
- * @param {Event} e The DOM event being handled
- */
- _handleEnterKey : function(e) {
- var KEYS = YAHOO.util.KeyListener.KEY;
-
- if (YAHOO.util.Event.getCharCode(e) == KEYS.ENTER) {
- YAHOO.util.Event.preventDefault(e);
- this.submit();
- }
- },
-
- /**
- * Default Keyboard event handler to capture up/down/pgup/pgdown
- * on the Navigator's year control (yearEl).
- *
- * @method _handleDirectionKeys
- * @protected
- * @param {Event} e The DOM event being handled
- */
- _handleDirectionKeys : function(e) {
- var E = YAHOO.util.Event,
- KEYS = YAHOO.util.KeyListener.KEY,
- NAV = YAHOO.widget.CalendarNavigator;
-
- var value = (this.yearEl.value) ? parseInt(this.yearEl.value, 10) : null;
- if (isFinite(value)) {
- var dir = false;
- switch(E.getCharCode(e)) {
- case KEYS.UP:
- this.yearEl.value = value + NAV.YR_MINOR_INC;
- dir = true;
- break;
- case KEYS.DOWN:
- this.yearEl.value = Math.max(value - NAV.YR_MINOR_INC, 0);
- dir = true;
- break;
- case KEYS.PAGE_UP:
- this.yearEl.value = value + NAV.YR_MAJOR_INC;
- dir = true;
- break;
- case KEYS.PAGE_DOWN:
- this.yearEl.value = Math.max(value - NAV.YR_MAJOR_INC, 0);
- dir = true;
- break;
- default:
- break;
- }
- if (dir) {
- E.preventDefault(e);
- try {
- this.yearEl.select();
- } catch(err) {
- // Ignore
- }
- }
- }
- },
-
- /**
- * Default Keyboard event handler to capture Tab
- * on the last control (lastCtrl) in the Navigator.
- *
- * @method _handleTabKey
- * @protected
- * @param {Event} e The DOM event being handled
- */
- _handleTabKey : function(e) {
- var E = YAHOO.util.Event,
- KEYS = YAHOO.util.KeyListener.KEY;
-
- if (E.getCharCode(e) == KEYS.TAB && !e.shiftKey) {
- try {
- E.preventDefault(e);
- this.firstCtrl.focus();
- } catch (err) {
- // Ignore - mainly for focus edge cases
- }
- }
- },
-
- /**
- * Default Keyboard event handler to capture Shift-Tab
- * on the first control (firstCtrl) in the Navigator.
- *
- * @method _handleShiftTabKey
- * @protected
- * @param {Event} e The DOM event being handled
- */
- _handleShiftTabKey : function(e) {
- var E = YAHOO.util.Event,
- KEYS = YAHOO.util.KeyListener.KEY;
-
- if (e.shiftKey && E.getCharCode(e) == KEYS.TAB) {
- try {
- E.preventDefault(e);
- this.lastCtrl.focus();
- } catch (err) {
- // Ignore - mainly for focus edge cases
- }
- }
- },
-
- /**
- * Retrieve Navigator configuration values from
- * the parent Calendar/CalendarGroup's config value.
- *
- * If it has not been set in the user provided configuration, the method will
- * return the default value of the configuration property, as set in DEFAULT_CONFIG
- *
- * @private
- * @method __getCfg
- * @param {String} Case sensitive property name.
- * @param {Boolean} true, if the property is a string property, false if not.
- * @return The value of the configuration property
- */
- __getCfg : function(prop, bIsStr) {
- var DEF_CFG = YAHOO.widget.CalendarNavigator.DEFAULT_CONFIG;
- var cfg = this.cal.cfg.getProperty("navigator");
-
- if (bIsStr) {
- return (cfg !== true && cfg.strings && cfg.strings[prop]) ? cfg.strings[prop] : DEF_CFG.strings[prop];
- } else {
- return (cfg !== true && cfg[prop]) ? cfg[prop] : DEF_CFG[prop];
- }
- },
-
- /**
- * Private flag, to identify MacOS
- * @private
- * @property __isMac
- */
- __isMac : (navigator.userAgent.toLowerCase().indexOf("macintosh") != -1)
-
-};
-YAHOO.register("calendar", YAHOO.widget.Calendar, {version: "2.9.0", build: "2800"});
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/icon1.gif b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/icon1.gif
deleted file mode 100644
index c5e5c044b91..00000000000
Binary files a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/icon1.gif and /dev/null differ
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/icon2.gif b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/icon2.gif
deleted file mode 100644
index b7d9077d454..00000000000
Binary files a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/icon2.gif and /dev/null differ
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/icon3.gif b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/icon3.gif
deleted file mode 100644
index 45a24662c36..00000000000
Binary files a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/icon3.gif and /dev/null differ
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/wicket-date.js b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/wicket-date.js
deleted file mode 100644
index 9a84fc38e4d..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/calendar/wicket-date.js
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * Wicket Date parse function for the Calendar/ Date picker component.
- */
-
-/*globals YAHOO: true */
-
-;(function (undefined) {
- 'use strict';
-
- // Wicket Namespace
-
- if (typeof(Wicket) === "undefined") {
- window.Wicket = {};
- }
-
- Wicket.DateTime = {};
-
- /**
- * Parses date from simple date pattern.
- *
- * Supports patterns built up from the following elements:
- * yy OR yyyy for year
- * M OR MM OR MMM OR MMMM for month
- * d OR dd for day
- * EEEE for weekday (optional)
- */
- Wicket.DateTime.parseDate = function(cfg, value) {
- var numbers = value.match(/(\d+)/g);
- var pattern = cfg.datePattern;
- if (!numbers) {
- return NaN;
- }
-
- var day, month, year;
- var arrayPos = 0;
- for (var i = 0; i < pattern.length; i++) {
- var c = pattern.charAt(i);
- var len = 0;
- while ((pattern.charAt(i) === c) && (i < pattern.length)) {
- i++;
- len++;
- }
- if (c === 'y') {
- year = numbers[arrayPos++];
- } else if (c === 'M') {
- var nameArray;
- switch (len) {
- case 3:
- nameArray = cfg.calendarInit.MONTHS_SHORT;
- break;
- case 4:
- nameArray = cfg.calendarInit.MONTHS_LONG;
- break;
- default:
- nameArray = null;
- }
- if (nameArray) {
- for (var j = 0; j < nameArray.length; j++) {
- if (value.indexOf(nameArray[j]) >= 0) {
- month = j + 1;
- break;
- }
- }
- } else {
- month = numbers[arrayPos++];
- }
- } else if (c === 'd') {
- day = numbers[arrayPos++];
- }
- if (arrayPos > 2) {
- break;
- }
- }
- // TODO this is a bit crude. Make nicer some time.
- if (year < 100) {
- if (year < 70) {
- year = year * 1 + 2000;
- } else {
- year = year * 1 + 1900;
- }
- }
- var date = new Date();
- date.setHours(0);
- date.setMinutes(0);
- date.setSeconds(0);
- date.setMilliseconds(0);
- date.setFullYear(year, (month - 1), day);
-
- return date;
- };
-
- /**
- * Returns a string containing the value, with a leading zero if the value is < 10.
- */
- Wicket.DateTime.padDateFragment = function(value) {
- return (value < 10 ? "0" : "") + value;
- };
-
- /**
- * Gets the height of the displayed area of the window, as YAHOO.util.Dom.getViewportHeight()
- * has issues with Firefox.
- * See http://tech.groups.yahoo.com/group/ydn-javascript/message/5850
- * Implementation taken from: http://www.quirksmode.org/viewport/compatibility.html#link2
- */
- Wicket.DateTime.getViewportHeight = function() {
- var viewPortHeight;
-
- if (window.innerHeight) {// all browsers except IE
- viewPortHeight = window.innerHeight;
- } else if (document.documentElement && document.documentElement.clientHeight) {// IE 6 strict mode
- viewPortHeight = document.documentElement.clientHeight;
- } else if (document.body) {// other IEs
- viewPortHeight = document.body.clientHeight;
- }
- return viewPortHeight;
- };
-
- /**
- * Position subject relative to target top-left by default.
- * If there is too little space on the right side/bottom,
- * the datepicker's position is corrected so that the right side/bottom
- * is aligned with the display area's right side/bottom.
- * @param subject the dom element to has to be positioned
- * @param target id of the dom element to position relative to
- */
- Wicket.DateTime.positionRelativeTo = function(subject, target) {
-
- var targetPos = YAHOO.util.Dom.getXY(target);
- var targetHeight = YAHOO.util.Dom.get(target).offsetHeight;
- var subjectHeight = YAHOO.util.Dom.get(subject).offsetHeight;
- var subjectWidth = YAHOO.util.Dom.get(subject).offsetWidth;
-
- var viewPortHeight = Wicket.DateTime.getViewportHeight();
- var viewPortWidth = YAHOO.util.Dom.getViewportWidth();
-
- // also take scroll position into account
- var scrollPos = [YAHOO.util.Dom.getDocumentScrollLeft(), YAHOO.util.Dom.getDocumentScrollTop()];
-
- // correct datepicker's position so that it isn't rendered off screen on the right side or bottom
- if (targetPos[0] + subjectWidth > scrollPos[0] + viewPortWidth) {
- // correct horizontal position
- YAHOO.util.Dom.setX(subject, Math.max(targetPos[0], viewPortWidth) - subjectWidth);
- } else {
- YAHOO.util.Dom.setX(subject, targetPos[0]);
- }
- if (targetPos[1] + targetHeight + 1 + subjectHeight > scrollPos[1] + viewPortHeight) {
- // correct vertical position
- YAHOO.util.Dom.setY(subject, Math.max(targetPos[1], viewPortHeight) - subjectHeight);
- } else {
- YAHOO.util.Dom.setY(subject, targetPos[1] + targetHeight + 1);
- }
- };
-
- /**
- * Return the result of interpolating the value (datetime) argument with the date pattern.
- * The date has to be an array, where year is in the first, month in the second
- * and date (day of month) in the third slot.
- */
- Wicket.DateTime.substituteDate = function(cfg, datetime) {
- var day = datetime[2];
- var month = datetime[1];
- var year = datetime[0];
-
- var date = new Date();
- date.setHours(0);
- date.setMinutes(0);
- date.setSeconds(0);
- date.setMilliseconds(0);
- date.setFullYear(year, (month - 1), day);
-
- var dayName = null;
- var datePattern = cfg.datePattern;
-
- // optionally do some padding to match the pattern
- if(datePattern.match(/dd+/)) {
- day = Wicket.DateTime.padDateFragment(day);
- }
- if (datePattern.match(/MMMM/)) {
- month = cfg.calendarInit.MONTHS_LONG[month - 1];
- }
- else if (datePattern.match(/MMM/)) {
- month = cfg.calendarInit.MONTHS_SHORT[month - 1];
- }
- else if(datePattern.match(/MM+/)) {
- month = Wicket.DateTime.padDateFragment(month);
- }
- if(datePattern.match(/yyy+/)) {
- year = Wicket.DateTime.padDateFragment(year);
- } else if(datePattern.match(/yy+/)) {
- year = Wicket.DateTime.padDateFragment(year % 100);
- }
- if (datePattern.match(/EEEE/)) {
- // figure out which weekday it is...
- var engDayName = date.toString().match(/(\S*)/)[0];
- var engDayNames = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
- for (var i = 0; i < engDayNames.length; i++) {
- if (engDayName === engDayNames[i]) {
- dayName = cfg.calendarInit.WEEKDAYS_LONG[i];
- break;
- }
- }
- }
- // replace pattern with real values
- var result = datePattern.replace(/d+/, day).replace(/y+/, year).replace(/M+/, month);
-
- if (dayName != null) {
- result = result.replace(/EEEE/, dayName);
- }
-
- return result;
- };
-
- /**
- * Display the YUI calendar widget. If the date is not null (should be a string) then it is parsed
- * using the provided date pattern, and set as the current date on the widget.
- */
- Wicket.DateTime.showCalendar = function(widget, date, cfg) {
- if (date) {
- date = Wicket.DateTime.parseDate(cfg, date);
- if (!isNaN(date)) {
- widget.select(date);
- var firstDate = widget.getSelectedDates()[0];
- if (firstDate) {
- widget.cfg.setProperty("pagedate", (firstDate.getMonth() + 1) + "/" + firstDate.getFullYear());
- widget.render();
- }
- }
- }
- widget.show();
- };
-
- // configures a datepicker using the cfg object
- Wicket.DateTime.init = function(cfg) {
- cfg.dpJs = cfg.widgetId + "DpJs";
- cfg.dp = cfg.widgetId + "Dp";
- cfg.icon = cfg.widgetId +"Icon";
- YAHOO.namespace("wicket");
-
- if (cfg.calendarInit.pages && cfg.calendarInit.pages > 1) {
- YAHOO.wicket[cfg.dpJs] = new YAHOO.widget.CalendarGroup(cfg.dpJs,cfg.dp, cfg.calendarInit);
- } else {
- YAHOO.wicket[cfg.dpJs] = new YAHOO.widget.Calendar(cfg.dpJs,cfg.dp, cfg.calendarInit);
- }
- YAHOO.wicket[cfg.dpJs].isVisible = function() { return YAHOO.wicket[cfg.dpJs].oDomContainer.style.display === 'block'; };
-
- function showCalendar() {
- if (YAHOO.wicket[cfg.dpJs].oDomContainer.style.display !== 'block') {
- Wicket.DateTime.showCalendar(YAHOO.wicket[cfg.dpJs], YAHOO.util.Dom.get(cfg.componentId).value, cfg);
- if (cfg.alignWithIcon) {
- Wicket.DateTime.positionRelativeTo(YAHOO.wicket[cfg.dpJs].oDomContainer, cfg.icon);
- }
- }
- }
-
- YAHOO.util.Event.addListener(cfg.icon, "click", showCalendar, YAHOO.wicket[cfg.dpJs], true);
-
- if (cfg.showOnFieldClick) {
- YAHOO.util.Event.addListener(cfg.widgetId, "click", showCalendar, YAHOO.wicket[cfg.dpJs], true);
- }
-
- YAHOO.wicket[cfg.dpJs].cfg.setProperty(YAHOO.widget.Calendar.DEFAULT_CONFIG.STRINGS.key, {"close": cfg.closeLabel});
-
- function selectHandler(type, args, cal) {
- YAHOO.util.Dom.get(cfg.componentId).value = Wicket.DateTime.substituteDate(cfg, args[0][0]);
- if (cal.isVisible()) {
- if (cfg.hideOnSelect) {
- cal.hide();
- }
- if (cfg.fireChangeEvent) {
- var field = YAHOO.util.Dom.get(cfg.componentId);
- if (field.onchangeoriginal) {
- field.onchangeoriginal();
- }
- if (field.onchange) {
- field.onchange();
- }
- Wicket.Event.fire(Wicket.$(cfg.componentId), 'change');
- }
- }
- }
-
- YAHOO.wicket[cfg.dpJs].selectEvent.subscribe(selectHandler, YAHOO.wicket[cfg.dpJs]);
-
- if(cfg.autoHide) {
- YAHOO.util.Event.on(document, "click", function(e) {
-
- var el = YAHOO.util.Event.getTarget(e);
- var dialogEl = document.getElementById(cfg.dp);
- var showBtn = document.getElementById(cfg.icon);
- var fieldEl = document.getElementById(cfg.componentId);
-
- if (YAHOO.wicket[cfg.dpJs] &&
- el !== dialogEl &&
- el !== fieldEl &&
- !YAHOO.util.Dom.isAncestor(dialogEl, el) &&
- el !== showBtn &&
- !YAHOO.util.Dom.isAncestor(showBtn, el))
- {
- YAHOO.wicket[cfg.dpJs].hide();
- }
- });
- }
- YAHOO.wicket[cfg.dpJs].render();
- };
-
- /**
- * Checks that `str` ends with `suffix`
- * @param str The string to check
- * @param suffix The suffix with which the `srt` must end
- * @return {boolean} true if the `str` ends with `suffix`
- */
- var endsWith = function(str, suffix) {
- return str.indexOf(suffix, str.length - suffix.length) !== -1;
- };
-
- /**
- * @param toDestroy An array of Wicket DateTime objects to destroy
- */
- var destroyInternal = function (toDestroy) {
-
- // avoids creation of a function inside a loop (JSLint warning)
- function scheduleDestroy(toDestroy2) {
- window.setTimeout(function(){destroyInternal(toDestroy2);}, 5);
- }
-
- if (toDestroy && toDestroy.length > 1) {
- var i = 0;
- while (toDestroy.length > 0) {
- var name = toDestroy.pop();
- try {
- if (YAHOO.wicket[name]) {
- // this is expensive.
- YAHOO.wicket[name].destroy();
- delete YAHOO.wicket[name];
- }
- } catch (e) {
- if (Wicket.Log) {
- Wicket.Log.error(e);
- }
- }
- i++;
- if (i === 20) {
- scheduleDestroy(toDestroy);
- break;
- }
- }
- }
- };
-
- /**
- * Schedules all YAHOO.wicket.** objects for destroy if their host HTML element
- * is no more in the DOM document.
- */
- var destroy = function() {
- if (!YAHOO.wicket) {
- return;
- }
- var deleted = 0;
- var available = 0;
- var toDestroy = [];
- for(var propertyName in YAHOO.wicket) {
- if (endsWith(propertyName, "DpJs")) {
- var id = propertyName.substring(0, propertyName.length - 4);
- var e = Wicket.$(id);
- available++;
- if (e === null) {
- try {
- deleted++;
- toDestroy.push(propertyName);
- } catch (ex) {
- if (Wicket.Log) {
- Wicket.Log.error(ex);
- }
- }
- }
- }
- }
- if (Wicket.Log) {
- Wicket.Log.info("Date pickers to delete="+deleted+", available="+available);
- }
- setTimeout(function(){destroyInternal(toDestroy);}, 5);
- };
-
- // init method variant that needs less character to invoke
- Wicket.DateTime.init2 = function(widgetId, componentId, calendarInit, datePattern,
- alignWithIcon, fireChangeEvent, hideOnSelect, showOnFieldClick, i18n, autoHide, closeLabel) {
- calendarInit.MONTHS_SHORT = i18n.MONTHS_SHORT;
- calendarInit.MONTHS_LONG = i18n.MONTHS_LONG;
- calendarInit.WEEKDAYS_MEDIUM = i18n.WEEKDAYS_MEDIUM;
- calendarInit.WEEKDAYS_LONG = i18n.WEEKDAYS_LONG;
- calendarInit.START_WEEKDAY = i18n.START_WEEKDAY;
- calendarInit.WEEKDAYS_1CHAR = i18n.WEEKDAYS_1CHAR;
- calendarInit.WEEKDAYS_SHORT = i18n.WEEKDAYS_SHORT;
-
- Wicket.DateTime.init({
- widgetId: widgetId,
- componentId: componentId,
- calendarInit: calendarInit,
- datePattern: datePattern,
- alignWithIcon: alignWithIcon,
- fireChangeEvent: fireChangeEvent,
- hideOnSelect: hideOnSelect,
- showOnFieldClick: showOnFieldClick,
- autoHide: autoHide,
- closeLabel: closeLabel
- });
- };
-
- YAHOO.register("wicket-date", Wicket.DateTime, {version: "6.7.0", build: "1"});
-
- // register a listener to clean up YAHOO.wicket cache.
- Wicket.Event.subscribe('/ajax/call/complete', function(jqEvent, attributes, jqXHR, errorThrown, textStatus) {
- window.setTimeout(function(){destroy();}, 10);
- });
-})();
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/dom/dom-min.js b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/dom/dom-min.js
deleted file mode 100644
index 194f1e8c03d..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/dom/dom-min.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/*
-Copyright (c) 2011, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.html
-version: 2.9.0
-*/
-(function(){YAHOO.env._id_counter=YAHOO.env._id_counter||0;var e=YAHOO.util,k=YAHOO.lang,L=YAHOO.env.ua,a=YAHOO.lang.trim,B={},F={},m=/^t(?:able|d|h)$/i,w=/color$/i,j=window.document,v=j.documentElement,C="ownerDocument",M="defaultView",U="documentElement",S="compatMode",z="offsetLeft",o="offsetTop",T="offsetParent",x="parentNode",K="nodeType",c="tagName",n="scrollLeft",H="scrollTop",p="getBoundingClientRect",V="getComputedStyle",y="currentStyle",l="CSS1Compat",A="BackCompat",E="class",f="className",i="",b=" ",R="(?:^|\\s)",J="(?= |$)",t="g",O="position",D="fixed",u="relative",I="left",N="top",Q="medium",P="borderLeftWidth",q="borderTopWidth",d=L.opera,h=L.webkit,g=L.gecko,s=L.ie;e.Dom={CUSTOM_ATTRIBUTES:(!v.hasAttribute)?{"for":"htmlFor","class":f}:{"htmlFor":"for","className":E},DOT_ATTRIBUTES:{checked:true},get:function(aa){var ac,X,ab,Z,W,G,Y=null;if(aa){if(typeof aa=="string"||typeof aa=="number"){ac=aa+"";aa=j.getElementById(aa);G=(aa)?aa.attributes:null;if(aa&&G&&G.id&&G.id.value===ac){return aa;}else{if(aa&&j.all){aa=null;X=j.all[ac];if(X&&X.length){for(Z=0,W=X.length;Z-1;}}else{}return G;},addClass:function(W,G){return e.Dom.batch(W,e.Dom._addClass,G);},_addClass:function(X,W){var G=false,Y;if(X&&W){Y=e.Dom._getAttribute(X,f)||i;if(!e.Dom._hasClass(X,W)){e.Dom.setAttribute(X,f,a(Y+b+W));G=true;}}else{}return G;},removeClass:function(W,G){return e.Dom.batch(W,e.Dom._removeClass,G);},_removeClass:function(Y,X){var W=false,aa,Z,G;if(Y&&X){aa=e.Dom._getAttribute(Y,f)||i;e.Dom.setAttribute(Y,f,aa.replace(e.Dom._getClassRegex(X),i));Z=e.Dom._getAttribute(Y,f);if(aa!==Z){e.Dom.setAttribute(Y,f,a(Z));W=true;if(e.Dom._getAttribute(Y,f)===""){G=(Y.hasAttribute&&Y.hasAttribute(E))?E:f;Y.removeAttribute(G);}}}else{}return W;},replaceClass:function(X,W,G){return e.Dom.batch(X,e.Dom._replaceClass,{from:W,to:G});},_replaceClass:function(Y,X){var W,ab,aa,G=false,Z;if(Y&&X){ab=X.from;aa=X.to;if(!aa){G=false;}else{if(!ab){G=e.Dom._addClass(Y,X.to);}else{if(ab!==aa){Z=e.Dom._getAttribute(Y,f)||i;W=(b+Z.replace(e.Dom._getClassRegex(ab),b+aa).replace(/\s+/g,b)).split(e.Dom._getClassRegex(aa));W.splice(1,0,b+aa);e.Dom.setAttribute(Y,f,a(W.join(i)));G=true;}}}}else{}return G;},generateId:function(G,X){X=X||"yui-gen";var W=function(Y){if(Y&&Y.id){return Y.id;}var Z=X+YAHOO.env._id_counter++;
-if(Y){if(Y[C]&&Y[C].getElementById(Z)){return e.Dom.generateId(Y,Z+X);}Y.id=Z;}return Z;};return e.Dom.batch(G,W,e.Dom,true)||W.apply(e.Dom,arguments);},isAncestor:function(W,X){W=e.Dom.get(W);X=e.Dom.get(X);var G=false;if((W&&X)&&(W[K]&&X[K])){if(W.contains&&W!==X){G=W.contains(X);}else{if(W.compareDocumentPosition){G=!!(W.compareDocumentPosition(X)&16);}}}else{}return G;},inDocument:function(G,W){return e.Dom._inDoc(e.Dom.get(G),W);},_inDoc:function(W,X){var G=false;if(W&&W[c]){X=X||W[C];G=e.Dom.isAncestor(X[U],W);}else{}return G;},getElementsBy:function(W,af,ab,ad,X,ac,ae){af=af||"*";ab=(ab)?e.Dom.get(ab):null||j;var aa=(ae)?null:[],G;if(ab){G=ab.getElementsByTagName(af);for(var Y=0,Z=G.length;Y=8){e.Dom.DOT_ATTRIBUTES.type=true;}})();YAHOO.util.Region=function(d,e,a,c){this.top=d;this.y=d;this[1]=d;this.right=e;this.bottom=a;this.left=c;this.x=c;this[0]=c;this.width=this.right-this.left;this.height=this.bottom-this.top;};YAHOO.util.Region.prototype.contains=function(a){return(a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(f){var d=Math.max(this.top,f.top),e=Math.min(this.right,f.right),a=Math.min(this.bottom,f.bottom),c=Math.max(this.left,f.left);
-if(a>=d&&e>=c){return new YAHOO.util.Region(d,e,a,c);}else{return null;}};YAHOO.util.Region.prototype.union=function(f){var d=Math.min(this.top,f.top),e=Math.max(this.right,f.right),a=Math.max(this.bottom,f.bottom),c=Math.min(this.left,f.left);return new YAHOO.util.Region(d,e,a,c);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+", height: "+this.height+", width: "+this.width+"}");};YAHOO.util.Region.getRegion=function(e){var g=YAHOO.util.Dom.getXY(e),d=g[1],f=g[0]+e.offsetWidth,a=g[1]+e.offsetHeight,c=g[0];return new YAHOO.util.Region(d,f,a,c);};YAHOO.util.Point=function(a,b){if(YAHOO.lang.isArray(a)){b=a[1];a=a[0];}YAHOO.util.Point.superclass.constructor.call(this,b,a,b,a);};YAHOO.extend(YAHOO.util.Point,YAHOO.util.Region);(function(){var b=YAHOO.util,a="clientTop",f="clientLeft",j="parentNode",k="right",w="hasLayout",i="px",u="opacity",l="auto",d="borderLeftWidth",g="borderTopWidth",p="borderRightWidth",v="borderBottomWidth",s="visible",q="transparent",n="height",e="width",h="style",t="currentStyle",r=/^width|height$/,o=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,m={get:function(x,z){var y="",A=x[t][z];if(z===u){y=b.Dom.getStyle(x,u);}else{if(!A||(A.indexOf&&A.indexOf(i)>-1)){y=A;}else{if(b.Dom.IE_COMPUTED[z]){y=b.Dom.IE_COMPUTED[z](x,z);}else{if(o.test(A)){y=b.Dom.IE.ComputedStyle.getPixel(x,z);}else{y=A;}}}}return y;},getOffset:function(z,E){var B=z[t][E],x=E.charAt(0).toUpperCase()+E.substr(1),C="offset"+x,y="pixel"+x,A="",D;if(B==l){D=z[C];if(D===undefined){A=0;}A=D;if(r.test(E)){z[h][E]=D;if(z[C]>D){A=D-(z[C]-D);}z[h][E]=l;}}else{if(!z[h][y]&&!z[h][E]){z[h][E]=B;}A=z[h][y];}return A+i;},getBorderWidth:function(x,z){var y=null;if(!x[t][w]){x[h].zoom=1;}switch(z){case g:y=x[a];break;case v:y=x.offsetHeight-x.clientHeight-x[a];break;case d:y=x[f];break;case p:y=x.offsetWidth-x.clientWidth-x[f];break;}return y+i;},getPixel:function(y,x){var A=null,B=y[t][k],z=y[t][x];y[h][k]=z;A=y[h].pixelRight;y[h][k]=B;return A+i;},getMargin:function(y,x){var z;if(y[t][x]==l){z=0+i;}else{z=b.Dom.IE.ComputedStyle.getPixel(y,x);}return z;},getVisibility:function(y,x){var z;while((z=y[t])&&z[x]=="inherit"){y=y[j];}return(z)?z[x]:s;},getColor:function(y,x){return b.Dom.Color.toRGB(y[t][x])||q;},getBorderColor:function(y,x){var z=y[t],A=z[x]||z.color;return b.Dom.Color.toRGB(b.Dom.Color.toHex(A));}},c={};c.top=c.right=c.bottom=c.left=c[e]=c[n]=m.getOffset;c.color=m.getColor;c[g]=c[p]=c[v]=c[d]=m.getBorderWidth;c.marginTop=c.marginRight=c.marginBottom=c.marginLeft=m.getMargin;c.visibility=m.getVisibility;c.borderColor=c.borderTopColor=c.borderRightColor=c.borderBottomColor=c.borderLeftColor=m.getBorderColor;b.Dom.IE_COMPUTED=c;b.Dom.IE_ComputedStyle=m;})();(function(){var c="toString",a=parseInt,b=RegExp,d=YAHOO.util;d.Dom.Color={KEYWORDS:{black:"000",silver:"c0c0c0",gray:"808080",white:"fff",maroon:"800000",red:"f00",purple:"800080",fuchsia:"f0f",green:"008000",lime:"0f0",olive:"808000",yellow:"ff0",navy:"000080",blue:"00f",teal:"008080",aqua:"0ff"},re_RGB:/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,re_hex:/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,re_hex3:/([0-9A-F])/gi,toRGB:function(e){if(!d.Dom.Color.re_RGB.test(e)){e=d.Dom.Color.toHex(e);}if(d.Dom.Color.re_hex.exec(e)){e="rgb("+[a(b.$1,16),a(b.$2,16),a(b.$3,16)].join(", ")+")";}return e;},toHex:function(f){f=d.Dom.Color.KEYWORDS[f]||f;if(d.Dom.Color.re_RGB.exec(f)){f=[Number(b.$1).toString(16),Number(b.$2).toString(16),Number(b.$3).toString(16)];for(var e=0;e -1;
- }
- } else {
- }
-
- return ret;
- },
-
- /**
- * Adds a class name to a given element or collection of elements.
- * @method addClass
- * @param {String | HTMLElement | Array} el The element or collection to add the class to
- * @param {String} className the class name to add to the class attribute
- * @return {Boolean | Array} A pass/fail boolean or array of booleans
- */
- addClass: function(el, className) {
- return Y.Dom.batch(el, Y.Dom._addClass, className);
- },
-
- _addClass: function(el, className) {
- var ret = false,
- current;
-
- if (el && className) {
- current = Y.Dom._getAttribute(el, CLASS_NAME) || EMPTY;
- if ( !Y.Dom._hasClass(el, className) ) {
- Y.Dom.setAttribute(el, CLASS_NAME, trim(current + SPACE + className));
- ret = true;
- }
- } else {
- }
-
- return ret;
- },
-
- /**
- * Removes a class name from a given element or collection of elements.
- * @method removeClass
- * @param {String | HTMLElement | Array} el The element or collection to remove the class from
- * @param {String} className the class name to remove from the class attribute
- * @return {Boolean | Array} A pass/fail boolean or array of booleans
- */
- removeClass: function(el, className) {
- return Y.Dom.batch(el, Y.Dom._removeClass, className);
- },
-
- _removeClass: function(el, className) {
- var ret = false,
- current,
- newClass,
- attr;
-
- if (el && className) {
- current = Y.Dom._getAttribute(el, CLASS_NAME) || EMPTY;
- Y.Dom.setAttribute(el, CLASS_NAME, current.replace(Y.Dom._getClassRegex(className), EMPTY));
-
- newClass = Y.Dom._getAttribute(el, CLASS_NAME);
- if (current !== newClass) { // else nothing changed
- Y.Dom.setAttribute(el, CLASS_NAME, trim(newClass)); // trim after comparing to current class
- ret = true;
-
- if (Y.Dom._getAttribute(el, CLASS_NAME) === '') { // remove class attribute if empty
- attr = (el.hasAttribute && el.hasAttribute(_CLASS)) ? _CLASS : CLASS_NAME;
- el.removeAttribute(attr);
- }
- }
-
- } else {
- }
-
- return ret;
- },
-
- /**
- * Replace a class with another class for a given element or collection of elements.
- * If no oldClassName is present, the newClassName is simply added.
- * @method replaceClass
- * @param {String | HTMLElement | Array} el The element or collection to remove the class from
- * @param {String} oldClassName the class name to be replaced
- * @param {String} newClassName the class name that will be replacing the old class name
- * @return {Boolean | Array} A pass/fail boolean or array of booleans
- */
- replaceClass: function(el, oldClassName, newClassName) {
- return Y.Dom.batch(el, Y.Dom._replaceClass, { from: oldClassName, to: newClassName });
- },
-
- _replaceClass: function(el, classObj) {
- var className,
- from,
- to,
- ret = false,
- current;
-
- if (el && classObj) {
- from = classObj.from;
- to = classObj.to;
-
- if (!to) {
- ret = false;
- } else if (!from) { // just add if no "from"
- ret = Y.Dom._addClass(el, classObj.to);
- } else if (from !== to) { // else nothing to replace
- // May need to lead with DBLSPACE?
- current = Y.Dom._getAttribute(el, CLASS_NAME) || EMPTY;
- className = (SPACE + current.replace(Y.Dom._getClassRegex(from), SPACE + to).
- replace(/\s+/g, SPACE)). // normalize white space
- split(Y.Dom._getClassRegex(to));
-
- // insert to into what would have been the first occurrence slot
- className.splice(1, 0, SPACE + to);
- Y.Dom.setAttribute(el, CLASS_NAME, trim(className.join(EMPTY)));
- ret = true;
- }
- } else {
- }
-
- return ret;
- },
-
- /**
- * Returns an ID and applies it to the element "el", if provided.
- * @method generateId
- * @param {String | HTMLElement | Array} el (optional) An optional element array of elements to add an ID to (no ID is added if one is already present).
- * @param {String} prefix (optional) an optional prefix to use (defaults to "yui-gen").
- * @return {String | Array} The generated ID, or array of generated IDs (or original ID if already present on an element)
- */
- generateId: function(el, prefix) {
- prefix = prefix || 'yui-gen';
-
- var f = function(el) {
- if (el && el.id) { // do not override existing ID
- return el.id;
- }
-
- var id = prefix + YAHOO.env._id_counter++;
-
- if (el) {
- if (el[OWNER_DOCUMENT] && el[OWNER_DOCUMENT].getElementById(id)) { // in case one already exists
- // use failed id plus prefix to help ensure uniqueness
- return Y.Dom.generateId(el, id + prefix);
- }
- el.id = id;
- }
-
- return id;
- };
-
- // batch fails when no element, so just generate and return single ID
- return Y.Dom.batch(el, f, Y.Dom, true) || f.apply(Y.Dom, arguments);
- },
-
- /**
- * Determines whether an HTMLElement is an ancestor of another HTML element in the DOM hierarchy.
- * @method isAncestor
- * @param {String | HTMLElement} haystack The possible ancestor
- * @param {String | HTMLElement} needle The possible descendent
- * @return {Boolean} Whether or not the haystack is an ancestor of needle
- */
- isAncestor: function(haystack, needle) {
- haystack = Y.Dom.get(haystack);
- needle = Y.Dom.get(needle);
-
- var ret = false;
-
- if ( (haystack && needle) && (haystack[NODE_TYPE] && needle[NODE_TYPE]) ) {
- if (haystack.contains && haystack !== needle) { // contains returns true when equal
- ret = haystack.contains(needle);
- }
- else if (haystack.compareDocumentPosition) { // gecko
- ret = !!(haystack.compareDocumentPosition(needle) & 16);
- }
- } else {
- }
- return ret;
- },
-
- /**
- * Determines whether an HTMLElement is present in the current document.
- * @method inDocument
- * @param {String | HTMLElement} el The element to search for
- * @param {Object} doc An optional document to search, defaults to element's owner document
- * @return {Boolean} Whether or not the element is present in the current document
- */
- inDocument: function(el, doc) {
- return Y.Dom._inDoc(Y.Dom.get(el), doc);
- },
-
- _inDoc: function(el, doc) {
- var ret = false;
- if (el && el[TAG_NAME]) {
- doc = doc || el[OWNER_DOCUMENT];
- ret = Y.Dom.isAncestor(doc[DOCUMENT_ELEMENT], el);
- } else {
- }
- return ret;
- },
-
- /**
- * Returns an array of HTMLElements that pass the test applied by supplied boolean method.
- * For optimized performance, include a tag and/or root node when possible.
- * Note: This method operates against a live collection, so modifying the
- * collection in the callback (removing/appending nodes, etc.) will have
- * side effects. Instead you should iterate the returned nodes array,
- * as you would with the native "getElementsByTagName" method.
- * @method getElementsBy
- * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
- * @param {String} tag (optional) The tag name of the elements being collected
- * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
- * @param {Function} apply (optional) A function to apply to each element when found
- * @param {Any} o (optional) An optional arg that is passed to the supplied method
- * @param {Boolean} overrides (optional) Whether or not to override the scope of "method" with "o"
- * @return {Array} Array of HTMLElements
- */
- getElementsBy: function(method, tag, root, apply, o, overrides, firstOnly) {
- tag = tag || '*';
- root = (root) ? Y.Dom.get(root) : null || document;
-
- var ret = (firstOnly) ? null : [],
- elements;
-
- // in case Dom.get() returns null
- if (root) {
- elements = root.getElementsByTagName(tag);
- for (var i = 0, len = elements.length; i < len; ++i) {
- if ( method(elements[i]) ) {
- if (firstOnly) {
- ret = elements[i];
- break;
- } else {
- ret[ret.length] = elements[i];
- }
- }
- }
-
- if (apply) {
- Y.Dom.batch(ret, apply, o, overrides);
- }
- }
-
-
- return ret;
- },
-
- /**
- * Returns the first HTMLElement that passes the test applied by the supplied boolean method.
- * @method getElementBy
- * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
- * @param {String} tag (optional) The tag name of the elements being collected
- * @param {String | HTMLElement} root (optional) The HTMLElement or an ID to use as the starting point
- * @return {HTMLElement}
- */
- getElementBy: function(method, tag, root) {
- return Y.Dom.getElementsBy(method, tag, root, null, null, null, true);
- },
-
- /**
- * Runs the supplied method against each item in the Collection/Array.
- * The method is called with the element(s) as the first arg, and the optional param as the second ( method(el, o) ).
- * @method batch
- * @param {String | HTMLElement | Array} el (optional) An element or array of elements to apply the method to
- * @param {Function} method The method to apply to the element(s)
- * @param {Any} o (optional) An optional arg that is passed to the supplied method
- * @param {Boolean} overrides (optional) Whether or not to override the scope of "method" with "o"
- * @return {Any | Array} The return value(s) from the supplied method
- */
- batch: function(el, method, o, overrides) {
- var collection = [],
- scope = (overrides) ? o : null;
-
- el = (el && (el[TAG_NAME] || el.item)) ? el : Y.Dom.get(el); // skip get() when possible
- if (el && method) {
- if (el[TAG_NAME] || el.length === undefined) { // element or not array-like
- return method.call(scope, el, o);
- }
-
- for (var i = 0; i < el.length; ++i) {
- collection[collection.length] = method.call(scope || el[i], el[i], o);
- }
- } else {
- return false;
- }
- return collection;
- },
-
- /**
- * Returns the height of the document.
- * @method getDocumentHeight
- * @return {Int} The height of the actual document (which includes the body and its margin).
- */
- getDocumentHeight: function() {
- var scrollHeight = (document[COMPAT_MODE] != CSS1_COMPAT || isSafari) ? document.body.scrollHeight : documentElement.scrollHeight,
- h = Math.max(scrollHeight, Y.Dom.getViewportHeight());
-
- return h;
- },
-
- /**
- * Returns the width of the document.
- * @method getDocumentWidth
- * @return {Int} The width of the actual document (which includes the body and its margin).
- */
- getDocumentWidth: function() {
- var scrollWidth = (document[COMPAT_MODE] != CSS1_COMPAT || isSafari) ? document.body.scrollWidth : documentElement.scrollWidth,
- w = Math.max(scrollWidth, Y.Dom.getViewportWidth());
- return w;
- },
-
- /**
- * Returns the current height of the viewport.
- * @method getViewportHeight
- * @return {Int} The height of the viewable area of the page (excludes scrollbars).
- */
- getViewportHeight: function() {
- var height = self.innerHeight, // Safari, Opera
- mode = document[COMPAT_MODE];
-
- if ( (mode || isIE) && !isOpera ) { // IE, Gecko
- height = (mode == CSS1_COMPAT) ?
- documentElement.clientHeight : // Standards
- document.body.clientHeight; // Quirks
- }
-
- return height;
- },
-
- /**
- * Returns the current width of the viewport.
- * @method getViewportWidth
- * @return {Int} The width of the viewable area of the page (excludes scrollbars).
- */
-
- getViewportWidth: function() {
- var width = self.innerWidth, // Safari
- mode = document[COMPAT_MODE];
-
- if (mode || isIE) { // IE, Gecko, Opera
- width = (mode == CSS1_COMPAT) ?
- documentElement.clientWidth : // Standards
- document.body.clientWidth; // Quirks
- }
- return width;
- },
-
- /**
- * Returns the nearest ancestor that passes the test applied by supplied boolean method.
- * For performance reasons, IDs are not accepted and argument validation omitted.
- * @method getAncestorBy
- * @param {HTMLElement} node The HTMLElement to use as the starting point
- * @param {Function} method - A boolean method for testing elements which receives the element as its only argument.
- * @return {Object} HTMLElement or null if not found
- */
- getAncestorBy: function(node, method) {
- while ( (node = node[PARENT_NODE]) ) { // NOTE: assignment
- if ( Y.Dom._testElement(node, method) ) {
- return node;
- }
- }
-
- return null;
- },
-
- /**
- * Returns the nearest ancestor with the given className.
- * @method getAncestorByClassName
- * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point
- * @param {String} className
- * @return {Object} HTMLElement
- */
- getAncestorByClassName: function(node, className) {
- node = Y.Dom.get(node);
- if (!node) {
- return null;
- }
- var method = function(el) { return Y.Dom.hasClass(el, className); };
- return Y.Dom.getAncestorBy(node, method);
- },
-
- /**
- * Returns the nearest ancestor with the given tagName.
- * @method getAncestorByTagName
- * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point
- * @param {String} tagName
- * @return {Object} HTMLElement
- */
- getAncestorByTagName: function(node, tagName) {
- node = Y.Dom.get(node);
- if (!node) {
- return null;
- }
- var method = function(el) {
- return el[TAG_NAME] && el[TAG_NAME].toUpperCase() == tagName.toUpperCase();
- };
-
- return Y.Dom.getAncestorBy(node, method);
- },
-
- /**
- * Returns the previous sibling that is an HTMLElement.
- * For performance reasons, IDs are not accepted and argument validation omitted.
- * Returns the nearest HTMLElement sibling if no method provided.
- * @method getPreviousSiblingBy
- * @param {HTMLElement} node The HTMLElement to use as the starting point
- * @param {Function} method A boolean function used to test siblings
- * that receives the sibling node being tested as its only argument
- * @return {Object} HTMLElement or null if not found
- */
- getPreviousSiblingBy: function(node, method) {
- while (node) {
- node = node.previousSibling;
- if ( Y.Dom._testElement(node, method) ) {
- return node;
- }
- }
- return null;
- },
-
- /**
- * Returns the previous sibling that is an HTMLElement
- * @method getPreviousSibling
- * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point
- * @return {Object} HTMLElement or null if not found
- */
- getPreviousSibling: function(node) {
- node = Y.Dom.get(node);
- if (!node) {
- return null;
- }
-
- return Y.Dom.getPreviousSiblingBy(node);
- },
-
- /**
- * Returns the next HTMLElement sibling that passes the boolean method.
- * For performance reasons, IDs are not accepted and argument validation omitted.
- * Returns the nearest HTMLElement sibling if no method provided.
- * @method getNextSiblingBy
- * @param {HTMLElement} node The HTMLElement to use as the starting point
- * @param {Function} method A boolean function used to test siblings
- * that receives the sibling node being tested as its only argument
- * @return {Object} HTMLElement or null if not found
- */
- getNextSiblingBy: function(node, method) {
- while (node) {
- node = node.nextSibling;
- if ( Y.Dom._testElement(node, method) ) {
- return node;
- }
- }
- return null;
- },
-
- /**
- * Returns the next sibling that is an HTMLElement
- * @method getNextSibling
- * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point
- * @return {Object} HTMLElement or null if not found
- */
- getNextSibling: function(node) {
- node = Y.Dom.get(node);
- if (!node) {
- return null;
- }
-
- return Y.Dom.getNextSiblingBy(node);
- },
-
- /**
- * Returns the first HTMLElement child that passes the test method.
- * @method getFirstChildBy
- * @param {HTMLElement} node The HTMLElement to use as the starting point
- * @param {Function} method A boolean function used to test children
- * that receives the node being tested as its only argument
- * @return {Object} HTMLElement or null if not found
- */
- getFirstChildBy: function(node, method) {
- var child = ( Y.Dom._testElement(node.firstChild, method) ) ? node.firstChild : null;
- return child || Y.Dom.getNextSiblingBy(node.firstChild, method);
- },
-
- /**
- * Returns the first HTMLElement child.
- * @method getFirstChild
- * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point
- * @return {Object} HTMLElement or null if not found
- */
- getFirstChild: function(node, method) {
- node = Y.Dom.get(node);
- if (!node) {
- return null;
- }
- return Y.Dom.getFirstChildBy(node);
- },
-
- /**
- * Returns the last HTMLElement child that passes the test method.
- * @method getLastChildBy
- * @param {HTMLElement} node The HTMLElement to use as the starting point
- * @param {Function} method A boolean function used to test children
- * that receives the node being tested as its only argument
- * @return {Object} HTMLElement or null if not found
- */
- getLastChildBy: function(node, method) {
- if (!node) {
- return null;
- }
- var child = ( Y.Dom._testElement(node.lastChild, method) ) ? node.lastChild : null;
- return child || Y.Dom.getPreviousSiblingBy(node.lastChild, method);
- },
-
- /**
- * Returns the last HTMLElement child.
- * @method getLastChild
- * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point
- * @return {Object} HTMLElement or null if not found
- */
- getLastChild: function(node) {
- node = Y.Dom.get(node);
- return Y.Dom.getLastChildBy(node);
- },
-
- /**
- * Returns an array of HTMLElement childNodes that pass the test method.
- * @method getChildrenBy
- * @param {HTMLElement} node The HTMLElement to start from
- * @param {Function} method A boolean function used to test children
- * that receives the node being tested as its only argument
- * @return {Array} A static array of HTMLElements
- */
- getChildrenBy: function(node, method) {
- var child = Y.Dom.getFirstChildBy(node, method),
- children = child ? [child] : [];
-
- Y.Dom.getNextSiblingBy(child, function(node) {
- if ( !method || method(node) ) {
- children[children.length] = node;
- }
- return false; // fail test to collect all children
- });
-
- return children;
- },
-
- /**
- * Returns an array of HTMLElement childNodes.
- * @method getChildren
- * @param {String | HTMLElement} node The HTMLElement or an ID to use as the starting point
- * @return {Array} A static array of HTMLElements
- */
- getChildren: function(node) {
- node = Y.Dom.get(node);
- if (!node) {
- }
-
- return Y.Dom.getChildrenBy(node);
- },
-
- /**
- * Returns the left scroll value of the document
- * @method getDocumentScrollLeft
- * @param {HTMLDocument} document (optional) The document to get the scroll value of
- * @return {Int} The amount that the document is scrolled to the left
- */
- getDocumentScrollLeft: function(doc) {
- doc = doc || document;
- return Math.max(doc[DOCUMENT_ELEMENT].scrollLeft, doc.body.scrollLeft);
- },
-
- /**
- * Returns the top scroll value of the document
- * @method getDocumentScrollTop
- * @param {HTMLDocument} document (optional) The document to get the scroll value of
- * @return {Int} The amount that the document is scrolled to the top
- */
- getDocumentScrollTop: function(doc) {
- doc = doc || document;
- return Math.max(doc[DOCUMENT_ELEMENT].scrollTop, doc.body.scrollTop);
- },
-
- /**
- * Inserts the new node as the previous sibling of the reference node
- * @method insertBefore
- * @param {String | HTMLElement} newNode The node to be inserted
- * @param {String | HTMLElement} referenceNode The node to insert the new node before
- * @return {HTMLElement} The node that was inserted (or null if insert fails)
- */
- insertBefore: function(newNode, referenceNode) {
- newNode = Y.Dom.get(newNode);
- referenceNode = Y.Dom.get(referenceNode);
-
- if (!newNode || !referenceNode || !referenceNode[PARENT_NODE]) {
- return null;
- }
-
- return referenceNode[PARENT_NODE].insertBefore(newNode, referenceNode);
- },
-
- /**
- * Inserts the new node as the next sibling of the reference node
- * @method insertAfter
- * @param {String | HTMLElement} newNode The node to be inserted
- * @param {String | HTMLElement} referenceNode The node to insert the new node after
- * @return {HTMLElement} The node that was inserted (or null if insert fails)
- */
- insertAfter: function(newNode, referenceNode) {
- newNode = Y.Dom.get(newNode);
- referenceNode = Y.Dom.get(referenceNode);
-
- if (!newNode || !referenceNode || !referenceNode[PARENT_NODE]) {
- return null;
- }
-
- if (referenceNode.nextSibling) {
- return referenceNode[PARENT_NODE].insertBefore(newNode, referenceNode.nextSibling);
- } else {
- return referenceNode[PARENT_NODE].appendChild(newNode);
- }
- },
-
- /**
- * Creates a Region based on the viewport relative to the document.
- * @method getClientRegion
- * @return {Region} A Region object representing the viewport which accounts for document scroll
- */
- getClientRegion: function() {
- var t = Y.Dom.getDocumentScrollTop(),
- l = Y.Dom.getDocumentScrollLeft(),
- r = Y.Dom.getViewportWidth() + l,
- b = Y.Dom.getViewportHeight() + t;
-
- return new Y.Region(t, r, b, l);
- },
-
- /**
- * Provides a normalized attribute interface.
- * @method setAttribute
- * @param {String | HTMLElement} el The target element for the attribute.
- * @param {String} attr The attribute to set.
- * @param {String} val The value of the attribute.
- */
- setAttribute: function(el, attr, val) {
- Y.Dom.batch(el, Y.Dom._setAttribute, { attr: attr, val: val });
- },
-
- _setAttribute: function(el, args) {
- var attr = Y.Dom._toCamel(args.attr),
- val = args.val;
-
- if (el && el.setAttribute) {
- // set as DOM property, except for BUTTON, which errors on property setter
- if (Y.Dom.DOT_ATTRIBUTES[attr] && el.tagName && el.tagName != 'BUTTON') {
- el[attr] = val;
- } else {
- attr = Y.Dom.CUSTOM_ATTRIBUTES[attr] || attr;
- el.setAttribute(attr, val);
- }
- } else {
- }
- },
-
- /**
- * Provides a normalized attribute interface.
- * @method getAttribute
- * @param {String | HTMLElement} el The target element for the attribute.
- * @param {String} attr The attribute to get.
- * @return {String} The current value of the attribute.
- */
- getAttribute: function(el, attr) {
- return Y.Dom.batch(el, Y.Dom._getAttribute, attr);
- },
-
-
- _getAttribute: function(el, attr) {
- var val;
- attr = Y.Dom.CUSTOM_ATTRIBUTES[attr] || attr;
-
- if (Y.Dom.DOT_ATTRIBUTES[attr]) {
- val = el[attr];
- } else if (el && 'getAttribute' in el) {
- if (/^(?:href|src)$/.test(attr)) { // use IE flag to return exact value
- val = el.getAttribute(attr, 2);
- } else {
- val = el.getAttribute(attr);
- }
- } else {
- }
-
- return val;
- },
-
- _toCamel: function(property) {
- var c = propertyCache;
-
- function tU(x,l) {
- return l.toUpperCase();
- }
-
- return c[property] || (c[property] = property.indexOf('-') === -1 ?
- property :
- property.replace( /-([a-z])/gi, tU ));
- },
-
- _getClassRegex: function(className) {
- var re;
- if (className !== undefined) { // allow empty string to pass
- if (className.exec) { // already a RegExp
- re = className;
- } else {
- re = reCache[className];
- if (!re) {
- // escape special chars (".", "[", etc.)
- className = className.replace(Y.Dom._patterns.CLASS_RE_TOKENS, '\\$1');
- className = className.replace(/\s+/g, SPACE); // convert line breaks and other delims
- re = reCache[className] = new RegExp(C_START + className + C_END, G);
- }
- }
- }
- return re;
- },
-
- _patterns: {
- ROOT_TAG: /^body|html$/i, // body for quirks mode, html for standards,
- CLASS_RE_TOKENS: /([\.\(\)\^\$\*\+\?\|\[\]\{\}\\])/g
- },
-
-
- _testElement: function(node, method) {
- return node && node[NODE_TYPE] == 1 && ( !method || method(node) );
- },
-
- _calcBorders: function(node, xy2) {
- var t = parseInt(Y.Dom[GET_COMPUTED_STYLE](node, BORDER_TOP_WIDTH), 10) || 0,
- l = parseInt(Y.Dom[GET_COMPUTED_STYLE](node, BORDER_LEFT_WIDTH), 10) || 0;
- if (isGecko) {
- if (RE_TABLE.test(node[TAG_NAME])) {
- t = 0;
- l = 0;
- }
- }
- xy2[0] += l;
- xy2[1] += t;
- return xy2;
- }
- };
-
- var _getComputedStyle = Y.Dom[GET_COMPUTED_STYLE];
- // fix opera computedStyle default color unit (convert to rgb)
- if (UA.opera) {
- Y.Dom[GET_COMPUTED_STYLE] = function(node, att) {
- var val = _getComputedStyle(node, att);
- if (RE_COLOR.test(att)) {
- val = Y.Dom.Color.toRGB(val);
- }
-
- return val;
- };
-
- }
-
- // safari converts transparent to rgba(), others use "transparent"
- if (UA.webkit) {
- Y.Dom[GET_COMPUTED_STYLE] = function(node, att) {
- var val = _getComputedStyle(node, att);
-
- if (val === 'rgba(0, 0, 0, 0)') {
- val = 'transparent';
- }
-
- return val;
- };
-
- }
-
- if (UA.ie && UA.ie >= 8) {
- Y.Dom.DOT_ATTRIBUTES.type = true; // IE 8 errors on input.setAttribute('type')
- }
-})();
-/**
- * A region is a representation of an object on a grid. It is defined
- * by the top, right, bottom, left extents, so is rectangular by default. If
- * other shapes are required, this class could be extended to support it.
- * @namespace YAHOO.util
- * @class Region
- * @param {Int} t the top extent
- * @param {Int} r the right extent
- * @param {Int} b the bottom extent
- * @param {Int} l the left extent
- * @constructor
- */
-YAHOO.util.Region = function(t, r, b, l) {
-
- /**
- * The region's top extent
- * @property top
- * @type Int
- */
- this.top = t;
-
- /**
- * The region's top extent
- * @property y
- * @type Int
- */
- this.y = t;
-
- /**
- * The region's top extent as index, for symmetry with set/getXY
- * @property 1
- * @type Int
- */
- this[1] = t;
-
- /**
- * The region's right extent
- * @property right
- * @type int
- */
- this.right = r;
-
- /**
- * The region's bottom extent
- * @property bottom
- * @type Int
- */
- this.bottom = b;
-
- /**
- * The region's left extent
- * @property left
- * @type Int
- */
- this.left = l;
-
- /**
- * The region's left extent
- * @property x
- * @type Int
- */
- this.x = l;
-
- /**
- * The region's left extent as index, for symmetry with set/getXY
- * @property 0
- * @type Int
- */
- this[0] = l;
-
- /**
- * The region's total width
- * @property width
- * @type Int
- */
- this.width = this.right - this.left;
-
- /**
- * The region's total height
- * @property height
- * @type Int
- */
- this.height = this.bottom - this.top;
-};
-
-/**
- * Returns true if this region contains the region passed in
- * @method contains
- * @param {Region} region The region to evaluate
- * @return {Boolean} True if the region is contained with this region,
- * else false
- */
-YAHOO.util.Region.prototype.contains = function(region) {
- return ( region.left >= this.left &&
- region.right <= this.right &&
- region.top >= this.top &&
- region.bottom <= this.bottom );
-
-};
-
-/**
- * Returns the area of the region
- * @method getArea
- * @return {Int} the region's area
- */
-YAHOO.util.Region.prototype.getArea = function() {
- return ( (this.bottom - this.top) * (this.right - this.left) );
-};
-
-/**
- * Returns the region where the passed in region overlaps with this one
- * @method intersect
- * @param {Region} region The region that intersects
- * @return {Region} The overlap region, or null if there is no overlap
- */
-YAHOO.util.Region.prototype.intersect = function(region) {
- var t = Math.max( this.top, region.top ),
- r = Math.min( this.right, region.right ),
- b = Math.min( this.bottom, region.bottom ),
- l = Math.max( this.left, region.left );
-
- if (b >= t && r >= l) {
- return new YAHOO.util.Region(t, r, b, l);
- } else {
- return null;
- }
-};
-
-/**
- * Returns the region representing the smallest region that can contain both
- * the passed in region and this region.
- * @method union
- * @param {Region} region The region that to create the union with
- * @return {Region} The union region
- */
-YAHOO.util.Region.prototype.union = function(region) {
- var t = Math.min( this.top, region.top ),
- r = Math.max( this.right, region.right ),
- b = Math.max( this.bottom, region.bottom ),
- l = Math.min( this.left, region.left );
-
- return new YAHOO.util.Region(t, r, b, l);
-};
-
-/**
- * toString
- * @method toString
- * @return string the region properties
- */
-YAHOO.util.Region.prototype.toString = function() {
- return ( "Region {" +
- "top: " + this.top +
- ", right: " + this.right +
- ", bottom: " + this.bottom +
- ", left: " + this.left +
- ", height: " + this.height +
- ", width: " + this.width +
- "}" );
-};
-
-/**
- * Returns a region that is occupied by the DOM element
- * @method getRegion
- * @param {HTMLElement} el The element
- * @return {Region} The region that the element occupies
- * @static
- */
-YAHOO.util.Region.getRegion = function(el) {
- var p = YAHOO.util.Dom.getXY(el),
- t = p[1],
- r = p[0] + el.offsetWidth,
- b = p[1] + el.offsetHeight,
- l = p[0];
-
- return new YAHOO.util.Region(t, r, b, l);
-};
-
-/////////////////////////////////////////////////////////////////////////////
-
-
-/**
- * A point is a region that is special in that it represents a single point on
- * the grid.
- * @namespace YAHOO.util
- * @class Point
- * @param {Int} x The X position of the point
- * @param {Int} y The Y position of the point
- * @constructor
- * @extends YAHOO.util.Region
- */
-YAHOO.util.Point = function(x, y) {
- if (YAHOO.lang.isArray(x)) { // accept input from Dom.getXY, Event.getXY, etc.
- y = x[1]; // dont blow away x yet
- x = x[0];
- }
-
- YAHOO.util.Point.superclass.constructor.call(this, y, x, y, x);
-};
-
-YAHOO.extend(YAHOO.util.Point, YAHOO.util.Region);
-
-(function() {
-/**
- * Internal methods used to add style management functionality to DOM.
- * @module dom
- * @class IEStyle
- * @namespace YAHOO.util.Dom
- */
-
-var Y = YAHOO.util,
- CLIENT_TOP = 'clientTop',
- CLIENT_LEFT = 'clientLeft',
- PARENT_NODE = 'parentNode',
- RIGHT = 'right',
- HAS_LAYOUT = 'hasLayout',
- PX = 'px',
- OPACITY = 'opacity',
- AUTO = 'auto',
- BORDER_LEFT_WIDTH = 'borderLeftWidth',
- BORDER_TOP_WIDTH = 'borderTopWidth',
- BORDER_RIGHT_WIDTH = 'borderRightWidth',
- BORDER_BOTTOM_WIDTH = 'borderBottomWidth',
- VISIBLE = 'visible',
- TRANSPARENT = 'transparent',
- HEIGHT = 'height',
- WIDTH = 'width',
- STYLE = 'style',
- CURRENT_STYLE = 'currentStyle',
-
-// IE getComputedStyle
-// TODO: unit-less lineHeight (e.g. 1.22)
- re_size = /^width|height$/,
- re_unit = /^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,
-
- ComputedStyle = {
- /**
- * @method get
- * @description Method used by DOM to get style information for IE
- * @param {HTMLElement} el The element to check
- * @param {String} property The property to check
- * @returns {String} The computed style
- */
- get: function(el, property) {
- var value = '',
- current = el[CURRENT_STYLE][property];
-
- if (property === OPACITY) {
- value = Y.Dom.getStyle(el, OPACITY);
- } else if (!current || (current.indexOf && current.indexOf(PX) > -1)) { // no need to convert
- value = current;
- } else if (Y.Dom.IE_COMPUTED[property]) { // use compute function
- value = Y.Dom.IE_COMPUTED[property](el, property);
- } else if (re_unit.test(current)) { // convert to pixel
- value = Y.Dom.IE.ComputedStyle.getPixel(el, property);
- } else {
- value = current;
- }
-
- return value;
- },
- /**
- * @method getOffset
- * @description Determine the offset of an element
- * @param {HTMLElement} el The element to check
- * @param {String} prop The property to check.
- * @return {String} The offset
- */
- getOffset: function(el, prop) {
- var current = el[CURRENT_STYLE][prop], // value of "width", "top", etc.
- capped = prop.charAt(0).toUpperCase() + prop.substr(1), // "Width", "Top", etc.
- offset = 'offset' + capped, // "offsetWidth", "offsetTop", etc.
- pixel = 'pixel' + capped, // "pixelWidth", "pixelTop", etc.
- value = '',
- actual;
-
- if (current == AUTO) {
- actual = el[offset]; // offsetHeight/Top etc.
- if (actual === undefined) { // likely "right" or "bottom"
- value = 0;
- }
-
- value = actual;
- if (re_size.test(prop)) { // account for box model diff
- el[STYLE][prop] = actual;
- if (el[offset] > actual) {
- // the difference is padding + border (works in Standards & Quirks modes)
- value = actual - (el[offset] - actual);
- }
- el[STYLE][prop] = AUTO; // revert to auto
- }
- } else { // convert units to px
- if (!el[STYLE][pixel] && !el[STYLE][prop]) { // need to map style.width to currentStyle (no currentStyle.pixelWidth)
- el[STYLE][prop] = current; // no style.pixelWidth if no style.width
- }
- value = el[STYLE][pixel];
- }
- return value + PX;
- },
- /**
- * @method getBorderWidth
- * @description Try to determine the width of an elements border
- * @param {HTMLElement} el The element to check
- * @param {String} property The property to check
- * @return {String} The elements border width
- */
- getBorderWidth: function(el, property) {
- // clientHeight/Width = paddingBox (e.g. offsetWidth - borderWidth)
- // clientTop/Left = borderWidth
- var value = null;
- if (!el[CURRENT_STYLE][HAS_LAYOUT]) { // TODO: unset layout?
- el[STYLE].zoom = 1; // need layout to measure client
- }
-
- switch(property) {
- case BORDER_TOP_WIDTH:
- value = el[CLIENT_TOP];
- break;
- case BORDER_BOTTOM_WIDTH:
- value = el.offsetHeight - el.clientHeight - el[CLIENT_TOP];
- break;
- case BORDER_LEFT_WIDTH:
- value = el[CLIENT_LEFT];
- break;
- case BORDER_RIGHT_WIDTH:
- value = el.offsetWidth - el.clientWidth - el[CLIENT_LEFT];
- break;
- }
- return value + PX;
- },
- /**
- * @method getPixel
- * @description Get the pixel value from a style property
- * @param {HTMLElement} node The element to check
- * @param {String} att The attribute to check
- * @return {String} The pixel value
- */
- getPixel: function(node, att) {
- // use pixelRight to convert to px
- var val = null,
- styleRight = node[CURRENT_STYLE][RIGHT],
- current = node[CURRENT_STYLE][att];
-
- node[STYLE][RIGHT] = current;
- val = node[STYLE].pixelRight;
- node[STYLE][RIGHT] = styleRight; // revert
-
- return val + PX;
- },
-
- /**
- * @method getMargin
- * @description Get the margin value from a style property
- * @param {HTMLElement} node The element to check
- * @param {String} att The attribute to check
- * @return {String} The margin value
- */
- getMargin: function(node, att) {
- var val;
- if (node[CURRENT_STYLE][att] == AUTO) {
- val = 0 + PX;
- } else {
- val = Y.Dom.IE.ComputedStyle.getPixel(node, att);
- }
- return val;
- },
-
- /**
- * @method getVisibility
- * @description Get the visibility of an element
- * @param {HTMLElement} node The element to check
- * @param {String} att The attribute to check
- * @return {String} The value
- */
- getVisibility: function(node, att) {
- var current;
- while ( (current = node[CURRENT_STYLE]) && current[att] == 'inherit') { // NOTE: assignment in test
- node = node[PARENT_NODE];
- }
- return (current) ? current[att] : VISIBLE;
- },
-
- /**
- * @method getColor
- * @description Get the color of an element
- * @param {HTMLElement} node The element to check
- * @param {String} att The attribute to check
- * @return {String} The value
- */
- getColor: function(node, att) {
- return Y.Dom.Color.toRGB(node[CURRENT_STYLE][att]) || TRANSPARENT;
- },
-
- /**
- * @method getBorderColor
- * @description Get the bordercolor of an element
- * @param {HTMLElement} node The element to check
- * @param {String} att The attribute to check
- * @return {String} The value
- */
- getBorderColor: function(node, att) {
- var current = node[CURRENT_STYLE],
- val = current[att] || current.color;
- return Y.Dom.Color.toRGB(Y.Dom.Color.toHex(val));
- }
-
- },
-
-//fontSize: getPixelFont,
- IEComputed = {};
-
-IEComputed.top = IEComputed.right = IEComputed.bottom = IEComputed.left =
- IEComputed[WIDTH] = IEComputed[HEIGHT] = ComputedStyle.getOffset;
-
-IEComputed.color = ComputedStyle.getColor;
-
-IEComputed[BORDER_TOP_WIDTH] = IEComputed[BORDER_RIGHT_WIDTH] =
- IEComputed[BORDER_BOTTOM_WIDTH] = IEComputed[BORDER_LEFT_WIDTH] =
- ComputedStyle.getBorderWidth;
-
-IEComputed.marginTop = IEComputed.marginRight = IEComputed.marginBottom =
- IEComputed.marginLeft = ComputedStyle.getMargin;
-
-IEComputed.visibility = ComputedStyle.getVisibility;
-IEComputed.borderColor = IEComputed.borderTopColor =
- IEComputed.borderRightColor = IEComputed.borderBottomColor =
- IEComputed.borderLeftColor = ComputedStyle.getBorderColor;
-
-Y.Dom.IE_COMPUTED = IEComputed;
-Y.Dom.IE_ComputedStyle = ComputedStyle;
-})();
-(function() {
-/**
- * Add style management functionality to DOM.
- * @module dom
- * @class Color
- * @namespace YAHOO.util.Dom
- */
-
-var TO_STRING = 'toString',
- PARSE_INT = parseInt,
- RE = RegExp,
- Y = YAHOO.util;
-
-Y.Dom.Color = {
- /**
- * @property KEYWORDS
- * @type Object
- * @description Color keywords used when converting to Hex
- */
- KEYWORDS: {
- black: '000',
- silver: 'c0c0c0',
- gray: '808080',
- white: 'fff',
- maroon: '800000',
- red: 'f00',
- purple: '800080',
- fuchsia: 'f0f',
- green: '008000',
- lime: '0f0',
- olive: '808000',
- yellow: 'ff0',
- navy: '000080',
- blue: '00f',
- teal: '008080',
- aqua: '0ff'
- },
- /**
- * @property re_RGB
- * @private
- * @type Regex
- * @description Regex to parse rgb(0,0,0) formatted strings
- */
- re_RGB: /^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,
- /**
- * @property re_hex
- * @private
- * @type Regex
- * @description Regex to parse #123456 formatted strings
- */
- re_hex: /^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,
- /**
- * @property re_hex3
- * @private
- * @type Regex
- * @description Regex to parse #123 formatted strings
- */
- re_hex3: /([0-9A-F])/gi,
- /**
- * @method toRGB
- * @description Converts a hex or color string to an rgb string: rgb(0,0,0)
- * @param {String} val The string to convert to RGB notation.
- * @returns {String} The converted string
- */
- toRGB: function(val) {
- if (!Y.Dom.Color.re_RGB.test(val)) {
- val = Y.Dom.Color.toHex(val);
- }
-
- if(Y.Dom.Color.re_hex.exec(val)) {
- val = 'rgb(' + [
- PARSE_INT(RE.$1, 16),
- PARSE_INT(RE.$2, 16),
- PARSE_INT(RE.$3, 16)
- ].join(', ') + ')';
- }
- return val;
- },
- /**
- * @method toHex
- * @description Converts an rgb or color string to a hex string: #123456
- * @param {String} val The string to convert to hex notation.
- * @returns {String} The converted string
- */
- toHex: function(val) {
- val = Y.Dom.Color.KEYWORDS[val] || val;
- if (Y.Dom.Color.re_RGB.exec(val)) {
- val = [
- Number(RE.$1).toString(16),
- Number(RE.$2).toString(16),
- Number(RE.$3).toString(16)
- ];
-
- for (var i = 0; i < val.length; i++) {
- if (val[i].length < 2) {
- val[i] = '0' + val[i];
- }
- }
-
- val = val.join('');
- }
-
- if (val.length < 6) {
- val = val.replace(Y.Dom.Color.re_hex3, '$1$1');
- }
-
- if (val !== 'transparent' && val.indexOf('#') < 0) {
- val = '#' + val;
- }
-
- return val.toUpperCase();
- }
-};
-}());
-YAHOO.register("dom", YAHOO.util.Dom, {version: "2.9.0", build: "2800"});
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event-min.js b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event-min.js
deleted file mode 100644
index f4a0f255e07..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/event/event-min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-Copyright (c) 2011, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.html
-version: 2.9.0
-*/
-YAHOO.util.CustomEvent=function(d,c,b,a,e){this.type=d;this.scope=c||window;this.silent=b;this.fireOnce=e;this.fired=false;this.firedWith=null;this.signature=a||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var f="_YUICEOnSubscribe";if(d!==f){this.subscribeEvent=new YAHOO.util.CustomEvent(f,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(b,c,d){if(!b){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(b,c,d);}var a=new YAHOO.util.Subscriber(b,c,d);if(this.fireOnce&&this.fired){this.notify(a,this.firedWith);}else{this.subscribers.push(a);}},unsubscribe:function(d,f){if(!d){return this.unsubscribeAll();}var e=false;for(var b=0,a=this.subscribers.length;b0){i=c[0];}try{b=g.fn.call(f,i,g.obj);}catch(h){this.lastError=h;if(a){throw h;}}}else{try{b=g.fn.call(f,this.type,c,g.obj);}catch(d){this.lastError=d;if(a){throw d;}}}return b;},unsubscribeAll:function(){var a=this.subscribers.length,b;for(b=a-1;b>-1;b--){this._delete(b);}this.subscribers=[];return a;},_delete:function(a){var b=this.subscribers[a];if(b){delete b.fn;delete b.obj;}this.subscribers.splice(a,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"context: "+this.scope;}};YAHOO.util.Subscriber=function(a,b,c){this.fn=a;this.obj=YAHOO.lang.isUndefined(b)?null:b;this.overrideContext=c;};YAHOO.util.Subscriber.prototype.getScope=function(a){if(this.overrideContext){if(this.overrideContext===true){return this.obj;}else{return this.overrideContext;}}return a;};YAHOO.util.Subscriber.prototype.contains=function(a,b){if(b){return(this.fn==a&&this.obj==b);}else{return(this.fn==a);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", overrideContext: "+(this.overrideContext||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var g=false,h=[],j=[],a=0,e=[],b=0,c={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9},d=YAHOO.env.ua.ie,f="focusin",i="focusout";return{POLL_RETRYS:500,POLL_INTERVAL:40,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:d,_interval:null,_dri:null,_specialTypes:{focusin:(d?"focusin":"focus"),focusout:(d?"focusout":"blur")},DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){this._interval=YAHOO.lang.later(this.POLL_INTERVAL,this,this._tryPreloadAttach,null,true);}},onAvailable:function(q,m,o,p,n){var k=(YAHOO.lang.isString(q))?[q]:q;for(var l=0;l-1;m--){s=(this.removeListener(l[m],k,r)&&s);}return s;}}if(!r||!r.call){return this.purgeElement(l,false,k);}if("unload"==k){for(m=j.length-1;m>-1;m--){u=j[m];if(u&&u[0]==l&&u[1]==k&&u[2]==r){j.splice(m,1);return true;}}return false;}var n=null;var o=arguments[3];if("undefined"===typeof o){o=this._getCacheIndex(h,l,k,r);}if(o>=0){n=h[o];}if(!l||!n){return false;}var t=n[this.CAPTURE]===true?true:false;try{this._simpleRemove(l,k,n[this.WFN],t);}catch(q){this.lastError=q;return false;}delete h[o][this.WFN];delete h[o][this.FN];h.splice(o,1);return true;},getTarget:function(m,l){var k=m.target||m.srcElement;return this.resolveTextNode(k);},resolveTextNode:function(l){try{if(l&&3==l.nodeType){return l.parentNode;}}catch(k){return null;}return l;},getPageX:function(l){var k=l.pageX;if(!k&&0!==k){k=l.clientX||0;if(this.isIE){k+=this._getScrollLeft();}}return k;},getPageY:function(k){var l=k.pageY;if(!l&&0!==l){l=k.clientY||0;if(this.isIE){l+=this._getScrollTop();}}return l;},getXY:function(k){return[this.getPageX(k),this.getPageY(k)];},getRelatedTarget:function(l){var k=l.relatedTarget;
-if(!k){if(l.type=="mouseout"){k=l.toElement;}else{if(l.type=="mouseover"){k=l.fromElement;}}}return this.resolveTextNode(k);},getTime:function(m){if(!m.time){var l=new Date().getTime();try{m.time=l;}catch(k){this.lastError=k;return l;}}return m.time;},stopEvent:function(k){this.stopPropagation(k);this.preventDefault(k);},stopPropagation:function(k){if(k.stopPropagation){k.stopPropagation();}else{k.cancelBubble=true;}},preventDefault:function(k){if(k.preventDefault){k.preventDefault();}else{k.returnValue=false;}},getEvent:function(m,k){var l=m||window.event;if(!l){var n=this.getEvent.caller;while(n){l=n.arguments[0];if(l&&Event==l.constructor){break;}n=n.caller;}}return l;},getCharCode:function(l){var k=l.keyCode||l.charCode||0;if(YAHOO.env.ua.webkit&&(k in c)){k=c[k];}return k;},_getCacheIndex:function(n,q,r,p){for(var o=0,m=n.length;o0&&e.length>0);}var p=[];var r=function(t,u){var s=t;if(u.overrideContext){if(u.overrideContext===true){s=u.obj;}else{s=u.overrideContext;}}u.fn.call(s,u.obj);};var l,k,o,n,m=[];for(l=0,k=e.length;l-1;l--){o=e[l];if(!o||!o.id){e.splice(l,1);}}this.startInterval();}else{if(this._interval){this._interval.cancel();this._interval=null;}}this.locked=false;},purgeElement:function(p,q,s){var n=(YAHOO.lang.isString(p))?this.getEl(p):p;var r=this.getListeners(n,s),o,k;if(r){for(o=r.length-1;o>-1;o--){var m=r[o];this.removeListener(n,m.type,m.fn);}}if(q&&n&&n.childNodes){for(o=0,k=n.childNodes.length;o-1;o--){n=h[o];if(n){try{m.removeListener(n[m.EL],n[m.TYPE],n[m.FN],o);}catch(v){}}}n=null;}try{m._simpleRemove(window,"unload",m._unload);m._simpleRemove(window,"load",m._load);}catch(u){}},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var k=document.documentElement,l=document.body;if(k&&(k.scrollTop||k.scrollLeft)){return[k.scrollTop,k.scrollLeft];}else{if(l){return[l.scrollTop,l.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(m,n,l,k){m.addEventListener(n,l,(k));};}else{if(window.attachEvent){return function(m,n,l,k){m.attachEvent("on"+n,l);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(m,n,l,k){m.removeEventListener(n,l,(k));};}else{if(window.detachEvent){return function(l,m,k){l.detachEvent("on"+m,k);};}else{return function(){};}}}()};}();(function(){var a=YAHOO.util.Event;a.on=a.addListener;a.onFocus=a.addFocusListener;a.onBlur=a.addBlurListener;
-/*! DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */
-if(a.isIE){if(self!==self.top){document.onreadystatechange=function(){if(document.readyState=="complete"){document.onreadystatechange=null;a._ready();}};}else{YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var b=document.createElement("p");a._dri=setInterval(function(){try{b.doScroll("left");clearInterval(a._dri);a._dri=null;a._ready();b=null;}catch(c){}},a.POLL_INTERVAL);}}else{if(a.webkit&&a.webkit<525){a._dri=setInterval(function(){var c=document.readyState;if("loaded"==c||"complete"==c){clearInterval(a._dri);a._dri=null;a._ready();}},a.POLL_INTERVAL);}else{a._simpleAdd(document,"DOMContentLoaded",a._ready);}}a._simpleAdd(window,"load",a._load);a._simpleAdd(window,"unload",a._unload);a._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(a,c,f,e){this.__yui_events=this.__yui_events||{};var d=this.__yui_events[a];if(d){d.subscribe(c,f,e);}else{this.__yui_subscribers=this.__yui_subscribers||{};var b=this.__yui_subscribers;if(!b[a]){b[a]=[];}b[a].push({fn:c,obj:f,overrideContext:e});}},unsubscribe:function(c,e,g){this.__yui_events=this.__yui_events||{};var a=this.__yui_events;if(c){var f=a[c];if(f){return f.unsubscribe(e,g);}}else{var b=true;for(var d in a){if(YAHOO.lang.hasOwnProperty(a,d)){b=b&&a[d].unsubscribe(e,g);
-}}return b;}return false;},unsubscribeAll:function(a){return this.unsubscribe(a);},createEvent:function(b,g){this.__yui_events=this.__yui_events||{};var e=g||{},d=this.__yui_events,f;if(d[b]){}else{f=new YAHOO.util.CustomEvent(b,e.scope||this,e.silent,YAHOO.util.CustomEvent.FLAT,e.fireOnce);d[b]=f;if(e.onSubscribeCallback){f.subscribeEvent.subscribe(e.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var a=this.__yui_subscribers[b];if(a){for(var c=0;c
- *
- *
- * @method onContentReady
- *
- * @param {string} id the id of the element to look for.
- * @param {function} fn what to execute when the element is ready.
- * @param {object} obj an optional object to be passed back as
- * a parameter to fn.
- * @param {boolean|object} overrideContext If set to true, fn will execute
- * in the context of obj. If an object, fn will
- * exectute in the context of that object
- *
- * @static
- */
- onContentReady: function(id, fn, obj, overrideContext) {
- this.onAvailable(id, fn, obj, overrideContext, true);
- },
-
- /**
- * Executes the supplied callback when the DOM is first usable. This
- * will execute immediately if called after the DOMReady event has
- * fired. @todo the DOMContentReady event does not fire when the
- * script is dynamically injected into the page. This means the
- * DOMReady custom event will never fire in FireFox or Opera when the
- * library is injected. It _will_ fire in Safari, and the IE
- * implementation would allow for us to fire it if the defered script
- * is not available. We want this to behave the same in all browsers.
- * Is there a way to identify when the script has been injected
- * instead of included inline? Is there a way to know whether the
- * window onload event has fired without having had a listener attached
- * to it when it did so?
- *
- *
The callback is a CustomEvent, so the signature is:
- *
type <string>, args <array>, customobject <object>
- *
For DOMReady events, there are no fire argments, so the
- * signature is:
- *
"DOMReady", [], obj
- *
- *
- * @method onDOMReady
- *
- * @param {function} fn what to execute when the element is found.
- * @param {object} obj an optional object to be passed back as
- * a parameter to fn.
- * @param {boolean|object} overrideContext If set to true, fn will execute
- * in the context of obj, if set to an object it
- * will execute in the context of that object
- *
- * @static
- */
- // onDOMReady: function(fn, obj, overrideContext) {
- onDOMReady: function() {
- this.DOMReadyEvent.subscribe.apply(this.DOMReadyEvent, arguments);
- },
-
-
- /**
- * Appends an event handler
- *
- * @method _addListener
- *
- * @param {String|HTMLElement|Array|NodeList} el An id, an element
- * reference, or a collection of ids and/or elements to assign the
- * listener to.
- * @param {String} sType The type of event to append
- * @param {Function} fn The method the event invokes
- * @param {Object} obj An arbitrary object that will be
- * passed as a parameter to the handler
- * @param {Boolean|object} overrideContext If true, the obj passed in becomes
- * the execution context of the listener. If an
- * object, this object becomes the execution
- * context.
- * @param {boolen} capture capture or bubble phase
- * @return {Boolean} True if the action was successful or defered,
- * false if one or more of the elements
- * could not have the listener attached,
- * or if the operation throws an exception.
- * @private
- * @static
- */
- _addListener: function(el, sType, fn, obj, overrideContext, bCapture) {
-
- if (!fn || !fn.call) {
- return false;
- }
-
- // The el argument can be an array of elements or element ids.
- if ( this._isValidCollection(el)) {
- var ok = true;
- for (var i=0,len=el.length; i-1; i--) {
- ok = ( this.removeListener(el[i], sType, fn) && ok );
- }
- return ok;
- }
-
- if (!fn || !fn.call) {
- //return false;
- return this.purgeElement(el, false, sType);
- }
-
- if ("unload" == sType) {
-
- for (i=unloadListeners.length-1; i>-1; i--) {
- li = unloadListeners[i];
- if (li &&
- li[0] == el &&
- li[1] == sType &&
- li[2] == fn) {
- unloadListeners.splice(i, 1);
- // unloadListeners[i]=null;
- return true;
- }
- }
-
- return false;
- }
-
- var cacheItem = null;
-
- // The index is a hidden parameter; needed to remove it from
- // the method signature because it was tempting users to
- // try and take advantage of it, which is not possible.
- var index = arguments[3];
-
- if ("undefined" === typeof index) {
- index = this._getCacheIndex(listeners, el, sType, fn);
- }
-
- if (index >= 0) {
- cacheItem = listeners[index];
- }
-
- if (!el || !cacheItem) {
- return false;
- }
-
-
- var bCapture = cacheItem[this.CAPTURE] === true ? true : false;
-
- try {
- this._simpleRemove(el, sType, cacheItem[this.WFN], bCapture);
- } catch(ex) {
- this.lastError = ex;
- return false;
- }
-
- // removed the wrapped handler
- delete listeners[index][this.WFN];
- delete listeners[index][this.FN];
- listeners.splice(index, 1);
- // listeners[index]=null;
-
- return true;
-
- },
-
- /**
- * Returns the event's target element. Safari sometimes provides
- * a text node, and this is automatically resolved to the text
- * node's parent so that it behaves like other browsers.
- * @method getTarget
- * @param {Event} ev the event
- * @param {boolean} resolveTextNode when set to true the target's
- * parent will be returned if the target is a
- * text node. @deprecated, the text node is
- * now resolved automatically
- * @return {HTMLElement} the event's target
- * @static
- */
- getTarget: function(ev, resolveTextNode) {
- var t = ev.target || ev.srcElement;
- return this.resolveTextNode(t);
- },
-
- /**
- * In some cases, some browsers will return a text node inside
- * the actual element that was targeted. This normalizes the
- * return value for getTarget and getRelatedTarget.
- *
- * If accessing a property of the node throws an error, this is
- * probably the anonymous div wrapper Gecko adds inside text
- * nodes. This likely will only occur when attempting to access
- * the relatedTarget. In this case, we now return null because
- * the anonymous div is completely useless and we do not know
- * what the related target was because we can't even get to
- * the element's parent node.
- *
- * @method resolveTextNode
- * @param {HTMLElement} node node to resolve
- * @return {HTMLElement} the normized node
- * @static
- */
- resolveTextNode: function(n) {
- try {
- if (n && 3 == n.nodeType) {
- return n.parentNode;
- }
- } catch(e) {
- return null;
- }
-
- return n;
- },
-
- /**
- * Returns the event's pageX
- * @method getPageX
- * @param {Event} ev the event
- * @return {int} the event's pageX
- * @static
- */
- getPageX: function(ev) {
- var x = ev.pageX;
- if (!x && 0 !== x) {
- x = ev.clientX || 0;
-
- if ( this.isIE ) {
- x += this._getScrollLeft();
- }
- }
-
- return x;
- },
-
- /**
- * Returns the event's pageY
- * @method getPageY
- * @param {Event} ev the event
- * @return {int} the event's pageY
- * @static
- */
- getPageY: function(ev) {
- var y = ev.pageY;
- if (!y && 0 !== y) {
- y = ev.clientY || 0;
-
- if ( this.isIE ) {
- y += this._getScrollTop();
- }
- }
-
-
- return y;
- },
-
- /**
- * Returns the pageX and pageY properties as an indexed array.
- * @method getXY
- * @param {Event} ev the event
- * @return {[x, y]} the pageX and pageY properties of the event
- * @static
- */
- getXY: function(ev) {
- return [this.getPageX(ev), this.getPageY(ev)];
- },
-
- /**
- * Returns the event's related target
- * @method getRelatedTarget
- * @param {Event} ev the event
- * @return {HTMLElement} the event's relatedTarget
- * @static
- */
- getRelatedTarget: function(ev) {
- var t = ev.relatedTarget;
- if (!t) {
- if (ev.type == "mouseout") {
- t = ev.toElement;
- } else if (ev.type == "mouseover") {
- t = ev.fromElement;
- }
- }
-
- return this.resolveTextNode(t);
- },
-
- /**
- * Returns the time of the event. If the time is not included, the
- * event is modified using the current time.
- * @method getTime
- * @param {Event} ev the event
- * @return {Date} the time of the event
- * @static
- */
- getTime: function(ev) {
- if (!ev.time) {
- var t = new Date().getTime();
- try {
- ev.time = t;
- } catch(ex) {
- this.lastError = ex;
- return t;
- }
- }
-
- return ev.time;
- },
-
- /**
- * Convenience method for stopPropagation + preventDefault
- * @method stopEvent
- * @param {Event} ev the event
- * @static
- */
- stopEvent: function(ev) {
- this.stopPropagation(ev);
- this.preventDefault(ev);
- },
-
- /**
- * Stops event propagation
- * @method stopPropagation
- * @param {Event} ev the event
- * @static
- */
- stopPropagation: function(ev) {
- if (ev.stopPropagation) {
- ev.stopPropagation();
- } else {
- ev.cancelBubble = true;
- }
- },
-
- /**
- * Prevents the default behavior of the event
- * @method preventDefault
- * @param {Event} ev the event
- * @static
- */
- preventDefault: function(ev) {
- if (ev.preventDefault) {
- ev.preventDefault();
- } else {
- ev.returnValue = false;
- }
- },
-
- /**
- * Finds the event in the window object, the caller's arguments, or
- * in the arguments of another method in the callstack. This is
- * executed automatically for events registered through the event
- * manager, so the implementer should not normally need to execute
- * this function at all.
- * @method getEvent
- * @param {Event} e the event parameter from the handler
- * @param {HTMLElement} boundEl the element the listener is attached to
- * @return {Event} the event
- * @static
- */
- getEvent: function(e, boundEl) {
- var ev = e || window.event;
-
- if (!ev) {
- var c = this.getEvent.caller;
- while (c) {
- ev = c.arguments[0];
- if (ev && Event == ev.constructor) {
- break;
- }
- c = c.caller;
- }
- }
-
- return ev;
- },
-
- /**
- * Returns the charcode for an event
- * @method getCharCode
- * @param {Event} ev the event
- * @return {int} the event's charCode
- * @static
- */
- getCharCode: function(ev) {
- var code = ev.keyCode || ev.charCode || 0;
-
- // webkit key normalization
- if (YAHOO.env.ua.webkit && (code in webkitKeymap)) {
- code = webkitKeymap[code];
- }
- return code;
- },
-
- /**
- * Locating the saved event handler data by function ref
- *
- * @method _getCacheIndex
- * @static
- * @private
- */
- _getCacheIndex: function(a, el, sType, fn) {
- for (var i=0, l=a.length; i 0 && onAvailStack.length > 0);
- }
-
- // onAvailable
- var notAvail = [];
-
- var executeItem = function (el, item) {
- var context = el;
- if (item.overrideContext) {
- if (item.overrideContext === true) {
- context = item.obj;
- } else {
- context = item.overrideContext;
- }
- }
- item.fn.call(context, item.obj);
- };
-
- var i, len, item, el, ready=[];
-
- // onAvailable onContentReady
- for (i=0, len=onAvailStack.length; i-1; i--) {
- item = onAvailStack[i];
- if (!item || !item.id) {
- onAvailStack.splice(i, 1);
- }
- }
-
- this.startInterval();
- } else {
- if (this._interval) {
- // clearInterval(this._interval);
- this._interval.cancel();
- this._interval = null;
- }
- }
-
- this.locked = false;
-
- },
-
- /**
- * Removes all listeners attached to the given element via addListener.
- * Optionally, the node's children can also be purged.
- * Optionally, you can specify a specific type of event to remove.
- * @method purgeElement
- * @param {HTMLElement} el the element to purge
- * @param {boolean} recurse recursively purge this element's children
- * as well. Use with caution.
- * @param {string} sType optional type of listener to purge. If
- * left out, all listeners will be removed
- * @static
- */
- purgeElement: function(el, recurse, sType) {
- var oEl = (YAHOO.lang.isString(el)) ? this.getEl(el) : el;
- var elListeners = this.getListeners(oEl, sType), i, len;
- if (elListeners) {
- for (i=elListeners.length-1; i>-1; i--) {
- var l = elListeners[i];
- this.removeListener(oEl, l.type, l.fn);
- }
- }
-
- if (recurse && oEl && oEl.childNodes) {
- for (i=0,len=oEl.childNodes.length; i-1; j--) {
- l = listeners[j];
- if (l) {
- try {
- EU.removeListener(l[EU.EL], l[EU.TYPE], l[EU.FN], j);
- } catch(e2) {}
- }
- }
- l=null;
- }
-
- try {
- EU._simpleRemove(window, "unload", EU._unload);
- EU._simpleRemove(window, "load", EU._load);
- } catch(e3) {}
-
- },
-
- /**
- * Returns scrollLeft
- * @method _getScrollLeft
- * @static
- * @private
- */
- _getScrollLeft: function() {
- return this._getScroll()[1];
- },
-
- /**
- * Returns scrollTop
- * @method _getScrollTop
- * @static
- * @private
- */
- _getScrollTop: function() {
- return this._getScroll()[0];
- },
-
- /**
- * Returns the scrollTop and scrollLeft. Used to calculate the
- * pageX and pageY in Internet Explorer
- * @method _getScroll
- * @static
- * @private
- */
- _getScroll: function() {
- var dd = document.documentElement, db = document.body;
- if (dd && (dd.scrollTop || dd.scrollLeft)) {
- return [dd.scrollTop, dd.scrollLeft];
- } else if (db) {
- return [db.scrollTop, db.scrollLeft];
- } else {
- return [0, 0];
- }
- },
-
- /**
- * Used by old versions of CustomEvent, restored for backwards
- * compatibility
- * @method regCE
- * @private
- * @static
- * @deprecated still here for backwards compatibility
- */
- regCE: function() {},
-
- /**
- * Adds a DOM event directly without the caching, cleanup, context adj, etc
- *
- * @method _simpleAdd
- * @param {HTMLElement} el the element to bind the handler to
- * @param {string} sType the type of event handler
- * @param {function} fn the callback to invoke
- * @param {boolen} capture capture or bubble phase
- * @static
- * @private
- */
- _simpleAdd: function () {
- if (window.addEventListener) {
- return function(el, sType, fn, capture) {
- el.addEventListener(sType, fn, (capture));
- };
- } else if (window.attachEvent) {
- return function(el, sType, fn, capture) {
- el.attachEvent("on" + sType, fn);
- };
- } else {
- return function(){};
- }
- }(),
-
- /**
- * Basic remove listener
- *
- * @method _simpleRemove
- * @param {HTMLElement} el the element to bind the handler to
- * @param {string} sType the type of event handler
- * @param {function} fn the callback to invoke
- * @param {boolen} capture capture or bubble phase
- * @static
- * @private
- */
- _simpleRemove: function() {
- if (window.removeEventListener) {
- return function (el, sType, fn, capture) {
- el.removeEventListener(sType, fn, (capture));
- };
- } else if (window.detachEvent) {
- return function (el, sType, fn) {
- el.detachEvent("on" + sType, fn);
- };
- } else {
- return function(){};
- }
- }()
- };
-
- }();
-
- (function() {
- var EU = YAHOO.util.Event;
-
- /**
- * Appends an event handler. This is an alias for addListener
- *
- * @method on
- *
- * @param {String|HTMLElement|Array|NodeList} el An id, an element
- * reference, or a collection of ids and/or elements to assign the
- * listener to.
- * @param {String} sType The type of event to append
- * @param {Function} fn The method the event invokes
- * @param {Object} obj An arbitrary object that will be
- * passed as a parameter to the handler
- * @param {Boolean|object} overrideContext If true, the obj passed in becomes
- * the execution context of the listener. If an
- * object, this object becomes the execution
- * context.
- * @return {Boolean} True if the action was successful or defered,
- * false if one or more of the elements
- * could not have the listener attached,
- * or if the operation throws an exception.
- * @static
- */
- EU.on = EU.addListener;
-
- /**
- * YAHOO.util.Event.onFocus is an alias for addFocusListener
- * @method onFocus
- * @see addFocusListener
- * @static
- * @deprecated use YAHOO.util.Event.on and specify "focusin" as the event type.
- */
- EU.onFocus = EU.addFocusListener;
-
- /**
- * YAHOO.util.Event.onBlur is an alias for addBlurListener
- * @method onBlur
- * @see addBlurListener
- * @static
- * @deprecated use YAHOO.util.Event.on and specify "focusout" as the event type.
- */
- EU.onBlur = EU.addBlurListener;
-
-/*! DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */
-
- // Internet Explorer: use the readyState of a defered script.
- // This isolates what appears to be a safe moment to manipulate
- // the DOM prior to when the document's readyState suggests
- // it is safe to do so.
- if (EU.isIE) {
- if (self !== self.top) {
- document.onreadystatechange = function() {
- if (document.readyState == 'complete') {
- document.onreadystatechange = null;
- EU._ready();
- }
- };
- } else {
-
- // Process onAvailable/onContentReady items when the
- // DOM is ready.
- YAHOO.util.Event.onDOMReady(
- YAHOO.util.Event._tryPreloadAttach,
- YAHOO.util.Event, true);
-
- var n = document.createElement('p');
-
- EU._dri = setInterval(function() {
- try {
- // throws an error if doc is not ready
- n.doScroll('left');
- clearInterval(EU._dri);
- EU._dri = null;
- EU._ready();
- n = null;
- } catch (ex) {
- }
- }, EU.POLL_INTERVAL);
- }
-
- // The document's readyState in Safari currently will
- // change to loaded/complete before images are loaded.
- } else if (EU.webkit && EU.webkit < 525) {
-
- EU._dri = setInterval(function() {
- var rs=document.readyState;
- if ("loaded" == rs || "complete" == rs) {
- clearInterval(EU._dri);
- EU._dri = null;
- EU._ready();
- }
- }, EU.POLL_INTERVAL);
-
- // FireFox and Opera: These browsers provide a event for this
- // moment. The latest WebKit releases now support this event.
- } else {
-
- EU._simpleAdd(document, "DOMContentLoaded", EU._ready);
-
- }
- /////////////////////////////////////////////////////////////
-
-
- EU._simpleAdd(window, "load", EU._load);
- EU._simpleAdd(window, "unload", EU._unload);
- EU._tryPreloadAttach();
- })();
-
-}
-/**
- * EventProvider is designed to be used with YAHOO.augment to wrap
- * CustomEvents in an interface that allows events to be subscribed to
- * and fired by name. This makes it possible for implementing code to
- * subscribe to an event that either has not been created yet, or will
- * not be created at all.
- *
- * @Class EventProvider
- */
-YAHOO.util.EventProvider = function() { };
-
-YAHOO.util.EventProvider.prototype = {
-
- /**
- * Private storage of custom events
- * @property __yui_events
- * @type Object[]
- * @private
- */
- __yui_events: null,
-
- /**
- * Private storage of custom event subscribers
- * @property __yui_subscribers
- * @type Object[]
- * @private
- */
- __yui_subscribers: null,
-
- /**
- * Subscribe to a CustomEvent by event type
- *
- * @method subscribe
- * @param p_type {string} the type, or name of the event
- * @param p_fn {function} the function to exectute when the event fires
- * @param p_obj {Object} An object to be passed along when the event
- * fires
- * @param overrideContext {boolean} If true, the obj passed in becomes the
- * execution scope of the listener
- */
- subscribe: function(p_type, p_fn, p_obj, overrideContext) {
-
- this.__yui_events = this.__yui_events || {};
- var ce = this.__yui_events[p_type];
-
- if (ce) {
- ce.subscribe(p_fn, p_obj, overrideContext);
- } else {
- this.__yui_subscribers = this.__yui_subscribers || {};
- var subs = this.__yui_subscribers;
- if (!subs[p_type]) {
- subs[p_type] = [];
- }
- subs[p_type].push(
- { fn: p_fn, obj: p_obj, overrideContext: overrideContext } );
- }
- },
-
- /**
- * Unsubscribes one or more listeners the from the specified event
- * @method unsubscribe
- * @param p_type {string} The type, or name of the event. If the type
- * is not specified, it will attempt to remove
- * the listener from all hosted events.
- * @param p_fn {Function} The subscribed function to unsubscribe, if not
- * supplied, all subscribers will be removed.
- * @param p_obj {Object} The custom object passed to subscribe. This is
- * optional, but if supplied will be used to
- * disambiguate multiple listeners that are the same
- * (e.g., you subscribe many object using a function
- * that lives on the prototype)
- * @return {boolean} true if the subscriber was found and detached.
- */
- unsubscribe: function(p_type, p_fn, p_obj) {
- this.__yui_events = this.__yui_events || {};
- var evts = this.__yui_events;
- if (p_type) {
- var ce = evts[p_type];
- if (ce) {
- return ce.unsubscribe(p_fn, p_obj);
- }
- } else {
- var ret = true;
- for (var i in evts) {
- if (YAHOO.lang.hasOwnProperty(evts, i)) {
- ret = ret && evts[i].unsubscribe(p_fn, p_obj);
- }
- }
- return ret;
- }
-
- return false;
- },
-
- /**
- * Removes all listeners from the specified event. If the event type
- * is not specified, all listeners from all hosted custom events will
- * be removed.
- * @method unsubscribeAll
- * @param p_type {string} The type, or name of the event
- */
- unsubscribeAll: function(p_type) {
- return this.unsubscribe(p_type);
- },
-
- /**
- * Creates a new custom event of the specified type. If a custom event
- * by that name already exists, it will not be re-created. In either
- * case the custom event is returned.
- *
- * @method createEvent
- *
- * @param p_type {string} the type, or name of the event
- * @param p_config {object} optional config params. Valid properties are:
- *
- *
- *
- * scope: defines the default execution scope. If not defined
- * the default scope will be this instance.
- *
- *
- * silent: if true, the custom event will not generate log messages.
- * This is false by default.
- *
- *
- * fireOnce: if true, the custom event will only notify subscribers
- * once regardless of the number of times the event is fired. In
- * addition, new subscribers will be executed immediately if the
- * event has already fired.
- * This is false by default.
- *
- *
- * onSubscribeCallback: specifies a callback to execute when the
- * event has a new subscriber. This will fire immediately for
- * each queued subscriber if any exist prior to the creation of
- * the event.
- *
- *
- *
- * @return {CustomEvent} the custom event
- *
- */
- createEvent: function(p_type, p_config) {
-
- this.__yui_events = this.__yui_events || {};
- var opts = p_config || {},
- events = this.__yui_events, ce;
-
- if (events[p_type]) {
- } else {
-
- ce = new YAHOO.util.CustomEvent(p_type, opts.scope || this, opts.silent,
- YAHOO.util.CustomEvent.FLAT, opts.fireOnce);
-
- events[p_type] = ce;
-
- if (opts.onSubscribeCallback) {
- ce.subscribeEvent.subscribe(opts.onSubscribeCallback);
- }
-
- this.__yui_subscribers = this.__yui_subscribers || {};
- var qs = this.__yui_subscribers[p_type];
-
- if (qs) {
- for (var i=0; i
- *
The first argument fire() was executed with
- *
The custom object (if any) that was passed into the subscribe()
- * method
- *
- * @method fireEvent
- * @param p_type {string} the type, or name of the event
- * @param arguments {Object*} an arbitrary set of parameters to pass to
- * the handler.
- * @return {boolean} the return value from CustomEvent.fire
- *
- */
- fireEvent: function(p_type) {
-
- this.__yui_events = this.__yui_events || {};
- var ce = this.__yui_events[p_type];
-
- if (!ce) {
- return null;
- }
-
- var args = [];
- for (var i=1; i":">",'"':""","'":"'","/":"/","`":"`"},d=["toString","valueOf"],e={isArray:function(j){return a.toString.apply(j)===c;},isBoolean:function(j){return typeof j==="boolean";},isFunction:function(j){return(typeof j==="function")||a.toString.apply(j)===h;},isNull:function(j){return j===null;},isNumber:function(j){return typeof j==="number"&&isFinite(j);},isObject:function(j){return(j&&(typeof j==="object"||f.isFunction(j)))||false;},isString:function(j){return typeof j==="string";},isUndefined:function(j){return typeof j==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(l,k){var j,n,m;for(j=0;j"'\/`]/g,function(k){return g[k];});},extend:function(m,n,l){if(!n||!m){throw new Error("extend failed, please check that "+"all dependencies are included.");}var k=function(){},j;k.prototype=n.prototype;m.prototype=new k();m.prototype.constructor=m;m.superclass=n.prototype;if(n.prototype.constructor==a.constructor){n.prototype.constructor=n;}if(l){for(j in l){if(f.hasOwnProperty(l,j)){m.prototype[j]=l[j];}}f._IEEnumFix(m.prototype,l);}},augmentObject:function(n,m){if(!m||!n){throw new Error("Absorb failed, verify dependencies.");}var j=arguments,l,o,k=j[2];if(k&&k!==true){for(l=2;l ";if(!f.isObject(j)){return j+"";}else{if(j instanceof Date||("nodeType" in j&&"tagName" in j)){return j;}else{if(f.isFunction(j)){return k;}}}p=(f.isNumber(p))?p:3;if(f.isArray(j)){r.push("[");for(l=0,n=j.length;l0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}if(r.length>1){r.pop();}r.push("]");}else{r.push("{");for(l in j){if(f.hasOwnProperty(j,l)){r.push(l+m);if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}}if(r.length>1){r.pop();}r.push("}");}return r.join("");},substitute:function(x,y,E,l){var D,C,B,G,t,u,F=[],p,z=x.length,A="dump",r=" ",q="{",m="}",n,w;for(;;){D=x.lastIndexOf(q,z);if(D<0){break;}C=x.indexOf(m,D);if(D+1>C){break;}p=x.substring(D+1,C);G=p;u=null;B=G.indexOf(r);if(B>-1){u=G.substring(B+1);G=G.substring(0,B);}t=y[G];if(E){t=E(G,t,u);}if(f.isObject(t)){if(f.isArray(t)){t=f.dump(t,parseInt(u,10));}else{u=u||"";n=u.indexOf(A);if(n>-1){u=u.substring(4);}w=t.toString();if(w===i||n>-1){t=f.dump(t,parseInt(u,10));}else{t=w;}}}else{if(!f.isString(t)&&!f.isNumber(t)){t="~-"+F.length+"-~";F[F.length]=p;}}x=x.substring(0,D)+t+x.substring(C+1);if(l===false){z=D-1;}}for(D=F.length-1;D>=0;D=D-1){x=x.replace(new RegExp("~-"+D+"-~"),"{"+F[D]+"}","g");}return x;},trim:function(j){try{return j.replace(/^\s+|\s+$/g,"");}catch(k){return j;
-}},merge:function(){var n={},k=arguments,j=k.length,m;for(m=0;m
- * YAHOO.env.getVersion for the description of the version data structure.
- * @property listener
- * @type Function
- * @static
- * @default undefined
- */
-
-/**
- * Set to true if the library will be dynamically loaded after window.onload.
- * Defaults to false
- * @property injecting
- * @type boolean
- * @static
- * @default undefined
- */
-
-/**
- * Instructs the yuiloader component to dynamically load yui components and
- * their dependencies. See the yuiloader documentation for more information
- * about dynamic loading
- * @property load
- * @static
- * @default undefined
- * @see yuiloader
- */
-
-/**
- * Forces the use of the supplied locale where applicable in the library
- * @property locale
- * @type string
- * @static
- * @default undefined
- */
-
-if (typeof YAHOO == "undefined" || !YAHOO) {
- /**
- * The YAHOO global namespace object. If YAHOO is already defined, the
- * existing YAHOO object will not be overwritten so that defined
- * namespaces are preserved.
- * @class YAHOO
- * @static
- */
- var YAHOO = {};
-}
-
-/**
- * Returns the namespace specified and creates it if it doesn't exist
- *
- * Either of the above would create YAHOO.property, then
- * YAHOO.property.package
- *
- * Be careful when naming packages. Reserved words may work in some browsers
- * and not others. For instance, the following will fail in Safari:
- *
- * This fails because "long" is a future reserved word in ECMAScript
- *
- * For implementation code that uses YUI, do not create your components
- * in the namespaces defined by YUI (
- * YAHOO.util,
- * YAHOO.widget,
- * YAHOO.lang,
- * YAHOO.tool,
- * YAHOO.example,
- * YAHOO.env) -- create your own namespace (e.g., 'companyname').
- *
- * @method namespace
- * @static
- * @param {String*} arguments 1-n namespaces to create
- * @return {Object} A reference to the last namespace object created
- */
-YAHOO.namespace = function() {
- var a=arguments, o=null, i, j, d;
- for (i=0; i
- *
name:
The name of the module
- *
version:
The version in use
- *
build:
The build number in use
- *
versions:
All versions that were registered
- *
builds:
All builds that were registered.
- *
mainClass:
An object that was was stamped with the
- * current version and build. If
- * mainClass.VERSION != version or mainClass.BUILD != build,
- * multiple versions of pieces of the library have been
- * loaded, potentially causing issues.
- *
- *
- * @method getVersion
- * @static
- * @param {String} name the name of the module (event, slider, etc)
- * @return {Object} The version info
- */
-YAHOO.env.getVersion = function(name) {
- return YAHOO.env.modules[name] || null;
-};
-
-/**
- * Do not fork for a browser if it can be avoided. Use feature detection when
- * you can. Use the user agent as a last resort. YAHOO.env.ua stores a version
- * number for the browser engine, 0 otherwise. This value may or may not map
- * to the version number of the browser using the engine. The value is
- * presented as a float so that it can easily be used for boolean evaluation
- * as well as for looking for a particular range of versions. Because of this,
- * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9
- * reports 1.8).
- * @class YAHOO.env.ua
- * @static
- */
-
-/**
- * parses a user agent string (or looks for one in navigator to parse if
- * not supplied).
- * @method parseUA
- * @since 2.9.0
- * @static
- */
-YAHOO.env.parseUA = function(agent) {
-
- var numberify = function(s) {
- var c = 0;
- return parseFloat(s.replace(/\./g, function() {
- return (c++ == 1) ? '' : '.';
- }));
- },
-
- nav = navigator,
-
- o = {
-
- /**
- * Internet Explorer version number or 0. Example: 6
- * @property ie
- * @type float
- * @static
- */
- ie: 0,
-
- /**
- * Opera version number or 0. Example: 9.2
- * @property opera
- * @type float
- * @static
- */
- opera: 0,
-
- /**
- * Gecko engine revision number. Will evaluate to 1 if Gecko
- * is detected but the revision could not be found. Other browsers
- * will be 0. Example: 1.8
- *
- * @property gecko
- * @type float
- * @static
- */
- gecko: 0,
-
- /**
- * AppleWebKit version. KHTML browsers that are not WebKit browsers
- * will evaluate to 1, other browsers 0. Example: 418.9
- *
- * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
- * latest available for Mac OSX 10.3.
- * Safari 2.0.2: 416 <-- hasOwnProperty introduced
- * Safari 2.0.4: 418 <-- preventDefault fixed
- * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
- * different versions of webkit
- * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been
- * updated, but not updated
- * to the latest patch.
- * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native
- * SVG and many major issues fixed).
- * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic
- * update from 2.x via the 10.4.11 OS patch.
- * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event.
- * yahoo.com user agent hack removed.
- *
- * http://en.wikipedia.org/wiki/Safari_version_history
- * @property webkit
- * @type float
- * @static
- */
- webkit: 0,
-
- /**
- * Chrome will be detected as webkit, but this property will also
- * be populated with the Chrome version number
- * @property chrome
- * @type float
- * @static
- */
- chrome: 0,
-
- /**
- * The mobile property will be set to a string containing any relevant
- * user agent information when a modern mobile browser is detected.
- * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
- * devices with the WebKit-based browser, and Opera Mini.
- * @property mobile
- * @type string
- * @static
- */
- mobile: null,
-
- /**
- * Adobe AIR version number or 0. Only populated if webkit is detected.
- * Example: 1.0
- * @property air
- * @type float
- */
- air: 0,
- /**
- * Detects Apple iPad's OS version
- * @property ipad
- * @type float
- * @static
- */
- ipad: 0,
- /**
- * Detects Apple iPhone's OS version
- * @property iphone
- * @type float
- * @static
- */
- iphone: 0,
- /**
- * Detects Apples iPod's OS version
- * @property ipod
- * @type float
- * @static
- */
- ipod: 0,
- /**
- * General truthy check for iPad, iPhone or iPod
- * @property ios
- * @type float
- * @static
- */
- ios: null,
- /**
- * Detects Googles Android OS version
- * @property android
- * @type float
- * @static
- */
- android: 0,
- /**
- * Detects Palms WebOS version
- * @property webos
- * @type float
- * @static
- */
- webos: 0,
-
- /**
- * Google Caja version number or 0.
- * @property caja
- * @type float
- */
- caja: nav && nav.cajaVersion,
-
- /**
- * Set to true if the page appears to be in SSL
- * @property secure
- * @type boolean
- * @static
- */
- secure: false,
-
- /**
- * The operating system. Currently only detecting windows or macintosh
- * @property os
- * @type string
- * @static
- */
- os: null
-
- },
-
- ua = agent || (navigator && navigator.userAgent),
-
- loc = window && window.location,
-
- href = loc && loc.href,
-
- m;
-
- o.secure = href && (href.toLowerCase().indexOf("https") === 0);
-
- if (ua) {
-
- if ((/windows|win32/i).test(ua)) {
- o.os = 'windows';
- } else if ((/macintosh/i).test(ua)) {
- o.os = 'macintosh';
- } else if ((/rhino/i).test(ua)) {
- o.os = 'rhino';
- }
-
- // Modern KHTML browsers should qualify as Safari X-Grade
- if ((/KHTML/).test(ua)) {
- o.webkit = 1;
- }
- // Modern WebKit browsers are at least X-Grade
- m = ua.match(/AppleWebKit\/([^\s]*)/);
- if (m && m[1]) {
- o.webkit = numberify(m[1]);
-
- // Mobile browser check
- if (/ Mobile\//.test(ua)) {
- o.mobile = 'Apple'; // iPhone or iPod Touch
-
- m = ua.match(/OS ([^\s]*)/);
- if (m && m[1]) {
- m = numberify(m[1].replace('_', '.'));
- }
- o.ios = m;
- o.ipad = o.ipod = o.iphone = 0;
-
- m = ua.match(/iPad|iPod|iPhone/);
- if (m && m[0]) {
- o[m[0].toLowerCase()] = o.ios;
- }
- } else {
- m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/);
- if (m) {
- // Nokia N-series, Android, webOS, ex: NokiaN95
- o.mobile = m[0];
- }
- if (/webOS/.test(ua)) {
- o.mobile = 'WebOS';
- m = ua.match(/webOS\/([^\s]*);/);
- if (m && m[1]) {
- o.webos = numberify(m[1]);
- }
- }
- if (/ Android/.test(ua)) {
- o.mobile = 'Android';
- m = ua.match(/Android ([^\s]*);/);
- if (m && m[1]) {
- o.android = numberify(m[1]);
- }
-
- }
- }
-
- m = ua.match(/Chrome\/([^\s]*)/);
- if (m && m[1]) {
- o.chrome = numberify(m[1]); // Chrome
- } else {
- m = ua.match(/AdobeAIR\/([^\s]*)/);
- if (m) {
- o.air = m[0]; // Adobe AIR 1.0 or better
- }
- }
- }
-
- if (!o.webkit) { // not webkit
-// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
- m = ua.match(/Opera[\s\/]([^\s]*)/);
- if (m && m[1]) {
- o.opera = numberify(m[1]);
- m = ua.match(/Version\/([^\s]*)/);
- if (m && m[1]) {
- o.opera = numberify(m[1]); // opera 10+
- }
- m = ua.match(/Opera Mini[^;]*/);
- if (m) {
- o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
- }
- } else { // not opera or webkit
- m = ua.match(/MSIE\s([^;]*)/);
- if (m && m[1]) {
- o.ie = numberify(m[1]);
- } else { // not opera, webkit, or ie
- m = ua.match(/Gecko\/([^\s]*)/);
- if (m) {
- o.gecko = 1; // Gecko detected, look for revision
- m = ua.match(/rv:([^\s\)]*)/);
- if (m && m[1]) {
- o.gecko = numberify(m[1]);
- }
- }
- }
- }
- }
- }
-
- return o;
-};
-
-YAHOO.env.ua = YAHOO.env.parseUA();
-
-/*
- * Initializes the global by creating the default namespaces and applying
- * any new configuration information that is detected. This is the setup
- * for env.
- * @method init
- * @static
- * @private
- */
-(function() {
- YAHOO.namespace("util", "widget", "example");
- /*global YAHOO_config*/
- if ("undefined" !== typeof YAHOO_config) {
- var l=YAHOO_config.listener, ls=YAHOO.env.listeners,unique=true, i;
- if (l) {
- // if YAHOO is loaded multiple times we need to check to see if
- // this is a new config object. If it is, add the new component
- // load listener to the stack
- for (i=0; i': '>',
- '"': '"',
- "'": ''',
- '/': '/',
- '`': '`'
- },
-
- // ADD = ["toString", "valueOf", "hasOwnProperty"],
- ADD = ["toString", "valueOf"],
-
- OB = {
-
- /**
- * Determines wheather or not the provided object is an array.
- * @method isArray
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isArray: function(o) {
- return OP.toString.apply(o) === ARRAY_TOSTRING;
- },
-
- /**
- * Determines whether or not the provided object is a boolean
- * @method isBoolean
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isBoolean: function(o) {
- return typeof o === 'boolean';
- },
-
- /**
- * Determines whether or not the provided object is a function.
- * Note: Internet Explorer thinks certain functions are objects:
- *
- * var obj = document.createElement("object");
- * YAHOO.lang.isFunction(obj.getAttribute) // reports false in IE
- *
- * var input = document.createElement("input"); // append to body
- * YAHOO.lang.isFunction(input.focus) // reports false in IE
- *
- * You will have to implement additional tests if these functions
- * matter to you.
- *
- * @method isFunction
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isFunction: function(o) {
- return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING;
- },
-
- /**
- * Determines whether or not the provided object is null
- * @method isNull
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isNull: function(o) {
- return o === null;
- },
-
- /**
- * Determines whether or not the provided object is a legal number
- * @method isNumber
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isNumber: function(o) {
- return typeof o === 'number' && isFinite(o);
- },
-
- /**
- * Determines whether or not the provided object is of type object
- * or function
- * @method isObject
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isObject: function(o) {
-return (o && (typeof o === 'object' || L.isFunction(o))) || false;
- },
-
- /**
- * Determines whether or not the provided object is a string
- * @method isString
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isString: function(o) {
- return typeof o === 'string';
- },
-
- /**
- * Determines whether or not the provided object is undefined
- * @method isUndefined
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isUndefined: function(o) {
- return typeof o === 'undefined';
- },
-
-
- /**
- * IE will not enumerate native functions in a derived object even if the
- * function was overridden. This is a workaround for specific functions
- * we care about on the Object prototype.
- * @property _IEEnumFix
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @static
- * @private
- */
- _IEEnumFix: (YAHOO.env.ua.ie) ? function(r, s) {
- var i, fname, f;
- for (i=0;i
- * Returns a copy of the specified string with special HTML characters
- * escaped. The following characters will be converted to their
- * corresponding character entities:
- * & < > " ' / `
- *
- *
- *
- * This implementation is based on the
- * OWASP
- * HTML escaping recommendations. In addition to the characters
- * in the OWASP recommendation, we also escape the `
- * character, since IE interprets it as an attribute delimiter when used in
- * innerHTML.
- *
- *
- * @method escapeHTML
- * @param {String} html String to escape.
- * @return {String} Escaped string.
- * @static
- * @since 2.9.0
- */
- escapeHTML: function (html) {
- return html.replace(/[&<>"'\/`]/g, function (match) {
- return HTML_CHARS[match];
- });
- },
-
- /**
- * Utility to set up the prototype, constructor and superclass properties to
- * support an inheritance strategy that can chain constructors and methods.
- * Static members will not be inherited.
- *
- * @method extend
- * @static
- * @param {Function} subc the object to modify
- * @param {Function} superc the object to inherit
- * @param {Object} overrides additional properties/methods to add to the
- * subclass prototype. These will override the
- * matching items obtained from the superclass
- * if present.
- */
- extend: function(subc, superc, overrides) {
- if (!superc||!subc) {
- throw new Error("extend failed, please check that " +
- "all dependencies are included.");
- }
- var F = function() {}, i;
- F.prototype=superc.prototype;
- subc.prototype=new F();
- subc.prototype.constructor=subc;
- subc.superclass=superc.prototype;
- if (superc.prototype.constructor == OP.constructor) {
- superc.prototype.constructor=superc;
- }
-
- if (overrides) {
- for (i in overrides) {
- if (L.hasOwnProperty(overrides, i)) {
- subc.prototype[i]=overrides[i];
- }
- }
-
- L._IEEnumFix(subc.prototype, overrides);
- }
- },
-
- /**
- * Applies all properties in the supplier to the receiver if the
- * receiver does not have these properties yet. Optionally, one or
- * more methods/properties can be specified (as additional
- * parameters). This option will overwrite the property if receiver
- * has it already. If true is passed as the third parameter, all
- * properties will be applied and _will_ overwrite properties in
- * the receiver.
- *
- * @method augmentObject
- * @static
- * @since 2.3.0
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @param {String*|boolean} arguments zero or more properties methods
- * to augment the receiver with. If none specified, everything
- * in the supplier will be used unless it would
- * overwrite an existing property in the receiver. If true
- * is specified as the third parameter, all properties will
- * be applied and will overwrite an existing property in
- * the receiver
- */
- augmentObject: function(r, s) {
- if (!s||!r) {
- throw new Error("Absorb failed, verify dependencies.");
- }
- var a=arguments, i, p, overrideList=a[2];
- if (overrideList && overrideList!==true) { // only absorb the specified properties
- for (i=2; i 0) ? L.dump(o[i], d-1) : OBJ);
- } else {
- s.push(o[i]);
- }
- s.push(COMMA);
- }
- if (s.length > 1) {
- s.pop();
- }
- s.push("]");
- // objects {k1 => v1, k2 => v2}
- } else {
- s.push("{");
- for (i in o) {
- if (L.hasOwnProperty(o, i)) {
- s.push(i + ARROW);
- if (L.isObject(o[i])) {
- s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
- } else {
- s.push(o[i]);
- }
- s.push(COMMA);
- }
- }
- if (s.length > 1) {
- s.pop();
- }
- s.push("}");
- }
-
- return s.join("");
- },
-
- /**
- * Does variable substitution on a string. It scans through the string
- * looking for expressions enclosed in { } braces. If an expression
- * is found, it is used a key on the object. If there is a space in
- * the key, the first word is used for the key and the rest is provided
- * to an optional function to be used to programatically determine the
- * value (the extra information might be used for this decision). If
- * the value for the key in the object, or what is returned from the
- * function has a string value, number value, or object value, it is
- * substituted for the bracket expression and it repeats. If this
- * value is an object, it uses the Object's toString() if this has
- * been overridden, otherwise it does a shallow dump of the key/value
- * pairs.
- *
- * By specifying the recurse option, the string is rescanned after
- * every replacement, allowing for nested template substitutions.
- * The side effect of this option is that curly braces in the
- * replacement content must be encoded.
- *
- * @method substitute
- * @since 2.3.0
- * @param s {String} The string that will be modified.
- * @param o {Object} An object containing the replacement values
- * @param f {Function} An optional function that can be used to
- * process each match. It receives the key,
- * value, and any extra metadata included with
- * the key inside of the braces.
- * @param recurse {boolean} default true - if not false, the replaced
- * string will be rescanned so that nested substitutions are possible.
- * @return {String} the substituted string
- */
- substitute: function (s, o, f, recurse) {
- var i, j, k, key, v, meta, saved=[], token, lidx=s.length,
- DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}',
- dump, objstr;
-
- for (;;) {
- i = s.lastIndexOf(LBRACE, lidx);
- if (i < 0) {
- break;
- }
- j = s.indexOf(RBRACE, i);
- if (i + 1 > j) {
- break;
- }
-
- //Extract key and meta info
- token = s.substring(i + 1, j);
- key = token;
- meta = null;
- k = key.indexOf(SPACE);
- if (k > -1) {
- meta = key.substring(k + 1);
- key = key.substring(0, k);
- }
-
- // lookup the value
- v = o[key];
-
- // if a substitution function was provided, execute it
- if (f) {
- v = f(key, v, meta);
- }
-
- if (L.isObject(v)) {
- if (L.isArray(v)) {
- v = L.dump(v, parseInt(meta, 10));
- } else {
- meta = meta || "";
-
- // look for the keyword 'dump', if found force obj dump
- dump = meta.indexOf(DUMP);
- if (dump > -1) {
- meta = meta.substring(4);
- }
-
- objstr = v.toString();
-
- // use the toString if it is not the Object toString
- // and the 'dump' meta info was not found
- if (objstr === OBJECT_TOSTRING || dump > -1) {
- v = L.dump(v, parseInt(meta, 10));
- } else {
- v = objstr;
- }
- }
- } else if (!L.isString(v) && !L.isNumber(v)) {
- // This {block} has no replace string. Save it for later.
- v = "~-" + saved.length + "-~";
- saved[saved.length] = token;
-
- // break;
- }
-
- s = s.substring(0, i) + v + s.substring(j + 1);
-
- if (recurse === false) {
- lidx = i-1;
- }
-
- }
-
- // restore saved {block}s
- for (i=saved.length-1; i>=0; i=i-1) {
- s = s.replace(new RegExp("~-" + i + "-~"), "{" + saved[i] + "}", "g");
- }
-
- return s;
- },
-
-
- /**
- * Returns a string without any leading or trailing whitespace. If
- * the input is not a string, the input will be returned untouched.
- * @method trim
- * @since 2.3.0
- * @param s {string} the string to trim
- * @return {string} the trimmed string
- */
- trim: function(s){
- try {
- return s.replace(/^\s+|\s+$/g, "");
- } catch(e) {
- return s;
- }
- },
-
- /**
- * Returns a new object containing all of the properties of
- * all the supplied objects. The properties from later objects
- * will overwrite those in earlier objects.
- * @method merge
- * @since 2.3.0
- * @param arguments {Object*} the objects to merge
- * @return the new merged object
- */
- merge: function() {
- var o={}, a=arguments, l=a.length, i;
- for (i=0; i
- * var A = function() {};
- * A.prototype.foo = 'foo';
- * var a = new A();
- * a.foo = 'foo';
- * alert(a.hasOwnProperty('foo')); // true
- * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
- *
- * @method hasOwnProperty
- * @param {any} o The object being testing
- * @param prop {string} the name of the property to test
- * @return {boolean} the result
- */
-L.hasOwnProperty = (OP.hasOwnProperty) ?
- function(o, prop) {
- return o && o.hasOwnProperty && o.hasOwnProperty(prop);
- } : function(o, prop) {
- return !L.isUndefined(o[prop]) &&
- o.constructor.prototype[prop] !== o[prop];
- };
-
-// new lang wins
-OB.augmentObject(L, OB, true);
-
-/*
- * An alias for YAHOO.lang
- * @class YAHOO.util.Lang
- */
-YAHOO.util.Lang = L;
-
-/**
- * Same as YAHOO.lang.augmentObject, except it only applies prototype
- * properties. This is an alias for augmentProto.
- * @see YAHOO.lang.augmentObject
- * @method augment
- * @static
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @param {String*|boolean} arguments zero or more properties methods to
- * augment the receiver with. If none specified, everything
- * in the supplier will be used unless it would
- * overwrite an existing property in the receiver. if true
- * is specified as the third parameter, all properties will
- * be applied and will overwrite an existing property in
- * the receiver
- */
-L.augment = L.augmentProto;
-
-/**
- * An alias for YAHOO.lang.augment
- * @for YAHOO
- * @method augment
- * @static
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @param {String*} arguments zero or more properties methods to
- * augment the receiver with. If none specified, everything
- * in the supplier will be used unless it would
- * overwrite an existing property in the receiver
- */
-YAHOO.augment = L.augmentProto;
-
-/**
- * An alias for YAHOO.lang.extend
- * @method extend
- * @static
- * @param {Function} subc the object to modify
- * @param {Function} superc the object to inherit
- * @param {Object} overrides additional properties/methods to add to the
- * subclass prototype. These will override the
- * matching items obtained from the superclass if present.
- */
-YAHOO.extend = L.extend;
-
-})();
-YAHOO.register("yahoo", YAHOO, {version: "2.9.0", build: "2800"});
diff --git a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoodomevent/yahoo-dom-event.js b/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoodomevent/yahoo-dom-event.js
deleted file mode 100644
index 46c58bfed4c..00000000000
--- a/wicket-datetime/src/main/java/org/apache/wicket/extensions/yui/yahoodomevent/yahoo-dom-event.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
-Copyright (c) 2011, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.html
-version: 2.9.0
-*/
-if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var b=arguments,g=null,e,c,f;for(e=0;e":">",'"':""","'":"'","/":"/","`":"`"},d=["toString","valueOf"],e={isArray:function(j){return a.toString.apply(j)===c;},isBoolean:function(j){return typeof j==="boolean";},isFunction:function(j){return(typeof j==="function")||a.toString.apply(j)===h;},isNull:function(j){return j===null;},isNumber:function(j){return typeof j==="number"&&isFinite(j);},isObject:function(j){return(j&&(typeof j==="object"||f.isFunction(j)))||false;},isString:function(j){return typeof j==="string";},isUndefined:function(j){return typeof j==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(l,k){var j,n,m;for(j=0;j"'\/`]/g,function(k){return g[k];});},extend:function(m,n,l){if(!n||!m){throw new Error("extend failed, please check that "+"all dependencies are included.");}var k=function(){},j;k.prototype=n.prototype;m.prototype=new k();m.prototype.constructor=m;m.superclass=n.prototype;if(n.prototype.constructor==a.constructor){n.prototype.constructor=n;}if(l){for(j in l){if(f.hasOwnProperty(l,j)){m.prototype[j]=l[j];}}f._IEEnumFix(m.prototype,l);}},augmentObject:function(n,m){if(!m||!n){throw new Error("Absorb failed, verify dependencies.");}var j=arguments,l,o,k=j[2];if(k&&k!==true){for(l=2;l ";if(!f.isObject(j)){return j+"";}else{if(j instanceof Date||("nodeType" in j&&"tagName" in j)){return j;}else{if(f.isFunction(j)){return k;}}}p=(f.isNumber(p))?p:3;if(f.isArray(j)){r.push("[");for(l=0,n=j.length;l0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}if(r.length>1){r.pop();}r.push("]");}else{r.push("{");for(l in j){if(f.hasOwnProperty(j,l)){r.push(l+m);if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}}if(r.length>1){r.pop();}r.push("}");}return r.join("");},substitute:function(x,y,E,l){var D,C,B,G,t,u,F=[],p,z=x.length,A="dump",r=" ",q="{",m="}",n,w;for(;;){D=x.lastIndexOf(q,z);if(D<0){break;}C=x.indexOf(m,D);if(D+1>C){break;}p=x.substring(D+1,C);G=p;u=null;B=G.indexOf(r);if(B>-1){u=G.substring(B+1);G=G.substring(0,B);}t=y[G];if(E){t=E(G,t,u);}if(f.isObject(t)){if(f.isArray(t)){t=f.dump(t,parseInt(u,10));}else{u=u||"";n=u.indexOf(A);if(n>-1){u=u.substring(4);}w=t.toString();if(w===i||n>-1){t=f.dump(t,parseInt(u,10));}else{t=w;}}}else{if(!f.isString(t)&&!f.isNumber(t)){t="~-"+F.length+"-~";F[F.length]=p;}}x=x.substring(0,D)+t+x.substring(C+1);if(l===false){z=D-1;}}for(D=F.length-1;D>=0;D=D-1){x=x.replace(new RegExp("~-"+D+"-~"),"{"+F[D]+"}","g");}return x;},trim:function(j){try{return j.replace(/^\s+|\s+$/g,"");}catch(k){return j;
-}},merge:function(){var n={},k=arguments,j=k.length,m;for(m=0;m-1;}}else{}return G;},addClass:function(W,G){return e.Dom.batch(W,e.Dom._addClass,G);},_addClass:function(X,W){var G=false,Y;if(X&&W){Y=e.Dom._getAttribute(X,f)||i;if(!e.Dom._hasClass(X,W)){e.Dom.setAttribute(X,f,a(Y+b+W));G=true;}}else{}return G;},removeClass:function(W,G){return e.Dom.batch(W,e.Dom._removeClass,G);},_removeClass:function(Y,X){var W=false,aa,Z,G;if(Y&&X){aa=e.Dom._getAttribute(Y,f)||i;e.Dom.setAttribute(Y,f,aa.replace(e.Dom._getClassRegex(X),i));Z=e.Dom._getAttribute(Y,f);if(aa!==Z){e.Dom.setAttribute(Y,f,a(Z));W=true;if(e.Dom._getAttribute(Y,f)===""){G=(Y.hasAttribute&&Y.hasAttribute(E))?E:f;Y.removeAttribute(G);}}}else{}return W;},replaceClass:function(X,W,G){return e.Dom.batch(X,e.Dom._replaceClass,{from:W,to:G});},_replaceClass:function(Y,X){var W,ab,aa,G=false,Z;if(Y&&X){ab=X.from;aa=X.to;if(!aa){G=false;}else{if(!ab){G=e.Dom._addClass(Y,X.to);}else{if(ab!==aa){Z=e.Dom._getAttribute(Y,f)||i;W=(b+Z.replace(e.Dom._getClassRegex(ab),b+aa).replace(/\s+/g,b)).split(e.Dom._getClassRegex(aa));W.splice(1,0,b+aa);e.Dom.setAttribute(Y,f,a(W.join(i)));G=true;}}}}else{}return G;},generateId:function(G,X){X=X||"yui-gen";var W=function(Y){if(Y&&Y.id){return Y.id;}var Z=X+YAHOO.env._id_counter++;
-if(Y){if(Y[C]&&Y[C].getElementById(Z)){return e.Dom.generateId(Y,Z+X);}Y.id=Z;}return Z;};return e.Dom.batch(G,W,e.Dom,true)||W.apply(e.Dom,arguments);},isAncestor:function(W,X){W=e.Dom.get(W);X=e.Dom.get(X);var G=false;if((W&&X)&&(W[K]&&X[K])){if(W.contains&&W!==X){G=W.contains(X);}else{if(W.compareDocumentPosition){G=!!(W.compareDocumentPosition(X)&16);}}}else{}return G;},inDocument:function(G,W){return e.Dom._inDoc(e.Dom.get(G),W);},_inDoc:function(W,X){var G=false;if(W&&W[c]){X=X||W[C];G=e.Dom.isAncestor(X[U],W);}else{}return G;},getElementsBy:function(W,af,ab,ad,X,ac,ae){af=af||"*";ab=(ab)?e.Dom.get(ab):null||j;var aa=(ae)?null:[],G;if(ab){G=ab.getElementsByTagName(af);for(var Y=0,Z=G.length;Y=8){e.Dom.DOT_ATTRIBUTES.type=true;}})();YAHOO.util.Region=function(d,e,a,c){this.top=d;this.y=d;this[1]=d;this.right=e;this.bottom=a;this.left=c;this.x=c;this[0]=c;this.width=this.right-this.left;this.height=this.bottom-this.top;};YAHOO.util.Region.prototype.contains=function(a){return(a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(f){var d=Math.max(this.top,f.top),e=Math.min(this.right,f.right),a=Math.min(this.bottom,f.bottom),c=Math.max(this.left,f.left);
-if(a>=d&&e>=c){return new YAHOO.util.Region(d,e,a,c);}else{return null;}};YAHOO.util.Region.prototype.union=function(f){var d=Math.min(this.top,f.top),e=Math.max(this.right,f.right),a=Math.max(this.bottom,f.bottom),c=Math.min(this.left,f.left);return new YAHOO.util.Region(d,e,a,c);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+", height: "+this.height+", width: "+this.width+"}");};YAHOO.util.Region.getRegion=function(e){var g=YAHOO.util.Dom.getXY(e),d=g[1],f=g[0]+e.offsetWidth,a=g[1]+e.offsetHeight,c=g[0];return new YAHOO.util.Region(d,f,a,c);};YAHOO.util.Point=function(a,b){if(YAHOO.lang.isArray(a)){b=a[1];a=a[0];}YAHOO.util.Point.superclass.constructor.call(this,b,a,b,a);};YAHOO.extend(YAHOO.util.Point,YAHOO.util.Region);(function(){var b=YAHOO.util,a="clientTop",f="clientLeft",j="parentNode",k="right",w="hasLayout",i="px",u="opacity",l="auto",d="borderLeftWidth",g="borderTopWidth",p="borderRightWidth",v="borderBottomWidth",s="visible",q="transparent",n="height",e="width",h="style",t="currentStyle",r=/^width|height$/,o=/^(\d[.\d]*)+(em|ex|px|gd|rem|vw|vh|vm|ch|mm|cm|in|pt|pc|deg|rad|ms|s|hz|khz|%){1}?/i,m={get:function(x,z){var y="",A=x[t][z];if(z===u){y=b.Dom.getStyle(x,u);}else{if(!A||(A.indexOf&&A.indexOf(i)>-1)){y=A;}else{if(b.Dom.IE_COMPUTED[z]){y=b.Dom.IE_COMPUTED[z](x,z);}else{if(o.test(A)){y=b.Dom.IE.ComputedStyle.getPixel(x,z);}else{y=A;}}}}return y;},getOffset:function(z,E){var B=z[t][E],x=E.charAt(0).toUpperCase()+E.substr(1),C="offset"+x,y="pixel"+x,A="",D;if(B==l){D=z[C];if(D===undefined){A=0;}A=D;if(r.test(E)){z[h][E]=D;if(z[C]>D){A=D-(z[C]-D);}z[h][E]=l;}}else{if(!z[h][y]&&!z[h][E]){z[h][E]=B;}A=z[h][y];}return A+i;},getBorderWidth:function(x,z){var y=null;if(!x[t][w]){x[h].zoom=1;}switch(z){case g:y=x[a];break;case v:y=x.offsetHeight-x.clientHeight-x[a];break;case d:y=x[f];break;case p:y=x.offsetWidth-x.clientWidth-x[f];break;}return y+i;},getPixel:function(y,x){var A=null,B=y[t][k],z=y[t][x];y[h][k]=z;A=y[h].pixelRight;y[h][k]=B;return A+i;},getMargin:function(y,x){var z;if(y[t][x]==l){z=0+i;}else{z=b.Dom.IE.ComputedStyle.getPixel(y,x);}return z;},getVisibility:function(y,x){var z;while((z=y[t])&&z[x]=="inherit"){y=y[j];}return(z)?z[x]:s;},getColor:function(y,x){return b.Dom.Color.toRGB(y[t][x])||q;},getBorderColor:function(y,x){var z=y[t],A=z[x]||z.color;return b.Dom.Color.toRGB(b.Dom.Color.toHex(A));}},c={};c.top=c.right=c.bottom=c.left=c[e]=c[n]=m.getOffset;c.color=m.getColor;c[g]=c[p]=c[v]=c[d]=m.getBorderWidth;c.marginTop=c.marginRight=c.marginBottom=c.marginLeft=m.getMargin;c.visibility=m.getVisibility;c.borderColor=c.borderTopColor=c.borderRightColor=c.borderBottomColor=c.borderLeftColor=m.getBorderColor;b.Dom.IE_COMPUTED=c;b.Dom.IE_ComputedStyle=m;})();(function(){var c="toString",a=parseInt,b=RegExp,d=YAHOO.util;d.Dom.Color={KEYWORDS:{black:"000",silver:"c0c0c0",gray:"808080",white:"fff",maroon:"800000",red:"f00",purple:"800080",fuchsia:"f0f",green:"008000",lime:"0f0",olive:"808000",yellow:"ff0",navy:"000080",blue:"00f",teal:"008080",aqua:"0ff"},re_RGB:/^rgb\(([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\)$/i,re_hex:/^#?([0-9A-F]{2})([0-9A-F]{2})([0-9A-F]{2})$/i,re_hex3:/([0-9A-F])/gi,toRGB:function(e){if(!d.Dom.Color.re_RGB.test(e)){e=d.Dom.Color.toHex(e);}if(d.Dom.Color.re_hex.exec(e)){e="rgb("+[a(b.$1,16),a(b.$2,16),a(b.$3,16)].join(", ")+")";}return e;},toHex:function(f){f=d.Dom.Color.KEYWORDS[f]||f;if(d.Dom.Color.re_RGB.exec(f)){f=[Number(b.$1).toString(16),Number(b.$2).toString(16),Number(b.$3).toString(16)];for(var e=0;e0){i=c[0];}try{b=g.fn.call(f,i,g.obj);}catch(h){this.lastError=h;if(a){throw h;}}}else{try{b=g.fn.call(f,this.type,c,g.obj);}catch(d){this.lastError=d;if(a){throw d;}}}return b;},unsubscribeAll:function(){var a=this.subscribers.length,b;for(b=a-1;b>-1;b--){this._delete(b);}this.subscribers=[];return a;},_delete:function(a){var b=this.subscribers[a];if(b){delete b.fn;delete b.obj;}this.subscribers.splice(a,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"context: "+this.scope;}};YAHOO.util.Subscriber=function(a,b,c){this.fn=a;this.obj=YAHOO.lang.isUndefined(b)?null:b;this.overrideContext=c;};YAHOO.util.Subscriber.prototype.getScope=function(a){if(this.overrideContext){if(this.overrideContext===true){return this.obj;}else{return this.overrideContext;}}return a;};YAHOO.util.Subscriber.prototype.contains=function(a,b){if(b){return(this.fn==a&&this.obj==b);}else{return(this.fn==a);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", overrideContext: "+(this.overrideContext||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var g=false,h=[],j=[],a=0,e=[],b=0,c={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9},d=YAHOO.env.ua.ie,f="focusin",i="focusout";return{POLL_RETRYS:500,POLL_INTERVAL:40,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:d,_interval:null,_dri:null,_specialTypes:{focusin:(d?"focusin":"focus"),focusout:(d?"focusout":"blur")},DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){this._interval=YAHOO.lang.later(this.POLL_INTERVAL,this,this._tryPreloadAttach,null,true);}},onAvailable:function(q,m,o,p,n){var k=(YAHOO.lang.isString(q))?[q]:q;for(var l=0;l-1;m--){s=(this.removeListener(l[m],k,r)&&s);}return s;}}if(!r||!r.call){return this.purgeElement(l,false,k);}if("unload"==k){for(m=j.length-1;m>-1;m--){u=j[m];if(u&&u[0]==l&&u[1]==k&&u[2]==r){j.splice(m,1);return true;}}return false;}var n=null;var o=arguments[3];if("undefined"===typeof o){o=this._getCacheIndex(h,l,k,r);}if(o>=0){n=h[o];}if(!l||!n){return false;}var t=n[this.CAPTURE]===true?true:false;try{this._simpleRemove(l,k,n[this.WFN],t);}catch(q){this.lastError=q;return false;}delete h[o][this.WFN];delete h[o][this.FN];h.splice(o,1);return true;},getTarget:function(m,l){var k=m.target||m.srcElement;return this.resolveTextNode(k);},resolveTextNode:function(l){try{if(l&&3==l.nodeType){return l.parentNode;}}catch(k){return null;}return l;},getPageX:function(l){var k=l.pageX;if(!k&&0!==k){k=l.clientX||0;if(this.isIE){k+=this._getScrollLeft();}}return k;},getPageY:function(k){var l=k.pageY;if(!l&&0!==l){l=k.clientY||0;if(this.isIE){l+=this._getScrollTop();}}return l;},getXY:function(k){return[this.getPageX(k),this.getPageY(k)];},getRelatedTarget:function(l){var k=l.relatedTarget;
-if(!k){if(l.type=="mouseout"){k=l.toElement;}else{if(l.type=="mouseover"){k=l.fromElement;}}}return this.resolveTextNode(k);},getTime:function(m){if(!m.time){var l=new Date().getTime();try{m.time=l;}catch(k){this.lastError=k;return l;}}return m.time;},stopEvent:function(k){this.stopPropagation(k);this.preventDefault(k);},stopPropagation:function(k){if(k.stopPropagation){k.stopPropagation();}else{k.cancelBubble=true;}},preventDefault:function(k){if(k.preventDefault){k.preventDefault();}else{k.returnValue=false;}},getEvent:function(m,k){var l=m||window.event;if(!l){var n=this.getEvent.caller;while(n){l=n.arguments[0];if(l&&Event==l.constructor){break;}n=n.caller;}}return l;},getCharCode:function(l){var k=l.keyCode||l.charCode||0;if(YAHOO.env.ua.webkit&&(k in c)){k=c[k];}return k;},_getCacheIndex:function(n,q,r,p){for(var o=0,m=n.length;o0&&e.length>0);}var p=[];var r=function(t,u){var s=t;if(u.overrideContext){if(u.overrideContext===true){s=u.obj;}else{s=u.overrideContext;}}u.fn.call(s,u.obj);};var l,k,o,n,m=[];for(l=0,k=e.length;l-1;l--){o=e[l];if(!o||!o.id){e.splice(l,1);}}this.startInterval();}else{if(this._interval){this._interval.cancel();this._interval=null;}}this.locked=false;},purgeElement:function(p,q,s){var n=(YAHOO.lang.isString(p))?this.getEl(p):p;var r=this.getListeners(n,s),o,k;if(r){for(o=r.length-1;o>-1;o--){var m=r[o];this.removeListener(n,m.type,m.fn);}}if(q&&n&&n.childNodes){for(o=0,k=n.childNodes.length;o-1;o--){n=h[o];if(n){try{m.removeListener(n[m.EL],n[m.TYPE],n[m.FN],o);}catch(v){}}}n=null;}try{m._simpleRemove(window,"unload",m._unload);m._simpleRemove(window,"load",m._load);}catch(u){}},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var k=document.documentElement,l=document.body;if(k&&(k.scrollTop||k.scrollLeft)){return[k.scrollTop,k.scrollLeft];}else{if(l){return[l.scrollTop,l.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(m,n,l,k){m.addEventListener(n,l,(k));};}else{if(window.attachEvent){return function(m,n,l,k){m.attachEvent("on"+n,l);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(m,n,l,k){m.removeEventListener(n,l,(k));};}else{if(window.detachEvent){return function(l,m,k){l.detachEvent("on"+m,k);};}else{return function(){};}}}()};}();(function(){var a=YAHOO.util.Event;a.on=a.addListener;a.onFocus=a.addFocusListener;a.onBlur=a.addBlurListener;
-/*! DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */
-if(a.isIE){if(self!==self.top){document.onreadystatechange=function(){if(document.readyState=="complete"){document.onreadystatechange=null;a._ready();}};}else{YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var b=document.createElement("p");a._dri=setInterval(function(){try{b.doScroll("left");clearInterval(a._dri);a._dri=null;a._ready();b=null;}catch(c){}},a.POLL_INTERVAL);}}else{if(a.webkit&&a.webkit<525){a._dri=setInterval(function(){var c=document.readyState;if("loaded"==c||"complete"==c){clearInterval(a._dri);a._dri=null;a._ready();}},a.POLL_INTERVAL);}else{a._simpleAdd(document,"DOMContentLoaded",a._ready);}}a._simpleAdd(window,"load",a._load);a._simpleAdd(window,"unload",a._unload);a._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(a,c,f,e){this.__yui_events=this.__yui_events||{};var d=this.__yui_events[a];if(d){d.subscribe(c,f,e);}else{this.__yui_subscribers=this.__yui_subscribers||{};var b=this.__yui_subscribers;if(!b[a]){b[a]=[];}b[a].push({fn:c,obj:f,overrideContext:e});}},unsubscribe:function(c,e,g){this.__yui_events=this.__yui_events||{};var a=this.__yui_events;if(c){var f=a[c];if(f){return f.unsubscribe(e,g);}}else{var b=true;for(var d in a){if(YAHOO.lang.hasOwnProperty(a,d)){b=b&&a[d].unsubscribe(e,g);
-}}return b;}return false;},unsubscribeAll:function(a){return this.unsubscribe(a);},createEvent:function(b,g){this.__yui_events=this.__yui_events||{};var e=g||{},d=this.__yui_events,f;if(d[b]){}else{f=new YAHOO.util.CustomEvent(b,e.scope||this,e.silent,YAHOO.util.CustomEvent.FLAT,e.fireOnce);d[b]=f;if(e.onSubscribeCallback){f.subscribeEvent.subscribe(e.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var a=this.__yui_subscribers[b];if(a){for(var c=0;c":">",'"':""","'":"'","/":"/","`":"`"},d=["toString","valueOf"],e={isArray:function(j){return a.toString.apply(j)===c;},isBoolean:function(j){return typeof j==="boolean";},isFunction:function(j){return(typeof j==="function")||a.toString.apply(j)===h;},isNull:function(j){return j===null;},isNumber:function(j){return typeof j==="number"&&isFinite(j);},isObject:function(j){return(j&&(typeof j==="object"||f.isFunction(j)))||false;},isString:function(j){return typeof j==="string";},isUndefined:function(j){return typeof j==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(l,k){var j,n,m;for(j=0;j"'\/`]/g,function(k){return g[k];});},extend:function(m,n,l){if(!n||!m){throw new Error("extend failed, please check that "+"all dependencies are included.");}var k=function(){},j;k.prototype=n.prototype;m.prototype=new k();m.prototype.constructor=m;m.superclass=n.prototype;if(n.prototype.constructor==a.constructor){n.prototype.constructor=n;}if(l){for(j in l){if(f.hasOwnProperty(l,j)){m.prototype[j]=l[j];}}f._IEEnumFix(m.prototype,l);}},augmentObject:function(n,m){if(!m||!n){throw new Error("Absorb failed, verify dependencies.");}var j=arguments,l,o,k=j[2];if(k&&k!==true){for(l=2;l ";if(!f.isObject(j)){return j+"";}else{if(j instanceof Date||("nodeType" in j&&"tagName" in j)){return j;}else{if(f.isFunction(j)){return k;}}}p=(f.isNumber(p))?p:3;if(f.isArray(j)){r.push("[");for(l=0,n=j.length;l0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}if(r.length>1){r.pop();}r.push("]");}else{r.push("{");for(l in j){if(f.hasOwnProperty(j,l)){r.push(l+m);if(f.isObject(j[l])){r.push((p>0)?f.dump(j[l],p-1):t);}else{r.push(j[l]);}r.push(q);}}if(r.length>1){r.pop();}r.push("}");}return r.join("");},substitute:function(x,y,E,l){var D,C,B,G,t,u,F=[],p,z=x.length,A="dump",r=" ",q="{",m="}",n,w;for(;;){D=x.lastIndexOf(q,z);if(D<0){break;}C=x.indexOf(m,D);if(D+1>C){break;}p=x.substring(D+1,C);G=p;u=null;B=G.indexOf(r);if(B>-1){u=G.substring(B+1);G=G.substring(0,B);}t=y[G];if(E){t=E(G,t,u);}if(f.isObject(t)){if(f.isArray(t)){t=f.dump(t,parseInt(u,10));}else{u=u||"";n=u.indexOf(A);if(n>-1){u=u.substring(4);}w=t.toString();if(w===i||n>-1){t=f.dump(t,parseInt(u,10));}else{t=w;}}}else{if(!f.isString(t)&&!f.isNumber(t)){t="~-"+F.length+"-~";F[F.length]=p;}}x=x.substring(0,D)+t+x.substring(C+1);if(l===false){z=D-1;}}for(D=F.length-1;D>=0;D=D-1){x=x.replace(new RegExp("~-"+D+"-~"),"{"+F[D]+"}","g");}return x;},trim:function(j){try{return j.replace(/^\s+|\s+$/g,"");}catch(k){return j;
-}},merge:function(){var n={},k=arguments,j=k.length,m;for(m=0;m=420){z.addEventListener("load",function(){YAHOO.log(x+" DOM2 onload "+u,"info","Get");F(x,u);});}else{t=m[x];if(t.varName){v=YAHOO.util.Get.POLL_FREQ;YAHOO.log("Polling for "+t.varName[0]);t.maxattempts=YAHOO.util.Get.TIMEOUT/v;t.attempts=0;t._cache=t.varName[0].split(".");t.timer=s.later(v,t,function(w){I=this._cache;A=I.length;J=this.win;for(C=0;Cthis.maxattempts){y="Over retry limit, giving up";t.timer.cancel();q(x,y);}else{YAHOO.log(I[C]+" failed, retrying");}return;}}YAHOO.log("Safari poll complete");t.timer.cancel();F(x,u);},null,true);}else{s.later(YAHOO.util.Get.POLL_FREQ,null,F,[x,u]);}}}}else{z.onload=function(){YAHOO.log(x+" onload "+u,"info","Get");F(x,u);};}}};q=function(w,v){YAHOO.log("get failure: "+v,"warn","Get");var u=m[w],t;if(u.onFailure){t=u.scope||u.win;u.onFailure.call(t,a(u,v));}};d=function(z){if(m[z]){var t=m[z],u=t.nodes,x=u.length,C=t.win.document,A=C.getElementsByTagName("head")[0],v,y,w,B;if(t.insertBefore){v=b(t.insertBefore,z);if(v){A=v.parentNode;}}for(y=0;y=m.rollup);if(roll){break;}}}}}else{for(j=0;j=m.rollup);if(roll){break;}}}}}if(roll){r[i]=true;rolled=true;this.getRequires(m);}}}if(!rolled){break;}}},_reduce:function(){var i,j,s,m,r=this.required;for(i in r){if(i in this.loaded){delete r[i];}else{var skinDef=this.parseSkin(i);if(skinDef){if(!skinDef.module){var skin_pre=this.SKIN_PREFIX+skinDef.skin;for(j in r){if(lang.hasOwnProperty(r,j)){m=this.moduleInfo[j];var ext=m&&m.ext;if(!ext&&j!==i&&j.indexOf(skin_pre)>-1){delete r[j];}}}}}else{m=this.moduleInfo[i];s=m&&m.supersedes;if(s){for(j=0;j-1){return true;}if(after&&YUI.ArrayUtil.indexOf(after,bb)>-1){return true;}if(checkOptional&&optional&&YUI.ArrayUtil.indexOf(optional,bb)>-1){return true;}var ss=info[bb]&&info[bb].supersedes;if(ss){for(ii=0;iistartLen){YAHOO.util.Get.script(self._filter(js),{data:self._loading,onSuccess:callback,onFailure:self._onFailure,onTimeout:self._onTimeout,insertBefore:self.insertBefore,charset:self.charset,timeout:self.timeout,scope:self});}else{this.loadNext();}};if(css.length>startLen){YAHOO.util.Get.css(this._filter(css),{data:this._loading,onSuccess:loadScript,onFailure:this._onFailure,onTimeout:this._onTimeout,insertBefore:this.insertBefore,charset:this.charset,timeout:this.timeout,scope:self});}else{loadScript();}return;}else{this.loadNext(this._loading);}},insert:function(o,type){this.calculate(o);this._loading=true;this.loadType=type;if(this.combine){return this._combine();}if(!type){var self=this;this._internalCallback=function(){self._internalCallback=null;self.insert(null,"js");};this.insert(null,"css");return;}this.loadNext();},sandbox:function(o,type){var self=this,success=function(o){var idx=o.argument[0],name=o.argument[2];self._scriptText[idx]=o.responseText;if(self.onProgress){self.onProgress.call(self.scope,{name:name,scriptText:o.responseText,xhrResponse:o,data:self.data});}self._loadCount++;if(self._loadCount>=self._stopCount){var v=self.varName||"YAHOO";var t="(function() {\n";var b="\nreturn "+v+";\n})();";var ref=eval(t+self._scriptText.join("\n")+b);self._pushEvents(ref);if(ref){self.onSuccess.call(self.scope,{reference:ref,data:self.data});}else{self._onFailure.call(self.varName+" reference failure");}}},failure=function(o){self.onFailure.call(self.scope,{msg:"XHR failure",xhrResponse:o,data:self.data});};self._config(o);if(!self.onSuccess){throw new Error("You must supply an onSuccess handler for your sandbox");}self._sandbox=true;if(!type||type!=="js"){self._internalCallback=function(){self._internalCallback=null;self.sandbox(null,"js");};self.insert(null,"css");return;}if(!util.Connect){var ld=new YAHOO.util.YUILoader();ld.insert({base:self.base,filter:self.filter,require:"connection",insertBefore:self.insertBefore,charset:self.charset,onSuccess:function(){self.sandbox(null,"js");},scope:self},"js");return;}self._scriptText=[];self._loadCount=0;self._stopCount=self.sorted.length;self._xhr=[];self.calculate();var s=self.sorted,l=s.length,i,m,url;for(i=0;i
- * YAHOO.env.getVersion for the description of the version data structure.
- * @property listener
- * @type Function
- * @static
- * @default undefined
- */
-
-/**
- * Set to true if the library will be dynamically loaded after window.onload.
- * Defaults to false
- * @property injecting
- * @type boolean
- * @static
- * @default undefined
- */
-
-/**
- * Instructs the yuiloader component to dynamically load yui components and
- * their dependencies. See the yuiloader documentation for more information
- * about dynamic loading
- * @property load
- * @static
- * @default undefined
- * @see yuiloader
- */
-
-/**
- * Forces the use of the supplied locale where applicable in the library
- * @property locale
- * @type string
- * @static
- * @default undefined
- */
-
-if (typeof YAHOO == "undefined" || !YAHOO) {
- /**
- * The YAHOO global namespace object. If YAHOO is already defined, the
- * existing YAHOO object will not be overwritten so that defined
- * namespaces are preserved.
- * @class YAHOO
- * @static
- */
- var YAHOO = {};
-}
-
-/**
- * Returns the namespace specified and creates it if it doesn't exist
- *
- * Either of the above would create YAHOO.property, then
- * YAHOO.property.package
- *
- * Be careful when naming packages. Reserved words may work in some browsers
- * and not others. For instance, the following will fail in Safari:
- *
- * This fails because "long" is a future reserved word in ECMAScript
- *
- * For implementation code that uses YUI, do not create your components
- * in the namespaces defined by YUI (
- * YAHOO.util,
- * YAHOO.widget,
- * YAHOO.lang,
- * YAHOO.tool,
- * YAHOO.example,
- * YAHOO.env) -- create your own namespace (e.g., 'companyname').
- *
- * @method namespace
- * @static
- * @param {String*} arguments 1-n namespaces to create
- * @return {Object} A reference to the last namespace object created
- */
-YAHOO.namespace = function() {
- var a=arguments, o=null, i, j, d;
- for (i=0; i
- *
name:
The name of the module
- *
version:
The version in use
- *
build:
The build number in use
- *
versions:
All versions that were registered
- *
builds:
All builds that were registered.
- *
mainClass:
An object that was was stamped with the
- * current version and build. If
- * mainClass.VERSION != version or mainClass.BUILD != build,
- * multiple versions of pieces of the library have been
- * loaded, potentially causing issues.
- *
- *
- * @method getVersion
- * @static
- * @param {String} name the name of the module (event, slider, etc)
- * @return {Object} The version info
- */
-YAHOO.env.getVersion = function(name) {
- return YAHOO.env.modules[name] || null;
-};
-
-/**
- * Do not fork for a browser if it can be avoided. Use feature detection when
- * you can. Use the user agent as a last resort. YAHOO.env.ua stores a version
- * number for the browser engine, 0 otherwise. This value may or may not map
- * to the version number of the browser using the engine. The value is
- * presented as a float so that it can easily be used for boolean evaluation
- * as well as for looking for a particular range of versions. Because of this,
- * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9
- * reports 1.8).
- * @class YAHOO.env.ua
- * @static
- */
-
-/**
- * parses a user agent string (or looks for one in navigator to parse if
- * not supplied).
- * @method parseUA
- * @since 2.9.0
- * @static
- */
-YAHOO.env.parseUA = function(agent) {
-
- var numberify = function(s) {
- var c = 0;
- return parseFloat(s.replace(/\./g, function() {
- return (c++ == 1) ? '' : '.';
- }));
- },
-
- nav = navigator,
-
- o = {
-
- /**
- * Internet Explorer version number or 0. Example: 6
- * @property ie
- * @type float
- * @static
- */
- ie: 0,
-
- /**
- * Opera version number or 0. Example: 9.2
- * @property opera
- * @type float
- * @static
- */
- opera: 0,
-
- /**
- * Gecko engine revision number. Will evaluate to 1 if Gecko
- * is detected but the revision could not be found. Other browsers
- * will be 0. Example: 1.8
- *
- * @property gecko
- * @type float
- * @static
- */
- gecko: 0,
-
- /**
- * AppleWebKit version. KHTML browsers that are not WebKit browsers
- * will evaluate to 1, other browsers 0. Example: 418.9
- *
- * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the
- * latest available for Mac OSX 10.3.
- * Safari 2.0.2: 416 <-- hasOwnProperty introduced
- * Safari 2.0.4: 418 <-- preventDefault fixed
- * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
- * different versions of webkit
- * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been
- * updated, but not updated
- * to the latest patch.
- * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native
- * SVG and many major issues fixed).
- * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic
- * update from 2.x via the 10.4.11 OS patch.
- * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event.
- * yahoo.com user agent hack removed.
- *
- * http://en.wikipedia.org/wiki/Safari_version_history
- * @property webkit
- * @type float
- * @static
- */
- webkit: 0,
-
- /**
- * Chrome will be detected as webkit, but this property will also
- * be populated with the Chrome version number
- * @property chrome
- * @type float
- * @static
- */
- chrome: 0,
-
- /**
- * The mobile property will be set to a string containing any relevant
- * user agent information when a modern mobile browser is detected.
- * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
- * devices with the WebKit-based browser, and Opera Mini.
- * @property mobile
- * @type string
- * @static
- */
- mobile: null,
-
- /**
- * Adobe AIR version number or 0. Only populated if webkit is detected.
- * Example: 1.0
- * @property air
- * @type float
- */
- air: 0,
- /**
- * Detects Apple iPad's OS version
- * @property ipad
- * @type float
- * @static
- */
- ipad: 0,
- /**
- * Detects Apple iPhone's OS version
- * @property iphone
- * @type float
- * @static
- */
- iphone: 0,
- /**
- * Detects Apples iPod's OS version
- * @property ipod
- * @type float
- * @static
- */
- ipod: 0,
- /**
- * General truthy check for iPad, iPhone or iPod
- * @property ios
- * @type float
- * @static
- */
- ios: null,
- /**
- * Detects Googles Android OS version
- * @property android
- * @type float
- * @static
- */
- android: 0,
- /**
- * Detects Palms WebOS version
- * @property webos
- * @type float
- * @static
- */
- webos: 0,
-
- /**
- * Google Caja version number or 0.
- * @property caja
- * @type float
- */
- caja: nav && nav.cajaVersion,
-
- /**
- * Set to true if the page appears to be in SSL
- * @property secure
- * @type boolean
- * @static
- */
- secure: false,
-
- /**
- * The operating system. Currently only detecting windows or macintosh
- * @property os
- * @type string
- * @static
- */
- os: null
-
- },
-
- ua = agent || (navigator && navigator.userAgent),
-
- loc = window && window.location,
-
- href = loc && loc.href,
-
- m;
-
- o.secure = href && (href.toLowerCase().indexOf("https") === 0);
-
- if (ua) {
-
- if ((/windows|win32/i).test(ua)) {
- o.os = 'windows';
- } else if ((/macintosh/i).test(ua)) {
- o.os = 'macintosh';
- } else if ((/rhino/i).test(ua)) {
- o.os = 'rhino';
- }
-
- // Modern KHTML browsers should qualify as Safari X-Grade
- if ((/KHTML/).test(ua)) {
- o.webkit = 1;
- }
- // Modern WebKit browsers are at least X-Grade
- m = ua.match(/AppleWebKit\/([^\s]*)/);
- if (m && m[1]) {
- o.webkit = numberify(m[1]);
-
- // Mobile browser check
- if (/ Mobile\//.test(ua)) {
- o.mobile = 'Apple'; // iPhone or iPod Touch
-
- m = ua.match(/OS ([^\s]*)/);
- if (m && m[1]) {
- m = numberify(m[1].replace('_', '.'));
- }
- o.ios = m;
- o.ipad = o.ipod = o.iphone = 0;
-
- m = ua.match(/iPad|iPod|iPhone/);
- if (m && m[0]) {
- o[m[0].toLowerCase()] = o.ios;
- }
- } else {
- m = ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/);
- if (m) {
- // Nokia N-series, Android, webOS, ex: NokiaN95
- o.mobile = m[0];
- }
- if (/webOS/.test(ua)) {
- o.mobile = 'WebOS';
- m = ua.match(/webOS\/([^\s]*);/);
- if (m && m[1]) {
- o.webos = numberify(m[1]);
- }
- }
- if (/ Android/.test(ua)) {
- o.mobile = 'Android';
- m = ua.match(/Android ([^\s]*);/);
- if (m && m[1]) {
- o.android = numberify(m[1]);
- }
-
- }
- }
-
- m = ua.match(/Chrome\/([^\s]*)/);
- if (m && m[1]) {
- o.chrome = numberify(m[1]); // Chrome
- } else {
- m = ua.match(/AdobeAIR\/([^\s]*)/);
- if (m) {
- o.air = m[0]; // Adobe AIR 1.0 or better
- }
- }
- }
-
- if (!o.webkit) { // not webkit
-// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
- m = ua.match(/Opera[\s\/]([^\s]*)/);
- if (m && m[1]) {
- o.opera = numberify(m[1]);
- m = ua.match(/Version\/([^\s]*)/);
- if (m && m[1]) {
- o.opera = numberify(m[1]); // opera 10+
- }
- m = ua.match(/Opera Mini[^;]*/);
- if (m) {
- o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
- }
- } else { // not opera or webkit
- m = ua.match(/MSIE\s([^;]*)/);
- if (m && m[1]) {
- o.ie = numberify(m[1]);
- } else { // not opera, webkit, or ie
- m = ua.match(/Gecko\/([^\s]*)/);
- if (m) {
- o.gecko = 1; // Gecko detected, look for revision
- m = ua.match(/rv:([^\s\)]*)/);
- if (m && m[1]) {
- o.gecko = numberify(m[1]);
- }
- }
- }
- }
- }
- }
-
- return o;
-};
-
-YAHOO.env.ua = YAHOO.env.parseUA();
-
-/*
- * Initializes the global by creating the default namespaces and applying
- * any new configuration information that is detected. This is the setup
- * for env.
- * @method init
- * @static
- * @private
- */
-(function() {
- YAHOO.namespace("util", "widget", "example");
- /*global YAHOO_config*/
- if ("undefined" !== typeof YAHOO_config) {
- var l=YAHOO_config.listener, ls=YAHOO.env.listeners,unique=true, i;
- if (l) {
- // if YAHOO is loaded multiple times we need to check to see if
- // this is a new config object. If it is, add the new component
- // load listener to the stack
- for (i=0; i': '>',
- '"': '"',
- "'": ''',
- '/': '/',
- '`': '`'
- },
-
- // ADD = ["toString", "valueOf", "hasOwnProperty"],
- ADD = ["toString", "valueOf"],
-
- OB = {
-
- /**
- * Determines wheather or not the provided object is an array.
- * @method isArray
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isArray: function(o) {
- return OP.toString.apply(o) === ARRAY_TOSTRING;
- },
-
- /**
- * Determines whether or not the provided object is a boolean
- * @method isBoolean
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isBoolean: function(o) {
- return typeof o === 'boolean';
- },
-
- /**
- * Determines whether or not the provided object is a function.
- * Note: Internet Explorer thinks certain functions are objects:
- *
- * var obj = document.createElement("object");
- * YAHOO.lang.isFunction(obj.getAttribute) // reports false in IE
- *
- * var input = document.createElement("input"); // append to body
- * YAHOO.lang.isFunction(input.focus) // reports false in IE
- *
- * You will have to implement additional tests if these functions
- * matter to you.
- *
- * @method isFunction
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isFunction: function(o) {
- return (typeof o === 'function') || OP.toString.apply(o) === FUNCTION_TOSTRING;
- },
-
- /**
- * Determines whether or not the provided object is null
- * @method isNull
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isNull: function(o) {
- return o === null;
- },
-
- /**
- * Determines whether or not the provided object is a legal number
- * @method isNumber
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isNumber: function(o) {
- return typeof o === 'number' && isFinite(o);
- },
-
- /**
- * Determines whether or not the provided object is of type object
- * or function
- * @method isObject
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isObject: function(o) {
-return (o && (typeof o === 'object' || L.isFunction(o))) || false;
- },
-
- /**
- * Determines whether or not the provided object is a string
- * @method isString
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isString: function(o) {
- return typeof o === 'string';
- },
-
- /**
- * Determines whether or not the provided object is undefined
- * @method isUndefined
- * @param {any} o The object being testing
- * @return {boolean} the result
- */
- isUndefined: function(o) {
- return typeof o === 'undefined';
- },
-
-
- /**
- * IE will not enumerate native functions in a derived object even if the
- * function was overridden. This is a workaround for specific functions
- * we care about on the Object prototype.
- * @property _IEEnumFix
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @static
- * @private
- */
- _IEEnumFix: (YAHOO.env.ua.ie) ? function(r, s) {
- var i, fname, f;
- for (i=0;i
- * Returns a copy of the specified string with special HTML characters
- * escaped. The following characters will be converted to their
- * corresponding character entities:
- * & < > " ' / `
- *
- *
- *
- * This implementation is based on the
- * OWASP
- * HTML escaping recommendations. In addition to the characters
- * in the OWASP recommendation, we also escape the `
- * character, since IE interprets it as an attribute delimiter when used in
- * innerHTML.
- *
- *
- * @method escapeHTML
- * @param {String} html String to escape.
- * @return {String} Escaped string.
- * @static
- * @since 2.9.0
- */
- escapeHTML: function (html) {
- return html.replace(/[&<>"'\/`]/g, function (match) {
- return HTML_CHARS[match];
- });
- },
-
- /**
- * Utility to set up the prototype, constructor and superclass properties to
- * support an inheritance strategy that can chain constructors and methods.
- * Static members will not be inherited.
- *
- * @method extend
- * @static
- * @param {Function} subc the object to modify
- * @param {Function} superc the object to inherit
- * @param {Object} overrides additional properties/methods to add to the
- * subclass prototype. These will override the
- * matching items obtained from the superclass
- * if present.
- */
- extend: function(subc, superc, overrides) {
- if (!superc||!subc) {
- throw new Error("extend failed, please check that " +
- "all dependencies are included.");
- }
- var F = function() {}, i;
- F.prototype=superc.prototype;
- subc.prototype=new F();
- subc.prototype.constructor=subc;
- subc.superclass=superc.prototype;
- if (superc.prototype.constructor == OP.constructor) {
- superc.prototype.constructor=superc;
- }
-
- if (overrides) {
- for (i in overrides) {
- if (L.hasOwnProperty(overrides, i)) {
- subc.prototype[i]=overrides[i];
- }
- }
-
- L._IEEnumFix(subc.prototype, overrides);
- }
- },
-
- /**
- * Applies all properties in the supplier to the receiver if the
- * receiver does not have these properties yet. Optionally, one or
- * more methods/properties can be specified (as additional
- * parameters). This option will overwrite the property if receiver
- * has it already. If true is passed as the third parameter, all
- * properties will be applied and _will_ overwrite properties in
- * the receiver.
- *
- * @method augmentObject
- * @static
- * @since 2.3.0
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @param {String*|boolean} arguments zero or more properties methods
- * to augment the receiver with. If none specified, everything
- * in the supplier will be used unless it would
- * overwrite an existing property in the receiver. If true
- * is specified as the third parameter, all properties will
- * be applied and will overwrite an existing property in
- * the receiver
- */
- augmentObject: function(r, s) {
- if (!s||!r) {
- throw new Error("Absorb failed, verify dependencies.");
- }
- var a=arguments, i, p, overrideList=a[2];
- if (overrideList && overrideList!==true) { // only absorb the specified properties
- for (i=2; i 0) ? L.dump(o[i], d-1) : OBJ);
- } else {
- s.push(o[i]);
- }
- s.push(COMMA);
- }
- if (s.length > 1) {
- s.pop();
- }
- s.push("]");
- // objects {k1 => v1, k2 => v2}
- } else {
- s.push("{");
- for (i in o) {
- if (L.hasOwnProperty(o, i)) {
- s.push(i + ARROW);
- if (L.isObject(o[i])) {
- s.push((d > 0) ? L.dump(o[i], d-1) : OBJ);
- } else {
- s.push(o[i]);
- }
- s.push(COMMA);
- }
- }
- if (s.length > 1) {
- s.pop();
- }
- s.push("}");
- }
-
- return s.join("");
- },
-
- /**
- * Does variable substitution on a string. It scans through the string
- * looking for expressions enclosed in { } braces. If an expression
- * is found, it is used a key on the object. If there is a space in
- * the key, the first word is used for the key and the rest is provided
- * to an optional function to be used to programatically determine the
- * value (the extra information might be used for this decision). If
- * the value for the key in the object, or what is returned from the
- * function has a string value, number value, or object value, it is
- * substituted for the bracket expression and it repeats. If this
- * value is an object, it uses the Object's toString() if this has
- * been overridden, otherwise it does a shallow dump of the key/value
- * pairs.
- *
- * By specifying the recurse option, the string is rescanned after
- * every replacement, allowing for nested template substitutions.
- * The side effect of this option is that curly braces in the
- * replacement content must be encoded.
- *
- * @method substitute
- * @since 2.3.0
- * @param s {String} The string that will be modified.
- * @param o {Object} An object containing the replacement values
- * @param f {Function} An optional function that can be used to
- * process each match. It receives the key,
- * value, and any extra metadata included with
- * the key inside of the braces.
- * @param recurse {boolean} default true - if not false, the replaced
- * string will be rescanned so that nested substitutions are possible.
- * @return {String} the substituted string
- */
- substitute: function (s, o, f, recurse) {
- var i, j, k, key, v, meta, saved=[], token, lidx=s.length,
- DUMP='dump', SPACE=' ', LBRACE='{', RBRACE='}',
- dump, objstr;
-
- for (;;) {
- i = s.lastIndexOf(LBRACE, lidx);
- if (i < 0) {
- break;
- }
- j = s.indexOf(RBRACE, i);
- if (i + 1 > j) {
- break;
- }
-
- //Extract key and meta info
- token = s.substring(i + 1, j);
- key = token;
- meta = null;
- k = key.indexOf(SPACE);
- if (k > -1) {
- meta = key.substring(k + 1);
- key = key.substring(0, k);
- }
-
- // lookup the value
- v = o[key];
-
- // if a substitution function was provided, execute it
- if (f) {
- v = f(key, v, meta);
- }
-
- if (L.isObject(v)) {
- if (L.isArray(v)) {
- v = L.dump(v, parseInt(meta, 10));
- } else {
- meta = meta || "";
-
- // look for the keyword 'dump', if found force obj dump
- dump = meta.indexOf(DUMP);
- if (dump > -1) {
- meta = meta.substring(4);
- }
-
- objstr = v.toString();
-
- // use the toString if it is not the Object toString
- // and the 'dump' meta info was not found
- if (objstr === OBJECT_TOSTRING || dump > -1) {
- v = L.dump(v, parseInt(meta, 10));
- } else {
- v = objstr;
- }
- }
- } else if (!L.isString(v) && !L.isNumber(v)) {
- // This {block} has no replace string. Save it for later.
- v = "~-" + saved.length + "-~";
- saved[saved.length] = token;
-
- // break;
- }
-
- s = s.substring(0, i) + v + s.substring(j + 1);
-
- if (recurse === false) {
- lidx = i-1;
- }
-
- }
-
- // restore saved {block}s
- for (i=saved.length-1; i>=0; i=i-1) {
- s = s.replace(new RegExp("~-" + i + "-~"), "{" + saved[i] + "}", "g");
- }
-
- return s;
- },
-
-
- /**
- * Returns a string without any leading or trailing whitespace. If
- * the input is not a string, the input will be returned untouched.
- * @method trim
- * @since 2.3.0
- * @param s {string} the string to trim
- * @return {string} the trimmed string
- */
- trim: function(s){
- try {
- return s.replace(/^\s+|\s+$/g, "");
- } catch(e) {
- return s;
- }
- },
-
- /**
- * Returns a new object containing all of the properties of
- * all the supplied objects. The properties from later objects
- * will overwrite those in earlier objects.
- * @method merge
- * @since 2.3.0
- * @param arguments {Object*} the objects to merge
- * @return the new merged object
- */
- merge: function() {
- var o={}, a=arguments, l=a.length, i;
- for (i=0; i
- * var A = function() {};
- * A.prototype.foo = 'foo';
- * var a = new A();
- * a.foo = 'foo';
- * alert(a.hasOwnProperty('foo')); // true
- * alert(YAHOO.lang.hasOwnProperty(a, 'foo')); // false when using fallback
- *
- * @method hasOwnProperty
- * @param {any} o The object being testing
- * @param prop {string} the name of the property to test
- * @return {boolean} the result
- */
-L.hasOwnProperty = (OP.hasOwnProperty) ?
- function(o, prop) {
- return o && o.hasOwnProperty && o.hasOwnProperty(prop);
- } : function(o, prop) {
- return !L.isUndefined(o[prop]) &&
- o.constructor.prototype[prop] !== o[prop];
- };
-
-// new lang wins
-OB.augmentObject(L, OB, true);
-
-/*
- * An alias for YAHOO.lang
- * @class YAHOO.util.Lang
- */
-YAHOO.util.Lang = L;
-
-/**
- * Same as YAHOO.lang.augmentObject, except it only applies prototype
- * properties. This is an alias for augmentProto.
- * @see YAHOO.lang.augmentObject
- * @method augment
- * @static
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @param {String*|boolean} arguments zero or more properties methods to
- * augment the receiver with. If none specified, everything
- * in the supplier will be used unless it would
- * overwrite an existing property in the receiver. if true
- * is specified as the third parameter, all properties will
- * be applied and will overwrite an existing property in
- * the receiver
- */
-L.augment = L.augmentProto;
-
-/**
- * An alias for YAHOO.lang.augment
- * @for YAHOO
- * @method augment
- * @static
- * @param {Function} r the object to receive the augmentation
- * @param {Function} s the object that supplies the properties to augment
- * @param {String*} arguments zero or more properties methods to
- * augment the receiver with. If none specified, everything
- * in the supplier will be used unless it would
- * overwrite an existing property in the receiver
- */
-YAHOO.augment = L.augmentProto;
-
-/**
- * An alias for YAHOO.lang.extend
- * @method extend
- * @static
- * @param {Function} subc the object to modify
- * @param {Function} superc the object to inherit
- * @param {Object} overrides additional properties/methods to add to the
- * subclass prototype. These will override the
- * matching items obtained from the superclass if present.
- */
-YAHOO.extend = L.extend;
-
-})();
-YAHOO.register("yahoo", YAHOO, {version: "2.9.0", build: "2800"});
-/**
- * Provides a mechanism to fetch remote resources and
- * insert them into a document
- * This utility can fetch JavaScript and CSS files, inserting script
- * tags for script and link tags for CSS. Note, this
- * is done via the normal browser mechanisms for inserting
- * these resources and making the content available to
- * code that would access it. Be careful when retreiving
- * remote resources. Only use this utility to fetch
- * files from sites you trust.
- *
- * @module get
- * @requires yahoo
- */
-
-/**
- * Fetches and inserts one or more script or link nodes into the document.
- * This utility can fetch JavaScript and CSS files, inserting script
- * tags for script and link tags for CSS. Note, this
- * is done via the normal browser mechanisms for inserting
- * these resources and making the content available to
- * code that would access it. Be careful when retreiving
- * remote resources. Only use this utility to fetch
- * files from sites you trust.
- *
- * @namespace YAHOO.util
- * @class YAHOO.util.Get
- */
-YAHOO.util.Get = function() {
-
- /**
- * hash of queues to manage multiple requests
- * @property queues
- * @private
- */
- var queues={},
-
- /**
- * queue index used to generate transaction ids
- * @property qidx
- * @type int
- * @private
- */
- qidx=0,
-
- /**
- * node index used to generate unique node ids
- * @property nidx
- * @type int
- * @private
- */
- nidx=0,
-
- /**
- * interal property used to prevent multiple simultaneous purge
- * processes
- * @property purging
- * @type boolean
- * @private
- */
- _purging=false,
-
- ua=YAHOO.env.ua,
-
- lang=YAHOO.lang,
-
- _fail,
- _purge,
- _track,
-
- /**
- * Generates an HTML element, this is not appended to a document
- * @method _node
- * @param type {string} the type of element
- * @param attr {string} the attributes
- * @param win {Window} optional window to create the element in
- * @return {HTMLElement} the generated node
- * @private
- */
- _node = function(type, attr, win) {
- var w = win || window, d=w.document, n=d.createElement(type), i;
-
- for (i in attr) {
- if (attr.hasOwnProperty(i)) {
- n.setAttribute(i, attr[i]);
- }
- }
-
- return n;
- },
-
- /**
- * Generates a link node
- * @method _linkNode
- * @param url {string} the url for the css file
- * @param win {Window} optional window to create the node in
- * @return {HTMLElement} the generated node
- * @private
- */
- _linkNode = function(url, win, attributes) {
-
- var o = {
- id: "yui__dyn_" + (nidx++),
- type: "text/css",
- rel: "stylesheet",
- href: url
- };
-
- if (attributes) {
- lang.augmentObject(o, attributes);
- }
-
- return _node("link", o, win);
- },
-
- /**
- * Generates a script node
- * @method _scriptNode
- * @param url {string} the url for the script file
- * @param win {Window} optional window to create the node in
- * @return {HTMLElement} the generated node
- * @private
- */
- _scriptNode = function(url, win, attributes) {
- var o = {
- id: "yui__dyn_" + (nidx++),
- type: "text/javascript",
- src: url
- };
-
- if (attributes) {
- lang.augmentObject(o, attributes);
- }
-
- return _node("script", o, win);
- },
-
- /**
- * Returns the data payload for callback functions
- * @method _returnData
- * @private
- */
- _returnData = function(q, msg) {
- return {
- tId: q.tId,
- win: q.win,
- data: q.data,
- nodes: q.nodes,
- msg: msg,
- purge: function() {
- _purge(this.tId);
- }
- };
- },
-
- _get = function(nId, tId) {
- var q = queues[tId],
- n = (lang.isString(nId)) ? q.win.document.getElementById(nId) : nId;
- if (!n) {
- _fail(tId, "target node not found: " + nId);
- }
-
- return n;
- },
-
-
- /**
- * The request is complete, so executing the requester's callback
- * @method _finish
- * @param id {string} the id of the request
- * @private
- */
- _finish = function(id) {
- YAHOO.log("Finishing transaction " + id);
- var q = queues[id], msg, context;
- q.finished = true;
-
- if (q.aborted) {
- msg = "transaction " + id + " was aborted";
- _fail(id, msg);
- return;
- }
-
- // execute success callback
- if (q.onSuccess) {
- context = q.scope || q.win;
- q.onSuccess.call(context, _returnData(q));
- }
- },
-
- /**
- * Timeout detected
- * @method _timeout
- * @param id {string} the id of the request
- * @private
- */
- _timeout = function(id) {
- YAHOO.log("Timeout " + id, "info", "get");
- var q = queues[id], context;
- if (q.onTimeout) {
- context = q.scope || q;
- q.onTimeout.call(context, _returnData(q));
- }
- },
-
- /**
- * Loads the next item for a given request
- * @method _next
- * @param id {string} the id of the request
- * @param loaded {string} the url that was just loaded, if any
- * @private
- */
- _next = function(id, loaded) {
-
- YAHOO.log("_next: " + id + ", loaded: " + loaded, "info", "Get");
-
- var q = queues[id], w=q.win, d=w.document, h=d.getElementsByTagName("head")[0],
- n, msg, url, s, extra;
-
- if (q.timer) {
- // Y.log('cancel timer');
- q.timer.cancel();
- }
-
- if (q.aborted) {
- msg = "transaction " + id + " was aborted";
- _fail(id, msg);
- return;
- }
-
- if (loaded) {
- q.url.shift();
- if (q.varName) {
- q.varName.shift();
- }
- } else {
- // This is the first pass: make sure the url is an array
- q.url = (lang.isString(q.url)) ? [q.url] : q.url;
- if (q.varName) {
- q.varName = (lang.isString(q.varName)) ? [q.varName] : q.varName;
- }
- }
-
-
- if (q.url.length === 0) {
- // Safari 2.x workaround - There is no way to know when
- // a script is ready in versions of Safari prior to 3.x.
- // Adding an extra node reduces the problem, but doesn't
- // eliminate it completely because the browser executes
- // them asynchronously.
- if (q.type === "script" && ua.webkit && ua.webkit < 420 &&
- !q.finalpass && !q.varName) {
- // Add another script node. This does not guarantee that the
- // scripts will execute in order, but it does appear to fix the
- // problem on fast connections more effectively than using an
- // arbitrary timeout. It is possible that the browser does
- // block subsequent script execution in this case for a limited
- // time.
- extra = _scriptNode(null, q.win, q.attributes);
- extra.innerHTML='YAHOO.util.Get._finalize("' + id + '");';
- q.nodes.push(extra); h.appendChild(extra);
-
- } else {
- _finish(id);
- }
-
- return;
- }
-
-
- url = q.url[0];
-
- // if the url is undefined, this is probably a trailing comma problem in IE
- if (!url) {
- q.url.shift();
- YAHOO.log('skipping empty url');
- return _next(id);
- }
-
- YAHOO.log("attempting to load " + url, "info", "Get");
-
- if (q.timeout) {
- // Y.log('create timer');
- q.timer = lang.later(q.timeout, q, _timeout, id);
- }
-
- if (q.type === "script") {
- n = _scriptNode(url, w, q.attributes);
- } else {
- n = _linkNode(url, w, q.attributes);
- }
-
- // track this node's load progress
- _track(q.type, n, id, url, w, q.url.length);
-
- // add the node to the queue so we can return it to the user supplied callback
- q.nodes.push(n);
-
- // add it to the head or insert it before 'insertBefore'
- if (q.insertBefore) {
- s = _get(q.insertBefore, id);
- if (s) {
- s.parentNode.insertBefore(n, s);
- }
- } else {
- h.appendChild(n);
- }
-
- YAHOO.log("Appending node: " + url, "info", "Get");
-
- // FireFox does not support the onload event for link nodes, so there is
- // no way to make the css requests synchronous. This means that the css
- // rules in multiple files could be applied out of order in this browser
- // if a later request returns before an earlier one. Safari too.
- if ((ua.webkit || ua.gecko) && q.type === "css") {
- _next(id, url);
- }
- },
-
- /**
- * Removes processed queues and corresponding nodes
- * @method _autoPurge
- * @private
- */
- _autoPurge = function() {
-
- if (_purging) {
- return;
- }
-
- _purging = true;
-
- var i, q;
-
- for (i in queues) {
- if (queues.hasOwnProperty(i)) {
- q = queues[i];
- if (q.autopurge && q.finished) {
- _purge(q.tId);
- delete queues[i];
- }
- }
- }
-
- _purging = false;
- },
-
- /**
- * Saves the state for the request and begins loading
- * the requested urls
- * @method queue
- * @param type {string} the type of node to insert
- * @param url {string} the url to load
- * @param opts the hash of options for this request
- * @private
- */
- _queue = function(type, url, opts) {
-
- var id = "q" + (qidx++), q;
- opts = opts || {};
-
- if (qidx % YAHOO.util.Get.PURGE_THRESH === 0) {
- _autoPurge();
- }
-
- queues[id] = lang.merge(opts, {
- tId: id,
- type: type,
- url: url,
- finished: false,
- aborted: false,
- nodes: []
- });
-
- q = queues[id];
- q.win = q.win || window;
- q.scope = q.scope || q.win;
- q.autopurge = ("autopurge" in q) ? q.autopurge :
- (type === "script") ? true : false;
-
- q.attributes = q.attributes || {};
- q.attributes.charset = opts.charset || q.attributes.charset || 'utf-8';
-
- lang.later(0, q, _next, id);
-
- return {
- tId: id
- };
- };
-
- /**
- * Detects when a node has been loaded. In the case of
- * script nodes, this does not guarantee that contained
- * script is ready to use.
- * @method _track
- * @param type {string} the type of node to track
- * @param n {HTMLElement} the node to track
- * @param id {string} the id of the request
- * @param url {string} the url that is being loaded
- * @param win {Window} the targeted window
- * @param qlength the number of remaining items in the queue,
- * including this one
- * @param trackfn {Function} function to execute when finished
- * the default is _next
- * @private
- */
- _track = function(type, n, id, url, win, qlength, trackfn) {
- var f = trackfn || _next, rs, q, a, freq, w, l, i, msg;
-
- // IE supports the readystatechange event for script and css nodes
- if (ua.ie) {
- n.onreadystatechange = function() {
- rs = this.readyState;
- if ("loaded" === rs || "complete" === rs) {
- YAHOO.log(id + " onload " + url, "info", "Get");
- n.onreadystatechange = null;
- f(id, url);
- }
- };
-
- // webkit prior to 3.x is problemmatic
- } else if (ua.webkit) {
-
- if (type === "script") {
-
- // Safari 3.x supports the load event for script nodes (DOM2)
- if (ua.webkit >= 420) {
-
- n.addEventListener("load", function() {
- YAHOO.log(id + " DOM2 onload " + url, "info", "Get");
- f(id, url);
- });
-
- // Nothing can be done with Safari < 3.x except to pause and hope
- // for the best, particularly after last script is inserted. The
- // scripts will always execute in the order they arrive, not
- // necessarily the order in which they were inserted. To support
- // script nodes with complete reliability in these browsers, script
- // nodes either need to invoke a function in the window once they
- // are loaded or the implementer needs to provide a well-known
- // property that the utility can poll for.
- } else {
- // Poll for the existence of the named variable, if it
- // was supplied.
- q = queues[id];
- if (q.varName) {
- freq = YAHOO.util.Get.POLL_FREQ;
- YAHOO.log("Polling for " + q.varName[0]);
- q.maxattempts = YAHOO.util.Get.TIMEOUT/freq;
- q.attempts = 0;
- q._cache = q.varName[0].split(".");
- q.timer = lang.later(freq, q, function(o) {
- a = this._cache;
- l = a.length;
- w = this.win;
- for (i=0; i this.maxattempts) {
- msg = "Over retry limit, giving up";
- q.timer.cancel();
- _fail(id, msg);
- } else {
- YAHOO.log(a[i] + " failed, retrying");
- }
- return;
- }
- }
-
- YAHOO.log("Safari poll complete");
-
- q.timer.cancel();
- f(id, url);
-
- }, null, true);
- } else {
- lang.later(YAHOO.util.Get.POLL_FREQ, null, f, [id, url]);
- }
- }
- }
-
- // FireFox and Opera support onload (but not DOM2 in FF) handlers for
- // script nodes. Opera, but not FF, supports the onload event for link
- // nodes.
- } else {
- n.onload = function() {
- YAHOO.log(id + " onload " + url, "info", "Get");
- f(id, url);
- };
- }
- };
-
- /*
- * The request failed, execute fail handler with whatever
- * was accomplished. There isn't a failure case at the
- * moment unless you count aborted transactions
- * @method _fail
- * @param id {string} the id of the request
- * @private
- */
- _fail = function(id, msg) {
- YAHOO.log("get failure: " + msg, "warn", "Get");
- var q = queues[id], context;
- // execute failure callback
- if (q.onFailure) {
- context = q.scope || q.win;
- q.onFailure.call(context, _returnData(q, msg));
- }
- };
-
- /**
- * Removes the nodes for the specified queue
- * @method _purge
- * @private
- */
- _purge = function(tId) {
- if (queues[tId]) {
-
- var q = queues[tId],
- nodes = q.nodes,
- l = nodes.length,
- d = q.win.document,
- h = d.getElementsByTagName("head")[0],
- sib, i, node, attr;
-
- if (q.insertBefore) {
- sib = _get(q.insertBefore, tId);
- if (sib) {
- h = sib.parentNode;
- }
- }
-
- for (i=0; i
- *
onSuccess
- *
- * callback to execute when the script(s) are finished loading
- * The callback receives an object back with the following
- * data:
- *
- *
win
- *
the window the script(s) were inserted into
- *
data
- *
the data object passed in when the request was made
- *
nodes
- *
An array containing references to the nodes that were
- * inserted
- *
purge
- *
A function that, when executed, will remove the nodes
- * that were inserted
- *
- *
- *
- *
onFailure
- *
- * callback to execute when the script load operation fails
- * The callback receives an object back with the following
- * data:
- *
- *
win
- *
the window the script(s) were inserted into
- *
data
- *
the data object passed in when the request was made
- *
nodes
- *
An array containing references to the nodes that were
- * inserted successfully
- *
purge
- *
A function that, when executed, will remove any nodes
- * that were inserted
- *
- *
- *
- *
onTimeout
- *
- * callback to execute when a timeout occurs.
- * The callback receives an object back with the following
- * data:
- *
- *
win
- *
the window the script(s) were inserted into
- *
data
- *
the data object passed in when the request was made
- *
nodes
- *
An array containing references to the nodes that were
- * inserted
- *
purge
- *
A function that, when executed, will remove the nodes
- * that were inserted
- *
- *
- *
- *
scope
- *
the execution context for the callbacks
- *
win
- *
a window other than the one the utility occupies
- *
autopurge
- *
- * setting to true will let the utilities cleanup routine purge
- * the script once loaded
- *
- *
data
- *
- * data that is supplied to the callback when the script(s) are
- * loaded.
- *
- *
varName
- *
- * variable that should be available when a script is finished
- * loading. Used to help Safari 2.x and below with script load
- * detection. The type of this property should match what was
- * passed into the url parameter: if loading a single url, a
- * string can be supplied. If loading multiple scripts, you
- * must supply an array that contains the variable name for
- * each script.
- *
- *
insertBefore
- *
node or node id that will become the new node's nextSibling
- *
- *
charset
- *
Node charset, deprecated, use 'attributes'
- *
attributes
- *
A hash of attributes to apply to dynamic nodes.
- *
timeout
- *
Number of milliseconds to wait before aborting and firing the timeout event
- *
- * // assumes yahoo, dom, and event are already on the page
- * YAHOO.util.Get.script(
- * ["http://yui.yahooapis.com/2.7.0/build/dragdrop/dragdrop-min.js",
- * "http://yui.yahooapis.com/2.7.0/build/animation/animation-min.js"], {
- * onSuccess: function(o) {
- * YAHOO.log(o.data); // foo
- * new YAHOO.util.DDProxy("dd1"); // also new o.reference("dd1"); would work
- * this.log("won't cause error because YAHOO is the scope");
- * this.log(o.nodes.length === 2) // true
- * // o.purge(); // optionally remove the script nodes immediately
- * },
- * onFailure: function(o) {
- * YAHOO.log("transaction failed");
- * },
- * data: "foo",
- * timeout: 10000, // 10 second timeout
- * scope: YAHOO,
- * // win: otherframe // target another window/frame
- * autopurge: true // allow the utility to choose when to remove the nodes
- * });
- *
- * @return {tId: string} an object containing info about the transaction
- */
- script: function(url, opts) { return _queue("script", url, opts); },
-
- /**
- * Fetches and inserts one or more css link nodes into the
- * head of the current document or the document in a specified
- * window.
- * @method css
- * @static
- * @param url {string} the url or urls to the css file(s)
- * @param opts Options:
- *
- *
onSuccess
- *
- * callback to execute when the css file(s) are finished loading
- * The callback receives an object back with the following
- * data:
- *
win
- *
the window the link nodes(s) were inserted into
- *
data
- *
the data object passed in when the request was made
- *
nodes
- *
An array containing references to the nodes that were
- * inserted
- *
purge
- *
A function that, when executed, will remove the nodes
- * that were inserted
- *
- *
- *
- *
scope
- *
the execution context for the callbacks
- *
win
- *
a window other than the one the utility occupies
- *
data
- *
- * data that is supplied to the callbacks when the nodes(s) are
- * loaded.
- *
- *
insertBefore
- *
node or node id that will become the new node's nextSibling
Selects the debug versions of the library (e.g., event-debug.js).
- * This option will automatically include the logger widget
- *
RAW
- *
Selects the non-minified version of the library (e.g., event.js).
- *
- * You can also define a custom filter, which must be an object literal
- * containing a search expression and a replace string:
- *
- * @property filter
- * @type string|{searchExp: string, replaceStr: string}
- */
- this.filter = null;
-
- /**
- * The list of requested modules
- * @property required
- * @type {string: boolean}
- */
- this.required = {};
-
- /**
- * The library metadata
- * @property moduleInfo
- */
- this.moduleInfo = lang.merge(YUI.info.moduleInfo);
-
- /**
- * List of rollup files found in the library metadata
- * @property rollups
- */
- this.rollups = null;
-
- /**
- * Whether or not to load optional dependencies for
- * the requested modules
- * @property loadOptional
- * @type boolean
- * @default false
- */
- this.loadOptional = false;
-
- /**
- * All of the derived dependencies in sorted order, which
- * will be populated when either calculate() or insert()
- * is called
- * @property sorted
- * @type string[]
- */
- this.sorted = [];
-
- /**
- * Set when beginning to compute the dependency tree.
- * Composed of what YAHOO reports to be loaded combined
- * with what has been loaded by the tool
- * @propery loaded
- * @type {string: boolean}
- */
- this.loaded = {};
-
- /**
- * Flag to indicate the dependency tree needs to be recomputed
- * if insert is called again.
- * @property dirty
- * @type boolean
- * @default true
- */
- this.dirty = true;
-
- /**
- * List of modules inserted by the utility
- * @property inserted
- * @type {string: boolean}
- */
- this.inserted = {};
-
- /**
- * Provides the information used to skin the skinnable components.
- * The following skin definition would result in 'skin1' and 'skin2'
- * being loaded for calendar (if calendar was requested), and
- * 'sam' for all other skinnable components:
- *
- *
- * skin: {
- *
- * // The default skin, which is automatically applied if not
- * // overriden by a component-specific skin definition.
- * // Change this in to apply a different skin globally
- * defaultSkin: 'sam',
- *
- * // This is combined with the loader base property to get
- * // the default root directory for a skin. ex:
- * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/
- * base: 'assets/skins/',
- *
- * // The name of the rollup css file for the skin
- * path: 'skin.css',
- *
- * // The number of skinnable components requested that are
- * // required before using the rollup file rather than the
- * // individual component css files
- * rollup: 3,
- *
- * // Any component-specific overrides can be specified here,
- * // making it possible to load different skins for different
- * // components. It is possible to load more than one skin
- * // for a given component as well.
- * overrides: {
- * calendar: ['skin1', 'skin2']
- * }
- * }
- *
- * @property skin
- */
-
- var self = this;
-
- env.listeners.push(function(m) {
- if (self._useYahooListener) {
- //Y.log("YAHOO listener: " + m.name);
- self.loadNext(m.name);
- }
- });
-
- this.skin = lang.merge(YUI.info.skin);
-
- this._config(o);
-
- };
-
- Y.util.YUILoader.prototype = {
-
- FILTERS: {
- RAW: {
- 'searchExp': "-min\\.js",
- 'replaceStr': ".js"
- },
- DEBUG: {
- 'searchExp': "-min\\.js",
- 'replaceStr': "-debug.js"
- }
- },
-
- SKIN_PREFIX: "skin-",
-
- _config: function(o) {
-
- // apply config values
- if (o) {
- for (var i in o) {
- if (lang.hasOwnProperty(o, i)) {
- if (i == "require") {
- this.require(o[i]);
- } else {
- this[i] = o[i];
- }
- }
- }
- }
-
- // fix filter
- var f = this.filter;
-
- if (lang.isString(f)) {
- f = f.toUpperCase();
-
- // the logger must be available in order to use the debug
- // versions of the library
- if (f === "DEBUG") {
- this.require("logger");
- }
-
- // hack to handle a a bug where LogWriter is being instantiated
- // at load time, and the loader has no way to sort above it
- // at the moment.
- if (!Y.widget.LogWriter) {
- Y.widget.LogWriter = function() {
- return Y;
- };
- }
-
- this.filter = this.FILTERS[f];
- }
-
- },
-
- /** Add a new module to the component metadata.
- *
- *
name:
required, the component name
- *
type:
required, the component type (js or css)
- *
path:
required, the path to the script from "base"
- *
requires:
array of modules required by this component
- *
optional:
array of optional modules for this component
- *
supersedes:
array of the modules this component replaces
- *
after:
array of modules the components which, if present, should be sorted above this one
- *
rollup:
the number of superseded modules required for automatic rollup
- *
fullpath:
If fullpath is specified, this is used instead of the configured base + path
- *
skinnable:
flag to determine if skin assets should automatically be pulled in
- *
- * @method addModule
- * @param o An object containing the module data
- * @return {boolean} true if the module was added, false if
- * the object passed in did not provide all required attributes
- */
- addModule: function(o) {
-
- if (!o || !o.name || !o.type || (!o.path && !o.fullpath)) {
- return false;
- }
-
- o.ext = ('ext' in o) ? o.ext : true;
- o.requires = o.requires || [];
-
- this.moduleInfo[o.name] = o;
- this.dirty = true;
-
- return true;
- },
-
- /**
- * Add a requirement for one or more module
- * @method require
- * @param what {string[] | string*} the modules to load
- */
- require: function(what) {
- var a = (typeof what === "string") ? arguments : what;
- this.dirty = true;
- YUI.ObjectUtil.appendArray(this.required, a);
- },
-
- /**
- * Adds the skin def to the module info
- * @method _addSkin
- * @param skin {string} the name of the skin
- * @param mod {string} the name of the module
- * @return {string} the module name for the skin
- * @private
- */
- _addSkin: function(skin, mod) {
-
- // Add a module definition for the skin rollup css
- var name = this.formatSkin(skin), info = this.moduleInfo,
- sinf = this.skin, ext = info[mod] && info[mod].ext;
-
- // Y.log('ext? ' + mod + ": " + ext);
- if (!info[name]) {
- // Y.log('adding skin ' + name);
- this.addModule({
- 'name': name,
- 'type': 'css',
- 'path': sinf.base + skin + '/' + sinf.path,
- //'supersedes': '*',
- 'after': sinf.after,
- 'rollup': sinf.rollup,
- 'ext': ext
- });
- }
-
- // Add a module definition for the module-specific skin css
- if (mod) {
- name = this.formatSkin(skin, mod);
- if (!info[name]) {
- var mdef = info[mod], pkg = mdef.pkg || mod;
- // Y.log('adding skin ' + name);
- this.addModule({
- 'name': name,
- 'type': 'css',
- 'after': sinf.after,
- 'path': pkg + '/' + sinf.base + skin + '/' + mod + '.css',
- 'ext': ext
- });
- }
- }
-
- return name;
- },
-
- /**
- * Returns an object containing properties for all modules required
- * in order to load the requested module
- * @method getRequires
- * @param mod The module definition from moduleInfo
- */
- getRequires: function(mod) {
- if (!mod) {
- return [];
- }
-
- if (!this.dirty && mod.expanded) {
- return mod.expanded;
- }
-
- mod.requires=mod.requires || [];
- var i, d=[], r=mod.requires, o=mod.optional, info=this.moduleInfo, m;
- for (i=0; iformatSkin, providing the skin name and
- * module name if the string matches the pattern for skins.
- * @method parseSkin
- * @param mod {string} the module name to parse
- * @return {skin: string, module: string} the parsed skin name
- * and module name, or null if the supplied string does not match
- * the skin pattern
- */
- parseSkin: function(mod) {
-
- if (mod.indexOf(this.SKIN_PREFIX) === 0) {
- var a = mod.split("-");
- return {skin: a[1], module: a[2]};
- }
-
- return null;
- },
-
- /**
- * Look for rollup packages to determine if all of the modules a
- * rollup supersedes are required. If so, include the rollup to
- * help reduce the total number of connections required. Called
- * by calculate()
- * @method _rollup
- * @private
- */
- _rollup: function() {
- var i, j, m, s, rollups={}, r=this.required, roll,
- info = this.moduleInfo;
-
- // find and cache rollup modules
- if (this.dirty || !this.rollups) {
- for (i in info) {
- if (lang.hasOwnProperty(info, i)) {
- m = info[i];
- //if (m && m.rollup && m.supersedes) {
- if (m && m.rollup) {
- rollups[i] = m;
- }
- }
- }
-
- this.rollups = rollups;
- }
-
- // make as many passes as needed to pick up rollup rollups
- for (;;) {
- var rolled = false;
-
- // go through the rollup candidates
- for (i in rollups) {
-
- // there can be only one
- if (!r[i] && !this.loaded[i]) {
- m =info[i]; s = m.supersedes; roll=false;
-
- if (!m.rollup) {
- continue;
- }
-
- var skin = (m.ext) ? false : this.parseSkin(i), c = 0;
-
- // Y.log('skin? ' + i + ": " + skin);
- if (skin) {
- for (j in r) {
- if (lang.hasOwnProperty(r, j)) {
- if (i !== j && this.parseSkin(j)) {
- c++;
- roll = (c >= m.rollup);
- if (roll) {
- // Y.log("skin rollup " + lang.dump(r));
- break;
- }
- }
- }
- }
-
- } else {
-
- // check the threshold
- for (j=0;j= m.rollup);
- if (roll) {
- // Y.log("over thresh " + c + ", " + lang.dump(r));
- break;
- }
- }
- }
- }
-
- if (roll) {
- // Y.log("rollup: " + i + ", " + lang.dump(this, 1));
- // add the rollup
- r[i] = true;
- rolled = true;
-
- // expand the rollup's dependencies
- this.getRequires(m);
- }
- }
- }
-
- // if we made it here w/o rolling up something, we are done
- if (!rolled) {
- break;
- }
- }
- },
-
- /**
- * Remove superceded modules and loaded modules. Called by
- * calculate() after we have the mega list of all dependencies
- * @method _reduce
- * @private
- */
- _reduce: function() {
-
- var i, j, s, m, r=this.required;
- for (i in r) {
-
- // remove if already loaded
- if (i in this.loaded) {
- delete r[i];
-
- // remove anything this module supersedes
- } else {
-
- var skinDef = this.parseSkin(i);
-
- if (skinDef) {
- //YAHOO.log("skin found in reduce: " + skinDef.skin + ", " + skinDef.module);
- // the skin rollup will not have a module name
- if (!skinDef.module) {
- var skin_pre = this.SKIN_PREFIX + skinDef.skin;
- //YAHOO.log("skin_pre: " + skin_pre);
- for (j in r) {
-
- if (lang.hasOwnProperty(r, j)) {
- m = this.moduleInfo[j];
- var ext = m && m.ext;
- if (!ext && j !== i && j.indexOf(skin_pre) > -1) {
- // Y.log ("removing component skin: " + j);
- delete r[j];
- }
- }
- }
- }
- } else {
-
- m = this.moduleInfo[i];
- s = m && m.supersedes;
- if (s) {
- for (j=0; j -1) {
- return true;
- }
-
- // check if this module should be sorted after the other
- if (after && YUI.ArrayUtil.indexOf(after, bb) > -1) {
- return true;
- }
-
- // if loadOptional is not specified, optional dependencies still
- // must be sorted correctly when present.
- if (checkOptional && optional && YUI.ArrayUtil.indexOf(optional, bb) > -1) {
- return true;
- }
-
- // check if this module requires one the other supersedes
- var ss=info[bb] && info[bb].supersedes;
- if (ss) {
- for (ii=0; ii startLen) {
- YAHOO.util.Get.script(self._filter(js), {
- data: self._loading,
- onSuccess: callback,
- onFailure: self._onFailure,
- onTimeout: self._onTimeout,
- insertBefore: self.insertBefore,
- charset: self.charset,
- timeout: self.timeout,
- scope: self
- });
- } else {
- this.loadNext();
- }
- };
-
- // load the css first
- // YAHOO.log('combining css: ' + css);
- if (css.length > startLen) {
- YAHOO.util.Get.css(this._filter(css), {
- data: this._loading,
- onSuccess: loadScript,
- onFailure: this._onFailure,
- onTimeout: this._onTimeout,
- insertBefore: this.insertBefore,
- charset: this.charset,
- timeout: this.timeout,
- scope: self
- });
- } else {
- loadScript();
- }
-
- return;
-
- } else {
- // this._combineComplete = true;
- this.loadNext(this._loading);
- }
- },
-
- /**
- * inserts the requested modules and their dependencies.
- * type can be "js" or "css". Both script and
- * css are inserted if type is not provided.
- * @method insert
- * @param o optional options object
- * @param type {string} the type of dependency to insert
- */
- insert: function(o, type) {
- // if (o) {
- // Y.log("insert: " + lang.dump(o, 1) + ", " + type);
- // } else {
- // Y.log("insert: " + this.toString() + ", " + type);
- // }
-
- // build the dependency list
- this.calculate(o);
-
-
- // set a flag to indicate the load has started
- this._loading = true;
-
- // flag to indicate we are done with the combo service
- // and any additional files will need to be loaded
- // individually
- // this._combineComplete = false;
-
- // keep the loadType (js, css or undefined) cached
- this.loadType = type;
-
- if (this.combine) {
- return this._combine();
- }
-
- if (!type) {
- // Y.log("trying to load css first");
- var self = this;
- this._internalCallback = function() {
- self._internalCallback = null;
- self.insert(null, "js");
- };
- this.insert(null, "css");
- return;
- }
-
-
- // start the load
- this.loadNext();
-
- },
-
- /**
- * Interns the script for the requested modules. The callback is
- * provided a reference to the sandboxed YAHOO object. This only
- * applies to the script: css can not be sandboxed; css will be
- * loaded into the page normally if specified.
- * @method sandbox
- * @param callback {Function} the callback to exectued when the load is
- * complete.
- */
- sandbox: function(o, type) {
- // if (o) {
- // YAHOO.log("sandbox: " + lang.dump(o, 1) + ", " + type);
- // } else {
- // YAHOO.log("sandbox: " + this.toString() + ", " + type);
- // }
-
- var self = this,
- success = function(o) {
-
- var idx=o.argument[0], name=o.argument[2];
-
- // store the response in the position it was requested
- self._scriptText[idx] = o.responseText;
-
- // YAHOO.log("received: " + o.responseText.substr(0, 100) + ", " + idx);
-
- if (self.onProgress) {
- self.onProgress.call(self.scope, {
- name: name,
- scriptText: o.responseText,
- xhrResponse: o,
- data: self.data
- });
- }
-
- // only generate the sandbox once everything is loaded
- self._loadCount++;
-
- if (self._loadCount >= self._stopCount) {
-
- // the variable to find
- var v = self.varName || "YAHOO";
-
- // wrap the contents of the requested modules in an anonymous function
- var t = "(function() {\n";
-
- // return the locally scoped reference.
- var b = "\nreturn " + v + ";\n})();";
-
- var ref = eval(t + self._scriptText.join("\n") + b);
-
- self._pushEvents(ref);
-
- if (ref) {
- self.onSuccess.call(self.scope, {
- reference: ref,
- data: self.data
- });
- } else {
- self._onFailure.call(self.varName + " reference failure");
- }
- }
- },
-
- failure = function(o) {
- self.onFailure.call(self.scope, {
- msg: "XHR failure",
- xhrResponse: o,
- data: self.data
- });
- };
-
- self._config(o);
-
- if (!self.onSuccess) {
-throw new Error("You must supply an onSuccess handler for your sandbox");
- }
-
- self._sandbox = true;
-
-
- // take care of any css first (this can't be sandboxed)
- if (!type || type !== "js") {
- self._internalCallback = function() {
- self._internalCallback = null;
- self.sandbox(null, "js");
- };
- self.insert(null, "css");
- return;
- }
-
- // get the connection manager if not on the page
- if (!util.Connect) {
- // get a new loader instance to load connection.
- var ld = new YAHOO.util.YUILoader();
- ld.insert({
- base: self.base,
- filter: self.filter,
- require: "connection",
- insertBefore: self.insertBefore,
- charset: self.charset,
- onSuccess: function() {
- self.sandbox(null, "js");
- },
- scope: self
- }, "js");
- return;
- }
-
- self._scriptText = [];
- self._loadCount = 0;
- self._stopCount = self.sorted.length;
- self._xhr = [];
-
- self.calculate();
-
- var s=self.sorted, l=s.length, i, m, url;
-
- for (i=0; i pageClass = DatesPage2.class;
- Date date = new GregorianCalendar(2010, 10, 6, 0, 0).getTime();
- tester.getSession().setLocale(Locale.GERMAN);
- tester.startPage(pageClass);
- tester.assertRenderedPage(pageClass);
- FormTester formTester = tester.newFormTester("form");
- formTester.setValue("dateTimeField:date", "06.11.2010");
- formTester.setValue("dateTimeField:hours", "00");
- formTester.setValue("dateTimeField:minutes", "00");
- formTester.setValue("dateField:date", "06.11.2010");
- formTester.submit();
- DatesPage2 page = (DatesPage2)tester.getLastRenderedPage();
-
- log.debug("orig: " + date.getTime() + "; date: " + page.date.getTime() + "; dateTime: " +
- page.dateTime.getTime());
- log.debug("orig: " + date + "; date: " + page.date + "; dateTime: " + page.dateTime);
- assertEquals(0, date.compareTo(page.dateTime));
- assertEquals(0, date.compareTo(page.date));
- }
-
- /**
- * Tests conversion of input for DateTimeField and DateField when the client and server are in
- * different time zones.
- *
- * @throws Exception
- */
- @Test
- public void testDateFieldInputTimezone() throws Exception
- {
- log.debug("=========== testDateFieldInputTimezone() =================");
- TimeZone tzClient = TimeZone.getTimeZone("America/Los_Angeles");
- TimeZone tzServer = TimeZone.getTimeZone("Europe/Berlin");
-
- TimeZone.setDefault(tzServer);
- DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer));
-
- Class extends Page> pageClass = DatesPage2.class;
- MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient));
- dt.setDateTime(2010, 11, 6, 0, 0, 0, 0);
- Date date = new Date(dt.getMillis());
-
- WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo();
- clientInfo.getProperties().setTimeZone(tzClient);
-
- tester.getSession().setLocale(Locale.GERMANY);
- tester.startPage(pageClass);
- tester.assertRenderedPage(pageClass);
- FormTester formTester = tester.newFormTester("form");
- formTester.setValue("dateTimeField:date", "06.11.2010");
- formTester.setValue("dateTimeField:hours", "00");
- formTester.setValue("dateTimeField:minutes", "00");
- formTester.setValue("dateField:date", "06.11.2010");
- formTester.submit();
-
- DatesPage2 page = (DatesPage2)tester.getLastRenderedPage();
-
- log.debug("orig: " + date.getTime() + "; date: " + page.date.getTime() + "; dateTime: " +
- page.dateTime.getTime());
- log.debug("orig: " + date + "; date: " + page.date + "; dateTime: " + page.dateTime);
- assertEquals(0, date.compareTo(page.dateTime));
- assertEquals(0, date.compareTo(page.date));
- }
-
- /**
- * Tests joda & jvm default time zone handling
- */
- @Test
- public void testJodaTimeDefaultTimeZone()
- {
- TimeZone origJvmDef = TimeZone.getDefault();
- DateTimeZone origJodaDef = DateTimeZone.getDefault();
-
- // lets find a timezone different from current default
- String newId = null;
- for (String id : TimeZone.getAvailableIDs())
- {
- if (!id.equals(origJvmDef.getID()))
- {
- newId = id;
- break;
- }
- }
-
- assertNotNull(newId);
-
- TimeZone.setDefault(TimeZone.getTimeZone(newId));
-
- TimeZone newJvmDef = TimeZone.getDefault();
- DateTimeZone newJodaDef = DateTimeZone.getDefault();
-
- // if this fails we are under security manager
- // and we have no right to set default timezone
- assertNotSame(origJvmDef, newJvmDef);
-
- // this should be true because joda caches the
- // default timezone and even for the first
- // lookup it uses a System property if possible
- // for more info see org.joda.time.DateTimeZone.getDefault()
- assertSame(origJodaDef, newJodaDef);
- }
-
- /**
- * Test date conversion with the server's time zone having a different current date than the
- * client time zone.
- *
- * @throws ParseException
- */
- @Test
- public void testDifferentDateTimeZoneConversion() throws ParseException
- {
- log.debug("=========== testDifferentDateTimeZoneConversion() =================");
- TimeZone origJvmDef = TimeZone.getDefault();
- DateTimeZone origJodaDef = DateTimeZone.getDefault();
- TimeZone tzClient = TimeZone.getTimeZone("GMT+14");
- TimeZone tzServer = TimeZone.getTimeZone("GMT-12");
-
- TimeZone.setDefault(tzServer);
- DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer));
-
- Class extends Page> pageClass = DatesPage2.class;
- MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient));
- dt.setDateTime(2010, 11, 6, 0, 0, 0, 0);
- Date date = new Date(dt.getMillis());
-
- WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo();
- clientInfo.getProperties().setTimeZone(tzClient);
-
- tester.getSession().setLocale(Locale.GERMANY);
- tester.startPage(pageClass);
- tester.assertRenderedPage(pageClass);
- FormTester formTester = tester.newFormTester("form");
- formTester.setValue("dateTimeField:date", "06.11.2010");
- formTester.setValue("dateTimeField:hours", "00");
- formTester.setValue("dateTimeField:minutes", "00");
- formTester.setValue("dateField:date", "06.11.2010");
- formTester.submit();
-
- DatesPage2 page = (DatesPage2)tester.getLastRenderedPage();
-
- log.debug("orig: " + date.getTime() + "; date: " + page.date.getTime() + "; dateTime: " +
- page.dateTime.getTime());
- log.debug("orig: " + date + "; date: " + page.date + "; dateTime: " + page.dateTime);
- assertEquals(0, date.compareTo(page.dateTime));
- assertEquals(0, date.compareTo(page.date));
-
- TimeZone.setDefault(origJvmDef);
- DateTimeZone.setDefault(origJodaDef);
- }
-
- /**
- * Test date conversion with the server's time zone having a different current date than the
- * client time zone using a Locale with am/pm style time.
- */
- @Test
- public void testDifferentDateTimeZoneConversionAMPM()
- {
- TimeZone origJvmDef = TimeZone.getDefault();
- DateTimeZone origJodaDef = DateTimeZone.getDefault();
- TimeZone tzClient = TimeZone.getTimeZone("GMT+14");
- TimeZone tzServer = TimeZone.getTimeZone("GMT-12");
-
- TimeZone.setDefault(tzServer);
- DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer));
-
- Class extends Page> pageClass = DatesPage2.class;
- MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient));
- dt.setDateTime(2010, 11, 6, 22, 0, 0, 0);
- Date date = new Date(dt.getMillis());
-
- WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo();
- clientInfo.getProperties().setTimeZone(tzClient);
-
- tester.getSession().setLocale(Locale.US);
- tester.startPage(pageClass);
- tester.assertRenderedPage(pageClass);
- FormTester formTester = tester.newFormTester("form");
- formTester.setValue("dateTimeField:date", "11/06/2010");
- formTester.setValue("dateTimeField:hours", "10");
- formTester.setValue("dateTimeField:minutes", "00");
- formTester.setValue("dateTimeField:amOrPmChoice", "1");
- formTester.submit();
-
- DatesPage2 page = (DatesPage2)tester.getLastRenderedPage();
-
- log.debug("orig: " + date.getTime() + "; dateTime: " + page.dateTime.getTime());
- log.debug("orig: " + date + "; dateTime: " + page.dateTime);
- assertEquals(0, date.compareTo(page.dateTime));
-
- TimeZone.setDefault(origJvmDef);
- DateTimeZone.setDefault(origJodaDef);
- }
-
- /**
- * Test time conversion for TimeField. The day, month, year of the TimeField model should not be
- * changed. The hours and minutes should be converted to the server's time zone based on the
- * day, month and year of the Date model.
- */
- @Test
- public void testTimeFieldDST()
- {
- TimeZone origJvmDef = TimeZone.getDefault();
- DateTimeZone origJodaDef = DateTimeZone.getDefault();
- TimeZone tzClient = TimeZone.getTimeZone("Canada/Eastern");
- TimeZone tzServer = TimeZone.getTimeZone("GMT");
-
- TimeZone.setDefault(tzServer);
- DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer));
- WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo();
- clientInfo.getProperties().setTimeZone(tzClient);
- tester.getSession().setLocale(Locale.GERMAN);
-
- // Test with standard time (in client time zone)
- MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient));
- dt.setDateTime(2010, 1, 15, 0, 0, 0, 0);
- Date date = new Date(dt.getMillis());
- DatesPage2 testPage = new DatesPage2();
- testPage.time = date;
- tester.startPage(testPage);
- FormTester formTester = tester.newFormTester("form");
- formTester.setValue("timeField:hours", "00");
- formTester.setValue("timeField:minutes", "00");
- formTester.submit();
- assertEquals(date, testPage.time);
-
- // Test with daylight savings time (in client time zone)
- dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient));
- dt.setDateTime(2010, 7, 15, 0, 0, 0, 0);
- date = new Date(dt.getMillis());
- testPage = new DatesPage2();
- testPage.time = date;
- tester.startPage(testPage);
- formTester = tester.newFormTester("form");
- formTester.setValue("timeField:hours", "00");
- formTester.setValue("timeField:minutes", "00");
- formTester.submit();
- assertEquals(date, testPage.time);
-
- TimeZone.setDefault(origJvmDef);
- DateTimeZone.setDefault(origJodaDef);
- }
-
- /**
- * Test StyleDateConverter with the server's time zone having a different current date than the
- * client time zone.
- *
- * @throws ParseException
- */
- @Test
- public void testStyleDateConverterTimeZoneDifference() throws ParseException
- {
- TimeZone origJvmDef = TimeZone.getDefault();
- DateTimeZone origJodaDef = DateTimeZone.getDefault();
-
- TimeZone tzClient = TimeZone.getTimeZone("GMT+14");
- TimeZone tzServer = TimeZone.getTimeZone("GMT-12");
-
- TimeZone.setDefault(tzServer);
- DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer));
-
- WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo();
- clientInfo.getProperties().setTimeZone(tzClient);
-
- StyleDateConverter converter = new StyleDateConverter(true);
-
- Calendar cal = Calendar.getInstance(tzClient);
- cal.set(2011, 10, 5, 0, 0, 0);
- cal.set(Calendar.MILLISECOND, 0);
-
- Date dateRef = cal.getTime();
- Date date = converter.convertToObject("05.11.2011", Locale.GERMANY);
- log.debug("ref: " + dateRef.getTime() + "; converted: " + date.getTime());
- log.debug("ref: " + dateRef + "; date: " + date);
- assertEquals(dateRef, date);
-
- TimeZone.setDefault(origJvmDef);
- DateTimeZone.setDefault(origJodaDef);
- }
-
- /**
- * Validates the "value" tags of the <input> fields for DateTimeField, DateField and
- * TimeField when they are given Date models containing Date instances.
- */
- @Test
- public void testDateFieldsWithDateModels()
- {
- TimeZone origJvmDef = TimeZone.getDefault();
- DateTimeZone origJodaDef = DateTimeZone.getDefault();
-
- TimeZone tzClient = TimeZone.getTimeZone("GMT-12");
- TimeZone tzServer = TimeZone.getTimeZone("GMT+14");
-
- TimeZone.setDefault(tzServer);
- DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer));
- WebClientInfo clientInfo = (WebClientInfo)tester.getSession().getClientInfo();
- clientInfo.getProperties().setTimeZone(tzClient);
-
- Calendar cal = Calendar.getInstance(tzServer);
- cal.set(2011, 5, 15, 10, 30, 0);
- cal.set(Calendar.MILLISECOND, 0);
- Date date = cal.getTime();
-
- DateFormat format = DateFormat.getDateInstance(DateFormat.SHORT, Locale.GERMAN);
- format.setTimeZone(tzClient);
- String dateRefString = format.format(date);
- cal.setTimeZone(tzClient);
- String hoursRefString = Integer.toString(cal.get(Calendar.HOUR_OF_DAY));
- String minutesRefString = Integer.toString(cal.get(Calendar.MINUTE));
-
- DatesPage2 testPage = new DatesPage2();
- testPage.dateTime = date;
- testPage.date = date;
- testPage.time = date;
- tester.getSession().setLocale(Locale.GERMAN);
- tester.startPage(testPage);
-
- String dateTimeFieldDateValue = tester.getTagByWicketId("dateTimeField")
- .getChild("wicket:id", "date")
- .getAttribute("value");
- assertEquals(dateRefString, dateTimeFieldDateValue);
- String dateTimeFieldHoursValue = tester.getTagByWicketId("dateTimeField")
- .getChild("wicket:id", "hours")
- .getAttribute("value");
- assertEquals(hoursRefString, dateTimeFieldHoursValue);
- String dateTimeFieldMinutesValue = tester.getTagByWicketId("dateTimeField")
- .getChild("wicket:id", "minutes")
- .getAttribute("value");
- assertEquals(minutesRefString, dateTimeFieldMinutesValue);
- String dateFieldValue = tester.getTagByWicketId("dateField")
- .getChild("wicket:id", "date")
- .getAttribute("value");
- assertEquals(dateRefString, dateFieldValue);
- String timeFieldHoursValue = tester.getTagByWicketId("timeField")
- .getChild("wicket:id", "hours")
- .getAttribute("value");
- assertEquals(hoursRefString, timeFieldHoursValue);
- String timeFieldMinutesValue = tester.getTagByWicketId("timeField")
- .getChild("wicket:id", "minutes")
- .getAttribute("value");
- assertEquals(minutesRefString, timeFieldMinutesValue);
-
- TimeZone.setDefault(origJvmDef);
- DateTimeZone.setDefault(origJodaDef);
- }
-
- /**
- *
- * @throws ParseException
- */
- @Test
- public void testDates1() throws ParseException
- {
- log.debug("=========== testDates1() =================");
- TimeZone tzClient = TimeZone.getTimeZone("America/Los_Angeles");
- TimeZone tzServer = TimeZone.getTimeZone("Europe/Berlin");
-
- TimeZone.setDefault(tzServer);
- DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer));
- Locale.setDefault(Locale.GERMANY);
-
-// Date orig = convertDate("06.11.2010", null, null, null, false, tzClient);
-// Date origJoda = convertDateJoda("06.11.2010", null, null, null, false, tzClient);
- Date orig3 = convertDateNew("06.11.2010", null, null, null, false, tzClient);
-
- MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient));
- dt.setDateTime(2010, 11, 6, 0, 0, 0, 0);
- Date date = new Date(dt.getMillis());
-
- log.debug(/* "actual: " + orig.getTime() + "; joda: " + origJoda.getTime() + */"; origNew: " +
- orig3.getTime() + "; expected: " + date.getTime());
- log.debug(/* "actual: " + orig + "; joda: " + origJoda + */"; origNew: " + orig3 +
- "; expected: " + date);
- assertEquals(date.getTime(), orig3.getTime());
-// assertEquals(date.getTime(), orig.getTime());
-// assertEquals(origJoda.getTime(), orig.getTime());
- }
-
- /**
- *
- * @throws ParseException
- */
- @Test
- public void testDates2() throws ParseException
- {
- log.debug("=========== testDates2() =================");
- TimeZone tzClient = TimeZone.getTimeZone("America/Los_Angeles");
- TimeZone tzServer = TimeZone.getTimeZone("Europe/Berlin");
-
- TimeZone.setDefault(tzServer);
- DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer));
- Locale.setDefault(Locale.GERMANY);
-
-// Date orig = convertDate("06.11.2010", 0, 0, AM_PM.AM, false, tzClient);
-// Date origJoda = convertDateJoda("06.11.2010", 0, 0, AM_PM.AM, false, tzClient);
- Date orig3 = convertDateNew("06.11.2010", 0, 0, AM_PM.AM, false, tzClient);
-
- MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient));
- dt.setDateTime(2010, 11, 6, 0, 0, 0, 0);
- Date date = new Date(dt.getMillis());
-
- log.debug(/* "actual: " + orig.getTime() + "; joda: " + origJoda.getTime() + */"; origNew: " +
- orig3.getTime() + "; expected: " + date.getTime());
- log.debug(/* "actual: " + orig + "; joda: " + origJoda + */"; origNew: " + orig3 +
- "; expected: " + date);
- assertEquals(date.getTime(), orig3.getTime());
-// assertEquals(date.getTime(), orig.getTime());
-// assertEquals(origJoda.getTime(), orig.getTime());
- }
-
- /**
- *
- * @throws ParseException
- */
- @Test
- public void testDates3() throws ParseException
- {
- log.debug("=========== testDates3() =================");
- TimeZone tzClient = TimeZone.getTimeZone("America/Los_Angeles");
- TimeZone tzServer = TimeZone.getTimeZone("Europe/Berlin");
-
- TimeZone.setDefault(tzServer);
- DateTimeZone.setDefault(DateTimeZone.forTimeZone(tzServer));
- Locale.setDefault(Locale.GERMANY);
-
-// Date orig = convertDate("06.11.2010", 12, 0, null, false, tzClient);
-// Date origJoda = convertDateJoda("06.11.2010", 12, 0, null, false, tzClient);
- Date orig3 = convertDateNew("06.11.2010", 12, 0, null, false, tzClient);
-
- MutableDateTime dt = new MutableDateTime(DateTimeZone.forTimeZone(tzClient));
- dt.setDateTime(2010, 11, 6, 12, 0, 0, 0);
- Date date = new Date(dt.getMillis());
-
- log.debug(/* "actual: " + orig.getTime() + "; joda: " + origJoda.getTime() + */"; origNew: " +
- orig3.getTime() + "; expected: " + date.getTime());
- log.debug(/* "actual: " + orig + "; joda: " + origJoda + */"; origNew: " + orig3 +
- "; expected: " + date);
- assertEquals(date.getTime(), orig3.getTime());
-// assertEquals(date.getTime(), orig.getTime());
-// assertEquals(origJoda.getTime(), orig.getTime());
- }
-
- /**
- * Simulate what DateTimeField does
- *
- * @param dateStr
- * @param hours
- * @param minutes
- * @param amOrPm
- * @param use12HourFormat
- * @param tzClient
- * @return Date
- * @throws ParseException
- */
- public Date convertDate(final String dateStr, final Integer hours, final Integer minutes,
- final AM_PM amOrPm, final boolean use12HourFormat, final TimeZone tzClient)
- throws ParseException
- {
- log.debug(">>> convertDate()");
- Date dateFieldInput = (dateStr != null ? DateFormat.getDateInstance().parse(dateStr) : null);
-
- // Default to today, if date entry was invisible
- final MutableDateTime date;
- if (dateFieldInput != null)
- {
- log.debug("1. dateFieldInput: " + dateFieldInput.getTime() + " " + dateFieldInput);
- date = new MutableDateTime(dateFieldInput);
- }
- else
- {
- log.debug("1. dateFieldInput: null");
- // Current date
- date = new MutableDateTime();
- }
- log.debug("2. mutable date: " + date.getMillis() + " " + date);
-
- // always set secs to 0
- date.setSecondOfMinute(0);
- log.debug("3. secs = 0: " + date.getMillis() + " " + date);
-
- // The AM/PM field
- if (use12HourFormat)
- {
- date.set(DateTimeFieldType.halfdayOfDay(), amOrPm == AM_PM.PM ? 1 : 0);
- }
- log.debug("4. AM/PM: " + date.getMillis() + " " + date);
-
- // The hours
- if (hours == null)
- {
- date.setHourOfDay(0);
- }
- else
- {
- date.set(DateTimeFieldType.hourOfDay(), hours % (use12HourFormat ? 12 : 24));
- }
- log.debug("5. hours: " + date.getMillis() + " " + date);
-
- // The minutes
- if (minutes == null)
- {
- date.setMinuteOfHour(0);
- }
- else
- {
- date.setMinuteOfHour(minutes);
- }
- log.debug("6. minutes: " + date.getMillis() + " " + date);
-
- // Use the client timezone to properly calculate the millisecs
- if (tzClient != null)
- {
- date.setZoneRetainFields(DateTimeZone.forTimeZone(tzClient));
- log.debug("7. zone: " + date.getMillis() + " " + date);
- }
-
- Date rtn = new Date(date.getMillis());
- log.debug("8. final date: " + rtn.getTime() + " " + rtn);
- return rtn;
- }
-
- /**
- * Simulate what DateTimeField does
- *
- * @param dateStr
- * @param hours
- * @param minutes
- * @param amOrPm
- * @param use12HourFormat
- * @param tzClient
- * @return Date
- * @throws ParseException
- */
- private Date convertDateNew(final String dateStr, final Integer hours, final Integer minutes,
- final AM_PM amOrPm, final boolean use12HourFormat, final TimeZone tzClient)
- throws ParseException
- {
- log.debug(">>> convertDateNew()");
- // This is what I get from field.getConvertedInput()
- Date dateFieldInput = (dateStr != null ? DateFormat.getDateInstance().parse(dateStr) : null);
-
- // Default with "now"
- if (dateFieldInput == null)
- {
- dateFieldInput = new Date();
- }
-
- // Get year, month and day ignoring any timezone of the Date object
- Calendar cal = Calendar.getInstance();
- cal.setTime(dateFieldInput);
- int year = cal.get(Calendar.YEAR);
- int month = cal.get(Calendar.MONTH) + 1;
- int day = cal.get(Calendar.DAY_OF_MONTH);
- int iHours = (hours == null ? 0 : hours % 24);
- int iMins = (minutes == null ? 0 : minutes);
-
- // Use the input to create a date object with proper timezone
- MutableDateTime date = new MutableDateTime(year, month, day, iHours, iMins, 0, 0,
- DateTimeZone.forTimeZone(tzClient));
-
- // Use the input to create a date object. Ignore the timezone provided by dateFieldInput and
- // use tzClient instead. No re-calculation will happen. It should be the same as above.
-// MutableDateTime date = new MutableDateTime(dateFieldInput,
-// DateTimeZone.forTimeZone(tzClient));
- log.debug("1. date: " + date.getMillis() + " " + date);
-
- // Adjust for halfday if needed
- int halfday;
- if (use12HourFormat)
- {
- halfday = (amOrPm == AM_PM.PM ? 1 : 0);
- date.set(DateTimeFieldType.halfdayOfDay(), halfday);
- date.set(DateTimeFieldType.hourOfDay(), iHours % 12);
- }
- log.debug("2. halfday adjustments: " + date.getMillis() + " " + date);
-
- Date rtn = new Date(date.getMillis());
- log.debug("3. final date: " + rtn.getTime() + " " + rtn);
- return rtn;
- }
-
- /**
- * Simulate what DateTimeField does
- *
- * @param dateStr
- * @param hours
- * @param minutes
- * @param amOrPm
- * @param use12HourFormat
- * @param tzClient
- * @return Date
- * @throws ParseException
- */
- private Date convertDateJoda(final String dateStr, final Integer hours, final Integer minutes,
- final AM_PM amOrPm, final boolean use12HourFormat, final TimeZone tzClient)
- throws ParseException
- {
- log.debug(">>> convertDateJoda()");
-
- DateTimeFormatter fmt = DateTimeFormat.shortDate();
- // fmt.withZone(timeZone).parseDateTime("10/1/06 5:00 AM");
- MutableDateTime date = (dateStr != null ? fmt.parseMutableDateTime(dateStr)
- : new MutableDateTime());
-
- log.debug("1. mutable date: " + date.getMillis() + " " + date);
-
- // always set secs to 0
- date.setSecondOfMinute(0);
- log.debug("2. secs = 0: " + date.getMillis() + " " + date);
-
- // The AM/PM field
- if (use12HourFormat)
- {
- date.set(DateTimeFieldType.halfdayOfDay(), amOrPm == AM_PM.PM ? 1 : 0);
- }
- log.debug("3. AM/PM: " + date.getMillis() + " " + date);
-
- // The hours
- if (hours == null)
- {
- date.setHourOfDay(0);
- }
- else
- {
- date.set(DateTimeFieldType.hourOfDay(), hours % (use12HourFormat ? 12 : 24));
- }
- log.debug("4. hours: " + date.getMillis() + " " + date);
-
- // The minutes
- if (minutes == null)
- {
- date.setMinuteOfHour(0);
- }
- else
- {
- date.setMinuteOfHour(minutes);
- }
- log.debug("5. minutes: " + date.getMillis() + " " + date);
-
- // Use the client timezone to properly calculate the millisecs
- if (tzClient != null)
- {
- date.setZoneRetainFields(DateTimeZone.forTimeZone(tzClient));
- }
- log.debug("6. timezone: " + date.getMillis() + " " + date);
-
- Date rtn = new Date(date.getMillis());
- log.debug("7. final date: " + rtn.getTime() + " " + rtn);
- return rtn;
- }
-
- /**
- * Use -Dwicket.replace.expected.results=true to automatically replace the expected
- * output file.
- *
- * @param
- *
- * @param pageClass
- * @param filename
- * @throws Exception
- */
- protected void myTestExecution(final Class pageClass, final String filename)
- throws Exception
- {
- System.out.println("=== " + pageClass.getName() + " ===");
-
- tester.getSession().setLocale(Locale.ITALIAN);
- tester.startPage(pageClass);
- tester.assertRenderedPage(pageClass);
-
- String document = tester.getLastResponseAsString();
- document = document.replaceAll("\\d\\d\\.\\d\\d\\.\\d\\d", "xx.xx.xx");
- document = document.replaceAll("\\d\\d/\\d\\d/\\d\\d\\d\\d", "xx/xx/xxxx");
- document = document.replaceAll("\\d\\d/\\d\\d/\\d\\d", "xx/xx/xx");
- document = document.replaceAll("\\d\\d/\\d\\d\\d\\d", "xx/xxxx");
-
- DiffUtil.validatePage(document, pageClass, filename, true);
- }
-}
diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DateTimeFieldTest.java b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DateTimeFieldTest.java
deleted file mode 100644
index c5f636b0f8c..00000000000
--- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DateTimeFieldTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.extensions.yui.calendar;
-
-import java.util.TimeZone;
-
-import org.apache.wicket.model.Model;
-import org.apache.wicket.util.tester.WicketTestCase;
-import org.joda.time.DateTime;
-import org.joda.time.DateTimeZone;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Tests for DateTimeField
- */
-public class DateTimeFieldTest extends WicketTestCase
-{
- /**
- * https://issues.apache.org/jira/browse/WICKET-5204
- */
- @Test
- public void testTimeZones()
- {
- DateTimeZone defaultTimeZone = DateTimeZone.getDefault();
-
- try
- {
- // The server is using UTC as it's default timezone
- DateTimeZone.setDefault(DateTimeZone.forID("UTC"));
-
- final String clientTimezone = "America/Toronto";
-
- DateTime jan01_10am = new DateTime(2013, 01, 01, 10, 0, 0,
- DateTimeZone.forID(clientTimezone));
-
- DateTimeField dateTimeField = new DateTimeField("foo", Model.of(jan01_10am.toDate()))
- {
- @Override
- protected TimeZone getClientTimeZone()
- {
- return TimeZone.getTimeZone(clientTimezone);
- }
- };
-
- tester.startComponentInPage(dateTimeField);
-
- Assert.assertEquals("The hour of day is incorrect!", jan01_10am.getHourOfDay(),
- dateTimeField.getHours().intValue());
- }
- finally
- {
- DateTimeZone.setDefault(defaultTimeZone);
- }
- }
-
-}
diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.html b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.html
deleted file mode 100644
index 228885658a5..00000000000
--- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-Wicket Examples - dates
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.java b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.java
deleted file mode 100644
index a632e9795f9..00000000000
--- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.extensions.yui.calendar;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.wicket.Session;
-import org.apache.wicket.datetime.StyleDateConverter;
-import org.apache.wicket.datetime.markup.html.form.DateTextField;
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.form.ChoiceRenderer;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.FormComponentUpdatingBehavior;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.PropertyModel;
-
-/**
- * Demonstrates components from the wicket-date project and a bunch of locale fiddling.
- */
-public class DatesPage1 extends WebPage
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * Choice for a locale.
- */
- private final class LocaleChoiceRenderer extends ChoiceRenderer
- {
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor.
- */
- public LocaleChoiceRenderer()
- {
- }
-
- /**
- * @see org.apache.wicket.markup.html.form.IChoiceRenderer#getDisplayValue(Object)
- */
- @Override
- public Object getDisplayValue(Locale locale)
- {
- String enName = locale.getDisplayName(LOCALE_EN);
- String localizedName = locale.getDisplayName(selectedLocale);
- return localizedName + (!enName.equals(localizedName) ? (" (" + enName + ")") : "");
- }
- }
-
- /**
- * Dropdown with Locales.
- */
- private final class LocaleDropDownChoice extends DropDownChoice
- {
- private static final long serialVersionUID = 1L;
-
- /**
- * Construct.
- *
- * @param id
- * component id
- */
- public LocaleDropDownChoice(String id)
- {
- super(id);
- // sort locales on strings of selected locale
- setChoices(new IModel>()
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- public List getObject()
- {
- getSelectedLocale();
- List locales = new ArrayList<>(LOCALES);
- Collections.sort(locales, new Comparator()
- {
- @Override
- public int compare(Locale o1, Locale o2)
- {
- return o1.getDisplayName(selectedLocale).compareTo(
- o2.getDisplayName(selectedLocale));
- }
- });
- return locales;
- }
- });
- setChoiceRenderer(new LocaleChoiceRenderer());
- setDefaultModel(new PropertyModel<>(DatesPage1.this, "selectedLocale"));
-
- add(new FormComponentUpdatingBehavior());
- }
-
- @Override
- public String getModelValue()
- {
- return super.getModelValue();
- }
- }
-
- private static final Locale LOCALE_EN = new Locale("en");
-
- private static final List LOCALES;
- static
- {
- LOCALES = Arrays.asList(Locale.CANADA, Locale.CANADA_FRENCH, Locale.CHINA, Locale.ENGLISH,
- Locale.FRANCE, Locale.FRENCH, Locale.GERMAN, Locale.GERMANY, Locale.ITALIAN,
- Locale.ITALY, Locale.JAPAN, Locale.JAPANESE, Locale.KOREA, Locale.KOREAN, Locale.PRC,
- Locale.SIMPLIFIED_CHINESE, Locale.TAIWAN, Locale.TRADITIONAL_CHINESE, Locale.UK,
- Locale.US);
- }
-
- private final Date date = new Date();
-
- private Locale selectedLocale = LOCALE_EN;
-
- /**
- * Constructor
- */
- public DatesPage1()
- {
- selectedLocale = Session.get().getLocale();
- Form> localeForm = new Form<>("localeForm");
- localeForm.add(new LocaleDropDownChoice("localeSelect"));
- localeForm.add(new Link("localeUSLink")
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- public void onClick()
- {
- selectedLocale = LOCALE_EN;
- }
- });
- add(localeForm);
- DateTextField dateTextField = new DateTextField("dateTextField", new PropertyModel(
- this, "date"), new StyleDateConverter("S-", true))
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- public Locale getLocale()
- {
- return selectedLocale;
- }
- };
- Form> form = new Form("form")
- {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void onSubmit()
- {
- info("set date to " + date);
- }
- };
- add(form);
- form.add(dateTextField);
- dateTextField.add(new DatePicker());
- add(new FeedbackPanel("feedback"));
- }
-
- /**
- * @return the selected locale
- */
- public final Locale getSelectedLocale()
- {
- return selectedLocale;
- }
-
- /**
- * @param selectedLocale
- */
- public final void setSelectedLocale(Locale selectedLocale)
- {
- this.selectedLocale = selectedLocale;
- }
-}
diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1_ExpectedResult.html b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1_ExpectedResult.html
deleted file mode 100644
index 907ce6c2216..00000000000
--- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage1_ExpectedResult.html
+++ /dev/null
@@ -1,142 +0,0 @@
-
-
-
-
-
-
-Wicket Examples - dates
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.html b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.html
deleted file mode 100644
index 09bde3a550c..00000000000
--- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
diff --git a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.java b/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.java
deleted file mode 100644
index 827d10d0054..00000000000
--- a/wicket-datetime/src/test/java/org/apache/wicket/extensions/yui/calendar/DatesPage2.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.extensions.yui.calendar;
-
-import java.util.Date;
-
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.PropertyModel;
-
-/**
- * Demonstrates components from the wicket-date project and a bunch of locale fiddling.
- */
-public class DatesPage2 extends WebPage
-{
- private static final long serialVersionUID = 1L;
-
- /** */
- public Date dateTime;
-
- /** */
- public Date date;
-
- /** */
- public Date time;
-
- /**
- * Constructor
- */
- public DatesPage2()
- {
- Form> form = new Form<>("form");
- add(form);
-
- form.add(new DateTimeField("dateTimeField", new PropertyModel(this, "dateTime")));
- form.add(new DateField("dateField", new PropertyModel(this, "date")));
- form.add(new TimeField("timeField", new PropertyModel(this, "time")));
- }
-}
\ No newline at end of file
diff --git a/wicket-datetime/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java b/wicket-datetime/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java
deleted file mode 100644
index 23887a3e2d2..00000000000
--- a/wicket-datetime/src/test/java/org/apache/wicket/util/license/ApacheLicenceHeaderTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.license;
-
-/**
- * Test that the license headers are in place in this project. The tests are run from
- * {@link ApacheLicenseHeaderTestCase}, but you can add project specific tests here if needed.
- *
- * @author Frank Bille Jensen (frankbille)
- */
-public class ApacheLicenceHeaderTest extends ApacheLicenseHeaderTestCase
-{
- /**
- * Construct.
- */
- public ApacheLicenceHeaderTest()
- {
- // addHeaders = true;
-
- /*
- * See NOTICE.txt
- */
- htmlIgnore.add("src/main/java/org/apache/wicket/util/diff");
-
- /*
- * YUI lib. See NOTICE
- */
- cssIgnore.add("src/main/java/org/apache/wicket/extensions/yui/calendar/assets/skins/sam/calendar.css");
- cssIgnore.add("src/main/java/org/apache/wicket/extensions/yui/calendar/assets/skins/sam/calendar.css");
-
- /*
- * YUI lib. See NOTICE
- */
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yuiloader/yuiloader.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yuiloader/yuiloader-min.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yahoo/yahoo-min.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/yahoodomevent/yahoo-dom-event.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/event/event.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/event/event-min.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/dom/dom.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/dom/dom-min.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/calendar/calendar.js");
- javaScriptIgnore.add("src/main/java/org/apache/wicket/extensions/yui/calendar/calendar-min.js");
- }
-}
diff --git a/wicket-datetime/src/test/java/org/apache/wicket/util/markup/xhtml/WellFormedXmlTest.java b/wicket-datetime/src/test/java/org/apache/wicket/util/markup/xhtml/WellFormedXmlTest.java
deleted file mode 100644
index a8e7628aa40..00000000000
--- a/wicket-datetime/src/test/java/org/apache/wicket/util/markup/xhtml/WellFormedXmlTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.wicket.util.markup.xhtml;
-
-import org.junit.Test;
-
-/**
- * Checks that the html markup files are well formed xml-s.
- *
- * @author akiraly
- */
-public class WellFormedXmlTest extends WellFormedXmlTestCase
-{
- @Test
- @Override
- public void markupFiles()
- {
- super.markupFiles();
- }
-}
diff --git a/wicket-examples/.tomcatplugin b/wicket-examples/.tomcatplugin
index d0a1479d6ca..75ef825dd2e 100644
--- a/wicket-examples/.tomcatplugin
+++ b/wicket-examples/.tomcatplugin
@@ -10,7 +10,6 @@
/wicket/wicket-auth-roles/target/classes
- /wicket-datetime/target/classes/wicket-examples/target/classes/wicket-extensions/target/classes/wicket-guice/target/classes
@@ -28,7 +27,6 @@
M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jarM2_REPO/easymock/easymock/1.2_Java1.3/easymock-1.2_Java1.3.jarM2_REPO/javax/portlet/portlet-api/1.0/portlet-api-1.0.jar
- M2_REPO/joda-time/joda-time/1.4/joda-time-1.4.jarM2_REPO/jtidy/jtidy/4aug2000r7-dev/jtidy-4aug2000r7-dev.jarM2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jarM2_REPO/logkit/logkit/1.0.1/logkit-1.0.1.jar
diff --git a/wicket-examples/pom.xml b/wicket-examples/pom.xml
index 76366e2d385..78497801ae7 100644
--- a/wicket-examples/pom.xml
+++ b/wicket-examples/pom.xml
@@ -31,32 +31,32 @@
action.
-
- 1.0.0
-
+
+ 1.0.0
+
-
-
- com.github.axet
- kaptcha
- 0.0.9
-
-
- com.github.cage
- cage
- 1.0
-
-
- org.codelibs
- jhighlight
- 1.0.3
-
-
- javax.servlet
- servlet-api
-
-
+
+
+ com.github.axet
+ kaptcha
+ 0.0.9
+
+
+ com.github.cage
+ cage
+ 1.0
+
+
+ org.codelibs
+ jhighlight
+ 1.0.3
+
+
+ javax.servlet
+ servlet-api
+
+
@@ -118,10 +118,6 @@
org.apache.wicketwicket-core
-
- org.apache.wicket
- wicket-datetime
- org.apache.wicketwicket-devutils
@@ -146,10 +142,10 @@
org.apache.wicketwicket-velocity
-
- org.apache.wicket
- wicket-native-websocket-javax
-
+
+ org.apache.wicket
+ wicket-native-websocket-javax
+ org.codelibsjhighlight
@@ -239,38 +235,38 @@
-
- org.apache.maven.plugins
- maven-javadoc-plugin
-
- true
-
-
-
- org.apache.maven.plugins
- maven-war-plugin
-
-
-
-
- true
- true
-
-
-
-
-
- org.mortbay.jetty
- jetty-maven-plugin
- ${jetty.version}
-
-
- javax.validation
- validation-api
- 1.1.0.Final
-
-
-
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-war-plugin
+
+
+
+
+ true
+ true
+
+
+
+
+
+ org.mortbay.jetty
+ jetty-maven-plugin
+ ${jetty.version}
+
+
+ javax.validation
+ validation-api
+ 1.1.0.Final
+
+
+
diff --git a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html
index c5e8099b212..528940efeca 100644
--- a/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html
+++ b/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.html
@@ -2,11 +2,11 @@
This is modal window
-
@@ -18,13 +18,11 @@