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:46 UTC
[19/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/widget/PopupContainer.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/PopupContainer.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/PopupContainer.js
deleted file mode 100644
index f1eb3a2..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/PopupContainer.js
+++ /dev/null
@@ -1,297 +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.widget.PopupContainer");
-dojo.require("dojo.html.style");
-dojo.require("dojo.html.layout");
-dojo.require("dojo.html.selection");
-dojo.require("dojo.html.iframe");
-dojo.require("dojo.event.*");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.widget.HtmlWidget");
-dojo.declare("dojo.widget.PopupContainerBase", null, function () {
- this.queueOnAnimationFinish = [];
-}, {isShowingNow:false, currentSubpopup:null, beginZIndex:1000, parentPopup:null, parent:null, popupIndex:0, aroundBox:dojo.html.boxSizing.BORDER_BOX, openedForWindow:null, processKey:function (evt) {
- return false;
-}, applyPopupBasicStyle:function () {
- with (this.domNode.style) {
- display = "none";
- position = "absolute";
- }
-}, aboutToShow:function () {
-}, open:function (x, y, parent, explodeSrc, orient, padding) {
- if (this.isShowingNow) {
- return;
- }
- if (this.animationInProgress) {
- this.queueOnAnimationFinish.push(this.open, arguments);
- return;
- }
- this.aboutToShow();
- var around = false, node, aroundOrient;
- if (typeof x == "object") {
- node = x;
- aroundOrient = explodeSrc;
- explodeSrc = parent;
- parent = y;
- around = true;
- }
- this.parent = parent;
- dojo.body().appendChild(this.domNode);
- explodeSrc = explodeSrc || parent["domNode"] || [];
- var parentPopup = null;
- this.isTopLevel = true;
- while (parent) {
- if (parent !== this && (parent.setOpenedSubpopup != undefined && parent.applyPopupBasicStyle != undefined)) {
- parentPopup = parent;
- this.isTopLevel = false;
- parentPopup.setOpenedSubpopup(this);
- break;
- }
- parent = parent.parent;
- }
- this.parentPopup = parentPopup;
- this.popupIndex = parentPopup ? parentPopup.popupIndex + 1 : 1;
- if (this.isTopLevel) {
- var button = dojo.html.isNode(explodeSrc) ? explodeSrc : null;
- dojo.widget.PopupManager.opened(this, button);
- }
- if (this.isTopLevel && !dojo.withGlobal(this.openedForWindow || dojo.global(), dojo.html.selection.isCollapsed)) {
- this._bookmark = dojo.withGlobal(this.openedForWindow || dojo.global(), dojo.html.selection.getBookmark);
- } else {
- this._bookmark = null;
- }
- if (explodeSrc instanceof Array) {
- explodeSrc = {left:explodeSrc[0], top:explodeSrc[1], width:0, height:0};
- }
- with (this.domNode.style) {
- display = "";
- zIndex = this.beginZIndex + this.popupIndex;
- }
- if (around) {
- this.move(node, padding, aroundOrient);
- } else {
- this.move(x, y, padding, orient);
- }
- this.domNode.style.display = "none";
- this.explodeSrc = explodeSrc;
- this.show();
- this.isShowingNow = true;
-}, move:function (x, y, padding, orient) {
- var around = (typeof x == "object");
- if (around) {
- var aroundOrient = padding;
- var node = x;
- padding = y;
- if (!aroundOrient) {
- aroundOrient = {"BL":"TL", "TL":"BL"};
- }
- dojo.html.placeOnScreenAroundElement(this.domNode, node, padding, this.aroundBox, aroundOrient);
- } else {
- if (!orient) {
- orient = "TL,TR,BL,BR";
- }
- dojo.html.placeOnScreen(this.domNode, x, y, padding, true, orient);
- }
-}, close:function (force) {
- if (force) {
- this.domNode.style.display = "none";
- }
- if (this.animationInProgress) {
- this.queueOnAnimationFinish.push(this.close, []);
- return;
- }
- this.closeSubpopup(force);
- this.hide();
- if (this.bgIframe) {
- this.bgIframe.hide();
- this.bgIframe.size({left:0, top:0, width:0, height:0});
- }
- if (this.isTopLevel) {
- dojo.widget.PopupManager.closed(this);
- }
- this.isShowingNow = false;
- if (this.parent) {
- setTimeout(dojo.lang.hitch(this, function () {
- try {
- if (this.parent["focus"]) {
- this.parent.focus();
- } else {
- this.parent.domNode.focus();
- }
- }
- catch (e) {
- dojo.debug("No idea how to focus to parent", e);
- }
- }), 10);
- }
- if (this._bookmark && dojo.withGlobal(this.openedForWindow || dojo.global(), dojo.html.selection.isCollapsed)) {
- if (this.openedForWindow) {
- this.openedForWindow.focus();
- }
- try {
- dojo.withGlobal(this.openedForWindow || dojo.global(), "moveToBookmark", dojo.html.selection, [this._bookmark]);
- }
- catch (e) {
- }
- }
- this._bookmark = null;
-}, closeAll:function (force) {
- if (this.parentPopup) {
- this.parentPopup.closeAll(force);
- } else {
- this.close(force);
- }
-}, setOpenedSubpopup:function (popup) {
- this.currentSubpopup = popup;
-}, closeSubpopup:function (force) {
- if (this.currentSubpopup == null) {
- return;
- }
- this.currentSubpopup.close(force);
- this.currentSubpopup = null;
-}, onShow:function () {
- dojo.widget.PopupContainer.superclass.onShow.apply(this, arguments);
- this.openedSize = {w:this.domNode.style.width, h:this.domNode.style.height};
- if (dojo.render.html.ie) {
- if (!this.bgIframe) {
- this.bgIframe = new dojo.html.BackgroundIframe();
- this.bgIframe.setZIndex(this.domNode);
- }
- this.bgIframe.size(this.domNode);
- this.bgIframe.show();
- }
- this.processQueue();
-}, processQueue:function () {
- if (!this.queueOnAnimationFinish.length) {
- return;
- }
- var func = this.queueOnAnimationFinish.shift();
- var args = this.queueOnAnimationFinish.shift();
- func.apply(this, args);
-}, onHide:function () {
- dojo.widget.HtmlWidget.prototype.onHide.call(this);
- if (this.openedSize) {
- with (this.domNode.style) {
- width = this.openedSize.w;
- height = this.openedSize.h;
- }
- }
- this.processQueue();
-}});
-dojo.widget.defineWidget("dojo.widget.PopupContainer", [dojo.widget.HtmlWidget, dojo.widget.PopupContainerBase], {isContainer:true, fillInTemplate:function () {
- this.applyPopupBasicStyle();
- dojo.widget.PopupContainer.superclass.fillInTemplate.apply(this, arguments);
-}});
-dojo.widget.PopupManager = new function () {
- this.currentMenu = null;
- this.currentButton = null;
- this.currentFocusMenu = null;
- this.focusNode = null;
- this.registeredWindows = [];
- this.registerWin = function (win) {
- if (!win.__PopupManagerRegistered) {
- dojo.event.connect(win.document, "onmousedown", this, "onClick");
- dojo.event.connect(win, "onscroll", this, "onClick");
- dojo.event.connect(win.document, "onkey", this, "onKey");
- win.__PopupManagerRegistered = true;
- this.registeredWindows.push(win);
- }
- };
- this.registerAllWindows = function (targetWindow) {
- if (!targetWindow) {
- targetWindow = dojo.html.getDocumentWindow(window.top && window.top.document || window.document);
- }
- this.registerWin(targetWindow);
- for (var i = 0; i < targetWindow.frames.length; i++) {
- try {
- var win = dojo.html.getDocumentWindow(targetWindow.frames[i].document);
- if (win) {
- this.registerAllWindows(win);
- }
- }
- catch (e) {
- }
- }
- };
- this.unRegisterWin = function (win) {
- if (win.__PopupManagerRegistered) {
- dojo.event.disconnect(win.document, "onmousedown", this, "onClick");
- dojo.event.disconnect(win, "onscroll", this, "onClick");
- dojo.event.disconnect(win.document, "onkey", this, "onKey");
- win.__PopupManagerRegistered = false;
- }
- };
- this.unRegisterAllWindows = function () {
- for (var i = 0; i < this.registeredWindows.length; ++i) {
- this.unRegisterWin(this.registeredWindows[i]);
- }
- this.registeredWindows = [];
- };
- dojo.addOnLoad(this, "registerAllWindows");
- dojo.addOnUnload(this, "unRegisterAllWindows");
- this.closed = function (menu) {
- if (this.currentMenu == menu) {
- this.currentMenu = null;
- this.currentButton = null;
- this.currentFocusMenu = null;
- }
- };
- this.opened = function (menu, button) {
- if (menu == this.currentMenu) {
- return;
- }
- if (this.currentMenu) {
- this.currentMenu.close();
- }
- this.currentMenu = menu;
- this.currentFocusMenu = menu;
- this.currentButton = button;
- };
- this.setFocusedMenu = function (menu) {
- this.currentFocusMenu = menu;
- };
- this.onKey = function (e) {
- if (!e.key) {
- return;
- }
- if (!this.currentMenu || !this.currentMenu.isShowingNow) {
- return;
- }
- var m = this.currentFocusMenu;
- while (m) {
- if (m.processKey(e)) {
- e.preventDefault();
- e.stopPropagation();
- break;
- }
- m = m.parentPopup || m.parentMenu;
- }
- }, this.onClick = function (e) {
- if (!this.currentMenu) {
- return;
- }
- var scrolloffset = dojo.html.getScroll().offset;
- var m = this.currentMenu;
- while (m) {
- if (dojo.html.overElement(m.domNode, e) || dojo.html.isDescendantOf(e.target, m.domNode)) {
- return;
- }
- m = m.currentSubpopup;
- }
- if (this.currentButton && dojo.html.overElement(this.currentButton, e)) {
- return;
- }
- this.currentMenu.closeAll(true);
- };
-};
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ProgressBar.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ProgressBar.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ProgressBar.js
deleted file mode 100644
index bcd1e31..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ProgressBar.js
+++ /dev/null
@@ -1,187 +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.widget.ProgressBar");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.event");
-dojo.require("dojo.dom");
-dojo.require("dojo.html.style");
-dojo.require("dojo.string.*");
-dojo.require("dojo.lfx.*");
-dojo.widget.defineWidget("dojo.widget.ProgressBar", dojo.widget.HtmlWidget, {progressValue:0, maxProgressValue:100, width:300, height:30, frontPercentClass:"frontPercent", backPercentClass:"backPercent", frontBarClass:"frontBar", backBarClass:"backBar", hasText:false, isVertical:false, showOnlyIntegers:false, dataSource:"", pollInterval:3000, duration:1000, templateString:"<div dojoAttachPoint=\"containerNode\" style=\"position:relative;overflow:hidden\">\n\t<div style=\"position:absolute;display:none;width:100%;text-align:center\" dojoAttachPoint=\"backPercentLabel\" class=\"dojoBackPercentLabel\"></div>\n\t<div style=\"position:absolute;overflow:hidden;width:100%;height:100%\" dojoAttachPoint=\"internalProgress\">\n\t<div style=\"position:absolute;display:none;width:100%;text-align:center\" dojoAttachPoint=\"frontPercentLabel\" class=\"dojoFrontPercentLabel\"></div></div>\n</div>\n", templateCssString:".backBar{\n\tborder:1px solid #84a3d1;\n}\n.frontBar{\n\tbackground:url(\"image
s/bar.gif\") repeat bottom left;\n\tbackground-attachment: fixed;\n}\n.h-frontBar{\n\tbackground:url(\"images/h-bar.gif\") repeat bottom left;\n\tbackground-attachment: fixed;\n}\n.simpleFrontBar{\n\tbackground: red;\n}\n.frontPercent,.backPercent{\n\tfont:bold 13px helvetica;\n}\n.backPercent{\n\tcolor:#293a4b;\n}\n.frontPercent{\n\tcolor:#fff;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/ProgressBar.css"), containerNode:null, internalProgress:null, _pixelUnitRatio:0, _pixelPercentRatio:0, _unitPercentRatio:0, _unitPixelRatio:0, _floatDimension:0, _intDimension:0, _progressPercentValue:"0%", _floatMaxProgressValue:0, _dimension:"width", _pixelValue:0, _oInterval:null, _animation:null, _animationStopped:true, _progressValueBak:false, _hasTextBak:false, fillInTemplate:function (args, frag) {
- this.internalProgress.className = this.frontBarClass;
- this.containerNode.className = this.backBarClass;
- if (this.isVertical) {
- this.internalProgress.style.bottom = "0px";
- this.internalProgress.style.left = "0px";
- this._dimension = "height";
- } else {
- this.internalProgress.style.top = "0px";
- this.internalProgress.style.left = "0px";
- this._dimension = "width";
- }
- this.frontPercentLabel.className = this.frontPercentClass;
- this.backPercentLabel.className = this.backPercentClass;
- this.progressValue = "" + this.progressValue;
- this.domNode.style.height = this.height + "px";
- this.domNode.style.width = this.width + "px";
- this._intDimension = parseInt("0" + eval("this." + this._dimension));
- this._floatDimension = parseFloat("0" + eval("this." + this._dimension));
- this._pixelPercentRatio = this._floatDimension / 100;
- this.setMaxProgressValue(this.maxProgressValue, true);
- this.setProgressValue(dojo.string.trim(this.progressValue), true);
- dojo.debug("float dimension: " + this._floatDimension);
- dojo.debug("this._unitPixelRatio: " + this._unitPixelRatio);
- this.showText(this.hasText);
-}, showText:function (visible) {
- if (visible) {
- this.backPercentLabel.style.display = "block";
- this.frontPercentLabel.style.display = "block";
- } else {
- this.backPercentLabel.style.display = "none";
- this.frontPercentLabel.style.display = "none";
- }
- this.hasText = visible;
-}, postCreate:function (args, frag) {
- this.render();
-}, _backupValues:function () {
- this._progressValueBak = this.progressValue;
- this._hasTextBak = this.hasText;
-}, _restoreValues:function () {
- this.setProgressValue(this._progressValueBak);
- this.showText(this._hasTextBak);
-}, _setupAnimation:function () {
- var _self = this;
- dojo.debug("internalProgress width: " + this.internalProgress.style.width);
- this._animation = dojo.lfx.html.slideTo(this.internalProgress, {top:0, left:parseInt(this.width) - parseInt(this.internalProgress.style.width)}, parseInt(this.duration), null, function () {
- var _backAnim = dojo.lfx.html.slideTo(_self.internalProgress, {top:0, left:0}, parseInt(_self.duration));
- dojo.event.connect(_backAnim, "onEnd", function () {
- if (!_self._animationStopped) {
- _self._animation.play();
- }
- });
- if (!_self._animationStopped) {
- _backAnim.play();
- }
- _backAnim = null;
- });
-}, getMaxProgressValue:function () {
- return this.maxProgressValue;
-}, setMaxProgressValue:function (maxValue, noRender) {
- if (!this._animationStopped) {
- return;
- }
- this.maxProgressValue = maxValue;
- this._floatMaxProgressValue = parseFloat("0" + this.maxProgressValue);
- this._pixelUnitRatio = this._floatDimension / this.maxProgressValue;
- this._unitPercentRatio = this._floatMaxProgressValue / 100;
- this._unitPixelRatio = this._floatMaxProgressValue / this._floatDimension;
- this.setProgressValue(this.progressValue, true);
- if (!noRender) {
- this.render();
- }
-}, setProgressValue:function (value, noRender) {
- if (!this._animationStopped) {
- return;
- }
- this._progressPercentValue = "0%";
- var _value = dojo.string.trim("" + value);
- var _floatValue = parseFloat("0" + _value);
- var _intValue = parseInt("0" + _value);
- var _pixelValue = 0;
- if (dojo.string.endsWith(_value, "%", false)) {
- this._progressPercentValue = Math.min(_floatValue.toFixed(1), 100) + "%";
- _value = Math.min((_floatValue) * this._unitPercentRatio, this.maxProgressValue);
- _pixelValue = Math.min((_floatValue) * this._pixelPercentRatio, eval("this." + this._dimension));
- } else {
- this.progressValue = Math.min(_floatValue, this.maxProgressValue);
- this._progressPercentValue = Math.min((_floatValue / this._unitPercentRatio).toFixed(1), 100) + "%";
- _pixelValue = Math.min(_floatValue / this._unitPixelRatio, eval("this." + this._dimension));
- }
- this.progressValue = dojo.string.trim(_value);
- this._pixelValue = _pixelValue;
- if (!noRender) {
- this.render();
- }
-}, getProgressValue:function () {
- return this.progressValue;
-}, getProgressPercentValue:function () {
- return this._progressPercentValue;
-}, setDataSource:function (dataSource) {
- this.dataSource = dataSource;
-}, setPollInterval:function (pollInterval) {
- this.pollInterval = pollInterval;
-}, start:function () {
- var _showFunction = dojo.lang.hitch(this, this._showRemoteProgress);
- this._oInterval = setInterval(_showFunction, this.pollInterval);
-}, startAnimation:function () {
- if (this._animationStopped) {
- this._backupValues();
- this.setProgressValue("10%");
- this._animationStopped = false;
- this._setupAnimation();
- this.showText(false);
- this.internalProgress.style.height = "105%";
- this._animation.play();
- }
-}, stopAnimation:function () {
- if (this._animation) {
- this._animationStopped = true;
- this._animation.stop();
- this.internalProgress.style.height = "100%";
- this.internalProgress.style.left = "0px";
- this._restoreValues();
- this._setLabelPosition();
- }
-}, _showRemoteProgress:function () {
- var _self = this;
- if ((this.getMaxProgressValue() == this.getProgressValue()) && this._oInterval) {
- clearInterval(this._oInterval);
- this._oInterval = null;
- this.setProgressValue("100%");
- return;
- }
- var bArgs = {url:_self.dataSource, method:"POST", mimetype:"text/json", error:function (type, errorObj) {
- dojo.debug("[ProgressBar] showRemoteProgress error");
- }, load:function (type, data, evt) {
- _self.setProgressValue((_self._oInterval ? data["progress"] : "100%"));
- }};
- dojo.io.bind(bArgs);
-}, render:function () {
- this._setPercentLabel(dojo.string.trim(this._progressPercentValue));
- this._setPixelValue(this._pixelValue);
- this._setLabelPosition();
-}, _setLabelPosition:function () {
- var _widthFront = dojo.html.getContentBox(this.frontPercentLabel).width;
- var _heightFront = dojo.html.getContentBox(this.frontPercentLabel).height;
- var _widthBack = dojo.html.getContentBox(this.backPercentLabel).width;
- var _heightBack = dojo.html.getContentBox(this.backPercentLabel).height;
- var _leftFront = (parseInt(this.width) - _widthFront) / 2 + "px";
- var _bottomFront = (parseInt(this.height) - parseInt(_heightFront)) / 2 + "px";
- var _leftBack = (parseInt(this.width) - _widthBack) / 2 + "px";
- var _bottomBack = (parseInt(this.height) - parseInt(_heightBack)) / 2 + "px";
- this.frontPercentLabel.style.left = _leftFront;
- this.backPercentLabel.style.left = _leftBack;
- this.frontPercentLabel.style.bottom = _bottomFront;
- this.backPercentLabel.style.bottom = _bottomBack;
-}, _setPercentLabel:function (percentValue) {
- dojo.dom.removeChildren(this.frontPercentLabel);
- dojo.dom.removeChildren(this.backPercentLabel);
- var _percentValue = this.showOnlyIntegers == false ? percentValue : parseInt(percentValue) + "%";
- this.frontPercentLabel.appendChild(document.createTextNode(_percentValue));
- this.backPercentLabel.appendChild(document.createTextNode(_percentValue));
-}, _setPixelValue:function (value) {
- eval("this.internalProgress.style." + this._dimension + " = " + value + " + 'px'");
- this.onChange();
-}, onChange:function () {
-}});
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RadioGroup.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RadioGroup.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RadioGroup.js
deleted file mode 100644
index 3b87a5a..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RadioGroup.js
+++ /dev/null
@@ -1,122 +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.widget.RadioGroup");
-dojo.require("dojo.lang.common");
-dojo.require("dojo.event.browser");
-dojo.require("dojo.html.selection");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.widget.HtmlWidget");
-dojo.widget.defineWidget("dojo.widget.RadioGroup", dojo.widget.HtmlWidget, function () {
- this.selectedItem = null;
- this.items = [];
- this.selected = [];
- this.groupCssClass = "radioGroup";
- this.selectedCssClass = "selected";
- this.itemContentCssClass = "itemContent";
-}, {isContainer:false, templatePath:null, templateCssPath:null, postCreate:function () {
- this._parseStructure();
- dojo.html.addClass(this.domNode, this.groupCssClass);
- this._setupChildren();
- dojo.event.browser.addListener(this.domNode, "onclick", dojo.lang.hitch(this, "onSelect"));
- if (this.selectedItem) {
- this._selectItem(this.selectedItem);
- }
-}, _parseStructure:function () {
- if (this.domNode.tagName.toLowerCase() != "ul" && this.domNode.tagName.toLowerCase() != "ol") {
- dojo.raise("RadioGroup: Expected ul or ol content.");
- return;
- }
- this.items = [];
- var nl = this.domNode.getElementsByTagName("li");
- for (var i = 0; i < nl.length; i++) {
- if (nl[i].parentNode == this.domNode) {
- this.items.push(nl[i]);
- }
- }
-}, add:function (node) {
- if (node.parentNode != this.domNode) {
- this.domNode.appendChild(node);
- }
- this.items.push(node);
- this._setup(node);
-}, remove:function (node) {
- var idx = -1;
- for (var i = 0; i < this.items.length; i++) {
- if (this.items[i] == node) {
- idx = i;
- break;
- }
- }
- if (idx < 0) {
- return;
- }
- this.items.splice(idx, 1);
- node.parentNode.removeChild(node);
-}, clear:function () {
- for (var i = 0; i < this.items.length; i++) {
- this.domNode.removeChild(this.items[i]);
- }
- this.items = [];
-}, clearSelections:function () {
- for (var i = 0; i < this.items.length; i++) {
- dojo.html.removeClass(this.items[i], this.selectedCssClass);
- }
- this.selectedItem = null;
-}, _setup:function (node) {
- var span = document.createElement("span");
- dojo.html.disableSelection(span);
- dojo.html.addClass(span, this.itemContentCssClass);
- dojo.dom.moveChildren(node, span);
- node.appendChild(span);
- if (this.selected.length > 0) {
- var uid = dojo.html.getAttribute(node, "id");
- if (uid && uid == this.selected) {
- this.selectedItem = node;
- }
- }
- dojo.event.browser.addListener(node, "onclick", dojo.lang.hitch(this, "onItemSelect"));
- if (dojo.html.hasAttribute(node, "onitemselect")) {
- var tn = dojo.lang.nameAnonFunc(new Function(dojo.html.getAttribute(node, "onitemselect")), this);
- dojo.event.browser.addListener(node, "onclick", dojo.lang.hitch(this, tn));
- }
-}, _setupChildren:function () {
- for (var i = 0; i < this.items.length; i++) {
- this._setup(this.items[i]);
- }
-}, _selectItem:function (node, event, nofire) {
- if (this.selectedItem) {
- dojo.html.removeClass(this.selectedItem, this.selectedCssClass);
- }
- this.selectedItem = node;
- dojo.html.addClass(this.selectedItem, this.selectedCssClass);
- if (!dj_undef("currentTarget", event)) {
- return;
- }
- if (!nofire) {
- if (dojo.render.html.ie) {
- this.selectedItem.fireEvent("onclick");
- } else {
- var e = document.createEvent("MouseEvents");
- e.initEvent("click", true, false);
- this.selectedItem.dispatchEvent(e);
- }
- }
-}, getValue:function () {
- return this.selectedItem;
-}, onSelect:function (e) {
-}, onItemSelect:function (e) {
- if (!dj_undef("currentTarget", e)) {
- this._selectItem(e.currentTarget, e);
- }
-}});
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RealNumberTextbox.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RealNumberTextbox.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RealNumberTextbox.js
deleted file mode 100644
index 0d50cf1..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RealNumberTextbox.js
+++ /dev/null
@@ -1,50 +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.widget.RealNumberTextbox");
-dojo.require("dojo.widget.IntegerTextbox");
-dojo.require("dojo.validate.common");
-dojo.widget.defineWidget("dojo.widget.RealNumberTextbox", dojo.widget.IntegerTextbox, {mixInProperties:function (localProperties, frag) {
- dojo.widget.RealNumberTextbox.superclass.mixInProperties.apply(this, arguments);
- if (localProperties.places) {
- this.flags.places = Number(localProperties.places);
- }
- if ((localProperties.exponent == "true") || (localProperties.exponent == "always")) {
- this.flags.exponent = true;
- } else {
- if ((localProperties.exponent == "false") || (localProperties.exponent == "never")) {
- this.flags.exponent = false;
- } else {
- this.flags.exponent = [true, false];
- }
- }
- if ((localProperties.esigned == "true") || (localProperties.esigned == "always")) {
- this.flags.eSigned = true;
- } else {
- if ((localProperties.esigned == "false") || (localProperties.esigned == "never")) {
- this.flags.eSigned = false;
- } else {
- this.flags.eSigned = [true, false];
- }
- }
- if (localProperties.min) {
- this.flags.min = parseFloat(localProperties.min);
- }
- if (localProperties.max) {
- this.flags.max = parseFloat(localProperties.max);
- }
-}, isValid:function () {
- return dojo.validate.isRealNumber(this.textbox.value, this.flags);
-}, isInRange:function () {
- return dojo.validate.isInRange(this.textbox.value, this.flags);
-}});
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RegexpTextbox.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RegexpTextbox.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RegexpTextbox.js
deleted file mode 100644
index cee9a14..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RegexpTextbox.js
+++ /dev/null
@@ -1,27 +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.widget.RegexpTextbox");
-dojo.require("dojo.widget.ValidationTextbox");
-dojo.widget.defineWidget("dojo.widget.RegexpTextbox", dojo.widget.ValidationTextbox, {mixInProperties:function (localProperties, frag) {
- dojo.widget.RegexpTextbox.superclass.mixInProperties.apply(this, arguments);
- if (localProperties.regexp) {
- this.flags.regexp = localProperties.regexp;
- }
- if (localProperties.flags) {
- this.flags.flags = localProperties.flags;
- }
-}, isValid:function () {
- var regexp = new RegExp(this.flags.regexp, this.flags.flags);
- return regexp.test(this.textbox.value);
-}});
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RemoteTabController.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RemoteTabController.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RemoteTabController.js
deleted file mode 100644
index 0c0c93f..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RemoteTabController.js
+++ /dev/null
@@ -1,28 +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.widget.RemoteTabController");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.widget.TabContainer");
-dojo.require("dojo.event.*");
-dojo.deprecated("dojo.widget.RemoteTabController is slated for removal in 0.5; use PageController or TabController instead.", "0.5");
-dojo.widget.defineWidget("dojo.widget.RemoteTabController", dojo.widget.TabController, {templateCssString:".dojoRemoteTabController {\n\tposition: relative;\n}\n\n.dojoRemoteTab {\n\tposition : relative;\n\tfloat : left;\n\tpadding-left : 9px;\n\tborder-bottom : 1px solid #6290d2;\n\tbackground : url(images/tab_left.gif) no-repeat left top;\n\tcursor: pointer;\n\twhite-space: nowrap;\n\tz-index: 3;\n}\n\n.dojoRemoteTab div {\n\tdisplay : block;\n\tpadding : 4px 15px 4px 6px;\n\tbackground : url(images/tab_top_right.gif) no-repeat right top;\n\tcolor : #333;\n\tfont-size : 90%;\n}\n\n.dojoRemoteTabPaneClose {\n\tposition : absolute;\n\tbottom : 0px;\n\tright : 6px;\n\theight : 12px;\n\twidth : 12px;\n\tbackground : url(images/tab_close.gif) no-repeat right top;\n}\n\n.dojoRemoteTabPaneCloseHover {\n\tbackground-image : url(images/tab_close_h.gif);\n}\n\n.dojoRemoteTabClose {\n\tdisplay : inline-block;\n\theight : 12px;\n\twidth : 12px;\n\tpadding : 0 12px 0 0;\n\tmargin : 0 -10px 0 1
0px;\n\tbackground : url(images/tab_close.gif) no-repeat right top;\n\tcursor : default;\n}\n\n.dojoRemoteTabCloseHover {\n\tbackground-image : url(images/tab_close_h.gif);\n}\n\n.dojoRemoteTab.current {\n\tpadding-bottom : 1px;\n\tborder-bottom : 0;\n\tbackground-position : 0 -150px;\n}\n\n.dojoRemoteTab.current div {\n\tpadding-bottom : 5px;\n\tmargin-bottom : -1px;\n\tbackground-position : 100% -150px;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/RemoteTabControl.css"), templateString:"<div dojoAttachPoint=\"domNode\" wairole=\"tablist\"></div>", "class":"dojoRemoteTabController", tabContainer:"", postMixInProperties:function () {
- this.containerId = this.tabContainer;
- dojo.widget.RemoteTabController.superclass.postMixInProperties.apply(this, arguments);
-}, fillInTemplate:function () {
- dojo.html.addClass(this.domNode, this["class"]);
- if (this.tabContainer) {
- dojo.addOnLoad(dojo.lang.hitch(this, "setupTabs"));
- }
- dojo.widget.RemoteTabController.superclass.fillInTemplate.apply(this, arguments);
-}});
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/Repeater.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/Repeater.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/Repeater.js
deleted file mode 100644
index dfdb2af..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/Repeater.js
+++ /dev/null
@@ -1,128 +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.widget.Repeater");
-dojo.require("dojo.widget.HtmlWidget");
-dojo.require("dojo.string");
-dojo.require("dojo.event.*");
-dojo.require("dojo.experimental");
-dojo.experimental("dojo.widget.Repeater");
-dojo.widget.defineWidget("dojo.widget.Repeater", dojo.widget.HtmlWidget, {name:"", rowTemplate:"", myObject:null, pattern:"", useDnd:false, isContainer:true, initialize:function (args, frag) {
- var node = this.getFragNodeRef(frag);
- node.removeAttribute("dojotype");
- this.setRow(dojo.string.trim(node.innerHTML), {});
- node.innerHTML = "";
- frag = null;
-}, postCreate:function (args, frag) {
- if (this.useDnd) {
- dojo.require("dojo.dnd.*");
- var dnd = new dojo.dnd.HtmlDropTarget(this.domNode, [this.widgetId]);
- }
-}, _reIndexRows:function () {
- for (var i = 0, len = this.domNode.childNodes.length; i < len; i++) {
- var elems = ["INPUT", "SELECT", "TEXTAREA"];
- for (var k = 0; k < elems.length; k++) {
- var list = this.domNode.childNodes[i].getElementsByTagName(elems[k]);
- for (var j = 0, len2 = list.length; j < len2; j++) {
- var name = list[j].name;
- var index = dojo.string.escape("regexp", this.pattern);
- index = index.replace(/(%\\\{index\\\})/g, "%{index}");
- var nameRegexp = dojo.string.substituteParams(index, {"index":"[0-9]*"});
- var newName = dojo.string.substituteParams(this.pattern, {"index":"" + i});
- var re = new RegExp(nameRegexp, "g");
- list[j].name = name.replace(re, newName);
- }
- }
- }
-}, onDeleteRow:function (e) {
- var index = dojo.string.escape("regexp", this.pattern);
- index = index.replace(/%\\\{index\\\}/g, "%{index}");
- var nameRegexp = dojo.string.substituteParams(index, {"index":"([0-9]*)"});
- var re = new RegExp(nameRegexp, "g");
- this.deleteRow(re.exec(e.target.name)[1]);
-}, hasRows:function () {
- if (this.domNode.childNodes.length > 0) {
- return true;
- }
- return false;
-}, getRowCount:function () {
- return this.domNode.childNodes.length;
-}, deleteRow:function (idx) {
- this.domNode.removeChild(this.domNode.childNodes[idx]);
- this._reIndexRows();
-}, _changeRowPosition:function (e) {
- if (e.dragStatus == "dropFailure") {
- this.domNode.removeChild(e["dragSource"].domNode);
- } else {
- if (e.dragStatus == "dropSuccess") {
- }
- }
- this._reIndexRows();
-}, setRow:function (template, myObject) {
- template = template.replace(/\%\{(index)\}/g, "0");
- this.rowTemplate = template;
- this.myObject = myObject;
-}, getRow:function () {
- return this.rowTemplate;
-}, _initRow:function (node) {
- if (typeof (node) == "number") {
- node = this.domNode.childNodes[node];
- }
- var elems = ["INPUT", "SELECT", "IMG"];
- for (var k = 0; k < elems.length; k++) {
- var list = node.getElementsByTagName(elems[k]);
- for (var i = 0, len = list.length; i < len; i++) {
- var child = list[i];
- if (child.nodeType != 1) {
- continue;
- }
- if (child.getAttribute("rowFunction") != null) {
- if (typeof (this.myObject[child.getAttribute("rowFunction")]) == "undefined") {
- dojo.debug("Function " + child.getAttribute("rowFunction") + " not found");
- } else {
- this.myObject[child.getAttribute("rowFunction")](child);
- }
- } else {
- if (child.getAttribute("rowAction") != null) {
- if (child.getAttribute("rowAction") == "delete") {
- child.name = dojo.string.substituteParams(this.pattern, {"index":"" + (this.getRowCount() - 1)});
- dojo.event.connect(child, "onclick", this, "onDeleteRow");
- }
- }
- }
- }
- }
-}, onAddRow:function (e) {
-}, addRow:function (doInit) {
- if (typeof (doInit) == "undefined") {
- doInit = true;
- }
- var node = document.createElement("span");
- node.innerHTML = this.getRow();
- if (node.childNodes.length == 1) {
- node = node.childNodes[0];
- }
- this.domNode.appendChild(node);
- var parser = new dojo.xml.Parse();
- var frag = parser.parseElement(node, null, true);
- dojo.widget.getParser().createSubComponents(frag, this);
- this._reIndexRows();
- if (doInit) {
- this._initRow(node);
- }
- if (this.useDnd) {
- node = new dojo.dnd.HtmlDragSource(node, this.widgetId);
- dojo.event.connect(node, "onDragEnd", this, "_changeRowPosition");
- }
- this.onAddRow(node);
-}});
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizableTextarea.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizableTextarea.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizableTextarea.js
deleted file mode 100644
index ecdd13b..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizableTextarea.js
+++ /dev/null
@@ -1,35 +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.widget.ResizableTextarea");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.widget.LayoutContainer");
-dojo.require("dojo.widget.ResizeHandle");
-dojo.widget.defineWidget("dojo.widget.ResizableTextarea", dojo.widget.HtmlWidget, {templateString:"<div>\n\t<div style=\"border: 2px solid black; width: 90%; height: 200px;\"\n\t\tdojoAttachPoint=\"rootLayoutNode\">\n\t\t<div dojoAttachPoint=\"textAreaContainerNode\" \n\t\t\tstyle=\"border: 0px; margin: 0px; overflow: hidden;\">\n\t\t</div>\n\t\t<div dojoAttachPoint=\"statusBarContainerNode\" class=\"statusBar\">\n\t\t\t<div dojoAttachPoint=\"statusLabelNode\" \n\t\t\t\tclass=\"statusPanel\"\n\t\t\t\tstyle=\"padding-right: 0px; z-index: 1;\">drag to resize</div>\n\t\t\t<div dojoAttachPoint=\"resizeHandleNode\"></div>\n\t\t</div>\n\t</div>\n</div>\n", templateCssString:"div.statusBar {\n\tbackground-color: ThreeDFace;\n\theight: 28px;\n\tpadding: 1px;\n\toverflow: hidden;\n\tfont-size: 12px;\n}\n\ndiv.statusPanel {\n\tbackground-color: ThreeDFace;\n\tborder: 1px solid;\n\tborder-color: ThreeDShadow ThreeDHighlight ThreeDHighlight ThreeDShadow;\n\tmargin: 1px;\n\tpadding: 2px 6px;\n}\
n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/ResizableTextarea.css"), fillInTemplate:function (args, frag) {
- this.textAreaNode = this.getFragNodeRef(frag).cloneNode(true);
- dojo.body().appendChild(this.domNode);
- this.rootLayout = dojo.widget.createWidget("LayoutContainer", {minHeight:50, minWidth:100}, this.rootLayoutNode);
- this.textAreaContainer = dojo.widget.createWidget("LayoutContainer", {layoutAlign:"client"}, this.textAreaContainerNode);
- this.rootLayout.addChild(this.textAreaContainer);
- this.textAreaContainer.domNode.appendChild(this.textAreaNode);
- with (this.textAreaNode.style) {
- width = "100%";
- height = "100%";
- }
- this.statusBar = dojo.widget.createWidget("LayoutContainer", {layoutAlign:"bottom", minHeight:28}, this.statusBarContainerNode);
- this.rootLayout.addChild(this.statusBar);
- this.statusLabel = dojo.widget.createWidget("LayoutContainer", {layoutAlign:"client", minWidth:50}, this.statusLabelNode);
- this.statusBar.addChild(this.statusLabel);
- this.resizeHandle = dojo.widget.createWidget("ResizeHandle", {targetElmId:this.rootLayout.widgetId}, this.resizeHandleNode);
- this.statusBar.addChild(this.resizeHandle);
-}});
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizeHandle.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizeHandle.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizeHandle.js
deleted file mode 100644
index c25e04a..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/ResizeHandle.js
+++ /dev/null
@@ -1,68 +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.widget.ResizeHandle");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.html.layout");
-dojo.require("dojo.event.*");
-dojo.widget.defineWidget("dojo.widget.ResizeHandle", dojo.widget.HtmlWidget, {targetElmId:"", templateCssString:".dojoHtmlResizeHandle {\n\tfloat: right;\n\tposition: absolute;\n\tright: 2px;\n\tbottom: 2px;\n\twidth: 13px;\n\theight: 13px;\n\tz-index: 20;\n\tcursor: nw-resize;\n\tbackground-image: url(grabCorner.gif);\n\tline-height: 0px;\n}\n", templateCssPath:dojo.uri.moduleUri("dojo.widget", "templates/ResizeHandle.css"), templateString:"<div class=\"dojoHtmlResizeHandle\"><div></div></div>", postCreate:function () {
- dojo.event.connect(this.domNode, "onmousedown", this, "_beginSizing");
-}, _beginSizing:function (e) {
- if (this._isSizing) {
- return false;
- }
- this.targetWidget = dojo.widget.byId(this.targetElmId);
- this.targetDomNode = this.targetWidget ? this.targetWidget.domNode : dojo.byId(this.targetElmId);
- if (!this.targetDomNode) {
- return;
- }
- this._isSizing = true;
- this.startPoint = {"x":e.clientX, "y":e.clientY};
- var mb = dojo.html.getMarginBox(this.targetDomNode);
- this.startSize = {"w":mb.width, "h":mb.height};
- dojo.event.kwConnect({srcObj:dojo.body(), srcFunc:"onmousemove", targetObj:this, targetFunc:"_changeSizing", rate:25});
- dojo.event.connect(dojo.body(), "onmouseup", this, "_endSizing");
- e.preventDefault();
-}, _changeSizing:function (e) {
- try {
- if (!e.clientX || !e.clientY) {
- return;
- }
- }
- catch (e) {
- return;
- }
- var dx = this.startPoint.x - e.clientX;
- var dy = this.startPoint.y - e.clientY;
- var newW = this.startSize.w - dx;
- var newH = this.startSize.h - dy;
- if (this.minSize) {
- var mb = dojo.html.getMarginBox(this.targetDomNode);
- if (newW < this.minSize.w) {
- newW = mb.width;
- }
- if (newH < this.minSize.h) {
- newH = mb.height;
- }
- }
- if (this.targetWidget) {
- this.targetWidget.resizeTo(newW, newH);
- } else {
- dojo.html.setMarginBox(this.targetDomNode, {width:newW, height:newH});
- }
- e.preventDefault();
-}, _endSizing:function (e) {
- dojo.event.disconnect(dojo.body(), "onmousemove", this, "_changeSizing");
- dojo.event.disconnect(dojo.body(), "onmouseup", this, "_endSizing");
- this._isSizing = false;
-}});
-
http://git-wip-us.apache.org/repos/asf/struts/blob/17d73d21/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RichText.js
----------------------------------------------------------------------
diff --git a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RichText.js b/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RichText.js
deleted file mode 100644
index 990857c..0000000
--- a/plugins/dojo/src/main/resources/org/apache/struts2/static/dojo/src/widget/RichText.js
+++ /dev/null
@@ -1,1167 +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.widget.RichText");
-dojo.require("dojo.widget.*");
-dojo.require("dojo.html.*");
-dojo.require("dojo.html.layout");
-dojo.require("dojo.html.selection");
-dojo.require("dojo.event.*");
-dojo.require("dojo.string.extras");
-dojo.require("dojo.uri.Uri");
-dojo.require("dojo.Deferred");
-if (!djConfig["useXDomain"] || djConfig["allowXdRichTextSave"]) {
- if (dojo.hostenv.post_load_) {
- (function () {
- var savetextarea = dojo.doc().createElement("textarea");
- savetextarea.id = "dojo.widget.RichText.savedContent";
- savetextarea.style = "display:none;position:absolute;top:-100px;left:-100px;height:3px;width:3px;overflow:hidden;";
- dojo.body().appendChild(savetextarea);
- })();
- } else {
- try {
- dojo.doc().write("<textarea id=\"dojo.widget.RichText.savedContent\" " + "style=\"display:none;position:absolute;top:-100px;left:-100px;height:3px;width:3px;overflow:hidden;\"></textarea>");
- }
- catch (e) {
- }
- }
-}
-dojo.widget.defineWidget("dojo.widget.RichText", dojo.widget.HtmlWidget, function () {
- this.contentPreFilters = [];
- this.contentPostFilters = [];
- this.contentDomPreFilters = [];
- this.contentDomPostFilters = [];
- this.editingAreaStyleSheets = [];
- if (dojo.render.html.moz) {
- this.contentPreFilters.push(this._fixContentForMoz);
- }
- this._keyHandlers = {};
- if (dojo.Deferred) {
- this.onLoadDeferred = new dojo.Deferred();
- }
-}, {inheritWidth:false, focusOnLoad:false, saveName:"", styleSheets:"", _content:"", height:"", minHeight:"1em", isClosed:true, isLoaded:false, useActiveX:false, relativeImageUrls:false, _SEPARATOR:"@@**%%__RICHTEXTBOUNDRY__%%**@@", onLoadDeferred:null, fillInTemplate:function () {
- dojo.event.topic.publish("dojo.widget.RichText::init", this);
- this.open();
- dojo.event.connect(this, "onKeyPressed", this, "afterKeyPress");
- dojo.event.connect(this, "onKeyPress", this, "keyPress");
- dojo.event.connect(this, "onKeyDown", this, "keyDown");
- dojo.event.connect(this, "onKeyUp", this, "keyUp");
- this.setupDefaultShortcuts();
-}, setupDefaultShortcuts:function () {
- var ctrl = this.KEY_CTRL;
- var exec = function (cmd, arg) {
- return arguments.length == 1 ? function () {
- this.execCommand(cmd);
- } : function () {
- this.execCommand(cmd, arg);
- };
- };
- this.addKeyHandler("b", ctrl, exec("bold"));
- this.addKeyHandler("i", ctrl, exec("italic"));
- this.addKeyHandler("u", ctrl, exec("underline"));
- this.addKeyHandler("a", ctrl, exec("selectall"));
- this.addKeyHandler("s", ctrl, function () {
- this.save(true);
- });
- this.addKeyHandler("1", ctrl, exec("formatblock", "h1"));
- this.addKeyHandler("2", ctrl, exec("formatblock", "h2"));
- this.addKeyHandler("3", ctrl, exec("formatblock", "h3"));
- this.addKeyHandler("4", ctrl, exec("formatblock", "h4"));
- this.addKeyHandler("\\", ctrl, exec("insertunorderedlist"));
- if (!dojo.render.html.ie) {
- this.addKeyHandler("Z", ctrl, exec("redo"));
- }
-}, events:["onBlur", "onFocus", "onKeyPress", "onKeyDown", "onKeyUp", "onClick"], open:function (element) {
- if (this.onLoadDeferred.fired >= 0) {
- this.onLoadDeferred = new dojo.Deferred();
- }
- var h = dojo.render.html;
- if (!this.isClosed) {
- this.close();
- }
- dojo.event.topic.publish("dojo.widget.RichText::open", this);
- this._content = "";
- if ((arguments.length == 1) && (element["nodeName"])) {
- this.domNode = element;
- }
- if ((this.domNode["nodeName"]) && (this.domNode.nodeName.toLowerCase() == "textarea")) {
- this.textarea = this.domNode;
- var html = this._preFilterContent(this.textarea.value);
- this.domNode = dojo.doc().createElement("div");
- dojo.html.copyStyle(this.domNode, this.textarea);
- var tmpFunc = dojo.lang.hitch(this, function () {
- with (this.textarea.style) {
- display = "block";
- position = "absolute";
- left = top = "-1000px";
- if (h.ie) {
- this.__overflow = overflow;
- overflow = "hidden";
- }
- }
- });
- if (h.ie) {
- setTimeout(tmpFunc, 10);
- } else {
- tmpFunc();
- }
- if (!h.safari) {
- dojo.html.insertBefore(this.domNode, this.textarea);
- }
- if (this.textarea.form) {
- dojo.event.connect("before", this.textarea.form, "onsubmit", dojo.lang.hitch(this, function () {
- this.textarea.value = this.getEditorContent();
- }));
- }
- var editor = this;
- dojo.event.connect(this, "postCreate", function () {
- dojo.html.insertAfter(editor.textarea, editor.domNode);
- });
- } else {
- var html = this._preFilterContent(dojo.string.trim(this.domNode.innerHTML));
- }
- if (html == "") {
- html = " ";
- }
- var content = dojo.html.getContentBox(this.domNode);
- this._oldHeight = content.height;
- this._oldWidth = content.width;
- this._firstChildContributingMargin = this._getContributingMargin(this.domNode, "top");
- this._lastChildContributingMargin = this._getContributingMargin(this.domNode, "bottom");
- this.savedContent = html;
- this.domNode.innerHTML = "";
- this.editingArea = dojo.doc().createElement("div");
- this.domNode.appendChild(this.editingArea);
- if ((this.domNode["nodeName"]) && (this.domNode.nodeName == "LI")) {
- this.domNode.innerHTML = " <br>";
- }
- if (this.saveName != "" && (!djConfig["useXDomain"] || djConfig["allowXdRichTextSave"])) {
- var saveTextarea = dojo.doc().getElementById("dojo.widget.RichText.savedContent");
- if (saveTextarea.value != "") {
- var datas = saveTextarea.value.split(this._SEPARATOR);
- for (var i = 0; i < datas.length; i++) {
- var data = datas[i].split(":");
- if (data[0] == this.saveName) {
- html = data[1];
- datas.splice(i, 1);
- break;
- }
- }
- }
- dojo.event.connect("before", window, "onunload", this, "_saveContent");
- }
- if (h.ie70 && this.useActiveX) {
- dojo.debug("activeX in ie70 is not currently supported, useActiveX is ignored for now.");
- this.useActiveX = false;
- }
- if (this.useActiveX && h.ie) {
- var self = this;
- setTimeout(function () {
- self._drawObject(html);
- }, 0);
- } else {
- if (h.ie || this._safariIsLeopard() || h.opera) {
- this.iframe = dojo.doc().createElement("iframe");
- this.iframe.src = "javascript:void(0)";
- this.editorObject = this.iframe;
- with (this.iframe.style) {
- border = "0";
- width = "100%";
- }
- this.iframe.frameBorder = 0;
- this.editingArea.appendChild(this.iframe);
- this.window = this.iframe.contentWindow;
- this.document = this.window.document;
- this.document.open();
- this.document.write("<html><head><style>body{margin:0;padding:0;border:0;overflow:hidden;}</style></head><body><div></div></body></html>");
- this.document.close();
- this.editNode = this.document.body.firstChild;
- this.editNode.contentEditable = true;
- with (this.iframe.style) {
- if (h.ie70) {
- if (this.height) {
- height = this.height;
- }
- if (this.minHeight) {
- minHeight = this.minHeight;
- }
- } else {
- height = this.height ? this.height : this.minHeight;
- }
- }
- var formats = ["p", "pre", "address", "h1", "h2", "h3", "h4", "h5", "h6", "ol", "div", "ul"];
- var localhtml = "";
- for (var i in formats) {
- if (formats[i].charAt(1) != "l") {
- localhtml += "<" + formats[i] + "><span>content</span></" + formats[i] + ">";
- } else {
- localhtml += "<" + formats[i] + "><li>content</li></" + formats[i] + ">";
- }
- }
- with (this.editNode.style) {
- position = "absolute";
- left = "-2000px";
- top = "-2000px";
- }
- this.editNode.innerHTML = localhtml;
- var node = this.editNode.firstChild;
- while (node) {
- dojo.withGlobal(this.window, "selectElement", dojo.html.selection, [node.firstChild]);
- var nativename = node.tagName.toLowerCase();
- this._local2NativeFormatNames[nativename] = this.queryCommandValue("formatblock");
- this._native2LocalFormatNames[this._local2NativeFormatNames[nativename]] = nativename;
- node = node.nextSibling;
- }
- with (this.editNode.style) {
- position = "";
- left = "";
- top = "";
- }
- this.editNode.innerHTML = html;
- if (this.height) {
- this.document.body.style.overflowY = "scroll";
- }
- dojo.lang.forEach(this.events, function (e) {
- dojo.event.connect(this.editNode, e.toLowerCase(), this, e);
- }, this);
- this.onLoad();
- } else {
- this._drawIframe(html);
- this.editorObject = this.iframe;
- }
- }
- if (this.domNode.nodeName == "LI") {
- this.domNode.lastChild.style.marginTop = "-1.2em";
- }
- dojo.html.addClass(this.domNode, "RichTextEditable");
- this.isClosed = false;
-}, _hasCollapseableMargin:function (element, side) {
- if (dojo.html.getPixelValue(element, "border-" + side + "-width", false)) {
- return false;
- } else {
- if (dojo.html.getPixelValue(element, "padding-" + side, false)) {
- return false;
- } else {
- return true;
- }
- }
-}, _getContributingMargin:function (element, topOrBottom) {
- if (topOrBottom == "top") {
- var siblingAttr = "previousSibling";
- var childSiblingAttr = "nextSibling";
- var childAttr = "firstChild";
- var marginProp = "margin-top";
- var siblingMarginProp = "margin-bottom";
- } else {
- var siblingAttr = "nextSibling";
- var childSiblingAttr = "previousSibling";
- var childAttr = "lastChild";
- var marginProp = "margin-bottom";
- var siblingMarginProp = "margin-top";
- }
- var elementMargin = dojo.html.getPixelValue(element, marginProp, false);
- function isSignificantNode(element) {
- return !(element.nodeType == 3 && dojo.string.isBlank(element.data)) && dojo.html.getStyle(element, "display") != "none" && !dojo.html.isPositionAbsolute(element);
- }
- var childMargin = 0;
- var child = element[childAttr];
- while (child) {
- while ((!isSignificantNode(child)) && child[childSiblingAttr]) {
- child = child[childSiblingAttr];
- }
- childMargin = Math.max(childMargin, dojo.html.getPixelValue(child, marginProp, false));
- if (!this._hasCollapseableMargin(child, topOrBottom)) {
- break;
- }
- child = child[childAttr];
- }
- if (!this._hasCollapseableMargin(element, topOrBottom)) {
- return parseInt(childMargin);
- }
- var contextMargin = 0;
- var sibling = element[siblingAttr];
- while (sibling) {
- if (isSignificantNode(sibling)) {
- contextMargin = dojo.html.getPixelValue(sibling, siblingMarginProp, false);
- break;
- }
- sibling = sibling[siblingAttr];
- }
- if (!sibling) {
- contextMargin = dojo.html.getPixelValue(element.parentNode, marginProp, false);
- }
- if (childMargin > elementMargin) {
- return parseInt(Math.max((childMargin - elementMargin) - contextMargin, 0));
- } else {
- return 0;
- }
-}, _drawIframe:function (html) {
- var oldMoz = Boolean(dojo.render.html.moz && (typeof window.XML == "undefined"));
- if (!this.iframe) {
- var currentDomain = (new dojo.uri.Uri(dojo.doc().location)).host;
- this.iframe = dojo.doc().createElement("iframe");
- with (this.iframe) {
- style.border = "none";
- style.lineHeight = "0";
- style.verticalAlign = "bottom";
- scrolling = this.height ? "auto" : "no";
- }
- }
- if (djConfig["useXDomain"] && !djConfig["dojoRichTextFrameUrl"]) {
- dojo.debug("dojo.widget.RichText: When using cross-domain Dojo builds," + " please save src/widget/templates/richtextframe.html to your domain and set djConfig.dojoRichTextFrameUrl" + " to the path on your domain to richtextframe.html");
- }
- this.iframe.src = (djConfig["dojoRichTextFrameUrl"] || dojo.uri.moduleUri("dojo.widget", "templates/richtextframe.html")) + ((dojo.doc().domain != currentDomain) ? ("#" + dojo.doc().domain) : "");
- this.iframe.width = this.inheritWidth ? this._oldWidth : "100%";
- if (this.height) {
- this.iframe.style.height = this.height;
- } else {
- var height = this._oldHeight;
- if (this._hasCollapseableMargin(this.domNode, "top")) {
- height += this._firstChildContributingMargin;
- }
- if (this._hasCollapseableMargin(this.domNode, "bottom")) {
- height += this._lastChildContributingMargin;
- }
- this.iframe.height = height;
- }
- var tmpContent = dojo.doc().createElement("div");
- tmpContent.innerHTML = html;
- this.editingArea.appendChild(tmpContent);
- if (this.relativeImageUrls) {
- var imgs = tmpContent.getElementsByTagName("img");
- for (var i = 0; i < imgs.length; i++) {
- imgs[i].src = (new dojo.uri.Uri(dojo.global().location, imgs[i].src)).toString();
- }
- html = tmpContent.innerHTML;
- }
- var firstChild = dojo.html.firstElement(tmpContent);
- var lastChild = dojo.html.lastElement(tmpContent);
- if (firstChild) {
- firstChild.style.marginTop = this._firstChildContributingMargin + "px";
- }
- if (lastChild) {
- lastChild.style.marginBottom = this._lastChildContributingMargin + "px";
- }
- this.editingArea.appendChild(this.iframe);
- if (dojo.render.html.safari) {
- this.iframe.src = this.iframe.src;
- }
- var _iframeInitialized = false;
- var ifrFunc = dojo.lang.hitch(this, function () {
- if (!_iframeInitialized) {
- _iframeInitialized = true;
- } else {
- return;
- }
- if (!this.editNode) {
- if (this.iframe.contentWindow) {
- this.window = this.iframe.contentWindow;
- this.document = this.iframe.contentWindow.document;
- } else {
- if (this.iframe.contentDocument) {
- this.window = this.iframe.contentDocument.window;
- this.document = this.iframe.contentDocument;
- }
- }
- var getStyle = (function (domNode) {
- return function (style) {
- return dojo.html.getStyle(domNode, style);
- };
- })(this.domNode);
- var font = getStyle("font-weight") + " " + getStyle("font-size") + " " + getStyle("font-family");
- var lineHeight = "1.0";
- var lineHeightStyle = dojo.html.getUnitValue(this.domNode, "line-height");
- if (lineHeightStyle.value && lineHeightStyle.units == "") {
- lineHeight = lineHeightStyle.value;
- }
- dojo.html.insertCssText("body,html{background:transparent;padding:0;margin:0;}" + "body{top:0;left:0;right:0;" + (((this.height) || (dojo.render.html.opera)) ? "" : "position:fixed;") + "font:" + font + ";" + "min-height:" + this.minHeight + ";" + "line-height:" + lineHeight + "}" + "p{margin: 1em 0 !important;}" + "body > *:first-child{padding-top:0 !important;margin-top:" + this._firstChildContributingMargin + "px !important;}" + "body > *:last-child{padding-bottom:0 !important;margin-bottom:" + this._lastChildContributingMargin + "px !important;}" + "li > ul:-moz-first-node, li > ol:-moz-first-node{padding-top:1.2em;}\n" + "li{min-height:1.2em;}" + "", this.document);
- dojo.html.removeNode(tmpContent);
- this.document.body.innerHTML = html;
- if (oldMoz || dojo.render.html.safari) {
- this.document.designMode = "on";
- }
- this.onLoad();
- } else {
- dojo.html.removeNode(tmpContent);
- this.editNode.innerHTML = html;
- this.onDisplayChanged();
- }
- });
- if (this.editNode) {
- ifrFunc();
- } else {
- if (dojo.render.html.moz) {
- this.iframe.onload = function () {
- setTimeout(ifrFunc, 250);
- };
- } else {
- this.iframe.onload = ifrFunc;
- }
- }
-}, _applyEditingAreaStyleSheets:function () {
- var files = [];
- if (this.styleSheets) {
- files = this.styleSheets.split(";");
- this.styleSheets = "";
- }
- files = files.concat(this.editingAreaStyleSheets);
- this.editingAreaStyleSheets = [];
- if (files.length > 0) {
- for (var i = 0; i < files.length; i++) {
- var url = files[i];
- if (url) {
- this.addStyleSheet(dojo.uri.dojoUri(url));
- }
- }
- }
-}, addStyleSheet:function (uri) {
- var url = uri.toString();
- if (dojo.lang.find(this.editingAreaStyleSheets, url) > -1) {
- dojo.debug("dojo.widget.RichText.addStyleSheet: Style sheet " + url + " is already applied to the editing area!");
- return;
- }
- if (url.charAt(0) == "." || (url.charAt(0) != "/" && !uri.host)) {
- url = (new dojo.uri.Uri(dojo.global().location, url)).toString();
- }
- this.editingAreaStyleSheets.push(url);
- if (this.document.createStyleSheet) {
- this.document.createStyleSheet(url);
- } else {
- var head = this.document.getElementsByTagName("head")[0];
- var stylesheet = this.document.createElement("link");
- with (stylesheet) {
- rel = "stylesheet";
- type = "text/css";
- href = url;
- }
- head.appendChild(stylesheet);
- }
-}, removeStyleSheet:function (uri) {
- var url = uri.toString();
- if (url.charAt(0) == "." || (url.charAt(0) != "/" && !uri.host)) {
- url = (new dojo.uri.Uri(dojo.global().location, url)).toString();
- }
- var index = dojo.lang.find(this.editingAreaStyleSheets, url);
- if (index == -1) {
- dojo.debug("dojo.widget.RichText.removeStyleSheet: Style sheet " + url + " is not applied to the editing area so it can not be removed!");
- return;
- }
- delete this.editingAreaStyleSheets[index];
- var links = this.document.getElementsByTagName("link");
- for (var i = 0; i < links.length; i++) {
- if (links[i].href == url) {
- if (dojo.render.html.ie) {
- links[i].href = "";
- }
- dojo.html.removeNode(links[i]);
- break;
- }
- }
-}, _drawObject:function (html) {
- this.object = dojo.html.createExternalElement(dojo.doc(), "object");
- with (this.object) {
- classid = "clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A";
- width = this.inheritWidth ? this._oldWidth : "100%";
- style.height = this.height ? this.height : (this._oldHeight + "px");
- Scrollbars = this.height ? true : false;
- Appearance = this._activeX.appearance.flat;
- }
- this.editorObject = this.object;
- this.editingArea.appendChild(this.object);
- this.object.attachEvent("DocumentComplete", dojo.lang.hitch(this, "onLoad"));
- dojo.lang.forEach(this.events, function (e) {
- this.object.attachEvent(e.toLowerCase(), dojo.lang.hitch(this, e));
- }, this);
- this.object.DocumentHTML = "<!doctype HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">" + "<html><title></title>" + "<style type=\"text/css\">" + " body,html { padding: 0; margin: 0; }" + (this.height ? "" : " body, { overflow: hidden; }") + "</style>" + "<body><div>" + html + "<div></body></html>";
- this._cacheLocalBlockFormatNames();
-}, _local2NativeFormatNames:{}, _native2LocalFormatNames:{}, _cacheLocalBlockFormatNames:function () {
- if (!this._native2LocalFormatNames["p"]) {
- var obj = this.object;
- var error = false;
- if (!obj) {
- try {
- obj = dojo.html.createExternalElement(dojo.doc(), "object");
- obj.classid = "clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A";
- dojo.body().appendChild(obj);
- obj.DocumentHTML = "<html><head></head><body></body></html>";
- }
- catch (e) {
- error = true;
- }
- }
- try {
- var oNamesParm = new ActiveXObject("DEGetBlockFmtNamesParam.DEGetBlockFmtNamesParam");
- obj.ExecCommand(this._activeX.command["getblockformatnames"], 0, oNamesParm);
- var vbNamesArray = new VBArray(oNamesParm.Names);
- var localFormats = vbNamesArray.toArray();
- var nativeFormats = ["p", "pre", "address", "h1", "h2", "h3", "h4", "h5", "h6", "ol", "ul", "", "", "", "", "div"];
- for (var i = 0; i < nativeFormats.length; ++i) {
- if (nativeFormats[i].length > 0) {
- this._local2NativeFormatNames[localFormats[i]] = nativeFormats[i];
- this._native2LocalFormatNames[nativeFormats[i]] = localFormats[i];
- }
- }
- }
- catch (e) {
- error = true;
- }
- if (obj && !this.object) {
- dojo.body().removeChild(obj);
- }
- }
- return !error;
-}, _isResized:function () {
- return false;
-}, onLoad:function (e) {
- this.isLoaded = true;
- if (this.object) {
- this.document = this.object.DOM;
- this.window = this.document.parentWindow;
- this.editNode = this.document.body.firstChild;
- this.editingArea.style.height = this.height ? this.height : this.minHeight;
- if (!this.height) {
- this.connect(this, "onDisplayChanged", "_updateHeight");
- }
- this.window._frameElement = this.object;
- } else {
- if (this.iframe && !dojo.render.html.ie) {
- this.editNode = this.document.body;
- if (!this.height) {
- this.connect(this, "onDisplayChanged", "_updateHeight");
- }
- try {
- this.document.execCommand("useCSS", false, true);
- this.document.execCommand("styleWithCSS", false, false);
- }
- catch (e2) {
- }
- if (dojo.render.html.safari) {
- this.connect(this.editNode, "onblur", "onBlur");
- this.connect(this.editNode, "onfocus", "onFocus");
- this.connect(this.editNode, "onclick", "onFocus");
- this.interval = setInterval(dojo.lang.hitch(this, "onDisplayChanged"), 750);
- } else {
- if (dojo.render.html.mozilla || dojo.render.html.opera) {
- var doc = this.document;
- var addListener = dojo.event.browser.addListener;
- var self = this;
- dojo.lang.forEach(this.events, function (e) {
- var l = addListener(self.document, e.substr(2).toLowerCase(), dojo.lang.hitch(self, e));
- if (e == "onBlur") {
- var unBlur = {unBlur:function (e) {
- dojo.event.browser.removeListener(doc, "blur", l);
- }};
- dojo.event.connect("before", self, "close", unBlur, "unBlur");
- }
- });
- }
- }
- } else {
- if (dojo.render.html.ie) {
- if (!this.height) {
- this.connect(this, "onDisplayChanged", "_updateHeight");
- }
- this.editNode.style.zoom = 1;
- }
- }
- }
- this._applyEditingAreaStyleSheets();
- if (this.focusOnLoad) {
- this.focus();
- }
- this.onDisplayChanged(e);
- if (this.onLoadDeferred) {
- this.onLoadDeferred.callback(true);
- }
-}, onKeyDown:function (e) {
- if ((!e) && (this.object)) {
- e = dojo.event.browser.fixEvent(this.window.event);
- }
- if ((dojo.render.html.ie) && (e.keyCode == e.KEY_TAB)) {
- e.preventDefault();
- e.stopPropagation();
- this.execCommand((e.shiftKey ? "outdent" : "indent"));
- } else {
- if (dojo.render.html.ie) {
- if ((65 <= e.keyCode) && (e.keyCode <= 90)) {
- e.charCode = e.keyCode;
- this.onKeyPress(e);
- }
- }
- }
-}, onKeyUp:function (e) {
- return;
-}, KEY_CTRL:1, onKeyPress:function (e) {
- if ((!e) && (this.object)) {
- e = dojo.event.browser.fixEvent(this.window.event);
- }
- var modifiers = e.ctrlKey ? this.KEY_CTRL : 0;
- if (this._keyHandlers[e.key]) {
- var handlers = this._keyHandlers[e.key], i = 0, handler;
- while (handler = handlers[i++]) {
- if (modifiers == handler.modifiers) {
- e.preventDefault();
- handler.handler.call(this);
- break;
- }
- }
- }
- dojo.lang.setTimeout(this, this.onKeyPressed, 1, e);
-}, addKeyHandler:function (key, modifiers, handler) {
- if (!(this._keyHandlers[key] instanceof Array)) {
- this._keyHandlers[key] = [];
- }
- this._keyHandlers[key].push({modifiers:modifiers || 0, handler:handler});
-}, onKeyPressed:function (e) {
- this.onDisplayChanged();
-}, onClick:function (e) {
- this.onDisplayChanged(e);
-}, onBlur:function (e) {
-}, _initialFocus:true, onFocus:function (e) {
- if ((dojo.render.html.mozilla) && (this._initialFocus)) {
- this._initialFocus = false;
- if (dojo.string.trim(this.editNode.innerHTML) == " ") {
- this.placeCursorAtStart();
- }
- }
-}, blur:function () {
- if (this.iframe) {
- this.window.blur();
- } else {
- if (this.object) {
- this.document.body.blur();
- } else {
- if (this.editNode) {
- this.editNode.blur();
- }
- }
- }
-}, focus:function () {
- if (this.iframe && !dojo.render.html.ie) {
- this.window.focus();
- } else {
- if (this.object) {
- this.document.focus();
- } else {
- if (this.editNode && this.editNode.focus) {
- this.editNode.focus();
- } else {
- dojo.debug("Have no idea how to focus into the editor!");
- }
- }
- }
-}, onDisplayChanged:function (e) {
-}, _activeX:{command:{bold:5000, italic:5023, underline:5048, justifycenter:5024, justifyleft:5025, justifyright:5026, cut:5003, copy:5002, paste:5032, "delete":5004, undo:5049, redo:5033, removeformat:5034, selectall:5035, unlink:5050, indent:5018, outdent:5031, insertorderedlist:5030, insertunorderedlist:5051, inserttable:5022, insertcell:5019, insertcol:5020, insertrow:5021, deletecells:5005, deletecols:5006, deleterows:5007, mergecells:5029, splitcell:5047, setblockformat:5043, getblockformat:5011, getblockformatnames:5012, setfontname:5044, getfontname:5013, setfontsize:5045, getfontsize:5014, setbackcolor:5042, getbackcolor:5010, setforecolor:5046, getforecolor:5015, findtext:5008, font:5009, hyperlink:5016, image:5017, lockelement:5027, makeabsolute:5028, sendbackward:5036, bringforward:5037, sendbelowtext:5038, bringabovetext:5039, sendtoback:5040, bringtofront:5041, properties:5052}, ui:{"default":0, prompt:1, noprompt:2}, status:{notsupported:0, disabled:1, enabled:3, latc
hed:7, ninched:11}, appearance:{flat:0, inset:1}, state:{unchecked:0, checked:1, gray:2}}, _normalizeCommand:function (cmd) {
- var drh = dojo.render.html;
- var command = cmd.toLowerCase();
- if (command == "formatblock") {
- if (drh.safari) {
- command = "heading";
- }
- } else {
- if (this.object) {
- switch (command) {
- case "createlink":
- command = "hyperlink";
- break;
- case "insertimage":
- command = "image";
- break;
- }
- } else {
- if (command == "hilitecolor" && !drh.mozilla) {
- command = "backcolor";
- }
- }
- }
- return command;
-}, _safariIsLeopard:function () {
- var gt420 = false;
- if (dojo.render.html.safari) {
- var tmp = dojo.render.html.UA.split("AppleWebKit/")[1];
- var ver = parseFloat(tmp.split(" ")[0]);
- if (ver >= 420) {
- gt420 = true;
- }
- }
- return gt420;
-}, queryCommandAvailable:function (command) {
- var ie = 1;
- var mozilla = 1 << 1;
- var safari = 1 << 2;
- var opera = 1 << 3;
- var safari420 = 1 << 4;
- var gt420 = this._safariIsLeopard();
- function isSupportedBy(browsers) {
- return {ie:Boolean(browsers & ie), mozilla:Boolean(browsers & mozilla), safari:Boolean(browsers & safari), safari420:Boolean(browsers & safari420), opera:Boolean(browsers & opera)};
- }
- var supportedBy = null;
- switch (command.toLowerCase()) {
- case "bold":
- case "italic":
- case "underline":
- case "subscript":
- case "superscript":
- case "fontname":
- case "fontsize":
- case "forecolor":
- case "hilitecolor":
- case "justifycenter":
- case "justifyfull":
- case "justifyleft":
- case "justifyright":
- case "delete":
- case "selectall":
- supportedBy = isSupportedBy(mozilla | ie | safari | opera);
- break;
- case "createlink":
- case "unlink":
- case "removeformat":
- case "inserthorizontalrule":
- case "insertimage":
- case "insertorderedlist":
- case "insertunorderedlist":
- case "indent":
- case "outdent":
- case "formatblock":
- case "inserthtml":
- case "undo":
- case "redo":
- case "strikethrough":
- supportedBy = isSupportedBy(mozilla | ie | opera | safari420);
- break;
- case "blockdirltr":
- case "blockdirrtl":
- case "dirltr":
- case "dirrtl":
- case "inlinedirltr":
- case "inlinedirrtl":
- supportedBy = isSupportedBy(ie);
- break;
- case "cut":
- case "copy":
- case "paste":
- supportedBy = isSupportedBy(ie | mozilla | safari420);
- break;
- case "inserttable":
- supportedBy = isSupportedBy(mozilla | (this.object ? ie : 0));
- break;
- case "insertcell":
- case "insertcol":
- case "insertrow":
- case "deletecells":
- case "deletecols":
- case "deleterows":
- case "mergecells":
- case "splitcell":
- supportedBy = isSupportedBy(this.object ? ie : 0);
- break;
- default:
- return false;
- }
- return (dojo.render.html.ie && supportedBy.ie) || (dojo.render.html.mozilla && supportedBy.mozilla) || (dojo.render.html.safari && supportedBy.safari) || (gt420 && supportedBy.safari420) || (dojo.render.html.opera && supportedBy.opera);
-}, execCommand:function (command, argument) {
- var returnValue;
- this.focus();
- command = this._normalizeCommand(command);
- if (argument != undefined) {
- if (command == "heading") {
- throw new Error("unimplemented");
- } else {
- if (command == "formatblock") {
- if (this.object) {
- argument = this._native2LocalFormatNames[argument];
- } else {
- if (dojo.render.html.ie) {
- argument = "<" + argument + ">";
- }
- }
- }
- }
- }
- if (this.object) {
- switch (command) {
- case "hilitecolor":
- command = "setbackcolor";
- break;
- case "forecolor":
- case "backcolor":
- case "fontsize":
- case "fontname":
- command = "set" + command;
- break;
- case "formatblock":
- command = "setblockformat";
- }
- if (command == "strikethrough") {
- command = "inserthtml";
- var range = this.document.selection.createRange();
- if (!range.htmlText) {
- return;
- }
- argument = range.htmlText.strike();
- } else {
- if (command == "inserthorizontalrule") {
- command = "inserthtml";
- argument = "<hr>";
- }
- }
- if (command == "inserthtml") {
- var range = this.document.selection.createRange();
- if (this.document.selection.type.toUpperCase() == "CONTROL") {
- for (var i = 0; i < range.length; i++) {
- range.item(i).outerHTML = argument;
- }
- } else {
- range.pasteHTML(argument);
- range.select();
- }
- returnValue = true;
- } else {
- if (arguments.length == 1) {
- returnValue = this.object.ExecCommand(this._activeX.command[command], this._activeX.ui.noprompt);
- } else {
- returnValue = this.object.ExecCommand(this._activeX.command[command], this._activeX.ui.noprompt, argument);
- }
- }
- } else {
- if (command == "inserthtml") {
- if (dojo.render.html.ie) {
- var insertRange = this.document.selection.createRange();
- insertRange.pasteHTML(argument);
- insertRange.select();
- return true;
- } else {
- return this.document.execCommand(command, false, argument);
- }
- } else {
- if ((command == "unlink") && (this.queryCommandEnabled("unlink")) && (dojo.render.html.mozilla)) {
- var selection = this.window.getSelection();
- var selectionRange = selection.getRangeAt(0);
- var selectionStartContainer = selectionRange.startContainer;
- var selectionStartOffset = selectionRange.startOffset;
- var selectionEndContainer = selectionRange.endContainer;
- var selectionEndOffset = selectionRange.endOffset;
- var a = dojo.withGlobal(this.window, "getAncestorElement", dojo.html.selection, ["a"]);
- dojo.withGlobal(this.window, "selectElement", dojo.html.selection, [a]);
- returnValue = this.document.execCommand("unlink", false, null);
- var selectionRange = this.document.createRange();
- selectionRange.setStart(selectionStartContainer, selectionStartOffset);
- selectionRange.setEnd(selectionEndContainer, selectionEndOffset);
- selection.removeAllRanges();
- selection.addRange(selectionRange);
- return returnValue;
- } else {
- if ((command == "hilitecolor") && (dojo.render.html.mozilla)) {
- this.document.execCommand("useCSS", false, false);
- returnValue = this.document.execCommand(command, false, argument);
- this.document.execCommand("useCSS", false, true);
- } else {
- if ((dojo.render.html.ie) && ((command == "backcolor") || (command == "forecolor"))) {
- argument = arguments.length > 1 ? argument : null;
- returnValue = this.document.execCommand(command, false, argument);
- } else {
- argument = arguments.length > 1 ? argument : null;
- if (argument || command != "createlink") {
- returnValue = this.document.execCommand(command, false, argument);
- }
- }
- }
- }
- }
- }
- this.onDisplayChanged();
- return returnValue;
-}, queryCommandEnabled:function (command) {
- command = this._normalizeCommand(command);
- if (this.object) {
- switch (command) {
- case "hilitecolor":
- command = "setbackcolor";
- break;
- case "forecolor":
- case "backcolor":
- case "fontsize":
- case "fontname":
- command = "set" + command;
- break;
- case "formatblock":
- command = "setblockformat";
- break;
- case "strikethrough":
- command = "bold";
- break;
- case "inserthorizontalrule":
- return true;
- }
- if (typeof this._activeX.command[command] == "undefined") {
- return false;
- }
- var status = this.object.QueryStatus(this._activeX.command[command]);
- return ((status != this._activeX.status.notsupported) && (status != this._activeX.status.disabled));
- } else {
- if (dojo.render.html.mozilla) {
- if (command == "unlink") {
- return dojo.withGlobal(this.window, "hasAncestorElement", dojo.html.selection, ["a"]);
- } else {
- if (command == "inserttable") {
- return true;
- }
- }
- }
- var elem = (dojo.render.html.ie) ? this.document.selection.createRange() : this.document;
- return elem.queryCommandEnabled(command);
- }
-}, queryCommandState:function (command) {
- command = this._normalizeCommand(command);
- if (this.object) {
- if (command == "forecolor") {
- command = "setforecolor";
- } else {
- if (command == "backcolor") {
- command = "setbackcolor";
- } else {
- if (command == "strikethrough") {
- return dojo.withGlobal(this.window, "hasAncestorElement", dojo.html.selection, ["strike"]);
- } else {
- if (command == "inserthorizontalrule") {
- return false;
- }
- }
- }
- }
- if (typeof this._activeX.command[command] == "undefined") {
- return null;
- }
- var status = this.object.QueryStatus(this._activeX.command[command]);
- return ((status == this._activeX.status.latched) || (status == this._activeX.status.ninched));
- } else {
- return this.document.queryCommandState(command);
- }
-}, queryCommandValue:function (command) {
- command = this._normalizeCommand(command);
- if (this.object) {
- switch (command) {
- case "forecolor":
- case "backcolor":
- case "fontsize":
- case "fontname":
- command = "get" + command;
- return this.object.execCommand(this._activeX.command[command], this._activeX.ui.noprompt);
- case "formatblock":
- var retvalue = this.object.execCommand(this._activeX.command["getblockformat"], this._activeX.ui.noprompt);
- if (retvalue) {
- return this._local2NativeFormatNames[retvalue];
- }
- }
- } else {
- if (dojo.render.html.ie && command == "formatblock") {
- return this._local2NativeFormatNames[this.document.queryCommandValue(command)] || this.document.queryCommandValue(command);
- }
- return this.document.queryCommandValue(command);
- }
-}, placeCursorAtStart:function () {
- this.focus();
- if (dojo.render.html.moz && this.editNode.firstChild && this.editNode.firstChild.nodeType != dojo.dom.TEXT_NODE) {
- dojo.withGlobal(this.window, "selectElementChildren", dojo.html.selection, [this.editNode.firstChild]);
- } else {
- dojo.withGlobal(this.window, "selectElementChildren", dojo.html.selection, [this.editNode]);
- }
- dojo.withGlobal(this.window, "collapse", dojo.html.selection, [true]);
-}, placeCursorAtEnd:function () {
- this.focus();
- if (dojo.render.html.moz && this.editNode.lastChild && this.editNode.lastChild.nodeType != dojo.dom.TEXT_NODE) {
- dojo.withGlobal(this.window, "selectElementChildren", dojo.html.selection, [this.editNode.lastChild]);
- } else {
- dojo.withGlobal(this.window, "selectElementChildren", dojo.html.selection, [this.editNode]);
- }
- dojo.withGlobal(this.window, "collapse", dojo.html.selection, [false]);
-}, replaceEditorContent:function (html) {
- html = this._preFilterContent(html);
- if (this.isClosed) {
- this.domNode.innerHTML = html;
- } else {
- if (this.window && this.window.getSelection && !dojo.render.html.moz) {
- this.editNode.innerHTML = html;
- } else {
- if ((this.window && this.window.getSelection) || (this.document && this.document.selection)) {
- this.execCommand("selectall");
- if (dojo.render.html.moz && !html) {
- html = " ";
- }
- this.execCommand("inserthtml", html);
- }
- }
- }
-}, _preFilterContent:function (html) {
- var ec = html;
- dojo.lang.forEach(this.contentPreFilters, function (ef) {
- ec = ef(ec);
- });
- if (this.contentDomPreFilters.length > 0) {
- var dom = dojo.doc().createElement("div");
- dom.style.display = "none";
- dojo.body().appendChild(dom);
- dom.innerHTML = ec;
- dojo.lang.forEach(this.contentDomPreFilters, function (ef) {
- dom = ef(dom);
- });
- ec = dom.innerHTML;
- dojo.body().removeChild(dom);
- }
- return ec;
-}, _postFilterContent:function (html) {
- var ec = html;
- if (this.contentDomPostFilters.length > 0) {
- var dom = this.document.createElement("div");
- dom.innerHTML = ec;
- dojo.lang.forEach(this.contentDomPostFilters, function (ef) {
- dom = ef(dom);
- });
- ec = dom.innerHTML;
- }
- dojo.lang.forEach(this.contentPostFilters, function (ef) {
- ec = ef(ec);
- });
- return ec;
-}, _lastHeight:0, _updateHeight:function () {
- if (!this.isLoaded) {
- return;
- }
- if (this.height) {
- return;
- }
- var height = dojo.html.getBorderBox(this.editNode).height;
- if (!height) {
- height = dojo.html.getBorderBox(this.document.body).height;
- }
- if (height == 0) {
- dojo.debug("Can not figure out the height of the editing area!");
- return;
- }
- this._lastHeight = height;
- this.editorObject.style.height = this._lastHeight + "px";
- this.window.scrollTo(0, 0);
-}, _saveContent:function (e) {
- var saveTextarea = dojo.doc().getElementById("dojo.widget.RichText.savedContent");
- saveTextarea.value += this._SEPARATOR + this.saveName + ":" + this.getEditorContent();
-}, getEditorContent:function () {
- var ec = "";
- try {
- ec = (this._content.length > 0) ? this._content : this.editNode.innerHTML;
- if (dojo.string.trim(ec) == " ") {
- ec = "";
- }
- }
- catch (e) {
- }
- if (dojo.render.html.ie && !this.object) {
- var re = new RegExp("(?:<p> </p>[\n\r]*)+$", "i");
- ec = ec.replace(re, "");
- }
- ec = this._postFilterContent(ec);
- if (this.relativeImageUrls) {
- var siteBase = dojo.global().location.protocol + "//" + dojo.global().location.host;
- var pathBase = dojo.global().location.pathname;
- if (pathBase.match(/\/$/)) {
- } else {
- var pathParts = pathBase.split("/");
- if (pathParts.length) {
- pathParts.pop();
- }
- pathBase = pathParts.join("/") + "/";
- }
- var sameSite = new RegExp("(<img[^>]* src=[\"'])(" + siteBase + "(" + pathBase + ")?)", "ig");
- ec = ec.replace(sameSite, "$1");
- }
- return ec;
-}, close:function (save, force) {
- if (this.isClosed) {
- return false;
- }
- if (arguments.length == 0) {
- save = true;
- }
- this._content = this._postFilterContent(this.editNode.innerHTML);
- var changed = (this.savedContent != this._content);
- if (this.interval) {
- clearInterval(this.interval);
- }
- if (dojo.render.html.ie && !this.object) {
- dojo.event.browser.clean(this.editNode);
- }
- if (this.iframe) {
- delete this.iframe;
- }
- if (this.textarea) {
- with (this.textarea.style) {
- position = "";
- left = top = "";
- if (dojo.render.html.ie) {
- overflow = this.__overflow;
- this.__overflow = null;
- }
- }
- if (save) {
- this.textarea.value = this._content;
- } else {
- this.textarea.value = this.savedContent;
- }
- dojo.html.removeNode(this.domNode);
- this.domNode = this.textarea;
- } else {
- if (save) {
- if (dojo.render.html.moz) {
- var nc = dojo.doc().createElement("span");
- this.domNode.appendChild(nc);
- nc.innerHTML = this.editNode.innerHTML;
- } else {
- this.domNode.innerHTML = this._content;
- }
- } else {
- this.domNode.innerHTML = this.savedContent;
- }
- }
- dojo.html.removeClass(this.domNode, "RichTextEditable");
- this.isClosed = true;
- this.isLoaded = false;
- delete this.editNode;
- if (this.window._frameElement) {
- this.window._frameElement = null;
- }
- this.window = null;
- this.document = null;
- this.object = null;
- this.editingArea = null;
- this.editorObject = null;
- return changed;
-}, destroyRendering:function () {
-}, destroy:function () {
- this.destroyRendering();
- if (!this.isClosed) {
- this.close(false);
- }
- dojo.widget.RichText.superclass.destroy.call(this);
-}, connect:function (targetObj, targetFunc, thisFunc) {
- dojo.event.connect(targetObj, targetFunc, this, thisFunc);
-}, disconnect:function (targetObj, targetFunc, thisFunc) {
- dojo.event.disconnect(targetObj, targetFunc, this, thisFunc);
-}, disconnectAllWithRoot:function (targetObj) {
- dojo.deprecated("disconnectAllWithRoot", "is deprecated. No need to disconnect manually", "0.5");
-}, _fixContentForMoz:function (html) {
- html = html.replace(/<strong([ \>])/gi, "<b$1");
- html = html.replace(/<\/strong>/gi, "</b>");
- html = html.replace(/<em([ \>])/gi, "<i$1");
- html = html.replace(/<\/em>/gi, "</i>");
- return html;
-}});
-