diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/AbstractRemoteCallUIBean.java
similarity index 97%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/AbstractRemoteCallUIBean.java
index 6a5ae4ca7..08cddca7e 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/AbstractRemoteCallUIBean.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/AbstractRemoteCallUIBean.java
@@ -15,11 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.struts2.components.ClosingUIBean;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
@@ -88,6 +89,11 @@ public abstract class AbstractRemoteCallUIBean extends ClosingUIBean implements
}
+ @Override
+ public String getTheme() {
+ return "ajax";
+ }
+
@StrutsTagAttribute(description="Topic that will trigger the remote call")
public void setListenTopics(String listenTopics) {
this.listenTopics = listenTopics;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/Anchor.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java
similarity index 93%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/Anchor.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java
index 51e11e6a2..34e4491a8 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/Anchor.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Anchor.java
@@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -80,7 +80,7 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*
*/
-@StrutsTag(name="a", tldTagClass="org.apache.struts2.views.jsp.ui.AnchorTag", description="Render a HTML href element that when clicked can optionally call a URL via remote XMLHttpRequest and updates its targets")
+@StrutsTag(name="a", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.AnchorTag", description="Render a HTML href element that when clicked can optionally call a URL via remote XMLHttpRequest and updates its targets")
public class Anchor extends AbstractRemoteCallUIBean {
public static final String OPEN_TEMPLATE = "a";
public static final String TEMPLATE = "a-close";
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/Autocompleter.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java
similarity index 97%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/Autocompleter.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java
index 57bf634c5..c2e1f8dd2 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/Autocompleter.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Autocompleter.java
@@ -18,11 +18,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.struts2.components.ComboBox;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
@@ -45,7 +46,7 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*
*/
-@StrutsTag(name="autocompleter", tldTagClass="org.apache.struts2.views.jsp.ui.AutocompleterTag", description="Renders a combobox with autocomplete and AJAX capabilities")
+@StrutsTag(name="autocompleter", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.AutocompleterTag", description="Renders a combobox with autocomplete and AJAX capabilities")
@StrutsTagSkipInheritance
public class Autocompleter extends ComboBox {
public static final String TEMPLATE = "autocompleter";
@@ -146,6 +147,11 @@ public class Autocompleter extends ComboBox {
addParameter("key", findString(keyNameExpr));
}
+ @Override
+ public String getTheme() {
+ return "ajax";
+ }
+
protected Object findListValue() {
return (list != null) ? findValue(list, Object.class) : null;
}
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/DateTimePicker.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java
similarity index 97%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/DateTimePicker.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java
index f1e08fe8f..a40654952 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/DateTimePicker.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/DateTimePicker.java
@@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
import java.text.ParseException;
import java.text.SimpleDateFormat;
@@ -29,6 +29,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.components.UIBean;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
@@ -126,7 +127,7 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*
*/
-@StrutsTag(name="datetimepicker", tldTagClass="org.apache.struts2.views.jsp.ui.DateTimePickerTag", description="Render datetimepicker")
+@StrutsTag(name="datetimepicker", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.DateTimePickerTag", description="Render datetimepicker")
@StrutsTagSkipInheritance
public class DateTimePicker extends UIBean {
@@ -213,6 +214,11 @@ public class DateTimePicker extends UIBean {
}
}
+ @Override
+ public String getTheme() {
+ return "ajax";
+ }
+
@StrutsTagAttribute(description="If true, weekly size of calendar changes to acomodate the month if false," +
" 42 day format is used", type="Boolean", defaultValue="false")
public void setAdjustWeeks(String adjustWeeks) {
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/Div.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java
similarity index 96%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/Div.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java
index f6ac44ee7..f01791f91 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/Div.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Div.java
@@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -58,7 +58,7 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*
*/
-@StrutsTag(name="div", tldTagClass="org.apache.struts2.views.jsp.ui.DivTag", description="Render HTML div providing content from remote call via AJAX")
+@StrutsTag(name="div", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.DivTag", description="Render HTML div providing content from remote call via AJAX")
public class Div extends AbstractRemoteCallUIBean {
public static final String TEMPLATE = "div";
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/RemoteUICallBean.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/RemoteUICallBean.java
similarity index 97%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/RemoteUICallBean.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/RemoteUICallBean.java
index 7e040e3b4..2f7524dd5 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/RemoteUICallBean.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/RemoteUICallBean.java
@@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
public interface RemoteUICallBean {
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/Submit.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java
similarity index 97%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/Submit.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java
index c6d1a0ef2..67a0f7573 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/Submit.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Submit.java
@@ -18,7 +18,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
import java.io.Writer;
@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.components.FormButton;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
@@ -91,7 +92,7 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*
*/
-@StrutsTag(name="submit", tldTagClass="org.apache.struts2.views.jsp.ui.SubmitTag", description="Render a submit button")
+@StrutsTag(name="submit", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.SubmitTag", description="Render a submit button")
@StrutsTagSkipInheritance
public class Submit extends FormButton implements RemoteUICallBean {
@@ -175,6 +176,11 @@ public class Submit extends FormButton implements RemoteUICallBean {
addParameter("showLoadingText", findString(showLoadingText));
}
+ @Override
+ public String getTheme() {
+ return "ajax";
+ }
+
/**
* Indicate whether the concrete button supports the type "image".
*
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/TabbedPanel.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java
similarity index 94%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/TabbedPanel.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java
index abc08d838..0ee307b1c 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/TabbedPanel.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TabbedPanel.java
@@ -18,11 +18,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.struts2.components.ClosingUIBean;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
@@ -58,7 +59,7 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*
*/
-@StrutsTag(name="tabbedPanel", tldTagClass="org.apache.struts2.views.jsp.ui.TabbedPanelTag", description="Render a tabbedPanel widget.")
+@StrutsTag(name="tabbedPanel", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TabbedPanelTag", description="Render a tabbedPanel widget.")
@StrutsTagSkipInheritance
public class TabbedPanel extends ClosingUIBean {
public static final String TEMPLATE = "tabbedpanel";
@@ -96,6 +97,11 @@ public class TabbedPanel extends ClosingUIBean {
addParameter("templateCssPath", findString(templateCssPath));
}
+ @Override
+ public String getTheme() {
+ return "ajax";
+ }
+
public String getDefaultOpenTemplate() {
return TEMPLATE;
}
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/Tree.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java
similarity index 98%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/Tree.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java
index 29ddfc378..c35a38e67 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/Tree.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/Tree.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
import java.io.Writer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.struts2.components.ClosingUIBean;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
@@ -68,7 +69,7 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*
*/
-@StrutsTag(name="tree", tldTagClass="org.apache.struts2.views.jsp.ui.TreeTag", description="Render a tree widget.")
+@StrutsTag(name="tree", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TreeTag", description="Render a tree widget.")
@StrutsTagSkipInheritance
public class Tree extends ClosingUIBean {
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/components/TreeNode.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java
similarity index 94%
rename from plugins/dojo/src/main/java/org/apache/struts2/components/TreeNode.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java
index 077f727ee..b9b93e16e 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/components/TreeNode.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/components/TreeNode.java
@@ -18,11 +18,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.components;
+package org.apache.struts2.dojo.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.struts2.components.ClosingUIBean;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;
import org.apache.struts2.views.annotations.StrutsTagSkipInheritance;
@@ -80,7 +81,7 @@ import com.opensymphony.xwork2.util.ValueStack;
*
*
*/
-@StrutsTag(name="treenode", tldTagClass="org.apache.struts2.views.jsp.ui.TreeNodeTag", description="Render a tree node within a tree widget.")
+@StrutsTag(name="treenode", tldTagClass="org.apache.struts2.dojo.views.jsp.ui.TreeNodeTag", description="Render a tree node within a tree widget.")
@StrutsTagSkipInheritance
public class TreeNode extends ClosingUIBean {
private static final String TEMPLATE = "treenode-close";
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/DojoTagLibrary.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/DojoTagLibrary.java
similarity index 58%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/DojoTagLibrary.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/DojoTagLibrary.java
index 829e3dc8f..b49864909 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/DojoTagLibrary.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/DojoTagLibrary.java
@@ -1,4 +1,4 @@
-package org.apache.struts2.views;
+package org.apache.struts2.dojo.views;
import java.util.Arrays;
import java.util.List;
@@ -6,15 +6,16 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.struts2.dojo.views.velocity.components.AnchorDirective;
+import org.apache.struts2.dojo.views.velocity.components.AutocompleterDirective;
+import org.apache.struts2.dojo.views.velocity.components.DateTimePickerDirective;
+import org.apache.struts2.dojo.views.velocity.components.DivDirective;
+import org.apache.struts2.dojo.views.velocity.components.SubmitDirective;
+import org.apache.struts2.dojo.views.velocity.components.TabbedPanelDirective;
+import org.apache.struts2.dojo.views.velocity.components.TreeDirective;
+import org.apache.struts2.dojo.views.velocity.components.TreeNodeDirective;
+import org.apache.struts2.views.TagLibrary;
import org.apache.struts2.views.freemarker.tags.StrutsModels;
-import org.apache.struts2.views.velocity.components.AnchorDirective;
-import org.apache.struts2.views.velocity.components.AutocompleterDirective;
-import org.apache.struts2.views.velocity.components.DateTimePickerDirective;
-import org.apache.struts2.views.velocity.components.DivDirective;
-import org.apache.struts2.views.velocity.components.SubmitDirective;
-import org.apache.struts2.views.velocity.components.TabbedPanelDirective;
-import org.apache.struts2.views.velocity.components.TreeDirective;
-import org.apache.struts2.views.velocity.components.TreeNodeDirective;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/AutocompleterModel.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/AutocompleterModel.java
similarity index 89%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/AutocompleterModel.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/AutocompleterModel.java
index 38d139003..3c2784a6b 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/AutocompleterModel.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/AutocompleterModel.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.freemarker.tags;
+package org.apache.struts2.dojo.views.freemarker.tags;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.Autocompleter;
+import org.apache.struts2.dojo.components.Autocompleter;
+import org.apache.struts2.views.freemarker.tags.TagModel;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/DateTimePickerModel.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DateTimePickerModel.java
similarity index 87%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/DateTimePickerModel.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DateTimePickerModel.java
index 18bd2a22a..07e368ff8 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/DateTimePickerModel.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DateTimePickerModel.java
@@ -15,13 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.struts2.views.freemarker.tags;
+package org.apache.struts2.dojo.views.freemarker.tags;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.DateTimePicker;
+import org.apache.struts2.dojo.components.DateTimePicker;
+import org.apache.struts2.views.freemarker.tags.TextFieldModel;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/DojoModels.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DojoModels.java
similarity index 90%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/DojoModels.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DojoModels.java
index 72d3447c3..1281eb6e6 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/DojoModels.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/DojoModels.java
@@ -1,8 +1,12 @@
-package org.apache.struts2.views.freemarker.tags;
+package org.apache.struts2.dojo.views.freemarker.tags;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.struts2.views.freemarker.tags.AnchorModel;
+import org.apache.struts2.views.freemarker.tags.DivModel;
+import org.apache.struts2.views.freemarker.tags.SubmitModel;
+
import com.opensymphony.xwork2.util.ValueStack;
public class DojoModels {
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TabbedPanelModel.java
similarity index 89%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TabbedPanelModel.java
index ac0ae5e40..fc2222b11 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/TabbedPanelModel.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TabbedPanelModel.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.freemarker.tags;
+package org.apache.struts2.dojo.views.freemarker.tags;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.TabbedPanel;
+import org.apache.struts2.dojo.components.TabbedPanel;
+import org.apache.struts2.views.freemarker.tags.TagModel;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TreeModel.java
similarity index 89%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TreeModel.java
index 763e1ee77..9d067e57a 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/TreeModel.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TreeModel.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.freemarker.tags;
+package org.apache.struts2.dojo.views.freemarker.tags;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.Tree;
+import org.apache.struts2.dojo.components.Tree;
+import org.apache.struts2.views.freemarker.tags.TagModel;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TreeNodeModel.java
similarity index 89%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TreeNodeModel.java
index 2c1ecd757..fc88a457b 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/freemarker/tags/TreeNodeModel.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/freemarker/tags/TreeNodeModel.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.freemarker.tags;
+package org.apache.struts2.dojo.views.freemarker.tags;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.TreeNode;
+import org.apache.struts2.dojo.components.TreeNode;
+import org.apache.struts2.views.freemarker.tags.TagModel;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AbstractRemoteCallUITag.java
similarity index 95%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AbstractRemoteCallUITag.java
index f21d9e18c..abcf0b41a 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/AbstractRemoteCallUITag.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AbstractRemoteCallUITag.java
@@ -15,9 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.struts2.views.jsp.ui;
+package org.apache.struts2.dojo.views.jsp.ui;
-import org.apache.struts2.components.RemoteUICallBean;
+import org.apache.struts2.dojo.components.RemoteUICallBean;
+import org.apache.struts2.views.jsp.ui.AbstractClosingTag;
public abstract class AbstractRemoteCallUITag extends AbstractClosingTag {
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTag.java
similarity index 91%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTag.java
index 346269f1b..c3bf92f5f 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/AnchorTag.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AnchorTag.java
@@ -18,13 +18,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.jsp.ui;
+package org.apache.struts2.dojo.views.jsp.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.struts2.components.Anchor;
import org.apache.struts2.components.Component;
+import org.apache.struts2.dojo.components.Anchor;
import com.opensymphony.xwork2.util.ValueStack;
@@ -33,7 +33,7 @@ import com.opensymphony.xwork2.util.ValueStack;
*/
public class AnchorTag extends AbstractRemoteCallUITag {
- private static final long serialVersionUID = -1034616578492431113L;
+ private static final long serialVersionUID = -1034616578492431113L;
protected String targets;
protected String preInvokeJS;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/AutocompleterTag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AutocompleterTag.java
similarity index 97%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/AutocompleterTag.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AutocompleterTag.java
index 57ae71a7e..95890cc0d 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/AutocompleterTag.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/AutocompleterTag.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.jsp.ui;
+package org.apache.struts2.dojo.views.jsp.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.struts2.components.Autocompleter;
import org.apache.struts2.components.Component;
+import org.apache.struts2.dojo.components.Autocompleter;
+import org.apache.struts2.views.jsp.ui.ComboBoxTag;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/DateTimePickerTag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DateTimePickerTag.java
similarity index 96%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/DateTimePickerTag.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DateTimePickerTag.java
index 290696846..742c7bc1d 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/DateTimePickerTag.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DateTimePickerTag.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.jsp.ui;
+package org.apache.struts2.dojo.views.jsp.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.DateTimePicker;
+import org.apache.struts2.dojo.components.DateTimePicker;
+import org.apache.struts2.views.jsp.ui.AbstractUITag;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DivTag.java
similarity index 96%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DivTag.java
index 5c965b07c..7831cbde1 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/DivTag.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/DivTag.java
@@ -18,13 +18,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.jsp.ui;
+package org.apache.struts2.dojo.views.jsp.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.Div;
+import org.apache.struts2.dojo.components.Div;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/SubmitTag.java
similarity index 97%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/SubmitTag.java
index f12bd511e..313002ac4 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/SubmitTag.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/SubmitTag.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.jsp.ui;
+package org.apache.struts2.dojo.views.jsp.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.Submit;
+import org.apache.struts2.dojo.components.Submit;
+import org.apache.struts2.views.jsp.ui.AbstractUITag;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TabbedPanelTag.java
similarity index 93%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TabbedPanelTag.java
index 11b9aec93..4fca002c8 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/TabbedPanelTag.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TabbedPanelTag.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.jsp.ui;
+package org.apache.struts2.dojo.views.jsp.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.TabbedPanel;
+import org.apache.struts2.dojo.components.TabbedPanel;
+import org.apache.struts2.views.jsp.ui.AbstractClosingTag;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TreeNodeTag.java
similarity index 91%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TreeNodeTag.java
index d845ce42e..4522f3233 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/TreeNodeTag.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TreeNodeTag.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.jsp.ui;
+package org.apache.struts2.dojo.views.jsp.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.TreeNode;
+import org.apache.struts2.dojo.components.TreeNode;
+import org.apache.struts2.views.jsp.ui.AbstractClosingTag;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TreeTag.java
similarity index 98%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TreeTag.java
index 2fc8fbebe..e50f9ffc7 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/jsp/ui/TreeTag.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/jsp/ui/TreeTag.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.jsp.ui;
+package org.apache.struts2.dojo.views.jsp.ui;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.Tree;
+import org.apache.struts2.dojo.components.Tree;
+import org.apache.struts2.views.jsp.ui.AbstractClosingTag;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/AnchorDirective.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/AnchorDirective.java
new file mode 100644
index 000000000..c528f5a38
--- /dev/null
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/AnchorDirective.java
@@ -0,0 +1,47 @@
+/*
+ * $Id: AnchorDirective.java 471756 2006-11-06 15:01:43Z husted $
+ *
+ * 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.struts2.dojo.views.velocity.components;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.components.Anchor;
+import org.apache.struts2.components.Component;
+import org.apache.struts2.views.velocity.components.AbstractDirective;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * @see Anchor
+ */
+public class AnchorDirective extends AbstractDirective {
+ public String getBeanName() {
+ return "a";
+ }
+
+ protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
+ return new Anchor(stack, req, res);
+ }
+
+ public int getType() {
+ return BLOCK;
+ }
+}
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/AutocompleterDirective.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/AutocompleterDirective.java
similarity index 88%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/AutocompleterDirective.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/AutocompleterDirective.java
index 58c0afc0e..87058a06c 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/AutocompleterDirective.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/AutocompleterDirective.java
@@ -18,14 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.velocity.components;
+package org.apache.struts2.dojo.views.velocity.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.struts2.components.Autocompleter;
-import org.apache.struts2.components.Bean;
import org.apache.struts2.components.Component;
+import org.apache.struts2.dojo.components.Autocompleter;
+import org.apache.struts2.views.velocity.components.AbstractDirective;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/DateTimePickerDirective.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/DateTimePickerDirective.java
similarity index 86%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/DateTimePickerDirective.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/DateTimePickerDirective.java
index e0b208815..ff90b620b 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/DateTimePickerDirective.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/DateTimePickerDirective.java
@@ -15,13 +15,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.struts2.views.velocity.components;
+package org.apache.struts2.dojo.views.velocity.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.DateTimePicker;
+import org.apache.struts2.dojo.components.DateTimePicker;
+import org.apache.struts2.views.velocity.components.TextFieldDirective;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/DivDirective.java
similarity index 88%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/DivDirective.java
index 71df9da19..bc651b4c7 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/DivDirective.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/DivDirective.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.velocity.components;
+package org.apache.struts2.dojo.views.velocity.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.Div;
+import org.apache.struts2.dojo.components.Div;
+import org.apache.struts2.views.velocity.components.AbstractDirective;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/SubmitDirective.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/SubmitDirective.java
new file mode 100644
index 000000000..bc140dcf1
--- /dev/null
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/SubmitDirective.java
@@ -0,0 +1,43 @@
+/*
+ * $Id: SubmitDirective.java 471756 2006-11-06 15:01:43Z husted $
+ *
+ * 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.struts2.dojo.views.velocity.components;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.components.Component;
+import org.apache.struts2.components.Submit;
+import org.apache.struts2.views.velocity.components.AbstractDirective;
+
+import com.opensymphony.xwork2.util.ValueStack;
+
+/**
+ * @see Submit
+ */
+public class SubmitDirective extends AbstractDirective {
+ public String getBeanName() {
+ return "submit";
+ }
+
+ protected Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
+ return new Submit(stack, req, res);
+ }
+}
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TabbedPanelDirective.java
similarity index 88%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TabbedPanelDirective.java
index cd2106b4e..762c9b710 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/TabbedPanelDirective.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TabbedPanelDirective.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.velocity.components;
+package org.apache.struts2.dojo.views.velocity.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.TabbedPanel;
+import org.apache.struts2.dojo.components.TabbedPanel;
+import org.apache.struts2.views.velocity.components.AbstractDirective;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TreeDirective.java
similarity index 88%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TreeDirective.java
index 933e904e6..43df54eb6 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/TreeDirective.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TreeDirective.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.velocity.components;
+package org.apache.struts2.dojo.views.velocity.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.Tree;
+import org.apache.struts2.dojo.components.Tree;
+import org.apache.struts2.views.velocity.components.AbstractDirective;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TreeNodeDirective.java
similarity index 88%
rename from plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java
rename to plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TreeNodeDirective.java
index 8f8876a21..487f2e29f 100644
--- a/plugins/dojo/src/main/java/org/apache/struts2/views/velocity/components/TreeNodeDirective.java
+++ b/plugins/dojo/src/main/java/org/apache/struts2/dojo/views/velocity/components/TreeNodeDirective.java
@@ -18,13 +18,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.struts2.views.velocity.components;
+package org.apache.struts2.dojo.views.velocity.components;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.components.Component;
-import org.apache.struts2.components.TreeNode;
+import org.apache.struts2.dojo.components.TreeNode;
+import org.apache.struts2.views.velocity.components.AbstractDirective;
import com.opensymphony.xwork2.util.ValueStack;
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js
index fa573795e..1c72b3be5 100644
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js
+++ b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/dojo.js
@@ -1,11190 +1,17204 @@
-/*
- Copyright (c) 2004-2006, The Dojo Foundation
- All Rights Reserved.
+if(typeof dojo == "undefined"){
- Licensed under the Academic Free License version 2.1 or above OR the
- modified BSD license. For more information on Dojo licensing, see:
+/**
+* @file bootstrap1.js
+*
+* summary: First file that is loaded that 'bootstraps' the entire dojo library suite.
+* note: Must run before hostenv_*.js file.
+*
+* @author Copyright 2004 Mark D. Anderson (mda@discerning.com)
+* TODOC: should the copyright be changed to Dojo Foundation?
+* @license Licensed under the Academic Free License 2.1 http://www.opensource.org/licenses/afl-2.1.php
+*
+* $Id: bootstrap1.js 6258 2006-10-20 03:12:36Z jburke $
+*/
- http://dojotoolkit.org/community/licensing.shtml
+// TODOC: HOW TO DOC THE BELOW?
+// @global: djConfig
+// summary:
+// Application code can set the global 'djConfig' prior to loading
+// the library to override certain global settings for how dojo works.
+// description: The variables that can be set are as follows:
+// - isDebug: false
+// - allowQueryConfig: false
+// - baseScriptUri: ""
+// - baseRelativePath: ""
+// - libraryScriptUri: ""
+// - iePreventClobber: false
+// - ieClobberMinimal: true
+// - locale: undefined
+// - extraLocale: undefined
+// - preventBackButtonFix: true
+// - searchIds: []
+// - parseWidgets: true
+// TODOC: HOW TO DOC THESE VARIABLES?
+// TODOC: IS THIS A COMPLETE LIST?
+// note:
+// 'djConfig' does not exist under 'dojo.*' so that it can be set before the
+// 'dojo' variable exists.
+// note:
+// Setting any of these variables *after* the library has loaded does nothing at all.
+// TODOC: is this still true? Release notes for 0.3 indicated they could be set after load.
+//
+
+
+//TODOC: HOW TO DOC THIS?
+// @global: dj_global
+// summary:
+// an alias for the top-level global object in the host environment
+// (e.g., the window object in a browser).
+// description:
+// Refer to 'dj_global' rather than referring to window to ensure your
+// code runs correctly in contexts other than web browsers (eg: Rhino on a server).
+var dj_global = this;
+
+//TODOC: HOW TO DOC THIS?
+// @global: dj_currentContext
+// summary:
+// Private global context object. Where 'dj_global' always refers to the boot-time
+// global context, 'dj_currentContext' can be modified for temporary context shifting.
+// dojo.global() returns dj_currentContext.
+// description:
+// Refer to dojo.global() rather than referring to dj_global to ensure your
+// code runs correctly in managed contexts.
+var dj_currentContext = this;
+
+
+// ****************************************************************
+// global public utils
+// TODOC: DO WE WANT TO NOTE THAT THESE ARE GLOBAL PUBLIC UTILS?
+// ****************************************************************
+
+function dj_undef(/*String*/ name, /*Object?*/ object){
+ //summary: Returns true if 'name' is defined on 'object' (or globally if 'object' is null).
+ //description: Note that 'defined' and 'exists' are not the same concept.
+ return (typeof (object || dj_currentContext)[name] == "undefined"); // Boolean
+}
+
+// make sure djConfig is defined
+if(dj_undef("djConfig", this)){
+ var djConfig = {};
+}
+
+//TODOC: HOW TO DOC THIS?
+// dojo is the root variable of (almost all) our public symbols -- make sure it is defined.
+if(dj_undef("dojo", this)){
+ var dojo = {};
+}
+
+dojo.global = function(){
+ // summary:
+ // return the current global context object
+ // (e.g., the window object in a browser).
+ // description:
+ // Refer to 'dojo.global()' rather than referring to window to ensure your
+ // code runs correctly in contexts other than web browsers (eg: Rhino on a server).
+ return dj_currentContext;
+}
+
+// Override locale setting, if specified
+dojo.locale = djConfig.locale;
+
+//TODOC: HOW TO DOC THIS?
+dojo.version = {
+ // summary: version number of this instance of dojo.
+ major: 0, minor: 4, patch: 0, flag: "",
+ revision: Number("$Rev: 6258 $".match(/[0-9]+/)[0]),
+ toString: function(){
+ with(dojo.version){
+ return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String
+ }
+ }
+}
+
+dojo.evalProp = function(/*String*/ name, /*Object*/ object, /*Boolean?*/ create){
+ // summary: Returns 'object[name]'. If not defined and 'create' is true, will return a new Object.
+ // description:
+ // Returns null if 'object[name]' is not defined and 'create' is not true.
+ // Note: 'defined' and 'exists' are not the same concept.
+ if((!object)||(!name)) return undefined; // undefined
+ if(!dj_undef(name, object)) return object[name]; // mixed
+ return (create ? (object[name]={}) : undefined); // mixed
+}
+
+dojo.parseObjPath = function(/*String*/ path, /*Object?*/ context, /*Boolean?*/ create){
+ // summary: Parse string path to an object, and return corresponding object reference and property name.
+ // description:
+ // Returns an object with two properties, 'obj' and 'prop'.
+ // 'obj[prop]' is the reference indicated by 'path'.
+ // path: Path to an object, in the form "A.B.C".
+ // context: Object to use as root of path. Defaults to 'dojo.global()'.
+ // create: If true, Objects will be created at any point along the 'path' that is undefined.
+ var object = (context || dojo.global());
+ var names = path.split('.');
+ var prop = names.pop();
+ for (var i=0,l=names.length;i 1) {
+ dh.modulesLoadedListeners.push(function() {
+ obj[functionName]();
+ });
+ }
+
+ //Added for xdomain loading. dojo.addOnLoad is used to
+ //indicate callbacks after doing some dojo.require() statements.
+ //In the xdomain case, if all the requires are loaded (after initial
+ //page load), then immediately call any listeners.
+ if(dh.post_load_ && dh.inFlightCount == 0 && !dh.loadNotifying){
+ dh.callLoaded();
+ }
+}
+
+dojo.addOnUnload = function(/*Object?*/obj, /*String|Function?*/functionName){
+// summary: registers a function to be triggered when the page unloads
+//
+// usage:
+// dojo.addOnLoad(functionPointer)
+// dojo.addOnLoad(object, "functionName")
+ var dh = dojo.hostenv;
+ if(arguments.length == 1){
+ dh.unloadListeners.push(obj);
+ } else if(arguments.length > 1) {
+ dh.unloadListeners.push(function() {
+ obj[functionName]();
+ });
+ }
+}
+
+dojo.hostenv.modulesLoaded = function(){
+ if(this.post_load_){ return; }
+ if(this.loadUriStack.length==0 && this.getTextStack.length==0){
+ if(this.inFlightCount > 0){
+ dojo.debug("files still in flight!");
+ return;
+ }
+ dojo.hostenv.callLoaded();
+ }
+}
+
+dojo.hostenv.callLoaded = function(){
+ if(typeof setTimeout == "object"){
+ setTimeout("dojo.hostenv.loaded();", 0);
+ }else{
+ dojo.hostenv.loaded();
+ }
+}
+
+dojo.hostenv.getModuleSymbols = function(/*String*/modulename){
+// summary:
+// Converts a module name in dotted JS notation to an array representing the path in the source tree
+
+ var syms = modulename.split(".");
+ for(var i = syms.length; i>0; i--){
+ var parentModule = syms.slice(0, i).join(".");
+ if ((i==1) && !this.moduleHasPrefix(parentModule)){
+ //Support default module directory (sibling of dojo)
+ syms[0] = "../" + syms[0];
+ }else{
+ var parentModulePath = this.getModulePrefix(parentModule);
+ if(parentModulePath != parentModule){
+ syms.splice(0, i, parentModulePath);
+ break;
+ }
+ }
+ }
+ return syms; // Array
+}
+
+dojo.hostenv._global_omit_module_check = false;
+dojo.hostenv.loadModule = function(/*String*/moduleName, /*Boolean?*/exactOnly, /*Boolean?*/omitModuleCheck){
+// summary:
+// loads a Javascript module from the appropriate URI
+//
+// description:
+// loadModule("A.B") first checks to see if symbol A.B is defined.
+// If it is, it is simply returned (nothing to do).
+//
+// If it is not defined, it will look for "A/B.js" in the script root directory,
+// followed by "A.js".
+//
+// It throws if it cannot find a file to load, or if the symbol A.B is not
+// defined after loading.
+//
+// It returns the object A.B.
+//
+// This does nothing about importing symbols into the current package.
+// It is presumed that the caller will take care of that. For example, to import
+// all symbols:
+//
+// with (dojo.hostenv.loadModule("A.B")) {
+// ...
+// }
+//
+// And to import just the leaf symbol:
+//
+// var B = dojo.hostenv.loadModule("A.B");
+// ...
+//
+// dj_load is an alias for dojo.hostenv.loadModule
+
+ if(!moduleName){ return; }
+ omitModuleCheck = this._global_omit_module_check || omitModuleCheck;
+ var module = this.findModule(moduleName, false);
+ if(module){
+ return module;
+ }
+
+ // protect against infinite recursion from mutual dependencies
+ if(dj_undef(moduleName, this.loading_modules_)){
+ this.addedToLoadingCount.push(moduleName);
+ }
+ this.loading_modules_[moduleName] = 1;
+
+ // convert periods to slashes
+ var relpath = moduleName.replace(/\./g, '/') + '.js';
+
+ var nsyms = moduleName.split(".");
+
+ // this line allowed loading of a module manifest as if it were a namespace
+ // it's an interesting idea, but shouldn't be combined with 'namespaces' proper
+ // and leads to unwanted dependencies
+ // the effect can be achieved in other (albeit less-flexible) ways now, so I am
+ // removing this pending further design work
+ // perhaps we can explicitly define this idea of a 'module manifest', and subclass
+ // 'namespace manifest' from that
+ //dojo.getNamespace(nsyms[0]);
+
+ var syms = this.getModuleSymbols(moduleName);
+ var startedRelative = ((syms[0].charAt(0) != '/') && !syms[0].match(/^\w+:/));
+ var last = syms[syms.length - 1];
+ var ok;
+ // figure out if we're looking for a full package, if so, we want to do
+ // things slightly diffrently
+ if(last=="*"){
+ moduleName = nsyms.slice(0, -1).join('.');
+ while(syms.length){
+ syms.pop();
+ syms.push(this.pkgFileName);
+ relpath = syms.join("/") + '.js';
+ if(startedRelative && relpath.charAt(0)=="/"){
+ relpath = relpath.slice(1);
+ }
+ ok = this.loadPath(relpath, !omitModuleCheck ? moduleName : null);
+ if(ok){ break; }
+ syms.pop();
+ }
+ }else{
+ relpath = syms.join("/") + '.js';
+ moduleName = nsyms.join('.');
+ var modArg = !omitModuleCheck ? moduleName : null;
+ ok = this.loadPath(relpath, modArg);
+ if(!ok && !exactOnly){
+ syms.pop();
+ while(syms.length){
+ relpath = syms.join('/') + '.js';
+ ok = this.loadPath(relpath, modArg);
+ if(ok){ break; }
+ syms.pop();
+ relpath = syms.join('/') + '/'+this.pkgFileName+'.js';
+ if(startedRelative && relpath.charAt(0)=="/"){
+ relpath = relpath.slice(1);
+ }
+ ok = this.loadPath(relpath, modArg);
+ if(ok){ break; }
+ }
+ }
+
+ if(!ok && !omitModuleCheck){
+ dojo.raise("Could not load '" + moduleName + "'; last tried '" + relpath + "'");
+ }
+ }
+
+ // check that the symbol was defined
+ //Don't bother if we're doing xdomain (asynchronous) loading.
+ if(!omitModuleCheck && !this["isXDomain"]){
+ // pass in false so we can give better error
+ module = this.findModule(moduleName, false);
+ if(!module){
+ dojo.raise("symbol '" + moduleName + "' is not defined after loading '" + relpath + "'");
+ }
+ }
+
+ return module;
+}
+
+dojo.hostenv.startPackage = function(/*String*/packageName){
+// summary:
+// Creates a JavaScript package
+//
+// description:
+// startPackage("A.B") follows the path, and at each level creates a new empty
+// object or uses what already exists. It returns the result.
+//
+// packageName: the package to be created as a String in dot notation
+
+ //Make sure we have a string.
+ var fullPkgName = String(packageName);
+ var strippedPkgName = fullPkgName;
+
+ var syms = packageName.split(/\./);
+ if(syms[syms.length-1]=="*"){
+ syms.pop();
+ strippedPkgName = syms.join(".");
+ }
+ var evaledPkg = dojo.evalObjPath(strippedPkgName, true);
+ this.loaded_modules_[fullPkgName] = evaledPkg;
+ this.loaded_modules_[strippedPkgName] = evaledPkg;
+
+ return evaledPkg; // Object
+}
+
+dojo.hostenv.findModule = function(/*String*/moduleName, /*Boolean?*/mustExist){
+// summary:
+// Returns the Object representing the module, if it exists, otherwise null.
+//
+// moduleName A fully qualified module including package name, like 'A.B'.
+// mustExist Optional, default false. throw instead of returning null
+// if the module does not currently exist.
+
+ var lmn = String(moduleName);
+
+ if(this.loaded_modules_[lmn]){
+ return this.loaded_modules_[lmn]; // Object
+ }
+
+ if(mustExist){
+ dojo.raise("no loaded module named '" + moduleName + "'");
+ }
+ return null; // null
+}
+
+//Start of old bootstrap2:
+
+dojo.kwCompoundRequire = function(/*Object containing Arrays*/modMap){
+// description:
+// This method taks a "map" of arrays which one can use to optionally load dojo
+// modules. The map is indexed by the possible dojo.hostenv.name_ values, with
+// two additional values: "default" and "common". The items in the "default"
+// array will be loaded if none of the other items have been choosen based on
+// the hostenv.name_ item. The items in the "common" array will _always_ be
+// loaded, regardless of which list is chosen. Here's how it's normally
+// called:
+//
+// dojo.kwCompoundRequire({
+// browser: [
+// ["foo.bar.baz", true, true], // an example that passes multiple args to loadModule()
+// "foo.sample.*",
+// "foo.test,
+// ],
+// default: [ "foo.sample.*" ],
+// common: [ "really.important.module.*" ]
+// });
+
+ var common = modMap["common"]||[];
+ var result = modMap[dojo.hostenv.name_] ? common.concat(modMap[dojo.hostenv.name_]||[]) : common.concat(modMap["default"]||[]);
+
+ for(var x=0; x,
+ // relative to Dojo root. For example, module acme is mapped to ../acme.
+ // If you want to use a different module name, use dojo.registerModulePath.
+ return dojo.hostenv.setModulePrefix(module, prefix);
+}
+
+dojo.setModulePrefix = function(/*String*/module, /*String*/prefix){
+ // summary: maps a module name to a path
+ dojo.deprecated('dojo.setModulePrefix("' + module + '", "' + prefix + '")', "replaced by dojo.registerModulePath", "0.5");
+ return dojo.registerModulePath(module, prefix);
+}
+
+dojo.exists = function(/*Object*/obj, /*String*/name){
+ // summary: determine if an object supports a given method
+ // description: useful for longer api chains where you have to test each object in the chain
+ var p = name.split(".");
+ for(var i = 0; i < p.length; i++){
+ if(!obj[p[i]]){ return false; } // Boolean
+ obj = obj[p[i]];
+ }
+ return true; // Boolean
+}
+
+// Localization routines
+
+dojo.hostenv.normalizeLocale = function(/*String?*/locale){
+// summary:
+// Returns canonical form of locale, as used by Dojo. All variants are case-insensitive and are separated by '-'
+// as specified in RFC 3066. If no locale is specified, the user agent's default is returned.
+
+ return locale ? locale.toLowerCase() : dojo.locale; // String
};
+
+dojo.hostenv.searchLocalePath = function(/*String*/locale, /*Boolean*/down, /*Function*/searchFunc){
+// summary:
+// A helper method to assist in searching for locale-based resources. Will iterate through
+// the variants of a particular locale, either up or down, executing a callback function.
+// For example, "en-us" and true will try "en-us" followed by "en" and finally "ROOT".
+
+ locale = dojo.hostenv.normalizeLocale(locale);
+
+ var elements = locale.split('-');
+ var searchlist = [];
+ for(var i = elements.length; i > 0; i--){
+ searchlist.push(elements.slice(0, i).join('-'));
+ }
+ searchlist.push(false);
+ if(down){searchlist.reverse();}
+
+ for(var j = searchlist.length - 1; j >= 0; j--){
+ var loc = searchlist[j] || "ROOT";
+ var stop = searchFunc(loc);
+ if(stop){ break; }
+ }
+}
+
+//These two functions are placed outside of preloadLocalizations
+//So that the xd loading can use/override them.
+dojo.hostenv.localesGenerated /***BUILD:localesGenerated***/; // value will be inserted here at build time, if necessary
+
+dojo.hostenv.registerNlsPrefix = function(){
+// summary:
+// Register module "nls" to point where Dojo can find pre-built localization files
+ dojo.registerModulePath("nls","nls");
+}
+
+dojo.hostenv.preloadLocalizations = function(){
+// summary:
+// Load built, flattened resource bundles, if available for all locales used in the page.
+// Execute only once. Note that this is a no-op unless there is a build.
+
+ if(dojo.hostenv.localesGenerated){
+ dojo.hostenv.registerNlsPrefix();
+
+ function preload(locale){
+ locale = dojo.hostenv.normalizeLocale(locale);
+ dojo.hostenv.searchLocalePath(locale, true, function(loc){
+ for(var i=0; i1){
-dh.modulesLoadedListeners.push(function(){
-obj[_3d]();
-});
-}
-}
-if(dh.post_load_&&dh.inFlightCount==0&&!dh.loadNotifying){
-dh.callLoaded();
-}
-};
-dojo.addOnUnload=function(obj,_40){
-var dh=dojo.hostenv;
-if(arguments.length==1){
-dh.unloadListeners.push(obj);
-}else{
-if(arguments.length>1){
-dh.unloadListeners.push(function(){
-obj[_40]();
-});
-}
-}
-};
-dojo.hostenv.modulesLoaded=function(){
-if(this.post_load_){
-return;
-}
-if(this.loadUriStack.length==0&&this.getTextStack.length==0){
-if(this.inFlightCount>0){
-dojo.debug("files still in flight!");
-return;
-}
-dojo.hostenv.callLoaded();
-}
-};
-dojo.hostenv.callLoaded=function(){
-if(typeof setTimeout=="object"){
-setTimeout("dojo.hostenv.loaded();",0);
-}else{
-dojo.hostenv.loaded();
-}
-};
-dojo.hostenv.getModuleSymbols=function(_42){
-var _43=_42.split(".");
-for(var i=_43.length;i>0;i--){
-var _45=_43.slice(0,i).join(".");
-if((i==1)&&!this.moduleHasPrefix(_45)){
-_43[0]="../"+_43[0];
-}else{
-var _46=this.getModulePrefix(_45);
-if(_46!=_45){
-_43.splice(0,i,_46);
-break;
-}
-}
-}
-return _43;
-};
-dojo.hostenv._global_omit_module_check=false;
-dojo.hostenv.loadModule=function(_47,_48,_49){
-if(!_47){
-return;
-}
-_49=this._global_omit_module_check||_49;
-var _4a=this.findModule(_47,false);
-if(_4a){
-return _4a;
-}
-if(dj_undef(_47,this.loading_modules_)){
-this.addedToLoadingCount.push(_47);
-}
-this.loading_modules_[_47]=1;
-var _4b=_47.replace(/\./g,"/")+".js";
-var _4c=_47.split(".");
-var _4d=this.getModuleSymbols(_47);
-var _4e=((_4d[0].charAt(0)!="/")&&!_4d[0].match(/^\w+:/));
-var _4f=_4d[_4d.length-1];
-var ok;
-if(_4f=="*"){
-_47=_4c.slice(0,-1).join(".");
-while(_4d.length){
-_4d.pop();
-_4d.push(this.pkgFileName);
-_4b=_4d.join("/")+".js";
-if(_4e&&_4b.charAt(0)=="/"){
-_4b=_4b.slice(1);
-}
-ok=this.loadPath(_4b,!_49?_47:null);
-if(ok){
-break;
-}
-_4d.pop();
-}
-}else{
-_4b=_4d.join("/")+".js";
-_47=_4c.join(".");
-var _51=!_49?_47:null;
-ok=this.loadPath(_4b,_51);
-if(!ok&&!_48){
-_4d.pop();
-while(_4d.length){
-_4b=_4d.join("/")+".js";
-ok=this.loadPath(_4b,_51);
-if(ok){
-break;
-}
-_4d.pop();
-_4b=_4d.join("/")+"/"+this.pkgFileName+".js";
-if(_4e&&_4b.charAt(0)=="/"){
-_4b=_4b.slice(1);
-}
-ok=this.loadPath(_4b,_51);
-if(ok){
-break;
-}
-}
-}
-if(!ok&&!_49){
-dojo.raise("Could not load '"+_47+"'; last tried '"+_4b+"'");
-}
-}
-if(!_49&&!this["isXDomain"]){
-_4a=this.findModule(_47,false);
-if(!_4a){
-dojo.raise("symbol '"+_47+"' is not defined after loading '"+_4b+"'");
-}
-}
-return _4a;
-};
-dojo.hostenv.startPackage=function(_52){
-var _53=String(_52);
-var _54=_53;
-var _55=_52.split(/\./);
-if(_55[_55.length-1]=="*"){
-_55.pop();
-_54=_55.join(".");
-}
-var _56=dojo.evalObjPath(_54,true);
-this.loaded_modules_[_53]=_56;
-this.loaded_modules_[_54]=_56;
-return _56;
-};
-dojo.hostenv.findModule=function(_57,_58){
-var lmn=String(_57);
-if(this.loaded_modules_[lmn]){
-return this.loaded_modules_[lmn];
-}
-if(_58){
-dojo.raise("no loaded module named '"+_57+"'");
-}
-return null;
-};
-dojo.kwCompoundRequire=function(_5a){
-var _5b=_5a["common"]||[];
-var _5c=_5a[dojo.hostenv.name_]?_5b.concat(_5a[dojo.hostenv.name_]||[]):_5b.concat(_5a["default"]||[]);
-for(var x=0;x<_5c.length;x++){
-var _5e=_5c[x];
-if(_5e.constructor==Array){
-dojo.hostenv.loadModule.apply(dojo.hostenv,_5e);
-}else{
-dojo.hostenv.loadModule(_5e);
-}
-}
-};
-dojo.require=function(_5f){
-dojo.hostenv.loadModule.apply(dojo.hostenv,arguments);
-};
-dojo.requireIf=function(_60,_61){
-var _62=arguments[0];
-if((_62===true)||(_62=="common")||(_62&&dojo.render[_62].capable)){
-var _63=[];
-for(var i=1;i0;i--){
-_73.push(_72.slice(0,i).join("-"));
-}
-_73.push(false);
-if(_70){
-_73.reverse();
-}
-for(var j=_73.length-1;j>=0;j--){
-var loc=_73[j]||"ROOT";
-var _77=_71(loc);
-if(_77){
-break;
-}
-}
-};
-dojo.hostenv.localesGenerated;
-dojo.hostenv.registerNlsPrefix=function(){
-dojo.registerModulePath("nls","nls");
-};
-dojo.hostenv.preloadLocalizations=function(){
-if(dojo.hostenv.localesGenerated){
-dojo.hostenv.registerNlsPrefix();
-function preload(_78){
-_78=dojo.hostenv.normalizeLocale(_78);
-dojo.hostenv.searchLocalePath(_78,true,function(loc){
-for(var i=0;i1){
-var _98=_97[1];
-var _99=_98.split("&");
-for(var x in _99){
-var sp=_99[x].split("=");
-if((sp[0].length>9)&&(sp[0].substr(0,9)=="djConfig.")){
-var opt=sp[0].substr(9);
-try{
-djConfig[opt]=eval(sp[1]);
-}
-catch(e){
-djConfig[opt]=sp[1];
-}
-}
-}
-}
-}
-if(((djConfig["baseScriptUri"]=="")||(djConfig["baseRelativePath"]==""))&&(document&&document.getElementsByTagName)){
-var _9d=document.getElementsByTagName("script");
-var _9e=/(__package__|dojo|bootstrap1)\.js([\?\.]|$)/i;
-for(var i=0;i<_9d.length;i++){
-var src=_9d[i].getAttribute("src");
-if(!src){
-continue;
-}
-var m=src.match(_9e);
-if(m){
-var _a2=src.substring(0,m.index);
-if(src.indexOf("bootstrap1")>-1){
-_a2+="../";
-}
-if(!this["djConfig"]){
-djConfig={};
-}
-if(djConfig["baseScriptUri"]==""){
-djConfig["baseScriptUri"]=_a2;
-}
-if(djConfig["baseRelativePath"]==""){
-djConfig["baseRelativePath"]=_a2;
-}
-break;
-}
-}
-}
-var dr=dojo.render;
-var drh=dojo.render.html;
-var drs=dojo.render.svg;
-var dua=(drh.UA=navigator.userAgent);
-var dav=(drh.AV=navigator.appVersion);
-var t=true;
-var f=false;
-drh.capable=t;
-drh.support.builtin=t;
-dr.ver=parseFloat(drh.AV);
-dr.os.mac=dav.indexOf("Macintosh")>=0;
-dr.os.win=dav.indexOf("Windows")>=0;
-dr.os.linux=dav.indexOf("X11")>=0;
-drh.opera=dua.indexOf("Opera")>=0;
-drh.khtml=(dav.indexOf("Konqueror")>=0)||(dav.indexOf("Safari")>=0);
-drh.safari=dav.indexOf("Safari")>=0;
-var _aa=dua.indexOf("Gecko");
-drh.mozilla=drh.moz=(_aa>=0)&&(!drh.khtml);
-if(drh.mozilla){
-drh.geckoVersion=dua.substring(_aa+6,_aa+14);
-}
-drh.ie=(document.all)&&(!drh.opera);
-drh.ie50=drh.ie&&dav.indexOf("MSIE 5.0")>=0;
-drh.ie55=drh.ie&&dav.indexOf("MSIE 5.5")>=0;
-drh.ie60=drh.ie&&dav.indexOf("MSIE 6.0")>=0;
-drh.ie70=drh.ie&&dav.indexOf("MSIE 7.0")>=0;
-var cm=document["compatMode"];
-drh.quirks=(cm=="BackCompat")||(cm=="QuirksMode")||drh.ie55||drh.ie50;
-dojo.locale=dojo.locale||(drh.ie?navigator.userLanguage:navigator.language).toLowerCase();
-dr.vml.capable=drh.ie;
-drs.capable=f;
-drs.support.plugin=f;
-drs.support.builtin=f;
-var _ac=window["document"];
-var tdi=_ac["implementation"];
-if((tdi)&&(tdi["hasFeature"])&&(tdi.hasFeature("org.w3c.dom.svg","1.0"))){
-drs.capable=t;
-drs.support.builtin=t;
-drs.support.plugin=f;
-}
-if(drh.safari){
-var tmp=dua.split("AppleWebKit/")[1];
-var ver=parseFloat(tmp.split(" ")[0]);
-if(ver>=420){
-drs.capable=t;
-drs.support.builtin=t;
-drs.support.plugin=f;
-}
-}
+
+if (typeof window != 'undefined') {
+
+// attempt to figure out the path to dojo if it isn't set in the config
+(function() {
+ // before we get any further with the config options, try to pick them out
+ // of the URL. Most of this code is from NW
+ if(djConfig.allowQueryConfig){
+ var baseUrl = document.location.toString(); // FIXME: use location.query instead?
+ var params = baseUrl.split("?", 2);
+ if(params.length > 1){
+ var paramStr = params[1];
+ var pairs = paramStr.split("&");
+ for(var x in pairs){
+ var sp = pairs[x].split("=");
+ // FIXME: is this eval dangerous?
+ if((sp[0].length > 9)&&(sp[0].substr(0, 9) == "djConfig.")){
+ var opt = sp[0].substr(9);
+ try{
+ djConfig[opt]=eval(sp[1]);
+ }catch(e){
+ djConfig[opt]=sp[1];
+ }
+ }
+ }
+ }
+ }
+
+ if(((djConfig["baseScriptUri"] == "")||(djConfig["baseRelativePath"] == "")) &&(document && document.getElementsByTagName)){
+ var scripts = document.getElementsByTagName("script");
+ var rePkg = /(__package__|dojo|bootstrap1)\.js([\?\.]|$)/i;
+ for(var i = 0; i < scripts.length; i++) {
+ var src = scripts[i].getAttribute("src");
+ if(!src) { continue; }
+ var m = src.match(rePkg);
+ if(m) {
+ var root = src.substring(0, m.index);
+ if(src.indexOf("bootstrap1") > -1) { root += "../"; }
+ if(!this["djConfig"]) { djConfig = {}; }
+ if(djConfig["baseScriptUri"] == "") { djConfig["baseScriptUri"] = root; }
+ if(djConfig["baseRelativePath"] == "") { djConfig["baseRelativePath"] = root; }
+ break;
+ }
+ }
+ }
+
+ // fill in the rendering support information in dojo.render.*
+ var dr = dojo.render;
+ var drh = dojo.render.html;
+ var drs = dojo.render.svg;
+ var dua = (drh.UA = navigator.userAgent);
+ var dav = (drh.AV = navigator.appVersion);
+ var t = true;
+ var f = false;
+ drh.capable = t;
+ drh.support.builtin = t;
+
+ dr.ver = parseFloat(drh.AV);
+ dr.os.mac = dav.indexOf("Macintosh") >= 0;
+ dr.os.win = dav.indexOf("Windows") >= 0;
+ // could also be Solaris or something, but it's the same browser
+ dr.os.linux = dav.indexOf("X11") >= 0;
+
+ drh.opera = dua.indexOf("Opera") >= 0;
+ drh.khtml = (dav.indexOf("Konqueror") >= 0)||(dav.indexOf("Safari") >= 0);
+ drh.safari = dav.indexOf("Safari") >= 0;
+ var geckoPos = dua.indexOf("Gecko");
+ drh.mozilla = drh.moz = (geckoPos >= 0)&&(!drh.khtml);
+ if (drh.mozilla) {
+ // gecko version is YYYYMMDD
+ drh.geckoVersion = dua.substring(geckoPos + 6, geckoPos + 14);
+ }
+ drh.ie = (document.all)&&(!drh.opera);
+ drh.ie50 = drh.ie && dav.indexOf("MSIE 5.0")>=0;
+ drh.ie55 = drh.ie && dav.indexOf("MSIE 5.5")>=0;
+ drh.ie60 = drh.ie && dav.indexOf("MSIE 6.0")>=0;
+ drh.ie70 = drh.ie && dav.indexOf("MSIE 7.0")>=0;
+
+ var cm = document["compatMode"];
+ drh.quirks = (cm == "BackCompat")||(cm == "QuirksMode")||drh.ie55||drh.ie50;
+
+ // TODO: is the HTML LANG attribute relevant?
+ dojo.locale = dojo.locale || (drh.ie ? navigator.userLanguage : navigator.language).toLowerCase();
+
+ dr.vml.capable=drh.ie;
+ drs.capable = f;
+ drs.support.plugin = f;
+ drs.support.builtin = f;
+ var tdoc = window["document"];
+ var tdi = tdoc["implementation"];
+
+ if((tdi)&&(tdi["hasFeature"])&&(tdi.hasFeature("org.w3c.dom.svg", "1.0"))){
+ drs.capable = t;
+ drs.support.builtin = t;
+ drs.support.plugin = f;
+ }
+ // webkits after 420 support SVG natively. The test string is "AppleWebKit/420+"
+ if(drh.safari){
+ var tmp = dua.split("AppleWebKit/")[1];
+ var ver = parseFloat(tmp.split(" ")[0]);
+ if(ver >= 420){
+ drs.capable = t;
+ drs.support.builtin = t;
+ drs.support.plugin = f;
+ }
+ }
})();
+
dojo.hostenv.startPackage("dojo.hostenv");
-dojo.render.name=dojo.hostenv.name_="browser";
-dojo.hostenv.searchIds=[];
-dojo.hostenv._XMLHTTP_PROGIDS=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];
-dojo.hostenv.getXmlhttpObject=function(){
-var _b0=null;
-var _b1=null;
-try{
-_b0=new XMLHttpRequest();
+
+dojo.render.name = dojo.hostenv.name_ = 'browser';
+dojo.hostenv.searchIds = [];
+
+// These are in order of decreasing likelihood; this will change in time.
+dojo.hostenv._XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
+
+dojo.hostenv.getXmlhttpObject = function(){
+ var http = null;
+ var last_e = null;
+ try{ http = new XMLHttpRequest(); }catch(e){}
+ if(!http){
+ for(var i=0; i<3; ++i){
+ var progid = dojo.hostenv._XMLHTTP_PROGIDS[i];
+ try{
+ http = new ActiveXObject(progid);
+ }catch(e){
+ last_e = e;
+ }
+
+ if(http){
+ dojo.hostenv._XMLHTTP_PROGIDS = [progid]; // so faster next time
+ break;
+ }
+ }
+
+ /*if(http && !http.toString) {
+ http.toString = function() { "[object XMLHttpRequest]"; }
+ }*/
+ }
+
+ if(!http){
+ return dojo.raise("XMLHTTP not available", last_e);
+ }
+
+ return http;
}
-catch(e){
+
+/**
+ * Read the contents of the specified uri and return those contents.
+ *
+ * @param uri A relative or absolute uri. If absolute, it still must be in the
+ * same "domain" as we are.
+ *
+ * @param async_cb If not specified, load synchronously. If specified, load
+ * asynchronously, and use async_cb as the progress handler which takes the
+ * xmlhttp object as its argument. If async_cb, this function returns null.
+ *
+ * @param fail_ok Default false. If fail_ok and !async_cb and loading fails,
+ * return null instead of throwing.
+ */
+dojo.hostenv._blockAsync = false;
+dojo.hostenv.getText = function(uri, async_cb, fail_ok){
+ // need to block async callbacks from snatching this thread as the result
+ // of an async callback might call another sync XHR, this hangs khtml forever
+ // hostenv._blockAsync must also be checked in BrowserIO's watchInFlight()
+ // NOTE: must be declared before scope switches ie. this.getXmlhttpObject()
+ if(!async_cb){ this._blockAsync = true; }
+
+ var http = this.getXmlhttpObject();
+
+ function isDocumentOk(http){
+ var stat = http["status"];
+ // allow a 304 use cache, needed in konq (is this compliant with the http spec?)
+ return Boolean((!stat)||((200 <= stat)&&(300 > stat))||(stat==304));
+ }
+
+ if(async_cb){
+ var _this = this, timer = null, gbl = dojo.global();
+ var xhr = dojo.evalObjPath("dojo.io.XMLHTTPTransport");
+ http.onreadystatechange = function(){
+ if(timer){ gbl.clearTimeout(timer); timer = null; }
+ if(_this._blockAsync || (xhr && xhr._blockAsync)){
+ timer = gbl.setTimeout(function () { http.onreadystatechange.apply(this); }, 10);
+ }else{
+ if(4==http.readyState){
+ if(isDocumentOk(http)){
+ // dojo.debug("LOADED URI: "+uri);
+ async_cb(http.responseText);
+ }
+ }
+ }
+ }
+ }
+
+ http.open('GET', uri, async_cb ? true : false);
+ try{
+ http.send(null);
+ if(async_cb){
+ return null;
+ }
+ if(!isDocumentOk(http)){
+ var err = Error("Unable to load "+uri+" status:"+ http.status);
+ err.status = http.status;
+ err.responseText = http.responseText;
+ throw err;
+ }
+ }catch(e){
+ this._blockAsync = false;
+ if((fail_ok)&&(!async_cb)){
+ return null;
+ }else{
+ throw e;
+ }
+ }
+
+ this._blockAsync = false;
+ return http.responseText;
}
-if(!_b0){
-for(var i=0;i<3;++i){
-var _b3=dojo.hostenv._XMLHTTP_PROGIDS[i];
-try{
-_b0=new ActiveXObject(_b3);
+
+/*
+ * It turns out that if we check *right now*, as this script file is being loaded,
+ * then the last script element in the window DOM is ourselves.
+ * That is because any subsequent script elements haven't shown up in the document
+ * object yet.
+ */
+ /*
+function dj_last_script_src() {
+ var scripts = window.document.getElementsByTagName('script');
+ if(scripts.length < 1){
+ dojo.raise("No script elements in window.document, so can't figure out my script src");
+ }
+ var script = scripts[scripts.length - 1];
+ var src = script.src;
+ if(!src){
+ dojo.raise("Last script element (out of " + scripts.length + ") has no src");
+ }
+ return src;
}
-catch(e){
-_b1=e;
+
+if(!dojo.hostenv["library_script_uri_"]){
+ dojo.hostenv.library_script_uri_ = dj_last_script_src();
}
-if(_b0){
-dojo.hostenv._XMLHTTP_PROGIDS=[_b3];
-break;
+*/
+
+dojo.hostenv.defaultDebugContainerId = 'dojoDebug';
+dojo.hostenv._println_buffer = [];
+dojo.hostenv._println_safe = false;
+dojo.hostenv.println = function (line){
+ if(!dojo.hostenv._println_safe){
+ dojo.hostenv._println_buffer.push(line);
+ }else{
+ try {
+ var console = document.getElementById(djConfig.debugContainerId ?
+ djConfig.debugContainerId : dojo.hostenv.defaultDebugContainerId);
+ if(!console) { console = dojo.body(); }
+
+ var div = document.createElement("div");
+ div.appendChild(document.createTextNode(line));
+ console.appendChild(div);
+ } catch (e) {
+ try{
+ // safari needs the output wrapped in an element for some reason
+ document.write("" + line + "
");
+ }catch(e2){
+ window.status = line;
+ }
+ }
+ }
}
-}
-}
-if(!_b0){
-return dojo.raise("XMLHTTP not available",_b1);
-}
-return _b0;
-};
-dojo.hostenv._blockAsync=false;
-dojo.hostenv.getText=function(uri,_b5,_b6){
-if(!_b5){
-this._blockAsync=true;
-}
-var _b7=this.getXmlhttpObject();
-function isDocumentOk(_b8){
-var _b9=_b8["status"];
-return Boolean((!_b9)||((200<=_b9)&&(300>_b9))||(_b9==304));
-}
-if(_b5){
-var _ba=this,_bb=null,gbl=dojo.global();
-var xhr=dojo.evalObjPath("dojo.io.XMLHTTPTransport");
-_b7.onreadystatechange=function(){
-if(_bb){
-gbl.clearTimeout(_bb);
-_bb=null;
-}
-if(_ba._blockAsync||(xhr&&xhr._blockAsync)){
-_bb=gbl.setTimeout(function(){
-_b7.onreadystatechange.apply(this);
-},10);
-}else{
-if(4==_b7.readyState){
-if(isDocumentOk(_b7)){
-_b5(_b7.responseText);
-}
-}
-}
-};
-}
-_b7.open("GET",uri,_b5?true:false);
-try{
-_b7.send(null);
-if(_b5){
-return null;
-}
-if(!isDocumentOk(_b7)){
-var err=Error("Unable to load "+uri+" status:"+_b7.status);
-err.status=_b7.status;
-err.responseText=_b7.responseText;
-throw err;
-}
-}
-catch(e){
-this._blockAsync=false;
-if((_b6)&&(!_b5)){
-return null;
-}else{
-throw e;
-}
-}
-this._blockAsync=false;
-return _b7.responseText;
-};
-dojo.hostenv.defaultDebugContainerId="dojoDebug";
-dojo.hostenv._println_buffer=[];
-dojo.hostenv._println_safe=false;
-dojo.hostenv.println=function(_bf){
-if(!dojo.hostenv._println_safe){
-dojo.hostenv._println_buffer.push(_bf);
-}else{
-try{
-var _c0=document.getElementById(djConfig.debugContainerId?djConfig.debugContainerId:dojo.hostenv.defaultDebugContainerId);
-if(!_c0){
-_c0=dojo.body();
-}
-var div=document.createElement("div");
-div.appendChild(document.createTextNode(_bf));
-_c0.appendChild(div);
-}
-catch(e){
-try{
-document.write(""+_bf+"
");
-}
-catch(e2){
-window.status=_bf;
-}
-}
-}
-};
+
dojo.addOnLoad(function(){
-dojo.hostenv._println_safe=true;
-while(dojo.hostenv._println_buffer.length>0){
-dojo.hostenv.println(dojo.hostenv._println_buffer.shift());
-}
+ dojo.hostenv._println_safe = true;
+ while(dojo.hostenv._println_buffer.length > 0){
+ dojo.hostenv.println(dojo.hostenv._println_buffer.shift());
+ }
});
-function dj_addNodeEvtHdlr(_c2,_c3,fp,_c5){
-var _c6=_c2["on"+_c3]||function(){
-};
-_c2["on"+_c3]=function(){
-fp.apply(_c2,arguments);
-_c6.apply(_c2,arguments);
-};
-return true;
+
+function dj_addNodeEvtHdlr(node, evtName, fp, capture){
+ var oldHandler = node["on"+evtName] || function(){};
+ node["on"+evtName] = function(){
+ fp.apply(node, arguments);
+ oldHandler.apply(node, arguments);
+ }
+ return true;
}
+
+// BEGIN DOMContentLoaded, from Dean Edwards (http://dean.edwards.name/weblog/2006/06/again/)
function dj_load_init(e){
-var _c8=(e&&e.type)?e.type.toLowerCase():"load";
-if(arguments.callee.initialized||(_c8!="domcontentloaded"&&_c8!="load")){
-return;
-}
-arguments.callee.initialized=true;
-if(typeof (_timer)!="undefined"){
-clearInterval(_timer);
-delete _timer;
-}
-var _c9=function(){
-if(dojo.render.html.ie){
-dojo.hostenv.makeWidgets();
-}
-};
-if(dojo.hostenv.inFlightCount==0){
-_c9();
-dojo.hostenv.modulesLoaded();
-}else{
-dojo.addOnLoad(_c9);
-}
+ // allow multiple calls, only first one will take effect
+ // A bug in khtml calls events callbacks for document for event which isnt supported
+ // for example a created contextmenu event calls DOMContentLoaded, workaround
+ var type = (e && e.type) ? e.type.toLowerCase() : "load";
+ if(arguments.callee.initialized || (type!="domcontentloaded" && type!="load")){ return; }
+ arguments.callee.initialized = true;
+ if(typeof(_timer) != 'undefined'){
+ clearInterval(_timer);
+ delete _timer;
+ }
+
+ var initFunc = function(){
+ //perform initialization
+ if(dojo.render.html.ie){
+ dojo.hostenv.makeWidgets();
+ }
+ };
+
+ if(dojo.hostenv.inFlightCount == 0){
+ initFunc();
+ dojo.hostenv.modulesLoaded();
+ }else{
+ dojo.addOnLoad(initFunc);
+ }
}
+
+// START DOMContentLoaded
+// Mozilla and Opera 9 expose the event we could use
if(document.addEventListener){
-if(dojo.render.html.opera||(dojo.render.html.moz&&!djConfig.delayMozLoadingFix)){
-document.addEventListener("DOMContentLoaded",dj_load_init,null);
+ if(dojo.render.html.opera || (dojo.render.html.moz && !djConfig.delayMozLoadingFix)){
+ document.addEventListener("DOMContentLoaded", dj_load_init, null);
+ }
+
+ // mainly for Opera 8.5, won't be fired if DOMContentLoaded fired already.
+ // also used for Mozilla because of trac #1640
+ window.addEventListener("load", dj_load_init, null);
}
-window.addEventListener("load",dj_load_init,null);
+
+// for Internet Explorer. readyState will not be achieved on init call, but dojo doesn't need it
+// however, we'll include it because we don't know if there are other functions added that might.
+// Note that this has changed because the build process strips all comments--including conditional
+// ones.
+if(dojo.render.html.ie && dojo.render.os.win){
+ document.attachEvent("onreadystatechange", function(e){
+ if(document.readyState == "complete"){
+ dj_load_init();
+ }
+ });
}
-if(dojo.render.html.ie&&dojo.render.os.win){
-document.attachEvent("onreadystatechange",function(e){
-if(document.readyState=="complete"){
-dj_load_init();
-}
-});
-}
-if(/(WebKit|khtml)/i.test(navigator.userAgent)){
-var _timer=setInterval(function(){
-if(/loaded|complete/.test(document.readyState)){
-dj_load_init();
-}
-},10);
+
+if (/(WebKit|khtml)/i.test(navigator.userAgent)) { // sniff
+ var _timer = setInterval(function() {
+ if (/loaded|complete/.test(document.readyState)) {
+ dj_load_init(); // call the onload handler
+ }
+ }, 10);
}
+// END DOMContentLoaded
+
+// IE WebControl hosted in an application can fire "beforeunload" and "unload"
+// events when control visibility changes, causing Dojo to unload too soon. The
+// following code fixes the problem
+// Reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;199155
if(dojo.render.html.ie){
-dj_addNodeEvtHdlr(window,"beforeunload",function(){
-dojo.hostenv._unloading=true;
-window.setTimeout(function(){
-dojo.hostenv._unloading=false;
-},0);
+ dj_addNodeEvtHdlr(window, "beforeunload", function(){
+ dojo.hostenv._unloading = true;
+ window.setTimeout(function() {
+ dojo.hostenv._unloading = false;
+ }, 0);
+ });
+}
+
+dj_addNodeEvtHdlr(window, "unload", function(){
+ dojo.hostenv.unloaded();
+ if((!dojo.render.html.ie)||(dojo.render.html.ie && dojo.hostenv._unloading)){
+ dojo.hostenv.unloaded();
+ }
});
+
+dojo.hostenv.makeWidgets = function(){
+ // you can put searchIds in djConfig and dojo.hostenv at the moment
+ // we should probably eventually move to one or the other
+ var sids = [];
+ if(djConfig.searchIds && djConfig.searchIds.length > 0) {
+ sids = sids.concat(djConfig.searchIds);
+ }
+ if(dojo.hostenv.searchIds && dojo.hostenv.searchIds.length > 0) {
+ sids = sids.concat(dojo.hostenv.searchIds);
+ }
+
+ if((djConfig.parseWidgets)||(sids.length > 0)){
+ if(dojo.evalObjPath("dojo.widget.Parse")){
+ // we must do this on a delay to avoid:
+ // http://www.shaftek.org/blog/archives/000212.html
+ // (IE bug)
+ var parser = new dojo.xml.Parse();
+ if(sids.length > 0){
+ for(var x=0; x0){
-_cb=_cb.concat(djConfig.searchIds);
-}
-if(dojo.hostenv.searchIds&&dojo.hostenv.searchIds.length>0){
-_cb=_cb.concat(dojo.hostenv.searchIds);
-}
-if((djConfig.parseWidgets)||(_cb.length>0)){
-if(dojo.evalObjPath("dojo.widget.Parse")){
-var _cc=new dojo.xml.Parse();
-if(_cb.length>0){
-for(var x=0;x<_cb.length;x++){
-var _ce=document.getElementById(_cb[x]);
-if(!_ce){
-continue;
-}
-var _cf=_cc.parseElement(_ce,null,true);
-dojo.widget.getParser().createComponents(_cf);
-}
-}else{
-if(djConfig.parseWidgets){
-var _cf=_cc.parseElement(dojo.body(),null,true);
-dojo.widget.getParser().createComponents(_cf);
-}
-}
-}
-}
-};
+
dojo.addOnLoad(function(){
-if(!dojo.render.html.ie){
-dojo.hostenv.makeWidgets();
-}
+ if(!dojo.render.html.ie) {
+ dojo.hostenv.makeWidgets();
+ }
});
-try{
-if(dojo.render.html.ie){
-document.namespaces.add("v","urn:schemas-microsoft-com:vml");
-document.createStyleSheet().addRule("v\\:*","behavior:url(#default#VML)");
+
+try {
+ if (dojo.render.html.ie) {
+ document.namespaces.add("v","urn:schemas-microsoft-com:vml");
+ document.createStyleSheet().addRule("v\\:*", "behavior:url(#default#VML)");
+ }
+} catch (e) { }
+
+// stub, over-ridden by debugging code. This will at least keep us from
+// breaking when it's not included
+dojo.hostenv.writeIncludes = function(){}
+
+//TODOC: HOW TO DOC THIS?
+// @global: dj_currentDocument
+// summary:
+// Current document object. 'dj_currentDocument' can be modified for temporary context shifting.
+// description:
+// dojo.doc() returns dojo.currentDocument.
+// Refer to dojo.doc() rather than referring to 'window.document' to ensure your
+// code runs correctly in managed contexts.
+if(!dj_undef("document", this)){
+ dj_currentDocument = this.document;
}
+
+dojo.doc = function(){
+ // summary:
+ // return the document object associated with the dojo.global()
+ return dj_currentDocument;
}
-catch(e){
+
+dojo.body = function(){
+ // summary:
+ // return the body object associated with dojo.doc()
+ // Note: document.body is not defined for a strict xhtml document
+ return dojo.doc().body || dojo.doc().getElementsByTagName("body")[0];
}
-dojo.hostenv.writeIncludes=function(){
+
+dojo.byId = function(id, doc){
+ if((id)&&((typeof id == "string")||(id instanceof String))){
+ if (!doc) { doc = dj_currentDocument; }
+ var ele = doc.getElementById(id);
+ // workaround bug in IE and Opera 8.2 where getElementById returns wrong element
+ if (ele && (ele.id != id) && doc.all) {
+ ele = null;
+ // get all matching elements with this id
+ eles = doc.all[id];
+ if (eles) {
+ // if more than 1, choose first with the correct id
+ if (eles.length) {
+ for (var i=0; i < eles.length; i++) {
+ if (eles[i].id == id) {
+ ele = eles[i];
+ break;
+ }
+ }
+ // return 1 and only element
+ } else { ele = eles; }
+ }
+ }
+ return ele;
+ }
+ return id; // assume it's a node
+}
+
+dojo.setContext = function(/*Object*/globalObject, /*Object*/ globalDocument){
+ dj_currentContext = globalObject;
+ dj_currentDocument = globalDocument;
};
-if(!dj_undef("document",this)){
-dj_currentDocument=this.document;
-}
-dojo.doc=function(){
-return dj_currentDocument;
-};
-dojo.body=function(){
-return dojo.doc().body||dojo.doc().getElementsByTagName("body")[0];
-};
-dojo.byId=function(id,doc){
-if((id)&&((typeof id=="string")||(id instanceof String))){
-if(!doc){
-doc=dj_currentDocument;
-}
-var ele=doc.getElementById(id);
-if(ele&&(ele.id!=id)&&doc.all){
-ele=null;
-eles=doc.all[id];
-if(eles){
-if(eles.length){
-for(var i=0;i");
-}
-catch(e){
-var _ed=document.createElement("script");
-_ed.src=_ec;
-document.getElementsByTagName("head")[0].appendChild(_ed);
+
+dojo._fireCallback = function(callback, context, cbArguments) {
+ if((context)&&((typeof callback == "string")||(callback instanceof String))){
+ callback=context[callback];
+ }
+ return (context ? callback.apply(context, cbArguments || [ ]) : callback());
}
+
+dojo.withGlobal = function(/*Object*/globalObject, /*Function*/callback, /*Object?*/thisObject, /*Array?*/cbArguments){
+ // summary:
+ // Call callback with globalObject as dojo.global() and globalObject.document
+ // as dojo.doc(). If provided, globalObject will be executed in the context of
+ // object thisObject
+ // description:
+ // When callback() returns or throws an error, the dojo.global() and dojo.doc() will
+ // be restored to its previous state.
+ var rval;
+ var oldGlob = dj_currentContext;
+ var oldDoc = dj_currentDocument;
+ try{
+ dojo.setContext(globalObject, globalObject.document);
+ rval = dojo._fireCallback(callback, thisObject, cbArguments);
+ }finally{
+ dojo.setContext(oldGlob, oldDoc);
+ }
+ return rval;
}
+
+dojo.withDoc = function (/*Object*/documentObject, /*Function*/callback, /*Object?*/thisObject, /*Array?*/cbArguments) {
+ // summary:
+ // Call callback with documentObject as dojo.doc(). If provided, callback will be executed
+ // in the context of object thisObject
+ // description:
+ // When callback() returns or throws an error, the dojo.doc() will
+ // be restored to its previous state.
+ var rval;
+ var oldDoc = dj_currentDocument;
+ try{
+ dj_currentDocument = documentObject;
+ rval = dojo._fireCallback(callback, thisObject, cbArguments);
+ }finally{
+ dj_currentDocument = oldDoc;
+ }
+ return rval;
}
+
+} //if (typeof window != 'undefined')
+
+//Semicolon is for when this file is integrated with a custom build on one line
+//with some other file's contents. Sometimes that makes things not get defined
+//properly, particularly with the using the closure below to do all the work.
+;(function(){
+ //Don't do this work if dojo.js has already done it.
+ if(typeof dj_usingBootstrap != "undefined"){
+ return;
+ }
+
+ var isRhino = false;
+ var isSpidermonkey = false;
+ var isDashboard = false;
+ if((typeof this["load"] == "function")&&((typeof this["Packages"] == "function")||(typeof this["Packages"] == "object"))){
+ isRhino = true;
+ }else if(typeof this["load"] == "function"){
+ isSpidermonkey = true;
+ }else if(window.widget){
+ isDashboard = true;
+ }
+
+ var tmps = [];
+ if((this["djConfig"])&&((djConfig["isDebug"])||(djConfig["debugAtAllCosts"]))){
+ tmps.push("debug.js");
+ }
+
+ if((this["djConfig"])&&(djConfig["debugAtAllCosts"])&&(!isRhino)&&(!isDashboard)){
+ tmps.push("browser_debug.js");
+ }
+
+ var loaderRoot = djConfig["baseScriptUri"];
+ if((this["djConfig"])&&(djConfig["baseLoaderUri"])){
+ loaderRoot = djConfig["baseLoaderUri"];
+ }
+
+ for(var x=0; x < tmps.length; x++){
+ var spath = loaderRoot+"src/"+tmps[x];
+ if(isRhino||isSpidermonkey){
+ load(spath);
+ } else {
+ try {
+ document.write("");
+ } catch (e) {
+ var script = document.createElement("script");
+ script.src = spath;
+ document.getElementsByTagName("head")[0].appendChild(script);
+ }
+ }
+ }
})();
+
dojo.provide("dojo.lang.common");
-dojo.lang.inherits=function(_ee,_ef){
-if(typeof _ef!="function"){
-dojo.raise("dojo.inherits: superclass argument ["+_ef+"] must be a function (subclass: ["+_ee+"']");
+
+dojo.lang.inherits = function(/*Function*/ subclass, /*Function*/ superclass){
+ // summary: Set up inheritance between two classes.
+ if(typeof superclass != 'function'){
+ dojo.raise("dojo.inherits: superclass argument ["+superclass+"] must be a function (subclass: ["+subclass+"']");
+ }
+ subclass.prototype = new superclass();
+ subclass.prototype.constructor = subclass;
+ subclass.superclass = superclass.prototype;
+ // DEPRECATED: super is a reserved word, use 'superclass'
+ subclass['super'] = superclass.prototype;
}
-_ee.prototype=new _ef();
-_ee.prototype.constructor=_ee;
-_ee.superclass=_ef.prototype;
-_ee["super"]=_ef.prototype;
-};
-dojo.lang._mixin=function(obj,_f1){
-var _f2={};
-for(var x in _f1){
-if((typeof _f2[x]=="undefined")||(_f2[x]!=_f1[x])){
-obj[x]=_f1[x];
+
+dojo.lang._mixin = function(/*Object*/ obj, /*Object*/ props){
+ // summary: Adds all properties and methods of props to obj.
+ var tobj = {};
+ for(var x in props){
+ // the "tobj" condition avoid copying properties in "props"
+ // inherited from Object.prototype. For example, if obj has a custom
+ // toString() method, don't overwrite it with the toString() method
+ // that props inherited from Object.protoype
+ if((typeof tobj[x] == "undefined") || (tobj[x] != props[x])){
+ obj[x] = props[x];
+ }
+ }
+ // IE doesn't recognize custom toStrings in for..in
+ if(dojo.render.html.ie
+ && (typeof(props["toString"]) == "function")
+ && (props["toString"] != obj["toString"])
+ && (props["toString"] != tobj["toString"]))
+ {
+ obj.toString = props.toString;
+ }
+ return obj; // Object
}
+
+dojo.lang.mixin = function(/*Object*/ obj, /*Object...*/props){
+ // summary: Adds all properties and methods of props to obj.
+ for(var i=1, l=arguments.length; i -1; // boolean
}
-var _101=dojo.lang.isString(_fc);
-if(_101){
-_fc=_fc.split("");
+
+/**
+ * Partial implmentation of is* functions from
+ * http://www.crockford.com/javascript/recommend.html
+ * NOTE: some of these may not be the best thing to use in all situations
+ * as they aren't part of core JS and therefore can't work in every case.
+ * See WARNING messages inline for tips.
+ *
+ * The following is* functions are fairly "safe"
+ */
+
+dojo.lang.isObject = function(/*anything*/ it){
+ // summary: Return true if it is an Object, Array or Function.
+ if(typeof it == "undefined"){ return false; }
+ return (typeof it == "object" || it === null || dojo.lang.isArray(it) || dojo.lang.isFunction(it)); // Boolean
}
-if(_ff){
-var step=-1;
-var i=_fc.length-1;
-var end=-1;
-}else{
-var step=1;
-var i=0;
-var end=_fc.length;
+
+dojo.lang.isArray = function(/*anything*/ it){
+ // summary: Return true if it is an Array.
+ return (it && it instanceof Array || typeof it == "array"); // Boolean
}
-if(_fe){
-while(i!=end){
-if(_fc[i]===_fd){
-return i;
+
+dojo.lang.isArrayLike = function(/*anything*/ it){
+ // summary: Return true if it can be used as an array (i.e. is an object with an integer length property).
+ if((!it)||(dojo.lang.isUndefined(it))){ return false; }
+ if(dojo.lang.isString(it)){ return false; }
+ if(dojo.lang.isFunction(it)){ return false; } // keeps out built-in constructors (Number, String, ...) which have length properties
+ if(dojo.lang.isArray(it)){ return true; }
+ // form node itself is ArrayLike, but not always iterable. Use form.elements instead.
+ if((it.tagName)&&(it.tagName.toLowerCase()=='form')){ return false; }
+ if(dojo.lang.isNumber(it.length) && isFinite(it.length)){ return true; }
+ return false; // Boolean
}
-i+=step;
+
+dojo.lang.isFunction = function(/*anything*/ it){
+ // summary: Return true if it is a Function.
+ if(!it){ return false; }
+ // webkit treats NodeList as a function, which is bad
+ if((typeof(it) == "function") && (it == "[object NodeList]")) { return false; }
+ return (it instanceof Function || typeof it == "function"); // Boolean
}
-}else{
-while(i!=end){
-if(_fc[i]==_fd){
-return i;
+
+dojo.lang.isString = function(/*anything*/ it){
+ // summary: Return true if it is a String.
+ return (typeof it == "string" || it instanceof String);
}
-i+=step;
+
+dojo.lang.isAlien = function(/*anything*/ it){
+ // summary: Return true if it is not a built-in function.
+ if(!it){ return false; }
+ return !dojo.lang.isFunction() && /\{\s*\[native code\]\s*\}/.test(String(it)); // Boolean
}
+
+dojo.lang.isBoolean = function(/*anything*/ it){
+ // summary: Return true if it is a Boolean.
+ return (it instanceof Boolean || typeof it == "boolean"); // Boolean
}
-return -1;
-};
-dojo.lang.indexOf=dojo.lang.find;
-dojo.lang.findLast=function(_105,_106,_107){
-return dojo.lang.find(_105,_106,_107,true);
-};
-dojo.lang.lastIndexOf=dojo.lang.findLast;
-dojo.lang.inArray=function(_108,_109){
-return dojo.lang.find(_108,_109)>-1;
-};
-dojo.lang.isObject=function(it){
-if(typeof it=="undefined"){
-return false;
+
+/**
+ * The following is***() functions are somewhat "unsafe". Fortunately,
+ * there are workarounds the the language provides and are mentioned
+ * in the WARNING messages.
+ *
+ */
+dojo.lang.isNumber = function(/*anything*/ it){
+ // summary: Return true if it is a number.
+ // description:
+ // WARNING - In most cases, isNaN(it) is sufficient to determine whether or not
+ // something is a number or can be used as such. For example, a number or string
+ // can be used interchangably when accessing array items (array["1"] is the same as
+ // array[1]) and isNaN will return false for both values ("1" and 1). However,
+ // isNumber("1") will return false, which is generally not too useful.
+ // Also, isNumber(NaN) returns true, again, this isn't generally useful, but there
+ // are corner cases (like when you want to make sure that two things are really
+ // the same type of thing). That is really where isNumber "shines".
+ //
+ // Recommendation - Use isNaN(it) when possible
+
+ return (it instanceof Number || typeof it == "number"); // Boolean
}
-return (typeof it=="object"||it===null||dojo.lang.isArray(it)||dojo.lang.isFunction(it));
-};
-dojo.lang.isArray=function(it){
-return (it&&it instanceof Array||typeof it=="array");
-};
-dojo.lang.isArrayLike=function(it){
-if((!it)||(dojo.lang.isUndefined(it))){
-return false;
+
+/*
+ * FIXME: Should isUndefined go away since it is error prone?
+ */
+dojo.lang.isUndefined = function(/*anything*/ it){
+ // summary: Return true if it is not defined.
+ // description:
+ // WARNING - In some cases, isUndefined will not behave as you
+ // might expect. If you do isUndefined(foo) and there is no earlier
+ // reference to foo, an error will be thrown before isUndefined is
+ // called. It behaves correctly if you scope yor object first, i.e.
+ // isUndefined(foo.bar) where foo is an object and bar isn't a
+ // property of the object.
+ //
+ // Recommendation - Use typeof foo == "undefined" when possible
+
+ return ((typeof(it) == "undefined")&&(it == undefined)); // Boolean
}
-if(dojo.lang.isString(it)){
-return false;
-}
-if(dojo.lang.isFunction(it)){
-return false;
-}
-if(dojo.lang.isArray(it)){
-return true;
-}
-if((it.tagName)&&(it.tagName.toLowerCase()=="form")){
-return false;
-}
-if(dojo.lang.isNumber(it.length)&&isFinite(it.length)){
-return true;
-}
-return false;
-};
-dojo.lang.isFunction=function(it){
-if(!it){
-return false;
-}
-if((typeof (it)=="function")&&(it=="[object NodeList]")){
-return false;
-}
-return (it instanceof Function||typeof it=="function");
-};
-dojo.lang.isString=function(it){
-return (typeof it=="string"||it instanceof String);
-};
-dojo.lang.isAlien=function(it){
-if(!it){
-return false;
-}
-return !dojo.lang.isFunction()&&/\{\s*\[native code\]\s*\}/.test(String(it));
-};
-dojo.lang.isBoolean=function(it){
-return (it instanceof Boolean||typeof it=="boolean");
-};
-dojo.lang.isNumber=function(it){
-return (it instanceof Number||typeof it=="number");
-};
-dojo.lang.isUndefined=function(it){
-return ((typeof (it)=="undefined")&&(it==undefined));
-};
+
+// end Crockford functions
+
dojo.provide("dojo.lang");
-dojo.deprecated("dojo.lang","replaced by dojo.lang.common","0.5");
+
+dojo.deprecated("dojo.lang", "replaced by dojo.lang.common", "0.5");
+
dojo.provide("dojo.dom");
-dojo.dom.ELEMENT_NODE=1;
-dojo.dom.ATTRIBUTE_NODE=2;
-dojo.dom.TEXT_NODE=3;
-dojo.dom.CDATA_SECTION_NODE=4;
-dojo.dom.ENTITY_REFERENCE_NODE=5;
-dojo.dom.ENTITY_NODE=6;
-dojo.dom.PROCESSING_INSTRUCTION_NODE=7;
-dojo.dom.COMMENT_NODE=8;
-dojo.dom.DOCUMENT_NODE=9;
-dojo.dom.DOCUMENT_TYPE_NODE=10;
-dojo.dom.DOCUMENT_FRAGMENT_NODE=11;
-dojo.dom.NOTATION_NODE=12;
-dojo.dom.dojoml="http://www.dojotoolkit.org/2004/dojoml";
-dojo.dom.xmlns={svg:"http://www.w3.org/2000/svg",smil:"http://www.w3.org/2001/SMIL20/",mml:"http://www.w3.org/1998/Math/MathML",cml:"http://www.xml-cml.org",xlink:"http://www.w3.org/1999/xlink",xhtml:"http://www.w3.org/1999/xhtml",xul:"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",xbl:"http://www.mozilla.org/xbl",fo:"http://www.w3.org/1999/XSL/Format",xsl:"http://www.w3.org/1999/XSL/Transform",xslt:"http://www.w3.org/1999/XSL/Transform",xi:"http://www.w3.org/2001/XInclude",xforms:"http://www.w3.org/2002/01/xforms",saxon:"http://icl.com/saxon",xalan:"http://xml.apache.org/xslt",xsd:"http://www.w3.org/2001/XMLSchema",dt:"http://www.w3.org/2001/XMLSchema-datatypes",xsi:"http://www.w3.org/2001/XMLSchema-instance",rdf:"http://www.w3.org/1999/02/22-rdf-syntax-ns#",rdfs:"http://www.w3.org/2000/01/rdf-schema#",dc:"http://purl.org/dc/elements/1.1/",dcq:"http://purl.org/dc/qualifiers/1.0","soap-env":"http://schemas.xmlsoap.org/soap/envelope/",wsdl:"http://schemas.xmlsoap.org/wsdl/",AdobeExtensions:"http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"};
-dojo.dom.isNode=function(wh){
-if(typeof Element=="function"){
-try{
-return wh instanceof Element;
-}
-catch(E){
-}
-}else{
-return wh&&!isNaN(wh.nodeType);
-}
+
+dojo.dom.ELEMENT_NODE = 1;
+dojo.dom.ATTRIBUTE_NODE = 2;
+dojo.dom.TEXT_NODE = 3;
+dojo.dom.CDATA_SECTION_NODE = 4;
+dojo.dom.ENTITY_REFERENCE_NODE = 5;
+dojo.dom.ENTITY_NODE = 6;
+dojo.dom.PROCESSING_INSTRUCTION_NODE = 7;
+dojo.dom.COMMENT_NODE = 8;
+dojo.dom.DOCUMENT_NODE = 9;
+dojo.dom.DOCUMENT_TYPE_NODE = 10;
+dojo.dom.DOCUMENT_FRAGMENT_NODE = 11;
+dojo.dom.NOTATION_NODE = 12;
+
+dojo.dom.dojoml = "http://www.dojotoolkit.org/2004/dojoml";
+
+/**
+ * comprehensive list of XML namespaces
+**/
+dojo.dom.xmlns = {
+ // summary
+ // aliases for various common XML namespaces
+ svg : "http://www.w3.org/2000/svg",
+ smil : "http://www.w3.org/2001/SMIL20/",
+ mml : "http://www.w3.org/1998/Math/MathML",
+ cml : "http://www.xml-cml.org",
+ xlink : "http://www.w3.org/1999/xlink",
+ xhtml : "http://www.w3.org/1999/xhtml",
+ xul : "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
+ xbl : "http://www.mozilla.org/xbl",
+ fo : "http://www.w3.org/1999/XSL/Format",
+ xsl : "http://www.w3.org/1999/XSL/Transform",
+ xslt : "http://www.w3.org/1999/XSL/Transform",
+ xi : "http://www.w3.org/2001/XInclude",
+ xforms : "http://www.w3.org/2002/01/xforms",
+ saxon : "http://icl.com/saxon",
+ xalan : "http://xml.apache.org/xslt",
+ xsd : "http://www.w3.org/2001/XMLSchema",
+ dt: "http://www.w3.org/2001/XMLSchema-datatypes",
+ xsi : "http://www.w3.org/2001/XMLSchema-instance",
+ rdf : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
+ rdfs : "http://www.w3.org/2000/01/rdf-schema#",
+ dc : "http://purl.org/dc/elements/1.1/",
+ dcq: "http://purl.org/dc/qualifiers/1.0",
+ "soap-env" : "http://schemas.xmlsoap.org/soap/envelope/",
+ wsdl : "http://schemas.xmlsoap.org/wsdl/",
+ AdobeExtensions : "http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
};
-dojo.dom.getUniqueId=function(){
-var _114=dojo.doc();
-do{
-var id="dj_unique_"+(++arguments.callee._idIncrement);
-}while(_114.getElementById(id));
-return id;
-};
-dojo.dom.getUniqueId._idIncrement=0;
-dojo.dom.firstElement=dojo.dom.getFirstChildElement=function(_116,_117){
-var node=_116.firstChild;
-while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE){
-node=node.nextSibling;
+
+dojo.dom.isNode = function(/* object */wh){
+ // summary
+ // checks to see if wh is actually a node.
+ if(typeof Element == "function") {
+ try {
+ return wh instanceof Element; // boolean
+ } catch(E) {}
+ } else {
+ // best-guess
+ return wh && !isNaN(wh.nodeType); // boolean
+ }
}
-if(_117&&node&&node.tagName&&node.tagName.toLowerCase()!=_117.toLowerCase()){
-node=dojo.dom.nextElement(node,_117);
+
+dojo.dom.getUniqueId = function(){
+ // summary
+ // returns a unique string for use with any DOM element
+ var _document = dojo.doc();
+ do {
+ var id = "dj_unique_" + (++arguments.callee._idIncrement);
+ }while(_document.getElementById(id));
+ return id; // string
}
-return node;
-};
-dojo.dom.lastElement=dojo.dom.getLastChildElement=function(_119,_11a){
-var node=_119.lastChild;
-while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE){
-node=node.previousSibling;
+dojo.dom.getUniqueId._idIncrement = 0;
+
+dojo.dom.firstElement = dojo.dom.getFirstChildElement = function(/* Element */parentNode, /* string? */tagName){
+ // summary
+ // returns the first child element matching tagName
+ var node = parentNode.firstChild;
+ while(node && node.nodeType != dojo.dom.ELEMENT_NODE){
+ node = node.nextSibling;
+ }
+ if(tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) {
+ node = dojo.dom.nextElement(node, tagName);
+ }
+ return node; // Element
}
-if(_11a&&node&&node.tagName&&node.tagName.toLowerCase()!=_11a.toLowerCase()){
-node=dojo.dom.prevElement(node,_11a);
+
+dojo.dom.lastElement = dojo.dom.getLastChildElement = function(/* Element */parentNode, /* string? */tagName){
+ // summary
+ // returns the last child element matching tagName
+ var node = parentNode.lastChild;
+ while(node && node.nodeType != dojo.dom.ELEMENT_NODE) {
+ node = node.previousSibling;
+ }
+ if(tagName && node && node.tagName && node.tagName.toLowerCase() != tagName.toLowerCase()) {
+ node = dojo.dom.prevElement(node, tagName);
+ }
+ return node; // Element
}
-return node;
-};
-dojo.dom.nextElement=dojo.dom.getNextSiblingElement=function(node,_11d){
-if(!node){
-return null;
+
+dojo.dom.nextElement = dojo.dom.getNextSiblingElement = function(/* Node */node, /* string? */tagName){
+ // summary
+ // returns the next sibling element matching tagName
+ if(!node) { return null; }
+ do {
+ node = node.nextSibling;
+ } while(node && node.nodeType != dojo.dom.ELEMENT_NODE);
+
+ if(node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) {
+ return dojo.dom.nextElement(node, tagName);
+ }
+ return node; // Element
}
-do{
-node=node.nextSibling;
-}while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE);
-if(node&&_11d&&_11d.toLowerCase()!=node.tagName.toLowerCase()){
-return dojo.dom.nextElement(node,_11d);
+
+dojo.dom.prevElement = dojo.dom.getPreviousSiblingElement = function(/* Node */node, /* string? */tagName){
+ // summary
+ // returns the previous sibling element matching tagName
+ if(!node) { return null; }
+ if(tagName) { tagName = tagName.toLowerCase(); }
+ do {
+ node = node.previousSibling;
+ } while(node && node.nodeType != dojo.dom.ELEMENT_NODE);
+
+ if(node && tagName && tagName.toLowerCase() != node.tagName.toLowerCase()) {
+ return dojo.dom.prevElement(node, tagName);
+ }
+ return node; // Element
}
-return node;
-};
-dojo.dom.prevElement=dojo.dom.getPreviousSiblingElement=function(node,_11f){
-if(!node){
-return null;
+
+// TODO: hmph
+/*this.forEachChildTag = function(node, unaryFunc) {
+ var child = this.getFirstChildTag(node);
+ while(child) {
+ if(unaryFunc(child) == "break") { break; }
+ child = this.getNextSiblingTag(child);
+ }
+}*/
+
+dojo.dom.moveChildren = function(/* Element */srcNode, /* Element */destNode, /* boolean? */trim){
+ // summary
+ // Moves children from srcNode to destNode and returns the count of children moved;
+ // will trim off text nodes if trim == true
+ var count = 0;
+ if(trim) {
+ while(srcNode.hasChildNodes() &&
+ srcNode.firstChild.nodeType == dojo.dom.TEXT_NODE) {
+ srcNode.removeChild(srcNode.firstChild);
+ }
+ while(srcNode.hasChildNodes() &&
+ srcNode.lastChild.nodeType == dojo.dom.TEXT_NODE) {
+ srcNode.removeChild(srcNode.lastChild);
+ }
+ }
+ while(srcNode.hasChildNodes()){
+ destNode.appendChild(srcNode.firstChild);
+ count++;
+ }
+ return count; // number
}
-if(_11f){
-_11f=_11f.toLowerCase();
+
+dojo.dom.copyChildren = function(/* Element */srcNode, /* Element */destNode, /* boolean? */trim){
+ // summary
+ // Copies children from srcNde to destNode and returns the count of children copied;
+ // will trim off text nodes if trim == true
+ var clonedNode = srcNode.cloneNode(true);
+ return this.moveChildren(clonedNode, destNode, trim); // number
}
-do{
-node=node.previousSibling;
-}while(node&&node.nodeType!=dojo.dom.ELEMENT_NODE);
-if(node&&_11f&&_11f.toLowerCase()!=node.tagName.toLowerCase()){
-return dojo.dom.prevElement(node,_11f);
+
+dojo.dom.removeChildren = function(/* Element */node){
+ // summary
+ // removes all children from node and returns the count of children removed.
+ var count = node.childNodes.length;
+ while(node.hasChildNodes()){ node.removeChild(node.firstChild); }
+ return count; // number
}
-return node;
-};
-dojo.dom.moveChildren=function(_120,_121,trim){
-var _123=0;
-if(trim){
-while(_120.hasChildNodes()&&_120.firstChild.nodeType==dojo.dom.TEXT_NODE){
-_120.removeChild(_120.firstChild);
+
+dojo.dom.replaceChildren = function(/* Element */node, /* Node */newChild){
+ // summary
+ // Removes all children of node and appends newChild
+ // FIXME: what if newChild is an array-like object?
+ dojo.dom.removeChildren(node);
+ node.appendChild(newChild);
}
-while(_120.hasChildNodes()&&_120.lastChild.nodeType==dojo.dom.TEXT_NODE){
-_120.removeChild(_120.lastChild);
+
+dojo.dom.removeNode = function(/* Node */node){
+ // summary
+ // if node has a parent, removes node from parent and returns a reference to the removed child.
+ if(node && node.parentNode){
+ // return a ref to the removed child
+ return node.parentNode.removeChild(node); // Node
+ }
}
+
+dojo.dom.getAncestors = function(/* Node */node, /* function? */filterFunction, /* boolean? */returnFirstHit) {
+ // summary
+ // returns all ancestors matching optional filterFunction; will return only the first if returnFirstHit
+ var ancestors = [];
+ var isFunction = (filterFunction && (filterFunction instanceof Function || typeof filterFunction == "function"));
+ while(node) {
+ if (!isFunction || filterFunction(node)) {
+ ancestors.push(node);
+ }
+ if (returnFirstHit && ancestors.length > 0) {
+ return ancestors[0]; // Node
+ }
+
+ node = node.parentNode;
+ }
+ if (returnFirstHit) { return null; }
+ return ancestors; // array
}
-while(_120.hasChildNodes()){
-_121.appendChild(_120.firstChild);
-_123++;
+
+dojo.dom.getAncestorsByTag = function(/* Node */node, /* string */tag, /* boolean? */returnFirstHit) {
+ // summary
+ // returns all ancestors matching tag (as tagName), will only return first one if returnFirstHit
+ tag = tag.toLowerCase();
+ return dojo.dom.getAncestors(node, function(el){
+ return ((el.tagName)&&(el.tagName.toLowerCase() == tag));
+ }, returnFirstHit); // Node || array
}
-return _123;
-};
-dojo.dom.copyChildren=function(_124,_125,trim){
-var _127=_124.cloneNode(true);
-return this.moveChildren(_127,_125,trim);
-};
-dojo.dom.removeChildren=function(node){
-var _129=node.childNodes.length;
-while(node.hasChildNodes()){
-node.removeChild(node.firstChild);
+
+dojo.dom.getFirstAncestorByTag = function(/* Node */node, /* string */tag) {
+ // summary
+ // Returns first ancestor of node with tag tagName
+ return dojo.dom.getAncestorsByTag(node, tag, true); // Node
}
-return _129;
-};
-dojo.dom.replaceChildren=function(node,_12b){
-dojo.dom.removeChildren(node);
-node.appendChild(_12b);
-};
-dojo.dom.removeNode=function(node){
-if(node&&node.parentNode){
-return node.parentNode.removeChild(node);
+
+dojo.dom.isDescendantOf = function(/* Node */node, /* Node */ancestor, /* boolean? */guaranteeDescendant){
+ // summary
+ // Returns boolean if node is a descendant of ancestor
+ // guaranteeDescendant allows us to be a "true" isDescendantOf function
+ if(guaranteeDescendant && node) { node = node.parentNode; }
+ while(node) {
+ if(node == ancestor){
+ return true; // boolean
+ }
+ node = node.parentNode;
+ }
+ return false; // boolean
}
-};
-dojo.dom.getAncestors=function(node,_12e,_12f){
-var _130=[];
-var _131=(_12e&&(_12e instanceof Function||typeof _12e=="function"));
-while(node){
-if(!_131||_12e(node)){
-_130.push(node);
+
+dojo.dom.innerXML = function(/* Node */node){
+ // summary
+ // Implementation of MS's innerXML function.
+ if(node.innerXML){
+ return node.innerXML; // string
+ }else if (node.xml){
+ return node.xml; // string
+ }else if(typeof XMLSerializer != "undefined"){
+ return (new XMLSerializer()).serializeToString(node); // string
+ }
}
-if(_12f&&_130.length>0){
-return _130[0];
+
+dojo.dom.createDocument = function(){
+ // summary
+ // cross-browser implementation of creating an XML document object.
+ var doc = null;
+ var _document = dojo.doc();
+
+ if(!dj_undef("ActiveXObject")){
+ var prefixes = [ "MSXML2", "Microsoft", "MSXML", "MSXML3" ];
+ for(var i = 0; i1) {
+ var _document = dojo.doc();
+ dojo.dom.replaceChildren(node, _document.createTextNode(text));
+ return text; // string
+ } else {
+ if(node.textContent != undefined){ //FF 1.5
+ return node.textContent; // string
+ }
+ var _result = "";
+ if (node == null) { return _result; }
+ for (var i = 0; i < node.childNodes.length; i++) {
+ switch (node.childNodes[i].nodeType) {
+ case 1: // ELEMENT_NODE
+ case 5: // ENTITY_REFERENCE_NODE
+ _result += dojo.dom.textContent(node.childNodes[i]);
+ break;
+ case 3: // TEXT_NODE
+ case 2: // ATTRIBUTE_NODE
+ case 4: // CDATA_SECTION_NODE
+ _result += node.childNodes[i].nodeValue;
+ break;
+ default:
+ break;
+ }
+ }
+ return _result; // string
+ }
}
+
+dojo.dom.hasParent = function (/* Node */node) {
+ // summary
+ // returns whether or not node is a child of another node.
+ return node && node.parentNode && dojo.dom.isNode(node.parentNode); // boolean
}
-};
-dojo.dom.createDocument=function(){
-var doc=null;
-var _13d=dojo.doc();
-if(!dj_undef("ActiveXObject")){
-var _13e=["MSXML2","Microsoft","MSXML","MSXML3"];
-for(var i=0;i<_13e.length;i++){
-try{
-doc=new ActiveXObject(_13e[i]+".XMLDOM");
+
+/**
+ * Examples:
+ *
+ * myFooNode =
+ * isTag(myFooNode, "foo"); // returns "foo"
+ * isTag(myFooNode, "bar"); // returns ""
+ * isTag(myFooNode, "FOO"); // returns ""
+ * isTag(myFooNode, "hey", "foo", "bar"); // returns "foo"
+**/
+dojo.dom.isTag = function(/* Node */node /* ... */) {
+ // summary
+ // determines if node has any of the provided tag names and returns the tag name that matches, empty string otherwise.
+ if(node && node.tagName) {
+ for(var i=1; i1){
-var _15e=dojo.doc();
-dojo.dom.replaceChildren(node,_15e.createTextNode(text));
-return text;
-}else{
-if(node.textContent!=undefined){
-return node.textContent;
-}
-var _15f="";
-if(node==null){
-return _15f;
-}
-for(var i=0;i,
+ //which will be treated as an external javascript file in IE
+ var xscript = dojo.doc().createElement('script');
+ xscript.src = "javascript:'dojo.html.createExternalElement=function(doc, tag){ return doc.createElement(tag); }'";
+ dojo.doc().getElementsByTagName("head")[0].appendChild(xscript);
+ })();
+ }
}else{
-if(!dojo.render.html.opera&&_16c.innerWidth){
-w=_16c.innerWidth;
-h=_16c.innerHeight;
-}else{
-if(!dojo.render.html.opera&&dojo.exists(_16d,"documentElement.clientWidth")){
-var w2=_16d.documentElement.clientWidth;
-if(!w||w2&&w20&&!(j==1&&segs[0]=="")&&segs[j]==".."&&segs[j-1]!=".."){
-if(j==segs.length-1){
-segs.splice(j,1);
-segs[j-1]="";
-}else{
-segs.splice(j-1,2);
-j-=2;
-}
-}
-}
-}
-_196.path=segs.join("/");
-}
-}
-}
-}
-uri="";
-if(_196.scheme!=null){
-uri+=_196.scheme+":";
-}
-if(_196.authority!=null){
-uri+="//"+_196.authority;
-}
-uri+=_196.path;
-if(_196.query!=null){
-uri+="?"+_196.query;
-}
-if(_196.fragment!=null){
-uri+="#"+_196.fragment;
-}
-}
-this.uri=uri.toString();
-var _19b="^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";
-var r=this.uri.match(new RegExp(_19b));
-this.scheme=r[2]||(r[1]?"":null);
-this.authority=r[4]||(r[3]?"":null);
-this.path=r[5];
-this.query=r[7]||(r[6]?"":null);
-this.fragment=r[9]||(r[8]?"":null);
-if(this.authority!=null){
-_19b="^((([^:]+:)?([^@]+))@)?([^:]*)(:([0-9]+))?$";
-r=this.authority.match(new RegExp(_19b));
-this.user=r[3]||null;
-this.password=r[4]||null;
-this.host=r[5];
-this.port=r[7]||null;
-}
-this.toString=function(){
-return this.uri;
-};
-};
+
+dojo.uri = new function() {
+ this.dojoUri = function (/*dojo.uri.Uri||String*/uri) {
+ // summary: returns a Uri object resolved relative to the dojo root
+ return new dojo.uri.Uri(dojo.hostenv.getBaseScriptUri(), uri);
+ }
+
+ this.moduleUri = function(/*String*/module, /*dojo.uri.Uri||String*/uri){
+ // summary: returns a Uri object relative to a (top-level) module
+ // description: Examples: dojo.uri.moduleUri("dojo","Editor"), or dojo.uri.moduleUri("acme","someWidget")
+ var loc = dojo.hostenv.getModulePrefix(module);
+ if(!loc){return null;}
+ if(loc.lastIndexOf("/") != loc.length-1){loc += "/";}
+ return new dojo.uri.Uri(dojo.hostenv.getBaseScriptUri()+loc,uri);
+ }
+
+ this.Uri = function (/*dojo.uri.Uri||String...*/) {
+ // summary: Constructor to create an object representing a URI.
+ // description:
+ // Each argument is evaluated in order relative to the next until
+ // a canonical uri is produced. To get an absolute Uri relative
+ // to the current document use
+ // new dojo.uri.Uri(document.baseURI, uri)
+
+ // TODO: support for IPv6, see RFC 2732
+
+ // resolve uri components relative to each other
+ var uri = arguments[0];
+ for (var i = 1; i < arguments.length; i++) {
+ if(!arguments[i]) { continue; }
+
+ // Safari doesn't support this.constructor so we have to be explicit
+ var relobj = new dojo.uri.Uri(arguments[i].toString());
+ var uriobj = new dojo.uri.Uri(uri.toString());
+
+ if ((relobj.path=="")&&(relobj.scheme==null)&&(relobj.authority==null)&&(relobj.query==null)) {
+ if (relobj.fragment != null) { uriobj.fragment = relobj.fragment; }
+ relobj = uriobj;
+ } else if (relobj.scheme == null) {
+ relobj.scheme = uriobj.scheme;
+
+ if (relobj.authority == null) {
+ relobj.authority = uriobj.authority;
+
+ if (relobj.path.charAt(0) != "/") {
+ var path = uriobj.path.substring(0,
+ uriobj.path.lastIndexOf("/") + 1) + relobj.path;
+
+ var segs = path.split("/");
+ for (var j = 0; j < segs.length; j++) {
+ if (segs[j] == ".") {
+ if (j == segs.length - 1) { segs[j] = ""; }
+ else { segs.splice(j, 1); j--; }
+ } else if (j > 0 && !(j == 1 && segs[0] == "") &&
+ segs[j] == ".." && segs[j-1] != "..") {
+
+ if (j == segs.length - 1) { segs.splice(j, 1); segs[j - 1] = ""; }
+ else { segs.splice(j - 1, 2); j -= 2; }
+ }
+ }
+ relobj.path = segs.join("/");
+ }
+ }
+ }
+
+ uri = "";
+ if (relobj.scheme != null) { uri += relobj.scheme + ":"; }
+ if (relobj.authority != null) { uri += "//" + relobj.authority; }
+ uri += relobj.path;
+ if (relobj.query != null) { uri += "?" + relobj.query; }
+ if (relobj.fragment != null) { uri += "#" + relobj.fragment; }
+ }
+
+ this.uri = uri.toString();
+
+ // break the uri into its main components
+ var regexp = "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$";
+ var r = this.uri.match(new RegExp(regexp));
+
+ this.scheme = r[2] || (r[1] ? "" : null);
+ this.authority = r[4] || (r[3] ? "" : null);
+ this.path = r[5]; // can never be undefined
+ this.query = r[7] || (r[6] ? "" : null);
+ this.fragment = r[9] || (r[8] ? "" : null);
+
+ if (this.authority != null) {
+ // server based naming authority
+ regexp = "^((([^:]+:)?([^@]+))@)?([^:]*)(:([0-9]+))?$";
+ r = this.authority.match(new RegExp(regexp));
+
+ this.user = r[3] || null;
+ this.password = r[4] || null;
+ this.host = r[5];
+ this.port = r[7] || null;
+ }
+
+ this.toString = function(){ return this.uri; }
+ }
};
+
dojo.provide("dojo.html.style");
-dojo.html.getClass=function(node){
-node=dojo.byId(node);
-if(!node){
-return "";
+
+dojo.html.getClass = function(/* HTMLElement */node){
+ // summary
+ // Returns the string value of the list of CSS classes currently assigned directly
+ // to the node in question. Returns an empty string if no class attribute is found;
+ node = dojo.byId(node);
+ if(!node){ return ""; }
+ var cs = "";
+ if(node.className){
+ cs = node.className;
+ }else if(dojo.html.hasAttribute(node, "class")){
+ cs = dojo.html.getAttribute(node, "class");
+ }
+ return cs.replace(/^\s+|\s+$/g, ""); // string
}
-var cs="";
-if(node.className){
-cs=node.className;
-}else{
-if(dojo.html.hasAttribute(node,"class")){
-cs=dojo.html.getAttribute(node,"class");
-}
-}
-return cs.replace(/^\s+|\s+$/g,"");
-};
-dojo.html.getClasses=function(node){
-var c=dojo.html.getClass(node);
-return (c=="")?[]:c.split(/\s+/g);
-};
-dojo.html.hasClass=function(node,_1a2){
-return (new RegExp("(^|\\s+)"+_1a2+"(\\s+|$)")).test(dojo.html.getClass(node));
-};
-dojo.html.prependClass=function(node,_1a4){
-_1a4+=" "+dojo.html.getClass(node);
-return dojo.html.setClass(node,_1a4);
-};
-dojo.html.addClass=function(node,_1a6){
-if(dojo.html.hasClass(node,_1a6)){
-return false;
-}
-_1a6=(dojo.html.getClass(node)+" "+_1a6).replace(/^\s+|\s+$/g,"");
-return dojo.html.setClass(node,_1a6);
-};
-dojo.html.setClass=function(node,_1a8){
-node=dojo.byId(node);
-var cs=new String(_1a8);
-try{
-if(typeof node.className=="string"){
-node.className=cs;
-}else{
-if(node.setAttribute){
-node.setAttribute("class",_1a8);
-node.className=cs;
-}else{
-return false;
-}
-}
-}
-catch(e){
-dojo.debug("dojo.html.setClass() failed",e);
-}
-return true;
-};
-dojo.html.removeClass=function(node,_1ab,_1ac){
-try{
-if(!_1ac){
-var _1ad=dojo.html.getClass(node).replace(new RegExp("(^|\\s+)"+_1ab+"(\\s+|$)"),"$1$2");
-}else{
-var _1ad=dojo.html.getClass(node).replace(_1ab,"");
-}
-dojo.html.setClass(node,_1ad);
-}
-catch(e){
-dojo.debug("dojo.html.removeClass() failed",e);
-}
-return true;
-};
-dojo.html.replaceClass=function(node,_1af,_1b0){
-dojo.html.removeClass(node,_1b0);
-dojo.html.addClass(node,_1af);
-};
-dojo.html.classMatchType={ContainsAll:0,ContainsAny:1,IsOnly:2};
-dojo.html.getElementsByClass=function(_1b1,_1b2,_1b3,_1b4,_1b5){
-_1b5=false;
-var _1b6=dojo.doc();
-_1b2=dojo.byId(_1b2)||_1b6;
-var _1b7=_1b1.split(/\s+/g);
-var _1b8=[];
-if(_1b4!=1&&_1b4!=2){
-_1b4=0;
-}
-var _1b9=new RegExp("(\\s|^)(("+_1b7.join(")|(")+"))(\\s|$)");
-var _1ba=_1b7.join(" ").length;
-var _1bb=[];
-if(!_1b5&&_1b6.evaluate){
-var _1bc=".//"+(_1b3||"*")+"[contains(";
-if(_1b4!=dojo.html.classMatchType.ContainsAny){
-_1bc+="concat(' ',@class,' '), ' "+_1b7.join(" ') and contains(concat(' ',@class,' '), ' ")+" ')";
-if(_1b4==2){
-_1bc+=" and string-length(@class)="+_1ba+"]";
-}else{
-_1bc+="]";
-}
-}else{
-_1bc+="concat(' ',@class,' '), ' "+_1b7.join(" ') or contains(concat(' ',@class,' '), ' ")+" ')]";
-}
-var _1bd=_1b6.evaluate(_1bc,_1b2,null,XPathResult.ANY_TYPE,null);
-var _1be=_1bd.iterateNext();
-while(_1be){
-try{
-_1bb.push(_1be);
-_1be=_1bd.iterateNext();
-}
-catch(e){
-break;
-}
-}
-return _1bb;
-}else{
-if(!_1b3){
-_1b3="*";
-}
-_1bb=_1b2.getElementsByTagName(_1b3);
-var node,i=0;
-outer:
-while(node=_1bb[i++]){
-var _1c1=dojo.html.getClasses(node);
-if(_1c1.length==0){
-continue outer;
-}
-var _1c2=0;
-for(var j=0;j<_1c1.length;j++){
-if(_1b9.test(_1c1[j])){
-if(_1b4==dojo.html.classMatchType.ContainsAny){
-_1b8.push(node);
-continue outer;
-}else{
-_1c2++;
-}
-}else{
-if(_1b4==dojo.html.classMatchType.IsOnly){
-continue outer;
-}
-}
-}
-if(_1c2==_1b7.length){
-if((_1b4==dojo.html.classMatchType.IsOnly)&&(_1c2==_1c1.length)){
-_1b8.push(node);
-}else{
-if(_1b4==dojo.html.classMatchType.ContainsAll){
-_1b8.push(node);
-}
-}
-}
-}
-return _1b8;
-}
-};
-dojo.html.getElementsByClassName=dojo.html.getElementsByClass;
-dojo.html.toCamelCase=function(_1c4){
-var arr=_1c4.split("-"),cc=arr[0];
-for(var i=1;i *downloaded cssText*
+ if(!URI){ return; }
+ if(!doc){ doc = document; }
+ var cssStr = dojo.hostenv.getText(URI, false, fail_ok);
+ if(cssStr===null){ return; }
+ cssStr = dojo.html.fixPathsInCssText(cssStr, URI);
+
+ if(checkDuplicates){
+ var idx = -1, node, ent = dojo.html._insertedCssFiles;
+ for(var i = 0; i < ent.length; i++){
+ if((ent[i].doc == doc) && (ent[i].cssText == cssStr)){
+ idx = i; node = ent[i].nodeRef;
+ break;
+ }
+ }
+ // make sure we havent deleted our node
+ if(node){
+ var styles = doc.getElementsByTagName("style");
+ for(var i = 0; i < styles.length; i++){
+ if(styles[i] == node){
+ return;
+ }
+ }
+ // delete this entry
+ dojo.html._insertedCssFiles.shift(idx, 1);
+ }
+ }
+
+ var style = dojo.html.insertCssText(cssStr);
+ dojo.html._insertedCssFiles.push({'doc': doc, 'cssText': cssStr, 'nodeRef': style});
+
+ // insert custom attribute ex dbgHref="../foo.css" usefull when debugging in DOM inspectors, no?
+ if(style && djConfig.isDebug){
+ style.setAttribute("dbgHref", URI);
+ }
+ return style; // HTMLStyleElement
+}
+
+dojo.html.insertCssText = function(/* string */cssStr, /* HTMLDocument? */doc, /* string? */URI){
+ // summary
+ // Attempt to insert CSS rules into the document through inserting a style element
+ // DomNode Style = insertCssText(String ".dojoMenu {color: green;}"[, DomDoc document, dojo.uri.Uri Url ])
+ if(!cssStr){
+ return; // HTMLStyleElement
+ }
+ if(!doc){ doc = document; }
+ if(URI){// fix paths in cssStr
+ cssStr = dojo.html.fixPathsInCssText(cssStr, URI);
+ }
+ var style = doc.createElement("style");
+ style.setAttribute("type", "text/css");
+ // IE is b0rken enough to require that we add the element to the doc
+ // before changing it's properties
+ var head = doc.getElementsByTagName("head")[0];
+ if(!head){ // must have a head tag
+ dojo.debug("No head tag in document, aborting styles");
+ return; // HTMLStyleElement
+ }else{
+ head.appendChild(style);
+ }
+ if(style.styleSheet){// IE
+ style.styleSheet.cssText = cssStr;
+ }else{ // w3c
+ var cssText = doc.createTextNode(cssStr);
+ style.appendChild(cssText);
+ }
+ return style; // HTMLStyleElement
+}
+
+dojo.html.fixPathsInCssText = function(/* string */cssStr, /* string */URI){
+ // summary
+ // usage: cssText comes from dojoroot/src/widget/templates/Foobar.css
+ // it has .dojoFoo { background-image: url(images/bar.png);} then uri should point to dojoroot/src/widget/templates/
+ function iefixPathsInCssText() {
+ var regexIe = /AlphaImageLoader\(src\=['"]([\t\s\w()\/.\\'"-:#=&?~]*)['"]/;
+ while(match = regexIe.exec(cssStr)){
+ url = match[1].replace(regexTrim, "$2");
+ if(!regexProtocol.exec(url)){
+ url = (new dojo.uri.Uri(URI, url).toString());
+ }
+ str += cssStr.substring(0, match.index) + "AlphaImageLoader(src='" + url + "'";
+ cssStr = cssStr.substr(match.index + match[0].length);
+ }
+ return str + cssStr;
+ }
+
+ if(!cssStr || !URI){ return; }
+ var match, str = "", url = "";
+ var regex = /url\(\s*([\t\s\w()\/.\\'"-:#=&?]+)\s*\)/;
+ var regexProtocol = /(file|https?|ftps?):\/\//;
+ var regexTrim = /^[\s]*(['"]?)([\w()\/.\\'"-:#=&?]*)\1[\s]*?$/;
+ if (dojo.render.html.ie55 || dojo.render.html.ie60) {
+ cssStr = iefixPathsInCssText();
+ }
+ while(match = regex.exec(cssStr)){
+ url = match[1].replace(regexTrim, "$2");
+ if(!regexProtocol.exec(url)){
+ url = (new dojo.uri.Uri(URI, url).toString());
+ }
+ str += cssStr.substring(0, match.index) + "url(" + url + ")";
+ cssStr = cssStr.substr(match.index + match[0].length);
+ }
+ return str + cssStr; // string
+}
+
+dojo.html.setActiveStyleSheet = function(/* string */title){
+ // summary
+ // Activate style sheet with specified title.
+ var i = 0, a, els = dojo.doc().getElementsByTagName("link");
+ while (a = els[i++]) {
+ if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")){
+ a.disabled = true;
+ if (a.getAttribute("title") == title) { a.disabled = false; }
+ }
+ }
+}
+
+dojo.html.getActiveStyleSheet = function(){
+ // summary
+ // return the title of the currently active stylesheet
+ var i = 0, a, els = dojo.doc().getElementsByTagName("link");
+ while (a = els[i++]) {
+ if (a.getAttribute("rel").indexOf("style") != -1
+ && a.getAttribute("title")
+ && !a.disabled
+ ){
+ return a.getAttribute("title"); // string
+ }
+ }
+ return null; // string
+}
+
+dojo.html.getPreferredStyleSheet = function(){
+ // summary
+ // Return the preferred stylesheet title (i.e. link without alt attribute)
+ var i = 0, a, els = dojo.doc().getElementsByTagName("link");
+ while (a = els[i++]) {
+ if(a.getAttribute("rel").indexOf("style") != -1
+ && a.getAttribute("rel").indexOf("alt") == -1
+ && a.getAttribute("title")
+ ){
+ return a.getAttribute("title"); // string
+ }
+ }
+ return null; // string
+}
+
+dojo.html.applyBrowserClass = function(/* HTMLElement */node){
+ // summary
+ // Applies pre-set class names based on browser & version to the passed node.
+ // Modified version of Morris' CSS hack.
+ var drh=dojo.render.html;
+ var classes = {
+ dj_ie: drh.ie,
+ dj_ie55: drh.ie55,
+ dj_ie6: drh.ie60,
+ dj_ie7: drh.ie70,
+ dj_iequirks: drh.ie && drh.quirks,
+ dj_opera: drh.opera,
+ dj_opera8: drh.opera && (Math.floor(dojo.render.version)==8),
+ dj_opera9: drh.opera && (Math.floor(dojo.render.version)==9),
+ dj_khtml: drh.khtml,
+ dj_safari: drh.safari,
+ dj_gecko: drh.mozilla
+ }; // no dojo unsupported browsers
+ for(var p in classes){
+ if(classes[p]){
+ dojo.html.addClass(node, p);
+ }
+ }
};
+
dojo.provide("dojo.html.*");
+
dojo.provide("dojo.html.display");
-dojo.html._toggle=function(node,_215,_216){
-node=dojo.byId(node);
-_216(node,!_215(node));
-return _215(node);
-};
-dojo.html.show=function(node){
-node=dojo.byId(node);
-if(dojo.html.getStyleProperty(node,"display")=="none"){
-dojo.html.setStyle(node,"display",(node.dojoDisplayCache||""));
-node.dojoDisplayCache=undefined;
+
+dojo.html._toggle = function(node, tester, setter){
+ node = dojo.byId(node);
+ setter(node, !tester(node));
+ return tester(node);
}
-};
-dojo.html.hide=function(node){
-node=dojo.byId(node);
-if(typeof node["dojoDisplayCache"]=="undefined"){
-var d=dojo.html.getStyleProperty(node,"display");
-if(d!="none"){
-node.dojoDisplayCache=d;
+
+dojo.html.show = function(/* HTMLElement */node){
+ // summary
+ // Show the passed element by reverting display property set by dojo.html.hide
+ node = dojo.byId(node);
+ if(dojo.html.getStyleProperty(node, 'display')=='none'){
+ dojo.html.setStyle(node, 'display', (node.dojoDisplayCache||''));
+ node.dojoDisplayCache = undefined; // cannot use delete on a node in IE6
+ }
}
+
+dojo.html.hide = function(/* HTMLElement */node){
+ // summary
+ // Hide the passed element by setting display:none
+ node = dojo.byId(node);
+ if(typeof node["dojoDisplayCache"] == "undefined"){ // it could == '', so we cannot say !node.dojoDisplayCount
+ var d = dojo.html.getStyleProperty(node, 'display')
+ if(d!='none'){
+ node.dojoDisplayCache = d;
+ }
+ }
+ dojo.html.setStyle(node, 'display', 'none');
}
-dojo.html.setStyle(node,"display","none");
-};
-dojo.html.setShowing=function(node,_21b){
-dojo.html[(_21b?"show":"hide")](node);
-};
-dojo.html.isShowing=function(node){
-return (dojo.html.getStyleProperty(node,"display")!="none");
-};
-dojo.html.toggleShowing=function(node){
-return dojo.html._toggle(node,dojo.html.isShowing,dojo.html.setShowing);
-};
-dojo.html.displayMap={tr:"",td:"",th:"",img:"inline",span:"inline",input:"inline",button:"inline"};
-dojo.html.suggestDisplayByTagName=function(node){
-node=dojo.byId(node);
-if(node&&node.tagName){
-var tag=node.tagName.toLowerCase();
-return (tag in dojo.html.displayMap?dojo.html.displayMap[tag]:"block");
+
+dojo.html.setShowing = function(/* HTMLElement */node, /* boolean? */showing){
+ // summary
+ // Calls show() if showing is true, hide() otherwise
+ dojo.html[(showing ? 'show' : 'hide')](node);
}
-};
-dojo.html.setDisplay=function(node,_221){
-dojo.html.setStyle(node,"display",((_221 instanceof String||typeof _221=="string")?_221:(_221?dojo.html.suggestDisplayByTagName(node):"none")));
-};
-dojo.html.isDisplayed=function(node){
-return (dojo.html.getComputedStyle(node,"display")!="none");
-};
-dojo.html.toggleDisplay=function(node){
-return dojo.html._toggle(node,dojo.html.isDisplayed,dojo.html.setDisplay);
-};
-dojo.html.setVisibility=function(node,_225){
-dojo.html.setStyle(node,"visibility",((_225 instanceof String||typeof _225=="string")?_225:(_225?"visible":"hidden")));
-};
-dojo.html.isVisible=function(node){
-return (dojo.html.getComputedStyle(node,"visibility")!="hidden");
-};
-dojo.html.toggleVisibility=function(node){
-return dojo.html._toggle(node,dojo.html.isVisible,dojo.html.setVisibility);
-};
-dojo.html.setOpacity=function(node,_229,_22a){
-node=dojo.byId(node);
-var h=dojo.render.html;
-if(!_22a){
-if(_229>=1){
-if(h.ie){
-dojo.html.clearOpacity(node);
-return;
-}else{
-_229=0.999999;
+
+dojo.html.isShowing = function(/* HTMLElement */node){
+ // summary
+ // Returns whether the element is displayed or not.
+ // FIXME: returns true if node is bad, isHidden would be easier to make correct
+ return (dojo.html.getStyleProperty(node, 'display') != 'none'); // boolean
}
-}else{
-if(_229<0){
-_229=0;
+
+dojo.html.toggleShowing = function(/* HTMLElement */node){
+ // summary
+ // Call setShowing() on node with the complement of isShowing(), then return the new value of isShowing()
+ return dojo.html._toggle(node, dojo.html.isShowing, dojo.html.setShowing); // boolean
}
+
+// Simple mapping of tag names to display values
+// FIXME: simplistic
+dojo.html.displayMap = { tr: '', td: '', th: '', img: 'inline', span: 'inline', input: 'inline', button: 'inline' };
+
+dojo.html.suggestDisplayByTagName = function(/* HTMLElement */node){
+ // summary
+ // Suggest a value for the display property that will show 'node' based on it's tag
+ node = dojo.byId(node);
+ if(node && node.tagName){
+ var tag = node.tagName.toLowerCase();
+ return (tag in dojo.html.displayMap ? dojo.html.displayMap[tag] : 'block'); // string
+ }
}
+
+dojo.html.setDisplay = function(/* HTMLElement */node, /* string */display){
+ // summary
+ // Sets the value of style.display to value of 'display' parameter if it is a string.
+ // Otherwise, if 'display' is false, set style.display to 'none'.
+ // Finally, set 'display' to a suggested display value based on the node's tag
+ dojo.html.setStyle(node, 'display', ((display instanceof String || typeof display == "string") ? display : (display ? dojo.html.suggestDisplayByTagName(node) : 'none')));
}
-if(h.ie){
-if(node.nodeName.toLowerCase()=="tr"){
-var tds=node.getElementsByTagName("td");
-for(var x=0;x= 1.0){
+ if(h.ie){
+ dojo.html.clearOpacity(node);
+ return;
+ }else{
+ opacity = 0.999999;
+ }
+ }else if( opacity < 0.0){ opacity = 0; }
+ }
+ if(h.ie){
+ if(node.nodeName.toLowerCase() == "tr"){
+ // FIXME: is this too naive? will we get more than we want?
+ var tds = node.getElementsByTagName("td");
+ for(var x=0; x= 0.999999 ? 1.0 : Number(opac); // float
}
-}else{
-if(h.moz){
-ns.opacity=1;
-ns.MozOpacity=1;
-}else{
-if(h.safari){
-ns.opacity=1;
-ns.KhtmlOpacity=1;
-}else{
-ns.opacity=1;
-}
-}
-}
-};
-dojo.html.getOpacity=function(node){
-node=dojo.byId(node);
-var h=dojo.render.html;
-if(h.ie){
-var opac=(node.filters&&node.filters.alpha&&typeof node.filters.alpha.opacity=="number"?node.filters.alpha.opacity:100)/100;
-}else{
-var opac=node.style.opacity||node.style.MozOpacity||node.style.KhtmlOpacity||1;
-}
-return opac>=0.999999?1:Number(opac);
-};
+
dojo.provide("dojo.html.layout");
-dojo.html.sumAncestorProperties=function(node,prop){
-node=dojo.byId(node);
-if(!node){
-return 0;
+
+
+dojo.html.sumAncestorProperties = function(/* HTMLElement */node, /* string */prop){
+ // summary
+ // Returns the sum of the passed property on all ancestors of node.
+ node = dojo.byId(node);
+ if(!node){ return 0; } // FIXME: throw an error?
+
+ var retVal = 0;
+ while(node){
+ if(dojo.html.getComputedStyle(node, 'position') == 'fixed'){
+ return 0;
+ }
+ var val = node[prop];
+ if(val){
+ retVal += val - 0;
+ if(node==dojo.body()){ break; }// opera and khtml #body & #html has the same values, we only need one value
+ }
+ node = node.parentNode;
+ }
+ return retVal; // integer
}
-var _236=0;
-while(node){
-if(dojo.html.getComputedStyle(node,"position")=="fixed"){
-return 0;
+
+dojo.html.setStyleAttributes = function(/* HTMLElement */node, /* string */attributes) {
+ // summary
+ // allows a dev to pass a string similar to what you'd pass in style="", and apply it to a node.
+ node = dojo.byId(node);
+ var splittedAttribs=attributes.replace(/(;)?\s*$/, "").split(";");
+ for(var i=0; i0){
+ ret.x += isNaN(n) ? 0 : n;
+ }
+ var m = curnode["offsetTop"];
+ ret.y += isNaN(m) ? 0 : m;
+ curnode = curnode.offsetParent;
+ }while((curnode != endNode)&&(curnode != null));
+ }else if(node["x"]&&node["y"]){
+ ret.x += isNaN(node.x) ? 0 : node.x;
+ ret.y += isNaN(node.y) ? 0 : node.y;
+ }
+ }
+
+ // account for document scrolling!
+ if(includeScroll){
+ var scroll = dojo.html.getScroll();
+ ret.y += scroll.top;
+ ret.x += scroll.left;
+ }
+
+ var extentFuncArray=[dojo.html.getPaddingExtent, dojo.html.getBorderExtent, dojo.html.getMarginExtent];
+ if(nativeBoxType > targetBoxType){
+ for(var i=targetBoxType;inativeBoxType;--i){
+ ret.y -= extentFuncArray[i-1](node, 'top');
+ ret.x -= extentFuncArray[i-1](node, 'left');
+ }
+ }
+ ret.top = ret.y;
+ ret.left = ret.x;
+ return ret; // object
}
+
+dojo.html.isPositionAbsolute = function(/* HTMLElement */node){
+ // summary
+ // Returns true if the element is absolutely positioned.
+ return (dojo.html.getComputedStyle(node, 'position') == 'absolute'); // boolean
}
-node=node.parentNode;
+
+dojo.html._sumPixelValues = function(/* HTMLElement */node, selectors, autoIsZero){
+ var total = 0;
+ for(var x=0; x0){
-ret.x+=isNaN(n)?0:n;
+
+dojo.html.getPaddingBox = function(/* HTMLElement */node){
+ // summary
+ // Returns the dimensions of the padding box (see http://www.w3.org/TR/CSS21/box.html)
+ var box = dojo.html.getBorderBox(node);
+ var border = dojo.html.getBorder(node);
+ return {
+ width: box.width - border.width,
+ height:box.height - border.height
+ }; // object
}
-var m=_24b["offsetTop"];
-ret.y+=isNaN(m)?0:m;
-_24b=_24b.offsetParent;
-}while((_24b!=_249)&&(_24b!=null));
-}else{
-if(node["x"]&&node["y"]){
-ret.x+=isNaN(node.x)?0:node.x;
-ret.y+=isNaN(node.y)?0:node.y;
+
+dojo.html.getContentBox = function(/* HTMLElement */node){
+ // summary
+ // Returns the dimensions of the content box (see http://www.w3.org/TR/CSS21/box.html)
+ node = dojo.byId(node);
+ var padborder = dojo.html.getPadBorder(node);
+ return {
+ width: node.offsetWidth - padborder.width,
+ height: node.offsetHeight - padborder.height
+ }; // object
}
+
+dojo.html.setContentBox = function(/* HTMLElement */node, /* object */args){
+ // summary
+ // Sets the dimensions of the passed node according to content sizing.
+ node = dojo.byId(node);
+ var width = 0; var height = 0;
+ var isbb = dojo.html.isBorderBox(node);
+ var padborder = (isbb ? dojo.html.getPadBorder(node) : { width: 0, height: 0});
+ var ret = {};
+ if(typeof args.width != "undefined"){
+ width = args.width + padborder.width;
+ ret.width = dojo.html.setPositivePixelValue(node, "width", width);
+ }
+ if(typeof args.height != "undefined"){
+ height = args.height + padborder.height;
+ ret.height = dojo.html.setPositivePixelValue(node, "height", height);
+ }
+ return ret; // object
}
+
+dojo.html.getMarginBox = function(/* HTMLElement */node){
+ // summary
+ // returns the dimensions of the passed node including any margins.
+ var borderbox = dojo.html.getBorderBox(node);
+ var margin = dojo.html.getMargin(node);
+ return { width: borderbox.width + margin.width, height: borderbox.height + margin.height }; // object
}
+
+dojo.html.setMarginBox = function(/* HTMLElement */node, /* object */args){
+ // summary
+ // Sets the dimensions of the passed node using margin box calcs.
+ node = dojo.byId(node);
+ var width = 0; var height = 0;
+ var isbb = dojo.html.isBorderBox(node);
+ var padborder = (!isbb ? dojo.html.getPadBorder(node) : { width: 0, height: 0 });
+ var margin = dojo.html.getMargin(node);
+ var ret = {};
+ if(typeof args.width != "undefined"){
+ width = args.width - padborder.width;
+ width -= margin.width;
+ ret.width = dojo.html.setPositivePixelValue(node, "width", width);
+ }
+ if(typeof args.height != "undefined"){
+ height = args.height - padborder.height;
+ height -= margin.height;
+ ret.height = dojo.html.setPositivePixelValue(node, "height", height);
+ }
+ return ret; // object
}
-if(_240){
-var _24e=dojo.html.getScroll();
-ret.y+=_24e.top;
-ret.x+=_24e.left;
+
+dojo.html.getElementBox = function(/* HTMLElement */node, /* string */type){
+ // summary
+ // return dimesions of a node based on the passed box model type.
+ var bs = dojo.html.boxSizing;
+ switch(type){
+ case bs.MARGIN_BOX:
+ return dojo.html.getMarginBox(node); // object
+ case bs.BORDER_BOX:
+ return dojo.html.getBorderBox(node); // object
+ case bs.PADDING_BOX:
+ return dojo.html.getPaddingBox(node); // object
+ case bs.CONTENT_BOX:
+ default:
+ return dojo.html.getContentBox(node); // object
+ }
}
-var _24f=[dojo.html.getPaddingExtent,dojo.html.getBorderExtent,dojo.html.getMarginExtent];
-if(_244>_245){
-for(var i=_245;i<_244;++i){
-ret.y+=_24f[i](node,"top");
-ret.x+=_24f[i](node,"left");
+// in: coordinate array [x,y,w,h] or dom node
+// return: coordinate object
+dojo.html.toCoordinateObject = dojo.html.toCoordinateArray = function(/* array */coords, /* boolean? */includeScroll, /* string? */boxtype) {
+ // summary
+ // Converts an array of coordinates into an object of named arguments.
+ if(coords instanceof Array || typeof coords == "array"){
+ dojo.deprecated("dojo.html.toCoordinateArray", "use dojo.html.toCoordinateObject({left: , top: , width: , height: }) instead", "0.5");
+ // coords is already an array (of format [x,y,w,h]), just return it
+ while ( coords.length < 4 ) { coords.push(0); }
+ while ( coords.length > 4 ) { coords.pop(); }
+ var ret = {
+ left: coords[0],
+ top: coords[1],
+ width: coords[2],
+ height: coords[3]
+ };
+ }else if(!coords.nodeType && !(coords instanceof String || typeof coords == "string") &&
+ ('width' in coords || 'height' in coords || 'left' in coords ||
+ 'x' in coords || 'top' in coords || 'y' in coords)){
+ // coords is a coordinate object or at least part of one
+ var ret = {
+ left: coords.left||coords.x||0,
+ top: coords.top||coords.y||0,
+ width: coords.width||0,
+ height: coords.height||0
+ };
+ }else{
+ // coords is an dom object (or dom object id); return it's coordinates
+ var node = dojo.byId(coords);
+ var pos = dojo.html.abs(node, includeScroll, boxtype);
+ var marginbox = dojo.html.getMarginBox(node);
+ var ret = {
+ left: pos.left,
+ top: pos.top,
+ width: marginbox.width,
+ height: marginbox.height
+ };
+ }
+ ret.x = ret.left;
+ ret.y = ret.top;
+ return ret; // object
}
-}else{
-if(_244<_245){
-for(var i=_245;i>_244;--i){
-ret.y-=_24f[i-1](node,"top");
-ret.x-=_24f[i-1](node,"left");
+
+dojo.html.setMarginBoxWidth = dojo.html.setOuterWidth = function(node, width){
+ return dojo.html._callDeprecated("setMarginBoxWidth", "setMarginBox", arguments, "width");
}
+dojo.html.setMarginBoxHeight = dojo.html.setOuterHeight = function(){
+ return dojo.html._callDeprecated("setMarginBoxHeight", "setMarginBox", arguments, "height");
}
+dojo.html.getMarginBoxWidth = dojo.html.getOuterWidth = function(){
+ return dojo.html._callDeprecated("getMarginBoxWidth", "getMarginBox", arguments, null, "width");
}
-ret.top=ret.y;
-ret.left=ret.x;
-return ret;
-};
-dojo.html.isPositionAbsolute=function(node){
-return (dojo.html.getComputedStyle(node,"position")=="absolute");
-};
-dojo.html._sumPixelValues=function(node,_253,_254){
-var _255=0;
-for(var x=0;x<_253.length;x++){
-_255+=dojo.html.getPixelValue(node,_253[x],_254);
+dojo.html.getMarginBoxHeight = dojo.html.getOuterHeight = function(){
+ return dojo.html._callDeprecated("getMarginBoxHeight", "getMarginBox", arguments, null, "height");
}
-return _255;
-};
-dojo.html.getMargin=function(node){
-return {width:dojo.html._sumPixelValues(node,["margin-left","margin-right"],(dojo.html.getComputedStyle(node,"position")=="absolute")),height:dojo.html._sumPixelValues(node,["margin-top","margin-bottom"],(dojo.html.getComputedStyle(node,"position")=="absolute"))};
-};
-dojo.html.getBorder=function(node){
-return {width:dojo.html.getBorderExtent(node,"left")+dojo.html.getBorderExtent(node,"right"),height:dojo.html.getBorderExtent(node,"top")+dojo.html.getBorderExtent(node,"bottom")};
-};
-dojo.html.getBorderExtent=function(node,side){
-return (dojo.html.getStyle(node,"border-"+side+"-style")=="none"?0:dojo.html.getPixelValue(node,"border-"+side+"-width"));
-};
-dojo.html.getMarginExtent=function(node,side){
-return dojo.html._sumPixelValues(node,["margin-"+side],dojo.html.isPositionAbsolute(node));
-};
-dojo.html.getPaddingExtent=function(node,side){
-return dojo.html._sumPixelValues(node,["padding-"+side],true);
-};
-dojo.html.getPadding=function(node){
-return {width:dojo.html._sumPixelValues(node,["padding-left","padding-right"],true),height:dojo.html._sumPixelValues(node,["padding-top","padding-bottom"],true)};
-};
-dojo.html.getPadBorder=function(node){
-var pad=dojo.html.getPadding(node);
-var _262=dojo.html.getBorder(node);
-return {width:pad.width+_262.width,height:pad.height+_262.height};
-};
-dojo.html.getBoxSizing=function(node){
-var h=dojo.render.html;
-var bs=dojo.html.boxSizing;
-if((h.ie)||(h.opera)){
-var cm=document["compatMode"];
-if((cm=="BackCompat")||(cm=="QuirksMode")){
-return bs.BORDER_BOX;
-}else{
-return bs.CONTENT_BOX;
+dojo.html.getTotalOffset = function(node, type, includeScroll){
+ return dojo.html._callDeprecated("getTotalOffset", "getAbsolutePosition", arguments, null, type);
}
-}else{
-if(arguments.length==0){
-node=document.documentElement;
+dojo.html.getAbsoluteX = function(node, includeScroll){
+ return dojo.html._callDeprecated("getAbsoluteX", "getAbsolutePosition", arguments, null, "x");
}
-var _267=dojo.html.getStyle(node,"-moz-box-sizing");
-if(!_267){
-_267=dojo.html.getStyle(node,"box-sizing");
+dojo.html.getAbsoluteY = function(node, includeScroll){
+ return dojo.html._callDeprecated("getAbsoluteY", "getAbsolutePosition", arguments, null, "y");
}
-return (_267?_267:bs.CONTENT_BOX);
+dojo.html.totalOffsetLeft = function(node, includeScroll){
+ return dojo.html._callDeprecated("totalOffsetLeft", "getAbsolutePosition", arguments, null, "left");
}
-};
-dojo.html.isBorderBox=function(node){
-return (dojo.html.getBoxSizing(node)==dojo.html.boxSizing.BORDER_BOX);
-};
-dojo.html.getBorderBox=function(node){
-node=dojo.byId(node);
-return {width:node.offsetWidth,height:node.offsetHeight};
-};
-dojo.html.getPaddingBox=function(node){
-var box=dojo.html.getBorderBox(node);
-var _26c=dojo.html.getBorder(node);
-return {width:box.width-_26c.width,height:box.height-_26c.height};
-};
-dojo.html.getContentBox=function(node){
-node=dojo.byId(node);
-var _26e=dojo.html.getPadBorder(node);
-return {width:node.offsetWidth-_26e.width,height:node.offsetHeight-_26e.height};
-};
-dojo.html.setContentBox=function(node,args){
-node=dojo.byId(node);
-var _271=0;
-var _272=0;
-var isbb=dojo.html.isBorderBox(node);
-var _274=(isbb?dojo.html.getPadBorder(node):{width:0,height:0});
-var ret={};
-if(typeof args.width!="undefined"){
-_271=args.width+_274.width;
-ret.width=dojo.html.setPositivePixelValue(node,"width",_271);
+dojo.html.totalOffsetTop = function(node, includeScroll){
+ return dojo.html._callDeprecated("totalOffsetTop", "getAbsolutePosition", arguments, null, "top");
}
-if(typeof args.height!="undefined"){
-_272=args.height+_274.height;
-ret.height=dojo.html.setPositivePixelValue(node,"height",_272);
+dojo.html.getMarginWidth = function(node){
+ return dojo.html._callDeprecated("getMarginWidth", "getMargin", arguments, null, "width");
}
-return ret;
-};
-dojo.html.getMarginBox=function(node){
-var _277=dojo.html.getBorderBox(node);
-var _278=dojo.html.getMargin(node);
-return {width:_277.width+_278.width,height:_277.height+_278.height};
-};
-dojo.html.setMarginBox=function(node,args){
-node=dojo.byId(node);
-var _27b=0;
-var _27c=0;
-var isbb=dojo.html.isBorderBox(node);
-var _27e=(!isbb?dojo.html.getPadBorder(node):{width:0,height:0});
-var _27f=dojo.html.getMargin(node);
-var ret={};
-if(typeof args.width!="undefined"){
-_27b=args.width-_27e.width;
-_27b-=_27f.width;
-ret.width=dojo.html.setPositivePixelValue(node,"width",_27b);
+dojo.html.getMarginHeight = function(node){
+ return dojo.html._callDeprecated("getMarginHeight", "getMargin", arguments, null, "height");
}
-if(typeof args.height!="undefined"){
-_27c=args.height-_27e.height;
-_27c-=_27f.height;
-ret.height=dojo.html.setPositivePixelValue(node,"height",_27c);
+dojo.html.getBorderWidth = function(node){
+ return dojo.html._callDeprecated("getBorderWidth", "getBorder", arguments, null, "width");
}
-return ret;
-};
-dojo.html.getElementBox=function(node,type){
-var bs=dojo.html.boxSizing;
-switch(type){
-case bs.MARGIN_BOX:
-return dojo.html.getMarginBox(node);
-case bs.BORDER_BOX:
-return dojo.html.getBorderBox(node);
-case bs.PADDING_BOX:
-return dojo.html.getPaddingBox(node);
-case bs.CONTENT_BOX:
-default:
-return dojo.html.getContentBox(node);
+dojo.html.getBorderHeight = function(node){
+ return dojo.html._callDeprecated("getBorderHeight", "getBorder", arguments, null, "height");
}
-};
-dojo.html.toCoordinateObject=dojo.html.toCoordinateArray=function(_284,_285,_286){
-if(_284 instanceof Array||typeof _284=="array"){
-dojo.deprecated("dojo.html.toCoordinateArray","use dojo.html.toCoordinateObject({left: , top: , width: , height: }) instead","0.5");
-while(_284.length<4){
-_284.push(0);
+dojo.html.getPaddingWidth = function(node){
+ return dojo.html._callDeprecated("getPaddingWidth", "getPadding", arguments, null, "width");
}
-while(_284.length>4){
-_284.pop();
+dojo.html.getPaddingHeight = function(node){
+ return dojo.html._callDeprecated("getPaddingHeight", "getPadding", arguments, null, "height");
}
-var ret={left:_284[0],top:_284[1],width:_284[2],height:_284[3]};
-}else{
-if(!_284.nodeType&&!(_284 instanceof String||typeof _284=="string")&&("width" in _284||"height" in _284||"left" in _284||"x" in _284||"top" in _284||"y" in _284)){
-var ret={left:_284.left||_284.x||0,top:_284.top||_284.y||0,width:_284.width||0,height:_284.height||0};
-}else{
-var node=dojo.byId(_284);
-var pos=dojo.html.abs(node,_285,_286);
-var _28a=dojo.html.getMarginBox(node);
-var ret={left:pos.left,top:pos.top,width:_28a.width,height:_28a.height};
+dojo.html.getPadBorderWidth = function(node){
+ return dojo.html._callDeprecated("getPadBorderWidth", "getPadBorder", arguments, null, "width");
}
+dojo.html.getPadBorderHeight = function(node){
+ return dojo.html._callDeprecated("getPadBorderHeight", "getPadBorder", arguments, null, "height");
}
-ret.x=ret.left;
-ret.y=ret.top;
-return ret;
-};
-dojo.html.setMarginBoxWidth=dojo.html.setOuterWidth=function(node,_28c){
-return dojo.html._callDeprecated("setMarginBoxWidth","setMarginBox",arguments,"width");
-};
-dojo.html.setMarginBoxHeight=dojo.html.setOuterHeight=function(){
-return dojo.html._callDeprecated("setMarginBoxHeight","setMarginBox",arguments,"height");
-};
-dojo.html.getMarginBoxWidth=dojo.html.getOuterWidth=function(){
-return dojo.html._callDeprecated("getMarginBoxWidth","getMarginBox",arguments,null,"width");
-};
-dojo.html.getMarginBoxHeight=dojo.html.getOuterHeight=function(){
-return dojo.html._callDeprecated("getMarginBoxHeight","getMarginBox",arguments,null,"height");
-};
-dojo.html.getTotalOffset=function(node,type,_28f){
-return dojo.html._callDeprecated("getTotalOffset","getAbsolutePosition",arguments,null,type);
-};
-dojo.html.getAbsoluteX=function(node,_291){
-return dojo.html._callDeprecated("getAbsoluteX","getAbsolutePosition",arguments,null,"x");
-};
-dojo.html.getAbsoluteY=function(node,_293){
-return dojo.html._callDeprecated("getAbsoluteY","getAbsolutePosition",arguments,null,"y");
-};
-dojo.html.totalOffsetLeft=function(node,_295){
-return dojo.html._callDeprecated("totalOffsetLeft","getAbsolutePosition",arguments,null,"left");
-};
-dojo.html.totalOffsetTop=function(node,_297){
-return dojo.html._callDeprecated("totalOffsetTop","getAbsolutePosition",arguments,null,"top");
-};
-dojo.html.getMarginWidth=function(node){
-return dojo.html._callDeprecated("getMarginWidth","getMargin",arguments,null,"width");
-};
-dojo.html.getMarginHeight=function(node){
-return dojo.html._callDeprecated("getMarginHeight","getMargin",arguments,null,"height");
-};
-dojo.html.getBorderWidth=function(node){
-return dojo.html._callDeprecated("getBorderWidth","getBorder",arguments,null,"width");
-};
-dojo.html.getBorderHeight=function(node){
-return dojo.html._callDeprecated("getBorderHeight","getBorder",arguments,null,"height");
-};
-dojo.html.getPaddingWidth=function(node){
-return dojo.html._callDeprecated("getPaddingWidth","getPadding",arguments,null,"width");
-};
-dojo.html.getPaddingHeight=function(node){
-return dojo.html._callDeprecated("getPaddingHeight","getPadding",arguments,null,"height");
-};
-dojo.html.getPadBorderWidth=function(node){
-return dojo.html._callDeprecated("getPadBorderWidth","getPadBorder",arguments,null,"width");
-};
-dojo.html.getPadBorderHeight=function(node){
-return dojo.html._callDeprecated("getPadBorderHeight","getPadBorder",arguments,null,"height");
-};
-dojo.html.getBorderBoxWidth=dojo.html.getInnerWidth=function(){
-return dojo.html._callDeprecated("getBorderBoxWidth","getBorderBox",arguments,null,"width");
-};
-dojo.html.getBorderBoxHeight=dojo.html.getInnerHeight=function(){
-return dojo.html._callDeprecated("getBorderBoxHeight","getBorderBox",arguments,null,"height");
-};
-dojo.html.getContentBoxWidth=dojo.html.getContentWidth=function(){
-return dojo.html._callDeprecated("getContentBoxWidth","getContentBox",arguments,null,"width");
-};
-dojo.html.getContentBoxHeight=dojo.html.getContentHeight=function(){
-return dojo.html._callDeprecated("getContentBoxHeight","getContentBox",arguments,null,"height");
-};
-dojo.html.setContentBoxWidth=dojo.html.setContentWidth=function(node,_2a1){
-return dojo.html._callDeprecated("setContentBoxWidth","setContentBox",arguments,"width");
-};
-dojo.html.setContentBoxHeight=dojo.html.setContentHeight=function(node,_2a3){
-return dojo.html._callDeprecated("setContentBoxHeight","setContentBox",arguments,"height");
-};
+dojo.html.getBorderBoxWidth = dojo.html.getInnerWidth = function(){
+ return dojo.html._callDeprecated("getBorderBoxWidth", "getBorderBox", arguments, null, "width");
+}
+dojo.html.getBorderBoxHeight = dojo.html.getInnerHeight = function(){
+ return dojo.html._callDeprecated("getBorderBoxHeight", "getBorderBox", arguments, null, "height");
+}
+dojo.html.getContentBoxWidth = dojo.html.getContentWidth = function(){
+ return dojo.html._callDeprecated("getContentBoxWidth", "getContentBox", arguments, null, "width");
+}
+dojo.html.getContentBoxHeight = dojo.html.getContentHeight = function(){
+ return dojo.html._callDeprecated("getContentBoxHeight", "getContentBox", arguments, null, "height");
+}
+dojo.html.setContentBoxWidth = dojo.html.setContentWidth = function(node, width){
+ return dojo.html._callDeprecated("setContentBoxWidth", "setContentBox", arguments, "width");
+}
+dojo.html.setContentBoxHeight = dojo.html.setContentHeight = function(node, height){
+ return dojo.html._callDeprecated("setContentBoxHeight", "setContentBox", arguments, "height");
+}
+
dojo.provide("dojo.html.util");
-dojo.html.getElementWindow=function(_2a4){
-return dojo.html.getDocumentWindow(_2a4.ownerDocument);
-};
-dojo.html.getDocumentWindow=function(doc){
-if(dojo.render.html.safari&&!doc._parentWindow){
-var fix=function(win){
-win.document._parentWindow=win;
-for(var i=0;i
+ // If you wanted to insert a node into a DOM tree based on the mouse
+ // position you might use the following code:
+ //
+ // if (gravity(node, e) & gravity.NORTH) { [insert before]; }
+ // else { [insert after]; }
+ //
+ //
+ // @param node The node
+ // @param e The event containing the mouse coordinates
+ // @return The directions, NORTH or SOUTH and EAST or WEST. These
+ // are properties of the function.
+ node = dojo.byId(node);
+ var mouse = dojo.html.getCursorPosition(e);
+
+ with (dojo.html) {
+ var absolute = getAbsolutePosition(node, true);
+ var bb = getBorderBox(node);
+ var nodecenterx = absolute.x + (bb.width / 2);
+ var nodecentery = absolute.y + (bb.height / 2);
+ }
+
+ with (dojo.html.gravity) {
+ return ((mouse.x < nodecenterx ? WEST : EAST) | (mouse.y < nodecentery ? NORTH : SOUTH)); // integer
+ }
}
-return doc._parentWindow||doc.parentWindow||doc.defaultView;
-};
-dojo.html.gravity=function(node,e){
-node=dojo.byId(node);
-var _2ac=dojo.html.getCursorPosition(e);
-with(dojo.html){
-var _2ad=getAbsolutePosition(node,true);
-var bb=getBorderBox(node);
-var _2af=_2ad.x+(bb.width/2);
-var _2b0=_2ad.y+(bb.height/2);
+
+dojo.html.gravity.NORTH = 1;
+dojo.html.gravity.SOUTH = 1 << 1;
+dojo.html.gravity.EAST = 1 << 2;
+dojo.html.gravity.WEST = 1 << 3;
+
+dojo.html.overElement = function(/* HTMLElement */element, /* DOMEvent */e){
+ // summary
+ // Returns whether the mouse is over the passed element.
+ element = dojo.byId(element);
+ var mouse = dojo.html.getCursorPosition(e);
+ var bb = dojo.html.getBorderBox(element);
+ var absolute = dojo.html.getAbsolutePosition(element, true, dojo.html.boxSizing.BORDER_BOX);
+ var top = absolute.y;
+ var bottom = top + bb.height;
+ var left = absolute.x;
+ var right = left + bb.width;
+
+ return (mouse.x >= left
+ && mouse.x <= right
+ && mouse.y >= top
+ && mouse.y <= bottom
+ ); // boolean
}
-with(dojo.html.gravity){
-return ((_2ac.x<_2af?WEST:EAST)|(_2ac.y<_2b0?NORTH:SOUTH));
+
+dojo.html.renderedTextContent = function(/* HTMLElement */node){
+ // summary
+ // Attempts to return the text as it would be rendered, with the line breaks
+ // sorted out nicely. Unfinished.
+ node = dojo.byId(node);
+ var result = "";
+ if (node == null) { return result; }
+ for (var i = 0; i < node.childNodes.length; i++) {
+ switch (node.childNodes[i].nodeType) {
+ case 1: // ELEMENT_NODE
+ case 5: // ENTITY_REFERENCE_NODE
+ var display = "unknown";
+ try {
+ display = dojo.html.getStyle(node.childNodes[i], "display");
+ } catch(E) {}
+ switch (display) {
+ case "block": case "list-item": case "run-in":
+ case "table": case "table-row-group": case "table-header-group":
+ case "table-footer-group": case "table-row": case "table-column-group":
+ case "table-column": case "table-cell": case "table-caption":
+ // TODO: this shouldn't insert double spaces on aligning blocks
+ result += "\n";
+ result += dojo.html.renderedTextContent(node.childNodes[i]);
+ result += "\n";
+ break;
+
+ case "none": break;
+
+ default:
+ if(node.childNodes[i].tagName && node.childNodes[i].tagName.toLowerCase() == "br") {
+ result += "\n";
+ } else {
+ result += dojo.html.renderedTextContent(node.childNodes[i]);
+ }
+ break;
+ }
+ break;
+ case 3: // TEXT_NODE
+ case 2: // ATTRIBUTE_NODE
+ case 4: // CDATA_SECTION_NODE
+ var text = node.childNodes[i].nodeValue;
+ var textTransform = "unknown";
+ try {
+ textTransform = dojo.html.getStyle(node, "text-transform");
+ } catch(E) {}
+ switch (textTransform){
+ case "capitalize":
+ var words = text.split(' ');
+ for(var i=0; i=left&&_2b3.x<=_2b9&&_2b3.y>=top&&_2b3.y<=_2b7);
-};
-dojo.html.renderedTextContent=function(node){
-node=dojo.byId(node);
-var _2bb="";
-if(node==null){
-return _2bb;
+
+dojo.html.createNodesFromText = function(/* string */txt, /* boolean? */trim){
+ // summary
+ // Attempts to create a set of nodes based on the structure of the passed text.
+ if(trim) { txt = txt.replace(/^\s+|\s+$/g, ""); }
+
+ var tn = dojo.doc().createElement("div");
+ // tn.style.display = "none";
+ tn.style.visibility= "hidden";
+ dojo.body().appendChild(tn);
+ var tableType = "none";
+ if((/^]/i).test(txt.replace(/^\s+/))) {
+ txt = "";
+ tableType = "cell";
+ } else if((/^]/i).test(txt.replace(/^\s+/))) {
+ txt = "";
+ tableType = "row";
+ } else if((/^<(thead|tbody|tfoot)[\s\r\n>]/i).test(txt.replace(/^\s+/))) {
+ txt = "";
+ tableType = "section";
+ }
+ tn.innerHTML = txt;
+ if(tn["normalize"]){
+ tn.normalize();
+ }
+
+ var parent = null;
+ switch(tableType) {
+ case "cell":
+ parent = tn.getElementsByTagName("tr")[0];
+ break;
+ case "row":
+ parent = tn.getElementsByTagName("tbody")[0];
+ break;
+ case "section":
+ parent = tn.getElementsByTagName("table")[0];
+ break;
+ default:
+ parent = tn;
+ break;
+ }
+
+ /* this doesn't make much sense, I'm assuming it just meant trim() so wrap was replaced with trim
+ if(wrap){
+ var ret = [];
+ // start hack
+ var fc = tn.firstChild;
+ ret[0] = ((fc.nodeValue == " ")||(fc.nodeValue == "\t")) ? fc.nextSibling : fc;
+ // end hack
+ // tn.style.display = "none";
+ dojo.body().removeChild(tn);
+ return ret;
+ }
+ */
+ var nodes = [];
+ for(var x=0; x view.width) {
+ x = view.width - w;
+ match = false;
+ } else {
+ x = tryX;
+ }
+ x = Math.max(padding[0], x) + scroll.x;
+
+ var y = tryY + h;
+ if(y > view.height) {
+ y = view.height - h;
+ match = false;
+ } else {
+ y = tryY;
+ }
+ y = Math.max(padding[1], y) + scroll.y;
+
+ if(match){ //perfect match, return now
+ bestx = x;
+ besty = y;
+ bestDistance = 0;
+ bestCorner = corner;
+ break;
+ }else{
+ //not perfect, find out whether it is better than the saved one
+ var dist = Math.pow(x-tryX-scroll.x,2)+Math.pow(y-tryY-scroll.y,2);
+ if(bestDistance > dist){
+ bestDistance = dist;
+ bestx = x;
+ besty = y;
+ bestCorner = corner;
+ }
+ }
+ }
+
+ if(!tryOnly){
+ node.style.left = bestx + "px";
+ node.style.top = besty + "px";
+ }
+
+ return { left: bestx, top: besty, x: bestx, y: besty, dist: bestDistance, corner: bestCorner}; // object
}
-catch(E){
+
+dojo.html.placeOnScreenPoint = function(node, desiredX, desiredY, padding, hasScroll) {
+ dojo.deprecated("dojo.html.placeOnScreenPoint", "use dojo.html.placeOnScreen() instead", "0.5");
+ return dojo.html.placeOnScreen(node, desiredX, desiredY, padding, hasScroll, ['TL', 'TR', 'BL', 'BR']);
}
-switch(_2bd){
-case "block":
-case "list-item":
-case "run-in":
-case "table":
-case "table-row-group":
-case "table-header-group":
-case "table-footer-group":
-case "table-row":
-case "table-column-group":
-case "table-column":
-case "table-cell":
-case "table-caption":
-_2bb+="\n";
-_2bb+=dojo.html.renderedTextContent(node.childNodes[i]);
-_2bb+="\n";
-break;
-case "none":
-break;
-default:
-if(node.childNodes[i].tagName&&node.childNodes[i].tagName.toLowerCase()=="br"){
-_2bb+="\n";
-}else{
-_2bb+=dojo.html.renderedTextContent(node.childNodes[i]);
+
+dojo.html.placeOnScreenAroundElement = function(
+ /* HTMLElement */node,
+ /* HTMLElement */aroundNode,
+ /* integer */padding,
+ /* string? */aroundType,
+ /* string? */aroundCorners,
+ /* boolean? */tryOnly
+){
+ // summary
+ // Like placeOnScreen, except it accepts aroundNode instead of x,y
+ // and attempts to place node around it. aroundType (see
+ // dojo.html.boxSizing in html/layout.js) determines which box of the
+ // aroundNode should be used to calculate the outer box.
+ // aroundCorners specify Which corner of aroundNode should be
+ // used to place the node => which corner(s) of node to use (see the
+ // corners parameter in dojo.html.placeOnScreen)
+ // aroundCorners: {'TL': 'BL', 'BL': 'TL'}
+
+ var best, bestDistance=Infinity;
+ aroundNode = dojo.byId(aroundNode);
+ var oldDisplay = aroundNode.style.display;
+ aroundNode.style.display="";
+ var mb = dojo.html.getElementBox(aroundNode, aroundType);
+ var aroundNodeW = mb.width;
+ var aroundNodeH = mb.height;
+ var aroundNodePos = dojo.html.getAbsolutePosition(aroundNode, true, aroundType);
+ aroundNode.style.display=oldDisplay;
+
+ for(var nodeCorner in aroundCorners){
+ var pos, desiredX, desiredY;
+ var corners = aroundCorners[nodeCorner];
+
+ desiredX = aroundNodePos.x + (nodeCorner.charAt(1)=='L' ? 0 : aroundNodeW);
+ desiredY = aroundNodePos.y + (nodeCorner.charAt(0)=='T' ? 0 : aroundNodeH);
+
+ pos = dojo.html.placeOnScreen(node, desiredX, desiredY, padding, true, corners, true);
+ if(pos.dist == 0){
+ best = pos;
+ break;
+ }else{
+ //not perfect, find out whether it is better than the saved one
+ if(bestDistance > pos.dist){
+ bestDistance = pos.dist;
+ best = pos;
+ }
+ }
+ }
+
+ if(!tryOnly){
+ node.style.left = best.left + "px";
+ node.style.top = best.top + "px";
+ }
+ return best; // object
}
-break;
+
+dojo.html.scrollIntoView = function(/* HTMLElement */node){
+ // summary
+ // Scroll the passed node into view, if it is not.
+ if(!node){ return; }
+
+ // don't rely on that node.scrollIntoView works just because the function is there
+ // it doesnt work in Konqueror or Opera even though the function is there and probably
+ // not safari either
+ // dont like browser sniffs implementations but sometimes you have to use it
+ if(dojo.render.html.ie){
+ //only call scrollIntoView if there is a scrollbar for this menu,
+ //otherwise, scrollIntoView will scroll the window scrollbar
+ if(dojo.html.getBorderBox(node.parentNode).height < node.parentNode.scrollHeight){
+ node.scrollIntoView(false);
+ }
+ }else if(dojo.render.html.mozilla){
+ // IE, mozilla
+ node.scrollIntoView(false);
+ }else{
+ var parent = node.parentNode;
+ var parentBottom = parent.scrollTop + dojo.html.getBorderBox(parent).height;
+ var nodeBottom = node.offsetTop + dojo.html.getMarginBox(node).height;
+ if(parentBottom < nodeBottom){
+ parent.scrollTop += (nodeBottom - parentBottom);
+ }else if(parent.scrollTop > node.offsetTop){
+ parent.scrollTop -= (parent.scrollTop - node.offsetTop);
+ }
+ }
}
-break;
-case 3:
-case 2:
-case 4:
-var text=node.childNodes[i].nodeValue;
-var _2bf="unknown";
-try{
-_2bf=dojo.html.getStyle(node,"text-transform");
-}
-catch(E){
-}
-switch(_2bf){
-case "capitalize":
-var _2c0=text.split(" ");
-for(var i=0;i<_2c0.length;i++){
-_2c0[i]=_2c0[i].charAt(0).toUpperCase()+_2c0[i].substring(1);
-}
-text=_2c0.join(" ");
-break;
-case "uppercase":
-text=text.toUpperCase();
-break;
-case "lowercase":
-text=text.toLowerCase();
-break;
-default:
-break;
-}
-switch(_2bf){
-case "nowrap":
-break;
-case "pre-wrap":
-break;
-case "pre-line":
-break;
-case "pre":
-break;
-default:
-text=text.replace(/\s+/," ");
-if(/\s$/.test(_2bb)){
-text.replace(/^\s/,"");
-}
-break;
-}
-_2bb+=text;
-break;
-default:
-break;
-}
-}
-return _2bb;
-};
-dojo.html.createNodesFromText=function(txt,trim){
-if(trim){
-txt=txt.replace(/^\s+|\s+$/g,"");
-}
-var tn=dojo.doc().createElement("div");
-tn.style.visibility="hidden";
-dojo.body().appendChild(tn);
-var _2c4="none";
-if((/^]/i).test(txt.replace(/^\s+/))){
-txt="";
-_2c4="cell";
-}else{
-if((/^]/i).test(txt.replace(/^\s+/))){
-txt="";
-_2c4="row";
-}else{
-if((/^<(thead|tbody|tfoot)[\s\r\n>]/i).test(txt.replace(/^\s+/))){
-txt="";
-_2c4="section";
-}
-}
-}
-tn.innerHTML=txt;
-if(tn["normalize"]){
-tn.normalize();
-}
-var _2c5=null;
-switch(_2c4){
-case "cell":
-_2c5=tn.getElementsByTagName("tr")[0];
-break;
-case "row":
-_2c5=tn.getElementsByTagName("tbody")[0];
-break;
-case "section":
-_2c5=tn.getElementsByTagName("table")[0];
-break;
-default:
-_2c5=tn;
-break;
-}
-var _2c6=[];
-for(var x=0;x<_2c5.childNodes.length;x++){
-_2c6.push(_2c5.childNodes[x].cloneNode(true));
-}
-tn.style.display="none";
-dojo.body().removeChild(tn);
-return _2c6;
-};
-dojo.html.placeOnScreen=function(node,_2c9,_2ca,_2cb,_2cc,_2cd,_2ce){
-if(_2c9 instanceof Array||typeof _2c9=="array"){
-_2ce=_2cd;
-_2cd=_2cc;
-_2cc=_2cb;
-_2cb=_2ca;
-_2ca=_2c9[1];
-_2c9=_2c9[0];
-}
-if(_2cd instanceof String||typeof _2cd=="string"){
-_2cd=_2cd.split(",");
-}
-if(!isNaN(_2cb)){
-_2cb=[Number(_2cb),Number(_2cb)];
-}else{
-if(!(_2cb instanceof Array||typeof _2cb=="array")){
-_2cb=[0,0];
-}
-}
-var _2cf=dojo.html.getScroll().offset;
-var view=dojo.html.getViewport();
-node=dojo.byId(node);
-var _2d1=node.style.display;
-node.style.display="";
-var bb=dojo.html.getBorderBox(node);
-var w=bb.width;
-var h=bb.height;
-node.style.display=_2d1;
-if(!(_2cd instanceof Array||typeof _2cd=="array")){
-_2cd=["TL"];
-}
-var _2d5,_2d6,_2d7=Infinity,_2d8;
-for(var _2d9=0;_2d9<_2cd.length;++_2d9){
-var _2da=_2cd[_2d9];
-var _2db=true;
-var tryX=_2c9-(_2da.charAt(1)=="L"?0:w)+_2cb[0]*(_2da.charAt(1)=="L"?1:-1);
-var tryY=_2ca-(_2da.charAt(0)=="T"?0:h)+_2cb[1]*(_2da.charAt(0)=="T"?1:-1);
-if(_2cc){
-tryX-=_2cf.x;
-tryY-=_2cf.y;
-}
-if(tryX<0){
-tryX=0;
-_2db=false;
-}
-if(tryY<0){
-tryY=0;
-_2db=false;
-}
-var x=tryX+w;
-if(x>view.width){
-x=view.width-w;
-_2db=false;
-}else{
-x=tryX;
-}
-x=Math.max(_2cb[0],x)+_2cf.x;
-var y=tryY+h;
-if(y>view.height){
-y=view.height-h;
-_2db=false;
-}else{
-y=tryY;
-}
-y=Math.max(_2cb[1],y)+_2cf.y;
-if(_2db){
-_2d5=x;
-_2d6=y;
-_2d7=0;
-_2d8=_2da;
-break;
-}else{
-var dist=Math.pow(x-tryX-_2cf.x,2)+Math.pow(y-tryY-_2cf.y,2);
-if(_2d7>dist){
-_2d7=dist;
-_2d5=x;
-_2d6=y;
-_2d8=_2da;
-}
-}
-}
-if(!_2ce){
-node.style.left=_2d5+"px";
-node.style.top=_2d6+"px";
-}
-return {left:_2d5,top:_2d6,x:_2d5,y:_2d6,dist:_2d7,corner:_2d8};
-};
-dojo.html.placeOnScreenPoint=function(node,_2e2,_2e3,_2e4,_2e5){
-dojo.deprecated("dojo.html.placeOnScreenPoint","use dojo.html.placeOnScreen() instead","0.5");
-return dojo.html.placeOnScreen(node,_2e2,_2e3,_2e4,_2e5,["TL","TR","BL","BR"]);
-};
-dojo.html.placeOnScreenAroundElement=function(node,_2e7,_2e8,_2e9,_2ea,_2eb){
-var best,_2ed=Infinity;
-_2e7=dojo.byId(_2e7);
-var _2ee=_2e7.style.display;
-_2e7.style.display="";
-var mb=dojo.html.getElementBox(_2e7,_2e9);
-var _2f0=mb.width;
-var _2f1=mb.height;
-var _2f2=dojo.html.getAbsolutePosition(_2e7,true,_2e9);
-_2e7.style.display=_2ee;
-for(var _2f3 in _2ea){
-var pos,_2f5,_2f6;
-var _2f7=_2ea[_2f3];
-_2f5=_2f2.x+(_2f3.charAt(1)=="L"?0:_2f0);
-_2f6=_2f2.y+(_2f3.charAt(0)=="T"?0:_2f1);
-pos=dojo.html.placeOnScreen(node,_2f5,_2f6,_2e8,true,_2f7,true);
-if(pos.dist==0){
-best=pos;
-break;
-}else{
-if(_2ed>pos.dist){
-_2ed=pos.dist;
-best=pos;
-}
-}
-}
-if(!_2eb){
-node.style.left=best.left+"px";
-node.style.top=best.top+"px";
-}
-return best;
-};
-dojo.html.scrollIntoView=function(node){
-if(!node){
-return;
-}
-if(dojo.render.html.ie){
-if(dojo.html.getBorderBox(node.parentNode).heightnode.offsetTop){
-_2f9.scrollTop-=(_2f9.scrollTop-node.offsetTop);
-}
-}
-}
-}
-};
+
dojo.provide("dojo.lang.array");
-dojo.lang.has=function(obj,name){
-try{
-return typeof obj[name]!="undefined";
+
+
+// FIXME: Is this worthless since you can do: if(name in obj)
+// is this the right place for this?
+dojo.lang.has = function(/*Object*/obj, /*String*/name){
+ try{
+ return typeof obj[name] != "undefined";
+ }catch(e){ return false; }
}
-catch(e){
-return false;
+
+dojo.lang.isEmpty = function(/*Object*/obj){
+ if(dojo.lang.isObject(obj)){
+ var tmp = {};
+ var count = 0;
+ for(var x in obj){
+ if(obj[x] && (!tmp[x])){
+ count++;
+ break;
+ }
+ }
+ return count == 0;
+ }else if(dojo.lang.isArrayLike(obj) || dojo.lang.isString(obj)){
+ return obj.length == 0;
+ }
}
-};
-dojo.lang.isEmpty=function(obj){
-if(dojo.lang.isObject(obj)){
-var tmp={};
-var _300=0;
-for(var x in obj){
-if(obj[x]&&(!tmp[x])){
-_300++;
-break;
+
+dojo.lang.map = function(/*Array*/arr, /*Object|Function*/obj, /*Function?*/unary_func){
+ var isString = dojo.lang.isString(arr);
+ if(isString){
+ // arr: String
+ arr = arr.split("");
+ }
+ if(dojo.lang.isFunction(obj)&&(!unary_func)){
+ unary_func = obj;
+ obj = dj_global;
+ }else if(dojo.lang.isFunction(obj) && unary_func){
+ // ff 1.5 compat
+ var tmpObj = obj;
+ obj = unary_func;
+ unary_func = tmpObj;
+ }
+ if(Array.map){
+ var outArr = Array.map(arr, unary_func, obj);
+ }else{
+ var outArr = [];
+ for(var i=0;i= 3){ dojo.raise("thisObject doesn't exist!"); }
+ thisObject = dj_global;
+ }
+
+ outArr = [];
+ for(var i = 0; i < arr.length; i++){
+ if(callback.call(thisObject, arr[i], i, arr)){
+ outArr.push(arr[i]);
+ }
+ }
+ }
+ if(isString){
+ return outArr.join(""); // String
+ } else {
+ return outArr; // Array
+ }
}
-if(Array.map){
-var _307=Array.map(arr,_304,obj);
-}else{
-var _307=[];
-for(var i=0;i [1, 2, 3]
+ // unnest(1, [2, [3], [[[4]]]]) ==> [1, 2, 3, 4]
+
+ var out = [];
+ for(var i = 0; i < arguments.length; i++){
+ if(dojo.lang.isArrayLike(arguments[i])){
+ var add = dojo.lang.unnest.apply(this, arguments[i]);
+ out = out.concat(add);
+ }else{
+ out.push(arguments[i]);
+ }
+ }
+ return out; // Array
}
+
+dojo.lang.toArray = function(/*Object*/arrayLike, /*Number*/startOffset){
+ // summary:
+ // Converts an array-like object (i.e. arguments, DOMCollection)
+ // to an array
+ var array = [];
+ for(var i = startOffset||0; i < arrayLike.length; i++){
+ array.push(arrayLike[i]);
+ }
+ return array; // Array
}
-if(_305){
-return _307.join("");
-}else{
-return _307;
-}
-};
-dojo.lang.reduce=function(arr,_30a,obj,_30c){
-var _30d=_30a;
-var ob=obj?obj:dj_global;
-dojo.lang.map(arr,function(val){
-_30d=_30c.call(ob,_30d,val);
-});
-return _30d;
-};
-dojo.lang.forEach=function(_310,_311,_312){
-if(dojo.lang.isString(_310)){
-_310=_310.split("");
-}
-if(Array.forEach){
-Array.forEach(_310,_311,_312);
-}else{
-if(!_312){
-_312=dj_global;
-}
-for(var i=0,l=_310.length;i=3){
-dojo.raise("thisObject doesn't exist!");
-}
-_324=dj_global;
-}
-_326=[];
-for(var i=0;i 0){ this.duration = duration; }
+ if(repeatCount){ this.repeatCount = repeatCount; }
+ if(rate){ this.rate = rate; }
+ if(handlers){
+ dojo.lang.forEach([
+ "handler", "beforeBegin", "onBegin",
+ "onEnd", "onPlay", "onStop", "onAnimate"
+ ], function(item){
+ if(handlers[item]){
+ this.connect(item, handlers[item]);
+ }
+ }, this);
+ }
+ if(easing && dojo.lang.isFunction(easing)){
+ this.easing=easing;
+ }
}
-if(_389!=null&&_389>0){
-this.duration=_389;
+dojo.inherits(dojo.lfx.Animation, dojo.lfx.IAnimation);
+dojo.lang.extend(dojo.lfx.Animation, {
+ // "private" properties
+ _startTime: null,
+ _endTime: null,
+ _timer: null,
+ _percent: 0,
+ _startRepeatCount: 0,
+
+ // public methods
+ play: function(/*int?*/ delay, /*bool?*/ gotoStart){
+ // summary: Start the animation.
+ // delay: How many milliseconds to delay before starting.
+ // gotoStart: If true, starts the animation from the beginning; otherwise,
+ // starts it from its current position.
+ if(gotoStart){
+ clearTimeout(this._timer);
+ this._active = false;
+ this._paused = false;
+ this._percent = 0;
+ }else if(this._active && !this._paused){
+ return this; // dojo.lfx.Animation
+ }
+
+ this.fire("handler", ["beforeBegin"]);
+ this.fire("beforeBegin");
+
+ if(delay > 0){
+ setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);
+ return this; // dojo.lfx.Animation
+ }
+
+ this._startTime = new Date().valueOf();
+ if(this._paused){
+ this._startTime -= (this.duration * this._percent / 100);
+ }
+ this._endTime = this._startTime + this.duration;
+
+ this._active = true;
+ this._paused = false;
+
+ var step = this._percent / 100;
+ var value = this.curve.getValue(step);
+ if(this._percent == 0 ){
+ if(!this._startRepeatCount){
+ this._startRepeatCount = this.repeatCount;
+ }
+ this.fire("handler", ["begin", value]);
+ this.fire("onBegin", [value]);
+ }
+
+ this.fire("handler", ["play", value]);
+ this.fire("onPlay", [value]);
+
+ this._cycle();
+ return this; // dojo.lfx.Animation
+ },
+
+ pause: function(){
+ // summary: Pauses a running animation.
+ clearTimeout(this._timer);
+ if(!this._active){ return this; /*dojo.lfx.Animation*/}
+ this._paused = true;
+ var value = this.curve.getValue(this._percent / 100);
+ this.fire("handler", ["pause", value]);
+ this.fire("onPause", [value]);
+ return this; // dojo.lfx.Animation
+ },
+
+ gotoPercent: function(/*Decimal*/ pct, /*bool?*/ andPlay){
+ // summary: Sets the progress of the animation.
+ // pct: A percentage in decimal notation (between and including 0.0 and 1.0).
+ // andPlay: If true, play the animation after setting the progress.
+ clearTimeout(this._timer);
+ this._active = true;
+ this._paused = true;
+ this._percent = pct;
+ if(andPlay){ this.play(); }
+ return this; // dojo.lfx.Animation
+ },
+
+ stop: function(/*bool?*/ gotoEnd){
+ // summary: Stops a running animation.
+ // gotoEnd: If true, the animation will end.
+ clearTimeout(this._timer);
+ var step = this._percent / 100;
+ if(gotoEnd){
+ step = 1;
+ }
+ var value = this.curve.getValue(step);
+ this.fire("handler", ["stop", value]);
+ this.fire("onStop", [value]);
+ this._active = false;
+ this._paused = false;
+ return this; // dojo.lfx.Animation
+ },
+
+ status: function(){
+ // summary: Returns a string representation of the status of
+ // the animation.
+ if(this._active){
+ return this._paused ? "paused" : "playing"; // String
+ }else{
+ return "stopped"; // String
+ }
+ return this;
+ },
+
+ // "private" methods
+ _cycle: function(){
+ clearTimeout(this._timer);
+ if(this._active){
+ var curr = new Date().valueOf();
+ var step = (curr - this._startTime) / (this._endTime - this._startTime);
+
+ if(step >= 1){
+ step = 1;
+ this._percent = 100;
+ }else{
+ this._percent = step * 100;
+ }
+
+ // Perform easing
+ if((this.easing)&&(dojo.lang.isFunction(this.easing))){
+ step = this.easing(step);
+ }
+
+ var value = this.curve.getValue(step);
+ this.fire("handler", ["animate", value]);
+ this.fire("onAnimate", [value]);
+
+ if( step < 1 ){
+ this._timer = setTimeout(dojo.lang.hitch(this, "_cycle"), this.rate);
+ }else{
+ this._active = false;
+ this.fire("handler", ["end"]);
+ this.fire("onEnd");
+
+ if(this.repeatCount > 0){
+ this.repeatCount--;
+ this.play(null, true);
+ }else if(this.repeatCount == -1){
+ this.play(null, true);
+ }else{
+ if(this._startRepeatCount){
+ this.repeatCount = this._startRepeatCount;
+ this._startRepeatCount = 0;
+ }
+ }
+ }
+ }
+ return this; // dojo.lfx.Animation
+ }
+});
+
+dojo.lfx.Combine = function(/*dojo.lfx.IAnimation...*/ animations){
+ // summary: An animation object to play animations passed to it at the same time.
+ dojo.lfx.IAnimation.call(this);
+ this._anims = [];
+ this._animsEnded = 0;
+
+ var anims = arguments;
+ if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){
+ /* animations: dojo.lfx.IAnimation[]
+ pId: a */
+ anims = anims[0];
+ }
+
+ dojo.lang.forEach(anims, function(anim){
+ this._anims.push(anim);
+ anim.connect("onEnd", dojo.lang.hitch(this, "_onAnimsEnded"));
+ }, this);
}
-if(_38c){
-this.repeatCount=_38c;
+dojo.inherits(dojo.lfx.Combine, dojo.lfx.IAnimation);
+dojo.lang.extend(dojo.lfx.Combine, {
+ // private members
+ _animsEnded: 0,
+
+ // public methods
+ play: function(/*int?*/ delay, /*bool?*/ gotoStart){
+ // summary: Start the animations.
+ // delay: How many milliseconds to delay before starting.
+ // gotoStart: If true, starts the animations from the beginning; otherwise,
+ // starts them from their current position.
+ if( !this._anims.length ){ return this; /*dojo.lfx.Combine*/}
+
+ this.fire("beforeBegin");
+
+ if(delay > 0){
+ setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);
+ return this; // dojo.lfx.Combine
+ }
+
+ if(gotoStart || this._anims[0].percent == 0){
+ this.fire("onBegin");
+ }
+ this.fire("onPlay");
+ this._animsCall("play", null, gotoStart);
+ return this; // dojo.lfx.Combine
+ },
+
+ pause: function(){
+ // summary: Pauses the running animations.
+ this.fire("onPause");
+ this._animsCall("pause");
+ return this; // dojo.lfx.Combine
+ },
+
+ stop: function(/*bool?*/ gotoEnd){
+ // summary: Stops the running animations.
+ // gotoEnd: If true, the animations will end.
+ this.fire("onStop");
+ this._animsCall("stop", gotoEnd);
+ return this; // dojo.lfx.Combine
+ },
+
+ // private methods
+ _onAnimsEnded: function(){
+ this._animsEnded++;
+ if(this._animsEnded >= this._anims.length){
+ this.fire("onEnd");
+ }
+ return this; // dojo.lfx.Combine
+ },
+
+ _animsCall: function(/*String*/ funcName){
+ var args = [];
+ if(arguments.length > 1){
+ for(var i = 1 ; i < arguments.length ; i++){
+ args.push(arguments[i]);
+ }
+ }
+ var _this = this;
+ dojo.lang.forEach(this._anims, function(anim){
+ anim[funcName](args);
+ }, _this);
+ return this; // dojo.lfx.Combine
+ }
+});
+
+dojo.lfx.Chain = function(/*dojo.lfx.IAnimation...*/ animations) {
+ // summary: An animation object to play animations passed to it
+ // one after another.
+ dojo.lfx.IAnimation.call(this);
+ this._anims = [];
+ this._currAnim = -1;
+
+ var anims = arguments;
+ if(anims.length == 1 && (dojo.lang.isArray(anims[0]) || dojo.lang.isArrayLike(anims[0]))){
+ /* animations: dojo.lfx.IAnimation[]
+ pId: a */
+ anims = anims[0];
+ }
+
+ var _this = this;
+ dojo.lang.forEach(anims, function(anim, i, anims_arr){
+ this._anims.push(anim);
+ if(i < anims_arr.length - 1){
+ anim.connect("onEnd", dojo.lang.hitch(this, "_playNext") );
+ }else{
+ anim.connect("onEnd", dojo.lang.hitch(this, function(){ this.fire("onEnd"); }) );
+ }
+ }, this);
}
-if(rate){
-this.rate=rate;
+dojo.inherits(dojo.lfx.Chain, dojo.lfx.IAnimation);
+dojo.lang.extend(dojo.lfx.Chain, {
+ // private members
+ _currAnim: -1,
+
+ // public methods
+ play: function(/*int?*/ delay, /*bool?*/ gotoStart){
+ // summary: Start the animation sequence.
+ // delay: How many milliseconds to delay before starting.
+ // gotoStart: If true, starts the sequence from the beginning; otherwise,
+ // starts it from its current position.
+ if( !this._anims.length ) { return this; /*dojo.lfx.Chain*/}
+ if( gotoStart || !this._anims[this._currAnim] ) {
+ this._currAnim = 0;
+ }
+
+ var currentAnimation = this._anims[this._currAnim];
+
+ this.fire("beforeBegin");
+ if(delay > 0){
+ setTimeout(dojo.lang.hitch(this, function(){ this.play(null, gotoStart); }), delay);
+ return this; // dojo.lfx.Chain
+ }
+
+ if(currentAnimation){
+ if(this._currAnim == 0){
+ this.fire("handler", ["begin", this._currAnim]);
+ this.fire("onBegin", [this._currAnim]);
+ }
+ this.fire("onPlay", [this._currAnim]);
+ currentAnimation.play(null, gotoStart);
+ }
+ return this; // dojo.lfx.Chain
+ },
+
+ pause: function(){
+ // summary: Pauses the running animation sequence.
+ if( this._anims[this._currAnim] ) {
+ this._anims[this._currAnim].pause();
+ this.fire("onPause", [this._currAnim]);
+ }
+ return this; // dojo.lfx.Chain
+ },
+
+ playPause: function(){
+ // summary: If the animation sequence is playing, pause it; otherwise,
+ // play it.
+ if(this._anims.length == 0){ return this; }
+ if(this._currAnim == -1){ this._currAnim = 0; }
+ var currAnim = this._anims[this._currAnim];
+ if( currAnim ) {
+ if( !currAnim._active || currAnim._paused ) {
+ this.play();
+ } else {
+ this.pause();
+ }
+ }
+ return this; // dojo.lfx.Chain
+ },
+
+ stop: function(){
+ // summary: Stops the running animations.
+ var currAnim = this._anims[this._currAnim];
+ if(currAnim){
+ currAnim.stop();
+ this.fire("onStop", [this._currAnim]);
+ }
+ return currAnim; // dojo.lfx.IAnimation
+ },
+
+ // private methods
+ _playNext: function(){
+ if( this._currAnim == -1 || this._anims.length == 0 ) { return this; }
+ this._currAnim++;
+ if( this._anims[this._currAnim] ){
+ this._anims[this._currAnim].play(null, true);
+ }
+ return this; // dojo.lfx.Chain
+ }
+});
+
+dojo.lfx.combine = function(/*dojo.lfx.IAnimation...*/ animations){
+ // summary: Convenience function. Returns a dojo.lfx.Combine created
+ // using the animations passed in.
+ var anims = arguments;
+ if(dojo.lang.isArray(arguments[0])){
+ /* animations: dojo.lfx.IAnimation[]
+ pId: a */
+ anims = arguments[0];
+ }
+ if(anims.length == 1){ return anims[0]; }
+ return new dojo.lfx.Combine(anims); // dojo.lfx.Combine
}
-if(_388){
-dojo.lang.forEach(["handler","beforeBegin","onBegin","onEnd","onPlay","onStop","onAnimate"],function(item){
-if(_388[item]){
-this.connect(item,_388[item]);
+
+dojo.lfx.chain = function(/*dojo.lfx.IAnimation...*/ animations){
+ // summary: Convenience function. Returns a dojo.lfx.Chain created
+ // using the animations passed in.
+ var anims = arguments;
+ if(dojo.lang.isArray(arguments[0])){
+ /* animations: dojo.lfx.IAnimation[]
+ pId: a */
+ anims = arguments[0];
+ }
+ if(anims.length == 1){ return anims[0]; }
+ return new dojo.lfx.Chain(anims); // dojo.lfx.Combine
}
-},this);
-}
-if(_38b&&dojo.lang.isFunction(_38b)){
-this.easing=_38b;
-}
-};
-dojo.inherits(dojo.lfx.Animation,dojo.lfx.IAnimation);
-dojo.lang.extend(dojo.lfx.Animation,{_startTime:null,_endTime:null,_timer:null,_percent:0,_startRepeatCount:0,play:function(_38f,_390){
-if(_390){
-clearTimeout(this._timer);
-this._active=false;
-this._paused=false;
-this._percent=0;
-}else{
-if(this._active&&!this._paused){
-return this;
-}
-}
-this.fire("handler",["beforeBegin"]);
-this.fire("beforeBegin");
-if(_38f>0){
-setTimeout(dojo.lang.hitch(this,function(){
-this.play(null,_390);
-}),_38f);
-return this;
-}
-this._startTime=new Date().valueOf();
-if(this._paused){
-this._startTime-=(this.duration*this._percent/100);
-}
-this._endTime=this._startTime+this.duration;
-this._active=true;
-this._paused=false;
-var step=this._percent/100;
-var _392=this.curve.getValue(step);
-if(this._percent==0){
-if(!this._startRepeatCount){
-this._startRepeatCount=this.repeatCount;
-}
-this.fire("handler",["begin",_392]);
-this.fire("onBegin",[_392]);
-}
-this.fire("handler",["play",_392]);
-this.fire("onPlay",[_392]);
-this._cycle();
-return this;
-},pause:function(){
-clearTimeout(this._timer);
-if(!this._active){
-return this;
-}
-this._paused=true;
-var _393=this.curve.getValue(this._percent/100);
-this.fire("handler",["pause",_393]);
-this.fire("onPause",[_393]);
-return this;
-},gotoPercent:function(pct,_395){
-clearTimeout(this._timer);
-this._active=true;
-this._paused=true;
-this._percent=pct;
-if(_395){
-this.play();
-}
-return this;
-},stop:function(_396){
-clearTimeout(this._timer);
-var step=this._percent/100;
-if(_396){
-step=1;
-}
-var _398=this.curve.getValue(step);
-this.fire("handler",["stop",_398]);
-this.fire("onStop",[_398]);
-this._active=false;
-this._paused=false;
-return this;
-},status:function(){
-if(this._active){
-return this._paused?"paused":"playing";
-}else{
-return "stopped";
-}
-return this;
-},_cycle:function(){
-clearTimeout(this._timer);
-if(this._active){
-var curr=new Date().valueOf();
-var step=(curr-this._startTime)/(this._endTime-this._startTime);
-if(step>=1){
-step=1;
-this._percent=100;
-}else{
-this._percent=step*100;
-}
-if((this.easing)&&(dojo.lang.isFunction(this.easing))){
-step=this.easing(step);
-}
-var _39b=this.curve.getValue(step);
-this.fire("handler",["animate",_39b]);
-this.fire("onAnimate",[_39b]);
-if(step<1){
-this._timer=setTimeout(dojo.lang.hitch(this,"_cycle"),this.rate);
-}else{
-this._active=false;
-this.fire("handler",["end"]);
-this.fire("onEnd");
-if(this.repeatCount>0){
-this.repeatCount--;
-this.play(null,true);
-}else{
-if(this.repeatCount==-1){
-this.play(null,true);
-}else{
-if(this._startRepeatCount){
-this.repeatCount=this._startRepeatCount;
-this._startRepeatCount=0;
-}
-}
-}
-}
-}
-return this;
-}});
-dojo.lfx.Combine=function(_39c){
-dojo.lfx.IAnimation.call(this);
-this._anims=[];
-this._animsEnded=0;
-var _39d=arguments;
-if(_39d.length==1&&(dojo.lang.isArray(_39d[0])||dojo.lang.isArrayLike(_39d[0]))){
-_39d=_39d[0];
-}
-dojo.lang.forEach(_39d,function(anim){
-this._anims.push(anim);
-anim.connect("onEnd",dojo.lang.hitch(this,"_onAnimsEnded"));
-},this);
-};
-dojo.inherits(dojo.lfx.Combine,dojo.lfx.IAnimation);
-dojo.lang.extend(dojo.lfx.Combine,{_animsEnded:0,play:function(_39f,_3a0){
-if(!this._anims.length){
-return this;
-}
-this.fire("beforeBegin");
-if(_39f>0){
-setTimeout(dojo.lang.hitch(this,function(){
-this.play(null,_3a0);
-}),_39f);
-return this;
-}
-if(_3a0||this._anims[0].percent==0){
-this.fire("onBegin");
-}
-this.fire("onPlay");
-this._animsCall("play",null,_3a0);
-return this;
-},pause:function(){
-this.fire("onPause");
-this._animsCall("pause");
-return this;
-},stop:function(_3a1){
-this.fire("onStop");
-this._animsCall("stop",_3a1);
-return this;
-},_onAnimsEnded:function(){
-this._animsEnded++;
-if(this._animsEnded>=this._anims.length){
-this.fire("onEnd");
-}
-return this;
-},_animsCall:function(_3a2){
-var args=[];
-if(arguments.length>1){
-for(var i=1;i0){
-setTimeout(dojo.lang.hitch(this,function(){
-this.play(null,_3ae);
-}),_3ad);
-return this;
-}
-if(_3af){
-if(this._currAnim==0){
-this.fire("handler",["begin",this._currAnim]);
-this.fire("onBegin",[this._currAnim]);
-}
-this.fire("onPlay",[this._currAnim]);
-_3af.play(null,_3ae);
-}
-return this;
-},pause:function(){
-if(this._anims[this._currAnim]){
-this._anims[this._currAnim].pause();
-this.fire("onPause",[this._currAnim]);
-}
-return this;
-},playPause:function(){
-if(this._anims.length==0){
-return this;
-}
-if(this._currAnim==-1){
-this._currAnim=0;
-}
-var _3b0=this._anims[this._currAnim];
-if(_3b0){
-if(!_3b0._active||_3b0._paused){
-this.play();
-}else{
-this.pause();
-}
-}
-return this;
-},stop:function(){
-var _3b1=this._anims[this._currAnim];
-if(_3b1){
-_3b1.stop();
-this.fire("onStop",[this._currAnim]);
-}
-return _3b1;
-},_playNext:function(){
-if(this._currAnim==-1||this._anims.length==0){
-return this;
-}
-this._currAnim++;
-if(this._anims[this._currAnim]){
-this._anims[this._currAnim].play(null,true);
-}
-return this;
-}});
-dojo.lfx.combine=function(_3b2){
-var _3b3=arguments;
-if(dojo.lang.isArray(arguments[0])){
-_3b3=arguments[0];
-}
-if(_3b3.length==1){
-return _3b3[0];
-}
-return new dojo.lfx.Combine(_3b3);
-};
-dojo.lfx.chain=function(_3b4){
-var _3b5=arguments;
-if(dojo.lang.isArray(arguments[0])){
-_3b5=arguments[0];
-}
-if(_3b5.length==1){
-return _3b5[0];
-}
-return new dojo.lfx.Chain(_3b5);
-};
+
dojo.provide("dojo.html.color");
-dojo.html.getBackgroundColor=function(node){
-node=dojo.byId(node);
-var _3b7;
-do{
-_3b7=dojo.html.getStyle(node,"background-color");
-if(_3b7.toLowerCase()=="rgba(0, 0, 0, 0)"){
-_3b7="transparent";
+
+
+dojo.html.getBackgroundColor = function(/* HTMLElement */node){
+ // summary
+ // returns the background color of the passed node as a 32-bit color (RGBA)
+ node = dojo.byId(node);
+ var color;
+ do{
+ color = dojo.html.getStyle(node, "background-color");
+ // Safari doesn't say "transparent"
+ if(color.toLowerCase() == "rgba(0, 0, 0, 0)") { color = "transparent"; }
+ if(node == document.getElementsByTagName("body")[0]) { node = null; break; }
+ node = node.parentNode;
+ }while(node && dojo.lang.inArray(["transparent", ""], color));
+ if(color == "transparent"){
+ color = [255, 255, 255, 0];
+ }else{
+ color = dojo.gfx.color.extractRGB(color);
+ }
+ return color; // array
}
-if(node==document.getElementsByTagName("body")[0]){
-node=null;
-break;
-}
-node=node.parentNode;
-}while(node&&dojo.lang.inArray(["transparent",""],_3b7));
-if(_3b7=="transparent"){
-_3b7=[255,255,255,0];
-}else{
-_3b7=dojo.gfx.color.extractRGB(_3b7);
-}
-return _3b7;
-};
+
dojo.provide("dojo.lfx.html");
-dojo.lfx.html._byId=function(_3b8){
-if(!_3b8){
-return [];
+
+
+dojo.lfx.html._byId = function(nodes){
+ if(!nodes){ return []; }
+ if(dojo.lang.isArrayLike(nodes)){
+ if(!nodes.alreadyChecked){
+ var n = [];
+ dojo.lang.forEach(nodes, function(node){
+ n.push(dojo.byId(node));
+ });
+ n.alreadyChecked = true;
+ return n;
+ }else{
+ return nodes;
+ }
+ }else{
+ var n = [];
+ n.push(dojo.byId(nodes));
+ n.alreadyChecked = true;
+ return n;
+ }
}
-if(dojo.lang.isArrayLike(_3b8)){
-if(!_3b8.alreadyChecked){
-var n=[];
-dojo.lang.forEach(_3b8,function(node){
-n.push(dojo.byId(node));
-});
-n.alreadyChecked=true;
-return n;
-}else{
-return _3b8;
+
+dojo.lfx.html.propertyAnimation = function( /*DOMNode[]*/ nodes,
+ /*Object[]*/ propertyMap,
+ /*int*/ duration,
+ /*function*/ easing,
+ /*Object*/ handlers){
+ // summary: Returns an animation that will transition the properties of "nodes"
+ // depending how they are defined in "propertyMap".
+ // nodes: An array of DOMNodes or one DOMNode.
+ // propertyMap: { property: String, start: Decimal?, end: Decimal?, units: String? }
+ // An array of objects defining properties to change.
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // handlers: { handler: Function?, onstart: Function?, onstop: Function?, onanimate: Function? }
+ nodes = dojo.lfx.html._byId(nodes);
+
+ var targs = {
+ "propertyMap": propertyMap,
+ "nodes": nodes,
+ "duration": duration,
+ "easing": easing||dojo.lfx.easeDefault
+ };
+
+ var setEmUp = function(args){
+ if(args.nodes.length==1){
+ // FIXME: we're only supporting start-value filling when one node is
+ // passed
+
+ var pm = args.propertyMap;
+ if(!dojo.lang.isArray(args.propertyMap)){
+ // it's stupid to have to pack an array with a set of objects
+ // when you can just pass in an object list
+ var parr = [];
+ for(var pname in pm){
+ pm[pname].property = pname;
+ parr.push(pm[pname]);
+ }
+ pm = args.propertyMap = parr;
+ }
+ dojo.lang.forEach(pm, function(prop){
+ if(dj_undef("start", prop)){
+ if(prop.property != "opacity"){
+ prop.start = parseInt(dojo.html.getComputedStyle(args.nodes[0], prop.property));
+ }else{
+ prop.start = dojo.html.getOpacity(args.nodes[0]);
+ }
+ }
+ });
+ }
+ }
+
+ var coordsAsInts = function(coords){
+ var cints = [];
+ dojo.lang.forEach(coords, function(c){
+ cints.push(Math.round(c));
+ });
+ return cints;
+ }
+
+ var setStyle = function(n, style){
+ n = dojo.byId(n);
+ if(!n || !n.style){ return; }
+ for(var s in style){
+ if(s == "opacity"){
+ dojo.html.setOpacity(n, style[s]);
+ }else{
+ n.style[s] = style[s];
+ }
+ }
+ }
+
+ var propLine = function(properties){
+ this._properties = properties;
+ this.diffs = new Array(properties.length);
+ dojo.lang.forEach(properties, function(prop, i){
+ // calculate the end - start to optimize a bit
+ if(dojo.lang.isFunction(prop.start)){
+ prop.start = prop.start(prop, i);
+ }
+ if(dojo.lang.isFunction(prop.end)){
+ prop.end = prop.end(prop, i);
+ }
+ if(dojo.lang.isArray(prop.start)){
+ // don't loop through the arrays
+ this.diffs[i] = null;
+ }else if(prop.start instanceof dojo.gfx.color.Color){
+ // save these so we don't have to call toRgb() every getValue() call
+ prop.startRgb = prop.start.toRgb();
+ prop.endRgb = prop.end.toRgb();
+ }else{
+ this.diffs[i] = prop.end - prop.start;
+ }
+ }, this);
+
+ this.getValue = function(n){
+ var ret = {};
+ dojo.lang.forEach(this._properties, function(prop, i){
+ var value = null;
+ if(dojo.lang.isArray(prop.start)){
+ // FIXME: what to do here?
+ }else if(prop.start instanceof dojo.gfx.color.Color){
+ value = (prop.units||"rgb") + "(";
+ for(var j = 0 ; j < prop.startRgb.length ; j++){
+ value += Math.round(((prop.endRgb[j] - prop.startRgb[j]) * n) + prop.startRgb[j]) + (j < prop.startRgb.length - 1 ? "," : "");
+ }
+ value += ")";
+ }else{
+ value = ((this.diffs[i]) * n) + prop.start + (prop.property != "opacity" ? prop.units||"px" : "");
+ }
+ ret[dojo.html.toCamelCase(prop.property)] = value;
+ }, this);
+ return ret;
+ }
+ }
+
+ var anim = new dojo.lfx.Animation({
+ beforeBegin: function(){
+ setEmUp(targs);
+ anim.curve = new propLine(targs.propertyMap);
+ },
+ onAnimate: function(propValues){
+ dojo.lang.forEach(targs.nodes, function(node){
+ setStyle(node, propValues);
+ });
+ }
+ },
+ targs.duration,
+ null,
+ targs.easing
+ );
+ if(handlers){
+ for(var x in handlers){
+ if(dojo.lang.isFunction(handlers[x])){
+ anim.connect(x, anim, handlers[x]);
+ }
+ }
+ }
+
+ return anim; // dojo.lfx.Animation
}
-}else{
-var n=[];
-n.push(dojo.byId(_3b8));
-n.alreadyChecked=true;
-return n;
+
+dojo.lfx.html._makeFadeable = function(nodes){
+ var makeFade = function(node){
+ if(dojo.render.html.ie){
+ // only set the zoom if the "tickle" value would be the same as the
+ // default
+ if( (node.style.zoom.length == 0) &&
+ (dojo.html.getStyle(node, "zoom") == "normal") ){
+ // make sure the node "hasLayout"
+ // NOTE: this has been tested with larger and smaller user-set text
+ // sizes and works fine
+ node.style.zoom = "1";
+ // node.style.zoom = "normal";
+ }
+ // don't set the width to auto if it didn't already cascade that way.
+ // We don't want to f anyones designs
+ if( (node.style.width.length == 0) &&
+ (dojo.html.getStyle(node, "width") == "auto") ){
+ node.style.width = "auto";
+ }
+ }
+ }
+ if(dojo.lang.isArrayLike(nodes)){
+ dojo.lang.forEach(nodes, makeFade);
+ }else{
+ makeFade(nodes);
+ }
}
-};
-dojo.lfx.html.propertyAnimation=function(_3bb,_3bc,_3bd,_3be,_3bf){
-_3bb=dojo.lfx.html._byId(_3bb);
-var _3c0={"propertyMap":_3bc,"nodes":_3bb,"duration":_3bd,"easing":_3be||dojo.lfx.easeDefault};
-var _3c1=function(args){
-if(args.nodes.length==1){
-var pm=args.propertyMap;
-if(!dojo.lang.isArray(args.propertyMap)){
-var parr=[];
-for(var _3c5 in pm){
-pm[_3c5].property=_3c5;
-parr.push(pm[_3c5]);
+
+dojo.lfx.html.fade = function(/*DOMNode[]*/ nodes,
+ /*Object*/values,
+ /*int?*/ duration,
+ /*Function?*/ easing,
+ /*Function?*/ callback){
+ // summary:Returns an animation that will fade the "nodes" from the start to end values passed.
+ // nodes: An array of DOMNodes or one DOMNode.
+ // values: { start: Decimal?, end: Decimal? }
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ nodes = dojo.lfx.html._byId(nodes);
+ var props = { property: "opacity" };
+ if(!dj_undef("start", values)){
+ props.start = values.start;
+ }else{
+ props.start = function(){ return dojo.html.getOpacity(nodes[0]); };
+ }
+
+ if(!dj_undef("end", values)){
+ props.end = values.end;
+ }else{
+ dojo.raise("dojo.lfx.html.fade needs an end value");
+ }
+
+ var anim = dojo.lfx.propertyAnimation(nodes, [ props ], duration, easing);
+ anim.connect("beforeBegin", function(){
+ dojo.lfx.html._makeFadeable(nodes);
+ });
+ if(callback){
+ anim.connect("onEnd", function(){ callback(nodes, anim); });
+ }
+
+ return anim; // dojo.lfx.Animation
}
-pm=args.propertyMap=parr;
+
+dojo.lfx.html.fadeIn = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){
+ // summary: Returns an animation that will fade "nodes" from its current opacity to fully opaque.
+ // nodes: An array of DOMNodes or one DOMNode.
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ return dojo.lfx.html.fade(nodes, { end: 1 }, duration, easing, callback); // dojo.lfx.Animation
}
-dojo.lang.forEach(pm,function(prop){
-if(dj_undef("start",prop)){
-if(prop.property!="opacity"){
-prop.start=parseInt(dojo.html.getComputedStyle(args.nodes[0],prop.property));
-}else{
-prop.start=dojo.html.getOpacity(args.nodes[0]);
+
+dojo.lfx.html.fadeOut = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){
+ // summary: Returns an animation that will fade "nodes" from its current opacity to fully transparent.
+ // nodes: An array of DOMNodes or one DOMNode.
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ return dojo.lfx.html.fade(nodes, { end: 0 }, duration, easing, callback); // dojo.lfx.Animation
}
+
+dojo.lfx.html.fadeShow = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){
+ // summary: Returns an animation that will fade "nodes" from transparent to opaque and shows
+ // "nodes" at the end if it is hidden.
+ // nodes: An array of DOMNodes or one DOMNode.
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ nodes=dojo.lfx.html._byId(nodes);
+ dojo.lang.forEach(nodes, function(node){
+ dojo.html.setOpacity(node, 0.0);
+ });
+
+ var anim = dojo.lfx.html.fadeIn(nodes, duration, easing, callback);
+ anim.connect("beforeBegin", function(){
+ if(dojo.lang.isArrayLike(nodes)){
+ dojo.lang.forEach(nodes, dojo.html.show);
+ }else{
+ dojo.html.show(nodes);
+ }
+ });
+
+ return anim; // dojo.lfx.Animation
}
-});
+
+dojo.lfx.html.fadeHide = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){
+ // summary: Returns an animation that will fade "nodes" from its current opacity to opaque and hides
+ // "nodes" at the end.
+ // nodes: An array of DOMNodes or one DOMNode.
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ var anim = dojo.lfx.html.fadeOut(nodes, duration, easing, function(){
+ if(dojo.lang.isArrayLike(nodes)){
+ dojo.lang.forEach(nodes, dojo.html.hide);
+ }else{
+ dojo.html.hide(nodes);
+ }
+ if(callback){ callback(nodes, anim); }
+ });
+
+ return anim; // dojo.lfx.Animation
}
-};
-var _3c7=function(_3c8){
-var _3c9=[];
-dojo.lang.forEach(_3c8,function(c){
-_3c9.push(Math.round(c));
-});
-return _3c9;
-};
-var _3cb=function(n,_3cd){
-n=dojo.byId(n);
-if(!n||!n.style){
-return;
+
+dojo.lfx.html.wipeIn = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){
+ // summary: Returns an animation that will show and wipe in "nodes".
+ // nodes: An array of DOMNodes or one DOMNode.
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ nodes = dojo.lfx.html._byId(nodes);
+ var anims = [];
+
+ dojo.lang.forEach(nodes, function(node){
+ var oprop = { }; // old properties of node (before we mucked w/them)
+
+ // get node height, either it's natural height or it's height specified via style or class attributes
+ // (for FF, the node has to be (temporarily) rendered to measure height)
+ dojo.html.show(node);
+ var height = dojo.html.getBorderBox(node).height;
+ dojo.html.hide(node);
+
+ var anim = dojo.lfx.propertyAnimation(node,
+ { "height": {
+ start: 1, // 0 causes IE to display the whole panel
+ end: function(){ return height; }
+ }
+ },
+ duration,
+ easing);
+
+ anim.connect("beforeBegin", function(){
+ oprop.overflow = node.style.overflow;
+ oprop.height = node.style.height;
+ with(node.style){
+ overflow = "hidden";
+ height = "1px"; // 0 causes IE to display the whole panel
+ }
+ dojo.html.show(node);
+ });
+
+ anim.connect("onEnd", function(){
+ with(node.style){
+ overflow = oprop.overflow;
+ height = oprop.height;
+ }
+ if(callback){ callback(node, anim); }
+ });
+ anims.push(anim);
+ });
+
+ return dojo.lfx.combine(anims); // dojo.lfx.Combine
}
-for(var s in _3cd){
-if(s=="opacity"){
-dojo.html.setOpacity(n,_3cd[s]);
-}else{
-n.style[s]=_3cd[s];
+
+dojo.lfx.html.wipeOut = function(/*DOMNode[]*/ nodes, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){
+ // summary: Returns an animation that will wipe out and hide "nodes".
+ // nodes: An array of DOMNodes or one DOMNode.
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ nodes = dojo.lfx.html._byId(nodes);
+ var anims = [];
+
+ dojo.lang.forEach(nodes, function(node){
+ var oprop = { }; // old properties of node (before we mucked w/them)
+ var anim = dojo.lfx.propertyAnimation(node,
+ { "height": {
+ start: function(){ return dojo.html.getContentBox(node).height; },
+ end: 1 // 0 causes IE to display the whole panel
+ }
+ },
+ duration,
+ easing,
+ {
+ "beforeBegin": function(){
+ oprop.overflow = node.style.overflow;
+ oprop.height = node.style.height;
+ with(node.style){
+ overflow = "hidden";
+ }
+ dojo.html.show(node);
+ },
+
+ "onEnd": function(){
+ dojo.html.hide(node);
+ with(node.style){
+ overflow = oprop.overflow;
+ height = oprop.height;
+ }
+ if(callback){ callback(node, anim); }
+ }
+ }
+ );
+ anims.push(anim);
+ });
+
+ return dojo.lfx.combine(anims); // dojo.lfx.Combine
}
+
+dojo.lfx.html.slideTo = function(/*DOMNode*/ nodes,
+ /*Object*/ coords,
+ /*int?*/ duration,
+ /*Function?*/ easing,
+ /*Function?*/ callback){
+ // summary: Returns an animation that will slide "nodes" from its current position to
+ // the position defined in "coords".
+ // nodes: An array of DOMNodes or one DOMNode.
+ // coords: { top: Decimal?, left: Decimal? }
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ nodes = dojo.lfx.html._byId(nodes);
+ var anims = [];
+ var compute = dojo.html.getComputedStyle;
+
+ if(dojo.lang.isArray(coords)){
+ /* coords: Array
+ pId: a */
+ dojo.deprecated('dojo.lfx.html.slideTo(node, array)', 'use dojo.lfx.html.slideTo(node, {top: value, left: value});', '0.5');
+ coords = { top: coords[0], left: coords[1] };
+ }
+ dojo.lang.forEach(nodes, function(node){
+ var top = null;
+ var left = null;
+
+ var init = (function(){
+ var innerNode = node;
+ return function(){
+ var pos = compute(innerNode, 'position');
+ top = (pos == 'absolute' ? node.offsetTop : parseInt(compute(node, 'top')) || 0);
+ left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node, 'left')) || 0);
+
+ if (!dojo.lang.inArray(['absolute', 'relative'], pos)) {
+ var ret = dojo.html.abs(innerNode, true);
+ dojo.html.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;");
+ top = ret.y;
+ left = ret.x;
+ }
+ }
+ })();
+ init();
+
+ var anim = dojo.lfx.propertyAnimation(node,
+ { "top": { start: top, end: (coords.top||0) },
+ "left": { start: left, end: (coords.left||0) }
+ },
+ duration,
+ easing,
+ { "beforeBegin": init }
+ );
+
+ if(callback){
+ anim.connect("onEnd", function(){ callback(nodes, anim); });
+ }
+
+ anims.push(anim);
+ });
+
+ return dojo.lfx.combine(anims); // dojo.lfx.Combine
}
-};
-var _3cf=function(_3d0){
-this._properties=_3d0;
-this.diffs=new Array(_3d0.length);
-dojo.lang.forEach(_3d0,function(prop,i){
-if(dojo.lang.isFunction(prop.start)){
-prop.start=prop.start(prop,i);
+
+dojo.lfx.html.slideBy = function(/*DOMNode*/ nodes, /*Object*/ coords, /*int?*/ duration, /*Function?*/ easing, /*Function?*/ callback){
+ // summary: Returns an animation that will slide "nodes" from its current position
+ // to its current position plus the numbers defined in "coords".
+ // nodes: An array of DOMNodes or one DOMNode.
+ // coords: { top: Decimal?, left: Decimal? }
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ nodes = dojo.lfx.html._byId(nodes);
+ var anims = [];
+ var compute = dojo.html.getComputedStyle;
+
+ if(dojo.lang.isArray(coords)){
+ /* coords: Array
+ pId: a */
+ dojo.deprecated('dojo.lfx.html.slideBy(node, array)', 'use dojo.lfx.html.slideBy(node, {top: value, left: value});', '0.5');
+ coords = { top: coords[0], left: coords[1] };
+ }
+
+ dojo.lang.forEach(nodes, function(node){
+ var top = null;
+ var left = null;
+
+ var init = (function(){
+ var innerNode = node;
+ return function(){
+ var pos = compute(innerNode, 'position');
+ top = (pos == 'absolute' ? node.offsetTop : parseInt(compute(node, 'top')) || 0);
+ left = (pos == 'absolute' ? node.offsetLeft : parseInt(compute(node, 'left')) || 0);
+
+ if (!dojo.lang.inArray(['absolute', 'relative'], pos)) {
+ var ret = dojo.html.abs(innerNode, true);
+ dojo.html.setStyleAttributes(innerNode, "position:absolute;top:"+ret.y+"px;left:"+ret.x+"px;");
+ top = ret.y;
+ left = ret.x;
+ }
+ }
+ })();
+ init();
+
+ var anim = dojo.lfx.propertyAnimation(node,
+ {
+ "top": { start: top, end: top+(coords.top||0) },
+ "left": { start: left, end: left+(coords.left||0) }
+ },
+ duration,
+ easing).connect("beforeBegin", init);
+
+ if(callback){
+ anim.connect("onEnd", function(){ callback(nodes, anim); });
+ }
+
+ anims.push(anim);
+ });
+
+ return dojo.lfx.combine(anims); // dojo.lfx.Combine
}
-if(dojo.lang.isFunction(prop.end)){
-prop.end=prop.end(prop,i);
+
+dojo.lfx.html.explode = function(/*DOMNode*/ start,
+ /*DOMNode*/ endNode,
+ /*int?*/ duration,
+ /*Function?*/ easing,
+ /*Function?*/ callback){
+ // summary: Returns an animation that will
+ // start:
+ // endNode:
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ var h = dojo.html;
+ start = dojo.byId(start);
+ endNode = dojo.byId(endNode);
+ var startCoords = h.toCoordinateObject(start, true);
+ var outline = document.createElement("div");
+ h.copyStyle(outline, endNode);
+ if (endNode.explodeClassName) { outline.className = endNode.explodeClassName; }
+ with(outline.style){
+ position = "absolute";
+ display = "none";
+ // border = "1px solid black";
+ }
+ dojo.body().appendChild(outline);
+
+ with(endNode.style){
+ visibility = "hidden";
+ display = "block";
+ }
+ var endCoords = h.toCoordinateObject(endNode, true);
+ with(endNode.style){
+ display = "none";
+ visibility = "visible";
+ }
+
+ var props = { opacity: { start: 0.5, end: 1.0 } };
+ dojo.lang.forEach(["height", "width", "top", "left"], function(type){
+ props[type] = { start: startCoords[type], end: endCoords[type] }
+ });
+
+ var anim = new dojo.lfx.propertyAnimation(outline,
+ props,
+ duration,
+ easing,
+ {
+ "beforeBegin": function(){
+ h.setDisplay(outline, "block");
+ },
+ "onEnd": function(){
+ h.setDisplay(endNode, "block");
+ outline.parentNode.removeChild(outline);
+ }
+ }
+ );
+
+ if(callback){
+ anim.connect("onEnd", function(){ callback(endNode, anim); });
+ }
+ return anim; // dojo.lfx.Animation
}
-if(dojo.lang.isArray(prop.start)){
-this.diffs[i]=null;
-}else{
-if(prop.start instanceof dojo.gfx.color.Color){
-prop.startRgb=prop.start.toRgb();
-prop.endRgb=prop.end.toRgb();
-}else{
-this.diffs[i]=prop.end-prop.start;
+
+dojo.lfx.html.implode = function(/*DOMNode*/ startNode,
+ /*DOMNode*/ end,
+ /*int?*/ duration,
+ /*Function?*/ easing,
+ /*Function?*/ callback){
+ // summary: Returns an animation that will
+ // startNode:
+ // end:
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ var h = dojo.html;
+ startNode = dojo.byId(startNode);
+ end = dojo.byId(end);
+ var startCoords = dojo.html.toCoordinateObject(startNode, true);
+ var endCoords = dojo.html.toCoordinateObject(end, true);
+
+ var outline = document.createElement("div");
+ dojo.html.copyStyle(outline, startNode);
+ if (startNode.explodeClassName) { outline.className = startNode.explodeClassName; }
+ dojo.html.setOpacity(outline, 0.3);
+ with(outline.style){
+ position = "absolute";
+ display = "none";
+ backgroundColor = h.getStyle(startNode, "background-color").toLowerCase();
+ }
+ dojo.body().appendChild(outline);
+
+ var props = { opacity: { start: 1.0, end: 0.5 } };
+ dojo.lang.forEach(["height", "width", "top", "left"], function(type){
+ props[type] = { start: startCoords[type], end: endCoords[type] }
+ });
+
+ var anim = new dojo.lfx.propertyAnimation(outline,
+ props,
+ duration,
+ easing,
+ {
+ "beforeBegin": function(){
+ dojo.html.hide(startNode);
+ dojo.html.show(outline);
+ },
+ "onEnd": function(){
+ outline.parentNode.removeChild(outline);
+ }
+ }
+ );
+
+ if(callback){
+ anim.connect("onEnd", function(){ callback(startNode, anim); });
+ }
+ return anim; // dojo.lfx.Animation
}
+
+dojo.lfx.html.highlight = function(/*DOMNode[]*/ nodes,
+ /*dojo.gfx.color.Color*/ startColor,
+ /*int?*/ duration,
+ /*Function?*/ easing,
+ /*Function?*/ callback){
+ // summary: Returns an animation that will set the background color
+ // of "nodes" to startColor and transition it to "nodes"
+ // original color.
+ // startColor: Color to transition from.
+ // duration: Duration of the animation in milliseconds.
+ // easing: An easing function.
+ // callback: Function to run at the end of the animation.
+ nodes = dojo.lfx.html._byId(nodes);
+ var anims = [];
+
+ dojo.lang.forEach(nodes, function(node){
+ var color = dojo.html.getBackgroundColor(node);
+ var bg = dojo.html.getStyle(node, "background-color").toLowerCase();
+ var bgImage = dojo.html.getStyle(node, "background-image");
+ var wasTransparent = (bg == "transparent" || bg == "rgba(0, 0, 0, 0)");
+ while(color.length > 3) { color.pop(); }
+
+ var rgb = new dojo.gfx.color.Color(startColor);
+ var endRgb = new dojo.gfx.color.Color(color);
+
+ var anim = dojo.lfx.propertyAnimation(node,
+ { "background-color": { start: rgb, end: endRgb } },
+ duration,
+ easing,
+ {
+ "beforeBegin": function(){
+ if(bgImage){
+ node.style.backgroundImage = "none";
+ }
+ node.style.backgroundColor = "rgb(" + rgb.toRgb().join(",") + ")";
+ },
+ "onEnd": function(){
+ if(bgImage){
+ node.style.backgroundImage = bgImage;
+ }
+ if(wasTransparent){
+ node.style.backgroundColor = "transparent";
+ }
+ if(callback){
+ callback(node, anim);
+ }
+ }
+ }
+ );
+
+ anims.push(anim);
+ });
+ return dojo.lfx.combine(anims); // dojo.lfx.Combine
}
-},this);
-this.getValue=function(n){
-var ret={};
-dojo.lang.forEach(this._properties,function(prop,i){
-var _3d7=null;
-if(dojo.lang.isArray(prop.start)){
-}else{
-if(prop.start instanceof dojo.gfx.color.Color){
-_3d7=(prop.units||"rgb")+"(";
-for(var j=0;j3){
-_448.pop();
-}
-var rgb=new dojo.gfx.color.Color(_442);
-var _44d=new dojo.gfx.color.Color(_448);
-var anim=dojo.lfx.propertyAnimation(node,{"background-color":{start:rgb,end:_44d}},_443,_444,{"beforeBegin":function(){
-if(_44a){
-node.style.backgroundImage="none";
-}
-node.style.backgroundColor="rgb("+rgb.toRgb().join(",")+")";
-},"onEnd":function(){
-if(_44a){
-node.style.backgroundImage=_44a;
-}
-if(_44b){
-node.style.backgroundColor="transparent";
-}
-if(_445){
-_445(node,anim);
-}
-}});
-_446.push(anim);
-});
-return dojo.lfx.combine(_446);
-};
-dojo.lfx.html.unhighlight=function(_44f,_450,_451,_452,_453){
-_44f=dojo.lfx.html._byId(_44f);
-var _454=[];
-dojo.lang.forEach(_44f,function(node){
-var _456=new dojo.gfx.color.Color(dojo.html.getBackgroundColor(node));
-var rgb=new dojo.gfx.color.Color(_450);
-var _458=dojo.html.getStyle(node,"background-image");
-var anim=dojo.lfx.propertyAnimation(node,{"background-color":{start:_456,end:rgb}},_451,_452,{"beforeBegin":function(){
-if(_458){
-node.style.backgroundImage="none";
-}
-node.style.backgroundColor="rgb("+_456.toRgb().join(",")+")";
-},"onEnd":function(){
-if(_453){
-_453(node,anim);
-}
-}});
-_454.push(anim);
-});
-return dojo.lfx.combine(_454);
-};
-dojo.lang.mixin(dojo.lfx,dojo.lfx.html);
+
+dojo.lang.mixin(dojo.lfx, dojo.lfx.html);
+
dojo.provide("dojo.lfx.*");
dojo.provide("dojo.lang.extras");
-dojo.lang.setTimeout=function(func,_45b){
-var _45c=window,_45d=2;
-if(!dojo.lang.isFunction(func)){
-_45c=func;
-func=_45b;
-_45b=arguments[2];
-_45d++;
+
+
+dojo.lang.setTimeout = function(/*Function*/func, /*int*/delay /*, ...*/){
+ // summary:
+ // Sets a timeout in milliseconds to execute a function in a given context
+ // with optional arguments.
+ //
+ // usage:
+ // setTimeout (Object context, function func, number delay[, arg1[, ...]]);
+ // setTimeout (function func, number delay[, arg1[, ...]]);
+
+ var context = window, argsStart = 2;
+ if(!dojo.lang.isFunction(func)){
+ context = func;
+ func = delay;
+ delay = arguments[2];
+ argsStart++;
+ }
+
+ if(dojo.lang.isString(func)){
+ func = context[func];
+ }
+
+ var args = [];
+ for (var i = argsStart; i < arguments.length; i++){
+ args.push(arguments[i]);
+ }
+ return dojo.global().setTimeout(function () { func.apply(context, args); }, delay); // int
}
-if(dojo.lang.isString(func)){
-func=_45c[func];
+
+dojo.lang.clearTimeout = function(/*int*/timer){
+ // summary: clears timer by number from the execution queue
+ dojo.global().clearTimeout(timer);
}
-var args=[];
-for(var i=_45d;i2)?args[0]:"after",precedence:"last",once:false,delay:null,rate:0,adviceMsg:false};
-switch(args.length){
-case 0:
-return;
-case 1:
-return;
-case 2:
-ao.srcFunc=args[0];
-ao.adviceFunc=args[1];
-break;
-case 3:
-if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isString(args[2]))){
-ao.adviceType="after";
-ao.srcObj=args[0];
-ao.srcFunc=args[1];
-ao.adviceFunc=args[2];
-}else{
-if((dl.isString(args[1]))&&(dl.isString(args[2]))){
-ao.srcFunc=args[1];
-ao.adviceFunc=args[2];
-}else{
-if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isFunction(args[2]))){
-ao.adviceType="after";
-ao.srcObj=args[0];
-ao.srcFunc=args[1];
-var _474=dl.nameAnonFunc(args[2],ao.adviceObj,_471);
-ao.adviceFunc=_474;
-}else{
-if((dl.isFunction(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))){
-ao.adviceType="after";
-ao.srcObj=dj_global;
-var _474=dl.nameAnonFunc(args[0],ao.srcObj,_471);
-ao.srcFunc=_474;
-ao.adviceObj=args[1];
-ao.adviceFunc=args[2];
+
+
+// TODO: connection filter functions
+// these are functions that accept a method invocation (like around
+// advice) and return a boolean based on it. That value determines
+// whether or not the connection proceeds. It could "feel" like around
+// advice for those who know what it is (calling proceed() or not),
+// but I think presenting it as a "filter" and/or calling it with the
+// function args and not the MethodInvocation might make it more
+// palletable to "normal" users than around-advice currently is
+// TODO: execution scope mangling
+// YUI's event facility by default executes listeners in the context
+// of the source object. This is very odd, but should probably be
+// supported as an option (both for the source and for the dest). It
+// can be thought of as a connection-specific hitch().
+// TODO: more resiliency for 4+ arguments to connect()
+
+dojo.event = new function(){
+ this._canTimeout = dojo.lang.isFunction(dj_global["setTimeout"])||dojo.lang.isAlien(dj_global["setTimeout"]);
+
+ // FIXME: where should we put this method (not here!)?
+ function interpolateArgs(args, searchForNames){
+ var dl = dojo.lang;
+ var ao = {
+ srcObj: dj_global,
+ srcFunc: null,
+ adviceObj: dj_global,
+ adviceFunc: null,
+ aroundObj: null,
+ aroundFunc: null,
+ adviceType: (args.length>2) ? args[0] : "after",
+ precedence: "last",
+ once: false,
+ delay: null,
+ rate: 0,
+ adviceMsg: false
+ };
+
+ switch(args.length){
+ case 0: return;
+ case 1: return;
+ case 2:
+ ao.srcFunc = args[0];
+ ao.adviceFunc = args[1];
+ break;
+ case 3:
+ if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isString(args[2]))){
+ ao.adviceType = "after";
+ ao.srcObj = args[0];
+ ao.srcFunc = args[1];
+ ao.adviceFunc = args[2];
+ }else if((dl.isString(args[1]))&&(dl.isString(args[2]))){
+ ao.srcFunc = args[1];
+ ao.adviceFunc = args[2];
+ }else if((dl.isObject(args[0]))&&(dl.isString(args[1]))&&(dl.isFunction(args[2]))){
+ ao.adviceType = "after";
+ ao.srcObj = args[0];
+ ao.srcFunc = args[1];
+ var tmpName = dl.nameAnonFunc(args[2], ao.adviceObj, searchForNames);
+ ao.adviceFunc = tmpName;
+ }else if((dl.isFunction(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))){
+ ao.adviceType = "after";
+ ao.srcObj = dj_global;
+ var tmpName = dl.nameAnonFunc(args[0], ao.srcObj, searchForNames);
+ ao.srcFunc = tmpName;
+ ao.adviceObj = args[1];
+ ao.adviceFunc = args[2];
+ }
+ break;
+ case 4:
+ if((dl.isObject(args[0]))&&(dl.isObject(args[2]))){
+ // we can assume that we've got an old-style "connect" from
+ // the sigslot school of event attachment. We therefore
+ // assume after-advice.
+ ao.adviceType = "after";
+ ao.srcObj = args[0];
+ ao.srcFunc = args[1];
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else if((dl.isString(args[0]))&&(dl.isString(args[1]))&&(dl.isObject(args[2]))){
+ ao.adviceType = args[0];
+ ao.srcObj = dj_global;
+ ao.srcFunc = args[1];
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else if((dl.isString(args[0]))&&(dl.isFunction(args[1]))&&(dl.isObject(args[2]))){
+ ao.adviceType = args[0];
+ ao.srcObj = dj_global;
+ var tmpName = dl.nameAnonFunc(args[1], dj_global, searchForNames);
+ ao.srcFunc = tmpName;
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else if((dl.isString(args[0]))&&(dl.isObject(args[1]))&&(dl.isString(args[2]))&&(dl.isFunction(args[3]))){
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ var tmpName = dl.nameAnonFunc(args[3], dj_global, searchForNames);
+ ao.adviceObj = dj_global;
+ ao.adviceFunc = tmpName;
+ }else if(dl.isObject(args[1])){
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = dj_global;
+ ao.adviceFunc = args[3];
+ }else if(dl.isObject(args[2])){
+ ao.srcObj = dj_global;
+ ao.srcFunc = args[1];
+ ao.adviceObj = args[2];
+ ao.adviceFunc = args[3];
+ }else{
+ ao.srcObj = ao.adviceObj = ao.aroundObj = dj_global;
+ ao.srcFunc = args[1];
+ ao.adviceFunc = args[2];
+ ao.aroundFunc = args[3];
+ }
+ break;
+ case 6:
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = args[3]
+ ao.adviceFunc = args[4];
+ ao.aroundFunc = args[5];
+ ao.aroundObj = dj_global;
+ break;
+ default:
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = args[3]
+ ao.adviceFunc = args[4];
+ ao.aroundObj = args[5];
+ ao.aroundFunc = args[6];
+ ao.once = args[7];
+ ao.delay = args[8];
+ ao.rate = args[9];
+ ao.adviceMsg = args[10];
+ break;
+ }
+
+ if(dl.isFunction(ao.aroundFunc)){
+ var tmpName = dl.nameAnonFunc(ao.aroundFunc, ao.aroundObj, searchForNames);
+ ao.aroundFunc = tmpName;
+ }
+
+ if(dl.isFunction(ao.srcFunc)){
+ ao.srcFunc = dl.getNameInObj(ao.srcObj, ao.srcFunc);
+ }
+
+ if(dl.isFunction(ao.adviceFunc)){
+ ao.adviceFunc = dl.getNameInObj(ao.adviceObj, ao.adviceFunc);
+ }
+
+ if((ao.aroundObj)&&(dl.isFunction(ao.aroundFunc))){
+ ao.aroundFunc = dl.getNameInObj(ao.aroundObj, ao.aroundFunc);
+ }
+
+ if(!ao.srcObj){
+ dojo.raise("bad srcObj for srcFunc: "+ao.srcFunc);
+ }
+ if(!ao.adviceObj){
+ dojo.raise("bad adviceObj for adviceFunc: "+ao.adviceFunc);
+ }
+
+ if(!ao.adviceFunc){
+ dojo.debug("bad adviceFunc for srcFunc: "+ao.srcFunc);
+ dojo.debugShallow(ao);
+ }
+
+ return ao;
+ }
+
+ this.connect = function(/*...*/){
+ // summary:
+ // dojo.event.connect is the glue that holds most Dojo-based
+ // applications together. Most combinations of arguments are
+ // supported, with the connect() method attempting to disambiguate
+ // the implied types of positional parameters. The following will
+ // all work:
+ // dojo.event.connect("globalFunctionName1", "globalFunctionName2");
+ // dojo.event.connect(functionReference1, functionReference2);
+ // dojo.event.connect("globalFunctionName1", functionReference2);
+ // dojo.event.connect(functionReference1, "globalFunctionName2");
+ // dojo.event.connect(scope1, "functionName1", "globalFunctionName2");
+ // dojo.event.connect("globalFunctionName1", scope2, "functionName2");
+ // dojo.event.connect(scope1, "functionName1", scope2, "functionName2");
+ // dojo.event.connect("after", scope1, "functionName1", scope2, "functionName2");
+ // dojo.event.connect("before", scope1, "functionName1", scope2, "functionName2");
+ // dojo.event.connect("around", scope1, "functionName1",
+ // scope2, "functionName2",
+ // aroundFunctionReference);
+ // dojo.event.connect("around", scope1, "functionName1",
+ // scope2, "functionName2",
+ // scope3, "aroundFunctionName");
+ // dojo.event.connect("before-around", scope1, "functionName1",
+ // scope2, "functionName2",
+ // aroundFunctionReference);
+ // dojo.event.connect("after-around", scope1, "functionName1",
+ // scope2, "functionName2",
+ // aroundFunctionReference);
+ // dojo.event.connect("after-around", scope1, "functionName1",
+ // scope2, "functionName2",
+ // scope3, "aroundFunctionName");
+ // dojo.event.connect("around", scope1, "functionName1",
+ // scope2, "functionName2",
+ // scope3, "aroundFunctionName", true, 30);
+ // dojo.event.connect("around", scope1, "functionName1",
+ // scope2, "functionName2",
+ // scope3, "aroundFunctionName", null, null, 10);
+ // adviceType:
+ // Optional. String. One of "before", "after", "around",
+ // "before-around", or "after-around". FIXME
+ // srcObj:
+ // the scope in which to locate/execute the named srcFunc. Along
+ // with srcFunc, this creates a way to dereference the function to
+ // call. So if the function in question is "foo.bar", the
+ // srcObj/srcFunc pair would be foo and "bar", where "bar" is a
+ // string and foo is an object reference.
+ // srcFunc:
+ // the name of the function to connect to. When it is executed,
+ // the listener being registered with this call will be called.
+ // The adviceType defines the call order between the source and
+ // the target functions.
+ // adviceObj:
+ // the scope in which to locate/execute the named adviceFunc.
+ // adviceFunc:
+ // the name of the function being conected to srcObj.srcFunc
+ // aroundObj:
+ // the scope in which to locate/execute the named aroundFunc.
+ // aroundFunc:
+ // the name of, or a reference to, the function that will be used
+ // to mediate the advice call. Around advice requires a special
+ // unary function that will be passed a "MethodInvocation" object.
+ // These objects have several important properties, namely:
+ // - args
+ // a mutable array of arguments to be passed into the
+ // wrapped function
+ // - proceed
+ // a function that "continues" the invocation. The result
+ // of this function is the return of the wrapped function.
+ // You can then manipulate this return before passing it
+ // back out (or take further action based on it).
+ // once:
+ // boolean that determines whether or not this connect() will
+ // create a new connection if an identical connect() has already
+ // been made. Defaults to "false".
+ // delay:
+ // an optional delay (in ms), as an integer, for dispatch of a
+ // listener after the source has been fired.
+ // rate:
+ // an optional rate throttling parameter (integer, in ms). When
+ // specified, this particular connection will not fire more than
+ // once in the interval specified by the rate
+ // adviceMsg:
+ // boolean. Should the listener have all the parameters passed in
+ // as a single argument?
+
+ /*
+ ao.adviceType = args[0];
+ ao.srcObj = args[1];
+ ao.srcFunc = args[2];
+ ao.adviceObj = args[3]
+ ao.adviceFunc = args[4];
+ ao.aroundObj = args[5];
+ ao.aroundFunc = args[6];
+ ao.once = args[7];
+ ao.delay = args[8];
+ ao.rate = args[9];
+ ao.adviceMsg = args[10];
+ */
+ if(arguments.length == 1){
+ var ao = arguments[0];
+ }else{
+ var ao = interpolateArgs(arguments, true);
+ }
+ if(dojo.lang.isString(ao.srcFunc) && (ao.srcFunc.toLowerCase() == "onkey") ){
+ if(dojo.render.html.ie){
+ ao.srcFunc = "onkeydown";
+ this.connect(ao);
+ }
+ ao.srcFunc = "onkeypress";
+ }
+
+
+ if(dojo.lang.isArray(ao.srcObj) && ao.srcObj!=""){
+ var tmpAO = {};
+ for(var x in ao){
+ tmpAO[x] = ao[x];
+ }
+ var mjps = [];
+ dojo.lang.forEach(ao.srcObj, function(src){
+ if((dojo.render.html.capable)&&(dojo.lang.isString(src))){
+ src = dojo.byId(src);
+ // dojo.debug(src);
+ }
+ tmpAO.srcObj = src;
+ // dojo.debug(tmpAO.srcObj, tmpAO.srcFunc);
+ // dojo.debug(tmpAO.adviceObj, tmpAO.adviceFunc);
+ mjps.push(dojo.event.connect.call(dojo.event, tmpAO));
+ });
+ return mjps;
+ }
+
+ // FIXME: just doing a "getForMethod()" seems to be enough to put this into infinite recursion!!
+ var mjp = dojo.event.MethodJoinPoint.getForMethod(ao.srcObj, ao.srcFunc);
+ if(ao.adviceFunc){
+ var mjp2 = dojo.event.MethodJoinPoint.getForMethod(ao.adviceObj, ao.adviceFunc);
+ }
+
+ mjp.kwAddAdvice(ao);
+
+ // advanced users might want to fsck w/ the join point manually
+ return mjp; // a MethodJoinPoint object
+ }
+
+ this.log = function(/*object or funcName*/ a1, /*funcName*/ a2){
+ // summary:
+ // a function that will wrap and log all calls to the specified
+ // a1.a2() function. If only a1 is passed, it'll be used as a
+ // function or function name on the global context. Logging will
+ // be sent to dojo.debug
+ // a1:
+ // if a2 is passed, this should be an object. If not, it can be a
+ // function or function name.
+ // a2:
+ // a function name
+ var kwArgs;
+ if((arguments.length == 1)&&(typeof a1 == "object")){
+ kwArgs = a1;
+ }else{
+ kwArgs = {
+ srcObj: a1,
+ srcFunc: a2
+ };
+ }
+ kwArgs.adviceFunc = function(){
+ var argsStr = [];
+ for(var x=0; x= this.jp_.around.length){
+ return this.jp_.object[this.jp_.methodname].apply(this.jp_.object, this.args);
+ // return this.jp_.run_before_after(this.object, this.args);
+ }else{
+ var ti = this.jp_.around[this.around_index];
+ var mobj = ti[0]||dj_global;
+ var meth = ti[1];
+ return mobj[meth].call(mobj, this);
+ }
+}
+
+
+dojo.event.MethodJoinPoint = function(/*Object*/obj, /*String*/funcName){
+ this.object = obj||dj_global;
+ this.methodname = funcName;
+ this.methodfunc = this.object[funcName];
+ this.squelch = false;
+ // this.before = [];
+ // this.after = [];
+ // this.around = [];
}
+
+dojo.event.MethodJoinPoint.getForMethod = function(/*Object*/obj, /*String*/funcName){
+ // summary:
+ // "static" class function for returning a MethodJoinPoint from a
+ // scoped function. If one doesn't exist, one is created.
+ // obj:
+ // the scope to search for the function in
+ // funcName:
+ // the name of the function to return a MethodJoinPoint for
+ if(!obj){ obj = dj_global; }
+ if(!obj[funcName]){
+ // supply a do-nothing method implementation
+ obj[funcName] = function(){};
+ if(!obj[funcName]){
+ // e.g. cannot add to inbuilt objects in IE6
+ dojo.raise("Cannot set do-nothing method on that object "+funcName);
+ }
+ }else if((!dojo.lang.isFunction(obj[funcName]))&&(!dojo.lang.isAlien(obj[funcName]))){
+ // FIXME: should we throw an exception here instead?
+ return null;
+ }
+ // we hide our joinpoint instance in obj[funcName + '$joinpoint']
+ var jpname = funcName + "$joinpoint";
+ var jpfuncname = funcName + "$joinpoint$method";
+ var joinpoint = obj[jpname];
+ if(!joinpoint){
+ var isNode = false;
+ if(dojo.event["browser"]){
+ if( (obj["attachEvent"])||
+ (obj["nodeType"])||
+ (obj["addEventListener"]) ){
+ isNode = true;
+ dojo.event.browser.addClobberNodeAttrs(obj, [jpname, jpfuncname, funcName]);
+ }
+ }
+ var origArity = obj[funcName].length;
+ obj[jpfuncname] = obj[funcName];
+ // joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, funcName);
+ joinpoint = obj[jpname] = new dojo.event.MethodJoinPoint(obj, jpfuncname);
+ obj[funcName] = function(){
+ var args = [];
+
+ if((isNode)&&(!arguments.length)){
+ var evt = null;
+ try{
+ if(obj.ownerDocument){
+ evt = obj.ownerDocument.parentWindow.event;
+ }else if(obj.documentElement){
+ evt = obj.documentElement.ownerDocument.parentWindow.event;
+ }else if(obj.event){ //obj is a window
+ evt = obj.event;
+ }else{
+ evt = window.event;
+ }
+ }catch(e){
+ evt = window.event;
+ }
+
+ if(evt){
+ args.push(dojo.event.browser.fixEvent(evt, this));
+ }
+ }else{
+ for(var x=0; x0)){
+ // pass a cloned array, if this event disconnects this event forEach on this.before wont work
+ dojo.lang.forEach(this.before.concat(new Array()), unRollSquelch);
+ }
+
+ var result;
+ try{
+ if((this["around"])&&(this.around.length>0)){
+ var mi = new dojo.event.MethodInvocation(this, obj, args);
+ result = mi.proceed();
+ }else if(this.methodfunc){
+ result = this.object[this.methodname].apply(this.object, args);
+ }
+ }catch(e){ if(!this.squelch){ dojo.raise(e); } }
+
+ if((this["after"])&&(this.after.length>0)){
+ // see comment on this.before above
+ dojo.lang.forEach(this.after.concat(new Array()), unRollSquelch);
+ }
+
+ return (this.methodfunc) ? result : null;
+ },
+
+ getArr: function(/*String*/kind){
+ // summary: return a list of listeners of the past "kind"
+ // kind:
+ // can be one of: "before", "after", "around", "before-around", or
+ // "after-around"
+ var type = "after";
+ // FIXME: we should be able to do this through props or Array.in()
+ if((typeof kind == "string")&&(kind.indexOf("before")!=-1)){
+ type = "before";
+ }else if(kind=="around"){
+ type = "around";
+ }
+ if(!this[type]){ this[type] = []; }
+ return this[type]; // Array
+ },
+
+ kwAddAdvice: function(/*Object*/args){
+ // summary:
+ // adds advice to the joinpoint with arguments in a map
+ // args:
+ // An object that can have the following properties:
+ // - adviceType
+ // - adviceObj
+ // - adviceFunc
+ // - aroundObj
+ // - aroundFunc
+ // - once
+ // - delay
+ // - rate
+ // - adviceMsg
+ this.addAdvice( args["adviceObj"], args["adviceFunc"],
+ args["aroundObj"], args["aroundFunc"],
+ args["adviceType"], args["precedence"],
+ args["once"], args["delay"], args["rate"],
+ args["adviceMsg"]);
+ },
+
+ addAdvice: function( thisAdviceObj, thisAdvice,
+ thisAroundObj, thisAround,
+ adviceType, precedence,
+ once, delay, rate, asMessage){
+ // summary:
+ // add advice to this joinpoint using positional parameters
+ // thisAdviceObj:
+ // the scope in which to locate/execute the named adviceFunc.
+ // thisAdviceFunc:
+ // the name of the function being conected
+ // thisAroundObj:
+ // the scope in which to locate/execute the named aroundFunc.
+ // thisAroundFunc:
+ // the name of the function that will be used to mediate the
+ // advice call.
+ // adviceType:
+ // Optional. String. One of "before", "after", "around",
+ // "before-around", or "after-around". FIXME
+ // once:
+ // boolean that determines whether or not this advice will create
+ // a new connection if an identical advice set has already been
+ // provided. Defaults to "false".
+ // delay:
+ // an optional delay (in ms), as an integer, for dispatch of a
+ // listener after the source has been fired.
+ // rate:
+ // an optional rate throttling parameter (integer, in ms). When
+ // specified, this particular connection will not fire more than
+ // once in the interval specified by the rate
+ // adviceMsg:
+ // boolean. Should the listener have all the parameters passed in
+ // as a single argument?
+ var arr = this.getArr(adviceType);
+ if(!arr){
+ dojo.raise("bad this: " + this);
+ }
+
+ var ao = [thisAdviceObj, thisAdvice, thisAroundObj, thisAround, delay, rate, asMessage];
+
+ if(once){
+ if(this.hasAdvice(thisAdviceObj, thisAdvice, adviceType, arr) >= 0){
+ return;
+ }
+ }
+
+ if(precedence == "first"){
+ arr.unshift(ao);
+ }else{
+ arr.push(ao);
+ }
+ },
+
+ hasAdvice: function(thisAdviceObj, thisAdvice, adviceType, arr){
+ // summary:
+ // returns the array index of the first existing connection
+ // betweened the passed advice and this joinpoint. Will be -1 if
+ // none exists.
+ // thisAdviceObj:
+ // the scope in which to locate/execute the named adviceFunc.
+ // thisAdviceFunc:
+ // the name of the function being conected
+ // adviceType:
+ // Optional. String. One of "before", "after", "around",
+ // "before-around", or "after-around". FIXME
+ // arr:
+ // Optional. The list of advices to search. Will be found via
+ // adviceType if not passed
+ if(!arr){ arr = this.getArr(adviceType); }
+ var ind = -1;
+ for(var x=0; x=this.jp_.around.length){
-return this.jp_.object[this.jp_.methodname].apply(this.jp_.object,this.args);
-}else{
-var ti=this.jp_.around[this.around_index];
-var mobj=ti[0]||dj_global;
-var meth=ti[1];
-return mobj[meth].call(mobj,this);
-}
-};
-dojo.event.MethodJoinPoint=function(obj,_496){
-this.object=obj||dj_global;
-this.methodname=_496;
-this.methodfunc=this.object[_496];
-this.squelch=false;
-};
-dojo.event.MethodJoinPoint.getForMethod=function(obj,_498){
-if(!obj){
-obj=dj_global;
-}
-if(!obj[_498]){
-obj[_498]=function(){
-};
-if(!obj[_498]){
-dojo.raise("Cannot set do-nothing method on that object "+_498);
-}
-}else{
-if((!dojo.lang.isFunction(obj[_498]))&&(!dojo.lang.isAlien(obj[_498]))){
-return null;
-}
-}
-var _499=_498+"$joinpoint";
-var _49a=_498+"$joinpoint$method";
-var _49b=obj[_499];
-if(!_49b){
-var _49c=false;
-if(dojo.event["browser"]){
-if((obj["attachEvent"])||(obj["nodeType"])||(obj["addEventListener"])){
-_49c=true;
-dojo.event.browser.addClobberNodeAttrs(obj,[_499,_49a,_498]);
-}
-}
-var _49d=obj[_498].length;
-obj[_49a]=obj[_498];
-_49b=obj[_499]=new dojo.event.MethodJoinPoint(obj,_49a);
-obj[_498]=function(){
-var args=[];
-if((_49c)&&(!arguments.length)){
-var evt=null;
-try{
-if(obj.ownerDocument){
-evt=obj.ownerDocument.parentWindow.event;
-}else{
-if(obj.documentElement){
-evt=obj.documentElement.ownerDocument.parentWindow.event;
-}else{
-if(obj.event){
-evt=obj.event;
-}else{
-evt=window.event;
-}
-}
-}
-}
-catch(e){
-evt=window.event;
-}
-if(evt){
-args.push(dojo.event.browser.fixEvent(evt,this));
-}
-}else{
-for(var x=0;x0)){
-dojo.lang.forEach(this.before.concat(new Array()),_4b5);
-}
-var _4b6;
-try{
-if((this["around"])&&(this.around.length>0)){
-var mi=new dojo.event.MethodInvocation(this,obj,args);
-_4b6=mi.proceed();
-}else{
-if(this.methodfunc){
-_4b6=this.object[this.methodname].apply(this.object,args);
-}
-}
-}
-catch(e){
-if(!this.squelch){
-dojo.raise(e);
-}
-}
-if((this["after"])&&(this.after.length>0)){
-dojo.lang.forEach(this.after.concat(new Array()),_4b5);
-}
-return (this.methodfunc)?_4b6:null;
-},getArr:function(kind){
-var type="after";
-if((typeof kind=="string")&&(kind.indexOf("before")!=-1)){
-type="before";
-}else{
-if(kind=="around"){
-type="around";
-}
-}
-if(!this[type]){
-this[type]=[];
-}
-return this[type];
-},kwAddAdvice:function(args){
-this.addAdvice(args["adviceObj"],args["adviceFunc"],args["aroundObj"],args["aroundFunc"],args["adviceType"],args["precedence"],args["once"],args["delay"],args["rate"],args["adviceMsg"]);
-},addAdvice:function(_4bb,_4bc,_4bd,_4be,_4bf,_4c0,once,_4c2,rate,_4c4){
-var arr=this.getArr(_4bf);
-if(!arr){
-dojo.raise("bad this: "+this);
-}
-var ao=[_4bb,_4bc,_4bd,_4be,_4c2,rate,_4c4];
-if(once){
-if(this.hasAdvice(_4bb,_4bc,_4bf,arr)>=0){
-return;
-}
-}
-if(_4c0=="first"){
-arr.unshift(ao);
-}else{
-arr.push(ao);
-}
-},hasAdvice:function(_4c7,_4c8,_4c9,arr){
-if(!arr){
-arr=this.getArr(_4c9);
-}
-var ind=-1;
-for(var x=0;x=0; i=i-1){
+ var el = na[i];
+ try{
+ if(el && el["__clobberAttrs__"]){
+ for(var j=0; j=0;i=i-1){
-var el=na[i];
-try{
-if(el&&el["__clobberAttrs__"]){
-for(var j=0;j= 65 && unifiedCharCode <= 90 && evt.shiftKey == false){
+ unifiedCharCode += 32;
+ }
+ if(unifiedCharCode >= 1 && unifiedCharCode <= 26 && evt.ctrlKey){
+ unifiedCharCode += 96; // 001-032 = ctrl+[a-z]
+ }
+ evt.key = String.fromCharCode(unifiedCharCode);
+ }
+ }
+ } else if(evt["type"] == "keypress"){
+ if(dojo.render.html.opera){
+ if(evt.which == 0){
+ evt.key = evt.keyCode;
+ }else if(evt.which > 0){
+ switch(evt.which){
+ case evt.KEY_SHIFT:
+ case evt.KEY_CTRL:
+ case evt.KEY_ALT:
+ case evt.KEY_CAPS_LOCK:
+ case evt.KEY_NUM_LOCK:
+ case evt.KEY_SCROLL_LOCK:
+ break;
+ case evt.KEY_PAUSE:
+ case evt.KEY_TAB:
+ case evt.KEY_BACKSPACE:
+ case evt.KEY_ENTER:
+ case evt.KEY_ESCAPE:
+ evt.key = evt.which;
+ break;
+ default:
+ var unifiedCharCode = evt.which;
+ if((evt.ctrlKey || evt.altKey || evt.metaKey) && (evt.which >= 65 && evt.which <= 90 && evt.shiftKey == false)){
+ unifiedCharCode += 32;
+ }
+ evt.key = String.fromCharCode(unifiedCharCode);
+ }
+ }
+ }else if(dojo.render.html.ie){ // catch some IE keys that are hard to get in keyDown
+ // key combinations were handled in onKeyDown
+ if(!evt.ctrlKey && !evt.altKey && evt.keyCode >= evt.KEY_SPACE){
+ evt.key = String.fromCharCode(evt.keyCode);
+ }
+ }else if(dojo.render.html.safari){
+ switch(evt.keyCode){
+ case 63232: evt.key = evt.KEY_UP_ARROW; break;
+ case 63233: evt.key = evt.KEY_DOWN_ARROW; break;
+ case 63234: evt.key = evt.KEY_LEFT_ARROW; break;
+ case 63235: evt.key = evt.KEY_RIGHT_ARROW; break;
+ default:
+ evt.key = evt.charCode > 0 ? String.fromCharCode(evt.charCode) : evt.keyCode;
+ }
+ }else{
+ evt.key = evt.charCode > 0 ? String.fromCharCode(evt.charCode) : evt.keyCode;
+ }
+ }
+ }
+ if(dojo.render.html.ie){
+ if(!evt.target){ evt.target = evt.srcElement; }
+ if(!evt.currentTarget){ evt.currentTarget = (sender ? sender : evt.srcElement); }
+ if(!evt.layerX){ evt.layerX = evt.offsetX; }
+ if(!evt.layerY){ evt.layerY = evt.offsetY; }
+ // FIXME: scroll position query is duped from dojo.html to avoid dependency on that entire module
+ // DONOT replace the following to use dojo.body(), in IE, document.documentElement should be used
+ // here rather than document.body
+ var doc = (evt.srcElement && evt.srcElement.ownerDocument) ? evt.srcElement.ownerDocument : document;
+ var docBody = ((dojo.render.html.ie55)||(doc["compatMode"] == "BackCompat")) ? doc.body : doc.documentElement;
+ if(!evt.pageX){ evt.pageX = evt.clientX + (docBody.scrollLeft || 0) }
+ if(!evt.pageY){ evt.pageY = evt.clientY + (docBody.scrollTop || 0) }
+ // mouseover
+ if(evt.type == "mouseover"){ evt.relatedTarget = evt.fromElement; }
+ // mouseout
+ if(evt.type == "mouseout"){ evt.relatedTarget = evt.toElement; }
+ this.currentEvent = evt;
+ evt.callListener = this.callListener;
+ evt.stopPropagation = this._stopPropagation;
+ evt.preventDefault = this._preventDefault;
+ }
+ return evt; // Event
+ }
+
+ this.stopEvent = function(/*Event*/evt){
+ // summary:
+ // prevents propigation and clobbers the default action of the
+ // passed event
+ // evt: Optional for IE. The native event object.
+ if(window.event){
+ evt.returnValue = false;
+ evt.cancelBubble = true;
+ }else{
+ evt.preventDefault();
+ evt.stopPropagation();
+ }
+ }
}
-catch(e){
-}
-try{
-window.onload=null;
-}
-catch(e){
-}
-try{
-window.onunload=null;
-}
-catch(e){
-}
-dojo._ie_clobber.clobberNodes=[];
-});
-}
-dojo.event.browser=new function(){
-var _4fd=0;
-this.normalizedEventName=function(_4fe){
-switch(_4fe){
-case "CheckboxStateChange":
-case "DOMAttrModified":
-case "DOMMenuItemActive":
-case "DOMMenuItemInactive":
-case "DOMMouseScroll":
-case "DOMNodeInserted":
-case "DOMNodeRemoved":
-case "RadioStateChange":
-return _4fe;
-break;
-default:
-return _4fe.toLowerCase();
-break;
-}
-};
-this.clean=function(node){
-if(dojo.render.html.ie){
-dojo._ie_clobber.clobber(node);
-}
-};
-this.addClobberNode=function(node){
-if(!dojo.render.html.ie){
-return;
-}
-if(!node["__doClobber__"]){
-node.__doClobber__=true;
-dojo._ie_clobber.clobberNodes.push(node);
-node.__clobberAttrs__=[];
-}
-};
-this.addClobberNodeAttrs=function(node,_502){
-if(!dojo.render.html.ie){
-return;
-}
-this.addClobberNode(node);
-for(var x=0;x<_502.length;x++){
-node.__clobberAttrs__.push(_502[x]);
-}
-};
-this.removeListener=function(node,_505,fp,_507){
-if(!_507){
-var _507=false;
-}
-_505=dojo.event.browser.normalizedEventName(_505);
-if((_505=="onkey")||(_505=="key")){
-if(dojo.render.html.ie){
-this.removeListener(node,"onkeydown",fp,_507);
-}
-_505="onkeypress";
-}
-if(_505.substr(0,2)=="on"){
-_505=_505.substr(2);
-}
-if(node.removeEventListener){
-node.removeEventListener(_505,fp,_507);
-}
-};
-this.addListener=function(node,_509,fp,_50b,_50c){
-if(!node){
-return;
-}
-if(!_50b){
-var _50b=false;
-}
-_509=dojo.event.browser.normalizedEventName(_509);
-if((_509=="onkey")||(_509=="key")){
-if(dojo.render.html.ie){
-this.addListener(node,"onkeydown",fp,_50b,_50c);
-}
-_509="onkeypress";
-}
-if(_509.substr(0,2)!="on"){
-_509="on"+_509;
-}
-if(!_50c){
-var _50d=function(evt){
-if(!evt){
-evt=window.event;
-}
-var ret=fp(dojo.event.browser.fixEvent(evt,this));
-if(_50b){
-dojo.event.browser.stopEvent(evt);
-}
-return ret;
-};
-}else{
-_50d=fp;
-}
-if(node.addEventListener){
-node.addEventListener(_509.substr(2),_50d,_50b);
-return _50d;
-}else{
-if(typeof node[_509]=="function"){
-var _510=node[_509];
-node[_509]=function(e){
-_510(e);
-return _50d(e);
-};
-}else{
-node[_509]=_50d;
-}
-if(dojo.render.html.ie){
-this.addClobberNodeAttrs(node,[_509]);
-}
-return _50d;
-}
-};
-this.isEvent=function(obj){
-return (typeof obj!="undefined")&&(typeof Event!="undefined")&&(obj.eventPhase);
-};
-this.currentEvent=null;
-this.callListener=function(_513,_514){
-if(typeof _513!="function"){
-dojo.raise("listener not a function: "+_513);
-}
-dojo.event.browser.currentEvent.currentTarget=_514;
-return _513.call(_514,dojo.event.browser.currentEvent);
-};
-this._stopPropagation=function(){
-dojo.event.browser.currentEvent.cancelBubble=true;
-};
-this._preventDefault=function(){
-dojo.event.browser.currentEvent.returnValue=false;
-};
-this.keys={KEY_BACKSPACE:8,KEY_TAB:9,KEY_CLEAR:12,KEY_ENTER:13,KEY_SHIFT:16,KEY_CTRL:17,KEY_ALT:18,KEY_PAUSE:19,KEY_CAPS_LOCK:20,KEY_ESCAPE:27,KEY_SPACE:32,KEY_PAGE_UP:33,KEY_PAGE_DOWN:34,KEY_END:35,KEY_HOME:36,KEY_LEFT_ARROW:37,KEY_UP_ARROW:38,KEY_RIGHT_ARROW:39,KEY_DOWN_ARROW:40,KEY_INSERT:45,KEY_DELETE:46,KEY_HELP:47,KEY_LEFT_WINDOW:91,KEY_RIGHT_WINDOW:92,KEY_SELECT:93,KEY_NUMPAD_0:96,KEY_NUMPAD_1:97,KEY_NUMPAD_2:98,KEY_NUMPAD_3:99,KEY_NUMPAD_4:100,KEY_NUMPAD_5:101,KEY_NUMPAD_6:102,KEY_NUMPAD_7:103,KEY_NUMPAD_8:104,KEY_NUMPAD_9:105,KEY_NUMPAD_MULTIPLY:106,KEY_NUMPAD_PLUS:107,KEY_NUMPAD_ENTER:108,KEY_NUMPAD_MINUS:109,KEY_NUMPAD_PERIOD:110,KEY_NUMPAD_DIVIDE:111,KEY_F1:112,KEY_F2:113,KEY_F3:114,KEY_F4:115,KEY_F5:116,KEY_F6:117,KEY_F7:118,KEY_F8:119,KEY_F9:120,KEY_F10:121,KEY_F11:122,KEY_F12:123,KEY_F13:124,KEY_F14:125,KEY_F15:126,KEY_NUM_LOCK:144,KEY_SCROLL_LOCK:145};
-this.revKeys=[];
-for(var key in this.keys){
-this.revKeys[this.keys[key]]=key;
-}
-this.fixEvent=function(evt,_517){
-if(!evt){
-if(window["event"]){
-evt=window.event;
-}
-}
-if((evt["type"])&&(evt["type"].indexOf("key")==0)){
-evt.keys=this.revKeys;
-for(var key in this.keys){
-evt[key]=this.keys[key];
-}
-if(evt["type"]=="keydown"&&dojo.render.html.ie){
-switch(evt.keyCode){
-case evt.KEY_SHIFT:
-case evt.KEY_CTRL:
-case evt.KEY_ALT:
-case evt.KEY_CAPS_LOCK:
-case evt.KEY_LEFT_WINDOW:
-case evt.KEY_RIGHT_WINDOW:
-case evt.KEY_SELECT:
-case evt.KEY_NUM_LOCK:
-case evt.KEY_SCROLL_LOCK:
-case evt.KEY_NUMPAD_0:
-case evt.KEY_NUMPAD_1:
-case evt.KEY_NUMPAD_2:
-case evt.KEY_NUMPAD_3:
-case evt.KEY_NUMPAD_4:
-case evt.KEY_NUMPAD_5:
-case evt.KEY_NUMPAD_6:
-case evt.KEY_NUMPAD_7:
-case evt.KEY_NUMPAD_8:
-case evt.KEY_NUMPAD_9:
-case evt.KEY_NUMPAD_PERIOD:
-break;
-case evt.KEY_NUMPAD_MULTIPLY:
-case evt.KEY_NUMPAD_PLUS:
-case evt.KEY_NUMPAD_ENTER:
-case evt.KEY_NUMPAD_MINUS:
-case evt.KEY_NUMPAD_DIVIDE:
-break;
-case evt.KEY_PAUSE:
-case evt.KEY_TAB:
-case evt.KEY_BACKSPACE:
-case evt.KEY_ENTER:
-case evt.KEY_ESCAPE:
-case evt.KEY_PAGE_UP:
-case evt.KEY_PAGE_DOWN:
-case evt.KEY_END:
-case evt.KEY_HOME:
-case evt.KEY_LEFT_ARROW:
-case evt.KEY_UP_ARROW:
-case evt.KEY_RIGHT_ARROW:
-case evt.KEY_DOWN_ARROW:
-case evt.KEY_INSERT:
-case evt.KEY_DELETE:
-case evt.KEY_F1:
-case evt.KEY_F2:
-case evt.KEY_F3:
-case evt.KEY_F4:
-case evt.KEY_F5:
-case evt.KEY_F6:
-case evt.KEY_F7:
-case evt.KEY_F8:
-case evt.KEY_F9:
-case evt.KEY_F10:
-case evt.KEY_F11:
-case evt.KEY_F12:
-case evt.KEY_F12:
-case evt.KEY_F13:
-case evt.KEY_F14:
-case evt.KEY_F15:
-case evt.KEY_CLEAR:
-case evt.KEY_HELP:
-evt.key=evt.keyCode;
-break;
-default:
-if(evt.ctrlKey||evt.altKey){
-var _519=evt.keyCode;
-if(_519>=65&&_519<=90&&evt.shiftKey==false){
-_519+=32;
-}
-if(_519>=1&&_519<=26&&evt.ctrlKey){
-_519+=96;
-}
-evt.key=String.fromCharCode(_519);
-}
-}
-}else{
-if(evt["type"]=="keypress"){
-if(dojo.render.html.opera){
-if(evt.which==0){
-evt.key=evt.keyCode;
-}else{
-if(evt.which>0){
-switch(evt.which){
-case evt.KEY_SHIFT:
-case evt.KEY_CTRL:
-case evt.KEY_ALT:
-case evt.KEY_CAPS_LOCK:
-case evt.KEY_NUM_LOCK:
-case evt.KEY_SCROLL_LOCK:
-break;
-case evt.KEY_PAUSE:
-case evt.KEY_TAB:
-case evt.KEY_BACKSPACE:
-case evt.KEY_ENTER:
-case evt.KEY_ESCAPE:
-evt.key=evt.which;
-break;
-default:
-var _519=evt.which;
-if((evt.ctrlKey||evt.altKey||evt.metaKey)&&(evt.which>=65&&evt.which<=90&&evt.shiftKey==false)){
-_519+=32;
-}
-evt.key=String.fromCharCode(_519);
-}
-}
-}
-}else{
-if(dojo.render.html.ie){
-if(!evt.ctrlKey&&!evt.altKey&&evt.keyCode>=evt.KEY_SPACE){
-evt.key=String.fromCharCode(evt.keyCode);
-}
-}else{
-if(dojo.render.html.safari){
-switch(evt.keyCode){
-case 63232:
-evt.key=evt.KEY_UP_ARROW;
-break;
-case 63233:
-evt.key=evt.KEY_DOWN_ARROW;
-break;
-case 63234:
-evt.key=evt.KEY_LEFT_ARROW;
-break;
-case 63235:
-evt.key=evt.KEY_RIGHT_ARROW;
-break;
-default:
-evt.key=evt.charCode>0?String.fromCharCode(evt.charCode):evt.keyCode;
-}
-}else{
-evt.key=evt.charCode>0?String.fromCharCode(evt.charCode):evt.keyCode;
-}
-}
-}
-}
-}
-}
-if(dojo.render.html.ie){
-if(!evt.target){
-evt.target=evt.srcElement;
-}
-if(!evt.currentTarget){
-evt.currentTarget=(_517?_517:evt.srcElement);
-}
-if(!evt.layerX){
-evt.layerX=evt.offsetX;
-}
-if(!evt.layerY){
-evt.layerY=evt.offsetY;
-}
-var doc=(evt.srcElement&&evt.srcElement.ownerDocument)?evt.srcElement.ownerDocument:document;
-var _51b=((dojo.render.html.ie55)||(doc["compatMode"]=="BackCompat"))?doc.body:doc.documentElement;
-if(!evt.pageX){
-evt.pageX=evt.clientX+(_51b.scrollLeft||0);
-}
-if(!evt.pageY){
-evt.pageY=evt.clientY+(_51b.scrollTop||0);
-}
-if(evt.type=="mouseover"){
-evt.relatedTarget=evt.fromElement;
-}
-if(evt.type=="mouseout"){
-evt.relatedTarget=evt.toElement;
-}
-this.currentEvent=evt;
-evt.callListener=this.callListener;
-evt.stopPropagation=this._stopPropagation;
-evt.preventDefault=this._preventDefault;
-}
-return evt;
-};
-this.stopEvent=function(evt){
-if(window.event){
-evt.returnValue=false;
-evt.cancelBubble=true;
-}else{
-evt.preventDefault();
-evt.stopPropagation();
-}
-};
-};
+
dojo.provide("dojo.event.*");
+
+/* This is the dojo logging facility, which is imported from nWidgets
+ (written by Alex Russell, CLA on file), which is patterned on the
+ Python logging module, which in turn has been heavily influenced by
+ log4j (execpt with some more pythonic choices, which we adopt as well).
+
+ While the dojo logging facilities do provide a set of familiar
+ interfaces, many of the details are changed to reflect the constraints
+ of the browser environment. Mainly, file and syslog-style logging
+ facilites are not provided, with HTTP POST and GET requests being the
+ only ways of getting data from the browser back to a server. Minimal
+ support for this (and XML serialization of logs) is provided, but may
+ not be of practical use in a deployment environment.
+
+ The Dojo logging classes are agnostic of any environment, and while
+ default loggers are provided for browser-based interpreter
+ environments, this file and the classes it define are explicitly
+ designed to be portable to command-line interpreters and other
+ ECMA-262v3 envrionments.
+
+ the logger needs to accomidate:
+ log "levels"
+ type identifiers
+ file?
+ message
+ tic/toc?
+
+ The logger should ALWAYS record:
+ time/date logged
+ message
+ type
+ level
+*/
+// TODO: conver documentation to javadoc style once we confirm that is our choice
+// TODO: define DTD for XML-formatted log messages
+// TODO: write XML Formatter class
+// TODO: write HTTP Handler which uses POST to send log lines/sections
+
+// Filename: LogCore.js
+// Purpose: a common logging infrastructure for dojo
+// Classes: dojo.logging, dojo.logging.Logger, dojo.logging.Record, dojo.logging.LogFilter
+// Global Objects: dojo.logging
+// Dependencies: none
+
dojo.provide("dojo.logging.Logger");
-dojo.logging.Record=function(lvl,msg){
-this.level=lvl;
-this.message="";
-this.msgArgs=[];
-this.time=new Date();
-if(dojo.lang.isArray(msg)){
-if(msg.length>0&&dojo.lang.isString(msg[0])){
-this.message=msg.shift();
+
+/*
+ A simple data structure class that stores information for and about
+ a logged event. Objects of this type are created automatically when
+ an event is logged and are the internal format in which information
+ about log events is kept.
+*/
+
+dojo.logging.Record = function(lvl, msg){
+ this.level = lvl;
+ this.message = "";
+ this.msgArgs = [];
+ this.time = new Date();
+
+ if(dojo.lang.isArray(msg)){
+ if(msg.length > 0 && dojo.lang.isString(msg[0])){
+ this.message=msg.shift();
+ }
+ this.msgArgs=msg;
+ }else{
+ this.message=msg;
+ }
+ // FIXME: what other information can we receive/discover here?
}
-this.msgArgs=msg;
-}else{
-this.message=msg;
+
+// an empty parent (abstract) class which concrete filters should inherit from.
+dojo.logging.LogFilter = function(loggerChain){
+ this.passChain = loggerChain || "";
+ this.filter = function(record){
+ // FIXME: need to figure out a way to enforce the loggerChain
+ // restriction
+ return true; // pass all records
+ }
}
-};
-dojo.logging.LogFilter=function(_51f){
-this.passChain=_51f||"";
-this.filter=function(_520){
-return true;
-};
-};
-dojo.logging.Logger=function(){
-this.cutOffLevel=0;
-this.propagate=true;
-this.parent=null;
-this.data=[];
-this.filters=[];
-this.handlers=[];
-};
-dojo.extend(dojo.logging.Logger,{argsToArr:function(args){
-var ret=[];
-for(var x=0;x=this.cutOffLevel;
-},getEffectiveLevel:function(){
-if((this.cutOffLevel==0)&&(this.parent)){
-return this.parent.getEffectiveLevel();
+
+dojo.extend(dojo.logging.Logger,{
+ argsToArr: function(args){
+ // utility function, reproduced from __util__ here to remove dependency
+ var ret = [];
+ for(var x=0; x= this.cutOffLevel;
+ },
+
+ getEffectiveLevel: function(){
+ if((this.cutOffLevel==0)&&(this.parent)){
+ return this.parent.getEffectiveLevel();
+ }
+ return this.cutOffLevel;
+ },
+
+ addFilter: function(flt){
+ this.filters.push(flt);
+ return this.filters.length-1;
+ },
+
+ removeFilterByIndex: function(fltIndex){
+ if(this.filters[fltIndex]){
+ delete this.filters[fltIndex];
+ return true;
+ }
+ return false;
+ },
+
+ removeFilter: function(fltRef){
+ for(var x=0; x=this.cutOffLevel)){
+ this.parent.log(lvl, msg);
+ return false;
+ }
+ // FIXME: need to call logging providers here!
+ this.handle(new dojo.logging.Record(lvl, msg));
+ return true;
+ },
+
+ // logger helpers
+ debug:function(msg){
+ return this.logType("DEBUG", this.argsToArr(arguments));
+ },
+
+ info: function(msg){
+ return this.logType("INFO", this.argsToArr(arguments));
+ },
+
+ warning: function(msg){
+ return this.logType("WARNING", this.argsToArr(arguments));
+ },
+
+ error: function(msg){
+ return this.logType("ERROR", this.argsToArr(arguments));
+ },
+
+ critical: function(msg){
+ return this.logType("CRITICAL", this.argsToArr(arguments));
+ },
+
+ exception: function(msg, e, squelch){
+ // FIXME: this needs to be modified to put the exception in the msg
+ // if we're on Moz, we can get the following from the exception object:
+ // lineNumber
+ // message
+ // fileName
+ // stack
+ // name
+ // on IE, we get:
+ // name
+ // message (from MDA?)
+ // number
+ // description (same as message!)
+ if(e){
+ var eparts = [e.name, (e.description||e.message)];
+ if(e.fileName){
+ eparts.push(e.fileName);
+ eparts.push("line "+e.lineNumber);
+ // eparts.push(e.stack);
+ }
+ msg += " "+eparts.join(" : ");
+ }
+
+ this.logType("ERROR", msg);
+ if(!squelch){
+ throw e;
+ }
+ },
+
+ logType: function(type, args){
+ return this.log.apply(this, [dojo.logging.log.getLevel(type),
+ args]);
+ },
+
+ warn:function(){
+ this.warning.apply(this,arguments);
+ },
+ err:function(){
+ this.error.apply(this,arguments);
+ },
+ crit:function(){
+ this.critical.apply(this,arguments);
+ }
+});
+
+// the Handler class
+dojo.logging.LogHandler = function(level){
+ this.cutOffLevel = (level) ? level : 0;
+ this.formatter = null; // FIXME: default formatter?
+ this.data = [];
+ this.filters = [];
}
-return this.cutOffLevel;
-},addFilter:function(flt){
-this.filters.push(flt);
-return this.filters.length-1;
-},removeFilterByIndex:function(_527){
-if(this.filters[_527]){
-delete this.filters[_527];
-return true;
+dojo.lang.extend(dojo.logging.LogHandler,{
+
+ setFormatter:function(formatter){
+ dojo.unimplemented("setFormatter");
+ },
+
+ flush:function(){},
+ close:function(){},
+ handleError:function(){},
+
+ handle:function(record){
+ if((this.filter(record))&&(record.level>=this.cutOffLevel)){
+ this.emit(record);
+ }
+ },
+
+ emit:function(record){
+ dojo.unimplemented("emit");
+ }
+});
+
+// set aliases since we don't want to inherit from dojo.logging.Logger
+void(function(){ // begin globals protection closure
+ var names = [
+ "setLevel", "addFilter", "removeFilterByIndex", "removeFilter",
+ "removeAllFilters", "filter"
+ ];
+ var tgt = dojo.logging.LogHandler.prototype;
+ var src = dojo.logging.Logger.prototype;
+ for(var x=0; x=this.cutOffLevel)){
-this.parent.log(lvl,msg);
-return false;
-}
-this.handle(new dojo.logging.Record(lvl,msg));
-return true;
-},debug:function(msg){
-return this.logType("DEBUG",this.argsToArr(arguments));
-},info:function(msg){
-return this.logType("INFO",this.argsToArr(arguments));
-},warning:function(msg){
-return this.logType("WARNING",this.argsToArr(arguments));
-},error:function(msg){
-return this.logType("ERROR",this.argsToArr(arguments));
-},critical:function(msg){
-return this.logType("CRITICAL",this.argsToArr(arguments));
-},exception:function(msg,e,_538){
-if(e){
-var _539=[e.name,(e.description||e.message)];
-if(e.fileName){
-_539.push(e.fileName);
-_539.push("line "+e.lineNumber);
-}
-msg+=" "+_539.join(" : ");
-}
-this.logType("ERROR",msg);
-if(!_538){
-throw e;
-}
-},logType:function(type,args){
-return this.log.apply(this,[dojo.logging.log.getLevel(type),args]);
-},warn:function(){
-this.warning.apply(this,arguments);
-},err:function(){
-this.error.apply(this,arguments);
-},crit:function(){
-this.critical.apply(this,arguments);
-}});
-dojo.logging.LogHandler=function(_53c){
-this.cutOffLevel=(_53c)?_53c:0;
-this.formatter=null;
-this.data=[];
-this.filters=[];
-};
-dojo.lang.extend(dojo.logging.LogHandler,{setFormatter:function(_53d){
-dojo.unimplemented("setFormatter");
-},flush:function(){
-},close:function(){
-},handleError:function(){
-},handle:function(_53e){
-if((this.filter(_53e))&&(_53e.level>=this.cutOffLevel)){
-this.emit(_53e);
-}
-},emit:function(_53f){
-dojo.unimplemented("emit");
-}});
-void (function(){
-var _540=["setLevel","addFilter","removeFilterByIndex","removeFilter","removeAllFilters","filter"];
-var tgt=dojo.logging.LogHandler.prototype;
-var src=dojo.logging.Logger.prototype;
-for(var x=0;x<_540.length;x++){
-tgt[_540[x]]=src[_540[x]];
-}
-})();
-dojo.logging.log=new dojo.logging.Logger();
-dojo.logging.log.levels=[{"name":"DEBUG","level":1},{"name":"INFO","level":2},{"name":"WARNING","level":3},{"name":"ERROR","level":4},{"name":"CRITICAL","level":5}];
-dojo.logging.log.loggers={};
-dojo.logging.log.getLogger=function(name){
-if(!this.loggers[name]){
-this.loggers[name]=new dojo.logging.Logger();
-this.loggers[name].parent=this;
-}
-return this.loggers[name];
-};
-dojo.logging.log.getLevelName=function(lvl){
-for(var x=0;xthis.numRecords){
-this.data.shift();
-}
-}
-}});
-dojo.logging.logQueueHandler=new dojo.logging.MemoryLogHandler(0,50,0,10000);
+
+dojo.lang.inherits(dojo.logging.MemoryLogHandler, dojo.logging.LogHandler);
+dojo.lang.extend(dojo.logging.MemoryLogHandler,{
+
+ emit:function(record){
+ if (!djConfig.isDebug) { return; }
+
+ var logStr = String(dojo.log.getLevelName(record.level)+": "
+ +record.time.toLocaleTimeString())+": "+record.message;
+ if(!dj_undef("println", dojo.hostenv)){
+ dojo.hostenv.println(logStr);
+ }
+
+ this.data.push(record);
+ if(this.numRecords != -1){
+ while(this.data.length>this.numRecords){
+ this.data.shift();
+ }
+ }
+ }
+});
+
+dojo.logging.logQueueHandler = new dojo.logging.MemoryLogHandler(0,50,0,10000);
+
dojo.logging.log.addHandler(dojo.logging.logQueueHandler);
-dojo.log=dojo.logging.log;
+dojo.log = dojo.logging.log;
+
dojo.provide("dojo.logging.*");
+
dojo.provide("dojo.string.common");
-dojo.string.trim=function(str,wh){
-if(!str.replace){
-return str;
+
+dojo.string.trim = function(/* string */str, /* integer? */wh){
+ // summary
+ // Trim whitespace from str. If wh > 0, trim from start, if wh < 0, trim from end, else both
+ if(!str.replace){ return str; }
+ if(!str.length){ return str; }
+ var re = (wh > 0) ? (/^\s+/) : (wh < 0) ? (/\s+$/) : (/^\s+|\s+$/g);
+ return str.replace(re, ""); // string
}
-if(!str.length){
-return str;
+
+dojo.string.trimStart = function(/* string */str) {
+ // summary
+ // Trim whitespace at the beginning of 'str'
+ return dojo.string.trim(str, 1); // string
}
-var re=(wh>0)?(/^\s+/):(wh<0)?(/\s+$/):(/^\s+|\s+$/g);
-return str.replace(re,"");
-};
-dojo.string.trimStart=function(str){
-return dojo.string.trim(str,1);
-};
-dojo.string.trimEnd=function(str){
-return dojo.string.trim(str,-1);
-};
-dojo.string.repeat=function(str,_557,_558){
-var out="";
-for(var i=0;i<_557;i++){
-out+=str;
-if(_558&&i<_557-1){
-out+=_558;
+
+dojo.string.trimEnd = function(/* string */str) {
+ // summary
+ // Trim whitespace at the end of 'str'
+ return dojo.string.trim(str, -1);
}
+
+dojo.string.repeat = function(/* string */str, /* integer */count, /* string? */separator) {
+ // summary
+ // Return 'str' repeated 'count' times, optionally placing 'separator' between each rep
+ var out = "";
+ for(var i = 0; i < count; i++) {
+ out += str;
+ if(separator && i < count - 1) {
+ out += separator;
+ }
+ }
+ return out; // string
}
-return out;
-};
-dojo.string.pad=function(str,len,c,dir){
-var out=String(str);
-if(!c){
-c="0";
+
+dojo.string.pad = function(/* string */str, /* integer */len/*=2*/, /* string */ c/*='0'*/, /* integer */dir/*=1*/) {
+ // summary
+ // Pad 'str' to guarantee that it is at least 'len' length with the character 'c' at either the
+ // start (dir=1) or end (dir=-1) of the string
+ var out = String(str);
+ if(!c) {
+ c = '0';
+ }
+ if(!dir) {
+ dir = 1;
+ }
+ while(out.length < len) {
+ if(dir > 0) {
+ out = c + out;
+ } else {
+ out += c;
+ }
+ }
+ return out; // string
}
-if(!dir){
-dir=1;
+
+dojo.string.padLeft = function(/* string */str, /* integer */len, /* string */c) {
+ // summary
+ // same as dojo.string.pad(str, len, c, 1)
+ return dojo.string.pad(str, len, c, 1); // string
}
-while(out.length0){
-out=c+out;
-}else{
-out+=c;
+
+dojo.string.padRight = function(/* string */str, /* integer */len, /* string */c) {
+ // summary
+ // same as dojo.string.pad(str, len, c, -1)
+ return dojo.string.pad(str, len, c, -1); // string
}
-}
-return out;
-};
-dojo.string.padLeft=function(str,len,c){
-return dojo.string.pad(str,len,c,1);
-};
-dojo.string.padRight=function(str,len,c){
-return dojo.string.pad(str,len,c,-1);
-};
+
dojo.provide("dojo.string");
+
dojo.provide("dojo.io.common");
-dojo.io.transports=[];
-dojo.io.hdlrFuncNames=["load","error","timeout"];
-dojo.io.Request=function(url,_567,_568,_569){
-if((arguments.length==1)&&(arguments[0].constructor==Object)){
-this.fromKwArgs(arguments[0]);
-}else{
-this.url=url;
-if(_567){
-this.mimetype=_567;
+
+/******************************************************************************
+ * Notes about dojo.io design:
+ *
+ * The dojo.io.* package has the unenviable task of making a lot of different
+ * types of I/O feel natural, despite a universal lack of good (or even
+ * reasonable!) I/O capability in the host environment. So lets pin this down
+ * a little bit further.
+ *
+ * Rhino:
+ * perhaps the best situation anywhere. Access to Java classes allows you
+ * to do anything one might want in terms of I/O, both synchronously and
+ * async. Can open TCP sockets and perform low-latency client/server
+ * interactions. HTTP transport is available through Java HTTP client and
+ * server classes. Wish it were always this easy.
+ *
+ * xpcshell:
+ * XPCOM for I/O.
+ *
+ * spidermonkey:
+ * S.O.L.
+ *
+ * Browsers:
+ * Browsers generally do not provide any useable filesystem access. We are
+ * therefore limited to HTTP for moving information to and from Dojo
+ * instances living in a browser.
+ *
+ * XMLHTTP:
+ * Sync or async, allows reading of arbitrary text files (including
+ * JS, which can then be eval()'d), writing requires server
+ * cooperation and is limited to HTTP mechanisms (POST and GET).
+ *
+ * ");
-}
-}
-catch(e){
-}
+ if((!djConfig["preventBackButtonFix"])&&(!dojo.hostenv.post_load_)){
+ document.write("");
+ }
+}catch(e){/* squelch */}
+
if(dojo.render.html.opera){
-dojo.debug("Opera is not supported with dojo.undo.browser, so back/forward detection will not work.");
+ dojo.debug("Opera is not supported with dojo.undo.browser, so back/forward detection will not work.");
}
-dojo.undo.browser={initialHref:window.location.href,initialHash:window.location.hash,moveForward:false,historyStack:[],forwardStack:[],historyIframe:null,bookmarkAnchor:null,locationTimer:null,setInitialState:function(args){
-this.initialState=this._createState(this.initialHref,args,this.initialHash);
-},addToHistory:function(args){
-this.forwardStack=[];
-var hash=null;
-var url=null;
-if(!this.historyIframe){
-this.historyIframe=window.frames["djhistory"];
+
+/* NOTES:
+ * Safari 1.2:
+ * back button "works" fine, however it's not possible to actually
+ * DETECT that you've moved backwards by inspecting window.location.
+ * Unless there is some other means of locating.
+ * FIXME: perhaps we can poll on history.length?
+ * Safari 2.0.3+ (and probably 1.3.2+):
+ * works fine, except when changeUrl is used. When changeUrl is used,
+ * Safari jumps all the way back to whatever page was shown before
+ * the page that uses dojo.undo.browser support.
+ * IE 5.5 SP2:
+ * back button behavior is macro. It does not move back to the
+ * previous hash value, but to the last full page load. This suggests
+ * that the iframe is the correct way to capture the back button in
+ * these cases.
+ * Don't test this page using local disk for MSIE. MSIE will not create
+ * a history list for iframe_history.html if served from a file: URL.
+ * The XML served back from the XHR tests will also not be properly
+ * created if served from local disk. Serve the test pages from a web
+ * server to test in that browser.
+ * IE 6.0:
+ * same behavior as IE 5.5 SP2
+ * Firefox 1.0+:
+ * the back button will return us to the previous hash on the same
+ * page, thereby not requiring an iframe hack, although we do then
+ * need to run a timer to detect inter-page movement.
+ */
+
+dojo.undo.browser = {
+ initialHref: window.location.href,
+ initialHash: window.location.hash,
+
+ moveForward: false,
+ historyStack: [],
+ forwardStack: [],
+ historyIframe: null,
+ bookmarkAnchor: null,
+ locationTimer: null,
+
+ /**
+ * setInitialState sets the state object and back callback for the very first page that is loaded.
+ * It is recommended that you call this method as part of an event listener that is registered via
+ * dojo.addOnLoad().
+ */
+ setInitialState: function(args){
+ this.initialState = this._createState(this.initialHref, args, this.initialHash);
+ },
+
+ //FIXME: Would like to support arbitrary back/forward jumps. Have to rework iframeLoaded among other things.
+ //FIXME: is there a slight race condition in moz using change URL with the timer check and when
+ // the hash gets set? I think I have seen a back/forward call in quick succession, but not consistent.
+ /**
+ * addToHistory takes one argument, and it is an object that defines the following functions:
+ * - To support getting back button notifications, the object argument should implement a
+ * function called either "back", "backButton", or "handle". The string "back" will be
+ * passed as the first and only argument to this callback.
+ * - To support getting forward button notifications, the object argument should implement a
+ * function called either "forward", "forwardButton", or "handle". The string "forward" will be
+ * passed as the first and only argument to this callback.
+ * - If you want the browser location string to change, define "changeUrl" on the object. If the
+ * value of "changeUrl" is true, then a unique number will be appended to the URL as a fragment
+ * identifier (http://some.domain.com/path#uniquenumber). If it is any other value that does
+ * not evaluate to false, that value will be used as the fragment identifier. For example,
+ * if changeUrl: 'page1', then the URL will look like: http://some.domain.com/path#page1
+ *
+ * Full example:
+ *
+ * dojo.undo.browser.addToHistory({
+ * back: function() { alert('back pressed'); },
+ * forward: function() { alert('forward pressed'); },
+ * changeUrl: true
+ * });
+ */
+ addToHistory: function(args){
+ //If addToHistory is called, then that means we prune the
+ //forward stack -- the user went back, then wanted to
+ //start a new forward path.
+ this.forwardStack = [];
+
+ var hash = null;
+ var url = null;
+ if(!this.historyIframe){
+ this.historyIframe = window.frames["djhistory"];
+ }
+ if(!this.bookmarkAnchor){
+ this.bookmarkAnchor = document.createElement("a");
+ dojo.body().appendChild(this.bookmarkAnchor);
+ this.bookmarkAnchor.style.display = "none";
+ }
+ if(args["changeUrl"]){
+ hash = "#"+ ((args["changeUrl"]!==true) ? args["changeUrl"] : (new Date()).getTime());
+
+ //If the current hash matches the new one, just replace the history object with
+ //this new one. It doesn't make sense to track different state objects for the same
+ //logical URL. This matches the browser behavior of only putting in one history
+ //item no matter how many times you click on the same #hash link, at least in Firefox
+ //and Safari, and there is no reliable way in those browsers to know if a #hash link
+ //has been clicked on multiple times. So making this the standard behavior in all browsers
+ //so that dojo.undo.browser's behavior is the same in all browsers.
+ if(this.historyStack.length == 0 && this.initialState.urlHash == hash){
+ this.initialState = this._createState(url, args, hash);
+ return;
+ }else if(this.historyStack.length > 0 && this.historyStack[this.historyStack.length - 1].urlHash == hash){
+ this.historyStack[this.historyStack.length - 1] = this._createState(url, args, hash);
+ return;
+ }
+
+ this.changingUrl = true;
+ setTimeout("window.location.href = '"+hash+"'; dojo.undo.browser.changingUrl = false;", 1);
+ this.bookmarkAnchor.href = hash;
+
+ if(dojo.render.html.ie){
+ url = this._loadIframeHistory();
+
+ var oldCB = args["back"]||args["backButton"]||args["handle"];
+
+ //The function takes handleName as a parameter, in case the
+ //callback we are overriding was "handle". In that case,
+ //we will need to pass the handle name to handle.
+ var tcb = function(handleName){
+ if(window.location.hash != ""){
+ setTimeout("window.location.href = '"+hash+"';", 1);
+ }
+ //Use apply to set "this" to args, and to try to avoid memory leaks.
+ oldCB.apply(this, [handleName]);
+ }
+
+ //Set interceptor function in the right place.
+ if(args["back"]){
+ args.back = tcb;
+ }else if(args["backButton"]){
+ args.backButton = tcb;
+ }else if(args["handle"]){
+ args.handle = tcb;
+ }
+
+ var oldFW = args["forward"]||args["forwardButton"]||args["handle"];
+
+ //The function takes handleName as a parameter, in case the
+ //callback we are overriding was "handle". In that case,
+ //we will need to pass the handle name to handle.
+ var tfw = function(handleName){
+ if(window.location.hash != ""){
+ window.location.href = hash;
+ }
+ if(oldFW){ // we might not actually have one
+ //Use apply to set "this" to args, and to try to avoid memory leaks.
+ oldFW.apply(this, [handleName]);
+ }
+ }
+
+ //Set interceptor function in the right place.
+ if(args["forward"]){
+ args.forward = tfw;
+ }else if(args["forwardButton"]){
+ args.forwardButton = tfw;
+ }else if(args["handle"]){
+ args.handle = tfw;
+ }
+
+ }else if(dojo.render.html.moz){
+ // start the timer
+ if(!this.locationTimer){
+ this.locationTimer = setInterval("dojo.undo.browser.checkLocation();", 200);
+ }
+ }
+ }else{
+ url = this._loadIframeHistory();
+ }
+
+ this.historyStack.push(this._createState(url, args, hash));
+ },
+
+ checkLocation: function(){
+ if (!this.changingUrl){
+ var hsl = this.historyStack.length;
+
+ if((window.location.hash == this.initialHash||window.location.href == this.initialHref)&&(hsl == 1)){
+ // FIXME: could this ever be a forward button?
+ // we can't clear it because we still need to check for forwards. Ugg.
+ // clearInterval(this.locationTimer);
+ this.handleBackButton();
+ return;
+ }
+
+ // first check to see if we could have gone forward. We always halt on
+ // a no-hash item.
+ if(this.forwardStack.length > 0){
+ if(this.forwardStack[this.forwardStack.length-1].urlHash == window.location.hash){
+ this.handleForwardButton();
+ return;
+ }
+ }
+
+ // ok, that didn't work, try someplace back in the history stack
+ if((hsl >= 2)&&(this.historyStack[hsl-2])){
+ if(this.historyStack[hsl-2].urlHash==window.location.hash){
+ this.handleBackButton();
+ return;
+ }
+ }
+ }
+ },
+
+ iframeLoaded: function(evt, ifrLoc){
+ if(!dojo.render.html.opera){
+ var query = this._getUrlQuery(ifrLoc.href);
+ if(query == null){
+ // alert("iframeLoaded");
+ // we hit the end of the history, so we should go back
+ if(this.historyStack.length == 1){
+ this.handleBackButton();
+ }
+ return;
+ }
+ if(this.moveForward){
+ // we were expecting it, so it's not either a forward or backward movement
+ this.moveForward = false;
+ return;
+ }
+
+ //Check the back stack first, since it is more likely.
+ //Note that only one step back or forward is supported.
+ if(this.historyStack.length >= 2 && query == this._getUrlQuery(this.historyStack[this.historyStack.length-2].url)){
+ this.handleBackButton();
+ }
+ else if(this.forwardStack.length > 0 && query == this._getUrlQuery(this.forwardStack[this.forwardStack.length-1].url)){
+ this.handleForwardButton();
+ }
+ }
+ },
+
+ handleBackButton: function(){
+ //The "current" page is always at the top of the history stack.
+ var current = this.historyStack.pop();
+ if(!current){ return; }
+ var last = this.historyStack[this.historyStack.length-1];
+ if(!last && this.historyStack.length == 0){
+ last = this.initialState;
+ }
+ if (last){
+ if(last.kwArgs["back"]){
+ last.kwArgs["back"]();
+ }else if(last.kwArgs["backButton"]){
+ last.kwArgs["backButton"]();
+ }else if(last.kwArgs["handle"]){
+ last.kwArgs.handle("back");
+ }
+ }
+ this.forwardStack.push(current);
+ },
+
+ handleForwardButton: function(){
+ var last = this.forwardStack.pop();
+ if(!last){ return; }
+ if(last.kwArgs["forward"]){
+ last.kwArgs.forward();
+ }else if(last.kwArgs["forwardButton"]){
+ last.kwArgs.forwardButton();
+ }else if(last.kwArgs["handle"]){
+ last.kwArgs.handle("forward");
+ }
+ this.historyStack.push(last);
+ },
+
+ _createState: function(url, args, hash){
+ return {"url": url, "kwArgs": args, "urlHash": hash};
+ },
+
+ _getUrlQuery: function(url){
+ var segments = url.split("?");
+ if (segments.length < 2){
+ return null;
+ }
+ else{
+ return segments[1];
+ }
+ },
+
+ _loadIframeHistory: function(){
+ var url = dojo.hostenv.getBaseScriptUri()+"iframe_history.html?"+(new Date()).getTime();
+ this.moveForward = true;
+ dojo.io.setIFrameSrc(this.historyIframe, url, false);
+ return url;
+ }
}
-if(!this.bookmarkAnchor){
-this.bookmarkAnchor=document.createElement("a");
-dojo.body().appendChild(this.bookmarkAnchor);
-this.bookmarkAnchor.style.display="none";
-}
-if(args["changeUrl"]){
-hash="#"+((args["changeUrl"]!==true)?args["changeUrl"]:(new Date()).getTime());
-if(this.historyStack.length==0&&this.initialState.urlHash==hash){
-this.initialState=this._createState(url,args,hash);
-return;
-}else{
-if(this.historyStack.length>0&&this.historyStack[this.historyStack.length-1].urlHash==hash){
-this.historyStack[this.historyStack.length-1]=this._createState(url,args,hash);
-return;
-}
-}
-this.changingUrl=true;
-setTimeout("window.location.href = '"+hash+"'; dojo.undo.browser.changingUrl = false;",1);
-this.bookmarkAnchor.href=hash;
-if(dojo.render.html.ie){
-url=this._loadIframeHistory();
-var _5d0=args["back"]||args["backButton"]||args["handle"];
-var tcb=function(_5d2){
-if(window.location.hash!=""){
-setTimeout("window.location.href = '"+hash+"';",1);
-}
-_5d0.apply(this,[_5d2]);
-};
-if(args["back"]){
-args.back=tcb;
-}else{
-if(args["backButton"]){
-args.backButton=tcb;
-}else{
-if(args["handle"]){
-args.handle=tcb;
-}
-}
-}
-var _5d3=args["forward"]||args["forwardButton"]||args["handle"];
-var tfw=function(_5d5){
-if(window.location.hash!=""){
-window.location.href=hash;
-}
-if(_5d3){
-_5d3.apply(this,[_5d5]);
-}
-};
-if(args["forward"]){
-args.forward=tfw;
-}else{
-if(args["forwardButton"]){
-args.forwardButton=tfw;
-}else{
-if(args["handle"]){
-args.handle=tfw;
-}
-}
-}
-}else{
-if(dojo.render.html.moz){
-if(!this.locationTimer){
-this.locationTimer=setInterval("dojo.undo.browser.checkLocation();",200);
-}
-}
-}
-}else{
-url=this._loadIframeHistory();
-}
-this.historyStack.push(this._createState(url,args,hash));
-},checkLocation:function(){
-if(!this.changingUrl){
-var hsl=this.historyStack.length;
-if((window.location.hash==this.initialHash||window.location.href==this.initialHref)&&(hsl==1)){
-this.handleBackButton();
-return;
-}
-if(this.forwardStack.length>0){
-if(this.forwardStack[this.forwardStack.length-1].urlHash==window.location.hash){
-this.handleForwardButton();
-return;
-}
-}
-if((hsl>=2)&&(this.historyStack[hsl-2])){
-if(this.historyStack[hsl-2].urlHash==window.location.hash){
-this.handleBackButton();
-return;
-}
-}
-}
-},iframeLoaded:function(evt,_5d8){
-if(!dojo.render.html.opera){
-var _5d9=this._getUrlQuery(_5d8.href);
-if(_5d9==null){
-if(this.historyStack.length==1){
-this.handleBackButton();
-}
-return;
-}
-if(this.moveForward){
-this.moveForward=false;
-return;
-}
-if(this.historyStack.length>=2&&_5d9==this._getUrlQuery(this.historyStack[this.historyStack.length-2].url)){
-this.handleBackButton();
-}else{
-if(this.forwardStack.length>0&&_5d9==this._getUrlQuery(this.forwardStack[this.forwardStack.length-1].url)){
-this.handleForwardButton();
-}
-}
-}
-},handleBackButton:function(){
-var _5da=this.historyStack.pop();
-if(!_5da){
-return;
-}
-var last=this.historyStack[this.historyStack.length-1];
-if(!last&&this.historyStack.length==0){
-last=this.initialState;
-}
-if(last){
-if(last.kwArgs["back"]){
-last.kwArgs["back"]();
-}else{
-if(last.kwArgs["backButton"]){
-last.kwArgs["backButton"]();
-}else{
-if(last.kwArgs["handle"]){
-last.kwArgs.handle("back");
-}
-}
-}
-}
-this.forwardStack.push(_5da);
-},handleForwardButton:function(){
-var last=this.forwardStack.pop();
-if(!last){
-return;
-}
-if(last.kwArgs["forward"]){
-last.kwArgs.forward();
-}else{
-if(last.kwArgs["forwardButton"]){
-last.kwArgs.forwardButton();
-}else{
-if(last.kwArgs["handle"]){
-last.kwArgs.handle("forward");
-}
-}
-}
-this.historyStack.push(last);
-},_createState:function(url,args,hash){
-return {"url":url,"kwArgs":args,"urlHash":hash};
-},_getUrlQuery:function(url){
-var _5e1=url.split("?");
-if(_5e1.length<2){
-return null;
-}else{
-return _5e1[1];
-}
-},_loadIframeHistory:function(){
-var url=dojo.hostenv.getBaseScriptUri()+"iframe_history.html?"+(new Date()).getTime();
-this.moveForward=true;
-dojo.io.setIFrameSrc(this.historyIframe,url,false);
-return url;
-}};
+
dojo.provide("dojo.io.BrowserIO");
-dojo.io.checkChildrenForFile=function(node){
-var _5e4=false;
-var _5e5=node.getElementsByTagName("input");
-dojo.lang.forEach(_5e5,function(_5e6){
-if(_5e4){
-return;
+
+
+dojo.io.checkChildrenForFile = function(node){
+ var hasFile = false;
+ var inputs = node.getElementsByTagName("input");
+ dojo.lang.forEach(inputs, function(input){
+ if(hasFile){ return; }
+ if(input.getAttribute("type")=="file"){
+ hasFile = true;
+ }
+ });
+ return hasFile;
}
-if(_5e6.getAttribute("type")=="file"){
-_5e4=true;
+
+dojo.io.formHasFile = function(formNode){
+ return dojo.io.checkChildrenForFile(formNode);
}
+
+dojo.io.updateNode = function(node, urlOrArgs){
+ node = dojo.byId(node);
+ var args = urlOrArgs;
+ if(dojo.lang.isString(urlOrArgs)){
+ args = { url: urlOrArgs };
+ }
+ args.mimetype = "text/html";
+ args.load = function(t, d, e){
+ while(node.firstChild){
+ if(dojo["event"]){
+ try{
+ dojo.event.browser.clean(node.firstChild);
+ }catch(e){}
+ }
+ node.removeChild(node.firstChild);
+ }
+ node.innerHTML = d;
+ };
+ dojo.io.bind(args);
+}
+
+dojo.io.formFilter = function(node) {
+ var type = (node.type||"").toLowerCase();
+ return !node.disabled && node.name
+ && !dojo.lang.inArray(["file", "submit", "image", "reset", "button"], type);
+}
+
+// TODO: Move to htmlUtils
+dojo.io.encodeForm = function(formNode, encoding, formFilter){
+ if((!formNode)||(!formNode.tagName)||(!formNode.tagName.toLowerCase() == "form")){
+ dojo.raise("Attempted to encode a non-form element.");
+ }
+ if(!formFilter) { formFilter = dojo.io.formFilter; }
+ var enc = /utf/i.test(encoding||"") ? encodeURIComponent : dojo.string.encodeAscii;
+ var values = [];
+
+ for(var i = 0; i < formNode.elements.length; i++){
+ var elm = formNode.elements[i];
+ if(!elm || elm.tagName.toLowerCase() == "fieldset" || !formFilter(elm)) { continue; }
+ var name = enc(elm.name);
+ var type = elm.type.toLowerCase();
+
+ if(type == "select-multiple"){
+ for(var j = 0; j < elm.options.length; j++){
+ if(elm.options[j].selected) {
+ values.push(name + "=" + enc(elm.options[j].value));
+ }
+ }
+ }else if(dojo.lang.inArray(["radio", "checkbox"], type)){
+ if(elm.checked){
+ values.push(name + "=" + enc(elm.value));
+ }
+ }else{
+ values.push(name + "=" + enc(elm.value));
+ }
+ }
+
+ // now collect input type="image", which doesn't show up in the elements array
+ var inputs = formNode.getElementsByTagName("input");
+ for(var i = 0; i < inputs.length; i++) {
+ var input = inputs[i];
+ if(input.type.toLowerCase() == "image" && input.form == formNode
+ && formFilter(input)) {
+ var name = enc(input.name);
+ values.push(name + "=" + enc(input.value));
+ values.push(name + ".x=0");
+ values.push(name + ".y=0");
+ }
+ }
+ return values.join("&") + "&";
+}
+
+dojo.io.FormBind = function(args) {
+ this.bindArgs = {};
+
+ if(args && args.formNode) {
+ this.init(args);
+ } else if(args) {
+ this.init({formNode: args});
+ }
+}
+dojo.lang.extend(dojo.io.FormBind, {
+ form: null,
+
+ bindArgs: null,
+
+ clickedButton: null,
+
+ init: function(args) {
+ var form = dojo.byId(args.formNode);
+
+ if(!form || !form.tagName || form.tagName.toLowerCase() != "form") {
+ throw new Error("FormBind: Couldn't apply, invalid form");
+ } else if(this.form == form) {
+ return;
+ } else if(this.form) {
+ throw new Error("FormBind: Already applied to a form");
+ }
+
+ dojo.lang.mixin(this.bindArgs, args);
+ this.form = form;
+
+ this.connect(form, "onsubmit", "submit");
+
+ for(var i = 0; i < form.elements.length; i++) {
+ var node = form.elements[i];
+ if(node && node.type && dojo.lang.inArray(["submit", "button"], node.type.toLowerCase())) {
+ this.connect(node, "onclick", "click");
+ }
+ }
+
+ var inputs = form.getElementsByTagName("input");
+ for(var i = 0; i < inputs.length; i++) {
+ var input = inputs[i];
+ if(input.type.toLowerCase() == "image" && input.form == form) {
+ this.connect(input, "onclick", "click");
+ }
+ }
+ },
+
+ onSubmit: function(form) {
+ return true;
+ },
+
+ submit: function(e) {
+ e.preventDefault();
+ if(this.onSubmit(this.form)) {
+ dojo.io.bind(dojo.lang.mixin(this.bindArgs, {
+ formFilter: dojo.lang.hitch(this, "formFilter")
+ }));
+ }
+ },
+
+ click: function(e) {
+ var node = e.currentTarget;
+ if(node.disabled) { return; }
+ this.clickedButton = node;
+ },
+
+ formFilter: function(node) {
+ var type = (node.type||"").toLowerCase();
+ var accept = false;
+ if(node.disabled || !node.name) {
+ accept = false;
+ } else if(dojo.lang.inArray(["submit", "button", "image"], type)) {
+ if(!this.clickedButton) { this.clickedButton = node; }
+ accept = node == this.clickedButton;
+ } else {
+ accept = !dojo.lang.inArray(["file", "submit", "reset", "button"], type);
+ }
+ return accept;
+ },
+
+ // in case you don't have dojo.event.* pulled in
+ connect: function(srcObj, srcFcn, targetFcn) {
+ if(dojo.evalObjPath("dojo.event.connect")) {
+ dojo.event.connect(srcObj, srcFcn, this, targetFcn);
+ } else {
+ var fcn = dojo.lang.hitch(this, targetFcn);
+ srcObj[srcFcn] = function(e) {
+ if(!e) { e = window.event; }
+ if(!e.currentTarget) { e.currentTarget = e.srcElement; }
+ if(!e.preventDefault) { e.preventDefault = function() { window.event.returnValue = false; } }
+ fcn(e);
+ }
+ }
+ }
});
-return _5e4;
-};
-dojo.io.formHasFile=function(_5e7){
-return dojo.io.checkChildrenForFile(_5e7);
-};
-dojo.io.updateNode=function(node,_5e9){
-node=dojo.byId(node);
-var args=_5e9;
-if(dojo.lang.isString(_5e9)){
-args={url:_5e9};
-}
-args.mimetype="text/html";
-args.load=function(t,d,e){
-while(node.firstChild){
-if(dojo["event"]){
-try{
-dojo.event.browser.clean(node.firstChild);
-}
-catch(e){
-}
-}
-node.removeChild(node.firstChild);
-}
-node.innerHTML=d;
-};
-dojo.io.bind(args);
-};
-dojo.io.formFilter=function(node){
-var type=(node.type||"").toLowerCase();
-return !node.disabled&&node.name&&!dojo.lang.inArray(["file","submit","image","reset","button"],type);
-};
-dojo.io.encodeForm=function(_5f0,_5f1,_5f2){
-if((!_5f0)||(!_5f0.tagName)||(!_5f0.tagName.toLowerCase()=="form")){
-dojo.raise("Attempted to encode a non-form element.");
-}
-if(!_5f2){
-_5f2=dojo.io.formFilter;
-}
-var enc=/utf/i.test(_5f1||"")?encodeURIComponent:dojo.string.encodeAscii;
-var _5f4=[];
-for(var i=0;i<_5f0.elements.length;i++){
-var elm=_5f0.elements[i];
-if(!elm||elm.tagName.toLowerCase()=="fieldset"||!_5f2(elm)){
-continue;
-}
-var name=enc(elm.name);
-var type=elm.type.toLowerCase();
-if(type=="select-multiple"){
-for(var j=0;j=200)&&(http.status<300))||(http.status==304)||(location.protocol=="file:"&&(http.status==0||http.status==undefined))||(location.protocol=="chrome:"&&(http.status==0||http.status==undefined))){
-var ret;
-if(_61b.method.toLowerCase()=="head"){
-var _621=http.getAllResponseHeaders();
-ret={};
-ret.toString=function(){
-return _621;
-};
-var _622=_621.split(/[\r\n]+/g);
-for(var i=0;i<_622.length;i++){
-var pair=_622[i].match(/^([^:]+)\s*:\s*(.+)$/i);
-if(pair){
-ret[pair[1]]=pair[2];
-}
-}
-}else{
-if(_61b.mimetype=="text/javascript"){
-try{
-ret=dj_eval(http.responseText);
-}
-catch(e){
-dojo.debug(e);
-dojo.debug(http.responseText);
-ret=null;
-}
-}else{
-if(_61b.mimetype=="text/json"||_61b.mimetype=="application/json"){
-try{
-ret=dj_eval("("+http.responseText+")");
-}
-catch(e){
-dojo.debug(e);
-dojo.debug(http.responseText);
-ret=false;
-}
-}else{
-if((_61b.mimetype=="application/xml")||(_61b.mimetype=="text/xml")){
-ret=http.responseXML;
-if(!ret||typeof ret=="string"||!http.getResponseHeader("Content-Type")){
-ret=dojo.dom.createDocumentFromText(http.responseText);
-}
-}else{
-ret=http.responseText;
-}
-}
-}
-}
-if(_61f){
-addToCache(url,_61e,_61b.method,http);
-}
-_61b[(typeof _61b.load=="function")?"load":"handle"]("load",ret,http,_61b);
-}else{
-var _625=new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText);
-_61b[(typeof _61b.error=="function")?"error":"handle"]("error",_625,http,_61b);
-}
-}
-function setHeaders(http,_627){
-if(_627["headers"]){
-for(var _628 in _627["headers"]){
-if(_628.toLowerCase()=="content-type"&&!_627["contentType"]){
-_627["contentType"]=_627["headers"][_628];
-}else{
-http.setRequestHeader(_628,_627["headers"][_628]);
-}
-}
-}
-}
-this.inFlight=[];
-this.inFlightTimer=null;
-this.startWatchingInFlight=function(){
-if(!this.inFlightTimer){
-this.inFlightTimer=setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();",10);
-}
-};
-this.watchInFlight=function(){
-var now=null;
-if(!dojo.hostenv._blockAsync&&!_60f._blockAsync){
-for(var x=this.inFlight.length-1;x>=0;x--){
-try{
-var tif=this.inFlight[x];
-if(!tif||tif.http._aborted||!tif.http.readyState){
-this.inFlight.splice(x,1);
-continue;
-}
-if(4==tif.http.readyState){
-this.inFlight.splice(x,1);
-doLoad(tif.req,tif.http,tif.url,tif.query,tif.useCache);
-}else{
-if(tif.startTime){
-if(!now){
-now=(new Date()).getTime();
-}
-if(tif.startTime+(tif.req.timeoutSeconds*1000)-1){
-dojo.debug("Warning: dojo.io.bind: stripping hash values from url:",url);
-url=url.split("#")[0];
-}
-if(_62f["file"]){
-_62f.method="post";
-}
-if(!_62f["method"]){
-_62f.method="get";
-}
-if(_62f.method.toLowerCase()=="get"){
-_62f.multipart=false;
-}else{
-if(_62f["file"]){
-_62f.multipart=true;
-}else{
-if(!_62f["multipart"]){
-_62f.multipart=false;
-}
-}
-}
-if(_62f["backButton"]||_62f["back"]||_62f["changeUrl"]){
-dojo.undo.browser.addToHistory(_62f);
-}
-var _634=_62f["content"]||{};
-if(_62f.sendTransport){
-_634["dojo.transport"]="xmlhttp";
-}
-do{
-if(_62f.postContent){
-_631=_62f.postContent;
-break;
-}
-if(_634){
-_631+=dojo.io.argsFromMap(_634,_62f.encoding);
-}
-if(_62f.method.toLowerCase()=="get"||!_62f.multipart){
-break;
-}
-var t=[];
-if(_631.length){
-var q=_631.split("&");
-for(var i=0;i-1?"&":"?")+_631;
-}
-if(_63b){
-_641+=(dojo.string.endsWithAny(_641,"?","&")?"":(_641.indexOf("?")>-1?"&":"?"))+"dojo.preventCache="+new Date().valueOf();
-}
-if(!_62f.user){
-http.open(_62f.method.toUpperCase(),_641,_63a);
-}else{
-http.open(_62f.method.toUpperCase(),_641,_63a,_62f.user,_62f.password);
-}
-setHeaders(http,_62f);
-try{
-http.send(null);
-}
-catch(e){
-if(typeof http.abort=="function"){
-http.abort();
-}
-doLoad(_62f,{status:404},url,_631,_63c);
-}
-}
-if(!_63a){
-doLoad(_62f,http,url,_631,_63c);
-_60f._blockAsync=false;
-}
-_62f.abort=function(){
-try{
-http._aborted=true;
-}
-catch(e){
-}
-return http.abort();
-};
-return;
-};
-dojo.io.transports.addTransport("XMLHTTPTransport");
-};
+
+dojo.io.XMLHTTPTransport = new function(){
+ var _this = this;
+
+ var _cache = {}; // FIXME: make this public? do we even need to?
+ this.useCache = false; // if this is true, we'll cache unless kwArgs.useCache = false
+ this.preventCache = false; // if this is true, we'll always force GET requests to cache
+
+ // FIXME: Should this even be a function? or do we just hard code it in the next 2 functions?
+ function getCacheKey(url, query, method) {
+ return url + "|" + query + "|" + method.toLowerCase();
+ }
+
+ function addToCache(url, query, method, http) {
+ _cache[getCacheKey(url, query, method)] = http;
+ }
+
+ function getFromCache(url, query, method) {
+ return _cache[getCacheKey(url, query, method)];
+ }
+
+ this.clearCache = function() {
+ _cache = {};
+ }
+
+ // moved successful load stuff here
+ function doLoad(kwArgs, http, url, query, useCache) {
+ if( ((http.status>=200)&&(http.status<300))|| // allow any 2XX response code
+ (http.status==304)|| // get it out of the cache
+ (location.protocol=="file:" && (http.status==0 || http.status==undefined))||
+ (location.protocol=="chrome:" && (http.status==0 || http.status==undefined))
+ ){
+ var ret;
+ if(kwArgs.method.toLowerCase() == "head"){
+ var headers = http.getAllResponseHeaders();
+ ret = {};
+ ret.toString = function(){ return headers; }
+ var values = headers.split(/[\r\n]+/g);
+ for(var i = 0; i < values.length; i++) {
+ var pair = values[i].match(/^([^:]+)\s*:\s*(.+)$/i);
+ if(pair) {
+ ret[pair[1]] = pair[2];
+ }
+ }
+ }else if(kwArgs.mimetype == "text/javascript"){
+ try{
+ ret = dj_eval(http.responseText);
+ }catch(e){
+ dojo.debug(e);
+ dojo.debug(http.responseText);
+ ret = null;
+ }
+ }else if(kwArgs.mimetype == "text/json" || kwArgs.mimetype == "application/json"){
+ try{
+ ret = dj_eval("("+http.responseText+")");
+ }catch(e){
+ dojo.debug(e);
+ dojo.debug(http.responseText);
+ ret = false;
+ }
+ }else if((kwArgs.mimetype == "application/xml")||
+ (kwArgs.mimetype == "text/xml")){
+ ret = http.responseXML;
+ if(!ret || typeof ret == "string" || !http.getResponseHeader("Content-Type")) {
+ ret = dojo.dom.createDocumentFromText(http.responseText);
+ }
+ }else{
+ ret = http.responseText;
+ }
+
+ if(useCache){ // only cache successful responses
+ addToCache(url, query, kwArgs.method, http);
+ }
+ kwArgs[(typeof kwArgs.load == "function") ? "load" : "handle"]("load", ret, http, kwArgs);
+ }else{
+ var errObj = new dojo.io.Error("XMLHttpTransport Error: "+http.status+" "+http.statusText);
+ kwArgs[(typeof kwArgs.error == "function") ? "error" : "handle"]("error", errObj, http, kwArgs);
+ }
+ }
+
+ // set headers (note: Content-Type will get overriden if kwArgs.contentType is set)
+ function setHeaders(http, kwArgs){
+ if(kwArgs["headers"]) {
+ for(var header in kwArgs["headers"]) {
+ if(header.toLowerCase() == "content-type" && !kwArgs["contentType"]) {
+ kwArgs["contentType"] = kwArgs["headers"][header];
+ } else {
+ http.setRequestHeader(header, kwArgs["headers"][header]);
+ }
+ }
+ }
+ }
+
+ this.inFlight = [];
+ this.inFlightTimer = null;
+
+ this.startWatchingInFlight = function(){
+ if(!this.inFlightTimer){
+ // setInterval broken in mozilla x86_64 in some circumstances, see
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=344439
+ // using setTimeout instead
+ this.inFlightTimer = setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();", 10);
+ }
+ }
+
+ this.watchInFlight = function(){
+ var now = null;
+ // make sure sync calls stay thread safe, if this callback is called during a sync call
+ // and this results in another sync call before the first sync call ends the browser hangs
+ if(!dojo.hostenv._blockAsync && !_this._blockAsync){
+ for(var x=this.inFlight.length-1; x>=0; x--){
+ try{
+ var tif = this.inFlight[x];
+ if(!tif || tif.http._aborted || !tif.http.readyState){
+ this.inFlight.splice(x, 1); continue;
+ }
+ if(4==tif.http.readyState){
+ // remove it so we can clean refs
+ this.inFlight.splice(x, 1);
+ doLoad(tif.req, tif.http, tif.url, tif.query, tif.useCache);
+ }else if (tif.startTime){
+ //See if this is a timeout case.
+ if(!now){
+ now = (new Date()).getTime();
+ }
+ if(tif.startTime + (tif.req.timeoutSeconds * 1000) < now){
+ //Stop the request.
+ if(typeof tif.http.abort == "function"){
+ tif.http.abort();
+ }
+
+ // remove it so we can clean refs
+ this.inFlight.splice(x, 1);
+ tif.req[(typeof tif.req.timeout == "function") ? "timeout" : "handle"]("timeout", null, tif.http, tif.req);
+ }
+ }
+ }catch(e){
+ try{
+ var errObj = new dojo.io.Error("XMLHttpTransport.watchInFlight Error: " + e);
+ tif.req[(typeof tif.req.error == "function") ? "error" : "handle"]("error", errObj, tif.http, tif.req);
+ }catch(e2){
+ dojo.debug("XMLHttpTransport error callback failed: " + e2);
+ }
+ }
+ }
+ }
+
+ clearTimeout(this.inFlightTimer);
+ if(this.inFlight.length == 0){
+ this.inFlightTimer = null;
+ return;
+ }
+ this.inFlightTimer = setTimeout("dojo.io.XMLHTTPTransport.watchInFlight();", 10);
+ }
+
+ var hasXmlHttp = dojo.hostenv.getXmlhttpObject() ? true : false;
+ this.canHandle = function(kwArgs){
+ // canHandle just tells dojo.io.bind() if this is a good transport to
+ // use for the particular type of request.
+
+ // FIXME: we need to determine when form values need to be
+ // multi-part mime encoded and avoid using this transport for those
+ // requests.
+ return hasXmlHttp
+ && dojo.lang.inArray(["text/plain", "text/html", "application/xml", "text/xml", "text/javascript", "text/json", "application/json"], (kwArgs["mimetype"].toLowerCase()||""))
+ && !( kwArgs["formNode"] && dojo.io.formHasFile(kwArgs["formNode"]) );
+ }
+
+ this.multipartBoundary = "45309FFF-BD65-4d50-99C9-36986896A96F"; // unique guid as a boundary value for multipart posts
+
+ this.bind = function(kwArgs){
+ if(!kwArgs["url"]){
+ // are we performing a history action?
+ if( !kwArgs["formNode"]
+ && (kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"] || kwArgs["watchForURL"])
+ && (!djConfig.preventBackButtonFix)) {
+ dojo.deprecated("Using dojo.io.XMLHTTPTransport.bind() to add to browser history without doing an IO request",
+ "Use dojo.undo.browser.addToHistory() instead.", "0.4");
+ dojo.undo.browser.addToHistory(kwArgs);
+ return true;
+ }
+ }
+
+ // build this first for cache purposes
+ var url = kwArgs.url;
+ var query = "";
+ if(kwArgs["formNode"]){
+ var ta = kwArgs.formNode.getAttribute("action");
+ if((ta)&&(!kwArgs["url"])){ url = ta; }
+ var tp = kwArgs.formNode.getAttribute("method");
+ if((tp)&&(!kwArgs["method"])){ kwArgs.method = tp; }
+ query += dojo.io.encodeForm(kwArgs.formNode, kwArgs.encoding, kwArgs["formFilter"]);
+ }
+
+ if(url.indexOf("#") > -1) {
+ dojo.debug("Warning: dojo.io.bind: stripping hash values from url:", url);
+ url = url.split("#")[0];
+ }
+
+ if(kwArgs["file"]){
+ // force post for file transfer
+ kwArgs.method = "post";
+ }
+
+ if(!kwArgs["method"]){
+ kwArgs.method = "get";
+ }
+
+ // guess the multipart value
+ if(kwArgs.method.toLowerCase() == "get"){
+ // GET cannot use multipart
+ kwArgs.multipart = false;
+ }else{
+ if(kwArgs["file"]){
+ // enforce multipart when sending files
+ kwArgs.multipart = true;
+ }else if(!kwArgs["multipart"]){
+ // default
+ kwArgs.multipart = false;
+ }
+ }
+
+ if(kwArgs["backButton"] || kwArgs["back"] || kwArgs["changeUrl"]){
+ dojo.undo.browser.addToHistory(kwArgs);
+ }
+
+ var content = kwArgs["content"] || {};
+
+ if(kwArgs.sendTransport) {
+ content["dojo.transport"] = "xmlhttp";
+ }
+
+ do { // break-block
+ if(kwArgs.postContent){
+ query = kwArgs.postContent;
+ break;
+ }
+
+ if(content) {
+ query += dojo.io.argsFromMap(content, kwArgs.encoding);
+ }
+
+ if(kwArgs.method.toLowerCase() == "get" || !kwArgs.multipart){
+ break;
+ }
+
+ var t = [];
+ if(query.length){
+ var q = query.split("&");
+ for(var i = 0; i < q.length; ++i){
+ if(q[i].length){
+ var p = q[i].split("=");
+ t.push( "--" + this.multipartBoundary,
+ "Content-Disposition: form-data; name=\"" + p[0] + "\"",
+ "",
+ p[1]);
+ }
+ }
+ }
+
+ if(kwArgs.file){
+ if(dojo.lang.isArray(kwArgs.file)){
+ for(var i = 0; i < kwArgs.file.length; ++i){
+ var o = kwArgs.file[i];
+ t.push( "--" + this.multipartBoundary,
+ "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"",
+ "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"),
+ "",
+ o.content);
+ }
+ }else{
+ var o = kwArgs.file;
+ t.push( "--" + this.multipartBoundary,
+ "Content-Disposition: form-data; name=\"" + o.name + "\"; filename=\"" + ("fileName" in o ? o.fileName : o.name) + "\"",
+ "Content-Type: " + ("contentType" in o ? o.contentType : "application/octet-stream"),
+ "",
+ o.content);
+ }
+ }
+
+ if(t.length){
+ t.push("--"+this.multipartBoundary+"--", "");
+ query = t.join("\r\n");
+ }
+ }while(false);
+
+ // kwArgs.Connection = "close";
+
+ var async = kwArgs["sync"] ? false : true;
+
+ var preventCache = kwArgs["preventCache"] ||
+ (this.preventCache == true && kwArgs["preventCache"] != false);
+ var useCache = kwArgs["useCache"] == true ||
+ (this.useCache == true && kwArgs["useCache"] != false );
+
+ // preventCache is browser-level (add query string junk), useCache
+ // is for the local cache. If we say preventCache, then don't attempt
+ // to look in the cache, but if useCache is true, we still want to cache
+ // the response
+ if(!preventCache && useCache){
+ var cachedHttp = getFromCache(url, query, kwArgs.method);
+ if(cachedHttp){
+ doLoad(kwArgs, cachedHttp, url, query, false);
+ return;
+ }
+ }
+
+ // much of this is from getText, but reproduced here because we need
+ // more flexibility
+ var http = dojo.hostenv.getXmlhttpObject(kwArgs);
+ var received = false;
+
+ // build a handler function that calls back to the handler obj
+ if(async){
+ var startTime =
+ // FIXME: setting up this callback handler leaks on IE!!!
+ this.inFlight.push({
+ "req": kwArgs,
+ "http": http,
+ "url": url,
+ "query": query,
+ "useCache": useCache,
+ "startTime": kwArgs.timeoutSeconds ? (new Date()).getTime() : 0
+ });
+ this.startWatchingInFlight();
+ }else{
+ // block async callbacks until sync is in, needed in khtml, others?
+ _this._blockAsync = true;
+ }
+
+ if(kwArgs.method.toLowerCase() == "post"){
+ // FIXME: need to hack in more flexible Content-Type setting here!
+ if (!kwArgs.user) {
+ http.open("POST", url, async);
+ }else{
+ http.open("POST", url, async, kwArgs.user, kwArgs.password);
+ }
+ setHeaders(http, kwArgs);
+ http.setRequestHeader("Content-Type", kwArgs.multipart ? ("multipart/form-data; boundary=" + this.multipartBoundary) :
+ (kwArgs.contentType || "application/x-www-form-urlencoded"));
+ try{
+ http.send(query);
+ }catch(e){
+ if(typeof http.abort == "function"){
+ http.abort();
+ }
+ doLoad(kwArgs, {status: 404}, url, query, useCache);
+ }
+ }else{
+ var tmpUrl = url;
+ if(query != "") {
+ tmpUrl += (tmpUrl.indexOf("?") > -1 ? "&" : "?") + query;
+ }
+ if(preventCache) {
+ tmpUrl += (dojo.string.endsWithAny(tmpUrl, "?", "&")
+ ? "" : (tmpUrl.indexOf("?") > -1 ? "&" : "?")) + "dojo.preventCache=" + new Date().valueOf();
+ }
+ if (!kwArgs.user) {
+ http.open(kwArgs.method.toUpperCase(), tmpUrl, async);
+ }else{
+ http.open(kwArgs.method.toUpperCase(), tmpUrl, async, kwArgs.user, kwArgs.password);
+ }
+ setHeaders(http, kwArgs);
+ try {
+ http.send(null);
+ }catch(e) {
+ if(typeof http.abort == "function"){
+ http.abort();
+ }
+ doLoad(kwArgs, {status: 404}, url, query, useCache);
+ }
+ }
+
+ if( !async ) {
+ doLoad(kwArgs, http, url, query, useCache);
+ _this._blockAsync = false;
+ }
+
+ kwArgs.abort = function(){
+ try{// khtml doesent reset readyState on abort, need this workaround
+ http._aborted = true;
+ }catch(e){/*squelsh*/}
+ return http.abort();
+ }
+
+ return;
+ }
+ dojo.io.transports.addTransport("XMLHTTPTransport");
+}
+
dojo.provide("dojo.io.cookie");
-dojo.io.cookie.setCookie=function(name,_643,days,path,_646,_647){
-var _648=-1;
-if(typeof days=="number"&&days>=0){
-var d=new Date();
-d.setTime(d.getTime()+(days*24*60*60*1000));
-_648=d.toGMTString();
+
+dojo.io.cookie.setCookie = function(name, value, days, path, domain, secure) {
+ var expires = -1;
+ if(typeof days == "number" && days >= 0) {
+ var d = new Date();
+ d.setTime(d.getTime()+(days*24*60*60*1000));
+ expires = d.toGMTString();
+ }
+ value = escape(value);
+ document.cookie = name + "=" + value + ";"
+ + (expires != -1 ? " expires=" + expires + ";" : "")
+ + (path ? "path=" + path : "")
+ + (domain ? "; domain=" + domain : "")
+ + (secure ? "; secure" : "");
}
-_643=escape(_643);
-document.cookie=name+"="+_643+";"+(_648!=-1?" expires="+_648+";":"")+(path?"path="+path:"")+(_646?"; domain="+_646:"")+(_647?"; secure":"");
-};
-dojo.io.cookie.set=dojo.io.cookie.setCookie;
-dojo.io.cookie.getCookie=function(name){
-var idx=document.cookie.lastIndexOf(name+"=");
-if(idx==-1){
-return null;
+
+dojo.io.cookie.set = dojo.io.cookie.setCookie;
+
+dojo.io.cookie.getCookie = function(name) {
+ // FIXME: Which cookie should we return?
+ // If there are cookies set for different sub domains in the current
+ // scope there could be more than one cookie with the same name.
+ // I think taking the last one in the list takes the one from the
+ // deepest subdomain, which is what we're doing here.
+ var idx = document.cookie.lastIndexOf(name+'=');
+ if(idx == -1) { return null; }
+ var value = document.cookie.substring(idx+name.length+1);
+ var end = value.indexOf(';');
+ if(end == -1) { end = value.length; }
+ value = value.substring(0, end);
+ value = unescape(value);
+ return value;
}
-var _64c=document.cookie.substring(idx+name.length+1);
-var end=_64c.indexOf(";");
-if(end==-1){
-end=_64c.length;
+
+dojo.io.cookie.get = dojo.io.cookie.getCookie;
+
+dojo.io.cookie.deleteCookie = function(name) {
+ dojo.io.cookie.setCookie(name, "-", 0);
}
-_64c=_64c.substring(0,end);
-_64c=unescape(_64c);
-return _64c;
-};
-dojo.io.cookie.get=dojo.io.cookie.getCookie;
-dojo.io.cookie.deleteCookie=function(name){
-dojo.io.cookie.setCookie(name,"-",0);
-};
-dojo.io.cookie.setObjectCookie=function(name,obj,days,path,_653,_654,_655){
-if(arguments.length==5){
-_655=_653;
-_653=null;
-_654=null;
+
+dojo.io.cookie.setObjectCookie = function(name, obj, days, path, domain, secure, clearCurrent) {
+ if(arguments.length == 5) { // for backwards compat
+ clearCurrent = domain;
+ domain = null;
+ secure = null;
+ }
+ var pairs = [], cookie, value = "";
+ if(!clearCurrent) { cookie = dojo.io.cookie.getObjectCookie(name); }
+ if(days >= 0) {
+ if(!cookie) { cookie = {}; }
+ for(var prop in obj) {
+ if(prop == null) {
+ delete cookie[prop];
+ } else if(typeof obj[prop] == "string" || typeof obj[prop] == "number") {
+ cookie[prop] = obj[prop];
+ }
+ }
+ prop = null;
+ for(var prop in cookie) {
+ pairs.push(escape(prop) + "=" + escape(cookie[prop]));
+ }
+ value = pairs.join("&");
+ }
+ dojo.io.cookie.setCookie(name, value, days, path, domain, secure);
}
-var _656=[],_657,_658="";
-if(!_655){
-_657=dojo.io.cookie.getObjectCookie(name);
+
+dojo.io.cookie.getObjectCookie = function(name) {
+ var values = null, cookie = dojo.io.cookie.getCookie(name);
+ if(cookie) {
+ values = {};
+ var pairs = cookie.split("&");
+ for(var i = 0; i < pairs.length; i++) {
+ var pair = pairs[i].split("=");
+ var value = pair[1];
+ if( isNaN(value) ) { value = unescape(pair[1]); }
+ values[ unescape(pair[0]) ] = value;
+ }
+ }
+ return values;
}
-if(days>=0){
-if(!_657){
-_657={};
-}
-for(var prop in obj){
-if(prop==null){
-delete _657[prop];
-}else{
-if(typeof obj[prop]=="string"||typeof obj[prop]=="number"){
-_657[prop]=obj[prop];
-}
-}
-}
-prop=null;
-for(var prop in _657){
-_656.push(escape(prop)+"="+escape(_657[prop]));
-}
-_658=_656.join("&");
-}
-dojo.io.cookie.setCookie(name,_658,days,path,_653,_654);
-};
-dojo.io.cookie.getObjectCookie=function(name){
-var _65b=null,_65c=dojo.io.cookie.getCookie(name);
-if(_65c){
-_65b={};
-var _65d=_65c.split("&");
-for(var i=0;i<_65d.length;i++){
-var pair=_65d[i].split("=");
-var _660=pair[1];
-if(isNaN(_660)){
-_660=unescape(pair[1]);
-}
-_65b[unescape(pair[0])]=_660;
-}
-}
-return _65b;
-};
-dojo.io.cookie.isSupported=function(){
-if(typeof navigator.cookieEnabled!="boolean"){
-dojo.io.cookie.setCookie("__TestingYourBrowserForCookieSupport__","CookiesAllowed",90,null);
-var _661=dojo.io.cookie.getCookie("__TestingYourBrowserForCookieSupport__");
-navigator.cookieEnabled=(_661=="CookiesAllowed");
-if(navigator.cookieEnabled){
-this.deleteCookie("__TestingYourBrowserForCookieSupport__");
-}
-}
-return navigator.cookieEnabled;
-};
-if(!dojo.io.cookies){
-dojo.io.cookies=dojo.io.cookie;
+
+dojo.io.cookie.isSupported = function() {
+ if(typeof navigator.cookieEnabled != "boolean") {
+ dojo.io.cookie.setCookie("__TestingYourBrowserForCookieSupport__",
+ "CookiesAllowed", 90, null);
+ var cookieVal = dojo.io.cookie.getCookie("__TestingYourBrowserForCookieSupport__");
+ navigator.cookieEnabled = (cookieVal == "CookiesAllowed");
+ if(navigator.cookieEnabled) {
+ // FIXME: should we leave this around?
+ this.deleteCookie("__TestingYourBrowserForCookieSupport__");
+ }
+ }
+ return navigator.cookieEnabled;
}
+
+// need to leave this in for backwards-compat from 0.1 for when it gets pulled in by dojo.io.*
+if(!dojo.io.cookies) { dojo.io.cookies = dojo.io.cookie; }
+
dojo.provide("dojo.io.*");
+
dojo.provide("dojo.uri.*");
+
dojo.provide("dojo.io.IframeIO");
-dojo.io.createIFrame=function(_662,_663,uri){
-if(window[_662]){
-return window[_662];
+
+// FIXME: is it possible to use the Google htmlfile hack to prevent the
+// background click with this transport?
+
+dojo.io.createIFrame = function(fname, onloadstr, uri){
+ if(window[fname]){ return window[fname]; }
+ if(window.frames[fname]){ return window.frames[fname]; }
+ var r = dojo.render.html;
+ var cframe = null;
+ var turi = uri||dojo.uri.dojoUri("iframe_history.html?noInit=true");
+ var ifrstr = ((r.ie)&&(dojo.render.os.win)) ? '