You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2015/05/22 12:58:36 UTC
[09/50] struts git commit: Moves deprecated plugins to struts-archive
repo
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/Parse.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/Parse.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/Parse.js
deleted file mode 100644
index 3baabbb..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/Parse.js
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- Copyright (c) 2004-2006, The Dojo Foundation
- All Rights Reserved.
-
- Licensed under the Academic Free License version 2.1 or above OR the
- modified BSD license. For more information on Dojo licensing, see:
-
- http://dojotoolkit.org/community/licensing.shtml
-*/
-
-
-
-dojo.provide("dojo.xml.Parse");
-dojo.require("dojo.dom");
-dojo.xml.Parse = function () {
- var isIE = ((dojo.render.html.capable) && (dojo.render.html.ie));
- function getTagName(node) {
- try {
- return node.tagName.toLowerCase();
- }
- catch (e) {
- return "";
- }
- }
- function getDojoTagName(node) {
- var tagName = getTagName(node);
- if (!tagName) {
- return "";
- }
- if ((dojo.widget) && (dojo.widget.tags[tagName])) {
- return tagName;
- }
- var p = tagName.indexOf(":");
- if (p >= 0) {
- return tagName;
- }
- if (tagName.substr(0, 5) == "dojo:") {
- return tagName;
- }
- if (dojo.render.html.capable && dojo.render.html.ie && node.scopeName != "HTML") {
- return node.scopeName.toLowerCase() + ":" + tagName;
- }
- if (tagName.substr(0, 4) == "dojo") {
- return "dojo:" + tagName.substring(4);
- }
- var djt = node.getAttribute("dojoType") || node.getAttribute("dojotype");
- if (djt) {
- if (djt.indexOf(":") < 0) {
- djt = "dojo:" + djt;
- }
- return djt.toLowerCase();
- }
- djt = node.getAttributeNS && node.getAttributeNS(dojo.dom.dojoml, "type");
- if (djt) {
- return "dojo:" + djt.toLowerCase();
- }
- try {
- djt = node.getAttribute("dojo:type");
- }
- catch (e) {
- }
- if (djt) {
- return "dojo:" + djt.toLowerCase();
- }
- if ((dj_global["djConfig"]) && (!djConfig["ignoreClassNames"])) {
- var classes = node.className || node.getAttribute("class");
- if ((classes) && (classes.indexOf) && (classes.indexOf("dojo-") != -1)) {
- var aclasses = classes.split(" ");
- for (var x = 0, c = aclasses.length; x < c; x++) {
- if (aclasses[x].slice(0, 5) == "dojo-") {
- return "dojo:" + aclasses[x].substr(5).toLowerCase();
- }
- }
- }
- }
- return "";
- }
- this.parseElement = function (node, hasParentNodeSet, optimizeForDojoML, thisIdx) {
- var tagName = getTagName(node);
- if (isIE && tagName.indexOf("/") == 0) {
- return null;
- }
- try {
- var attr = node.getAttribute("parseWidgets");
- if (attr && attr.toLowerCase() == "false") {
- return {};
- }
- }
- catch (e) {
- }
- var process = true;
- if (optimizeForDojoML) {
- var dojoTagName = getDojoTagName(node);
- tagName = dojoTagName || tagName;
- process = Boolean(dojoTagName);
- }
- var parsedNodeSet = {};
- parsedNodeSet[tagName] = [];
- var pos = tagName.indexOf(":");
- if (pos > 0) {
- var ns = tagName.substring(0, pos);
- parsedNodeSet["ns"] = ns;
- if ((dojo.ns) && (!dojo.ns.allow(ns))) {
- process = false;
- }
- }
- if (process) {
- var attributeSet = this.parseAttributes(node);
- for (var attr in attributeSet) {
- if ((!parsedNodeSet[tagName][attr]) || (typeof parsedNodeSet[tagName][attr] != "array")) {
- parsedNodeSet[tagName][attr] = [];
- }
- parsedNodeSet[tagName][attr].push(attributeSet[attr]);
- }
- parsedNodeSet[tagName].nodeRef = node;
- parsedNodeSet.tagName = tagName;
- parsedNodeSet.index = thisIdx || 0;
- }
- var count = 0;
- for (var i = 0; i < node.childNodes.length; i++) {
- var tcn = node.childNodes.item(i);
- switch (tcn.nodeType) {
- case dojo.dom.ELEMENT_NODE:
- var ctn = getDojoTagName(tcn) || getTagName(tcn);
- if (!parsedNodeSet[ctn]) {
- parsedNodeSet[ctn] = [];
- }
- parsedNodeSet[ctn].push(this.parseElement(tcn, true, optimizeForDojoML, count));
- if ((tcn.childNodes.length == 1) && (tcn.childNodes.item(0).nodeType == dojo.dom.TEXT_NODE)) {
- parsedNodeSet[ctn][parsedNodeSet[ctn].length - 1].value = tcn.childNodes.item(0).nodeValue;
- }
- count++;
- break;
- case dojo.dom.TEXT_NODE:
- if (node.childNodes.length == 1) {
- parsedNodeSet[tagName].push({value:node.childNodes.item(0).nodeValue});
- }
- break;
- default:
- break;
- }
- }
- return parsedNodeSet;
- };
- this.parseAttributes = function (node) {
- var parsedAttributeSet = {};
- var atts = node.attributes;
- var attnode, i = 0;
- while ((attnode = atts[i++])) {
- if (isIE) {
- if (!attnode) {
- continue;
- }
- if ((typeof attnode == "object") && (typeof attnode.nodeValue == "undefined") || (attnode.nodeValue == null) || (attnode.nodeValue == "")) {
- continue;
- }
- }
- var nn = attnode.nodeName.split(":");
- nn = (nn.length == 2) ? nn[1] : attnode.nodeName;
- parsedAttributeSet[nn] = {value:attnode.nodeValue};
- }
- return parsedAttributeSet;
- };
-};
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/XslTransform.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/XslTransform.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/XslTransform.js
deleted file mode 100644
index 4adb8c2..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/XslTransform.js
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- Copyright (c) 2004-2006, The Dojo Foundation
- All Rights Reserved.
-
- Licensed under the Academic Free License version 2.1 or above OR the
- modified BSD license. For more information on Dojo licensing, see:
-
- http://dojotoolkit.org/community/licensing.shtml
-*/
-
-
-
-dojo.provide("dojo.xml.XslTransform");
-dojo.xml.XslTransform = function (xsltUri) {
- dojo.debug("XslTransform is supported by Internet Explorer and Mozilla, with limited support in Opera 9 (no document function support).");
- var IS_IE = dojo.render.html.ie;
- var ACTIVEX_DOMS = ["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"];
- var ACTIVEX_FT_DOMS = ["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"];
- var ACTIVEX_TEMPLATES = ["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"];
- function getActiveXImpl(activeXArray) {
- for (var i = 0; i < activeXArray.length; i++) {
- try {
- var testObj = new ActiveXObject(activeXArray[i]);
- if (testObj) {
- return activeXArray[i];
- }
- }
- catch (e) {
- }
- }
- dojo.raise("Could not find an ActiveX implementation in:\n\n " + activeXArray);
- }
- if (xsltUri == null || xsltUri == undefined) {
- dojo.raise("You must pass the URI String for the XSL file to be used!");
- return false;
- }
- var xsltDocument = null;
- var xsltProcessor = null;
- if (IS_IE) {
- xsltDocument = new ActiveXObject(getActiveXImpl(ACTIVEX_FT_DOMS));
- xsltDocument.async = false;
- } else {
- xsltProcessor = new XSLTProcessor();
- xsltDocument = document.implementation.createDocument("", "", null);
- xsltDocument.addEventListener("load", onXslLoad, false);
- }
- xsltDocument.load(xsltUri);
- if (IS_IE) {
- var xslt = new ActiveXObject(getActiveXImpl(ACTIVEX_TEMPLATES));
- xslt.stylesheet = xsltDocument;
- xsltProcessor = xslt.createProcessor();
- }
- function onXslLoad() {
- xsltProcessor.importStylesheet(xsltDocument);
- }
- function getResultDom(xmlDoc, params) {
- if (IS_IE) {
- addIeParams(params);
- var result = getIeResultDom(xmlDoc);
- removeIeParams(params);
- return result;
- } else {
- return getMozillaResultDom(xmlDoc, params);
- }
- }
- function addIeParams(params) {
- if (!params) {
- return;
- }
- for (var i = 0; i < params.length; i++) {
- xsltProcessor.addParameter(params[i][0], params[i][1]);
- }
- }
- function removeIeParams(params) {
- if (!params) {
- return;
- }
- for (var i = 0; i < params.length; i++) {
- xsltProcessor.addParameter(params[i][0], "");
- }
- }
- function getIeResultDom(xmlDoc) {
- xsltProcessor.input = xmlDoc;
- var outDoc = new ActiveXObject(getActiveXImpl(ACTIVEX_DOMS));
- outDoc.async = false;
- outDoc.validateOnParse = false;
- xsltProcessor.output = outDoc;
- xsltProcessor.transform();
- if (outDoc.parseError.errorCode != 0) {
- var err = outDoc.parseError;
- dojo.raise("err.errorCode: " + err.errorCode + "\n\nerr.reason: " + err.reason + "\n\nerr.url: " + err.url + "\n\nerr.srcText: " + err.srcText);
- }
- return outDoc;
- }
- function getIeResultStr(xmlDoc, params) {
- xsltProcessor.input = xmlDoc;
- xsltProcessor.transform();
- return xsltProcessor.output;
- }
- function addMozillaParams(params) {
- if (!params) {
- return;
- }
- for (var i = 0; i < params.length; i++) {
- xsltProcessor.setParameter(null, params[i][0], params[i][1]);
- }
- }
- function getMozillaResultDom(xmlDoc, params) {
- addMozillaParams(params);
- var resultDoc = xsltProcessor.transformToDocument(xmlDoc);
- xsltProcessor.clearParameters();
- return resultDoc;
- }
- function getMozillaResultStr(xmlDoc, params, parentDoc) {
- addMozillaParams(params);
- var resultDoc = xsltProcessor.transformToFragment(xmlDoc, parentDoc);
- var serializer = new XMLSerializer();
- xsltProcessor.clearParameters();
- return serializer.serializeToString(resultDoc);
- }
- this.getResultString = function (xmlDoc, params, parentDoc) {
- var content = null;
- if (IS_IE) {
- addIeParams(params);
- content = getIeResultStr(xmlDoc, params);
- removeIeParams(params);
- } else {
- content = getMozillaResultStr(xmlDoc, params, parentDoc);
- }
- return content;
- };
- this.transformToContentPane = function (xmlDoc, params, contentPane, parentDoc) {
- var content = this.getResultString(xmlDoc, params, parentDoc);
- contentPane.setContent(content);
- };
- this.transformToRegion = function (xmlDoc, params, region, parentDoc) {
- try {
- var content = this.getResultString(xmlDoc, params, parentDoc);
- region.innerHTML = content;
- }
- catch (e) {
- dojo.raise(e.message + "\n\n xsltUri: " + xsltUri);
- }
- };
- this.transformToDocument = function (xmlDoc, params) {
- return getResultDom(xmlDoc, params);
- };
- this.transformToWindow = function (xmlDoc, params, windowDoc, parentDoc) {
- try {
- windowDoc.open();
- windowDoc.write(this.getResultString(xmlDoc, params, parentDoc));
- windowDoc.close();
- }
- catch (e) {
- dojo.raise(e.message + "\n\n xsltUri: " + xsltUri);
- }
- };
-};
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/__package__.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/__package__.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/__package__.js
deleted file mode 100644
index 1e510ae..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/__package__.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- Copyright (c) 2004-2006, The Dojo Foundation
- All Rights Reserved.
-
- Licensed under the Academic Free License version 2.1 or above OR the
- modified BSD license. For more information on Dojo licensing, see:
-
- http://dojotoolkit.org/community/licensing.shtml
-*/
-
-
-
-dojo.require("dojo.xml.Parse");
-dojo.kwCompoundRequire({common:["dojo.dom"], browser:["dojo.html.*"], dashboard:["dojo.html.*"]});
-dojo.provide("dojo.xml.*");
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/svgUtil.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/svgUtil.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/svgUtil.js
deleted file mode 100644
index e6c9f05..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/xml/svgUtil.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- Copyright (c) 2004-2006, The Dojo Foundation
- All Rights Reserved.
-
- Licensed under the Academic Free License version 2.1 or above OR the
- modified BSD license. For more information on Dojo licensing, see:
-
- http://dojotoolkit.org/community/licensing.shtml
-*/
-
-dojo.provide("dojo.xml.svgUtil");
-// FIXME: add imports for deps!
-
-dojo.xml.svgUtil = new function(){
-
- this.getInnerWidth = function(node){
- // FIXME: need to find out from dylan how to
- }
-
- this.getOuterWidth = function(node){
-
- }
-
- this.getInnerHeight = function(node){
-
- }
-
- this.getOuterHeight = function(node){
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/storage_dialog.swf
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/storage_dialog.swf b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/storage_dialog.swf
deleted file mode 100644
index cb15ec8..0000000
Binary files a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/storage_dialog.swf and /dev/null differ
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/ComboBox.css
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/ComboBox.css b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/ComboBox.css
deleted file mode 100644
index 91c8fe9..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/ComboBox.css
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-.dojoComboBoxOuter {
- border: 0px !important;
- margin: 0px !important;
- padding: 0px !important;
- background: transparent !important;
- white-space: nowrap !important;
-}
-
-.dojoComboBox {
- border: 1px inset #afafaf;
- margin: 0px;
- padding: 0px;
- vertical-align: middle !important;
- float: none !important;
- position: static !important;
- display: inline;
-}
-
-/* the input box */
-input.dojoComboBox {
- border-right-width: 1px !important;
- margin-right: 0px !important;
- padding-right: 0px !important;
-}
-
-/* the down arrow */
-img.dojoComboBox {
- border-left-width: 0px !important;
- padding-left: 0px !important;
- margin-left: 0px !important;
-}
-
-/* IE vertical-alignment calculations can be off by +-1 but these margins are collapsed away */
-.dj_ie img.dojoComboBox {
- margin-top: 1px;
- margin-bottom: 1px;
-}
-
-/* the drop down */
-.dojoComboBoxOptions {
- font-family: Verdana, Helvetica, Garamond, sans-serif;
- /* font-size: 0.7em; */
- background-color: white;
- border: 1px solid #afafaf;
- position: absolute;
- z-index: 1000;
- overflow: auto;
- cursor: default;
-}
-
-.dojoComboBoxItem {
- padding-left: 2px;
- padding-top: 2px;
- margin: 0px;
-}
-
-.dojoComboBoxItemEven {
- background-color: #f4f4f4;
-}
-
-.dojoComboBoxItemOdd {
- background-color: white;
-}
-
-.dojoComboBoxItemHighlight {
- background-color: #63709A;
- color: white;
-}
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js
deleted file mode 100644
index 8e3269c..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/Bind.js
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-dojo.provide("struts.widget.Bind");
-
-dojo.require("dojo.widget.HtmlWidget");
-dojo.require("dojo.lfx.html");
-dojo.require("dojo.io.*");
-
-dojo.widget.defineWidget(
- "struts.widget.Bind",
- dojo.widget.HtmlWidget, {
- widgetType : "Bind",
- executeScripts : false,
- scriptSeparation : false,
- targets : "",
- targetsArray : null,
- href : "",
- handler : "",
-
- //messages
- loadingText : "Loading...",
- errorText : "",
- showError : true,
- showLoading : false,
-
- //pub/sub events
- listenTopics : "",
- notifyTopics : "",
- notifyTopicsArray : null,
- beforeNotifyTopics : "",
- beforeNotifyTopicsArray : null,
- afterNotifyTopics : "",
- afterNotifyTopicsArray : null,
- errorNotifyTopics : "",
- errorNotifyTopicsArray : null,
-
- formId : "",
- formFilter : "",
- formNode : null,
-
- events : "",
- indicator : "",
-
- parseContent : true,
-
- highlightColor : "",
- highlightDuration : 2000,
-
- validate : false,
- ajaxAfterValidation : false,
-
- //used for scripts downloading & caching
- cacheContent : true,
- //run script on its own scope
- scriptSeparation : true,
- //scope for the cript separation
- scriptScope : null,
- transport : "",
-
- postCreate : function() {
- var self = this;
-
- //attach listeners
- if(!dojo.string.isBlank(this.listenTopics)) {
- this.log("Listening to " + this.listenTopics + " to refresh");
- var topics = this.listenTopics.split(",");
- if(topics) {
- dojo.lang.forEach(topics, function(topic){
- dojo.event.topic.subscribe(topic, self, "reloadContents");
- });
- }
- }
-
- //topics
- if(!dojo.string.isBlank(this.notifyTopics)) {
- this.notifyTopicsArray = this.notifyTopics.split(",");
- }
-
- //before topics
- if(!dojo.string.isBlank(this.beforeNotifyTopics)) {
- this.beforeNotifyTopicsArray = this.beforeNotifyTopics.split(",");
- }
-
- //after topics
- if(!dojo.string.isBlank(this.afterNotifyTopics)) {
- this.afterNotifyTopicsArray = this.afterNotifyTopics.split(",");
- }
-
- //error topics
- if(!dojo.string.isBlank(this.errorNotifyTopics)) {
- this.errorNotifyTopicsArray = this.errorNotifyTopics.split(",");
- }
-
- if(!dojo.string.isBlank(this.targets)) {
- //split targets
- this.targetsArray = this.targets.split(",");
- }
-
- if(!dojo.string.isBlank(this.events)) {
- var eventsArray = this.events.split(",");
- if(eventsArray && this.domNode) {
- dojo.lang.forEach(eventsArray, function(event){
- dojo.event.connect(self.domNode, event, function(evt) {
- evt.preventDefault();
- evt.stopPropagation();
- self.reloadContents();
- });
- });
- }
- }
-
- if(dojo.string.isBlank(this.formId)) {
- //no formId, see if we are inside a form
- this.formNode = dojo.dom.getFirstAncestorByTag(this.domNode, "form");
- } else {
- this.formNode = dojo.byId(this.formId);
- }
-
- if(this.formNode && dojo.string.isBlank(this.href)) {
- this.href = this.formNode.action;
- }
- },
-
- highlight : function() {
- if(!dojo.string.isBlank(this.highlightColor)) {
- var nodes = [];
- //add nodes to array
- dojo.lang.forEach(this.targetsArray, function(target) {
- var node = dojo.byId(target);
- if(node) {
- nodes.push(node);
- }
- });
- var effect = dojo.lfx.html.highlight(nodes, this.highlightColor, this.highlightDuration);
- effect.play();
- }
- },
-
- log : function(text) {
- dojo.debug("[" + (this.widgetId ? this.widgetId : "unknown") + "] " + text);
- },
-
- setContent : function(text) {
- if(this.targetsArray) {
- var self = this;
- var xmlParser = new dojo.xml.Parse();
- dojo.lang.forEach(this.targetsArray, function(target) {
- var node = dojo.byId(target);
- if(node) {
- node.innerHTML = text;
-
- if(self.parseContent && text != self.loadingText){
- var frag = xmlParser.parseElement(node, null, true);
- dojo.widget.getParser().createSubComponents(frag, dojo.widget.byId(target));
- }
- } else {
- self.log("Unable to find target: " + node);
- }
- });
- }
- },
-
- bindHandler : function(type, data, e) {
- //hide indicator
- dojo.html.hide(this.indicator);
-
- //publish topics
- this.notify(data, type, e);
-
- if(type == "load") {
- if(this.validate) {
- StrutsUtils.clearValidationErrors(this.formNode);
- //validation is active for this action
- var errors = StrutsUtils.getValidationErrors(data);
- if(errors && errors.fieldErrors) {
- //validation failed
- StrutsUtils.showValidationErrors(this.formNode, errors);
- return;
- } else {
- //validation passed
- if(!this.ajaxAfterValidation && this.formNode) {
- //regular submit
- this.formNode.submit();
- return;
- }
- }
- }
-
- // no validation or validation passed
- if(this.executeScripts) {
- //parse text to extract content and javascript
- var parsed = this.parse(data);
-
- //update targets content
- this.setContent(parsed.text);
-
- //execute scripts
- this._executeScripts(parsed.scripts);
- }
- else {
- this.setContent(data);
- }
- this.highlight();
- } else {
- if(this.showError) {
- var message = dojo.string.isBlank(this.errorText) ? e.message : this.errorText;
- this.setContent(message);
- }
- }
- },
-
- notify : function(data, type, e) {
- var self = this;
- //general topics
- if(this.notifyTopicsArray) {
- dojo.lang.forEach(this.notifyTopicsArray, function(topic) {
- try {
- dojo.event.topic.publish(topic, data, type, e, self);
- } catch(ex){
- self.log(ex);
- }
- });
- }
-
- //before, after and error topics
- var topicsArray = null;
- switch(type) {
- case "before":
- this.notifyTo(this.beforeNotifyTopicsArray, null, e);
- break;
- case "load":
- this.notifyTo(this.afterNotifyTopicsArray, data, e);
- break;
- case "error":
- this.notifyTo(this.errorNotifyTopicsArray, data, e);
- break;
- }
- },
-
- notifyTo : function(topicsArray, data, e) {
- var self = this;
- if(topicsArray) {
- dojo.lang.forEach(topicsArray, function(topic) {
- try {
- if(data != null) {
- dojo.event.topic.publish(topic, data, e, self);
- } else {
- dojo.event.topic.publish(topic, e, self);
- }
- } catch(ex){
- self.log(ex);
- }
- });
- }
- },
-
- onDownloadStart : function(event) {
- if(this.showLoading && !dojo.string.isBlank(this.loadingText)) {
- event.text = this.loadingText;
- }
- },
-
- reloadContents : function(evt) {
- if(!dojo.string.isBlank(this.handler)) {
- //use custom handler
- this.log("Invoking handler: " + this.handler);
- window[this.handler](this, this.domNode);
- }
- else {
- try {
- var self = this;
- var request = {cancel: false};
- this.notify(this.widgetId, "before", request);
- if(request.cancel) {
- this.log("Request canceled");
- return;
- }
-
- //if the href is null, we still publish the notify topics
- if(dojo.string.isBlank(this.href)) {
- return;
- }
-
- //if there is a parent form, and it has a "onsubmit"
- //execute it, validation is usually there, except is validation == true
- //on which case it is ajax validation, instead of client side
- if(!this.validate && this.formNode && this.formNode.onsubmit != null) {
- var makeRequest = this.formNode.onsubmit.call(evt);
- if(makeRequest != null && !makeRequest) {
- this.log("Request canceled by 'onsubmit' of the form");
- return;
- }
- }
-
- //show indicator
- dojo.html.show(this.indicator);
- if(this.showLoading) {
- this.setContent(this.loadingText);
- }
-
- var tmpHref = this.href;
- tmpHref = tmpHref + (tmpHref.indexOf("?") > -1 ? "&" : "?") + "struts.enableJSONValidation=true";
- if(!this.ajaxAfterValidation && this.validate) {
- tmpHref = tmpHref + (tmpHref.indexOf("?") > -1 ? "&" : "?") + "struts.validateOnly=true";
- }
-
- if(dojo.dom.isTag(this.domNode, "INPUT", "input")
- && this.events == "onclick"
- && this.domNode.type == "submit"
- && !dojo.string.isBlank(this.domNode.name)
- && !dojo.string.isBlank(this.domNode.value)) {
- var enc = /utf/i.test("") ? encodeURIComponent : dojo.string.encodeAscii
- tmpHref = tmpHref + (tmpHref.indexOf("?") > -1 ? "&" : "?") + enc(this.domNode.name) + "=" + enc(this.domNode.value);
- }
-
- dojo.io.bind({
- url: tmpHref,
- useCache: false,
- preventCache: true,
- formNode: self.formNode,
- formFilter: window[self.formFilter],
- transport: self.transport,
- handler: function(type, data, e) {
- dojo.lang.hitch(self, "bindHandler")(type, data, e);
- },
- mimetype: "text/html"
- });
- }
- catch(ex) {
- if(this.showError) {
- var message = dojo.string.isBlank(this.errorText) ? ex : this.errorText;
- this.setContent(message);
- }
- }
- }
- },
-
- //from Dojo's ContentPane
- parse : function(s) {
- this.log("Parsing: " + s);
- var match = [];
- var tmp = [];
- var scripts = [];
- while(match){
- match = s.match(/<script([^>]*)>([\s\S]*?)<\/script>/i);
- if(!match){ break; }
- if(match[1]){
- attr = match[1].match(/src=(['"]?)([^"']*)\1/i);
- if(attr){
- // remove a dojo.js or dojo.js.uncompressed.js from remoteScripts
- // we declare all files with dojo.js as bad, regardless of folder
- var tmp2 = attr[2].search(/.*(\bdojo\b(?:\.uncompressed)?\.js)$/);
- if(tmp2 > -1){
- this.log("Security note! inhibit:"+attr[2]+" from beeing loaded again.");
- }
- }
- }
- if(match[2]){
- // strip out all djConfig variables from script tags nodeValue
- // this is ABSOLUTLY needed as reinitialize djConfig after dojo is initialised
- // makes a dissaster greater than Titanic, update remove writeIncludes() to
- var sc = match[2].replace(/(?:var )?\bdjConfig\b(?:[\s]*=[\s]*\{[^}]+\}|\.[\w]*[\s]*=[\s]*[^;\n]*)?;?|dojo\.hostenv\.writeIncludes\(\s*\);?/g, "");
- if(!sc){ continue; }
-
- // cut out all dojo.require (...) calls, if we have execute
- // scripts false widgets dont get there require calls
- // does suck out possible widgetpackage registration as well
- tmp = [];
- while(tmp){
- tmp = sc.match(/dojo\.(?:(?:require(?:After)?(?:If)?)|(?:widget\.(?:manager\.)?registerWidgetPackage)|(?:(?:hostenv\.)?setModulePrefix))\((['"]).*?\1\)\s*;?/);
- if(!tmp){ break;}
- sc = sc.replace(tmp[0], "");
- }
- scripts.push(sc);
- }
- s = s.replace(/<script[^>]*>[\s\S]*?<\/script>/i, "");
- }
-
- return {
- text: s,
- scripts: scripts
- };
- },
-
- //from Dojo content pane
- _executeScripts : function (scripts) {
- var self = this;
- var tmp = "", code = "";
- for (var i = 0; i < scripts.length; i++) {
- if (scripts[i].path) {
- dojo.io.bind(this._cacheSetting({"url":scripts[i].path, "load":function (type, scriptStr) {
- dojo.lang.hitch(self, tmp = ";" + scriptStr);
- }, "error":function (type, error) {
- error.text = type + " downloading remote script";
- self._handleDefaults.call(self, error, "onExecError", "debug");
- }, "mimetype":"text/plain", "sync":true}, this.cacheContent));
- code += tmp;
- } else {
- code += scripts[i];
- }
- }
- try {
- if (this.scriptSeparation) {
- delete this.scriptScope;
- this.scriptScope = new (new Function("_container_", code + "; return this;"))(self);
- } else {
- var djg = dojo.global();
- if (djg.execScript) {
- djg.execScript(code);
- } else {
- var djd = dojo.doc();
- var sc = djd.createElement("script");
- sc.appendChild(djd.createTextNode(code));
- (this.containerNode || this.domNode).appendChild(sc);
- }
- }
- }
- catch (e) {
- e.text = "Error running scripts from content:\n" + e.description;
- this.log(e);
- }
- },
-
- _cacheSetting : function (bindObj, useCache) {
- for (var x in this.bindArgs) {
- if (dojo.lang.isUndefined(bindObj[x])) {
- bindObj[x] = this.bindArgs[x];
- }
- }
- if (dojo.lang.isUndefined(bindObj.useCache)) {
- bindObj.useCache = useCache;
- }
- if (dojo.lang.isUndefined(bindObj.preventCache)) {
- bindObj.preventCache = !useCache;
- }
- if (dojo.lang.isUndefined(bindObj.mimetype)) {
- bindObj.mimetype = "text/html";
- }
- return bindObj;
- }
-
-});
-
-
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindAnchor.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindAnchor.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindAnchor.js
deleted file mode 100644
index a88814e..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindAnchor.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-dojo.provide("struts.widget.BindAnchor");
-
-dojo.require("dojo.widget.HtmlWidget");
-dojo.require("dojo.io.*");
-dojo.require("struts.widget.Bind");
-
-dojo.widget.defineWidget(
- "struts.widget.BindAnchor",
- struts.widget.Bind, {
- widgetType : "BindAnchor",
-
- events: "onclick",
-
- postCreate : function() {
- struts.widget.BindAnchor.superclass.postCreate.apply(this);
- this.domNode.href = "#";
- }
-});
-
-
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js
deleted file mode 100644
index 6b1be80..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindDiv.js
+++ /dev/null
@@ -1,436 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-dojo.provide("struts.widget.BindDiv");
-
-dojo.require("dojo.io.*");
-dojo.require("dojo.widget.ContentPane");
-dojo.require("dojo.lang.timing.Timer");
-
-dojo.widget.defineWidget(
- "struts.widget.BindDiv",
- dojo.widget.ContentPane, {
- widgetType : "BindDiv",
-
- //from ContentPane
- href : "",
- extractContent : false,
- parseContent : false,
- cacheContent : false,
- refreshOnShow : false,
- executeScripts : false,
- preload : true,
-
- //update times
- updateFreq : 0,
- delay : 0,
- autoStart : true,
- timer : null,
-
- //messages
- loadingText : "Loading...",
- showLoading : false,
- errorText : "",
- showError : true,
-
- //pub/sub events
- listenTopics : "",
- notifyTopics : "",
- notifyTopicsArray : null,
- stopTimerListenTopics : "",
- startTimerListenTopics : "",
- beforeNotifyTopics : "",
- beforeNotifyTopicsArray : null,
- afterNotifyTopics : "",
- afterNotifyTopicsArray : null,
- errorNotifyTopics : "",
- errorNotifyTopicsArray : null,
-
-
- //callbacks
- beforeLoading : "",
- afterLoading : "",
-
- formId : "",
- formFilter : "",
-
- indicator: "",
-
- //make dojo process the content
- parseContent : true,
-
- highlightColor : "",
- highlightDuration : 2000,
-
- //only used when inside a tabbedpanel
- disabled : false,
-
- transport : "",
-
- onDownloadStart : function(event) {
- if(!this.showLoading) {
- event.returnValue = false;
- return;
- }
- if(this.showLoading && !dojo.string.isBlank(this.loadingText)) {
- event.text = this.loadingText;
- }
- },
-
- highlight : function() {
- if(!dojo.string.isBlank(this.highlightColor)) {
- var effect = dojo.lfx.html.highlight([this.domNode], this.highlightColor, this.highlightDuration);
- effect.play();
- }
- },
-
- onDownloadError : function(event) {
- this.onError(event);
- },
-
- onContentError : function(event) {
- this.onError(event);
- },
-
- onExecError : function(event) {
- this.onError(event);
- },
-
- onError : function(event) {
- if(this.showError) {
- if(!dojo.string.isBlank(this.errorText)) {
- event.text = this.errorText;
- }
- } else {
- event.text = "";
- }
- },
-
- notify : function(data, type, e) {
- if(this.notifyTopicsArray) {
- var self = this;
- dojo.lang.forEach(this.notifyTopicsArray, function(topic) {
- try {
- dojo.event.topic.publish(topic, data, type, e, self);
- } catch(ex) {
- self.log(ex);
- }
- });
- }
-
- //before, after and error topics
- var topicsArray = null;
- switch(type) {
- case "before":
- this.notifyTo(this.beforeNotifyTopicsArray, null, e);
- break;
- case "load":
- this.notifyTo(this.afterNotifyTopicsArray, data, e);
- break;
- case "error":
- this.notifyTo(this.errorNotifyTopicsArray, data, e);
- break;
- }
- },
-
- notifyTo : function(topicsArray, data, e) {
- var self = this;
- if(topicsArray) {
- dojo.lang.forEach(topicsArray, function(topic) {
- try {
- if(data != null) {
- dojo.event.topic.publish(topic, data, e, self);
- } else {
- dojo.event.topic.publish(topic, e, self);
- }
- } catch(ex){
- self.log(ex);
- }
- });
- }
- },
-
- postCreate : function(args, frag) {
- if (this.handler !== "") {
- this.setHandler(this.handler);
- }
-
- var self = this;
- var hitchedRefresh = function() {
- dojo.lang.hitch(self, "refresh")();
- };
- var hitchedStartTimer = function() {
- dojo.lang.hitch(self, "startTimer")();
- };
-
- if(this.updateFreq > 0) {
- //there is a timer
- this.timer = new dojo.lang.timing.Timer(this.updateFreq);
- this.timer.onTick = hitchedRefresh;
-
- if(this.autoStart) {
- //start the timer
- if(this.delay > 0) {
- //start time after delay
- dojo.lang.setTimeout(hitchedStartTimer, this.delay);
- } else {
- //start timer now
- this.startTimer();
- }
- }
- } else {
- //no timer
- if(this.delay > 0) {
- //load after delay
- dojo.lang.setTimeout(hitchedRefresh, this.delay);
- }
- }
-
- //attach listeners
- if(!dojo.string.isBlank(this.listenTopics)) {
- this.log("Listening to " + this.listenTopics + " to refresh");
- var topics = this.listenTopics.split(",");
- if(topics) {
- dojo.lang.forEach(topics, function(topic){
- dojo.event.topic.subscribe(topic, self, "refresh");
- });
- }
- }
-
- if(!dojo.string.isBlank(this.stopTimerListenTopics)) {
- this.log("Listening to " + this.stopTimerListenTopics + " to stop timer");
- var stopTopics = this.stopTimerListenTopics.split(",");
- if(stopTopics) {
- dojo.lang.forEach(stopTopics, function(topic){
- dojo.event.topic.subscribe(topic, self, "stopTimer");
- });
- }
- }
-
- if(!dojo.string.isBlank(this.startTimerListenTopics)) {
- this.log("Listening to " + this.stopTimerListenTopics + " to start timer");
- var startTopics = this.startTimerListenTopics.split(",");
- if(startTopics) {
- dojo.lang.forEach(startTopics, function(topic){
- dojo.event.topic.subscribe(topic, self, "startTimer");
- });
- }
- }
-
- //notify topics
- if(!dojo.string.isBlank(this.notifyTopics)) {
- this.notifyTopicsArray = this.notifyTopics.split(",");
- }
-
- //before topics
- if(!dojo.string.isBlank(this.beforeNotifyTopics)) {
- this.beforeNotifyTopicsArray = this.beforeNotifyTopics.split(",");
- }
-
- //after topics
- if(!dojo.string.isBlank(this.afterNotifyTopics)) {
- this.afterNotifyTopicsArray = this.afterNotifyTopics.split(",");
- }
-
- //error topics
- if(!dojo.string.isBlank(this.errorNotifyTopics)) {
- this.errorNotifyTopicsArray = this.errorNotifyTopics.split(",");
- }
-
- if(this.isShowing() && this.preload && this.updateFreq <= 0 && this.delay <= 0) {
- this.refresh();
- }
- },
-
- _downloadExternalContent: function(url, useCache) {
-
- var request = {cancel: false};
- this.notify(this.widgetId, "before", request);
- if(request.cancel) {
- return;
- }
-
- //show indicator
- dojo.html.show(this.indicator);
-
- this._handleDefaults("Loading...", "onDownloadStart");
- var self = this;
- dojo.io.bind({
- url: url,
- useCache: useCache,
- preventCache: !useCache,
- mimetype: "text/html",
- formNode: dojo.byId(self.formId),
- formFilter: window[self.formFilter],
- transport: self.transport,
- handler: function(type, data, e) {
- //hide indicator
- dojo.html.hide(self.indicator);
-
- self.notify(data, type, e);
-
- if(type == "load") {
- self.onDownloadEnd.call(self, url, data);
- self.highlight();
- } else {
- // works best when from a live server instead of from file system
- self._handleDefaults.call(self, "Error loading '" + url + "' (" + e.status + " "+ e.statusText + ")", "onDownloadError");
- self.onLoad();
- }
- }
- });
- },
-
- log : function(text) {
- dojo.debug("[" + this.widgetId + "] " + text);
- },
-
- stopTimer : function() {
- if(this.timer && this.timer.isRunning) {
- this.log("stopping timer");
- this.timer.stop();
- }
- },
-
- startTimer : function() {
- if(this.timer && !this.timer.isRunning) {
- this.log("starting timer with update interval " + this.updateFreq);
- this.timer.start();
- }
- },
-
- //from Dojo's ContentPane
- //TODO: remove when fixed on Dojo (WW-1869)
- splitAndFixPaths:function (s, url) {
- var titles = [], scripts = [], tmp = [];
- var match = [], requires = [], attr = [], styles = [];
- var str = "", path = "", fix = "", tagFix = "", tag = "", origPath = "";
- if (!url) {
- url = "./";
- }
- if (s) {
- var regex = /<title[^>]*>([\s\S]*?)<\/title>/i;
- while (match = regex.exec(s)) {
- titles.push(match[1]);
- s = s.substring(0, match.index) + s.substr(match.index + match[0].length);
- }
- if (this.adjustPaths) {
- var regexFindTag = /<[a-z][a-z0-9]*[^>]*\s(?:(?:src|href|style)=[^>])+[^>]*>/i;
- var regexFindAttr = /\s(src|href|style)=(['"]?)([\w()\[\]\/.,\\'"-:;#=&?\s@!]+?)\2/i;
- var regexProtocols = /^(?:[#]|(?:(?:https?|ftps?|file|javascript|mailto|news):))/;
- while (tag = regexFindTag.exec(s)) {
- str += s.substring(0, tag.index);
- s = s.substring((tag.index + tag[0].length), s.length);
- tag = tag[0];
- tagFix = "";
- while (attr = regexFindAttr.exec(tag)) {
- path = "";
- origPath = attr[3];
- switch (attr[1].toLowerCase()) {
- case "src":
- case "href":
- if (regexProtocols.exec(origPath)) {
- path = origPath;
- } else {
- path = (new dojo.uri.Uri(url, origPath).toString());
- }
- break;
- case "style":
- path = dojo.html.fixPathsInCssText(origPath, url);
- break;
- default:
- path = origPath;
- }
- fix = " " + attr[1] + "=" + attr[2] + path + attr[2];
- tagFix += tag.substring(0, attr.index) + fix;
- tag = tag.substring((attr.index + attr[0].length), tag.length);
- }
- str += tagFix + tag;
- }
- s = str + s;
- }
- regex = /(?:<(style)[^>]*>([\s\S]*?)<\/style>|<link ([^>]*rel=['"]?stylesheet['"]?[^>]*)>)/i;
- while (match = regex.exec(s)) {
- if (match[1] && match[1].toLowerCase() == "style") {
- styles.push(dojo.html.fixPathsInCssText(match[2], url));
- } else {
- if (attr = match[3].match(/href=(['"]?)([^'">]*)\1/i)) {
- styles.push({path:attr[2]});
- }
- }
- s = s.substring(0, match.index) + s.substr(match.index + match[0].length);
- }
- var regex = /<script([^>]*)>([\s\S]*?)<\/script>/i;
- var regexSrc = /src=(['"]?)([^"']*)\1/i;
- var regexDojoJs = /.*(\bdojo\b\.js(?:\.uncompressed\.js)?)$/;
- var regexInvalid = /(?:var )?\bdjConfig\b(?:[\s]*=[\s]*\{[^}]+\}|\.[\w]*[\s]*=[\s]*[^;\n]*)?;?|dojo\.hostenv\.writeIncludes\(\s*\);?/g;
- var regexRequires = /dojo\.(?:(?:require(?:After)?(?:If)?)|(?:widget\.(?:manager\.)?registerWidgetPackage)|(?:(?:hostenv\.)?setModulePrefix|registerModulePath)|defineNamespace)\((['"]).*?\1\)\s*;?/;
- while (match = regex.exec(s)) {
- if (this.executeScripts && match[1]) {
- if (attr = regexSrc.exec(match[1])) {
- if (regexDojoJs.exec(attr[2])) {
- dojo.debug("Security note! inhibit:" + attr[2] + " from being loaded again.");
- } else {
- scripts.push({path:attr[2]});
- }
- }
- }
- if (match[2]) {
- var sc = match[2].replace(regexInvalid, "");
- if (!sc) {
- continue;
- }
- while (tmp = regexRequires.exec(sc)) {
- requires.push(tmp[0]);
- sc = sc.substring(0, tmp.index) + sc.substr(tmp.index + tmp[0].length);
- }
- if (this.executeScripts) {
- scripts.push(sc);
- }
- }
- s = s.substr(0, match.index) + s.substr(match.index + match[0].length);
- }
- if (this.extractContent) {
- match = s.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);
- if (match) {
- s = match[1];
- }
- }
- if (this.executeScripts && this.scriptSeparation) {
- var regex = /(<[a-zA-Z][a-zA-Z0-9]*\s[^>]*?\S=)((['"])[^>]*scriptScope[^>]*>)/;
- var regexAttr = /([\s'";:\(])scriptScope(.*)/;
- str = "";
- while (tag = regex.exec(s)) {
- tmp = ((tag[3] == "'") ? "\"" : "'");
- fix = "";
- str += s.substring(0, tag.index) + tag[1];
- while (attr = regexAttr.exec(tag[2])) {
- tag[2] = tag[2].substring(0, attr.index) + attr[1] + "dojo.widget.byId(" + tmp + this.widgetId + tmp + ").scriptScope" + attr[2];
- }
- str += tag[2];
- s = s.substr(tag.index + tag[0].length);
- }
- s = str + s;
- }
- }
- return {"xml":s, "styles":styles, "titles":titles, "requires":requires, "scripts":scripts, "url":url};
- }
-});
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindEvent.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindEvent.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindEvent.js
deleted file mode 100644
index 1b0751d..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/BindEvent.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-dojo.provide("struts.widget.BindEvent");
-
-dojo.require("struts.widget.Bind");
-
-dojo.widget.defineWidget(
- "struts.widget.BindEvent",
- struts.widget.Bind, {
- widgetType : "BindEvent",
-
- sources: "",
-
- postCreate : function() {
- struts.widget.BindEvent.superclass.postCreate.apply(this);
- var self = this;
-
- if(!dojo.string.isBlank(this.events) && !dojo.string.isBlank(this.sources)) {
- var eventsArray = this.events.split(",");
- var sourcesArray = this.sources.split(",");
-
- if(eventsArray && this.domNode) {
- //events
- dojo.lang.forEach(eventsArray, function(event) {
- //sources
- dojo.lang.forEach(sourcesArray, function(source) {
- var sourceObject = dojo.byId(source);
- if(sourceObject) {
- dojo.event.connect(sourceObject, event, function(evt) {
- evt.preventDefault();
- evt.stopPropagation();
- self.reloadContents();
- });
- }
- });
- });
- }
- }
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js
deleted file mode 100644
index 77521c3..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/ComboBox.js
+++ /dev/null
@@ -1,536 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-dojo.provide("struts.widget.ComboBox");
-
-dojo.require("dojo.html.*");
-dojo.require("dojo.widget.ComboBox");
-
-struts.widget.ComboBoxDataProvider = function(combobox, node){
- this.data = [];
- this.searchLimit = combobox.searchLimit;
- this.searchType = "STARTSTRING"; // may also be "STARTWORD" or "SUBSTRING"
- this.caseSensitive = false;
- // for caching optimizations
- this._lastSearch = "";
- this._lastSearchResults = null;
-
- this.firstRequest = true;
-
- this.cbox = combobox;
- this.formId = this.cbox.formId;
- this.formFilter = this.cbox.formFilter;
- this.transport = this.cbox.transport;
-
- this.getData = function(/*String*/ url){
- //show indicator
- dojo.html.show(this.cbox.indicator);
-
- dojo.io.bind({
- url: url,
- formNode: dojo.byId(this.formId),
- formFilter: window[this.formFilter],
- transport: this.transport,
- handler: dojo.lang.hitch(this, function(type, data, evt) {
- //hide indicator
- dojo.html.hide(this.cbox.indicator);
-
- //if notifyTopics is published on the first request (onload)
- //the value of listeners will be reset
- if(!this.firstRequest || type == "error") {
- this.cbox.notify.apply(this.cbox, [data, type, evt]);
- }
-
- this.firstRequest = false;
- var arrData = null;
- var dataByName = data[dojo.string.isBlank(this.cbox.dataFieldName) ? this.cbox.name : this.cbox.dataFieldName];
- if(!dojo.lang.isArray(data)) {
- //if there is a dataFieldName, take it
- if(dataByName) {
- if(dojo.lang.isArray(dataByName)) {
- //ok, it is an array
- arrData = dataByName;
- } else if(dojo.lang.isObject(dataByName)) {
- //it is an object, treat it like a map
- arrData = [];
- for(var key in dataByName){
- arrData.push([key, dataByName[key]]);
- }
- }
- } else {
- //try to find a match
- var tmpArrData = [];
- for(var key in data){
- //does it start with the field name? take it
- if(dojo.string.startsWith(key, this.cbox.name)) {
- arrData = data[key];
- break;
- } else {
- //if nathing else is found, we will use values in this
- //object as the data
- tmpArrData.push([key, data[key]]);
- }
- //grab the first array found, we will use it if nothing else
- //is found
- if(!arrData && dojo.lang.isArray(data[key]) && !dojo.lang.isString(data[key])) {
- arrData = data[key];
- }
- }
- if(!arrData) {
- arrData = tmpArrData;
- }
- }
-
- data = arrData;
- }
- this.setData(data);
- }),
- mimetype: "text/json"
- });
- };
-
- this.startSearch = function (searchStr, callback) {
- // FIXME: need to add timeout handling here!!
- this._preformSearch(searchStr, callback);
- };
-
- this._preformSearch = function(/*String*/ searchStr, callback){
- //
- // NOTE: this search is LINEAR, which means that it exhibits perhaps
- // the worst possible speed characteristics of any search type. It's
- // written this way to outline the responsibilities and interfaces for
- // a search.
- //
- var st = this.searchType;
- // FIXME: this is just an example search, which means that we implement
- // only a linear search without any of the attendant (useful!) optimizations
- var ret = [];
- if(!this.caseSensitive){
- searchStr = searchStr.toLowerCase();
- }
- for(var x=0; x<this.data.length; x++){
- if(!this.data[x] || !this.data[x][0]) {
- //needed for IE
- continue;
- }
- if((this.searchLimit > 0) && (ret.length >= this.searchLimit)) {
- break;
- }
- // FIXME: we should avoid copies if possible!
- var dataLabel = new String((!this.caseSensitive) ? this.data[x][0].toLowerCase() : this.data[x][0]);
- if(dataLabel.length < searchStr.length){
- // this won't ever be a good search, will it? What if we start
- // to support regex search?
- continue;
- }
-
- if(st == "STARTSTRING"){
- if(searchStr == dataLabel.substr(0, searchStr.length)){
- ret.push(this.data[x]);
- }
- }else if(st == "SUBSTRING"){
- // this one is a gimmie
- if(dataLabel.indexOf(searchStr) >= 0){
- ret.push(this.data[x]);
- }
- }else if(st == "STARTWORD"){
- // do a substring search and then attempt to determine if the
- // preceeding char was the beginning of the string or a
- // whitespace char.
- var idx = dataLabel.indexOf(searchStr);
- if(idx == 0){
- // implicit match
- ret.push(this.data[x]);
- }
- if(idx <= 0){
- // if we didn't match or implicily matched, march onward
- continue;
- }
- // otherwise, we have to go figure out if the match was at the
- // start of a word...
- // this code is taken almost directy from nWidgets
- var matches = false;
- while(idx!=-1){
- // make sure the match either starts whole string, or
- // follows a space, or follows some punctuation
- if(" ,/(".indexOf(dataLabel.charAt(idx-1)) != -1){
- // FIXME: what about tab chars?
- matches = true; break;
- }
- idx = dataLabel.indexOf(searchStr, idx+1);
- }
- if(!matches){
- continue;
- }else{
- ret.push(this.data[x]);
- }
- }
- }
- callback(ret);
- };
-
- this.addData = function(/*Array*/ pairs){
- // FIXME: incredibly naive and slow!
- this.data = this.data.concat(pairs);
- };
-
- this.setData = function(/*Array*/ pdata){
- // populate this.data and initialize lookup structures
- this.data = pdata;
- //all ellements must be a key and value pair
- for(var i = 0; i < this.data.length; i++) {
- var element = this.data[i];
- if(!dojo.lang.isArray(element)) {
- this.data[i] = [element, element];
- }
- }
- };
-
-
- if(!dojo.string.isBlank(this.cbox.dataUrl) && this.cbox.preload){
- this.getData(this.cbox.dataUrl);
- } else {
- // check to see if we can populate the list from <option> elements
- if((node)&&(node.nodeName.toLowerCase() == "select")){
- // NOTE: we're not handling <optgroup> here yet
- var opts = node.getElementsByTagName("option");
- var ol = opts.length;
- var data = [];
- for(var x=0; x<ol; x++){
- var text = opts[x].textContent || opts[x].innerText || opts[x].innerHTML;
- var keyValArr = [String(text), String(opts[x].value)];
- data.push(keyValArr);
- if(opts[x].selected){
- this.cbox.setAllValues(keyValArr[0], keyValArr[1]);
- }
- }
- this.setData(data);
- }
- }
-};
-
-dojo.widget.defineWidget(
- "struts.widget.ComboBox",
- dojo.widget.ComboBox, {
- widgetType : "ComboBox",
-
- dropdownHeight: 120,
- dropdownWidth: 0,
- itemHeight: 0,
-
- listenTopics : "",
- notifyTopics : "",
- notifyTopicsArray : null,
- beforeNotifyTopics : "",
- beforeNotifyTopicsArray : null,
- afterNotifyTopics : "",
- afterNotifyTopicsArray : null,
- errorNotifyTopics : "",
- errorNotifyTopicsArray : null,
- valueNotifyTopics : "",
- valueNotifyTopicsArray : null,
- indicator : "",
-
- formId : "",
- formFilter : "",
- dataProviderClass: "struts.widget.ComboBoxDataProvider",
-
- loadOnType : false,
- loadMinimum : 3,
-
- initialValue : "",
- initialKey : "",
-
- visibleDownArrow : true,
- fadeTime : 100,
-
- //dojo has "stringstart" which is invalid
- searchType: "STARTSTRING",
-
- dataFieldName : "",
- keyName: "",
- //embedded the style in the template string in 0.4.2 release, not good
- templateCssString: null,
- templateCssPath: dojo.uri.dojoUri("struts/ComboBox.css"),
-
- //how many results are shown
- searchLimit : 30,
-
- transport : "",
-
- //load options when page loads
- preload : true,
-
- tabIndex: "",
-
- //from Dojo's ComboBox
- showResultList: function() {
- // Our dear friend IE doesnt take max-height so we need to calculate that on our own every time
- var childs = this.optionsListNode.childNodes;
- if(childs.length){
-
- this.optionsListNode.style.width = this.dropdownWidth === 0 ? (dojo.html.getMarginBox(this.domNode).width-2)+"px" : this.dropdownWidth + "px";
-
- if(this.itemHeight === 0 || dojo.string.isBlank(this.textInputNode.value)) {
- this.optionsListNode.style.height = this.dropdownHeight + "px";
- this.optionsListNode.style.display = "";
- this.itemHeight = dojo.html.getMarginBox(childs[0]).height;
- }
-
- //if there is extra space, adjust height
- var totalHeight = this.itemHeight * childs.length;
- if(totalHeight < this.dropdownHeight) {
- this.optionsListNode.style.height = totalHeight + 2 + "px";
- } else {
- this.optionsListNode.style.height = this.dropdownHeight + "px";
- }
-
- this.popupWidget.open(this.domNode, this, this.downArrowNode);
- } else {
- this._hideResultList();
- }
- },
-
- _openResultList: function(/*Array*/ results){
- if (this.disabled) {
- return;
- }
- this._clearResultList();
- if(!results.length){
- this._hideResultList();
- }
-
- if( (this.autoComplete)&&
- (results.length)&&
- (!this._prev_key_backspace)&&
- (this.textInputNode.value.length > 0)){
- var cpos = this._getCaretPos(this.textInputNode);
- // only try to extend if we added the last character at the end of the input
- if((cpos+1) > this.textInputNode.value.length){
- // only add to input node as we would overwrite Capitalisation of chars
- this.textInputNode.value += results[0][0].substr(cpos);
- // build a new range that has the distance from the earlier
- // caret position to the end of the first string selected
- this._setSelectedRange(this.textInputNode, cpos, this.textInputNode.value.length);
- }
- }
- var typedText = this.textInputNode.value;
- var even = true;
- while(results.length){
- var tr = results.shift();
- if(tr){
- var td = document.createElement("div");
- var text = tr[0];
- var i = text.toLowerCase().indexOf(typedText.toLowerCase());
- if(i >= 0) {
- var pre = text.substring(0, i);
- var matched = text.substring(i, i + typedText.length);
- var post = text.substring(i + typedText.length);
-
- if(!dojo.string.isBlank(pre)) {
- td.appendChild(document.createTextNode(pre));
- }
- var boldNode = document.createElement("b");
- td.appendChild(boldNode);
- boldNode.appendChild(document.createTextNode(matched));
- td.appendChild(document.createTextNode(post));
- } else {
- td.appendChild(document.createTextNode(tr[0]));
- }
-
- td.setAttribute("resultName", tr[0]);
- td.setAttribute("resultValue", tr[1]);
- td.className = "dojoComboBoxItem "+((even) ? "dojoComboBoxItemEven" : "dojoComboBoxItemOdd");
- even = (!even);
- this.optionsListNode.appendChild(td);
- }
- }
-
- // show our list (only if we have content, else nothing)
- this.showResultList();
- },
-
- postCreate : function() {
- struts.widget.ComboBox.superclass.postCreate.apply(this);
- var self = this;
- //events
- if(!dojo.string.isBlank(this.listenTopics)) {
- var topics = this.listenTopics.split(",");
- for(var i = 0; i < topics.length; i++) {
- dojo.event.topic.subscribe(topics[i], function() {
- var request = {cancel: false};
- self.notify(this.widgetId, "before", request);
- if(request.cancel) {
- return;
- }
- self.clearValues();
- self.dataProvider.getData(self.dataUrl);
- });
- }
- }
-
- //notify topics
- if(!dojo.string.isBlank(this.notifyTopics)) {
- this.notifyTopicsArray = this.notifyTopics.split(",");
- }
-
- //before topics
- if(!dojo.string.isBlank(this.beforeNotifyTopics)) {
- this.beforeNotifyTopicsArray = this.beforeNotifyTopics.split(",");
- }
-
- //after topics
- if(!dojo.string.isBlank(this.afterNotifyTopics)) {
- this.afterNotifyTopicsArray = this.afterNotifyTopics.split(",");
- }
-
- //error topics
- if(!dojo.string.isBlank(this.errorNotifyTopics)) {
- this.errorNotifyTopicsArray = this.errorNotifyTopics.split(",");
- }
-
- //value topics
- if(!dojo.string.isBlank(this.valueNotifyTopics)) {
- this.valueNotifyTopicsArray = this.valueNotifyTopics.split(",");
- }
-
- //better name
- this.comboBoxSelectionValue.name = dojo.string.isBlank(this.keyName) ? this.name + "Key" : this.keyName;
-
- //init values
- this.comboBoxValue.value = this.initialValue;
- this.comboBoxSelectionValue.value = this.initialKey;
- this.textInputNode.value = this.initialValue;
-
- //tabindex
- if(!dojo.string.isBlank(this.tabIndex)) {
- this.textInputNode.tabIndex = this.tabIndex;
- }
-
- //hide arrow?
- if(!this.visibleDownArrow) {
- dojo.html.hide(this.downArrowNode);
- }
-
- //search type
- if(!dojo.string.isBlank(this.searchType)) {
- this.dataProvider.searchType = this.searchType.toUpperCase();
- }
- },
-
- clearValues : function() {
- this.comboBoxValue.value = "";
- this.comboBoxSelectionValue.value = "";
- this.textInputNode.value = "";
- },
-
- onValueChanged : function(data) {
- this.notify(data, "valuechanged", null);
- },
-
- notify : function(data, type, e) {
- var self = this;
- //general topics
- if(this.notifyTopicsArray) {
- dojo.lang.forEach(this.notifyTopicsArray, function(topic) {
- try {
- dojo.event.topic.publish(topic, data, type, e, self);
- } catch(ex){
- self.log(ex);
- }
- });
- }
-
- //before, after and error topics
- var topicsArray = null;
- switch(type) {
- case "before":
- this.notifyTo(this.beforeNotifyTopicsArray, [e, this]);
- break;
- case "load":
- this.notifyTo(this.afterNotifyTopicsArray, [data, e, this]);
- break;
- case "error":
- this.notifyTo(this.errorNotifyTopicsArray, [data, e, this]);
- break;
- case "valuechanged":
- this.notifyTo(this.valueNotifyTopicsArray, [this.getSelectedValue(), this.getSelectedKey(), this.getText(), this]);
- break;
- }
- },
-
- notifyTo : function(topicsArray, params) {
- var self = this;
- if(topicsArray) {
- dojo.lang.forEach(topicsArray, function(topic) {
- try {
- dojo.event.topic.publishApply(topic, params);
- } catch(ex){
- self.log(ex);
- }
- });
- }
- },
-
- log : function(text) {
- dojo.debug("[" + (this.widgetId ? this.widgetId : "unknown") + "] " + text);
- },
-
- _startSearchFromInput: function() {
- var searchStr = this.textInputNode.value;
- if(this.loadOnType) {
- if(searchStr.length >= this.loadMinimum) {
- var nuHref = this.dataUrl + (this.dataUrl.indexOf("?") > -1 ? "&" : "?");
- nuHref += this.name + '=' + encodeURIComponent(searchStr);
- this.dataProvider.getData(nuHref);
- this._startSearch(searchStr);
- } else {
- this._hideResultList();
- }
- }
- else {
- this._startSearch(searchStr);
- }
- },
-
- setSelectedKey : function(key) {
- var data = this.dataProvider.data;
- for(element in data) {
- var obj = data[element];
- if(obj[1].toString() == key) {
- this.setValue(obj[0].toString());
- this.comboBoxSelectionValue.value = obj[1].toString();
- }
- }
- },
-
- getSelectedKey : function() {
- return this.comboBoxSelectionValue.value;
- },
-
- getSelectedValue : function() {
- return this.comboBoxValue.value;
- },
-
- getText : function() {
- return this.textInputNode.value;
- }
-});
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsDatePicker.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsDatePicker.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsDatePicker.js
deleted file mode 100644
index 78d3d87..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsDatePicker.js
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-dojo.provide("struts.widget.StrutsDatePicker");
-
-dojo.require("dojo.widget.DropdownDatePicker");
-dojo.widget.defineWidget(
- "struts.widget.StrutsDatePicker",
- dojo.widget.DropdownDatePicker, {
- widgetType : "StrutsDatePicker",
-
- valueNotifyTopics : "",
- valueNotifyTopicsArray : null,
- tabIndex : "",
-
- postCreate: function() {
- struts.widget.StrutsDatePicker.superclass.postCreate.apply(this, arguments);
-
- //set cssClass
- if(this.extraArgs["class"]) {
- dojo.html.setClass(this.inputNode, this.extraArgs["class"]);
- }
-
- //set cssStyle
- if(this.extraArgs.style) {
- dojo.html.setStyleText(this.inputNode, this.extraArgs.style);
- }
-
- //value topics
- if(!dojo.string.isBlank(this.valueNotifyTopics)) {
- this.valueNotifyTopicsArray = this.valueNotifyTopics.split(",");
- }
-
- //tabindex
- if(!dojo.string.isBlank(this.tabIndex)) {
- this.inputNode.tabIndex = this.tabIndex;
- }
- },
-
- _syncValueNode:function () {
- var date = this.datePicker.value;
- var value = "";
- switch (this.saveFormat.toLowerCase()) {
- case "rfc":
- case "iso":
- case "":
- value = dojo.date.toRfc3339(date);
- break;
- case "posix":
- case "unix":
- value = Number(date);
- break;
- default:
- if (date) {
- value = dojo.date.format(date, {datePattern:this.saveFormat, selector:"dateOnly", locale:this.lang});
- }
- }
- this.valueNode.value = value;
- },
-
- _updateText : function() {
- struts.widget.StrutsDatePicker.superclass._updateText.apply(this, arguments);
- if(this.valueNotifyTopicsArray != null) {
- for(var i = 0; i < this.valueNotifyTopicsArray.length; i++) {
- var topic = this.valueNotifyTopicsArray[i];
- if(!dojo.string.isBlank(topic)) {
- try {
- dojo.event.topic.publish(topic, this.inputNode.value, this.getValue(), this);
- } catch(ex) {
- dojo.debug(ex);
- }
- }
- }
- }
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTabContainer.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTabContainer.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTabContainer.js
deleted file mode 100644
index d6c1820..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTabContainer.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-dojo.provide("struts.widget.StrutsTabContainer");
-
-dojo.require("dojo.widget.TabContainer");
-
-dojo.widget.defineWidget(
- "struts.widget.StrutsTabContainer",
- dojo.widget.TabContainer, {
- widgetType : "StrutsTabContainer",
-
- afterSelectTabNotifyTopics : "",
- afterSelectTabNotifyTopicsArray : null,
- beforeSelectTabNotifyTopics : "",
- beforeSelectTabNotifyTopicsArray : null,
-
- disabledTabCssClass : "strutsDisabledTab",
-
- postCreate : function() {
- struts.widget.StrutsTabContainer.superclass.postCreate.apply(this);
-
- //before topics
- if(!dojo.string.isBlank(this.beforeSelectTabNotifyTopics)) {
- this.beforeSelectTabNotifyTopicsArray = this.beforeSelectTabNotifyTopics.split(",");
- }
-
- //after topics
- if(!dojo.string.isBlank(this.afterSelectTabNotifyTopics)) {
- this.afterSelectTabNotifyTopicsArray = this.afterSelectTabNotifyTopics.split(",");
- }
-
- // add disabled class to disabled tabs
- if(this.disabledTabCssClass) {
- dojo.lang.forEach(this.children, function(div){
- if(div.disabled) {
- this.disableTab(div);
- }
- });
- }
- },
-
- selectChild: function (tab, callingWidget) {
- if(!tab.disabled) {
- var cancel = {"cancel" : false};
-
- if(this.beforeSelectTabNotifyTopicsArray) {
- var self = this;
- dojo.lang.forEach(this.beforeSelectTabNotifyTopicsArray, function(topic) {
- try {
- dojo.event.topic.publish(topic, cancel, tab, self);
- } catch(ex){
- dojo.debug(ex);
- }
- });
- }
-
- if(!cancel.cancel) {
- struts.widget.StrutsTabContainer.superclass.selectChild.apply(this, [tab, callingWidget]);
-
- if(this.afterSelectTabNotifyTopicsArray) {
- var self = this;
- dojo.lang.forEach(this.afterSelectTabNotifyTopicsArray, function(topic) {
- try {
- dojo.event.topic.publish(topic, tab, self);
- } catch(ex){
- dojo.debug(ex);
- }
- });
- }
- }
- }
- },
-
- disableTab : function(t) {
- var tabWidget = this.getTabWidget(t);
- tabWidget.disabled = true;
- dojo.html.addClass(tabWidget.controlButton.domNode, this.disabledTabCssClass);
- },
-
- enableTab : function(t) {
- var tabWidget = this.getTabWidget(t);
- tabWidget.disabled = false;
- dojo.html.removeClass(tabWidget.controlButton.domNode, this.disabledTabCssClass);
- },
-
- getTabWidget : function(t) {
- if(dojo.lang.isNumber(t)) {
- //tab index
- return this.children[t];
- } else if(dojo.lang.isString(t)) {
- //tab id
- return dojo.widget.byId(t);
- } else {
- //tab widget?
- return t;
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTimePicker.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTimePicker.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTimePicker.js
deleted file mode 100644
index 3892a1f..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTimePicker.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-//If we use "TimePicker" for the name, Dojo get's confused and breaks
-//TODO remove this file on next Dojo release
-
-dojo.provide("struts.widget.StrutsTimePicker");
-
-dojo.require("dojo.widget.DropdownTimePicker");
-
-dojo.widget.defineWidget(
- "struts.widget.StrutsTimePicker",
- dojo.widget.DropdownTimePicker, {
- widgetType : "StrutsTimePicker",
-
- inputName: "",
- name: "",
-
- valueNotifyTopics : "",
- valueNotifyTopicsArray : null,
-
- tabIndex : "",
-
- postCreate: function() {
- struts.widget.StrutsTimePicker.superclass.postCreate.apply(this, arguments);
-
- //set cssClass
- if(this.extraArgs["class"]) {
- dojo.html.setClass(this.inputNode, this.extraArgs["class"]);
- }
-
- //set cssStyle
- if(this.extraArgs.style) {
- dojo.html.setStyleText(this.inputNode, this.extraArgs.style);
- }
-
- //value topics
- if(!dojo.string.isBlank(this.valueNotifyTopics)) {
- this.valueNotifyTopicsArray = this.valueNotifyTopics.split(",");
- }
-
- //tabindex
- if(!dojo.string.isBlank(this.tabIndex)) {
- this.inputNode.tabIndex = this.tabIndex;
- }
- },
-
- _syncValueNode:function () {
- var time = this.timePicker.time;
- var value;
- switch (this.saveFormat.toLowerCase()) {
- case "rfc":
- case "iso":
- case "":
- //originally, Dojo only saves the time part
- value = dojo.date.toRfc3339(time);
- break;
- case "posix":
- case "unix":
- value = Number(time);
- break;
- default:
- value = dojo.date.format(time, {datePattern:this.saveFormat, selector:"timeOnly", locale:this.lang});
- }
- this.valueNode.value = value;
- },
-
- _updateText : function() {
- struts.widget.StrutsTimePicker.superclass._updateText.apply(this, arguments);
- if(this.valueNotifyTopicsArray != null) {
- for(var i = 0; i < this.valueNotifyTopicsArray.length; i++) {
- var topic = this.valueNotifyTopicsArray[i];
- if(!dojo.string.isBlank(topic)) {
- try {
- dojo.event.topic.publish(topic, this.inputNode.value, this.getValue(), this);
- } catch(ex) {
- dojo.debug(ex);
- }
- }
- }
- }
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTree.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTree.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTree.js
deleted file mode 100644
index c911716..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTree.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-dojo.provide("struts.widget.StrutsTree");
-
-dojo.require("dojo.widget.Tree");
-
-dojo.widget.defineWidget(
- "struts.widget.StrutsTree",
- dojo.widget.Tree, {
- widgetType : "StrutsTree",
-
- href : "",
- errorNotifyTopics : "",
- errorNotifyTopicsArray : null,
-
- postCreate : function() {
- struts.widget.StrutsTree.superclass.postCreate.apply(this);
-
- //error topics
- if(!dojo.string.isBlank(this.errorNotifyTopics)) {
- this.errorNotifyTopicsArray = this.errorNotifyTopics.split(",");
- }
-
- var self = this;
- if(!dojo.string.isBlank(this.href)) {
- dojo.io.bind({
- url: this.href,
- useCache: false,
- preventCache: true,
- handler: function(type, data, e) {
- if(type == 'load') {
- //data should be an array
- if(data) {
- dojo.lang.forEach(data, function(descr) {
- //create node for eachd descriptor
- var newNode = dojo.widget.createWidget("struts:StrutsTreeNode",{
- title : descr.label,
- isFolder: descr.hasChildren,
- widgetId: descr.id
- });
- self.addChild(newNode);
- });
- }
- } else {
- //publish error topics
- if(self.errorNotifyTopicsArray) {
- dojo.lang.forEach(self.errorNotifyTopicsArray, function(topic) {
- try {
- dojo.event.topic.publish(topic, data, e, self);
- } catch(ex){
- dojo.debug(ex);
- }
- });
- }
- }
- },
- mimetype: "text/json"
- });
- }
- }
-});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTreeNode.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTreeNode.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTreeNode.js
deleted file mode 100644
index 1cf55cb..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/struts/widget/StrutsTreeNode.js
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * $Id$
- *
- * 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.
- */
-
-dojo.provide("struts.widget.StrutsTreeNode");
-
-dojo.require("dojo.widget.TreeNode");
-
-dojo.widget.defineWidget(
- "struts.widget.StrutsTreeNode",
- dojo.widget.TreeNode, {
- widgetType : "StrutsTreeNode",
-
- loaded : false,
-
- expand : function() {
- if(!this.loaded) {
- this.reload();
- }
- struts.widget.StrutsTreeNode.superclass.expand.apply(this);
- },
-
- removeChildren : function() {
- var self = this;
- var childrenCopy = dojo.lang.toArray(this.children);
- dojo.lang.forEach(childrenCopy, function(node) {
- self.removeNode(node);
- });
- },
-
- reload : function() {
- var href = this.tree.href;
- this.loaded = true;
-
- if(!dojo.string.isBlank(href)) {
- //clear children list
- this.removeChildren();
- //pass widgetId as parameter
- var tmpHref = href + (href.indexOf("?") > -1 ? "&" : "?") + "nodeId=" + this.widgetId;
-
- var self = this;
- this.markLoading();
-
- dojo.io.bind({
- url: tmpHref,
- useCache: false,
- preventCache: true,
- handler: function(type, data, e) {
- if(type == 'load') {
- //data should be an array
- if(data) {
- dojo.lang.forEach(data, function(descr) {
- //create node for eachd descriptor
- var newNode = dojo.widget.createWidget("struts:StrutsTreeNode",{
- title : descr.label,
- isFolder: descr.hasChildren,
- widgetId: descr.id
- });
- self.addChild(newNode);
- });
- }
- }
-
- self.unMarkLoading();
- },
- mimetype: "text/json"
- });
- }
- }
-});
\ No newline at end of file