-Initial AJAX support
-Upgrading Dojo to version 1.0
This commit is contained in:
@@ -6,7 +6,7 @@ dojo.require("dijit._Widget");
|
||||
dojo.require("dijit._Templated");
|
||||
dojo.require("dojo.colors");
|
||||
dojo.require("dojo.i18n");
|
||||
dojo.requireLocalization("dojo", "colors", null, "ROOT");
|
||||
dojo.requireLocalization("dojo", "colors", null, "ko,zh,ja,zh-tw,ru,it,hu,ROOT,fr,pt,pl,es,de,cs");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.ColorPalette",
|
||||
@@ -16,13 +16,13 @@ dojo.declare(
|
||||
// Grid showing various colors, so the user can pick a certain color
|
||||
|
||||
// defaultTimeout: Number
|
||||
// number of milliseconds before a held key or button becomes typematic
|
||||
// number of milliseconds before a held key or button becomes typematic
|
||||
defaultTimeout: 500,
|
||||
|
||||
// timeoutChangeRate: Number
|
||||
// fraction of time used to change the typematic timer between events
|
||||
// 1.0 means that each typematic event fires at defaultTimeout intervals
|
||||
// < 1.0 means that each typematic event fires at an increasing faster rate
|
||||
// fraction of time used to change the typematic timer between events
|
||||
// 1.0 means that each typematic event fires at defaultTimeout intervals
|
||||
// < 1.0 means that each typematic event fires at an increasing faster rate
|
||||
timeoutChangeRate: 0.90,
|
||||
|
||||
// palette: String
|
||||
@@ -50,7 +50,7 @@ dojo.declare(
|
||||
// The first level is a hashmap of the different arrays available
|
||||
// The next two dimensions represent the columns and rows of colors.
|
||||
_palettes: {
|
||||
|
||||
|
||||
"7x10": [["white", "seashell", "cornsilk", "lemonchiffon","lightyellow", "palegreen", "paleturquoise", "lightcyan", "lavender", "plum"],
|
||||
["lightgray", "pink", "bisque", "moccasin", "khaki", "lightgreen", "lightseagreen", "lightskyblue", "cornflowerblue", "violet"],
|
||||
["silver", "lightcoral", "sandybrown", "orange", "palegoldenrod", "chartreuse", "mediumturquoise", "skyblue", "mediumslateblue","orchid"],
|
||||
@@ -58,11 +58,11 @@ dojo.declare(
|
||||
["dimgray", "crimson", "chocolate", "coral", "gold", "forestgreen", "seagreen", "blue", "blueviolet", "darkorchid"],
|
||||
["darkslategray","firebrick","saddlebrown", "sienna", "olive", "green", "darkcyan", "mediumblue","darkslateblue", "darkmagenta" ],
|
||||
["black", "darkred", "maroon", "brown", "darkolivegreen", "darkgreen", "midnightblue", "navy", "indigo", "purple"]],
|
||||
|
||||
|
||||
"3x4": [["white", "lime", "green", "blue"],
|
||||
["silver", "yellow", "fuchsia", "navy"],
|
||||
["gray", "red", "purple", "black"]]
|
||||
|
||||
|
||||
},
|
||||
|
||||
// _imagePaths: Map
|
||||
@@ -76,18 +76,20 @@ dojo.declare(
|
||||
// This is a map that is used to calculate the coordinates of the
|
||||
// images that make up the palette.
|
||||
_paletteCoords: {
|
||||
"leftOffset": 3, "topOffset": 3,
|
||||
"cWidth": 18, "cHeight": 16
|
||||
"leftOffset": 4, "topOffset": 4,
|
||||
"cWidth": 20, "cHeight": 20
|
||||
|
||||
},
|
||||
|
||||
// templatePath: String
|
||||
// Path to the template of this widget.
|
||||
templateString:"<fieldset class=\"dijitInlineBox\">\n\t<div style=\"overflow: hidden\" dojoAttachPoint=\"divNode\" waiRole=\"grid\" tabIndex=\"-1\">\n\t\t<img style=\"border-style: none;\" dojoAttachPoint=\"imageNode\" tabIndex=\"-1\" />\n\t</div>\t\n</fieldset>\n",
|
||||
|
||||
templateString:"<div class=\"dijitInline dijitColorPalette\">\n\t<div class=\"dijitColorPaletteInner\" dojoAttachPoint=\"divNode\" waiRole=\"grid\" tabIndex=\"-1\">\n\t\t<img class=\"dijitColorPaletteUnder\" dojoAttachPoint=\"imageNode\" waiRole=\"presentation\">\n\t</div>\t\n</div>\n",
|
||||
|
||||
// _paletteDims: Object
|
||||
// Size of the supported palettes for alignment purposes.
|
||||
_paletteDims: {
|
||||
"7x10": {"width": "185px", "height": "117px"},
|
||||
"3x4": {"width": "77px", "height": "53px"}
|
||||
"7x10": {"width": "206px", "height": "145px"},
|
||||
"3x4": {"width": "86px", "height": "64px"}
|
||||
},
|
||||
|
||||
|
||||
@@ -120,7 +122,7 @@ dojo.declare(
|
||||
highlightStyle.left = coords.leftOffset + (col * coords.cWidth) + "px";
|
||||
highlightNode.setAttribute("tabIndex","-1");
|
||||
highlightNode.title = this.colorNames[color];
|
||||
dijit.wai.setAttr(highlightNode, "waiRole", "role", "gridcell");
|
||||
dijit.setWaiRole(highlightNode, "gridcell");
|
||||
highlightNode.index = this._highlightNodes.length;
|
||||
this._highlightNodes.push(highlightNode);
|
||||
}
|
||||
@@ -166,7 +168,7 @@ dojo.declare(
|
||||
// Callback when a color is selected.
|
||||
// color: String
|
||||
// Hex value corresponding to color.
|
||||
console.debug("Color selected is: "+color);
|
||||
// console.debug("Color selected is: "+color);
|
||||
},
|
||||
|
||||
_onColorDijitclick: function(/*Event*/ evt){
|
||||
@@ -231,8 +233,7 @@ dojo.declare(
|
||||
// This selects a color. It triggers the onChange event
|
||||
// area:
|
||||
// The area node that covers the color being selected.
|
||||
this.value = selectNode.color;
|
||||
this.onChange(selectNode.color);
|
||||
this.onChange(this.value = selectNode.color);
|
||||
},
|
||||
|
||||
_navigateByKey: function(increment, typeCount){
|
||||
@@ -241,7 +242,7 @@ dojo.declare(
|
||||
// It changes the focus and the highlighed color.
|
||||
// increment:
|
||||
// How much the key is navigated.
|
||||
// typeCount:
|
||||
// typeCount:
|
||||
// How many times typematic has fired.
|
||||
|
||||
// typecount == -1 means the key is released.
|
||||
|
||||
@@ -25,8 +25,11 @@ dojo.declare(
|
||||
|
||||
var propList = this.defaults||{};
|
||||
|
||||
this.mixins = this.mixins.length ?
|
||||
dojo.map(this.mixins, dojo.getObject) :
|
||||
// map array of strings like [ "dijit.form.Button" ] to array of mixin objects
|
||||
// (note that dojo.map(this.mixins, dojo.getObject) doesn't work because it passes
|
||||
// a bogus third argument to getObject(), confusing it)
|
||||
this.mixins = this.mixins.length ?
|
||||
dojo.map(this.mixins, function(name){ return dojo.getObject(name); } ) :
|
||||
[ dijit._Widget, dijit._Templated ];
|
||||
|
||||
if(preambles.length){
|
||||
@@ -34,17 +37,14 @@ dojo.declare(
|
||||
propList.preamble = dojo.parser._functionFromScript(preambles[0]);
|
||||
}
|
||||
propList.widgetsInTemplate = true;
|
||||
propList.templateString = "<"+srcType+" class='"+src.className+"'>"+src.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+srcType+">";
|
||||
propList._skipNodeCache = true;
|
||||
propList.templateString = "<"+srcType+" class='"+src.className+"' dojoAttachPoint='"+(src.getAttribute("dojoAttachPoint")||'')+"' dojoAttachEvent='"+(src.getAttribute("dojoAttachEvent")||'')+"' >"+src.innerHTML.replace(/\%7B/g,"{").replace(/\%7D/g,"}")+"</"+srcType+">";
|
||||
// console.debug(propList.templateString);
|
||||
|
||||
// strip things so we don't create stuff under us in the initial setup phase
|
||||
dojo.query("[dojoType]", src).forEach(function(node){
|
||||
node.removeAttribute("dojoType");
|
||||
});
|
||||
scripts.forEach(function(s){
|
||||
if(!s.getAttribute("event")){
|
||||
this.mixins.push(dojo.parser._functionFromScript(s));
|
||||
}
|
||||
}, this);
|
||||
|
||||
// create the new widget class
|
||||
dojo.declare(
|
||||
@@ -53,11 +53,12 @@ dojo.declare(
|
||||
propList
|
||||
);
|
||||
|
||||
// do the connects for each <script type="dojo/connect" event="foo"> block and make
|
||||
// all <script type="dojo/method"> tags execute right after construction
|
||||
var wcp = dojo.getObject(this.widgetClass).prototype;
|
||||
scripts.forEach(function(s){
|
||||
if(s.getAttribute("event")){
|
||||
dojo.parser._wireUpMethod(wcp, s);
|
||||
}
|
||||
var event = s.getAttribute("event");
|
||||
dojo.connect(wcp, event || "postscript", null, dojo.parser._functionFromScript(s));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,11 @@ dojo.declare(
|
||||
[dijit._Widget, dijit._Templated],
|
||||
{
|
||||
// summary: the thing that grays out the screen behind the dialog
|
||||
|
||||
|
||||
// Template has two divs; outer div is used for fade-in/fade-out, and also to hold background iframe.
|
||||
// Inner div has opacity specified in CSS file.
|
||||
templateString: "<div class=dijitDialogUnderlayWrapper id='${id}_underlay'><div class=dijitDialogUnderlay dojoAttachPoint='node'></div></div>",
|
||||
|
||||
|
||||
postCreate: function(){
|
||||
dojo.body().appendChild(this.domNode);
|
||||
this.bgIframe = new dijit.BackgroundIframe(this.domNode);
|
||||
@@ -39,7 +39,7 @@ dojo.declare(
|
||||
os.left = viewport.l + "px";
|
||||
is.width = viewport.w + "px";
|
||||
is.height = viewport.h + "px";
|
||||
|
||||
|
||||
// process twice since the scroll bar may have been removed
|
||||
// by the previous resizing
|
||||
var viewport2 = dijit.getViewport();
|
||||
@@ -58,7 +58,6 @@ dojo.declare(
|
||||
|
||||
hide: function(){
|
||||
this.domNode.style.display = "none";
|
||||
this.domNode.style.width = this.domNode.style.height = "1px";
|
||||
if(this.bgIframe.iframe){
|
||||
this.bgIframe.iframe.style.display = "none";
|
||||
}
|
||||
@@ -72,7 +71,7 @@ dojo.declare(
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
dojo.declare(
|
||||
"dijit.Dialog",
|
||||
[dijit.layout.ContentPane, dijit._Templated, dijit.form._FormMixin],
|
||||
@@ -83,29 +82,34 @@ dojo.declare(
|
||||
// ContentPane so it supports all the same parameters (href, etc.)
|
||||
|
||||
templateString: null,
|
||||
templateString:"<div class=\"dijitDialog\">\n\t\t<div dojoAttachPoint=\"titleBar\" class=\"dijitDialogTitleBar\" tabindex=\"0\" waiRole=\"dialog\" title=\"${title}\">\n\t\t<span dojoAttachPoint=\"titleNode\" class=\"dijitDialogTitle\">${title}</span>\n\t\t<span dojoAttachPoint=\"closeButtonNode\" class=\"dijitDialogCloseIcon\" dojoAttachEvent=\"onclick: hide\">\n\t\t\t<span dojoAttachPoint=\"closeText\" class=\"closeText\">x</span>\n\t\t</span>\n\t</div>\n\t\t<div dojoAttachPoint=\"containerNode\" class=\"dijitDialogPaneContent\"></div>\n\t<span dojoAttachPoint=\"tabEnd\" dojoAttachEvent=\"onfocus:_cycleFocus\" tabindex=\"0\"></span>\n</div>\n",
|
||||
templateString:"<div class=\"dijitDialog\">\n\t<div dojoAttachPoint=\"titleBar\" class=\"dijitDialogTitleBar\" tabindex=\"0\" waiRole=\"dialog\">\n\t<span dojoAttachPoint=\"titleNode\" class=\"dijitDialogTitle\">${title}</span>\n\t<span dojoAttachPoint=\"closeButtonNode\" class=\"dijitDialogCloseIcon\" dojoAttachEvent=\"onclick: hide\">\n\t\t<span dojoAttachPoint=\"closeText\" class=\"closeText\">x</span>\n\t</span>\n\t</div>\n\t\t<div dojoAttachPoint=\"containerNode\" class=\"dijitDialogPaneContent\"></div>\n\t<span dojoAttachPoint=\"tabEnd\" dojoAttachEvent=\"onfocus:_cycleFocus\" tabindex=\"0\"></span>\n</div>\n",
|
||||
|
||||
// title: String
|
||||
// Title of the dialog
|
||||
title: "",
|
||||
// open: Boolean
|
||||
// is True or False depending on state of dialog
|
||||
open: false,
|
||||
|
||||
// duration: Integer
|
||||
// The time in milliseconds it takes the dialog to fade in and out
|
||||
duration: 400,
|
||||
|
||||
|
||||
_lastFocusItem:null,
|
||||
|
||||
|
||||
attributeMap: dojo.mixin(dojo.clone(dijit._Widget.prototype.attributeMap),
|
||||
{title: "titleBar"}),
|
||||
|
||||
postCreate: function(){
|
||||
dojo.body().appendChild(this.domNode);
|
||||
dijit.Dialog.superclass.postCreate.apply(this, arguments);
|
||||
this.inherited("postCreate",arguments);
|
||||
this.domNode.style.display="none";
|
||||
this.connect(this, "onExecute", "hide");
|
||||
this.connect(this, "onCancel", "hide");
|
||||
},
|
||||
|
||||
onLoad: function(){
|
||||
// when href is specified we need to reposition
|
||||
// the dialog after the data is loaded
|
||||
// summary:
|
||||
// when href is specified we need to reposition the dialog after the data is loaded
|
||||
this._position();
|
||||
dijit.Dialog.superclass.onLoad.call(this);
|
||||
this.inherited("onLoad",arguments);
|
||||
},
|
||||
|
||||
_setup: function(){
|
||||
@@ -161,23 +165,24 @@ dojo.declare(
|
||||
|
||||
_position: function(){
|
||||
// summary: position modal dialog in center of screen
|
||||
|
||||
|
||||
if(dojo.hasClass(dojo.body(),"dojoMove")){ return; }
|
||||
var viewport = dijit.getViewport();
|
||||
var mb = dojo.marginBox(this.domNode);
|
||||
|
||||
var style = this.domNode.style;
|
||||
style.left = (viewport.l + (viewport.w - mb.w)/2) + "px";
|
||||
style.top = (viewport.t + (viewport.h - mb.h)/2) + "px";
|
||||
style.left = Math.floor((viewport.l + (viewport.w - mb.w)/2)) + "px";
|
||||
style.top = Math.floor((viewport.t + (viewport.h - mb.h)/2)) + "px";
|
||||
},
|
||||
|
||||
|
||||
_findLastFocus: function(/*Event*/ evt){
|
||||
// summary: called from onblur of dialog container to determine the last focusable item
|
||||
// summary: called from onblur of dialog container to determine the last focusable item
|
||||
this._lastFocused = evt.target;
|
||||
},
|
||||
|
||||
|
||||
_cycleFocus: function(/*Event*/ evt){
|
||||
// summary: when tabEnd receives focus, advance focus around to titleBar
|
||||
|
||||
|
||||
// on first focus to tabEnd, store the last focused item in dialog
|
||||
if(!this._lastFocusItem){
|
||||
this._lastFocusItem = this._lastFocused;
|
||||
@@ -190,15 +195,15 @@ dojo.declare(
|
||||
var node = evt.target;
|
||||
// see if we are shift-tabbing from titleBar
|
||||
if(node == this.titleBar && evt.shiftKey && evt.keyCode == dojo.keys.TAB){
|
||||
if (this._lastFocusItem){
|
||||
if(this._lastFocusItem){
|
||||
this._lastFocusItem.focus(); // send focus to last item in dialog if known
|
||||
}
|
||||
dojo.stopEvent(evt);
|
||||
}else{
|
||||
// see if the key is for the dialog
|
||||
while (node){
|
||||
while(node){
|
||||
if(node == this.domNode){
|
||||
if (evt.keyCode == dojo.keys.ESCAPE){
|
||||
if(evt.keyCode == dojo.keys.ESCAPE){
|
||||
this.hide();
|
||||
}else{
|
||||
return; // just let it go
|
||||
@@ -207,7 +212,7 @@ dojo.declare(
|
||||
node = node.parentNode;
|
||||
}
|
||||
// this key is for the disabled document window
|
||||
if (evt.keyCode != dojo.keys.TAB){ // allow tabbing into the dialog for a11y
|
||||
if(evt.keyCode != dojo.keys.TAB){ // allow tabbing into the dialog for a11y
|
||||
dojo.stopEvent(evt);
|
||||
// opera won't tab to a div
|
||||
}else if (!dojo.isOpera){
|
||||
@@ -234,23 +239,22 @@ dojo.declare(
|
||||
|
||||
this._modalconnects.push(dojo.connect(window, "onscroll", this, "layout"));
|
||||
this._modalconnects.push(dojo.connect(document.documentElement, "onkeypress", this, "_onKey"));
|
||||
|
||||
|
||||
// IE doesn't bubble onblur events - use ondeactivate instead
|
||||
var ev = typeof(document.ondeactivate) == "object" ? "ondeactivate" : "onblur";
|
||||
this._modalconnects.push(dojo.connect(this.containerNode, ev, this, "_findLastFocus"));
|
||||
|
||||
|
||||
|
||||
dojo.style(this.domNode, "opacity", 0);
|
||||
this.domNode.style.display="block";
|
||||
|
||||
this.open = true;
|
||||
this._loadCheck(); // lazy load trigger
|
||||
|
||||
this._position();
|
||||
|
||||
this._fadeIn.play();
|
||||
|
||||
|
||||
this._savedFocus = dijit.getFocus(this);
|
||||
|
||||
|
||||
// set timeout to allow the browser to render dialog
|
||||
setTimeout(dojo.hitch(this, function(){
|
||||
dijit.focus(this.titleBar);
|
||||
@@ -277,12 +281,14 @@ dojo.declare(
|
||||
dojo.forEach(this._modalconnects, dojo.disconnect);
|
||||
this._modalconnects = [];
|
||||
|
||||
// TODO: this is failing on FF presumably because the DialogUnderlay hasn't disappeared yet?
|
||||
// Attach it to fire at the end of the animation
|
||||
dijit.focus(this._savedFocus);
|
||||
this.connect(this._fadeOut,"onEnd",dojo.hitch(this,function(){
|
||||
dijit.focus(this._savedFocus);
|
||||
}));
|
||||
this.open = false;
|
||||
},
|
||||
|
||||
layout: function() {
|
||||
// summary: position the Dialog and the underlay
|
||||
if(this.domNode.style.display == "block"){
|
||||
this._underlay.layout();
|
||||
this._position();
|
||||
@@ -290,25 +296,24 @@ dojo.declare(
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
dojo.declare(
|
||||
"dijit.TooltipDialog",
|
||||
[dijit.layout.ContentPane, dijit._Templated, dijit.form._FormMixin],
|
||||
{
|
||||
// summary:
|
||||
// Pops up a dialog that appears like a Tooltip
|
||||
|
||||
// title: String
|
||||
// Description of tooltip dialog (required for a11Y)
|
||||
// Description of tooltip dialog (required for a11Y)
|
||||
title: "",
|
||||
|
||||
_lastFocusItem: null,
|
||||
|
||||
templateString: null,
|
||||
templateString:"<div id=\"${id}\" class=\"dijitTooltipDialog\" >\n\t<div class=\"dijitTooltipContainer\">\n\t\t<div class =\"dijitTooltipContents dijitTooltipFocusNode\" dojoAttachPoint=\"containerNode\" tabindex=\"0\" waiRole=\"dialog\"></div>\n\t</div>\n\t<span dojoAttachPoint=\"tabEnd\" tabindex=\"0\" dojoAttachEvent=\"focus:_cycleFocus\"></span>\n\t<div class=\"dijitTooltipConnector\" ></div>\n</div>\n",
|
||||
templateString:"<div class=\"dijitTooltipDialog\" >\n\t<div class=\"dijitTooltipContainer\">\n\t\t<div class =\"dijitTooltipContents dijitTooltipFocusNode\" dojoAttachPoint=\"containerNode\" tabindex=\"0\" waiRole=\"dialog\"></div>\n\t</div>\n\t<span dojoAttachPoint=\"tabEnd\" tabindex=\"0\" dojoAttachEvent=\"focus:_cycleFocus\"></span>\n\t<div class=\"dijitTooltipConnector\" ></div>\n</div>\n",
|
||||
|
||||
postCreate: function(){
|
||||
dijit.TooltipDialog.superclass.postCreate.apply(this, arguments);
|
||||
this.inherited("postCreate",arguments);
|
||||
this.connect(this.containerNode, "onkeypress", "_onKey");
|
||||
|
||||
// IE doesn't bubble onblur events - use ondeactivate instead
|
||||
@@ -328,27 +333,31 @@ dojo.declare(
|
||||
this._loadCheck(); // lazy load trigger
|
||||
this.containerNode.focus();
|
||||
},
|
||||
|
||||
|
||||
_onKey: function(/*Event*/ evt){
|
||||
//summary: keep keyboard focus in dialog; close dialog on escape key
|
||||
if (evt.keyCode == dojo.keys.ESCAPE){
|
||||
// summary: keep keyboard focus in dialog; close dialog on escape key
|
||||
if(evt.keyCode == dojo.keys.ESCAPE){
|
||||
this.onCancel();
|
||||
}else if (evt.target == this.containerNode && evt.shiftKey && evt.keyCode == dojo.keys.TAB){
|
||||
}else if(evt.target == this.containerNode && evt.shiftKey && evt.keyCode == dojo.keys.TAB){
|
||||
if (this._lastFocusItem){
|
||||
this._lastFocusItem.focus();
|
||||
}
|
||||
dojo.stopEvent(evt);
|
||||
}else if(evt.keyCode == dojo.keys.TAB){
|
||||
// we want the browser's default tab handling to move focus
|
||||
// but we don't want the tab to propagate upwards
|
||||
evt.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_findLastFocus: function(/*Event*/ evt){
|
||||
// summary: called from onblur of dialog container to determine the last focusable item
|
||||
// summary: called from onblur of dialog container to determine the last focusable item
|
||||
this._lastFocused = evt.target;
|
||||
},
|
||||
|
||||
_cycleFocus: function(/*Event*/ evt){
|
||||
// summary: when tabEnd receives focus, advance focus around to containerNode
|
||||
|
||||
|
||||
// on first focus to tabEnd, store the last focused item in dialog
|
||||
if(!this._lastFocusItem){
|
||||
this._lastFocusItem = this._lastFocused;
|
||||
|
||||
@@ -6,27 +6,31 @@ dojo.require("dijit.Toolbar");
|
||||
dojo.require("dijit._editor._Plugin");
|
||||
dojo.require("dijit._Container");
|
||||
dojo.require("dojo.i18n");
|
||||
dojo.requireLocalization("dijit._editor", "commands", null, "it,ROOT,de");
|
||||
dojo.requireLocalization("dijit._editor", "commands", null, "ko,zh,ja,zh-tw,ru,it,hu,fr,pt,pl,es,ROOT,de,cs");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.Editor",
|
||||
[ dijit._editor.RichText, dijit._Container ],
|
||||
dijit._editor.RichText,
|
||||
{
|
||||
// plugins:
|
||||
// summary: A rich-text Editing widget
|
||||
|
||||
// plugins: Array
|
||||
// a list of plugin names (as strings) or instances (as objects)
|
||||
// for this widget.
|
||||
// plugins: [ "dijit._editor.plugins.DefaultToolbar" ],
|
||||
plugins: null,
|
||||
|
||||
// extraPlugins: Array
|
||||
// a list of extra plugin names which will be appended to plugins array
|
||||
extraPlugins: null,
|
||||
preamble: function(){
|
||||
this.inherited('preamble',arguments);
|
||||
|
||||
constructor: function(){
|
||||
this.plugins=["undo","redo","|","cut","copy","paste","|","bold","italic","underline","strikethrough","|",
|
||||
"insertOrderedList","insertUnorderedList","indent","outdent","|","justifyLeft","justifyRight","justifyCenter","justifyFull"/*"createlink"*/];
|
||||
"insertOrderedList","insertUnorderedList","indent","outdent","|","justifyLeft","justifyRight","justifyCenter","justifyFull"/*"createLink"*/];
|
||||
|
||||
this._plugins=[];
|
||||
this._editInterval = this.editActionInterval * 1000;
|
||||
},
|
||||
toolbar: null,
|
||||
|
||||
postCreate: function(){
|
||||
//for custom undo/redo
|
||||
if(this.customUndo){
|
||||
@@ -47,11 +51,13 @@ dojo.declare(
|
||||
|
||||
if(!this.toolbar){
|
||||
// if we haven't been assigned a toolbar, create one
|
||||
this.toolbar = new dijit.Toolbar();
|
||||
dojo.place(this.toolbar.domNode, this.editingArea, "before");
|
||||
var toolbarNode = dojo.doc.createElement("div");
|
||||
dojo.place(toolbarNode, this.editingArea, "before");
|
||||
this.toolbar = new dijit.Toolbar({}, toolbarNode);
|
||||
}
|
||||
|
||||
dojo.forEach(this.plugins, this.addPlugin, this);
|
||||
this.onNormalizedDisplayChanged(); //update toolbar button status
|
||||
// }catch(e){ console.debug(e); }
|
||||
},
|
||||
destroy: function(){
|
||||
@@ -61,6 +67,7 @@ dojo.declare(
|
||||
}
|
||||
});
|
||||
this._plugins=[];
|
||||
this.toolbar.destroy(); delete this.toolbar;
|
||||
this.inherited('destroy',arguments);
|
||||
},
|
||||
addPlugin: function(/*String||Object*/plugin, /*Integer?*/index){
|
||||
@@ -70,7 +77,7 @@ dojo.declare(
|
||||
// instance. The resulting plugin is added to the Editor's
|
||||
// plugins array. If index is passed, it's placed in the plugins
|
||||
// array at that index. No big magic, but a nice helper for
|
||||
// passing in plugin names via markup.
|
||||
// passing in plugin names via markup.
|
||||
// plugin: String, args object or plugin instance. Required.
|
||||
// args: This object will be passed to the plugin constructor.
|
||||
// index:
|
||||
@@ -88,7 +95,7 @@ dojo.declare(
|
||||
}
|
||||
}
|
||||
if(!o.plugin){
|
||||
console.debug('Can not find plugin',plugin);
|
||||
console.debug('Cannot find plugin',plugin);
|
||||
return;
|
||||
}
|
||||
plugin=o.plugin;
|
||||
@@ -104,7 +111,7 @@ dojo.declare(
|
||||
}
|
||||
},
|
||||
/* beginning of custom undo/redo support */
|
||||
|
||||
|
||||
// customUndo: Boolean
|
||||
// Whether we shall use custom undo/redo support instead of the native
|
||||
// browser support. By default, we only enable customUndo for IE, as it
|
||||
@@ -113,11 +120,11 @@ dojo.declare(
|
||||
customUndo: dojo.isIE,
|
||||
|
||||
// editActionInterval: Integer
|
||||
// When using customUndo, not every keystroke will be saved as a step.
|
||||
// Instead typing (including delete) will be grouped together: after
|
||||
// a user stop typing for editActionInterval seconds, a step will be
|
||||
// saved; if a user resume typing within editActionInterval seconds,
|
||||
// the timeout will be restarted. By default, editActionInterval is 3
|
||||
// When using customUndo, not every keystroke will be saved as a step.
|
||||
// Instead typing (including delete) will be grouped together: after
|
||||
// a user stop typing for editActionInterval seconds, a step will be
|
||||
// saved; if a user resume typing within editActionInterval seconds,
|
||||
// the timeout will be restarted. By default, editActionInterval is 3
|
||||
// seconds.
|
||||
editActionInterval: 3,
|
||||
beginEditing: function(cmd){
|
||||
@@ -136,7 +143,7 @@ dojo.declare(
|
||||
_undoedSteps:[],
|
||||
execCommand: function(cmd){
|
||||
if(this.customUndo && (cmd=='undo' || cmd=='redo')){
|
||||
return cmd=='undo'?this.undo():this.redo();
|
||||
return this[cmd]();
|
||||
}else{
|
||||
try{
|
||||
if(this.customUndo){
|
||||
@@ -149,14 +156,13 @@ dojo.declare(
|
||||
}
|
||||
return r;
|
||||
}catch(e){
|
||||
if(dojo.isMoz){
|
||||
if('copy'==cmd){
|
||||
alert(this.commands['copyErrorFF']);
|
||||
}else if('cut'==cmd){
|
||||
alert(this.commands['cutErrorFF']);
|
||||
}else if('paste'==cmd){
|
||||
alert(this.commands['pasteErrorFF']);
|
||||
}
|
||||
if(dojo.isMoz && /copy|cut|paste/.test(cmd)){
|
||||
// Warn user of platform limitation. Cannot programmatically access keyboard. See ticket #4136
|
||||
var sub = dojo.string.substitute,
|
||||
accel = {cut:'X', copy:'C', paste:'V'},
|
||||
isMac = navigator.userAgent.indexOf("Macintosh") != -1;
|
||||
alert(sub(this.commands.systemShortcutFF,
|
||||
[cmd, sub(this.commands[isMac ? 'appleKey' : 'ctrlKey'], [accel[cmd]])]));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -190,7 +196,7 @@ dojo.declare(
|
||||
dojo.withGlobal(this.window,'moveToBookmark',dijit,[b]);
|
||||
},
|
||||
undo: function(){
|
||||
console.log('undo');
|
||||
// console.log('undo');
|
||||
this.endEditing(true);
|
||||
var s=this._steps.pop();
|
||||
if(this._steps.length>0){
|
||||
@@ -203,7 +209,7 @@ dojo.declare(
|
||||
return false;
|
||||
},
|
||||
redo: function(){
|
||||
console.log('redo');
|
||||
// console.log('redo');
|
||||
this.endEditing(true);
|
||||
var s=this._undoedSteps.pop();
|
||||
if(s && this._steps.length>0){
|
||||
@@ -272,7 +278,7 @@ dojo.declare(
|
||||
}
|
||||
}
|
||||
this.inherited('onKeyDown',arguments);
|
||||
|
||||
|
||||
switch(k){
|
||||
case ks.ENTER:
|
||||
this.beginEditing();
|
||||
@@ -319,6 +325,7 @@ dojo.declare(
|
||||
//maybe ctrl+backspace/delete, so don't endEditing when ctrl is pressed
|
||||
case ks.CTRL:
|
||||
case ks.SHIFT:
|
||||
case ks.TAB:
|
||||
break;
|
||||
}
|
||||
},
|
||||
@@ -334,6 +341,7 @@ dojo.declare(
|
||||
}
|
||||
);
|
||||
|
||||
/* the following code is to registered a handler to get default plugins */
|
||||
dojo.subscribe("dijit.Editor.getPlugin",null,function(o){
|
||||
if(o.plugin){ return; }
|
||||
var args=o.args, p;
|
||||
@@ -346,20 +354,23 @@ dojo.subscribe("dijit.Editor.getPlugin",null,function(o){
|
||||
case "selectAll": case "removeFormat":
|
||||
p = new _p({ command: name });
|
||||
break;
|
||||
|
||||
case "bold": case "italic": case "underline": case "strikethrough":
|
||||
|
||||
case "bold": case "italic": case "underline": case "strikethrough":
|
||||
case "subscript": case "superscript":
|
||||
//shall we try to auto require here? or require user to worry about it?
|
||||
// dojo['require']('dijit.form.Button');
|
||||
p = new _p({ buttonClass: dijit.form.ToggleButton, command: name });
|
||||
break;
|
||||
case "|":
|
||||
p = new _p({ button: new dijit.ToolbarSeparator() });
|
||||
break;
|
||||
case "createlink":
|
||||
case "createLink":
|
||||
// dojo['require']('dijit._editor.plugins.LinkDialog');
|
||||
p = new dijit._editor.plugins.LinkDialog();
|
||||
p = new dijit._editor.plugins.LinkDialog({ command: name });
|
||||
break;
|
||||
case "foreColor": case "hiliteColor":
|
||||
p = new dijit._editor.plugins.TextColor({ command: name });
|
||||
break;
|
||||
case "fontName": case "fontSize": case "formatBlock":
|
||||
p = new dijit._editor.plugins.FontChoice({ command: name });
|
||||
}
|
||||
// console.log('name',name,p);
|
||||
o.plugin=p;
|
||||
|
||||
405
spring-faces/src/main/java/META-INF/dijit/InlineEditBox.js
Normal file
405
spring-faces/src/main/java/META-INF/dijit/InlineEditBox.js
Normal file
@@ -0,0 +1,405 @@
|
||||
if(!dojo._hasResource["dijit.InlineEditBox"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dijit.InlineEditBox"] = true;
|
||||
dojo.provide("dijit.InlineEditBox");
|
||||
|
||||
dojo.require("dojo.i18n");
|
||||
|
||||
dojo.require("dijit._Widget");
|
||||
dojo.require("dijit._Container");
|
||||
dojo.require("dijit.form.Button");
|
||||
dojo.require("dijit.form.TextBox");
|
||||
|
||||
dojo.requireLocalization("dijit", "common", null, "ko,zh,ja,zh-tw,ru,it,hu,fr,pt,ROOT,pl,es,de,cs");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.InlineEditBox",
|
||||
dijit._Widget,
|
||||
{
|
||||
// summary
|
||||
// Behavior for an existing node (<p>, <div>, <span>, etc.) so that
|
||||
// when you click it, an editor shows up in place of the original
|
||||
// text. Optionally, Save and Cancel button are displayed below the edit widget.
|
||||
// When Save is clicked, the text is pulled from the edit
|
||||
// widget and redisplayed and the edit widget is again hidden.
|
||||
// By default a plain Textarea widget is used as the editor (or for
|
||||
// inline values a TextBox), but you can specify an editor such as
|
||||
// dijit.Editor (for editing HTML) or a Slider (for adjusting a number).
|
||||
// An edit widget must support the following API to be used:
|
||||
// String getDisplayedValue() OR String getValue()
|
||||
// void setDisplayedValue(String) OR void setValue(String)
|
||||
// void focus()
|
||||
|
||||
// editing: Boolean
|
||||
// Is the node currently in edit mode?
|
||||
editing: false,
|
||||
|
||||
// autoSave: Boolean
|
||||
// Changing the value automatically saves it; don't have to push save button
|
||||
// (and save button isn't even displayed)
|
||||
autoSave: true,
|
||||
|
||||
// buttonSave: String
|
||||
// Save button label
|
||||
buttonSave: "",
|
||||
|
||||
// buttonCancel: String
|
||||
// Cancel button label
|
||||
buttonCancel: "",
|
||||
|
||||
// renderAsHtml: Boolean
|
||||
// Set this to true if the specified Editor's value should be interpreted as HTML
|
||||
// rather than plain text (ie, dijit.Editor)
|
||||
renderAsHtml: false,
|
||||
|
||||
// editor: String
|
||||
// Class name for Editor widget
|
||||
editor: "dijit.form.TextBox",
|
||||
|
||||
// editorParams: Object
|
||||
// Set of parameters for editor, like {required: true}
|
||||
editorParams: {},
|
||||
|
||||
onChange: function(value){
|
||||
// summary: User should set this handler to be notified of changes to value
|
||||
},
|
||||
|
||||
// width: String
|
||||
// Width of editor. By default it's width=100% (ie, block mode)
|
||||
width: "100%",
|
||||
|
||||
// value: String
|
||||
// The display value of the widget in read-only mode
|
||||
value: "",
|
||||
|
||||
// noValueIndicator: String
|
||||
// The text that gets displayed when there is no value (so that the user has a place to click to edit)
|
||||
noValueIndicator: "<span style='font-family: wingdings; text-decoration: underline;'> ✍ </span>",
|
||||
|
||||
postMixInProperties: function(){
|
||||
this.inherited('postMixInProperties', arguments);
|
||||
|
||||
// save pointer to original source node, since Widget nulls-out srcNodeRef
|
||||
this.displayNode = this.srcNodeRef;
|
||||
|
||||
// connect handlers to the display node
|
||||
var events = {
|
||||
ondijitclick: "_onClick",
|
||||
onmouseover: "_onMouseOver",
|
||||
onmouseout: "_onMouseOut",
|
||||
onfocus: "_onMouseOver",
|
||||
onblur: "_onMouseOut"
|
||||
};
|
||||
for(var name in events){
|
||||
this.connect(this.displayNode, name, events[name]);
|
||||
}
|
||||
dijit.setWaiRole(this.displayNode, "button");
|
||||
if(!this.displayNode.getAttribute("tabIndex")){
|
||||
this.displayNode.setAttribute("tabIndex", 0);
|
||||
}
|
||||
|
||||
if(!this.value){
|
||||
this.value = this.displayNode.innerHTML;
|
||||
}
|
||||
this._setDisplayValue(this.value); // if blank, change to icon for "input needed"
|
||||
},
|
||||
|
||||
_onMouseOver: function(){
|
||||
dojo.addClass(this.displayNode, this.disabled ? "dijitDisabledClickableRegion" : "dijitClickableRegion");
|
||||
},
|
||||
|
||||
_onMouseOut: function(){
|
||||
dojo.removeClass(this.displayNode, this.disabled ? "dijitDisabledClickableRegion" : "dijitClickableRegion");
|
||||
},
|
||||
|
||||
_onClick: function(/*Event*/ e){
|
||||
if(this.disabled){ return; }
|
||||
if(e){ dojo.stopEvent(e); }
|
||||
this._onMouseOut();
|
||||
|
||||
// Since FF gets upset if you move a node while in an event handler for that node...
|
||||
setTimeout(dojo.hitch(this, "_edit"), 0);
|
||||
},
|
||||
|
||||
_edit: function(){
|
||||
// summary: display the editor widget in place of the original (read only) markup
|
||||
|
||||
this.editing = true;
|
||||
|
||||
var editValue =
|
||||
(this.renderAsHtml ?
|
||||
this.value :
|
||||
this.value.replace(/\s*\r?\n\s*/g,"").replace(/<br\/?>/gi, "\n").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&"));
|
||||
|
||||
// Placeholder for edit widget
|
||||
// Put place holder (and eventually editWidget) before the display node so that it's positioned correctly
|
||||
// when Calendar dropdown appears, which happens automatically on focus.
|
||||
var placeholder = document.createElement("span");
|
||||
dojo.place(placeholder, this.domNode, "before");
|
||||
|
||||
var ew = this.editWidget = new dijit._InlineEditor({
|
||||
value: dojo.trim(editValue),
|
||||
autoSave: this.autoSave,
|
||||
buttonSave: this.buttonSave,
|
||||
buttonCancel: this.buttonCancel,
|
||||
renderAsHtml: this.renderAsHtml,
|
||||
editor: this.editor,
|
||||
editorParams: this.editorParams,
|
||||
style: dojo.getComputedStyle(this.displayNode),
|
||||
save: dojo.hitch(this, "save"),
|
||||
cancel: dojo.hitch(this, "cancel"),
|
||||
width: this.width
|
||||
}, placeholder);
|
||||
|
||||
// to avoid screen jitter, we first create the editor with position:absolute, visibility:hidden,
|
||||
// and then when it's finished rendering, we switch from display mode to editor
|
||||
var ews = ew.domNode.style;
|
||||
this.displayNode.style.display="none";
|
||||
ews.position = "static";
|
||||
ews.visibility = "visible";
|
||||
|
||||
// Replace the display widget with edit widget, leaving them both displayed for a brief time so that
|
||||
// focus can be shifted without incident. (browser may needs some time to render the editor.)
|
||||
this.domNode = ew.domNode;
|
||||
setTimeout(function(){
|
||||
ew.focus();
|
||||
}, 100);
|
||||
},
|
||||
|
||||
_showText: function(/*Boolean*/ focus){
|
||||
// summary: revert to display mode, and optionally focus on display node
|
||||
|
||||
// display the read-only text and then quickly hide the editor (to avoid screen jitter)
|
||||
this.displayNode.style.display="";
|
||||
var ews = this.editWidget.domNode.style;
|
||||
ews.position="absolute";
|
||||
ews.visibility="hidden";
|
||||
|
||||
this.domNode = this.displayNode;
|
||||
|
||||
// give the browser some time to render the display node and then shift focus to it
|
||||
// and hide the edit widget
|
||||
var _this = this;
|
||||
setTimeout(function(){
|
||||
if(focus){
|
||||
dijit.focus(_this.displayNode);
|
||||
}
|
||||
_this.editWidget.destroy();
|
||||
delete _this.editWidget;
|
||||
}, 100);
|
||||
},
|
||||
|
||||
save: function(/*Boolean*/ focus){
|
||||
// summary
|
||||
// Save the contents of the editor and revert to display mode.
|
||||
// focus: Boolean
|
||||
// Focus on the display mode text
|
||||
this.editing = false;
|
||||
|
||||
this.value = this.editWidget.getValue() + "";
|
||||
if(this.renderAsHtml){
|
||||
this.value = this.value.replace(/&/gm, "&").replace(/</gm, "<").replace(/>/gm, ">").replace(/"/gm, """)
|
||||
.replace("\n", "<br>");
|
||||
}
|
||||
this._setDisplayValue(this.value);
|
||||
|
||||
// tell the world that we have changed
|
||||
this.onChange(this.value);
|
||||
|
||||
this._showText(focus);
|
||||
},
|
||||
|
||||
_setDisplayValue: function(/*String*/ val){
|
||||
// summary: inserts specified HTML value into this node, or an "input needed" character if node is blank
|
||||
this.displayNode.innerHTML = val || this.noValueIndicator;
|
||||
},
|
||||
|
||||
cancel: function(/*Boolean*/ focus){
|
||||
// summary:
|
||||
// Revert to display mode, discarding any changes made in the editor
|
||||
this.editing = false;
|
||||
this._showText(focus);
|
||||
}
|
||||
});
|
||||
|
||||
dojo.declare(
|
||||
"dijit._InlineEditor",
|
||||
[dijit._Widget, dijit._Templated],
|
||||
{
|
||||
// summary:
|
||||
// internal widget used by InlineEditBox, displayed when in editing mode
|
||||
// to display the editor and maybe save/cancel buttons. Calling code should
|
||||
// connect to save/cancel methods to detect when editing is finished
|
||||
//
|
||||
// Has mainly the same parameters as InlineEditBox, plus these values:
|
||||
//
|
||||
// style: Object
|
||||
// Set of CSS attributes of display node, to replicate in editor
|
||||
//
|
||||
// value: String
|
||||
// Value as an HTML string or plain text string, depending on renderAsHTML flag
|
||||
|
||||
templateString:"<fieldset dojoAttachPoint=\"editNode\" waiRole=\"presentation\" style=\"position: absolute; visibility:hidden\" class=\"dijitReset dijitInline\"\n\tdojoAttachEvent=\"onkeypress: _onKeyPress\" \n\t><input dojoAttachPoint=\"editorPlaceholder\"\n\t/><span dojoAttachPoint=\"buttonContainer\"\n\t\t><button class='saveButton' dojoAttachPoint=\"saveButton\" dojoType=\"dijit.form.Button\" dojoAttachEvent=\"onClick:save\">${buttonSave}</button\n\t\t><button class='cancelButton' dojoAttachPoint=\"cancelButton\" dojoType=\"dijit.form.Button\" dojoAttachEvent=\"onClick:cancel\">${buttonCancel}</button\n\t></span\n></fieldset>\n",
|
||||
widgetsInTemplate: true,
|
||||
|
||||
postMixInProperties: function(){
|
||||
this.inherited('postMixInProperties', arguments);
|
||||
this.messages = dojo.i18n.getLocalization("dijit", "common", this.lang);
|
||||
dojo.forEach(["buttonSave", "buttonCancel"], function(prop){
|
||||
if(!this[prop]){ this[prop] = this.messages[prop]; }
|
||||
}, this);
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
// Create edit widget in place in the template
|
||||
var cls = dojo.getObject(this.editor);
|
||||
var ew = this.editWidget = new cls(this.editorParams, this.editorPlaceholder);
|
||||
|
||||
// Copy the style from the source
|
||||
// Don't copy ALL properties though, just the necessary/applicable ones
|
||||
var srcStyle = this.style;
|
||||
dojo.forEach(["fontWeight","fontFamily","fontSize","fontStyle"], function(prop){
|
||||
ew.focusNode.style[prop]=srcStyle[prop];
|
||||
}, this);
|
||||
dojo.forEach(["marginTop","marginBottom","marginLeft", "marginRight"], function(prop){
|
||||
this.domNode.style[prop]=srcStyle[prop];
|
||||
}, this);
|
||||
if(this.width=="100%"){
|
||||
// block mode
|
||||
ew.domNode.style.width = "100%"; // because display: block doesn't work for table widgets
|
||||
this.domNode.style.display="block";
|
||||
}else{
|
||||
// inline-block mode
|
||||
ew.domNode.style.width = this.width + (Number(this.width)==this.width ? "px" : "");
|
||||
}
|
||||
|
||||
(this.editWidget.setDisplayedValue||this.editWidget.setValue).call(this.editWidget, this.value);
|
||||
this._initialText = this.getValue();
|
||||
|
||||
if(this.autoSave){
|
||||
this.buttonContainer.style.display="none";
|
||||
}
|
||||
|
||||
this.connect(this.editWidget, "onChange", "_onChange");
|
||||
},
|
||||
|
||||
destroy: function(){
|
||||
this.editWidget.destroy();
|
||||
this.inherited("destroy", arguments);
|
||||
},
|
||||
|
||||
getValue: function(){
|
||||
var ew = this.editWidget;
|
||||
return ew.getDisplayedValue ? ew.getDisplayedValue() : ew.getValue();
|
||||
},
|
||||
|
||||
_onKeyPress: function(e){
|
||||
// summary:
|
||||
// Callback when keypress in the edit box (see template).
|
||||
// For autoSave widgets, if Esc/Enter, call cancel/save.
|
||||
// For non-autoSave widgets, enable save button if the text value is
|
||||
// different than the original value.
|
||||
if(this._exitInProgress){
|
||||
return;
|
||||
}
|
||||
if(this.autoSave){
|
||||
// If Enter/Esc pressed, treat as save/cancel.
|
||||
if(e.keyCode == dojo.keys.ESCAPE){
|
||||
dojo.stopEvent(e);
|
||||
this._exitInProgress = true;
|
||||
this.cancel(true);
|
||||
}else if(e.keyCode == dojo.keys.ENTER){
|
||||
dojo.stopEvent(e);
|
||||
this._exitInProgress = true;
|
||||
this.save(true);
|
||||
}
|
||||
}else{
|
||||
var _this = this;
|
||||
// Delay before calling getValue().
|
||||
// The delay gives the browser a chance to update the Textarea.
|
||||
setTimeout(
|
||||
function(){
|
||||
_this.saveButton.setDisabled(_this.getValue() == _this._initialText);
|
||||
}, 100);
|
||||
}
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
// summary:
|
||||
// Called when focus moves outside the editor
|
||||
if(this._exitInProgress){
|
||||
// when user clicks the "save" button, focus is shifted back to display text, causing this
|
||||
// function to be called, but in that case don't do anything
|
||||
return;
|
||||
}
|
||||
if(this.autoSave){
|
||||
this._exitInProgress = true;
|
||||
if(this.getValue() == this._initialText){
|
||||
this.cancel(false);
|
||||
}else{
|
||||
this.save(false);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
enableSave: function(){
|
||||
// summary: User replacable function returning a Boolean to indicate
|
||||
// if the Save button should be enabled or not - usually due to invalid conditions
|
||||
return this.editWidget.isValid ? this.editWidget.isValid() : true;
|
||||
},
|
||||
|
||||
_onChange: function(){
|
||||
// summary:
|
||||
// This is called when the underlying widget fires an onChange event,
|
||||
// which means that the user has finished entering the value
|
||||
if(this._exitInProgress){
|
||||
// TODO: the onChange event might happen after the return key for an async widget
|
||||
// like FilteringSelect. Shouldn't be deleting the edit widget on end-of-edit
|
||||
return;
|
||||
}
|
||||
if(this.autoSave){
|
||||
this._exitInProgress = true;
|
||||
this.save(true);
|
||||
}else{
|
||||
// in case the keypress event didn't get through (old problem with Textarea that has been fixed
|
||||
// in theory) or if the keypress event comes too quickly and the value inside the Textarea hasn't
|
||||
// been updated yet)
|
||||
this.saveButton.setDisabled((this.getValue() == this._initialText) || !this.enableSave());
|
||||
}
|
||||
},
|
||||
|
||||
enableSave: function(){
|
||||
// summary: User replacable function returning a Boolean to indicate
|
||||
// if the Save button should be enabled or not - usually due to invalid conditions
|
||||
return this.editWidget.isValid ? this.editWidget.isValid() : true;
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
this.editWidget.focus();
|
||||
dijit.selectInputText(this.editWidget.focusNode);
|
||||
}
|
||||
});
|
||||
|
||||
dijit.selectInputText = function(/*DomNode*/element){
|
||||
// summary: select all the text in an input element (TODO: use functions in _editor/selection.js?)
|
||||
var _window = dojo.global;
|
||||
var _document = dojo.doc;
|
||||
element = dojo.byId(element);
|
||||
if(_document["selection"] && dojo.body()["createTextRange"]){ // IE
|
||||
if(element.createTextRange){
|
||||
var range = element.createTextRange();
|
||||
range.moveStart("character", 0);
|
||||
range.moveEnd("character", element.value.length);
|
||||
range.select();
|
||||
}
|
||||
}else if(_window["getSelection"]){
|
||||
var selection = _window.getSelection();
|
||||
// FIXME: does this work on Safari?
|
||||
if(element.setSelectionRange){
|
||||
element.setSelectionRange(0, element.value.length);
|
||||
}
|
||||
}
|
||||
element.focus();
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
195
spring-faces/src/main/java/META-INF/dijit/LICENSE
Normal file
195
spring-faces/src/main/java/META-INF/dijit/LICENSE
Normal file
@@ -0,0 +1,195 @@
|
||||
Dojo is availble under *either* the terms of the modified BSD license *or* the
|
||||
Academic Free License version 2.1. As a recipient of Dojo, you may choose which
|
||||
license to receive this code under (except as noted in per-module LICENSE
|
||||
files). Some modules may not be the copyright of the Dojo Foundation. These
|
||||
modules contain explicit declarations of copyright in both the LICENSE files in
|
||||
the directories in which they reside and in the code itself. No external
|
||||
contributions are allowed under licenses which are fundamentally incompatible
|
||||
with the AFL or BSD licenses that Dojo is distributed under.
|
||||
|
||||
The text of the AFL and BSD licenses is reproduced below.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The "New" BSD License:
|
||||
**********************
|
||||
|
||||
Copyright (c) 2005-2007, The Dojo Foundation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of the Dojo Foundation nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
The Academic Free License, v. 2.1:
|
||||
**********************************
|
||||
|
||||
This Academic Free License (the "License") applies to any original work of
|
||||
authorship (the "Original Work") whose owner (the "Licensor") has placed the
|
||||
following notice immediately following the copyright notice for the Original
|
||||
Work:
|
||||
|
||||
Licensed under the Academic Free License version 2.1
|
||||
|
||||
1) Grant of Copyright License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license to do the
|
||||
following:
|
||||
|
||||
a) to reproduce the Original Work in copies;
|
||||
|
||||
b) to prepare derivative works ("Derivative Works") based upon the Original
|
||||
Work;
|
||||
|
||||
c) to distribute copies of the Original Work and Derivative Works to the
|
||||
public;
|
||||
|
||||
d) to perform the Original Work publicly; and
|
||||
|
||||
e) to display the Original Work publicly.
|
||||
|
||||
2) Grant of Patent License. Licensor hereby grants You a world-wide,
|
||||
royalty-free, non-exclusive, perpetual, sublicenseable license, under patent
|
||||
claims owned or controlled by the Licensor that are embodied in the Original
|
||||
Work as furnished by the Licensor, to make, use, sell and offer for sale the
|
||||
Original Work and Derivative Works.
|
||||
|
||||
3) Grant of Source Code License. The term "Source Code" means the preferred
|
||||
form of the Original Work for making modifications to it and all available
|
||||
documentation describing how to modify the Original Work. Licensor hereby
|
||||
agrees to provide a machine-readable copy of the Source Code of the Original
|
||||
Work along with each copy of the Original Work that Licensor distributes.
|
||||
Licensor reserves the right to satisfy this obligation by placing a
|
||||
machine-readable copy of the Source Code in an information repository
|
||||
reasonably calculated to permit inexpensive and convenient access by You for as
|
||||
long as Licensor continues to distribute the Original Work, and by publishing
|
||||
the address of that information repository in a notice immediately following
|
||||
the copyright notice that applies to the Original Work.
|
||||
|
||||
4) Exclusions From License Grant. Neither the names of Licensor, nor the names
|
||||
of any contributors to the Original Work, nor any of their trademarks or
|
||||
service marks, may be used to endorse or promote products derived from this
|
||||
Original Work without express prior written permission of the Licensor. Nothing
|
||||
in this License shall be deemed to grant any rights to trademarks, copyrights,
|
||||
patents, trade secrets or any other intellectual property of Licensor except as
|
||||
expressly stated herein. No patent license is granted to make, use, sell or
|
||||
offer to sell embodiments of any patent claims other than the licensed claims
|
||||
defined in Section 2. No right is granted to the trademarks of Licensor even if
|
||||
such marks are included in the Original Work. Nothing in this License shall be
|
||||
interpreted to prohibit Licensor from licensing under different terms from this
|
||||
License any Original Work that Licensor otherwise would have a right to
|
||||
license.
|
||||
|
||||
5) This section intentionally omitted.
|
||||
|
||||
6) Attribution Rights. You must retain, in the Source Code of any Derivative
|
||||
Works that You create, all copyright, patent or trademark notices from the
|
||||
Source Code of the Original Work, as well as any notices of licensing and any
|
||||
descriptive text identified therein as an "Attribution Notice." You must cause
|
||||
the Source Code for any Derivative Works that You create to carry a prominent
|
||||
Attribution Notice reasonably calculated to inform recipients that You have
|
||||
modified the Original Work.
|
||||
|
||||
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that
|
||||
the copyright in and to the Original Work and the patent rights granted herein
|
||||
by Licensor are owned by the Licensor or are sublicensed to You under the terms
|
||||
of this License with the permission of the contributor(s) of those copyrights
|
||||
and patent rights. Except as expressly stated in the immediately proceeding
|
||||
sentence, the Original Work is provided under this License on an "AS IS" BASIS
|
||||
and WITHOUT WARRANTY, either express or implied, including, without limitation,
|
||||
the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU.
|
||||
This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No
|
||||
license to Original Work is granted hereunder except under this disclaimer.
|
||||
|
||||
8) Limitation of Liability. Under no circumstances and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise, shall the
|
||||
Licensor be liable to any person for any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License
|
||||
or the use of the Original Work including, without limitation, damages for loss
|
||||
of goodwill, work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses. This limitation of liability shall not
|
||||
apply to liability for death or personal injury resulting from Licensor's
|
||||
negligence to the extent applicable law prohibits such limitation. Some
|
||||
jurisdictions do not allow the exclusion or limitation of incidental or
|
||||
consequential damages, so this exclusion and limitation may not apply to You.
|
||||
|
||||
9) Acceptance and Termination. If You distribute copies of the Original Work or
|
||||
a Derivative Work, You must make a reasonable effort under the circumstances to
|
||||
obtain the express assent of recipients to the terms of this License. Nothing
|
||||
else but this License (or another written agreement between Licensor and You)
|
||||
grants You permission to create Derivative Works based upon the Original Work
|
||||
or to exercise any of the rights granted in Section 1 herein, and any attempt
|
||||
to do so except under the terms of this License (or another written agreement
|
||||
between Licensor and You) is expressly prohibited by U.S. copyright law, the
|
||||
equivalent laws of other countries, and by international treaty. Therefore, by
|
||||
exercising any of the rights granted to You in Section 1 herein, You indicate
|
||||
Your acceptance of this License and all of its terms and conditions.
|
||||
|
||||
10) Termination for Patent Action. This License shall terminate automatically
|
||||
and You may no longer exercise any of the rights granted to You by this License
|
||||
as of the date You commence an action, including a cross-claim or counterclaim,
|
||||
against Licensor or any licensee alleging that the Original Work infringes a
|
||||
patent. This termination provision shall not apply for an action alleging
|
||||
patent infringement by combinations of the Original Work with other software or
|
||||
hardware.
|
||||
|
||||
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this
|
||||
License may be brought only in the courts of a jurisdiction wherein the
|
||||
Licensor resides or in which Licensor conducts its primary business, and under
|
||||
the laws of that jurisdiction excluding its conflict-of-law provisions. The
|
||||
application of the United Nations Convention on Contracts for the International
|
||||
Sale of Goods is expressly excluded. Any use of the Original Work outside the
|
||||
scope of this License or after its termination shall be subject to the
|
||||
requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et
|
||||
seq., the equivalent laws of other countries, and international treaty. This
|
||||
section shall survive the termination of this License.
|
||||
|
||||
12) Attorneys Fees. In any action to enforce the terms of this License or
|
||||
seeking damages relating thereto, the prevailing party shall be entitled to
|
||||
recover its costs and expenses, including, without limitation, reasonable
|
||||
attorneys' fees and costs incurred in connection with such action, including
|
||||
any appeal of such action. This section shall survive the termination of this
|
||||
License.
|
||||
|
||||
13) Miscellaneous. This License represents the complete agreement concerning
|
||||
the subject matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent necessary to
|
||||
make it enforceable.
|
||||
|
||||
14) Definition of "You" in This License. "You" throughout this License, whether
|
||||
in upper or lower case, means an individual or a legal entity exercising rights
|
||||
under, and complying with all of the terms of, this License. For legal
|
||||
entities, "You" includes any entity that controls, is controlled by, or is
|
||||
under common control with you. For purposes of this definition, "control" means
|
||||
(i) the power, direct or indirect, to cause the direction or management of such
|
||||
entity, whether by contract or otherwise, or (ii) ownership of fifty percent
|
||||
(50%) or more of the outstanding shares, or (iii) beneficial ownership of such
|
||||
entity.
|
||||
|
||||
15) Right to Use. You may use the Original Work in all ways not otherwise
|
||||
restricted or conditioned by this License or by law, and Licensor promises not
|
||||
to interfere with or be responsible for such uses by You.
|
||||
|
||||
This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved.
|
||||
Permission is hereby granted to copy and distribute this license without
|
||||
modification. This license may not be modified without the express written
|
||||
permission of its copyright owner.
|
||||
@@ -8,12 +8,12 @@ dojo.require("dijit._Templated");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.Menu",
|
||||
[dijit._Widget, dijit._Templated, dijit._Container],
|
||||
[dijit._Widget, dijit._Templated, dijit._KeyNavContainer],
|
||||
{
|
||||
preamble: function() {
|
||||
constructor: function() {
|
||||
this._bindings = [];
|
||||
},
|
||||
|
||||
|
||||
templateString:
|
||||
'<table class="dijit dijitMenu dijitReset dijitMenuTable" waiRole="menu" dojoAttachEvent="onkeypress:_onKeyPress">' +
|
||||
'<tbody class="dijitReset" dojoAttachPoint="containerNode"></tbody>'+
|
||||
@@ -48,10 +48,12 @@ dojo.declare(
|
||||
}else{
|
||||
dojo.forEach(this.targetNodeIds, this.bindDomNode, this);
|
||||
}
|
||||
this.connectKeyNavHandlers([dojo.keys.UP_ARROW], [dojo.keys.DOWN_ARROW]);
|
||||
},
|
||||
|
||||
startup: function(){
|
||||
dojo.forEach(this.getChildren(), function(child){ child.startup(); });
|
||||
this.startupKeyNavChildren();
|
||||
},
|
||||
|
||||
onExecute: function(){
|
||||
@@ -62,23 +64,10 @@ dojo.declare(
|
||||
// summary: attach point for notification about when the user cancels the current menu
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
this._focusFirstItem();
|
||||
},
|
||||
|
||||
_moveToPopup: function(/*Event*/ evt){
|
||||
if(this._focusedItem && this._focusedItem.popup && !this._focusedItem.disabled){
|
||||
return this._activateCurrentItem(evt);
|
||||
if(this.focusedChild && this.focusedChild.popup && !this.focusedChild.disabled){
|
||||
this.focusedChild._onClick(evt);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
_activateCurrentItem: function(/*Event*/ evt){
|
||||
if(this._focusedItem){
|
||||
this._focusedItem._onClick(evt);
|
||||
return true; //do not pass to parent menu
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
_onKeyPress: function(/*Event*/ evt){
|
||||
@@ -86,16 +75,7 @@ dojo.declare(
|
||||
// Handle keyboard based menu navigation.
|
||||
if(evt.ctrlKey || evt.altKey){ return; }
|
||||
|
||||
var key = (evt.charCode == dojo.keys.SPACE ? dojo.keys.SPACE : evt.keyCode);
|
||||
switch(key){
|
||||
case dojo.keys.DOWN_ARROW:
|
||||
this._focusNeighborItem(1);
|
||||
dojo.stopEvent(evt);
|
||||
break;
|
||||
case dojo.keys.UP_ARROW:
|
||||
this._focusNeighborItem(-1);
|
||||
dojo.stopEvent(evt);
|
||||
break;
|
||||
switch(evt.keyCode){
|
||||
case dojo.keys.RIGHT_ARROW:
|
||||
this._moveToPopup(evt);
|
||||
dojo.stopEvent(evt);
|
||||
@@ -107,87 +87,25 @@ dojo.declare(
|
||||
dojo.stopEvent(evt);
|
||||
}
|
||||
break;
|
||||
case dojo.keys.TAB:
|
||||
dojo.stopEvent(evt);
|
||||
// Hmm, there's no good infrastructure to support cancel closing the whole tree
|
||||
// of menus, but it's close to an execute event, in the sense that focus is returned
|
||||
// to the previously focused node (for a context menu) or to the DropDownButton
|
||||
this.onExecute();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
_findValidItem: function(dir){
|
||||
// summary: find the next/previous item to focus on (depending on dir setting).
|
||||
|
||||
var curItem = this._focusedItem;
|
||||
if(curItem){
|
||||
curItem = dir>0 ? curItem.getNextSibling() : curItem.getPreviousSibling();
|
||||
}
|
||||
|
||||
var children = this.getChildren();
|
||||
for(var i=0; i < children.length; ++i){
|
||||
if(!curItem){
|
||||
curItem = children[(dir>0) ? 0 : (children.length-1)];
|
||||
}
|
||||
//find next/previous visible menu item, not including separators
|
||||
if(curItem._onHover && dojo.style(curItem.domNode, "display") != "none"){
|
||||
return curItem;
|
||||
}
|
||||
curItem = dir>0 ? curItem.getNextSibling() : curItem.getPreviousSibling();
|
||||
}
|
||||
},
|
||||
|
||||
_focusNeighborItem: function(dir){
|
||||
// summary: focus on the next / previous item (depending on dir setting)
|
||||
var item = this._findValidItem(dir);
|
||||
this._focusItem(item);
|
||||
},
|
||||
|
||||
_focusFirstItem: function(){
|
||||
// blur focused item to make findValidItem() find the first item in the menu
|
||||
if(this._focusedItem){
|
||||
this._blurFocusedItem();
|
||||
}
|
||||
var item = this._findValidItem(1);
|
||||
this._focusItem(item);
|
||||
},
|
||||
|
||||
_focusItem: function(/*MenuItem*/ item){
|
||||
// summary: internal function to focus a given menu item
|
||||
|
||||
if(!item || item==this._focusedItem){
|
||||
return;
|
||||
}
|
||||
|
||||
if(this._focusedItem){
|
||||
this._blurFocusedItem();
|
||||
}
|
||||
item._focus();
|
||||
this._focusedItem = item;
|
||||
},
|
||||
|
||||
onItemHover: function(/*MenuItem*/ item){
|
||||
this._focusItem(item);
|
||||
this.focusChild(item);
|
||||
|
||||
if(this._focusedItem.popup && !this._focusedItem.disabled && !this.hover_timer){
|
||||
if(this.focusedChild.popup && !this.focusedChild.disabled && !this.hover_timer){
|
||||
this.hover_timer = setTimeout(dojo.hitch(this, "_openPopup"), this.popupDelay);
|
||||
}
|
||||
},
|
||||
|
||||
_blurFocusedItem: function(){
|
||||
// summary: internal function to remove focus from the currently focused item
|
||||
if(this._focusedItem){
|
||||
// Close all popups that are open and descendants of this menu
|
||||
dijit.popup.closeTo(this);
|
||||
this._focusedItem._blur();
|
||||
this._stopPopupTimer();
|
||||
this._focusedItem = null;
|
||||
}
|
||||
_onChildBlur: function(item){
|
||||
// Close all popups that are open and descendants of this menu
|
||||
dijit.popup.close(item.popup);
|
||||
item._blur();
|
||||
this._stopPopupTimer();
|
||||
},
|
||||
|
||||
onItemUnhover: function(/*MenuItem*/ item){
|
||||
//this._blurFocusedItem();
|
||||
},
|
||||
|
||||
_stopPopupTimer: function(){
|
||||
@@ -256,7 +174,7 @@ dojo.declare(
|
||||
// to capture these events at the top level,
|
||||
// attach to document, not body
|
||||
var cn = (node == dojo.body() ? dojo.doc : node);
|
||||
|
||||
|
||||
node[this.id] = this._bindings.push([
|
||||
dojo.connect(cn, "oncontextmenu", this, "_openMyself"),
|
||||
dojo.connect(cn, "onkeydown", this, "_contextKey"),
|
||||
@@ -299,7 +217,7 @@ dojo.declare(
|
||||
// does a right-click or something similar
|
||||
|
||||
dojo.stopEvent(e);
|
||||
|
||||
|
||||
// Get coordinates.
|
||||
// if we are opening the menu with the mouse or on safari open
|
||||
// the menu at the mouse cursor
|
||||
@@ -322,7 +240,7 @@ dojo.declare(
|
||||
function closeAndRestoreFocus(){
|
||||
// user has clicked on a menu or popup
|
||||
dijit.focus(savedFocus);
|
||||
dijit.popup.closeAll();
|
||||
dijit.popup.close(self);
|
||||
}
|
||||
dijit.popup.open({
|
||||
popup: this,
|
||||
@@ -333,12 +251,12 @@ dojo.declare(
|
||||
orient: this.isLeftToRight() ? 'L' : 'R'
|
||||
});
|
||||
this.focus();
|
||||
|
||||
|
||||
this._onBlur = function(){
|
||||
// Usually the parent closes the child widget but if this is a context
|
||||
// menu then there is no parent
|
||||
dijit.popup.closeAll();
|
||||
// don't try to restor focus; user has clicked another part of the screen
|
||||
dijit.popup.close(this);
|
||||
// don't try to restore focus; user has clicked another part of the screen
|
||||
// and set focus there
|
||||
}
|
||||
},
|
||||
@@ -355,15 +273,16 @@ dojo.declare(
|
||||
this.parentMenu = null;
|
||||
this.isShowingNow = false;
|
||||
this.currentPopup = null;
|
||||
if(this._focusedItem){
|
||||
this._blurFocusedItem();
|
||||
if(this.focusedChild){
|
||||
this._onChildBlur(this.focusedChild);
|
||||
this.focusedChild = null;
|
||||
}
|
||||
},
|
||||
|
||||
_openPopup: function(){
|
||||
// summary: open the popup to the side of the current menu item
|
||||
this._stopPopupTimer();
|
||||
var from_item = this._focusedItem;
|
||||
var from_item = this.focusedChild;
|
||||
var popup = from_item.popup;
|
||||
|
||||
if(popup.isShowingNow){ return; }
|
||||
@@ -374,18 +293,16 @@ dojo.declare(
|
||||
popup: popup,
|
||||
around: from_item.arrowCell,
|
||||
orient: this.isLeftToRight() ? {'TR': 'TL', 'TL': 'TR'} : {'TL': 'TR', 'TR': 'TL'},
|
||||
submenu: true,
|
||||
onCancel: function(){
|
||||
// called when the child menu is canceled
|
||||
dijit.popup.close();
|
||||
self._focusedItem._focus(); // put focus back on my node
|
||||
dijit.popup.close(popup);
|
||||
from_item.focus(); // put focus back on my node
|
||||
self.currentPopup = null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
this.currentPopup = popup;
|
||||
|
||||
|
||||
if(popup.focus){
|
||||
popup.focus();
|
||||
}
|
||||
@@ -404,20 +321,16 @@ dojo.declare(
|
||||
// icon, label, and expand arrow (BiDi-dependent) indicating sub-menu
|
||||
templateString:
|
||||
'<tr class="dijitReset dijitMenuItem"'
|
||||
+'dojoAttachEvent="onmouseover:_onHover,onmouseout:_onUnhover,ondijitclick:_onClick">'
|
||||
+'<td class="dijitReset"><div class="dijitMenuItemIcon ${iconClass}"></div></td>'
|
||||
+'dojoAttachEvent="onmouseenter:_onHover,onmouseleave:_onUnhover,ondijitclick:_onClick">'
|
||||
+'<td class="dijitReset"><div class="dijitMenuItemIcon ${iconClass}" dojoAttachPoint="iconNode" ></div></td>'
|
||||
+'<td tabIndex="-1" class="dijitReset dijitMenuItemLabel" dojoAttachPoint="containerNode" waiRole="menuitem"></td>'
|
||||
+'<td class="dijitReset" dojoAttachPoint="arrowCell">'
|
||||
+'<div class="dijitMenuExpand" dojoAttachPoint="expand" style="display:none">'
|
||||
+'<span class="dijit_a11y dijitInline dijitArrowNode dijitMenuExpandInner">+</span>'
|
||||
+'<span class="dijitInline dijitArrowNode dijitMenuExpandInner">+</span>'
|
||||
+'</div>'
|
||||
+'</td>'
|
||||
+'</tr>',
|
||||
|
||||
// iconSrc: String
|
||||
// path to icon to display to the left of the menu text
|
||||
iconSrc: '',
|
||||
|
||||
// label: String
|
||||
// menu text
|
||||
label: '',
|
||||
@@ -461,7 +374,7 @@ dojo.declare(
|
||||
// User defined function to handle clicks
|
||||
},
|
||||
|
||||
_focus: function(){
|
||||
focus: function(){
|
||||
dojo.addClass(this.domNode, 'dijitMenuItemHover');
|
||||
try{
|
||||
dijit.focus(this.containerNode);
|
||||
@@ -478,7 +391,7 @@ dojo.declare(
|
||||
// summary: enable or disable this menu item
|
||||
this.disabled = value;
|
||||
dojo[value ? "addClass" : "removeClass"](this.domNode, 'dijitMenuItemDisabled');
|
||||
dijit.wai.setAttr(this.containerNode, 'waiState', 'disabled', value ? 'true' : 'false');
|
||||
dijit.setWaiState(this.containerNode, 'disabled', value ? 'true' : 'false');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -496,7 +409,7 @@ dojo.declare(
|
||||
if(this.srcNodeRef){
|
||||
var nodes = dojo.query("*", this.srcNodeRef);
|
||||
dijit.PopupMenuItem.superclass._fillContent.call(this, nodes[0]);
|
||||
|
||||
|
||||
// save pointer to srcNode so we can grab the drop down widget after it's instantiated
|
||||
this.dropDownContainer = this.srcNodeRef;
|
||||
}
|
||||
@@ -514,7 +427,7 @@ dojo.declare(
|
||||
this.popup.domNode.style.display="none";
|
||||
dojo.addClass(this.expand, "dijitMenuExpandEnabled");
|
||||
dojo.style(this.expand, "display", "");
|
||||
dijit.wai.setAttr(this.containerNode, "waiState", "haspopup", "true");
|
||||
dijit.setWaiState(this.containerNode, "haspopup", "true");
|
||||
}
|
||||
});
|
||||
|
||||
@@ -532,6 +445,12 @@ dojo.declare(
|
||||
|
||||
postCreate: function(){
|
||||
dojo.setSelectable(this.domNode, false);
|
||||
},
|
||||
|
||||
isFocusable: function(){
|
||||
// summary:
|
||||
// over ride to always return false
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -43,11 +43,9 @@ dojo.declare("dijit.ProgressBar", [dijit._Widget, dijit._Templated], {
|
||||
|
||||
// public functions
|
||||
postCreate: function(){
|
||||
dijit.ProgressBar.superclass.postCreate.apply(this, arguments);
|
||||
|
||||
this.inherited("postCreate",arguments);
|
||||
this.inteterminateHighContrastImage.setAttribute("src",
|
||||
this._indeterminateHighContrastImagePath);
|
||||
|
||||
this.update();
|
||||
},
|
||||
|
||||
@@ -60,7 +58,9 @@ dojo.declare("dijit.ProgressBar", [dijit._Widget, dijit._Templated], {
|
||||
var percent = 1, classFunc;
|
||||
if(this.indeterminate){
|
||||
classFunc = "addClass";
|
||||
dijit.wai.removeAttr(this.internalProgress, "waiState", "valuenow");
|
||||
dijit.removeWaiState(this.internalProgress, "valuenow");
|
||||
dijit.removeWaiState(this.internalProgress, "valuemin");
|
||||
dijit.removeWaiState(this.internalProgress, "valuemax");
|
||||
}else{
|
||||
classFunc = "removeClass";
|
||||
if(String(this.progress).indexOf("%") != -1){
|
||||
@@ -72,7 +72,9 @@ dojo.declare("dijit.ProgressBar", [dijit._Widget, dijit._Templated], {
|
||||
}
|
||||
var text = this.report(percent);
|
||||
this.label.firstChild.nodeValue = text;
|
||||
dijit.wai.setAttr(this.internalProgress, "waiState", "valuenow", text);
|
||||
dijit.setWaiState(this.internalProgress, "valuenow", this.progress);
|
||||
dijit.setWaiState(this.internalProgress, "valuemin", 0);
|
||||
dijit.setWaiState(this.internalProgress, "valuemax", this.maximum);
|
||||
}
|
||||
dojo[classFunc](this.domNode, "dijitProgressBarIndeterminate");
|
||||
this.internalProgress.style.width = (percent * 100) + "%";
|
||||
|
||||
@@ -13,7 +13,7 @@ dojo.declare(
|
||||
{
|
||||
// summary
|
||||
// A pane with a title on top, that can be opened or collapsed.
|
||||
|
||||
//
|
||||
// title: String
|
||||
// Title of the pane
|
||||
title: "",
|
||||
@@ -23,10 +23,14 @@ dojo.declare(
|
||||
open: true,
|
||||
|
||||
// duration: Integer
|
||||
// milliseconds to fade in/fade out
|
||||
// Time in milliseconds to fade in/fade out
|
||||
duration: 250,
|
||||
|
||||
templateString:"<div class=\"dijitTitlePane\">\n\t<div dojoAttachEvent=\"onclick:toggle,onkeypress: _onTitleKey\" tabindex=\"0\"\n\t\t\twaiRole=\"button\" class=\"dijitTitlePaneTitle\" dojoAttachPoint=\"focusNode\">\n\t\t<span dojoAttachPoint=\"arrowNode\" class=\"dijitInline dijitArrowNode\"><span dojoAttachPoint=\"arrowNodeInner\" class=\"dijit_a11y dijitArrowNodeInner\"></span></span>\n\t\t<span dojoAttachPoint=\"titleNode\" class=\"dijitInlineBox dijitTitleNode\"></span>\n\t</div>\n\t<div class=\"dijitTitlePaneContentOuter\" dojoAttachPoint=\"hideNode\">\n\t\t<div class=\"dijitReset\" dojoAttachPoint=\"wipeNode\">\n\t\t\t<div class=\"dijitTitlePaneContentInner\" dojoAttachPoint=\"containerNode\" waiRole=\"region\" tabindex=\"-1\">\n\t\t\t\t<!-- nested divs because wipeIn()/wipeOut() doesn't work right on node w/padding etc. Put padding on inner div. -->\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n",
|
||||
// baseClass: String
|
||||
// the root className to use for the various states of this widget
|
||||
baseClass: "dijitTitlePane",
|
||||
|
||||
templateString:"<div class=\"dijitTitlePane\">\n\t<div dojoAttachEvent=\"onclick:toggle,onkeypress: _onTitleKey,onfocus:_handleFocus,onblur:_handleFocus\" tabindex=\"0\"\n\t\t\twaiRole=\"button\" class=\"dijitTitlePaneTitle\" dojoAttachPoint=\"focusNode\">\n\t\t<div dojoAttachPoint=\"arrowNode\" class=\"dijitInline dijitArrowNode\"><span dojoAttachPoint=\"arrowNodeInner\" class=\"dijitArrowNodeInner\"></span></div>\n\t\t<div dojoAttachPoint=\"titleNode\" class=\"dijitTitlePaneTextNode\"></div>\n\t</div>\n\t<div class=\"dijitTitlePaneContentOuter\" dojoAttachPoint=\"hideNode\">\n\t\t<div class=\"dijitReset\" dojoAttachPoint=\"wipeNode\">\n\t\t\t<div class=\"dijitTitlePaneContentInner\" dojoAttachPoint=\"containerNode\" waiRole=\"region\" tabindex=\"-1\">\n\t\t\t\t<!-- nested divs because wipeIn()/wipeOut() doesn't work right on node w/padding etc. Put padding on inner div. -->\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</div>\n",
|
||||
|
||||
postCreate: function(){
|
||||
this.setTitle(this.title);
|
||||
@@ -35,9 +39,9 @@ dojo.declare(
|
||||
}
|
||||
this._setCss();
|
||||
dojo.setSelectable(this.titleNode, false);
|
||||
dijit.TitlePane.superclass.postCreate.apply(this, arguments);
|
||||
dijit.wai.setAttr(this.containerNode, "waiState", "titleledby", this.titleNode.id);
|
||||
dijit.wai.setAttr(this.focusNode, "waiState", "haspopup", "true");
|
||||
this.inherited("postCreate",arguments);
|
||||
dijit.setWaiState(this.containerNode, "labelledby", this.titleNode.id);
|
||||
dijit.setWaiState(this.focusNode, "haspopup", "true");
|
||||
|
||||
// setup open/close animations
|
||||
var hideNode = this.hideNode, wipeNode = this.wipeNode;
|
||||
@@ -62,18 +66,18 @@ dojo.declare(
|
||||
// Typically called when an href is loaded. Our job is to make the animation smooth
|
||||
if(this._wipeOut.status() == "playing"){
|
||||
// we are currently *closing* the pane, so just let that continue
|
||||
dijit.layout.ContentPane.prototype.setContent.apply(this, content);
|
||||
this.inherited("setContent",arguments);
|
||||
}else{
|
||||
if(this._wipeIn.status() == "playing"){
|
||||
this._wipeIn.stop();
|
||||
}
|
||||
|
||||
|
||||
// freeze container at current height so that adding new content doesn't make it jump
|
||||
dojo.marginBox(this.wipeNode, {h: dojo.marginBox(this.wipeNode).h});
|
||||
|
||||
// add the new content (erasing the old content, if any)
|
||||
dijit.layout.ContentPane.prototype.setContent.apply(this, arguments);
|
||||
|
||||
this.inherited("setContent",arguments);
|
||||
|
||||
// call _wipeIn.play() to animate from current height to new height
|
||||
this._wipeIn.play();
|
||||
}
|
||||
@@ -98,19 +102,20 @@ dojo.declare(
|
||||
},
|
||||
|
||||
_setCss: function(){
|
||||
// summary: set the open/close css state for the TitlePane
|
||||
var classes = ["dijitClosed", "dijitOpen"];
|
||||
var boolIndex = this.open;
|
||||
dojo.removeClass(this.focusNode, classes[!boolIndex+0]);
|
||||
this.focusNode.className += " " + classes[boolIndex+0];
|
||||
|
||||
// provide a character based indicator for images-off mode
|
||||
this.arrowNodeInner.innerHTML = this.open ? "-" : "+";
|
||||
this.arrowNodeInner.innerHTML = this.open ? "-" : "+";
|
||||
},
|
||||
|
||||
_onTitleKey: function(/*Event*/ e){
|
||||
// summary: callback when user hits a key
|
||||
if(e.keyCode == dojo.keys.ENTER || e.charCode == dojo.keys.SPACE){
|
||||
this._onTitleClick();
|
||||
this.toggle();
|
||||
}
|
||||
else if(e.keyCode == dojo.keys.DOWN_ARROW){
|
||||
if(this.open){
|
||||
@@ -119,6 +124,13 @@ dojo.declare(
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_handleFocus: function(/*Event*/ e){
|
||||
// summary: handle blur and focus for this widget
|
||||
|
||||
// add/removeClass is safe to call without hasClass in this case
|
||||
dojo[(e.type=="focus" ? "addClass" : "removeClass")](this.focusNode,this.baseClass+"Focused");
|
||||
},
|
||||
|
||||
setTitle: function(/*String*/ title){
|
||||
// summary: sets the text of the title
|
||||
|
||||
@@ -8,14 +8,27 @@ dojo.require("dijit._Templated");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.Toolbar",
|
||||
[dijit._Widget, dijit._Templated, dijit._Container],
|
||||
[dijit._Widget, dijit._Templated, dijit._KeyNavContainer],
|
||||
{
|
||||
templateString:
|
||||
'<div class="dijit dijitToolbar" waiRole="toolbar" tabIndex="-1" dojoAttachPoint="containerNode">' +
|
||||
'<div class="dijit dijitToolbar" waiRole="toolbar" tabIndex="${tabIndex}" dojoAttachPoint="containerNode">' +
|
||||
// '<table style="table-layout: fixed" class="dijitReset dijitToolbarTable">' + // factor out style
|
||||
// '<tr class="dijitReset" dojoAttachPoint="containerNode"></tr>'+
|
||||
// '</table>' +
|
||||
'</div>'
|
||||
'</div>',
|
||||
|
||||
tabIndex: "0",
|
||||
|
||||
postCreate: function(){
|
||||
this.connectKeyNavHandlers(
|
||||
this.isLeftToRight() ? [dojo.keys.LEFT_ARROW] : [dojo.keys.RIGHT_ARROW],
|
||||
this.isLeftToRight() ? [dojo.keys.RIGHT_ARROW] : [dojo.keys.LEFT_ARROW]
|
||||
);
|
||||
},
|
||||
|
||||
startup: function(){
|
||||
this.startupKeyNavChildren();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -27,7 +40,8 @@ dojo.declare(
|
||||
// summary
|
||||
// A line between two menu items
|
||||
templateString: '<div class="dijitToolbarSeparator dijitInline"></div>',
|
||||
postCreate: function(){ dojo.setSelectable(this.domNode, false); }
|
||||
postCreate: function(){ dojo.setSelectable(this.domNode, false); },
|
||||
isFocusable: function(){ return false; }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ dojo.declare(
|
||||
this.bgIframe = new dijit.BackgroundIframe(this.domNode);
|
||||
|
||||
// Setup fade-in and fade-out functions.
|
||||
this.fadeIn = dojo.fadeIn({ node: this.domNode, duration: this.duration, onEnd: dojo.hitch(this, "_onShow") }),
|
||||
this.fadeIn = dojo.fadeIn({ node: this.domNode, duration: this.duration, onEnd: dojo.hitch(this, "_onShow") });
|
||||
this.fadeOut = dojo.fadeOut({ node: this.domNode, duration: this.duration, onEnd: dojo.hitch(this, "_onHide") });
|
||||
|
||||
},
|
||||
@@ -37,26 +37,31 @@ dojo.declare(
|
||||
// Display tooltip w/specified contents to right specified node
|
||||
// (To left if there's no space on the right, or if LTR==right)
|
||||
|
||||
if(this.aroundNode && this.aroundNode === aroundNode){
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.fadeOut.status() == "playing"){
|
||||
// previous tooltip is being hidden; wait until the hide completes then show new one
|
||||
this._onDeck=arguments;
|
||||
return;
|
||||
}
|
||||
this.containerNode.innerHTML=innerHTML;
|
||||
|
||||
|
||||
// Firefox bug. when innerHTML changes to be shorter than previous
|
||||
// one, the node size will not be updated until it moves.
|
||||
this.domNode.style.top = (this.domNode.offsetTop + 1) + "px";
|
||||
// one, the node size will not be updated until it moves.
|
||||
this.domNode.style.top = (this.domNode.offsetTop + 1) + "px";
|
||||
|
||||
// position the element and change CSS according to position
|
||||
var align = this.isLeftToRight() ? {'BR': 'BL', 'BL': 'BR'} : {'BL': 'BR', 'BR': 'BL'};
|
||||
var pos = dijit.placeOnScreenAroundElement(this.domNode, aroundNode, align);
|
||||
this.domNode.className="dijitTooltip dijitTooltip" + (pos.corner=='BL' ? "Right" : "Left");
|
||||
|
||||
this.domNode.className="dijitTooltip dijitTooltip" + (pos.corner=='BL' ? "Right" : "Left");//FIXME: might overwrite class
|
||||
|
||||
// show it
|
||||
dojo.style(this.domNode, "opacity", 0);
|
||||
this.fadeIn.play();
|
||||
this.isShowingNow = true;
|
||||
this.aroundNode = aroundNode;
|
||||
},
|
||||
|
||||
_onShow: function(){
|
||||
@@ -66,8 +71,11 @@ dojo.declare(
|
||||
}
|
||||
},
|
||||
|
||||
hide: function(){
|
||||
hide: function(aroundNode){
|
||||
// summary: hide the tooltip
|
||||
if(!this.aroundNode || this.aroundNode !== aroundNode){
|
||||
return;
|
||||
}
|
||||
if(this._onDeck){
|
||||
// this hide request is for a show() that hasn't even started yet;
|
||||
// just cancel the pending show()
|
||||
@@ -76,6 +84,7 @@ dojo.declare(
|
||||
}
|
||||
this.fadeIn.stop();
|
||||
this.isShowingNow = false;
|
||||
this.aroundNode = null;
|
||||
this.fadeOut.play();
|
||||
},
|
||||
|
||||
@@ -91,10 +100,19 @@ dojo.declare(
|
||||
}
|
||||
);
|
||||
|
||||
// Make a single tooltip markup on the page that is reused as appropriate
|
||||
dojo.addOnLoad(function(){
|
||||
dijit.MasterTooltip = new dijit._MasterTooltip();
|
||||
});
|
||||
dijit.showTooltip = function(/*String*/ innerHTML, /*DomNode*/ aroundNode){
|
||||
// summary:
|
||||
// Display tooltip w/specified contents to right specified node
|
||||
// (To left if there's no space on the right, or if LTR==right)
|
||||
if(!dijit._masterTT){ dijit._masterTT = new dijit._MasterTooltip(); }
|
||||
return dijit._masterTT.show(innerHTML, aroundNode);
|
||||
};
|
||||
|
||||
dijit.hideTooltip = function(aroundNode){
|
||||
// summary: hide the tooltip
|
||||
if(!dijit._masterTT){ dijit._masterTT = new dijit._MasterTooltip(); }
|
||||
return dijit._masterTT.hide(aroundNode);
|
||||
};
|
||||
|
||||
dojo.declare(
|
||||
"dijit.Tooltip",
|
||||
@@ -113,18 +131,30 @@ dojo.declare(
|
||||
// the tooltip is displayed.
|
||||
showDelay: 400,
|
||||
|
||||
// connectId: String
|
||||
// Id of domNode to attach the tooltip to.
|
||||
// (When user hovers over specified dom node, the tooltip will appear.)
|
||||
connectId: "",
|
||||
// connectId: String[]
|
||||
// Id(s) of domNodes to attach the tooltip to.
|
||||
// When user hovers over any of the specified dom nodes, the tooltip will appear.
|
||||
connectId: [],
|
||||
|
||||
postCreate: function(){
|
||||
this.srcNodeRef.style.display="none";
|
||||
if(this.srcNodeRef){
|
||||
this.srcNodeRef.style.display = "none";
|
||||
}
|
||||
|
||||
this._connectNode = dojo.byId(this.connectId);
|
||||
|
||||
dojo.forEach(["onMouseOver", "onHover", "onMouseOut", "onUnHover"], function(event){
|
||||
this.connect(this._connectNode, event.toLowerCase(), "_"+event);
|
||||
this._connectNodes = [];
|
||||
|
||||
dojo.forEach(this.connectId, function(id) {
|
||||
var node = dojo.byId(id);
|
||||
if (node) {
|
||||
this._connectNodes.push(node);
|
||||
dojo.forEach(["onMouseOver", "onMouseOut", "onFocus", "onBlur", "onHover", "onUnHover"], function(event){
|
||||
this.connect(node, event.toLowerCase(), "_"+event);
|
||||
}, this);
|
||||
if(dojo.isIE){
|
||||
// BiDi workaround
|
||||
node.style.zoom = 1;
|
||||
}
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
||||
@@ -133,50 +163,62 @@ dojo.declare(
|
||||
},
|
||||
|
||||
_onMouseOut: function(/*Event*/ e){
|
||||
if(dojo.isDescendant(e.relatedTarget, this._connectNode)){
|
||||
if(dojo.isDescendant(e.relatedTarget, e.target)){
|
||||
// false event; just moved from target to target child; ignore.
|
||||
return;
|
||||
}
|
||||
this._onUnHover(e);
|
||||
},
|
||||
|
||||
_onFocus: function(/*Event*/ e){
|
||||
this._focus = true;
|
||||
this._onHover(e);
|
||||
},
|
||||
|
||||
_onBlur: function(/*Event*/ e){
|
||||
this._focus = false;
|
||||
this._onUnHover(e);
|
||||
},
|
||||
|
||||
_onHover: function(/*Event*/ e){
|
||||
if(this._hover){ return; }
|
||||
this._hover=true;
|
||||
// If tooltip not showing yet then set a timer to show it shortly
|
||||
if(!this.isShowingNow && !this._showTimer){
|
||||
this._showTimer = setTimeout(dojo.hitch(this, "open"), this.showDelay);
|
||||
if(!this._showTimer){
|
||||
var target = e.target;
|
||||
this._showTimer = setTimeout(dojo.hitch(this, function(){this.open(target)}), this.showDelay);
|
||||
}
|
||||
},
|
||||
|
||||
_onUnHover: function(/*Event*/ e){
|
||||
if(!this._hover){ return; }
|
||||
this._hover=false;
|
||||
|
||||
// keep a tooltip open if the associated element has focus
|
||||
if(this._focus){ return; }
|
||||
if(this._showTimer){
|
||||
clearTimeout(this._showTimer);
|
||||
delete this._showTimer;
|
||||
}else{
|
||||
this.close();
|
||||
}
|
||||
this.close();
|
||||
},
|
||||
|
||||
open: function(){
|
||||
// summary: display the tooltip; usually not called directly.
|
||||
if(this.isShowingNow){ return; }
|
||||
open: function(/*DomNode*/ target){
|
||||
// summary: display the tooltip; usually not called directly.
|
||||
target = target || this._connectNodes[0];
|
||||
if(!target){ return; }
|
||||
|
||||
if(this._showTimer){
|
||||
clearTimeout(this._showTimer);
|
||||
delete this._showTimer;
|
||||
}
|
||||
dijit.MasterTooltip.show(this.label || this.domNode.innerHTML, this._connectNode);
|
||||
this.isShowingNow = true;
|
||||
dijit.showTooltip(this.label || this.domNode.innerHTML, target);
|
||||
|
||||
this._connectNode = target;
|
||||
},
|
||||
|
||||
close: function(){
|
||||
// summary: hide the tooltip; usually not called directly.
|
||||
if(!this.isShowingNow){ return; }
|
||||
dijit.MasterTooltip.hide();
|
||||
this.isShowingNow = false;
|
||||
dijit.hideTooltip(this._connectNode);
|
||||
delete this._connectNode;
|
||||
if(this._showTimer){
|
||||
clearTimeout(this._showTimer);
|
||||
delete this._showTimer;
|
||||
}
|
||||
},
|
||||
|
||||
uninitialize: function(){
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,7 @@ dojo.declare(
|
||||
-or-
|
||||
<div dojoType="dijit._Calendar"></div>
|
||||
*/
|
||||
templateString:"<table cellspacing=\"0\" cellpadding=\"0\" class=\"dijitCalendarContainer\">\n\t<thead>\n\t\t<tr class=\"dijitReset dijitCalendarMonthContainer\" valign=\"top\">\n\t\t\t<th class='dijitReset' dojoAttachEvent=\"onclick: _onDecrementMonth\">\n\t\t\t\t<span class=\"dijitInline dijitCalendarIncrementControl dijitCalendarDecrease\"><span dojoAttachPoint=\"decreaseArrowNode\" class=\"dijitA11ySideArrow dijitCalendarIncrementControl dijitCalendarDecreaseInner\">-</span></span>\n\t\t\t</th>\n\t\t\t<th class='dijitReset' colspan=\"5\">\n\t\t\t\t<div dojoAttachPoint=\"monthLabelSpacer\" class=\"dijitCalendarMonthLabelSpacer\"></div>\n\t\t\t\t<div dojoAttachPoint=\"monthLabelNode\" class=\"dijitCalendarMonth\"></div>\n\t\t\t</th>\n\t\t\t<th class='dijitReset' dojoAttachEvent=\"onclick: _onIncrementMonth\">\n\t\t\t\t<div class=\"dijitInline dijitCalendarIncrementControl dijitCalendarIncrease\"><span dojoAttachPoint=\"increaseArrowNode\" class=\"dijitA11ySideArrow dijitCalendarIncrementControl dijitCalendarIncreaseInner\">+</span></div>\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th class=\"dijitReset dijitCalendarDayLabelTemplate\"><span class=\"dijitCalendarDayLabel\"></span></th>\n\t\t</tr>\n\t</thead>\n\t<tbody dojoAttachEvent=\"onclick: _onDayClick\" class=\"dijitReset dijitCalendarBodyContainer\">\n\t\t<tr class=\"dijitReset dijitCalendarWeekTemplate\">\n\t\t\t<td class=\"dijitReset dijitCalendarDateTemplate\"><span class=\"dijitCalendarDateLabel\"></span></td>\n\t\t</tr>\n\t</tbody>\n\t<tfoot class=\"dijitReset dijitCalendarYearContainer\">\n\t\t<tr>\n\t\t\t<td class='dijitReset' valign=\"top\" colspan=\"7\">\n\t\t\t\t<h3 class=\"dijitCalendarYearLabel\">\n\t\t\t\t\t<span dojoAttachPoint=\"previousYearLabelNode\"\n\t\t\t\t\t\tdojoAttachEvent=\"onclick: _onDecrementYear\" class=\"dijitInline dijitCalendarPreviousYear\"></span>\n\t\t\t\t\t<span dojoAttachPoint=\"currentYearLabelNode\" class=\"dijitInline dijitCalendarSelectedYear\"></span>\n\t\t\t\t\t<span dojoAttachPoint=\"nextYearLabelNode\"\n\t\t\t\t\t\tdojoAttachEvent=\"onclick: _onIncrementYear\" class=\"dijitInline dijitCalendarNextYear\"></span>\n\t\t\t\t</h3>\n\t\t\t</td>\n\t\t</tr>\n\t</tfoot>\n</table>\t\n",
|
||||
templateString:"<table cellspacing=\"0\" cellpadding=\"0\" class=\"dijitCalendarContainer\">\n\t<thead>\n\t\t<tr class=\"dijitReset dijitCalendarMonthContainer\" valign=\"top\">\n\t\t\t<th class='dijitReset' dojoAttachPoint=\"decrementMonth\">\n\t\t\t\t<span class=\"dijitInline dijitCalendarIncrementControl dijitCalendarDecrease\"><span dojoAttachPoint=\"decreaseArrowNode\" class=\"dijitA11ySideArrow dijitCalendarIncrementControl dijitCalendarDecreaseInner\">-</span></span>\n\t\t\t</th>\n\t\t\t<th class='dijitReset' colspan=\"5\">\n\t\t\t\t<div dojoAttachPoint=\"monthLabelSpacer\" class=\"dijitCalendarMonthLabelSpacer\"></div>\n\t\t\t\t<div dojoAttachPoint=\"monthLabelNode\" class=\"dijitCalendarMonth\"></div>\n\t\t\t</th>\n\t\t\t<th class='dijitReset' dojoAttachPoint=\"incrementMonth\">\n\t\t\t\t<div class=\"dijitInline dijitCalendarIncrementControl dijitCalendarIncrease\"><span dojoAttachPoint=\"increaseArrowNode\" class=\"dijitA11ySideArrow dijitCalendarIncrementControl dijitCalendarIncreaseInner\">+</span></div>\n\t\t\t</th>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<th class=\"dijitReset dijitCalendarDayLabelTemplate\"><span class=\"dijitCalendarDayLabel\"></span></th>\n\t\t</tr>\n\t</thead>\n\t<tbody dojoAttachEvent=\"onclick: _onDayClick\" class=\"dijitReset dijitCalendarBodyContainer\">\n\t\t<tr class=\"dijitReset dijitCalendarWeekTemplate\">\n\t\t\t<td class=\"dijitReset dijitCalendarDateTemplate\"><span class=\"dijitCalendarDateLabel\"></span></td>\n\t\t</tr>\n\t</tbody>\n\t<tfoot class=\"dijitReset dijitCalendarYearContainer\">\n\t\t<tr>\n\t\t\t<td class='dijitReset' valign=\"top\" colspan=\"7\">\n\t\t\t\t<h3 class=\"dijitCalendarYearLabel\">\n\t\t\t\t\t<span dojoAttachPoint=\"previousYearLabelNode\" class=\"dijitInline dijitCalendarPreviousYear\"></span>\n\t\t\t\t\t<span dojoAttachPoint=\"currentYearLabelNode\" class=\"dijitInline dijitCalendarSelectedYear\"></span>\n\t\t\t\t\t<span dojoAttachPoint=\"nextYearLabelNode\" class=\"dijitInline dijitCalendarNextYear\"></span>\n\t\t\t\t</h3>\n\t\t\t</td>\n\t\t</tr>\n\t</tfoot>\n</table>\t\n",
|
||||
|
||||
// value: Date
|
||||
// the currently selected Date
|
||||
@@ -128,6 +128,18 @@ dojo.declare(
|
||||
this._setText(this[name+"YearLabelNode"],
|
||||
dojo.date.locale.format(new Date(y++, 0), {selector:'year', locale:this.lang}));
|
||||
}, this);
|
||||
|
||||
// Set up repeating mouse behavior
|
||||
var _this = this;
|
||||
var typematic = function(nodeProp, dateProp, adj){
|
||||
dijit.typematic.addMouseListener(_this[nodeProp], _this, function(count){
|
||||
if(count >= 0){ _this._adjustDisplay(dateProp, adj); }
|
||||
}, 0.8, 500);
|
||||
};
|
||||
typematic("incrementMonth", "month", 1);
|
||||
typematic("decrementMonth", "month", -1);
|
||||
typematic("nextYearLabelNode", "year", 1);
|
||||
typematic("previousYearLabelNode", "year", -1);
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
@@ -166,35 +178,11 @@ dojo.declare(
|
||||
this.setValue(new Date());
|
||||
},
|
||||
|
||||
_adjustDate: function(/*String*/part, /*int*/amount){
|
||||
_adjustDisplay: function(/*String*/part, /*int*/amount){
|
||||
this.displayMonth = dojo.date.add(this.displayMonth, part, amount);
|
||||
this._populateGrid();
|
||||
},
|
||||
|
||||
_onIncrementMonth: function(/*Event*/evt){
|
||||
// summary: handler for increment month event
|
||||
evt.stopPropagation();
|
||||
this._adjustDate("month", 1);
|
||||
},
|
||||
|
||||
_onDecrementMonth: function(/*Event*/evt){
|
||||
// summary: handler for increment month event
|
||||
evt.stopPropagation();
|
||||
this._adjustDate("month", -1);
|
||||
},
|
||||
|
||||
_onIncrementYear: function(/*Event*/evt){
|
||||
// summary: handler for increment year event
|
||||
evt.stopPropagation();
|
||||
this._adjustDate("year", 1);
|
||||
},
|
||||
|
||||
_onDecrementYear: function(/*Event*/evt){
|
||||
// summary: handler for increment year event
|
||||
evt.stopPropagation();
|
||||
this._adjustDate("year", -1);
|
||||
},
|
||||
|
||||
_onDayClick: function(/*Event*/evt){
|
||||
var node = evt.target;
|
||||
dojo.stopEvent(evt);
|
||||
|
||||
@@ -63,10 +63,17 @@ dojo.declare("dijit._Container",
|
||||
// Process the given child widget, inserting it's dom node as
|
||||
// a child of our dom node
|
||||
|
||||
if(typeof insertIndex == "undefined"){
|
||||
if(insertIndex === undefined){
|
||||
insertIndex = "last";
|
||||
}
|
||||
dojo.place(widget.domNode, this.containerNode || this.domNode, insertIndex);
|
||||
var refNode = this.containerNode || this.domNode;
|
||||
if(insertIndex && typeof insertIndex == "number"){
|
||||
var children = dojo.query("> [widgetid]", refNode);
|
||||
if(children && children.length >= insertIndex){
|
||||
refNode = children[insertIndex-1]; insertIndex = "after";
|
||||
}
|
||||
}
|
||||
dojo.place(widget.domNode, refNode, insertIndex);
|
||||
|
||||
// If I've been started but the child widget hasn't been started,
|
||||
// start it now. Make sure to do this after widget has been
|
||||
@@ -102,15 +109,205 @@ dojo.declare("dijit._Container",
|
||||
|
||||
getChildren: function(){
|
||||
// summary:
|
||||
// returns array of children widgets
|
||||
// Returns array of children widgets
|
||||
return dojo.query("> [widgetId]", this.containerNode || this.domNode).map(dijit.byNode); // Array
|
||||
},
|
||||
|
||||
hasChildren: function(){
|
||||
// summary:
|
||||
// returns true if widget has children
|
||||
// Returns true if widget has children
|
||||
var cn = this.containerNode || this.domNode;
|
||||
return !!this._firstElement(cn); // Boolean
|
||||
},
|
||||
|
||||
_getSiblingOfChild: function(/*Widget*/ child, /*int*/ dir){
|
||||
// summary:
|
||||
// get the next or previous widget sibling of child
|
||||
// dir:
|
||||
// if 1, get the next sibling
|
||||
// if -1, get the previous sibling
|
||||
var node = child.domNode;
|
||||
var which = (dir>0 ? "nextSibling" : "previousSibling");
|
||||
do{
|
||||
node = node[which];
|
||||
}while(node && (node.nodeType != 1 || !dijit.byNode(node)));
|
||||
return node ? dijit.byNode(node) : null;
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
dojo.declare("dijit._KeyNavContainer",
|
||||
[dijit._Container],
|
||||
{
|
||||
|
||||
// summary:
|
||||
// A _Container with keyboard navigation of its children.
|
||||
// To use this mixin, call connectKeyNavHandlers() in
|
||||
// postCreate() and call startupKeyNavChildren() in startup().
|
||||
|
||||
/*=====
|
||||
// focusedChild: Widget
|
||||
// The currently focused child widget, or null if there isn't one
|
||||
focusedChild: null,
|
||||
=====*/
|
||||
|
||||
_keyNavCodes: {},
|
||||
|
||||
connectKeyNavHandlers: function(/*Array*/ prevKeyCodes, /*Array*/ nextKeyCodes){
|
||||
// summary:
|
||||
// Call in postCreate() to attach the keyboard handlers
|
||||
// to the container.
|
||||
// preKeyCodes: Array
|
||||
// Key codes for navigating to the previous child.
|
||||
// nextKeyCodes: Array
|
||||
// Key codes for navigating to the next child.
|
||||
|
||||
var keyCodes = this._keyNavCodes = {};
|
||||
var prev = dojo.hitch(this, this.focusPrev);
|
||||
var next = dojo.hitch(this, this.focusNext);
|
||||
dojo.forEach(prevKeyCodes, function(code){ keyCodes[code] = prev });
|
||||
dojo.forEach(nextKeyCodes, function(code){ keyCodes[code] = next });
|
||||
this.connect(this.domNode, "onkeypress", "_onContainerKeypress");
|
||||
if(dojo.isIE){
|
||||
this.connect(this.domNode, "onactivate", "_onContainerFocus");
|
||||
this.connect(this.domNode, "ondeactivate", "_onContainerBlur");
|
||||
}else{
|
||||
this.connect(this.domNode, "onfocus", "_onContainerFocus");
|
||||
this.connect(this.domNode, "onblur", "_onContainerBlur");
|
||||
}
|
||||
},
|
||||
|
||||
startupKeyNavChildren: function(){
|
||||
// summary:
|
||||
// Call in startup() to set child tabindexes to -1
|
||||
dojo.forEach(this.getChildren(), dojo.hitch(this, "_setTabIndexMinusOne"));
|
||||
},
|
||||
|
||||
addChild: function(/*Widget*/ widget, /*int?*/ insertIndex){
|
||||
// summary: Add a child to our _Container
|
||||
dijit._KeyNavContainer.superclass.addChild.apply(this, arguments);
|
||||
this._setTabIndexMinusOne(widget);
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
// summary: Default focus() implementation: focus the first child.
|
||||
this.focusFirstChild();
|
||||
},
|
||||
|
||||
focusFirstChild: function(){
|
||||
// summary: Focus the first focusable child in the container.
|
||||
this.focusChild(this._getFirstFocusableChild());
|
||||
},
|
||||
|
||||
focusNext: function(){
|
||||
// summary: Focus the next widget or focal node (for widgets
|
||||
// with multiple focal nodes) within this container.
|
||||
if(this.focusedChild && this.focusedChild.hasNextFocalNode
|
||||
&& this.focusedChild.hasNextFocalNode()){
|
||||
this.focusedChild.focusNext();
|
||||
return;
|
||||
}
|
||||
var child = this._getNextFocusableChild(this.focusedChild, 1);
|
||||
if(child.getFocalNodes){
|
||||
this.focusChild(child, child.getFocalNodes()[0]);
|
||||
}else{
|
||||
this.focusChild(child);
|
||||
}
|
||||
},
|
||||
|
||||
focusPrev: function(){
|
||||
// summary: Focus the previous widget or focal node (for widgets
|
||||
// with multiple focal nodes) within this container.
|
||||
if(this.focusedChild && this.focusedChild.hasPrevFocalNode
|
||||
&& this.focusedChild.hasPrevFocalNode()){
|
||||
this.focusedChild.focusPrev();
|
||||
return;
|
||||
}
|
||||
var child = this._getNextFocusableChild(this.focusedChild, -1);
|
||||
if(child.getFocalNodes){
|
||||
var nodes = child.getFocalNodes();
|
||||
this.focusChild(child, nodes[nodes.length-1]);
|
||||
}else{
|
||||
this.focusChild(child);
|
||||
}
|
||||
},
|
||||
|
||||
focusChild: function(/*Widget*/ widget, /*Node?*/ node){
|
||||
// summary: Focus widget. Optionally focus 'node' within widget.
|
||||
if(widget){
|
||||
if(this.focusedChild && widget !== this.focusedChild){
|
||||
this._onChildBlur(this.focusedChild);
|
||||
}
|
||||
this.focusedChild = widget;
|
||||
if(node && widget.focusFocalNode){
|
||||
widget.focusFocalNode(node);
|
||||
}else{
|
||||
widget.focus();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_setTabIndexMinusOne: function(/*Widget*/ widget){
|
||||
if(widget.getFocalNodes){
|
||||
dojo.forEach(widget.getFocalNodes(), function(node){
|
||||
node.setAttribute("tabIndex", -1);
|
||||
});
|
||||
}else{
|
||||
(widget.focusNode || widget.domNode).setAttribute("tabIndex", -1);
|
||||
}
|
||||
},
|
||||
|
||||
_onContainerFocus: function(evt){
|
||||
this.domNode.setAttribute("tabIndex", -1);
|
||||
if(evt.target === this.domNode){
|
||||
this.focusFirstChild();
|
||||
}else{
|
||||
var widget = dijit.getEnclosingWidget(evt.target);
|
||||
if(widget && widget.isFocusable()){
|
||||
this.focusedChild = widget;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_onContainerBlur: function(evt){
|
||||
if(this.tabIndex){
|
||||
this.domNode.setAttribute("tabIndex", this.tabIndex);
|
||||
}
|
||||
},
|
||||
|
||||
_onContainerKeypress: function(evt){
|
||||
if(evt.ctrlKey || evt.altKey){ return; }
|
||||
var func = this._keyNavCodes[evt.keyCode];
|
||||
if(func){
|
||||
func();
|
||||
dojo.stopEvent(evt);
|
||||
}
|
||||
},
|
||||
|
||||
_onChildBlur: function(/*Widget*/ widget){
|
||||
// summary:
|
||||
// Called when focus leaves a child widget to go
|
||||
// to a sibling widget.
|
||||
},
|
||||
|
||||
_getFirstFocusableChild: function(){
|
||||
return this._getNextFocusableChild(null, 1);
|
||||
},
|
||||
|
||||
_getNextFocusableChild: function(child, dir){
|
||||
if(child){
|
||||
child = this._getSiblingOfChild(child, dir);
|
||||
}
|
||||
var children = this.getChildren();
|
||||
for(var i=0; i < children.length; i++){
|
||||
if(!child){
|
||||
child = children[(dir>0) ? 0 : (children.length-1)];
|
||||
}
|
||||
if(child.isFocusable()){
|
||||
return child;
|
||||
}
|
||||
child = this._getSiblingOfChild(child, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -39,16 +39,21 @@ dojo.declare("dijit._Templated",
|
||||
// the src dom node will be placed
|
||||
containerNode: null,
|
||||
|
||||
// skipNodeCache Boolean:
|
||||
// if using a cached widget template node poses issues for a
|
||||
// particular widget class, it can set this property to ensure
|
||||
// that its template is always re-built from a string
|
||||
_skipNodeCache: false,
|
||||
|
||||
// method over-ride
|
||||
buildRendering: function(){
|
||||
// summary:
|
||||
// Construct the UI for this widget from a template.
|
||||
// description:
|
||||
// Construct the UI for this widget from a template, setting this.domNode.
|
||||
|
||||
// Lookup cached version of template, and download to cache if it
|
||||
// isn't there already. Returns either a DomNode or a string, depending on
|
||||
// whether or not the template contains ${foo} replacement parameters.
|
||||
|
||||
var cached = dijit._Templated.getCachedTemplate(this.templatePath, this.templateString);
|
||||
var cached = dijit._Templated.getCachedTemplate(this.templatePath, this.templateString, this._skipNodeCache);
|
||||
|
||||
var node;
|
||||
if(dojo.isString(cached)){
|
||||
@@ -58,6 +63,7 @@ dojo.declare("dijit._Templated",
|
||||
var tstr = dojo.string.substitute(cached, this, function(value, key){
|
||||
if(key.charAt(0) == '!'){ value = _this[key.substr(1)]; }
|
||||
if(typeof value == "undefined"){ throw new Error(className+" template:"+key); } // a debugging aide
|
||||
if(!value){ return ""; }
|
||||
|
||||
// Substitution keys beginning with ! will skip the transform step,
|
||||
// in case a user wishes to insert unescaped markup, e.g. ${!foo}
|
||||
@@ -76,25 +82,21 @@ dojo.declare("dijit._Templated",
|
||||
// recurse through the node, looking for, and attaching to, our
|
||||
// attachment points which should be defined on the template node.
|
||||
this._attachTemplateNodes(node);
|
||||
if(this.srcNodeRef){
|
||||
dojo.style(this.styleNode || node, "cssText", this.srcNodeRef.style.cssText);
|
||||
if(this.srcNodeRef.className){
|
||||
node.className += " " + this.srcNodeRef.className;
|
||||
}
|
||||
|
||||
var source = this.srcNodeRef;
|
||||
if(source && source.parentNode){
|
||||
source.parentNode.replaceChild(node, source);
|
||||
}
|
||||
|
||||
this.domNode = node;
|
||||
if(this.srcNodeRef && this.srcNodeRef.parentNode){
|
||||
this.srcNodeRef.parentNode.replaceChild(this.domNode, this.srcNodeRef);
|
||||
}
|
||||
if(this.widgetsInTemplate){
|
||||
var childWidgets = dojo.parser.parse(this.domNode);
|
||||
var childWidgets = dojo.parser.parse(node);
|
||||
this._attachTemplateNodes(childWidgets, function(n,p){
|
||||
return n[p];
|
||||
});
|
||||
}
|
||||
|
||||
this._fillContent(this.srcNodeRef);
|
||||
this._fillContent(source);
|
||||
},
|
||||
|
||||
_fillContent: function(/*DomNode*/ source){
|
||||
@@ -173,24 +175,18 @@ dojo.declare("dijit._Templated",
|
||||
}
|
||||
|
||||
// waiRole, waiState
|
||||
var name, names = ["waiRole", "waiState"];
|
||||
while(name=names.shift()){
|
||||
var wai = dijit.wai[name];
|
||||
var values = getAttrFunc(baseNode, wai.name);
|
||||
if(values){
|
||||
var role = "role";
|
||||
var val;
|
||||
values = values.split(/\s*,\s*/);
|
||||
while(val=values.shift()){
|
||||
if(val.indexOf('-') != -1){
|
||||
// this is a state-value pair
|
||||
var statePair = val.split('-');
|
||||
role = statePair[0];
|
||||
val = statePair[1];
|
||||
}
|
||||
dijit.wai.setAttr(baseNode, wai.name, role, val);
|
||||
var role = getAttrFunc(baseNode, "waiRole");
|
||||
if(role){
|
||||
dijit.setWaiRole(baseNode, role);
|
||||
}
|
||||
var values = getAttrFunc(baseNode, "waiState");
|
||||
if(values){
|
||||
dojo.forEach(values.split(/\s*,\s*/), function(stateValue){
|
||||
if(stateValue.indexOf('-') != -1){
|
||||
var pair = stateValue.split('-');
|
||||
dijit.setWaiState(baseNode, pair[0], pair[1]);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -201,7 +197,7 @@ dojo.declare("dijit._Templated",
|
||||
// key is either templatePath or templateString; object is either string or DOM tree
|
||||
dijit._Templated._templateCache = {};
|
||||
|
||||
dijit._Templated.getCachedTemplate = function(templatePath, templateString){
|
||||
dijit._Templated.getCachedTemplate = function(templatePath, templateString, alwaysUseString){
|
||||
// summary:
|
||||
// static method to get a template based on the templatePath or
|
||||
// templateString key
|
||||
@@ -228,7 +224,7 @@ dijit._Templated.getCachedTemplate = function(templatePath, templateString){
|
||||
|
||||
templateString = dojo.string.trim(templateString);
|
||||
|
||||
if(templateString.match(/\$\{([^\}]+)\}/g)){
|
||||
if(templateString.match(/\$\{([^\}]+)\}/g) || alwaysUseString){
|
||||
// there are variables in the template so all we can do is cache the string
|
||||
return (tmplts[key] = templateString); //String
|
||||
}else{
|
||||
@@ -238,9 +234,10 @@ dijit._Templated.getCachedTemplate = function(templatePath, templateString){
|
||||
};
|
||||
|
||||
dijit._Templated._sanitizeTemplateString = function(/*String*/tString){
|
||||
//summary: Strips <?xml ...?> declarations so that external SVG and XML
|
||||
//documents can be added to a document without worry. Also, if the string
|
||||
//is an HTML document, only the part inside the body tag is returned.
|
||||
// summary:
|
||||
// Strips <?xml ...?> declarations so that external SVG and XML
|
||||
// documents can be added to a document without worry. Also, if the string
|
||||
// is an HTML document, only the part inside the body tag is returned.
|
||||
if(tString){
|
||||
tString = tString.replace(/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im, "");
|
||||
var matches = tString.match(/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im);
|
||||
@@ -278,12 +275,13 @@ if(dojo.isIE){
|
||||
var tn;
|
||||
|
||||
dijit._Templated._createNodesFromText = function(/*String*/text){
|
||||
// summary
|
||||
// summary:
|
||||
// Attempts to create a set of nodes based on the structure of the passed text.
|
||||
|
||||
if(!tn){
|
||||
tn = dojo.doc.createElement("div");
|
||||
tn.style.display="none";
|
||||
dojo.body().appendChild(tn);
|
||||
}
|
||||
var tableType = "none";
|
||||
var rtext = text.replace(/^\s+/, "");
|
||||
@@ -297,7 +295,6 @@ if(dojo.isIE){
|
||||
}
|
||||
|
||||
tn.innerHTML = text;
|
||||
dojo.body().appendChild(tn);
|
||||
if(tn.normalize){
|
||||
tn.normalize();
|
||||
}
|
||||
|
||||
221
spring-faces/src/main/java/META-INF/dijit/_TimePicker.js
Normal file
221
spring-faces/src/main/java/META-INF/dijit/_TimePicker.js
Normal file
@@ -0,0 +1,221 @@
|
||||
if(!dojo._hasResource["dijit._TimePicker"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dijit._TimePicker"] = true;
|
||||
dojo.provide("dijit._TimePicker");
|
||||
|
||||
dojo.require("dijit.form._FormWidget");
|
||||
dojo.require("dojo.date.locale");
|
||||
|
||||
dojo.declare("dijit._TimePicker",
|
||||
[dijit._Widget, dijit._Templated],
|
||||
{
|
||||
// summary:
|
||||
// A graphical time picker that TimeTextBox pops up
|
||||
// It is functionally modeled after the Java applet at http://java.arcadevillage.com/applets/timepica.htm
|
||||
// See ticket #599
|
||||
|
||||
templateString:"<div id=\"widget_${id}\" class=\"dijitMenu\"\n ><div dojoAttachPoint=\"upArrow\" class=\"dijitButtonNode\"><span class=\"dijitTimePickerA11yText\">▲</span></div\n ><div dojoAttachPoint=\"timeMenu,focusNode\" dojoAttachEvent=\"onclick:_onOptionSelected,onmouseover,onmouseout\"></div\n ><div dojoAttachPoint=\"downArrow\" class=\"dijitButtonNode\"><span class=\"dijitTimePickerA11yText\">▼</span></div\n></div>\n",
|
||||
baseClass: "dijitTimePicker",
|
||||
|
||||
// clickableIncrement: String
|
||||
// ISO-8601 string representing the amount by which
|
||||
// every clickable element in the time picker increases
|
||||
// Set in non-Zulu time, without a time zone
|
||||
// Example: "T00:15:00" creates 15 minute increments
|
||||
// Must divide visibleIncrement evenly
|
||||
clickableIncrement: "T00:15:00",
|
||||
|
||||
// visibleIncrement: String
|
||||
// ISO-8601 string representing the amount by which
|
||||
// every element with a visible time in the time picker increases
|
||||
// Set in non Zulu time, without a time zone
|
||||
// Example: "T01:00:00" creates text in every 1 hour increment
|
||||
visibleIncrement: "T01:00:00",
|
||||
|
||||
// visibleRange: String
|
||||
// ISO-8601 string representing the range of this TimePicker
|
||||
// The TimePicker will only display times in this range
|
||||
// Example: "T05:00:00" displays 5 hours of options
|
||||
visibleRange: "T05:00:00",
|
||||
|
||||
// value: String
|
||||
// Date to display.
|
||||
// Defaults to current time and date.
|
||||
// Can be a Date object or an ISO-8601 string
|
||||
// If you specify the GMT time zone ("-01:00"),
|
||||
// the time will be converted to the local time in the local time zone.
|
||||
// Otherwise, the time is considered to be in the local time zone.
|
||||
// If you specify the date and isDate is true, the date is used.
|
||||
// Example: if your local time zone is GMT -05:00,
|
||||
// "T10:00:00" becomes "T10:00:00-05:00" (considered to be local time),
|
||||
// "T10:00:00-01:00" becomes "T06:00:00-05:00" (4 hour difference),
|
||||
// "T10:00:00Z" becomes "T05:00:00-05:00" (5 hour difference between Zulu and local time)
|
||||
// "yyyy-mm-ddThh:mm:ss" is the format to set the date and time
|
||||
// Example: "2007-06-01T09:00:00"
|
||||
value: new Date(),
|
||||
|
||||
_visibleIncrement:2,
|
||||
_clickableIncrement:1,
|
||||
_totalIncrements:10,
|
||||
constraints:{},
|
||||
|
||||
serialize: dojo.date.stamp.toISOString,
|
||||
|
||||
setValue:function(/*Date*/ date, /*Boolean*/ priority){
|
||||
// summary:
|
||||
// Set the value of the TimePicker
|
||||
// Redraws the TimePicker around the new date
|
||||
|
||||
//dijit._TimePicker.superclass.setValue.apply(this, arguments);
|
||||
this.value=date;
|
||||
this._showText();
|
||||
},
|
||||
|
||||
isDisabledDate: function(/*Date*/dateObject, /*String?*/locale){
|
||||
// summary:
|
||||
// May be overridden to disable certain dates in the TimePicker e.g. isDisabledDate=dojo.date.locale.isWeekend
|
||||
return false; // Boolean
|
||||
},
|
||||
|
||||
_showText:function(){
|
||||
this.timeMenu.innerHTML="";
|
||||
var fromIso = dojo.date.stamp.fromISOString;
|
||||
this._clickableIncrementDate=fromIso(this.clickableIncrement);
|
||||
this._visibleIncrementDate=fromIso(this.visibleIncrement);
|
||||
this._visibleRangeDate=fromIso(this.visibleRange);
|
||||
// get the value of the increments and the range in seconds (since 00:00:00) to find out how many divs to create
|
||||
var sinceMidnight = function(/*Date*/ date){
|
||||
return date.getHours()*60*60+date.getMinutes()*60+date.getSeconds();
|
||||
};
|
||||
|
||||
var clickableIncrementSeconds = sinceMidnight(this._clickableIncrementDate);
|
||||
var visibleIncrementSeconds = sinceMidnight(this._visibleIncrementDate);
|
||||
var visibleRangeSeconds = sinceMidnight(this._visibleRangeDate);
|
||||
|
||||
// round reference date to previous visible increment
|
||||
var time = this.value.getTime();
|
||||
this._refDate = new Date(time - time % (visibleIncrementSeconds*1000));
|
||||
|
||||
// assume clickable increment is the smallest unit
|
||||
this._clickableIncrement=1;
|
||||
// divide the visible range by the clickable increment to get the number of divs to create
|
||||
// example: 10:00:00/00:15:00 -> display 40 divs
|
||||
this._totalIncrements=visibleRangeSeconds/clickableIncrementSeconds;
|
||||
// divide the visible increments by the clickable increments to get how often to display the time inline
|
||||
// example: 01:00:00/00:15:00 -> display the time every 4 divs
|
||||
this._visibleIncrement=visibleIncrementSeconds/clickableIncrementSeconds;
|
||||
for(var i=-this._totalIncrements/2; i<=this._totalIncrements/2; i+=this._clickableIncrement){
|
||||
var div=this._createOption(i);
|
||||
this.timeMenu.appendChild(div);
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// I commented this out because it
|
||||
// causes problems for a TimeTextBox in a Dialog, or as the editor of an InlineEditBox,
|
||||
// because the timeMenu node isn't visible yet. -- Bill (Bug #????)
|
||||
// dijit.focus(this.timeMenu);
|
||||
},
|
||||
|
||||
postCreate:function(){
|
||||
// instantiate constraints
|
||||
if(this.constraints===dijit._TimePicker.prototype.constraints){
|
||||
this.constraints={};
|
||||
}
|
||||
// dojo.date.locale needs the lang in the constraints as locale
|
||||
if(!this.constraints.locale){
|
||||
this.constraints.locale=this.lang;
|
||||
}
|
||||
|
||||
// assign typematic mouse listeners to the arrow buttons
|
||||
this.connect(this.timeMenu, dojo.isIE ? "onmousewheel" : 'DOMMouseScroll', "_mouseWheeled");
|
||||
dijit.typematic.addMouseListener(this.upArrow,this,this._onArrowUp, 0.8, 500);
|
||||
dijit.typematic.addMouseListener(this.downArrow,this,this._onArrowDown, 0.8, 500);
|
||||
//dijit.typematic.addListener(this.upArrow,this.timeMenu, {keyCode:dojo.keys.UP_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_onArrowUp", 0.8, 500);
|
||||
//dijit.typematic.addListener(this.downArrow, this.timeMenu, {keyCode:dojo.keys.DOWN_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_onArrowDown", 0.8,500);
|
||||
|
||||
this.inherited("postCreate", arguments);
|
||||
this.setValue(this.value);
|
||||
},
|
||||
|
||||
_createOption:function(/*Number*/ index){
|
||||
// summary: creates a clickable time option
|
||||
var div=document.createElement("div");
|
||||
var date = (div.date = new Date(this._refDate));
|
||||
div.index=index;
|
||||
var incrementDate = this._clickableIncrementDate;
|
||||
date.setHours(date.getHours()+incrementDate.getHours()*index,
|
||||
date.getMinutes()+incrementDate.getMinutes()*index,
|
||||
date.getSeconds()+incrementDate.getSeconds()*index);
|
||||
|
||||
var innerDiv = document.createElement('div');
|
||||
dojo.addClass(div,this.baseClass+"Item");
|
||||
dojo.addClass(innerDiv,this.baseClass+"ItemInner");
|
||||
innerDiv.innerHTML=dojo.date.locale.format(date, this.constraints);
|
||||
div.appendChild(innerDiv);
|
||||
|
||||
if(index%this._visibleIncrement<1 && index%this._visibleIncrement>-1){
|
||||
dojo.addClass(div, this.baseClass+"Marker");
|
||||
}else if(index%this._clickableIncrement==0){
|
||||
dojo.addClass(div, this.baseClass+"Tick");
|
||||
}
|
||||
|
||||
if(this.isDisabledDate(date)){
|
||||
// set disabled
|
||||
dojo.addClass(div, this.baseClass+"ItemDisabled");
|
||||
}
|
||||
if(dojo.date.compare(this.value, date, this.constraints.selector)==0){
|
||||
div.selected=true;
|
||||
dojo.addClass(div, this.baseClass+"ItemSelected");
|
||||
}
|
||||
return div;
|
||||
},
|
||||
|
||||
_onOptionSelected:function(/*Object*/ tgt){
|
||||
var tdate = tgt.target.date || tgt.target.parentNode.date;
|
||||
if(!tdate||this.isDisabledDate(tdate)){return;}
|
||||
this.setValue(tdate);
|
||||
this.onValueSelected(tdate);
|
||||
},
|
||||
|
||||
onValueSelected:function(value){
|
||||
},
|
||||
|
||||
onmouseover:function(/*Event*/ e){
|
||||
var tgr = (e.target.parentNode === this.timeMenu) ? e.target : e.target.parentNode;
|
||||
this._highlighted_option=tgr;
|
||||
dojo.addClass(tgr, this.baseClass+"ItemHover");
|
||||
},
|
||||
|
||||
onmouseout:function(/*Event*/ e){
|
||||
var tgr = (e.target.parentNode === this.timeMenu) ? e.target : e.target.parentNode;
|
||||
if(this._highlighted_option===tgr){
|
||||
dojo.removeClass(tgr, this.baseClass+"ItemHover");
|
||||
}
|
||||
},
|
||||
|
||||
_mouseWheeled:function(/*Event*/e){
|
||||
// summary: handle the mouse wheel listener
|
||||
dojo.stopEvent(e);
|
||||
// we're not _measuring_ the scroll amount, just direction
|
||||
var scrollAmount = (dojo.isIE ? e.wheelDelta : -e.detail);
|
||||
this[(scrollAmount>0 ? "_onArrowUp" : "_onArrowDown")](); // yes, we're making a new dom node every time you mousewheel, or click
|
||||
},
|
||||
|
||||
_onArrowUp:function(){
|
||||
// summary: remove the bottom time and add one to the top
|
||||
var index=this.timeMenu.childNodes[0].index-1;
|
||||
var div=this._createOption(index);
|
||||
this.timeMenu.removeChild(this.timeMenu.childNodes[this.timeMenu.childNodes.length-1]);
|
||||
this.timeMenu.insertBefore(div, this.timeMenu.childNodes[0]);
|
||||
},
|
||||
|
||||
_onArrowDown:function(){
|
||||
// summary: remove the top time and add one to the bottom
|
||||
var index=this.timeMenu.childNodes[this.timeMenu.childNodes.length-1].index+1;
|
||||
var div=this._createOption(index);
|
||||
this.timeMenu.removeChild(this.timeMenu.childNodes[0]);
|
||||
this.timeMenu.appendChild(div);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
@@ -5,9 +5,9 @@ dojo.provide("dijit._Widget");
|
||||
dojo.require("dijit._base");
|
||||
|
||||
dojo.declare("dijit._Widget", null, {
|
||||
constructor: function(params, srcNodeRef){
|
||||
this.create(params, srcNodeRef);
|
||||
},
|
||||
// summary:
|
||||
// The foundation of dijit widgets.
|
||||
//
|
||||
// id: String
|
||||
// a unique, opaque ID string that can be assigned by users or by the
|
||||
// system. If the developer passes an ID which is known not to be
|
||||
@@ -24,20 +24,42 @@ dojo.declare("dijit._Widget", null, {
|
||||
// Bi-directional support, as defined by the HTML DIR attribute. Either left-to-right "ltr" or right-to-left "rtl".
|
||||
dir: "",
|
||||
|
||||
// class: String
|
||||
// HTML class attribute
|
||||
"class": "",
|
||||
|
||||
// style: String
|
||||
// HTML style attribute
|
||||
style: "",
|
||||
|
||||
// title: String
|
||||
// HTML title attribute
|
||||
title: "",
|
||||
|
||||
// srcNodeRef: DomNode
|
||||
// pointer to original dom node
|
||||
srcNodeRef: null,
|
||||
|
||||
// domNode DomNode:
|
||||
// domNode: DomNode
|
||||
// this is our visible representation of the widget! Other DOM
|
||||
// Nodes may by assigned to other properties, usually through the
|
||||
// template system's dojoAttachPonit syntax, but the domNode
|
||||
// property is the canonical "top level" node in widget UI.
|
||||
domNode: null,
|
||||
|
||||
// attributeMap: Object
|
||||
// A map of attributes and attachpoints -- typically standard HTML attributes -- to set
|
||||
// on the widget's dom, at the "domNode" attach point, by default.
|
||||
// Other node references can be specified as properties of 'this'
|
||||
attributeMap: {id:"", dir:"", lang:"", "class":"", style:"", title:""}, // TODO: add on* handlers?
|
||||
|
||||
//////////// INITIALIZATION METHODS ///////////////////////////////////////
|
||||
|
||||
create: function(params, srcNodeRef) {
|
||||
|
||||
postscript: function(params, srcNodeRef){
|
||||
this.create(params, srcNodeRef);
|
||||
},
|
||||
|
||||
create: function(params, srcNodeRef){
|
||||
// summary:
|
||||
// To understand the process by which widgets are instantiated, it
|
||||
// is critical to understand what other methods create calls and
|
||||
@@ -72,14 +94,14 @@ dojo.declare("dijit._Widget", null, {
|
||||
// _attaches: String[]
|
||||
// names of all our dojoAttachPoint variables
|
||||
this._attaches=[];
|
||||
|
||||
|
||||
//mixin our passed parameters
|
||||
if(this.srcNodeRef && (typeof this.srcNodeRef.id == "string")){ this.id = this.srcNodeRef.id; }
|
||||
if(params){
|
||||
dojo.mixin(this,params);
|
||||
}
|
||||
this.postMixInProperties();
|
||||
|
||||
|
||||
// generate an id for the widget if one wasn't specified
|
||||
// (be sure to do this before buildRendering() because that function might
|
||||
// expect the id to be there.
|
||||
@@ -89,18 +111,44 @@ dojo.declare("dijit._Widget", null, {
|
||||
dijit.registry.add(this);
|
||||
|
||||
this.buildRendering();
|
||||
|
||||
// Copy attributes listed in attributeMap into the [newly created] DOM for the widget.
|
||||
// The placement of these attributes is according to the property mapping in attributeMap.
|
||||
// Note special handling for 'style' and 'class' attributes which are lists and can
|
||||
// have elements from both old and new structures, and some attributes like "type"
|
||||
// cannot be processed this way as they are not mutable.
|
||||
if(this.domNode){
|
||||
for(var attr in this.attributeMap){
|
||||
var mapNode = this[this.attributeMap[attr] || "domNode"];
|
||||
var value = this[attr];
|
||||
if(typeof value != "object" && (value !== "" || (params && params[attr]))){
|
||||
switch(attr){
|
||||
case "class":
|
||||
dojo.addClass(mapNode, value);
|
||||
break;
|
||||
case "style":
|
||||
if(mapNode.style.cssText){
|
||||
mapNode.style.cssText += "; " + value;// FIXME: Opera
|
||||
}else{
|
||||
mapNode.style.cssText = value;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
mapNode.setAttribute(attr, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.domNode){
|
||||
this.domNode.setAttribute("widgetId", this.id);
|
||||
if(this.srcNodeRef && this.srcNodeRef.dir){
|
||||
this.domNode.dir = this.srcNodeRef.dir;
|
||||
}
|
||||
}
|
||||
this.postCreate();
|
||||
|
||||
// If srcNodeRef has been processed and removed from the DOM (e.g. TemplatedWidget) then delete it to allow GC.
|
||||
if(this.srcNodeRef && !this.srcNodeRef.parentNode){
|
||||
delete this.srcNodeRef;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
@@ -114,7 +162,7 @@ dojo.declare("dijit._Widget", null, {
|
||||
// summary:
|
||||
// Construct the UI for this widget, setting this.domNode.
|
||||
// Most widgets will mixin TemplatedWidget, which overrides this method.
|
||||
this.domNode = this.srcNodeRef;
|
||||
this.domNode = this.srcNodeRef || dojo.doc.createElement('div');
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
@@ -237,7 +285,7 @@ dojo.declare("dijit._Widget", null, {
|
||||
handles.push(dojo.connect(obj, "onkeydown", this,
|
||||
function(e){
|
||||
if(e.keyCode == dojo.keys.ENTER){
|
||||
return (dojo.isString(method))?
|
||||
return (dojo.isString(method))?
|
||||
w[method](e) : method.call(w, e);
|
||||
}else if(e.keyCode == dojo.keys.SPACE){
|
||||
// stop space down as it causes IE to scroll
|
||||
@@ -248,7 +296,7 @@ dojo.declare("dijit._Widget", null, {
|
||||
handles.push(dojo.connect(obj, "onkeyup", this,
|
||||
function(e){
|
||||
if(e.keyCode == dojo.keys.SPACE){
|
||||
return dojo.isString(method) ?
|
||||
return dojo.isString(method) ?
|
||||
w[method](e) : method.call(w, e);
|
||||
}
|
||||
}));
|
||||
@@ -285,9 +333,16 @@ dojo.declare("dijit._Widget", null, {
|
||||
// See HTML spec, DIR attribute for more information.
|
||||
|
||||
if(typeof this._ltr == "undefined"){
|
||||
this._ltr = (this.dir || dojo.getComputedStyle(this.domNode).direction) != "rtl";
|
||||
this._ltr = dojo.getComputedStyle(this.domNode).direction != "rtl";
|
||||
}
|
||||
return this._ltr; //Boolean
|
||||
},
|
||||
|
||||
isFocusable: function(){
|
||||
// summary:
|
||||
// Return true if this widget can currently be focused
|
||||
// and false if not
|
||||
return this.focus && (dojo.style(this.domNode, "display") != "none");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ dojo.mixin(dijit,
|
||||
// _curFocus: DomNode
|
||||
// Currently focused item on screen
|
||||
_curFocus: null,
|
||||
|
||||
|
||||
// _prevFocus: DomNode
|
||||
// Previously focused item on screen
|
||||
_prevFocus: null,
|
||||
@@ -108,13 +108,13 @@ dojo.mixin(dijit,
|
||||
return {
|
||||
// Node to return focus to
|
||||
node: menu && dojo.isDescendant(dijit._curFocus, menu.domNode) ? dijit._prevFocus : dijit._curFocus,
|
||||
|
||||
|
||||
// Previously selected text
|
||||
bookmark:
|
||||
bookmark:
|
||||
!dojo.withGlobal(openedForWindow||dojo.global, dijit.isCollapsed) ?
|
||||
dojo.withGlobal(openedForWindow||dojo.global, dijit.getBookmark) :
|
||||
null,
|
||||
|
||||
|
||||
openedForWindow: openedForWindow
|
||||
}; // Object
|
||||
},
|
||||
@@ -176,9 +176,8 @@ dojo.mixin(dijit,
|
||||
}
|
||||
|
||||
dojo.connect(targetWindow.document, "onmousedown", null, function(evt){
|
||||
// this mouse down event will probably be immediately followed by a blur event; ignore it
|
||||
dijit._ignoreNextBlurEvent = true;
|
||||
setTimeout(function(){ dijit._ignoreNextBlurEvent = false; }, 0);
|
||||
dijit._justMouseDowned = true;
|
||||
setTimeout(function(){ dijit._justMouseDowned = false; }, 0);
|
||||
dijit._onTouchNode(evt.target||evt.srcElement);
|
||||
});
|
||||
//dojo.connect(targetWindow, "onscroll", ???);
|
||||
@@ -192,31 +191,41 @@ dojo.mixin(dijit,
|
||||
dijit._onFocusNode(evt.srcElement);
|
||||
}
|
||||
});
|
||||
body.attachEvent('ondeactivate', function(evt){ dijit._onBlurNode(); });
|
||||
body.attachEvent('ondeactivate', function(evt){ dijit._onBlurNode(evt.srcElement); });
|
||||
}else{
|
||||
body.addEventListener('focus', function(evt){ dijit._onFocusNode(evt.target); }, true);
|
||||
body.addEventListener('blur', function(evt){ dijit._onBlurNode(); }, true);
|
||||
body.addEventListener('blur', function(evt){ dijit._onBlurNode(evt.target); }, true);
|
||||
}
|
||||
}
|
||||
body = null; // prevent memory leak (apparent circular reference via closure)
|
||||
},
|
||||
|
||||
_onBlurNode: function(){
|
||||
|
||||
_onBlurNode: function(/*DomNode*/ node){
|
||||
// summary:
|
||||
// Called when focus leaves a node.
|
||||
// Usually ignored, _unless_ it *isn't* follwed by touching another node,
|
||||
// which indicates that we tabbed off the last field on the page,
|
||||
// in which case everything is blurred
|
||||
if(dijit._ignoreNextBlurEvent){
|
||||
dijit._ignoreNextBlurEvent = false;
|
||||
return;
|
||||
}
|
||||
// in which case every widget is marked inactive
|
||||
dijit._prevFocus = dijit._curFocus;
|
||||
dijit._curFocus = null;
|
||||
if(dijit._blurAllTimer){
|
||||
clearTimeout(dijit._blurAllTimer);
|
||||
|
||||
var w = dijit.getEnclosingWidget(node);
|
||||
if (w && w._setStateClass){
|
||||
w._focused = false;
|
||||
w._setStateClass();
|
||||
}
|
||||
dijit._blurAllTimer = setTimeout(function(){
|
||||
delete dijit._blurAllTimer; dijit._setStack([]); }, 100);
|
||||
if(dijit._justMouseDowned){
|
||||
// the mouse down caused a new widget to be marked as active; this blur event
|
||||
// is coming late, so ignore it.
|
||||
return;
|
||||
}
|
||||
|
||||
// if the blur event isn't followed by a focus event then mark all widgets as inactive.
|
||||
if(dijit._clearActiveWidgetsTimer){
|
||||
clearTimeout(dijit._clearActiveWidgetsTimer);
|
||||
}
|
||||
dijit._clearActiveWidgetsTimer = setTimeout(function(){
|
||||
delete dijit._clearActiveWidgetsTimer; dijit._setStack([]); }, 100);
|
||||
},
|
||||
|
||||
_onTouchNode: function(/*DomNode*/ node){
|
||||
@@ -224,9 +233,9 @@ dojo.mixin(dijit,
|
||||
// Callback when node is focused or mouse-downed
|
||||
|
||||
// ignore the recent blurNode event
|
||||
if(dijit._blurAllTimer){
|
||||
clearTimeout(dijit._blurAllTimer);
|
||||
delete dijit._blurAllTimer;
|
||||
if(dijit._clearActiveWidgetsTimer){
|
||||
clearTimeout(dijit._clearActiveWidgetsTimer);
|
||||
delete dijit._clearActiveWidgetsTimer;
|
||||
}
|
||||
|
||||
// compute stack of active widgets (ex: ComboButton --> Menu --> MenuItem)
|
||||
@@ -270,16 +279,10 @@ dojo.mixin(dijit,
|
||||
dojo.publish("focusNode", [node]);
|
||||
|
||||
// handle focus/blur styling
|
||||
var w = dijit.byId(node.id);
|
||||
var w = dijit.getEnclosingWidget(node);
|
||||
if (w && w._setStateClass){
|
||||
w._focused = true;
|
||||
w._setStateClass();
|
||||
// watch for a blur on the node that received focus
|
||||
var blurConnector = dojo.connect(node, "onblur", function(){
|
||||
w._focused = false;
|
||||
w._setStateClass();
|
||||
dojo.disconnect(blurConnector);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -8,11 +8,14 @@ dojo.declare("dijit.WidgetSet", null, {
|
||||
// A set of widgets indexed by id
|
||||
this._hash={};
|
||||
},
|
||||
|
||||
|
||||
add: function(/*Widget*/ widget){
|
||||
if(this._hash[widget.id]){
|
||||
throw new Error("Tried to register widget with id==" + widget.id + " but that id is already registered");
|
||||
}
|
||||
this._hash[widget.id]=widget;
|
||||
},
|
||||
|
||||
|
||||
remove: function(/*String*/ id){
|
||||
delete this._hash[id];
|
||||
},
|
||||
@@ -22,7 +25,7 @@ dojo.declare("dijit.WidgetSet", null, {
|
||||
func(this._hash[id]);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
filter: function(/*Function*/ filter){
|
||||
var res = new dijit.WidgetSet();
|
||||
this.forEach(function(widget){
|
||||
@@ -30,7 +33,7 @@ dojo.declare("dijit.WidgetSet", null, {
|
||||
});
|
||||
return res; // dijit.WidgetSet
|
||||
},
|
||||
|
||||
|
||||
byId: function(/*String*/ id){
|
||||
return this._hash[id];
|
||||
},
|
||||
@@ -79,4 +82,17 @@ dijit.byNode = function(/* DOMNode */ node){
|
||||
return dijit.registry.byId(node.getAttribute("widgetId")); // Widget
|
||||
};
|
||||
|
||||
dijit.getEnclosingWidget = function(/* DOMNode */ node){
|
||||
// summary:
|
||||
// Returns the widget whose dom tree contains node or null if
|
||||
// the node is not contained within the dom tree of any widget
|
||||
while(node){
|
||||
if(node.getAttribute && node.getAttribute("widgetId")){
|
||||
return dijit.registry.byId(node.getAttribute("widgetId"));
|
||||
}
|
||||
node = node.parentNode;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,27 @@ dijit.getViewport = function(){
|
||||
var w = 0, h = 0;
|
||||
if(dojo.isMozilla){
|
||||
// mozilla
|
||||
w = _document.documentElement.clientWidth;
|
||||
h = _window.innerHeight;
|
||||
// _window.innerHeight includes the height taken by the scroll bar
|
||||
// clientHeight is ideal but has DTD issues:
|
||||
// #4539: FF reverses the roles of body.clientHeight/Width and documentElement.clientHeight/Width based on the DTD!
|
||||
// check DTD to see whether body or documentElement returns the viewport dimensions using this algorithm:
|
||||
var minw, minh, maxw, maxh;
|
||||
if(_document.body.clientWidth>_document.documentElement.clientWidth){
|
||||
minw = _document.documentElement.clientWidth;
|
||||
maxw = _document.body.clientWidth;
|
||||
}else{
|
||||
maxw = _document.documentElement.clientWidth;
|
||||
minw = _document.body.clientWidth;
|
||||
}
|
||||
if(_document.body.clientHeight>_document.documentElement.clientHeight){
|
||||
minh = _document.documentElement.clientHeight;
|
||||
maxh = _document.body.clientHeight;
|
||||
}else{
|
||||
maxh = _document.documentElement.clientHeight;
|
||||
minh = _document.body.clientHeight;
|
||||
}
|
||||
w = (maxw > _window.innerWidth) ? minw : maxw;
|
||||
h = (maxh > _window.innerHeight) ? minh : maxh;
|
||||
}else if(!dojo.isOpera && _window.innerWidth){
|
||||
//in opera9, dojo.body().clientWidth should be used, instead
|
||||
//of window.innerWidth/document.documentElement.clientWidth
|
||||
@@ -31,7 +50,7 @@ dijit.getViewport = function(){
|
||||
w = dojo.body().clientWidth;
|
||||
h = dojo.body().clientHeight;
|
||||
}
|
||||
|
||||
|
||||
// get scroll position
|
||||
var scroll = dojo._docScroll();
|
||||
|
||||
@@ -39,7 +58,7 @@ dijit.getViewport = function(){
|
||||
};
|
||||
|
||||
dijit.placeOnScreen = function(
|
||||
/* HTMLElement */ node,
|
||||
/* DomNode */ node,
|
||||
/* Object */ pos,
|
||||
/* Object */ corners,
|
||||
/* boolean? */ tryOnly){
|
||||
@@ -58,13 +77,13 @@ dijit.placeOnScreen = function(
|
||||
// all of the specified corners, and choose the most appropriate one.
|
||||
//
|
||||
// NOTE: node is assumed to be absolutely or relatively positioned.
|
||||
|
||||
|
||||
var choices = dojo.map(corners, function(corner){ return { corner: corner, pos: pos }; });
|
||||
|
||||
|
||||
return dijit._place(node, choices);
|
||||
}
|
||||
|
||||
dijit._place = function(/*HtmlElement*/ node, /* Array */ choices, /* Function */ layoutNode){
|
||||
dijit._place = function(/*DomNode*/ node, /* Array */ choices, /* Function */ layoutNode){
|
||||
// summary:
|
||||
// Given a list of spots to put node, put it at the first spot where it fits,
|
||||
// of if it doesn't fit anywhere then the place with the least overflow
|
||||
@@ -74,7 +93,7 @@ dijit._place = function(/*HtmlElement*/ node, /* Array */ choices, /* Function *
|
||||
// layoutNode: Function(node, orient)
|
||||
// for things like tooltip, they are displayed differently (and have different dimensions)
|
||||
// based on their orientation relative to the parent. This adjusts the popup based on orientation.
|
||||
|
||||
|
||||
// get {x: 10, y: 10, w: 100, h:100} type obj representing position of
|
||||
// viewport over document
|
||||
var view = dijit.getViewport();
|
||||
@@ -116,7 +135,7 @@ dijit._place = function(/*HtmlElement*/ node, /* Array */ choices, /* Function *
|
||||
width = endX-startX,
|
||||
height = endY-startY,
|
||||
overflow = (mb.w-width) + (mb.h-height);
|
||||
|
||||
|
||||
if(best==null || overflow<best.overflow){
|
||||
best = {
|
||||
corner: corner,
|
||||
@@ -139,8 +158,8 @@ dijit._place = function(/*HtmlElement*/ node, /* Array */ choices, /* Function *
|
||||
}
|
||||
|
||||
dijit.placeOnScreenAroundElement = function(
|
||||
/* HTMLElement */ node,
|
||||
/* HTMLElement */ aroundNode,
|
||||
/* DomNode */ node,
|
||||
/* DomNode */ aroundNode,
|
||||
/* Object */ aroundCorners,
|
||||
/* Function */ layoutNode){
|
||||
|
||||
@@ -158,7 +177,7 @@ dijit.placeOnScreenAroundElement = function(
|
||||
// for things like tooltip, they are displayed differently (and have different dimensions)
|
||||
// based on their orientation relative to the parent. This adjusts the popup based on orientation.
|
||||
|
||||
|
||||
|
||||
// get coordinates of aroundNode
|
||||
aroundNode = dojo.byId(aroundNode);
|
||||
var oldDisplay = aroundNode.style.display;
|
||||
@@ -181,7 +200,7 @@ dijit.placeOnScreenAroundElement = function(
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return dijit._place(node, choices, layoutNode);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,14 +29,12 @@ dijit.popup = new function(){
|
||||
// orient: Object
|
||||
// structure specifying possible positions of popup relative to "around" node
|
||||
// onCancel: Function
|
||||
// callback when user has canceled the popup by
|
||||
// 1. hitting ESC or
|
||||
// callback when user has canceled the popup by
|
||||
// 1. hitting ESC or
|
||||
// 2. by using the popup widget's proprietary cancel mechanism (like a cancel button in a dialog);
|
||||
// ie: whenever popupWidget.onCancel() is called, args.onCancel is called
|
||||
// onClose: Function
|
||||
// callback whenever this popup is closed (via close(), closeAll(), or closeTo())
|
||||
// submenu: Boolean
|
||||
// Is this a submenu off of the existing popup?
|
||||
// callback whenever this popup is closed
|
||||
// onExecute: Function
|
||||
// callback when user "executed" on the popup/sub-popup by selecting a menu choice, etc. (top menu only)
|
||||
//
|
||||
@@ -54,10 +52,6 @@ dijit.popup = new function(){
|
||||
around = args.around,
|
||||
id = (args.around && args.around.id) ? (args.around.id+"_dropdown") : ("popup_"+idGen++);
|
||||
|
||||
if(!args.submenu){
|
||||
this.closeAll();
|
||||
}
|
||||
|
||||
// make wrapper div to hold widget and possibly hold iframe behind it.
|
||||
// we can't attach the iframe as a child of the widget.domNode because
|
||||
// widget.domNode might be a <table>, <ul>, etc.
|
||||
@@ -65,6 +59,7 @@ dijit.popup = new function(){
|
||||
wrapper.id = id;
|
||||
wrapper.className="dijitPopup";
|
||||
wrapper.style.zIndex = beginZIndex + stack.length;
|
||||
wrapper.style.visibility = "hidden";
|
||||
if(args.parent){
|
||||
wrapper.dijitPopupParent=args.parent.id;
|
||||
}
|
||||
@@ -80,14 +75,29 @@ dijit.popup = new function(){
|
||||
dijit.placeOnScreenAroundElement(wrapper, around, orient, widget.orient ? dojo.hitch(widget, "orient") : null) :
|
||||
dijit.placeOnScreen(wrapper, args, orient == 'R' ? ['TR','BR','TL','BL'] : ['TL','BL','TR','BR']);
|
||||
|
||||
wrapper.style.visibility = "visible";
|
||||
// TODO: use effects to fade in wrapper
|
||||
|
||||
var handlers = [];
|
||||
|
||||
// provide default escape key handling
|
||||
// Compute the closest ancestor popup that's *not* a child of another popup.
|
||||
// Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button.
|
||||
function getTopPopup(){
|
||||
for(var pi=stack.length-1; pi > 0 && stack[pi].parent === stack[pi-1].widget; pi--);
|
||||
return stack[pi];
|
||||
}
|
||||
|
||||
// provide default escape and tab key handling
|
||||
// (this will work for any widget, not just menu)
|
||||
handlers.push(dojo.connect(wrapper, "onkeypress", this, function(evt){
|
||||
if (evt.keyCode == dojo.keys.ESCAPE){
|
||||
if(evt.keyCode == dojo.keys.ESCAPE && args.onCancel){
|
||||
args.onCancel();
|
||||
}else if(evt.keyCode == dojo.keys.TAB){
|
||||
dojo.stopEvent(evt);
|
||||
var topPopup = getTopPopup();
|
||||
if(topPopup && topPopup.onCancel){
|
||||
topPopup.onCancel();
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -96,10 +106,11 @@ dijit.popup = new function(){
|
||||
if(widget.onCancel){
|
||||
handlers.push(dojo.connect(widget, "onCancel", null, args.onCancel));
|
||||
}
|
||||
|
||||
|
||||
handlers.push(dojo.connect(widget, widget.onExecute ? "onExecute" : "onChange", null, function(){
|
||||
if(stack[0] && stack[0].onExecute){
|
||||
stack[0].onExecute();
|
||||
var topPopup = getTopPopup();
|
||||
if(topPopup && topPopup.onExecute){
|
||||
topPopup.onExecute();
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -107,6 +118,7 @@ dijit.popup = new function(){
|
||||
wrapper: wrapper,
|
||||
iframe: iframe,
|
||||
widget: widget,
|
||||
parent: args.parent,
|
||||
onExecute: args.onExecute,
|
||||
onCancel: args.onCancel,
|
||||
onClose: args.onClose,
|
||||
@@ -120,54 +132,33 @@ dijit.popup = new function(){
|
||||
return best;
|
||||
};
|
||||
|
||||
this.close = function(){
|
||||
this.close = function(/*Widget*/ popup){
|
||||
// summary:
|
||||
// Close popup on the top of the stack (the highest z-index popup)
|
||||
|
||||
// this needs to happen before the stack is popped, because menu's
|
||||
// onClose calls closeTo(this)
|
||||
var widget = stack[stack.length-1].widget;
|
||||
if(widget.onClose){
|
||||
widget.onClose();
|
||||
}
|
||||
|
||||
if(!stack.length){
|
||||
return;
|
||||
}
|
||||
var top = stack.pop();
|
||||
var wrapper = top.wrapper,
|
||||
iframe = top.iframe,
|
||||
widget = top.widget,
|
||||
onClose = top.onClose;
|
||||
|
||||
dojo.forEach(top.handlers, dojo.disconnect);
|
||||
|
||||
// #2685: check if the widget still has a domNode so ContentPane can change its URL without getting an error
|
||||
if(!widget||!widget.domNode){ return; }
|
||||
dojo.style(widget.domNode, "display", "none");
|
||||
dojo.body().appendChild(widget.domNode);
|
||||
iframe.destroy();
|
||||
dojo._destroyElement(wrapper);
|
||||
|
||||
if(onClose){
|
||||
onClose();
|
||||
// Close specified popup and any popups that it parented
|
||||
while(dojo.some(stack, function(elem){return elem.widget == popup;})){
|
||||
var top = stack.pop(),
|
||||
wrapper = top.wrapper,
|
||||
iframe = top.iframe,
|
||||
widget = top.widget,
|
||||
onClose = top.onClose;
|
||||
|
||||
if(widget.onClose){
|
||||
widget.onClose();
|
||||
}
|
||||
dojo.forEach(top.handlers, dojo.disconnect);
|
||||
|
||||
// #2685: check if the widget still has a domNode so ContentPane can change its URL without getting an error
|
||||
if(!widget||!widget.domNode){ return; }
|
||||
dojo.style(widget.domNode, "display", "none");
|
||||
dojo.body().appendChild(widget.domNode);
|
||||
iframe.destroy();
|
||||
dojo._destroyElement(wrapper);
|
||||
|
||||
if(onClose){
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.closeAll = function(){
|
||||
// summary: close every popup, from top of stack down to the first one
|
||||
while(stack.length){
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
|
||||
this.closeTo = function(/*Widget*/ widget){
|
||||
// summary: closes every popup above specified widget
|
||||
while(stack.length && stack[stack.length-1].widget.id != widget.id){
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
|
||||
}();
|
||||
|
||||
dijit._frames = new function(){
|
||||
@@ -195,7 +186,7 @@ dijit._frames = new function(){
|
||||
}
|
||||
return iframe;
|
||||
};
|
||||
|
||||
|
||||
this.push = function(iframe){
|
||||
iframe.style.display="";
|
||||
if(dojo.isIE){
|
||||
@@ -215,7 +206,7 @@ if(dojo.isIE && dojo.isIE < 7){
|
||||
}
|
||||
|
||||
|
||||
dijit.BackgroundIframe = function(/* HTMLElement */node){
|
||||
dijit.BackgroundIframe = function(/* DomNode */node){
|
||||
// summary:
|
||||
// For IE z-index schenanigans. id attribute is required.
|
||||
//
|
||||
|
||||
@@ -2,7 +2,7 @@ if(!dojo._hasResource["dijit._base.scroll"]){ //_hasResource checks added by bui
|
||||
dojo._hasResource["dijit._base.scroll"] = true;
|
||||
dojo.provide("dijit._base.scroll");
|
||||
|
||||
dijit.scrollIntoView = function(/* HTMLElement */node){
|
||||
dijit.scrollIntoView = function(/* DomNode */node){
|
||||
// summary
|
||||
// Scroll the passed node into view, if it is not.
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@ dojo.provide("dijit._base.typematic");
|
||||
|
||||
dijit.typematic = {
|
||||
// summary:
|
||||
// These functions are used to repetitively call a user specified callback
|
||||
// method when a specific key or mouse click over a specific DOM node is
|
||||
// held down for a specific amount of time.
|
||||
// Only 1 such event is allowed to occur on the browser page at 1 time.
|
||||
// These functions are used to repetitively call a user specified callback
|
||||
// method when a specific key or mouse click over a specific DOM node is
|
||||
// held down for a specific amount of time.
|
||||
// Only 1 such event is allowed to occur on the browser page at 1 time.
|
||||
|
||||
_fireEventAndReload: function(){
|
||||
this._timer = null;
|
||||
@@ -19,19 +19,25 @@ dijit.typematic = {
|
||||
trigger: function(/*Event*/ evt, /* Object */ _this, /*DOMNode*/ node, /* Function */ callback, /* Object */ obj, /* Number */ subsequentDelay, /* Number */ initialDelay){
|
||||
// summary:
|
||||
// Start a timed, repeating callback sequence.
|
||||
// If already started, the function call is ignored.
|
||||
// This method is not normally called by the user but can be
|
||||
// when the normal listener code is insufficient.
|
||||
// If already started, the function call is ignored.
|
||||
// This method is not normally called by the user but can be
|
||||
// when the normal listener code is insufficient.
|
||||
// Parameters:
|
||||
// evt: key or mouse event object to pass to the user callback
|
||||
// _this: pointer to the user's widget space.
|
||||
// callback: function name to call until the sequence is stopped.
|
||||
// obj: any user space object to pass to the callback.
|
||||
// node: the DOM node object to pass the the callback function
|
||||
// callback: function to call until the sequence is stopped called with 3 parameters:
|
||||
// count: integer representing number of repeated calls (0..n) with -1 indicating the iteration has stopped
|
||||
// node: the DOM node object passed in
|
||||
// evt: key or mouse event object
|
||||
// obj: user space object used to uniquely identify each typematic sequence
|
||||
// subsequentDelay: if > 1, the number of milliseconds until the 3->n events occur
|
||||
// or else the fractional time multiplier for the next event.
|
||||
// initialDelay: the number of milliseconds until the 2nd event occurs.
|
||||
if (obj != this._obj){
|
||||
// or else the fractional time multiplier for the next event's delay, default=0.9
|
||||
// initialDelay: the number of milliseconds until the 2nd event occurs, default=500ms
|
||||
if(obj != this._obj){
|
||||
this.stop();
|
||||
this._initialDelay = initialDelay ? initialDelay : 500;
|
||||
this._subsequentDelay = subsequentDelay ? subsequentDelay : 0.90;
|
||||
this._initialDelay = initialDelay || 500;
|
||||
this._subsequentDelay = subsequentDelay || 0.90;
|
||||
this._obj = obj;
|
||||
this._evt = evt;
|
||||
this._node = node;
|
||||
@@ -44,7 +50,7 @@ dijit.typematic = {
|
||||
|
||||
stop: function(){
|
||||
// summary:
|
||||
// Stop an ongoing timed, repeating callback sequence.
|
||||
// Stop an ongoing timed, repeating callback sequence.
|
||||
if(this._timer){
|
||||
clearTimeout(this._timer);
|
||||
this._timer = null;
|
||||
@@ -57,7 +63,6 @@ dijit.typematic = {
|
||||
|
||||
addKeyListener: function(/*DOMNode*/ node, /*Object*/ keyObject, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay){
|
||||
// summary: Start listening for a specific typematic key.
|
||||
// node: the DOM node object to listen on for key events.
|
||||
// keyObject: an object defining the key to listen for.
|
||||
// key: (mandatory) the keyCode (number) or character (string) to listen for.
|
||||
// ctrlKey: desired ctrl key state to initiate the calback sequence:
|
||||
@@ -67,54 +72,56 @@ dijit.typematic = {
|
||||
// altKey: same as ctrlKey but for the alt key
|
||||
// shiftKey: same as ctrlKey but for the shift key
|
||||
// See the trigger method for other parameters.
|
||||
var ary = [];
|
||||
ary.push(dojo.connect(node, "onkeypress", this, function(evt){
|
||||
if(evt.keyCode == keyObject.keyCode && (!keyObject.charCode || keyObject.charCode == evt.charCode)
|
||||
&& ((typeof keyObject.ctrlKey == "undefined") || keyObject.ctrlKey == evt.ctrlKey)
|
||||
&& ((typeof keyObject.altKey == "undefined") || keyObject.altKey == evt.ctrlKey)
|
||||
&& ((typeof keyObject.shiftKey == "undefined") || keyObject.shiftKey == evt.ctrlKey)){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.trigger(keyObject, _this, node, callback, keyObject, subsequentDelay, initialDelay);
|
||||
}else if (dijit.typematic._obj == keyObject){
|
||||
dijit.typematic.stop();
|
||||
}
|
||||
}));
|
||||
ary.push(dojo.connect(node, "onkeyup", this, function(evt){
|
||||
if(dijit.typematic._obj == keyObject){
|
||||
dijit.typematic.stop();
|
||||
}
|
||||
}));
|
||||
return ary;
|
||||
// Returns an array of dojo.connect handles
|
||||
return [
|
||||
dojo.connect(node, "onkeypress", this, function(evt){
|
||||
if(evt.keyCode == keyObject.keyCode && (!keyObject.charCode || keyObject.charCode == evt.charCode) &&
|
||||
(keyObject.ctrlKey === undefined || keyObject.ctrlKey == evt.ctrlKey) &&
|
||||
(keyObject.altKey === undefined || keyObject.altKey == evt.ctrlKey) &&
|
||||
(keyObject.shiftKey === undefined || keyObject.shiftKey == evt.ctrlKey)){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.trigger(keyObject, _this, node, callback, keyObject, subsequentDelay, initialDelay);
|
||||
}else if(dijit.typematic._obj == keyObject){
|
||||
dijit.typematic.stop();
|
||||
}
|
||||
}),
|
||||
dojo.connect(node, "onkeyup", this, function(evt){
|
||||
if(dijit.typematic._obj == keyObject){
|
||||
dijit.typematic.stop();
|
||||
}
|
||||
})
|
||||
];
|
||||
},
|
||||
|
||||
addMouseListener: function(/*DOMNode*/ node, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay){
|
||||
// summary: Start listening for a typematic mouse click.
|
||||
// node: the DOM node object to listen on for mouse events.
|
||||
// See the trigger method for other parameters.
|
||||
var ary = [];
|
||||
ary.push(dojo.connect(node, "mousedown", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.trigger(evt, _this, node, callback, node, subsequentDelay, initialDelay);
|
||||
}));
|
||||
ary.push(dojo.connect(node, "mouseup", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.stop();
|
||||
}));
|
||||
ary.push(dojo.connect(node, "mouseout", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.stop();
|
||||
}));
|
||||
ary.push(dojo.connect(node, "mousemove", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
}));
|
||||
ary.push(dojo.connect(node, "dblclick", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
if(dojo.isIE){
|
||||
// Returns an array of dojo.connect handles
|
||||
var dc = dojo.connect;
|
||||
return [
|
||||
dc(node, "mousedown", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.trigger(evt, _this, node, callback, node, subsequentDelay, initialDelay);
|
||||
setTimeout("dijit.typematic.stop()",50);
|
||||
}
|
||||
}));
|
||||
return ary;
|
||||
}),
|
||||
dc(node, "mouseup", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.stop();
|
||||
}),
|
||||
dc(node, "mouseout", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
dijit.typematic.stop();
|
||||
}),
|
||||
dc(node, "mousemove", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
}),
|
||||
dc(node, "dblclick", this, function(evt){
|
||||
dojo.stopEvent(evt);
|
||||
if(dojo.isIE){
|
||||
dijit.typematic.trigger(evt, _this, node, callback, node, subsequentDelay, initialDelay);
|
||||
setTimeout(dijit.typematic.stop, 50);
|
||||
}
|
||||
})
|
||||
];
|
||||
},
|
||||
|
||||
addListener: function(/*Node*/ mouseNode, /*Node*/ keyNode, /*Object*/ keyObject, /*Object*/ _this, /*Function*/ callback, /*Number*/ subsequentDelay, /*Number*/ initialDelay){
|
||||
@@ -122,8 +129,8 @@ dijit.typematic = {
|
||||
// This is a thin wrapper to addKeyListener and addMouseListener.
|
||||
// mouseNode: the DOM node object to listen on for mouse events.
|
||||
// keyNode: the DOM node object to listen on for key events.
|
||||
// The mouseNode is used as the callback obj parameter.
|
||||
// See the trigger method for other parameters.
|
||||
// See the addMouseListener and addKeyListener methods for other parameters.
|
||||
// Returns an array of dojo.connect handles
|
||||
return this.addKeyListener(keyNode, keyObject, _this, callback, subsequentDelay, initialDelay).concat(
|
||||
this.addMouseListener(mouseNode, _this, callback, subsequentDelay, initialDelay));
|
||||
}
|
||||
|
||||
@@ -2,77 +2,7 @@ if(!dojo._hasResource["dijit._base.wai"]){ //_hasResource checks added by build.
|
||||
dojo._hasResource["dijit._base.wai"] = true;
|
||||
dojo.provide("dijit._base.wai");
|
||||
|
||||
dijit.waiNames = ["waiRole", "waiState"];
|
||||
|
||||
dijit.wai = {
|
||||
// summary: Contains functions to set accessibility roles and states
|
||||
// onto widget elements
|
||||
waiRole: {
|
||||
// name: String:
|
||||
// information for mapping accessibility role
|
||||
name: "waiRole",
|
||||
// namespace: String:
|
||||
// URI of the namespace for the set of roles
|
||||
"namespace": "http://www.w3.org/TR/xhtml2",
|
||||
// alias: String:
|
||||
// The alias to assign the namespace
|
||||
alias: "x2",
|
||||
// prefix: String:
|
||||
// The prefix to assign to the role value
|
||||
prefix: "wairole:"
|
||||
},
|
||||
waiState: {
|
||||
// name: String:
|
||||
// information for mapping accessibility state
|
||||
name: "waiState",
|
||||
// namespace: String:
|
||||
// URI of the namespace for the set of states
|
||||
"namespace": "http://www.w3.org/2005/07/aaa",
|
||||
// alias: String:
|
||||
// The alias to assign the namespace
|
||||
alias: "aaa",
|
||||
// prefix: String:
|
||||
// empty string - state value does not require prefix
|
||||
prefix: ""
|
||||
},
|
||||
setAttr: function(/*DomNode*/node, /*String*/ ns, /*String*/ attr, /*String|Boolean*/value){
|
||||
// summary: Use appropriate API to set the role or state attribute onto the element.
|
||||
// description: In IE use the generic setAttribute() api. Append a namespace
|
||||
// alias to the attribute name and appropriate prefix to the value.
|
||||
// Otherwise, use the setAttribueNS api to set the namespaced attribute. Also
|
||||
// add the appropriate prefix to the attribute value.
|
||||
if(dojo.isIE){
|
||||
node.setAttribute(this[ns].alias+":"+ attr, this[ns].prefix+value);
|
||||
}else{
|
||||
node.setAttributeNS(this[ns]["namespace"], attr, this[ns].prefix+value);
|
||||
}
|
||||
},
|
||||
|
||||
getAttr: function(/*DomNode*/ node, /*String*/ ns, /*String|Boolena*/ attr){
|
||||
// Summary: Use the appropriate API to retrieve the role or state value
|
||||
// Description: In IE use the generic getAttribute() api. An alias value
|
||||
// was added to the attribute name to simulate a namespace when the attribute
|
||||
// was set. Otherwise use the getAttributeNS() api to retrieve the state value
|
||||
if(dojo.isIE){
|
||||
return node.getAttribute(this[ns].alias+":"+attr);
|
||||
}else{
|
||||
return node.getAttributeNS(this[ns]["namespace"], attr);
|
||||
}
|
||||
},
|
||||
removeAttr: function(/*DomNode*/ node, /*String*/ ns, /*String|Boolena*/ attr){
|
||||
// summary: Use the appropriate API to remove the role or state value
|
||||
// description: In IE use the generic removeAttribute() api. An alias value
|
||||
// was added to the attribute name to simulate a namespace when the attribute
|
||||
// was set. Otherwise use the removeAttributeNS() api to remove the state value
|
||||
var success = true; //only IE returns a value
|
||||
if(dojo.isIE){
|
||||
success = node.removeAttribute(this[ns].alias+":"+attr);
|
||||
}else{
|
||||
node.removeAttributeNS(this[ns]["namespace"], attr);
|
||||
}
|
||||
return success;
|
||||
},
|
||||
|
||||
onload: function(){
|
||||
// summary:
|
||||
// Function that detects if we are in high-contrast mode or not,
|
||||
@@ -91,7 +21,7 @@ dijit.wai = {
|
||||
div.style.cssText = 'border: 1px solid;'
|
||||
+ 'border-color:red green;'
|
||||
+ 'position: absolute;'
|
||||
+ 'left: -999px;'
|
||||
+ 'height: 5px;'
|
||||
+ 'top: -999px;'
|
||||
+ 'background-image: url("' + dojo.moduleUrl("dijit", "form/templates/blank.gif") + '");';
|
||||
dojo.body().appendChild(div);
|
||||
@@ -118,4 +48,103 @@ if(dojo.isIE || dojo.isMoz){ // NOTE: checking in Safari messes things up
|
||||
dojo._loaders.unshift(dijit.wai.onload);
|
||||
}
|
||||
|
||||
dojo.mixin(dijit,
|
||||
{
|
||||
hasWaiRole: function(/*Element*/ elem){
|
||||
// Summary: Return true if elem has a role attribute and false if not.
|
||||
if(elem.hasAttribute){
|
||||
return elem.hasAttribute("role");
|
||||
}else{
|
||||
return elem.getAttribute("role") ? true : false;
|
||||
}
|
||||
},
|
||||
|
||||
getWaiRole: function(/*Element*/ elem){
|
||||
// Summary: Return the role of elem or an empty string if
|
||||
// elem does not have a role.
|
||||
var value = elem.getAttribute("role");
|
||||
if(value){
|
||||
var prefixEnd = value.indexOf(":");
|
||||
return prefixEnd == -1 ? value : value.substring(prefixEnd+1);
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
},
|
||||
|
||||
setWaiRole: function(/*Element*/ elem, /*String*/ role){
|
||||
// Summary: Set the role on elem. On Firefox 2 and below, "wairole:" is
|
||||
// prepended to the provided role value.
|
||||
if(dojo.isFF && dojo.isFF < 3){
|
||||
elem.setAttribute("role", "wairole:"+role);
|
||||
}else{
|
||||
elem.setAttribute("role", role);
|
||||
}
|
||||
},
|
||||
|
||||
removeWaiRole: function(/*Element*/ elem){
|
||||
// Summary: Removes the role attribute from elem.
|
||||
elem.removeAttribute("role");
|
||||
},
|
||||
|
||||
hasWaiState: function(/*Element*/ elem, /*String*/ state){
|
||||
// Summary: Return true if elem has a value for the given state and
|
||||
// false if it does not.
|
||||
// On Firefox 2 and below, we check for an attribute in namespace
|
||||
// "http://www.w3.org/2005/07/aaa" with a name of the given state.
|
||||
// On all other browsers, we check for an attribute called
|
||||
// "aria-"+state.
|
||||
if(dojo.isFF && dojo.isFF < 3){
|
||||
return elem.hasAttributeNS("http://www.w3.org/2005/07/aaa", state);
|
||||
}else{
|
||||
if(elem.hasAttribute){
|
||||
return elem.hasAttribute("aria-"+state);
|
||||
}else{
|
||||
return elem.getAttribute("aria-"+state) ? true : false;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getWaiState: function(/*Element*/ elem, /*String*/ state){
|
||||
// Summary: Return the value of the requested state on elem
|
||||
// or an empty string if elem has no value for state.
|
||||
// On Firefox 2 and below, we check for an attribute in namespace
|
||||
// "http://www.w3.org/2005/07/aaa" with a name of the given state.
|
||||
// On all other browsers, we check for an attribute called
|
||||
// "aria-"+state.
|
||||
if(dojo.isFF && dojo.isFF < 3){
|
||||
return elem.getAttributeNS("http://www.w3.org/2005/07/aaa", state);
|
||||
}else{
|
||||
var value = elem.getAttribute("aria-"+state);
|
||||
return value ? value : "";
|
||||
}
|
||||
},
|
||||
|
||||
setWaiState: function(/*Element*/ elem, /*String*/ state, /*String*/ value){
|
||||
// Summary: Set state on elem to value.
|
||||
// On Firefox 2 and below, we set an attribute in namespace
|
||||
// "http://www.w3.org/2005/07/aaa" with a name of the given state.
|
||||
// On all other browsers, we set an attribute called
|
||||
// "aria-"+state.
|
||||
if(dojo.isFF && dojo.isFF < 3){
|
||||
elem.setAttributeNS("http://www.w3.org/2005/07/aaa",
|
||||
"aaa:"+state, value);
|
||||
}else{
|
||||
elem.setAttribute("aria-"+state, value);
|
||||
}
|
||||
},
|
||||
|
||||
removeWaiState: function(/*Element*/ elem, /*String*/ state){
|
||||
// Summary: Removes the given state from elem.
|
||||
// On Firefox 2 and below, we remove the attribute in namespace
|
||||
// "http://www.w3.org/2005/07/aaa" with a name of the given state.
|
||||
// On all other browsers, we remove the attribute called
|
||||
// "aria-"+state.
|
||||
if(dojo.isFF && dojo.isFF < 3){
|
||||
elem.removeAttributeNS("http://www.w3.org/2005/07/aaa", state);
|
||||
}else{
|
||||
elem.removeAttribute("aria-"+state);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -4,14 +4,16 @@ dojo.provide("dijit._editor.RichText");
|
||||
|
||||
dojo.require("dijit._Widget");
|
||||
dojo.require("dijit._editor.selection");
|
||||
dojo.require("dojo.i18n");
|
||||
dojo.requireLocalization("dijit", "Textarea", null, "ROOT");
|
||||
|
||||
// used to save content
|
||||
// used to restore content when user leaves this page then comes back
|
||||
// but do not try doing document.write if we are using xd loading.
|
||||
// document.write will only work if RichText.js is included in the dojo.js
|
||||
// file. If it is included in dojo.js and you want to allow rich text saving
|
||||
// for back/forward actions, then set djConfig.allowXdRichTextSave = true.
|
||||
if(!djConfig["useXDomain"] || djConfig["allowXdRichTextSave"]){
|
||||
if(dojo._post_load){
|
||||
if(dojo._postLoad){
|
||||
(function(){
|
||||
var savetextarea = dojo.doc.createElement('textarea');
|
||||
savetextarea.id = "dijit._editor.RichText.savedContent";
|
||||
@@ -33,12 +35,12 @@ if(!djConfig["useXDomain"] || djConfig["allowXdRichTextSave"]){
|
||||
}
|
||||
}
|
||||
dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
preamble: function(){
|
||||
constructor: function(){
|
||||
// summary:
|
||||
// dijit._editor.RichText is the core of the WYSIWYG editor in dojo, which
|
||||
// provides the basic editing features. It also encapsulates the differences
|
||||
// of different js engines for various browsers
|
||||
|
||||
//
|
||||
// contentPreFilters: Array
|
||||
// pre content filter function register array.
|
||||
// these filters will be executed before the actual
|
||||
@@ -75,7 +77,6 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
}
|
||||
//this.contentDomPostFilters.push(this._postDomFixUrlAttributes);
|
||||
|
||||
|
||||
this.onLoadDeferred = new dojo.Deferred();
|
||||
},
|
||||
|
||||
@@ -111,7 +112,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
// minHeight: String
|
||||
// The minimum height that the editor should have
|
||||
minHeight: "1em",
|
||||
|
||||
|
||||
// isClosed: Boolean
|
||||
isClosed: true,
|
||||
|
||||
@@ -123,12 +124,11 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
_SEPARATOR: "@@**%%__RICHTEXTBOUNDRY__%%**@@",
|
||||
|
||||
// onLoadDeferred: dojo.Deferred
|
||||
// deferred that can be used to connect to the onLoad function. This
|
||||
// will only be set if dojo.Deferred is required
|
||||
// deferred which is fired when the editor finishes loading
|
||||
onLoadDeferred: null,
|
||||
|
||||
// Init
|
||||
postCreate: function(){
|
||||
// summary: init
|
||||
dojo.publish("dijit._editor.RichText::init", [this]);
|
||||
this.open();
|
||||
this.setupDefaultShortcuts();
|
||||
@@ -179,11 +179,11 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
return;
|
||||
}
|
||||
this._editorCommandsLocalized = true;
|
||||
|
||||
|
||||
//in IE, names for blockformat is locale dependent, so we cache the values here
|
||||
|
||||
//if the normal way fails, we try the hard way to get the list
|
||||
|
||||
|
||||
//do not use _cacheLocalBlockFormatNames here, as it will
|
||||
//trigger security warning in IE7
|
||||
|
||||
@@ -191,7 +191,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
//otherwise the queryCommandValue returns Normal for it
|
||||
var formats = ['p', 'pre', 'address', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'ol', 'div', 'ul'];
|
||||
var localhtml = "", format, i=0;
|
||||
while(format=formats[i++]){
|
||||
while((format=formats[i++])){
|
||||
if(format.charAt(1) != 'l'){
|
||||
localhtml += "<"+format+"><span>content</span></"+format+">";
|
||||
}else{
|
||||
@@ -217,22 +217,22 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
document.body.removeChild(div);
|
||||
},
|
||||
|
||||
open: function(/*DomNode, optional*/element){
|
||||
open: function(/*DomNode?*/element){
|
||||
// summary:
|
||||
// Transforms the node referenced in this.domNode into a rich text editing
|
||||
// node. This will result in the creation and replacement with an <iframe>
|
||||
// if designMode(FF)/contentEditable(IE) is used.
|
||||
|
||||
|
||||
if((!this.onLoadDeferred)||(this.onLoadDeferred.fired >= 0)){
|
||||
this.onLoadDeferred = new dojo.Deferred();
|
||||
}
|
||||
|
||||
|
||||
if(!this.isClosed){ this.close(); }
|
||||
dojo.publish("dijit._editor.RichText::open", [ this ]);
|
||||
|
||||
|
||||
this._content = "";
|
||||
if((arguments.length == 1)&&(element["nodeName"])){ this.domNode = element; } // else unchanged
|
||||
|
||||
|
||||
if( (this.domNode["nodeName"])&&
|
||||
(this.domNode.nodeName.toLowerCase() == "textarea")){
|
||||
// if we were created from a textarea, then we need to create a
|
||||
@@ -302,7 +302,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
var saveTextarea = dojo.byId("dijit._editor.RichText.savedContent");
|
||||
if(saveTextarea.value != ""){
|
||||
var datas = saveTextarea.value.split(this._SEPARATOR), i=0, dat;
|
||||
while(dat=datas[i++]){
|
||||
while((dat=datas[i++])){
|
||||
var data = dat.split(":");
|
||||
if(data[0] == this.name){
|
||||
html = data[1];
|
||||
@@ -311,6 +311,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: need to do something different for Opera/Safari
|
||||
dojo.connect(window, "onbeforeunload", this, "_saveContent");
|
||||
// dojo.connect(window, "onunload", this, "_saveContent");
|
||||
@@ -349,7 +350,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
if(dojo.isIE){
|
||||
this._localizeEditorCommands();
|
||||
}
|
||||
|
||||
|
||||
this.onLoad();
|
||||
}else{ // designMode in iframe
|
||||
this._drawIframe(html);
|
||||
@@ -363,8 +364,9 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
//static cache variables shared among all instance of this class
|
||||
_local2NativeFormatNames: {},
|
||||
_native2LocalFormatNames: {},
|
||||
_localizedIframeTitles: null,
|
||||
|
||||
_getIframeDocTxt: function(html){
|
||||
_getIframeDocTxt: function(/* String */ html){
|
||||
var _cs = dojo.getComputedStyle(this.domNode);
|
||||
if(!this.height && !dojo.isMoz){
|
||||
html="<div>"+html+"</div>";
|
||||
@@ -383,14 +385,16 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
lineHeight = "1.0";
|
||||
}
|
||||
return [
|
||||
"<html><head><style>",
|
||||
this.isLeftToRight() ? "<html><head>" : "<html dir='rtl'><head>",
|
||||
(dojo.isMoz ? "<title>" + this._localizedIframeTitles.iframeEditTitle + "</title>" : ""),
|
||||
"<style>",
|
||||
"body,html {",
|
||||
" background:transparent;",
|
||||
" padding: 0;",
|
||||
" margin: 0;",
|
||||
"}",
|
||||
// TODO: left positioning will cause contents to disappear out of view
|
||||
// if it gets too wide for the visible area
|
||||
// if it gets too wide for the visible area
|
||||
"body{",
|
||||
" top:0px; left:0px; right:0px;",
|
||||
((this.height||dojo.isOpera) ? "" : "position: fixed;"),
|
||||
@@ -408,7 +412,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
"</style>",
|
||||
this._applyEditingAreaStyleSheets(),
|
||||
"</head><body>"+html+"</body></html>"
|
||||
].join("");
|
||||
].join(""); // String
|
||||
},
|
||||
|
||||
_drawIframe: function(/*String*/html){
|
||||
@@ -429,6 +433,8 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
ifrs.verticalAlign = "bottom";
|
||||
// ifrs.scrolling = this.height ? "auto" : "vertical";
|
||||
this.editorObject = this.iframe;
|
||||
// get screen reader text for mozilla here, too
|
||||
this._localizedIframeTitles = dojo.i18n.getLocalization("dijit", "Textarea");
|
||||
}
|
||||
// opera likes this to be outside the with block
|
||||
// this.iframe.src = "javascript:void(0)";//dojo.uri.dojoUri("src/widget/templates/richtextframe.html") + ((dojo.doc.domain != currentDomain) ? ("#"+dojo.doc.domain) : "");
|
||||
@@ -489,7 +495,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
this.document = this.iframe.contentDocument;
|
||||
}
|
||||
if(!this.document.body){
|
||||
throw 'Error';
|
||||
throw 'Error';
|
||||
}
|
||||
}catch(e){
|
||||
setTimeout(ifrFunc,500);
|
||||
@@ -531,7 +537,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
this.editingAreaStyleSheets = [];
|
||||
|
||||
var text='', i=0, url;
|
||||
while(url=files[i++]){
|
||||
while((url=files[i++])){
|
||||
var abstring = (new dojo._Url(dojo.global.location, url)).toString();
|
||||
this.editingAreaStyleSheets.push(abstring);
|
||||
text += '<link rel="stylesheet" type="text/css" href="'+abstring+'"/>'
|
||||
@@ -616,7 +622,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
|
||||
_isResized: function(){ return false; },
|
||||
|
||||
onLoad: function(e){
|
||||
onLoad: function(/* Event */ e){
|
||||
// summary: handler after the content of the document finishes loading
|
||||
this.isLoaded = true;
|
||||
if(this.height || dojo.isMoz){
|
||||
@@ -626,9 +632,9 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
}
|
||||
this.editNode.contentEditable = true; //should do no harm in FF
|
||||
this._preDomFilterContent(this.editNode);
|
||||
|
||||
|
||||
var events=this.events.concat(this.captureEvents),i=0,et;
|
||||
while(et=events[i++]){
|
||||
while((et=events[i++])){
|
||||
this.connect(this.document, et.toLowerCase(), et);
|
||||
}
|
||||
if(!dojo.isIE){
|
||||
@@ -646,14 +652,14 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
if(this.focusOnLoad){
|
||||
this.focus();
|
||||
}
|
||||
|
||||
|
||||
this.onDisplayChanged(e);
|
||||
if(this.onLoadDeferred){
|
||||
this.onLoadDeferred.callback(true);
|
||||
}
|
||||
},
|
||||
|
||||
onKeyDown: function(e){
|
||||
onKeyDown: function(/* Event */ e){
|
||||
// summary: Fired on keydown
|
||||
|
||||
// console.info("onkeydown:", e.keyCode);
|
||||
@@ -662,16 +668,10 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
// such as the backspace. It might be possible to add this to Dojo, so that
|
||||
// keyPress events can be emulated by the keyDown and keyUp detection.
|
||||
if(dojo.isIE){
|
||||
if(e.keyCode === dojo.keys.TAB){
|
||||
dojo.stopEvent(e);
|
||||
// FIXME: this is a poor-man's indent/outdent. It would be
|
||||
// better if it added 4 " " chars in an undoable way.
|
||||
// Unfortuantly pasteHTML does not prove to be undoable
|
||||
this.execCommand((e.shiftKey ? "outdent" : "indent"));
|
||||
}else if(e.keyCode === dojo.keys.BACKSPACE && this.document.selection.type === "Control"){
|
||||
if(e.keyCode === dojo.keys.BACKSPACE && this.document.selection.type === "Control"){
|
||||
// IE has a bug where if a non-text object is selected in the editor,
|
||||
// hitting backspace would act as if the browser's back button was
|
||||
// clicked instead of deleting the object. see #1069
|
||||
// hitting backspace would act as if the browser's back button was
|
||||
// clicked instead of deleting the object. see #1069
|
||||
dojo.stopEvent(e);
|
||||
this.execCommand("delete");
|
||||
}else if( (65 <= e.keyCode&&e.keyCode <= 90) ||
|
||||
@@ -681,6 +681,23 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
this.onKeyPress(e);
|
||||
}
|
||||
}
|
||||
else if (dojo.isMoz){
|
||||
if(e.keyCode == dojo.keys.TAB && !e.shiftKey && !e.ctrlKey && !e.altKey && this.iframe){
|
||||
// update iframe document title for screen reader
|
||||
this.iframe.contentDocument.title = this._localizedIframeTitles.iframeFocusTitle;
|
||||
|
||||
// Place focus on the iframe. A subsequent tab or shift tab will put focus
|
||||
// on the correct control.
|
||||
this.iframe.focus(); // this.focus(); won't work
|
||||
dojo.stopEvent(e);
|
||||
}else if (e.keyCode == dojo.keys.TAB && e.shiftKey){
|
||||
// if there is a toolbar, set focus to it, otherwise ignore
|
||||
if (this.toolbar){
|
||||
this.toolbar.focus();
|
||||
}
|
||||
dojo.stopEvent(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onKeyUp: function(e){
|
||||
@@ -703,7 +720,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
if(this._keyHandlers[key]){
|
||||
// console.debug("char:", e.key);
|
||||
var handlers = this._keyHandlers[key], i = 0, h;
|
||||
while(h = handlers[i++]){
|
||||
while((h = handlers[i++])){
|
||||
if(modifiers == h.modifiers){
|
||||
if(!h.handler.apply(this,arguments)){
|
||||
e.preventDefault();
|
||||
@@ -728,11 +745,11 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
});
|
||||
},
|
||||
|
||||
onKeyPressed: function(e){
|
||||
onKeyPressed: function(/*Event*/e){
|
||||
this.onDisplayChanged(/*e*/); // can't pass in e
|
||||
},
|
||||
|
||||
onClick: function(e){
|
||||
onClick: function(/*Event*/e){
|
||||
// console.debug('onClick',this._tryDesignModeOnClick);
|
||||
// if(this._tryDesignModeOnClick){
|
||||
// try{
|
||||
@@ -747,10 +764,13 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
this.onChange(_c);
|
||||
this.savedContent=_c;
|
||||
}
|
||||
// console.info('_onBlur')
|
||||
if (dojo.isMoz && this.iframe){
|
||||
this.iframe.contentDocument.title = this._localizedIframeTitles.iframeEditTitle;
|
||||
}
|
||||
// console.info('_onBlur')
|
||||
},
|
||||
_initialFocus: true,
|
||||
_onFocus: function(e){
|
||||
_onFocus: function(/*Event*/e){
|
||||
// console.info('_onFocus')
|
||||
// summary: Fired on focus
|
||||
if( (dojo.isMoz)&&(this._initialFocus) ){
|
||||
@@ -787,12 +807,12 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
// _lastUpdate: 0,
|
||||
updateInterval: 200,
|
||||
_updateTimer: null,
|
||||
onDisplayChanged: function(e){
|
||||
onDisplayChanged: function(/*Event*/e){
|
||||
// summary:
|
||||
// this event will be fired everytime the display context
|
||||
// This event will be fired everytime the display context
|
||||
// changes and the result needs to be reflected in the UI.
|
||||
// description:
|
||||
// if you don't want to have update too often,
|
||||
// If you don't want to have update too often,
|
||||
// onNormalizedDisplayChanged should be used instead
|
||||
|
||||
// var _t=new Date();
|
||||
@@ -806,15 +826,15 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
},
|
||||
onNormalizedDisplayChanged: function(){
|
||||
// summary:
|
||||
// this event is fired every updateInterval ms or more
|
||||
// This event is fired every updateInterval ms or more
|
||||
// description:
|
||||
// if something needs to happen immidiately after a
|
||||
// If something needs to happen immidiately after a
|
||||
// user change, please use onDisplayChanged instead
|
||||
this._updateTimer=null;
|
||||
},
|
||||
onChange: function(newContent){
|
||||
// summary:
|
||||
// this is fired if and only if the editor loses focus and
|
||||
// summary:
|
||||
// this is fired if and only if the editor loses focus and
|
||||
// the content is changed
|
||||
|
||||
// console.log('onChange',newContent);
|
||||
@@ -970,9 +990,9 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
// // mozilla doesn't support hilitecolor properly when useCSS is
|
||||
// // set to false (bugzilla #279330)
|
||||
|
||||
// this.document.execCommand("useCSS", false, false);
|
||||
this.document.execCommand("styleWithCSS", false, true);
|
||||
returnValue = this.document.execCommand(command, false, argument);
|
||||
// this.document.execCommand("useCSS", false, true);
|
||||
this.document.execCommand("styleWithCSS", false, false);
|
||||
|
||||
}else if((dojo.isIE)&&( (command == "backcolor")||(command == "forecolor") )){
|
||||
// Tested under IE 6 XP2, no problem here, comment out
|
||||
@@ -1208,7 +1228,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
return ec;
|
||||
},
|
||||
|
||||
_saveContent: function(e){
|
||||
_saveContent: function(/*Event*/e){
|
||||
// summary:
|
||||
// Saves the content in an onunload event if the editor has not been closed
|
||||
var saveTextarea = dojo.byId("dijit._editor.RichText.savedContent");
|
||||
@@ -1216,7 +1236,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
},
|
||||
|
||||
|
||||
escapeXml: function(/*string*/str, /*boolean*/noSingleQuotes){
|
||||
escapeXml: function(/*String*/str, /*Boolean*/noSingleQuotes){
|
||||
//summary:
|
||||
// Adds escape sequences for special characters in XML: &<>"'
|
||||
// Optionally skips escapes for single quotes
|
||||
@@ -1227,7 +1247,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
return str; // string
|
||||
},
|
||||
|
||||
getNodeHtml: function(node){
|
||||
getNodeHtml: function(/* DomNode */node){
|
||||
switch(node.nodeType){
|
||||
case 1: //element node
|
||||
var output = '<'+node.tagName.toLowerCase();
|
||||
@@ -1266,7 +1286,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
}
|
||||
}else{
|
||||
var attr, i=0, attrs = node.attributes;
|
||||
while(attr=attrs[i++]){
|
||||
while((attr=attrs[i++])){
|
||||
//ignore all attributes starting with _dj which are
|
||||
//internal temporary attributes used by the editor
|
||||
if(attr.name.substr(0,3) != '_dj' /*&&
|
||||
@@ -1285,7 +1305,7 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
return a[0]<b[0]?-1:(a[0]==b[0]?0:1);
|
||||
});
|
||||
i=0;
|
||||
while(attr=attrarray[i++]){
|
||||
while((attr=attrarray[i++])){
|
||||
output += ' '+attr[0]+'="'+attr[1]+'"';
|
||||
}
|
||||
if(node.childNodes.length){
|
||||
@@ -1308,16 +1328,17 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
return output;
|
||||
},
|
||||
|
||||
getNodeChildrenHtml: function(dom){
|
||||
getNodeChildrenHtml: function(/* DomNode */dom){
|
||||
// summary: Returns the html content of a DomNode and children
|
||||
var out = "";
|
||||
if(!dom){ return out; }
|
||||
var nodes = dom["childNodes"]||dom;
|
||||
var i=0;
|
||||
var node;
|
||||
while(node=nodes[i++]){
|
||||
while((node=nodes[i++])){
|
||||
out += this.getNodeHtml(node);
|
||||
}
|
||||
return out;
|
||||
return out; // String
|
||||
},
|
||||
|
||||
close: function(/*Boolean*/save, /*Boolean*/force){
|
||||
@@ -1388,28 +1409,32 @@ dojo.declare("dijit._editor.RichText", [ dijit._Widget ], {
|
||||
return changed; // Boolean: whether the content has been modified
|
||||
},
|
||||
|
||||
destroyRendering: function(){}, // stub!
|
||||
destroyRendering: function(){
|
||||
// summary: stub
|
||||
},
|
||||
|
||||
destroy: function(){
|
||||
this.destroyRendering();
|
||||
if(!this.isClosed){ this.close(false); }
|
||||
|
||||
dijit._editor.RichText.superclass.destroy.call(this);
|
||||
this.inherited("destroy",arguments);
|
||||
//dijit._editor.RichText.superclass.destroy.call(this);
|
||||
},
|
||||
|
||||
_fixContentForMoz: function(html){
|
||||
_fixContentForMoz: function(/* String */ html){
|
||||
// summary:
|
||||
// Moz can not handle strong/em tags correctly, convert them to b/i
|
||||
html = html.replace(/<(\/)?strong([ \>])/gi, '<$1b$2' );
|
||||
html = html.replace(/<(\/)?em([ \>])/gi, '<$1i$2' );
|
||||
return html;
|
||||
return html; // String
|
||||
},
|
||||
|
||||
_srcInImgRegex : /(?:(<img(?=\s).*?\ssrc=)("|')(.*?)\2)|(?:(<img\s.*?src=)([^"'][^ >]+))/gi ,
|
||||
_hrefInARegex : /(?:(<a(?=\s).*?\shref=)("|')(.*?)\2)|(?:(<a\s.*?href=)([^"'][^ >]+))/gi ,
|
||||
_preFixUrlAttributes: function(html){
|
||||
|
||||
_preFixUrlAttributes: function(/* String */ html){
|
||||
html = html.replace(this._hrefInARegex, '$1$4$2$3$5$2 _djrealurl=$2$3$5$2') ;
|
||||
html = html.replace(this._srcInImgRegex, '$1$4$2$3$5$2 _djrealurl=$2$3$5$2') ;
|
||||
return html;
|
||||
return html; // String
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ dojo.declare("dijit._editor._Plugin", null, {
|
||||
dojo.mixin(this, args);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
editor: null,
|
||||
iconClassPrefix: "dijitEditorIcon",
|
||||
button: null,
|
||||
@@ -65,11 +65,11 @@ dojo.declare("dijit._editor._Plugin", null, {
|
||||
this._initButton();
|
||||
|
||||
// FIXME: wire up editor to button here!
|
||||
if( (this.command.length) &&
|
||||
if( (this.command.length) &&
|
||||
(!this.editor.queryCommandAvailable(this.command))
|
||||
){
|
||||
// console.debug("hiding:", this.command);
|
||||
if(this.button){
|
||||
if(this.button){
|
||||
this.button.domNode.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
({"1": "xx-small", "2": "x-small", "formatBlock": "Format", "monospaced": "monospaced", "3": "small", "4": "medium", "5": "large", "6": "x-large", "7": "xx-large", "fantasy": "fantasy", "serif": "serif", "p": "Paragraph", "pre": "Pre-formatted", "sans-serif": "sans-serif", "fontName": "Font", "h1": "Heading", "h2": "Subheading", "h3": "Sub-subheading", "fontSize": "Size", "cursive": "cursive"})
|
||||
@@ -1 +1 @@
|
||||
({"removeFormat": "Remove Format", "copy": "Copy", "paste": "Paste", "selectAll": "Select All", "insertOrderedList": "Numbered List", "insertTable": "Insert/Edit Table", "underline": "Underline", "foreColor": "Foreground Color", "htmlToggle": "HTML Source", "formatBlock": "Paragraph Style", "insertHorizontalRule": "Horizontal Rule", "delete": "Delete", "insertUnorderedList": "Bullet List", "tableProp": "Table Property", "insertImage": "Insert Image", "superscript": "Superscript", "subscript": "Subscript", "createLink": "Create Link", "pasteErrorFF": "Paste action is only available in Firefox via keyboard shortcut due to its design decision: please use ctrl+v.", "undo": "Undo", "italic": "Italic", "justifyLeft": "Align Left", "fontName": "Font Name", "unlink": "Remove Link", "toggleTableBorder": "Toggle Table Border", "fontSize": "Font Size", "indent": "Indent", "redo": "Redo", "strikethrough": "Strikethrough", "justifyFull": "Justify", "justifyCenter": "Align Center", "hiliteColor": "Background Color", "outdent": "Outdent", "cut": "Cut", "deleteTable": "Delete Table", "plainFormatBlock": "Paragraph Style", "bold": "Bold", "copyErrorFF": "Copy action is only available in Firefox via keyboard shortcut due to its design decision: please use ctrl+c.", "cutErrorFF": "Cut action is only available in Firefox via keyboard shortcut due to its design decision: please use ctrl+x.", "justifyRight": "Align Right"})
|
||||
({"removeFormat": "Remove Format", "copy": "Copy", "paste": "Paste", "selectAll": "Select All", "insertOrderedList": "Numbered List", "insertTable": "Insert/Edit Table", "underline": "Underline", "foreColor": "Foreground Color", "htmlToggle": "HTML Source", "formatBlock": "Paragraph Style", "insertHorizontalRule": "Horizontal Rule", "delete": "Delete", "appleKey": "⌘${0}", "insertUnorderedList": "Bullet List", "tableProp": "Table Property", "insertImage": "Insert Image", "superscript": "Superscript", "subscript": "Subscript", "createLink": "Create Link", "undo": "Undo", "italic": "Italic", "fontName": "Font Name", "justifyLeft": "Align Left", "unlink": "Remove Link", "toggleTableBorder": "Toggle Table Border", "ctrlKey": "ctrl+${0}", "fontSize": "Font Size", "indent": "Indent", "redo": "Redo", "strikethrough": "Strikethrough", "justifyFull": "Justify", "justifyCenter": "Align Center", "hiliteColor": "Background Color", "deleteTable": "Delete Table", "outdent": "Outdent", "cut": "Cut", "plainFormatBlock": "Paragraph Style", "bold": "Bold", "systemShortcutFF": "The \"${0}\" action is only available in Mozilla Firefox using a keyboard shortcut. Use ${1}.", "justifyRight": "Align Right"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "Nastavit", "text": "Text:", "title": "Adresa URL odkazu", "url": "Adresa URL:", "urlInvalidMessage": "Neplatná adresa URL. Zadejte úplnou adresu URL ve tvaru 'http://www.dojotoolkit.org'"})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "Odebrat formát", "copy": "Kopírovat", "paste": "Vložit", "selectAll": "Vybrat vše", "insertOrderedList": "Číslovaný seznam", "insertTable": "Vložit/upravit tabulku", "underline": "Podtržení", "foreColor": "Barva popředí", "htmlToggle": "Zdroj HTML", "formatBlock": "Styl odstavce", "insertHorizontalRule": "Vodorovné pravítko", "delete": "Odstranit", "insertUnorderedList": "Seznam s odrážkami", "tableProp": "Vlastnost tabulky", "insertImage": "Vložit obraz", "superscript": "Horní index", "subscript": "Dolní index", "createLink": "Vytvořit odkaz", "undo": "Zpět", "italic": "Kurzíva", "fontName": "Název písma", "justifyLeft": "Zarovnat vlevo", "unlink": "Odebrat odkaz", "toggleTableBorder": "Přepnout ohraničení tabulky", "fontSize": "Velikost písma", "indent": "Odsadit", "redo": "Opakovat", "strikethrough": "Přeškrtnutí", "justifyFull": "Do bloku", "justifyCenter": "Zarovnat na střed", "hiliteColor": "Barva pozadí", "deleteTable": "Odstranit tabulku", "outdent": "Předsadit", "cut": "Vyjmout", "plainFormatBlock": "Styl odstavce", "bold": "Tučné", "systemShortcutFF": "Akce \"${0}\" je k dispozici pouze v prohlížeči Mozilla Firefox při použití klávesové zkratky. Použijte ${1}.", "justifyRight": "Zarovnat vpravo", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "Festlegen", "text": "Text:", "title": "Link-URL", "url": "URL:", "urlInvalidMessage": "Ungültiger URL. Geben Sie einen vollständigen URL ein. Beispiel: 'http://www.dojotoolkit.org'"})
|
||||
@@ -1 +1 @@
|
||||
({"undo": "Rückgängig", "formatBlock": "Paragraph Stil", "selectAll": "Alles auswählen", "plainFormatBlock": "Paragraph Stil", "subscript": "Tiefgestellt", "delete": "Löschen", "justifyRight": "Rechtsbündig", "superscript": "Hochgestellt", "copy": "Kopieren", "createLink": "Link erstellen", "bold": "Fett", "removeFormat": "Formatierung löschen", "unlink": "Link löschen", "fontName": "Schriftart", "outdent": "Ausrücken", "paste": "Einfügen", "redo": "Wiederholen", "indent": "Einrücken", "justifyFull": "Blocksatz", "foreColor": "Textfarbe", "underline": "Unterstrichen", "justifyCenter": "Zentiert", "justifyLeft": "Linksbündig", "italic": "Kursiv", "insertUnorderedList": "Auflistung", "insertOrderedList": "Nummerierung", "insertHorizontalRule": "Horizontale Linie", "strikethrough": "Durchgestrichen", "insertImage": "Bild einfügen", "cut": "Ausschneiden", "hiliteColor": "Hintergrundfarbe", "fontSize": "Schriftgröße", "insertTable": "Insert/Edit Table", "htmlToggle": "HTML Source", "tableProp": "Table Property", "pasteErrorFF": "Paste action is only available in Firefox via keyboard shortcut due to its design decision: please use ctrl+v.", "toggleTableBorder": "Toggle Table Border", "deleteTable": "Delete Table", "copyErrorFF": "Copy action is only available in Firefox via keyboard shortcut due to its design decision: please use ctrl+c.", "cutErrorFF": "Cut action is only available in Firefox via keyboard shortcut due to its design decision: please use ctrl+x."})
|
||||
({"removeFormat": "Formatierung entfernen", "copy": "Kopieren", "paste": "Einfügen", "selectAll": "Alles auswählen", "insertOrderedList": "Nummerierte Liste", "insertTable": "Tabelle einfügen/bearbeiten", "underline": "Unterstrichen", "foreColor": "Vordergrundfarbe", "htmlToggle": "HTML-Quelltext", "formatBlock": "Absatzstil", "insertHorizontalRule": "Horizontaler Strich", "delete": "Löschen", "insertUnorderedList": "Listenpunkte", "tableProp": "Tabelleneigenschaft", "insertImage": "Grafik einfügen", "superscript": "Hochgestellt", "subscript": "Tiefgestellt", "createLink": "Link erstellen", "undo": "Rückgängig", "italic": "Kursiv", "fontName": "Schriftartname", "justifyLeft": "Linksbündig", "unlink": "Link entfernen", "toggleTableBorder": "Tabellenumrandung ein-/ausschalten", "ctrlKey": "Strg+${0}", "fontSize": "Schriftgröße", "indent": "Einrücken", "redo": "Wiederherstellen", "strikethrough": "Durchgestrichen", "justifyFull": "Blocksatz", "justifyCenter": "Zentrieren", "hiliteColor": "Hintergrundfarbe", "deleteTable": "Tabelle löschen", "outdent": "Ausrücken", "cut": "Ausschneiden", "plainFormatBlock": "Absatzstil", "bold": "Fett", "systemShortcutFF": "Die Aktion \"${0}\" ist in Mozilla Firefox nur über einen Tastaturkurzbefehl verfügbar. Verwenden Sie ${1}.", "justifyRight": "Rechtsbündig", "appleKey": "⌘${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "Establecer", "text": "Texto:", "title": "Enlazar URL", "url": "URL:", "urlInvalidMessage": "URL no válido. Especifique un URL completo como 'http://www.dojotoolkit.org'"})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "Eliminar formato", "copy": "Copiar", "paste": "Pegar", "selectAll": "Seleccionar todo", "insertOrderedList": "Lista numerada", "insertTable": "Insertar/Editar tabla", "underline": "Subrayado", "foreColor": "Color de primer plano", "htmlToggle": "Fuente HTML", "formatBlock": "Estilo de párrafo", "insertHorizontalRule": "Regla horizontal", "delete": "Suprimir", "insertUnorderedList": "Lista con viñetas", "tableProp": "Propiedad de tabla", "insertImage": "Insertar imagen", "superscript": "Superíndice", "subscript": "Subíndice", "createLink": "Crear enlace", "undo": "Deshacer", "italic": "Cursiva", "fontName": "Nombre de font", "justifyLeft": "Alinear izquierda", "unlink": "Eliminar enlace", "toggleTableBorder": "Conmutar borde de tabla", "ctrlKey": "Control+${0}", "fontSize": "Tamaño de font", "indent": "Sangría", "redo": "Rehacer", "strikethrough": "Tachado", "justifyFull": "Justificar", "justifyCenter": "Alinear centro", "hiliteColor": "Color de segundo plano", "deleteTable": "Suprimir tabla", "outdent": "Anular sangría", "cut": "Cortar", "plainFormatBlock": "Estilo de párrafo", "bold": "Negrita", "systemShortcutFF": "La acción \"${0}\" sólo está disponible en Mozilla Firefox mediante un atajo de teclado. Utilice ${1}.", "justifyRight": "Alinear derecha", "appleKey": "⌘${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "Définir", "text": "Texte :", "title": "URL du lien", "url": "URL :", "urlInvalidMessage": "Adresse URL non valide. Entrez une adresse URL complète de type 'http://www.dojotoolkit.org'"})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "Supprimer la mise en forme", "copy": "Copier", "paste": "Coller", "selectAll": "Sélectionner tout", "insertOrderedList": "Liste numérotée", "insertTable": "Insérer/Modifier un tableau", "underline": "Souligner", "foreColor": "Couleur d'avant-plan", "htmlToggle": "Source HTML", "formatBlock": "Style de paragraphe", "insertHorizontalRule": "Règle horizontale", "delete": "Supprimer", "insertUnorderedList": "Liste à puces", "tableProp": "Propriété du tableau", "insertImage": "Insérer une image", "superscript": "Exposant", "subscript": "Indice", "createLink": "Créer un lien", "undo": "Annuler", "italic": "Italique", "fontName": "Nom de police", "justifyLeft": "Aligner à gauche", "unlink": "Supprimer le lien", "toggleTableBorder": "Afficher/Masquer la bordure du tableau", "fontSize": "Taille de police", "indent": "Retrait", "redo": "Rétablir", "strikethrough": "Barrer", "justifyFull": "Justifier", "justifyCenter": "Aligner au centre", "hiliteColor": "Couleur d'arrière-plan", "deleteTable": "Supprimer le tableau", "outdent": "Retrait négatif", "cut": "Couper", "plainFormatBlock": "Style de paragraphe", "bold": "Gras", "systemShortcutFF": "L'action \"${0}\" est disponible dans Mozilla Firefox uniquement, par le biais d'un raccourci-clavier. Utilisez ${1}.", "justifyRight": "Aligner à droite", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "Beállítás", "text": "Szöveg:", "title": "Hivatkozás URL címe", "url": "URL:", "urlInvalidMessage": "Érvénytelen URL cím. Adjon meg teljes URL címet, például: 'http://www.dojotoolkit.org'"})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "Formázás eltávolítása", "copy": "Másolás", "paste": "Beillesztés", "selectAll": "Összes kijelölése", "insertOrderedList": "Számozott lista", "insertTable": "Táblázat beszúrása/szerkesztése", "underline": "Aláhúzott", "foreColor": "Előtérszín", "htmlToggle": "HTML forrás", "formatBlock": "Bekezdés stílusa", "insertHorizontalRule": "Vízszintes vonalzó", "delete": "Törlés", "insertUnorderedList": "Felsorolásjeles lista", "tableProp": "Táblázat tulajdonságai", "insertImage": "Kép beszúrása", "superscript": "Felső index", "subscript": "Alsó index", "createLink": "Hivatkozás létrehozása", "undo": "Visszavonás", "italic": "Dőlt", "fontName": "Betűtípus", "justifyLeft": "Balra igazítás", "unlink": "Hivatkozás eltávolítása", "toggleTableBorder": "Táblázatszegély ki-/bekapcsolása", "fontSize": "Betűméret", "indent": "Behúzás", "redo": "Újra", "strikethrough": "Áthúzott", "justifyFull": "Igazítás", "justifyCenter": "Középre igazítás", "hiliteColor": "Háttérszín", "deleteTable": "Táblázat törlése", "outdent": "Negatív behúzás", "cut": "Kivágás", "plainFormatBlock": "Bekezdés stílusa", "bold": "Félkövér", "systemShortcutFF": "A(z) \"${0}\" művelet csak Mozilla Firefox böngészőben érhető el billentyűparancs használatával. Használja a következőt: ${1}.", "justifyRight": "Jobbra igazítás", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "Imposta", "text": "Testo:", "title": "URL di collegamento", "url": "URL:", "urlInvalidMessage": "URL non valido. Immettere un URL completo come nel seguente esempio: 'http://www.dojotoolkit.org'"})
|
||||
@@ -1 +1 @@
|
||||
({"undo": "Annulla", "formatBlock": "Stile Paragrafo", "selectAll": "Seleziona Tutto", "htmlToggle": "Sorgente HTML", "plainFormatBlock": "Stile Paragrafo", "subscript": "Pedice", "delete": "Elimina", "justifyRight": "Allinea a Destra", "superscript": "Apice", "copy": "Copia", "createLink": "Crea collegamento", "bold": "Grassetto", "removeFormat": "Rimuovi Formato", "unlink": "Rimuovi Collegamento", "fontName": "Nome Font", "redo": "Ripeti", "paste": "Incolla", "outdent": "Riduci Rientro", "indent": "Aumenta Rientro", "justifyFull": "Giustifica", "foreColor": "Colore Primo Piano", "underline": "Sottolineato", "justifyCenter": "Allinea al Centro", "justifyLeft": "Allinea a Sinistra", "italic": "Corsivo", "insertUnorderedList": "Lista Puntata", "insertOrderedList": "Lista Numerata", "insertHorizontalRule": "Righello Orizzontale", "strikethrough": "Barrato", "insertImage": "Inserisci Immagine", "cut": "Taglia", "hiliteColor": "Colore Sfondo", "fontSize": "Dimensioni Font", "insertTable": "Insert/Edit Table", "tableProp": "Table Property", "pasteErrorFF": "Paste action is only available in Firefox via keyboard shortcut due to its design decision: please use ctrl+v.", "toggleTableBorder": "Toggle Table Border", "deleteTable": "Delete Table", "copyErrorFF": "Copy action is only available in Firefox via keyboard shortcut due to its design decision: please use ctrl+c.", "cutErrorFF": "Cut action is only available in Firefox via keyboard shortcut due to its design decision: please use ctrl+x."})
|
||||
({"removeFormat": "Rimuovi formato", "copy": "Copia", "paste": "Incolla", "selectAll": "Seleziona tutto", "insertOrderedList": "Elenco numerato", "insertTable": "Inserisci/Modifica tabella", "underline": "Sottolineato", "foreColor": "Colore primo piano", "htmlToggle": "Origine HTML", "formatBlock": "Stile paragrafo", "insertHorizontalRule": "Righello orizzontale", "delete": "Elimina", "insertUnorderedList": "Elenco puntato", "tableProp": "Proprietà tabella", "insertImage": "Inserisci immagine", "superscript": "Apice", "subscript": "Pedice", "createLink": "Crea collegamento", "undo": "Annulla", "italic": "Corsivo", "fontName": "Nome carattere", "justifyLeft": "Allinea a sinistra", "unlink": "Rimuovi collegamento", "toggleTableBorder": "Mostra/Nascondi margine tabella", "fontSize": "Dimensione carattere", "indent": "Rientra", "redo": "Ripristina", "strikethrough": "Barrato", "justifyFull": "Giustifica", "justifyCenter": "Allinea al centro", "hiliteColor": "Colore sfondo", "deleteTable": "Elimina tabella", "outdent": "Rimuovi rientro", "cut": "Taglia", "plainFormatBlock": "Stile paragrafo", "bold": "Grassetto", "systemShortcutFF": "L'azione \"${0}\" è disponibile solo in Mozilla Firefox tramite tasti di scelta rapida. Utilizzare ${1}.", "justifyRight": "Allinea a destra", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "設定", "text": "テキスト:", "title": "リンク URL", "url": "URL:", "urlInvalidMessage": "無効な URL です。完全な URL (例えば、http://www.dojotoolkit.org) を入力してください。"})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "形式の除去", "copy": "コピー", "paste": "貼り付け", "selectAll": "すべて選択", "insertOrderedList": "番号付きリスト", "insertTable": "テーブルの挿入/編集", "underline": "下線", "foreColor": "前景色", "htmlToggle": "HTML ソース", "formatBlock": "段落スタイル", "insertHorizontalRule": "水平罫線", "delete": "削除", "insertUnorderedList": "黒丸付きリスト", "tableProp": "テーブル・プロパティー", "insertImage": "イメージの挿入", "superscript": "上付き文字", "subscript": "下付き文字", "createLink": "リンクの作成", "undo": "取り消し", "italic": "イタリック", "fontName": "フォント名", "justifyLeft": "左揃え", "unlink": "リンクの除去", "toggleTableBorder": "テーブル・ボーダーの切り替え", "fontSize": "フォント・サイズ", "indent": "インデント", "redo": "再実行", "strikethrough": "取り消し線", "justifyFull": "行末揃え", "justifyCenter": "中央揃え", "hiliteColor": "背景色", "deleteTable": "テーブルの削除", "outdent": "アウトデント", "cut": "切り取り", "plainFormatBlock": "段落スタイル", "bold": "太字", "systemShortcutFF": "\"${0}\" アクションは、キーボード・ショートカットを使用して Mozilla Firefox でのみ使用できます。${1} を使用してください。", "justifyRight": "右揃え", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "설정", "text": "텍스트:", "title": "URL 링크", "url": "URL:", "urlInvalidMessage": "유효하지 않은 URL입니다. 'http://www.dojotoolkit.org'와 같이 전체 URL을 입력하십시오. "})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "형식 제거", "copy": "복사", "paste": "붙여넣기", "selectAll": "모두 선택", "insertOrderedList": "번호 목록", "insertTable": "테이블 삽입/편집", "underline": "밑줄", "foreColor": "전경색", "htmlToggle": "HTML 소스", "formatBlock": "단락 양식", "insertHorizontalRule": "수평 자", "delete": "삭제", "insertUnorderedList": "글머리표 목록", "tableProp": "테이블 특성", "insertImage": "이미지 삽입", "superscript": "위첨자", "subscript": "아래첨자", "createLink": "링크 작성", "undo": "실행 취소", "italic": "이탤릭체", "fontName": "글꼴 이름", "justifyLeft": "왼쪽 맞춤", "unlink": "링크 제거", "toggleTableBorder": "토글 테이블 경계", "fontSize": "글꼴 크기", "indent": "들여쓰기", "redo": "다시 실행", "strikethrough": "취소선", "justifyFull": "양쪽 맞춤", "justifyCenter": "가운데 맞춤", "hiliteColor": "배경색", "deleteTable": "테이블 삭제", "outdent": "내어쓰기", "cut": "잘라내기", "plainFormatBlock": "단락 양식", "bold": "굵은체", "systemShortcutFF": "\"${0}\" 조치는 키보드 바로 가기를 사용하는 Mozilla Firefox에서만 사용 가능합니다. ${1} 사용.", "justifyRight": "오른쪽 맞춤", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "Ustaw", "text": "Tekst:", "title": "Adres URL odsyłacza", "url": "Adres URL:", "urlInvalidMessage": "Nieprawidłowy adres URL. Wprowadź pełny adres URL, na przykład http://www.dojotoolkit.org."})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "Usuń formatowanie", "copy": "Kopiuj", "paste": "Wklej", "selectAll": "Wybierz wszystko", "insertOrderedList": "Lista numerowana", "insertTable": "Wstaw/edytuj tabelę", "underline": "Podkreślenie", "foreColor": "Kolor pierwszego planu", "htmlToggle": "Źródło HTML", "formatBlock": "Styl akapitu", "insertHorizontalRule": "Linia pozioma", "delete": "Usuń", "insertUnorderedList": "Lista wypunktowana", "tableProp": "Właściwość tabeli", "insertImage": "Wstaw obraz", "superscript": "Indeks górny", "subscript": "Indeks dolny", "createLink": "Utwórz odsyłacz", "undo": "Cofnij", "italic": "Kursywa", "fontName": "Nazwa czcionki", "justifyLeft": "Wyrównaj do lewej", "unlink": "Usuń odsyłacz", "toggleTableBorder": "Przełącz ramkę tabeli", "fontSize": "Wielkość czcionki", "indent": "Wcięcie", "redo": "Przywróć", "strikethrough": "Przekreślenie", "justifyFull": "Wyrównaj do lewej i prawej", "justifyCenter": "Wyrównaj do środka", "hiliteColor": "Kolor tła", "deleteTable": "Usuń tabelę", "outdent": "Usuń wcięcie", "cut": "Wytnij", "plainFormatBlock": "Styl akapitu", "bold": "Pogrubienie", "systemShortcutFF": "Działanie \"${0}\" jest dostępne w przeglądarce Mozilla Firefox wyłącznie za pomocą skrótu klawiaturowego. Użyj ${1}.", "justifyRight": "Wyrównaj do prawej", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "Definir\n", "text": "Texto:\n", "title": "Vincular URL", "url": "URL:", "urlInvalidMessage": "URL inválida. Digite uma URL completa, como 'http://www.dojotoolkit.org'"})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "Remover Formato", "copy": "Copiar", "paste": "Colar", "selectAll": "Selecionar Todos", "insertOrderedList": "Lista Numerada", "insertTable": "Inserir/Editar Tabela", "underline": "Sublinhado", "foreColor": "Cor do Primeiro Plano", "htmlToggle": "Origem HTML", "formatBlock": "Estilo de Parágrafo", "insertHorizontalRule": "Régua Horizontal", "delete": "Excluir ", "insertUnorderedList": "Lista com Marcadores", "tableProp": "Propriedade da Tabela", "insertImage": "Inserir Imagem", "superscript": "Sobrescrito", "subscript": "Subscrito", "createLink": "Criar Link", "undo": "Desfazer", "italic": "Itálico", "fontName": "Nome da Fonte", "justifyLeft": "Alinhar pela Esquerda", "unlink": "Remover Link", "toggleTableBorder": "Alternar Moldura da Tabela", "fontSize": "Tamanho da Fonte", "indent": "Recuar", "redo": "Refazer", "strikethrough": "Tachado", "justifyFull": "Justificar", "justifyCenter": "Alinhar pelo Centro", "hiliteColor": "Cor de segundo plano", "deleteTable": "Excluir Tabela", "outdent": "Não-chanfrado", "cut": "Recortar", "plainFormatBlock": "Estilo de Parágrafo", "bold": "Negrito", "systemShortcutFF": "A ação \"${0}\" está disponível apenas no Mozilla Firefox utilizando um atalho do teclado. Utilize ${1}.", "justifyRight": "Alinhar pela Direita", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "Задать", "text": "Текст:", "title": "URL ссылки", "url": "URL:", "urlInvalidMessage": "Недопустимый адрес URL. Укажите полный URL, например: 'http://www.dojotoolkit.org'"})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "Удалить формат", "copy": "Копировать", "paste": "Вставить", "selectAll": "Выбрать все", "insertOrderedList": "Нумерованный список", "insertTable": "Вставить/изменить таблицу", "underline": "Подчеркивание", "foreColor": "Цвет текста", "htmlToggle": "Код HTML", "formatBlock": "Стиль абзаца", "insertHorizontalRule": "Горизонтальная линейка", "delete": "Удалить", "insertUnorderedList": "Список с маркерами", "tableProp": "Свойства таблицы", "insertImage": "Вставить изображение", "superscript": "Верхний индекс", "subscript": "Нижний индекс", "createLink": "Создать ссылку", "undo": "Отменить", "italic": "Курсив", "fontName": "Название шрифта", "justifyLeft": "По левому краю", "unlink": "Удалить ссылку", "toggleTableBorder": "Переключить рамку таблицы", "fontSize": "Размер шрифта", "indent": "Отступ", "redo": "Повторить", "strikethrough": "Перечеркивание", "justifyFull": "По ширине", "justifyCenter": "По центру", "hiliteColor": "Цвет фона", "deleteTable": "Удалить таблицу", "outdent": "Втяжка", "cut": "Вырезать", "plainFormatBlock": "Стиль абзаца", "bold": "Полужирный", "systemShortcutFF": "Действие \"${0}\" доступно в Mozilla Firefox только через сочетание клавиш. Используйте ${1}.", "justifyRight": "По правому краю", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "設定", "text": "文字:", "title": "鏈結 URL", "url": "URL:", "urlInvalidMessage": "URL 無效。請輸入完整的 URL,例如 'http://www.dojotoolkit.org'"})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "移除格式", "copy": "複製", "paste": "貼上", "selectAll": "全選", "insertOrderedList": "編號清單", "insertTable": "插入/編輯表格", "underline": "底線", "foreColor": "前景顏色", "htmlToggle": "HTML 原始檔", "formatBlock": "段落樣式", "insertHorizontalRule": "水平尺規", "delete": "刪除", "insertUnorderedList": "項目符號清單", "tableProp": "表格內容", "insertImage": "插入影像", "superscript": "上標", "subscript": "下標", "createLink": "建立鏈結", "undo": "復原", "italic": "斜體", "fontName": "字型名稱", "justifyLeft": "靠左對齊", "unlink": "移除鏈結", "toggleTableBorder": "切換表格邊框", "fontSize": "字型大小", "indent": "縮排", "redo": "重做", "strikethrough": "加刪除線", "justifyFull": "對齊", "justifyCenter": "置中對齊", "hiliteColor": "背景顏色", "deleteTable": "刪除表格", "outdent": "凸排", "cut": "剪下", "plainFormatBlock": "段落樣式", "bold": "粗體", "systemShortcutFF": "\"${0}\" 動作在 Mozilla Firefox 中,只能使用鍵盤快速鍵。使用 ${1}。", "justifyRight": "靠右對齊", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -0,0 +1 @@
|
||||
({"set": "设定", "text": "文本:", "title": "链接 URL", "url": "URL:", "urlInvalidMessage": "URL 无效。请输入完整的 URL,如“http://www.dojotoolkit.org”"})
|
||||
@@ -0,0 +1 @@
|
||||
({"removeFormat": "除去格式", "copy": "复制", "paste": "粘贴", "selectAll": "全选", "insertOrderedList": "编号列表", "insertTable": "插入/编辑表", "underline": "下划线", "foreColor": "前景色", "htmlToggle": "HTML 源代码", "formatBlock": "段落样式", "insertHorizontalRule": "水平线", "delete": "删除", "insertUnorderedList": "符号列表", "tableProp": "表属性", "insertImage": "插入图像", "superscript": "上标", "subscript": "下标", "createLink": "创建链接", "undo": "撤销", "italic": "斜体", "fontName": "字体名称", "justifyLeft": "左对齐", "unlink": "除去链接", "toggleTableBorder": "切换表边框", "fontSize": "字体大小", "indent": "增加缩进", "redo": "重做", "strikethrough": "删除线", "justifyFull": "对齐", "justifyCenter": "居中", "hiliteColor": "背景色", "deleteTable": "删除表", "outdent": "减少缩进", "cut": "剪切", "plainFormatBlock": "段落样式", "bold": "粗体", "systemShortcutFF": "只能在 Mozilla Firefox 中通过键盘快捷方式执行“${0}”操作。请使用 ${1}。", "justifyRight": "右对齐", "appleKey": "⌘${0}", "ctrlKey": "ctrl+${0}"})
|
||||
@@ -90,7 +90,7 @@ dojo.declare("dijit._editor.plugins.EnterKeyHandling",null,{
|
||||
// all supported browsers. See property blockNodeForEnter for available options
|
||||
if(!this.blockNodeForEnter){ return true; } //let browser handle this
|
||||
if(e.shiftKey //shift+enter always generates <br>
|
||||
|| this.blockNodeForEnter=='BR'){
|
||||
|| this.blockNodeForEnter=='BR'){
|
||||
var parent = dojo.withGlobal(this.editor.window, "getParentElement", dijit._editor.selection);
|
||||
var header = dijit.range.getAncestor(parent,this.editor.blockNodes);
|
||||
if(header){
|
||||
@@ -219,16 +219,16 @@ dojo.declare("dijit._editor.plugins.EnterKeyHandling",null,{
|
||||
if(typeof this.editor.document.__INSERTED_EDITIOR_NEWLINE_CSS == "undefined"){
|
||||
var lineFixingStyles = "p{margin:0 !important;}";
|
||||
var insertCssText = function(
|
||||
/*String*/ cssStr,
|
||||
/*Document*/ doc,
|
||||
/*String*/ cssStr,
|
||||
/*Document*/ doc,
|
||||
/*String*/ URI)
|
||||
{
|
||||
// summary:
|
||||
// Attempt to insert CSS rules into the document through inserting a
|
||||
// style element
|
||||
|
||||
|
||||
// DomNode Style = insertCssText(String ".dojoMenu {color: green;}"[, DomDoc document, dojo.uri.Uri Url ])
|
||||
if(!cssStr){
|
||||
if(!cssStr){
|
||||
return; // HTMLStyleElement
|
||||
}
|
||||
if(!doc){ doc = document; }
|
||||
@@ -240,14 +240,14 @@ dojo.declare("dijit._editor.plugins.EnterKeyHandling",null,{
|
||||
// IE is b0rken enough to require that we add the element to the doc
|
||||
// before changing it's properties
|
||||
var head = doc.getElementsByTagName("head")[0];
|
||||
if(!head){ // must have a head tag
|
||||
if(!head){ // must have a head tag
|
||||
console.debug("No head tag in document, aborting styles");
|
||||
return; // HTMLStyleElement
|
||||
}else{
|
||||
head.appendChild(style);
|
||||
}
|
||||
if(style.styleSheet){// IE
|
||||
var setFunc = function(){
|
||||
var setFunc = function(){
|
||||
try{
|
||||
style.styleSheet.cssText = cssStr;
|
||||
}catch(e){ dojo.debug(e); }
|
||||
@@ -277,7 +277,7 @@ dojo.declare("dijit._editor.plugins.EnterKeyHandling",null,{
|
||||
var newP = nodes[0].ownerDocument.createElement('p'); // FIXME: not very idiomatic
|
||||
nodes[0].parentNode.insertBefore(newP, nodes[0]);
|
||||
for(var i=0; i<nodes.length; i++){
|
||||
newP.appendChild(nodes[i]);
|
||||
newP.appendChild(nodes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -309,11 +309,11 @@ dojo.declare("dijit._editor.plugins.EnterKeyHandling",null,{
|
||||
}
|
||||
|
||||
function splitP(el){
|
||||
// split a paragraph into seperate paragraphs at BRs
|
||||
var currentNode = null;
|
||||
var trailingNodes = [];
|
||||
var lastNodeIndex = el.childNodes.length-1;
|
||||
for(var i=lastNodeIndex; i>=0; i--){
|
||||
// split a paragraph into seperate paragraphs at BRs
|
||||
var currentNode = null;
|
||||
var trailingNodes = [];
|
||||
var lastNodeIndex = el.childNodes.length-1;
|
||||
for(var i=lastNodeIndex; i>=0; i--){
|
||||
currentNode = el.childNodes[i];
|
||||
if(currentNode.nodeName=="BR"){
|
||||
var newP = currentNode.ownerDocument.createElement('p');
|
||||
@@ -329,7 +329,7 @@ dojo.declare("dijit._editor.plugins.EnterKeyHandling",null,{
|
||||
}else{
|
||||
trailingNodes.unshift(currentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var pList = [];
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
if(!dojo._hasResource["dijit._editor.plugins.FontChoice"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dijit._editor.plugins.FontChoice"] = true;
|
||||
dojo.provide("dijit._editor.plugins.FontChoice");
|
||||
|
||||
dojo.require("dijit._editor._Plugin");
|
||||
dojo.require("dijit.form.FilteringSelect");
|
||||
dojo.require("dojo.data.ItemFileReadStore");
|
||||
dojo.require("dojo.i18n");
|
||||
|
||||
dojo.requireLocalization("dijit._editor", "FontChoice", null, "ROOT");
|
||||
|
||||
dojo.declare("dijit._editor.plugins.FontChoice",
|
||||
dijit._editor._Plugin,
|
||||
{
|
||||
_uniqueId: 0,
|
||||
|
||||
buttonClass: dijit.form.FilteringSelect,
|
||||
|
||||
_initButton: function(){
|
||||
this.inherited("_initButton", arguments);
|
||||
|
||||
//TODO: do we need nls for font names? provide css font lists? or otherwise make this more configurable?
|
||||
var names = {
|
||||
fontName: ["serif", "sans-serif", "monospaced", "cursive", "fantasy"],
|
||||
fontSize: [1,2,3,4,5,6,7],
|
||||
formatBlock: ["p", "h1", "h2", "h3", "pre"] }[this.command];
|
||||
var strings = dojo.i18n.getLocalization("dijit._editor", "FontChoice");
|
||||
var items = dojo.map(names, function(x){ return { name: strings[x], value: x }; });
|
||||
items.push({name:"", value:""}); // FilteringSelect doesn't like unmatched blank strings
|
||||
this.button.store = new dojo.data.ItemFileReadStore(
|
||||
{ data: { identifier: "value",
|
||||
items: items }
|
||||
});
|
||||
this.button.setValue("");
|
||||
|
||||
dojo.connect(this.button, "onChange", this, function(choice){
|
||||
this.editor.execCommand(this.command, choice);
|
||||
});
|
||||
},
|
||||
|
||||
updateState: function(){
|
||||
this.inherited("updateState", arguments);
|
||||
var _e = this.editor;
|
||||
var _c = this.command;
|
||||
if(!_e || !_e.isLoaded || !_c.length){ return; }
|
||||
if(this.button){
|
||||
var value = _e.queryCommandValue(_c);
|
||||
this.button.setValue(value);
|
||||
}
|
||||
},
|
||||
|
||||
setToolbar: function(){
|
||||
this.inherited("setToolbar", arguments);
|
||||
|
||||
var forRef = this.button;
|
||||
if(!forRef.id){ forRef.id = "dijitEditorButton-"+this.command+(this._uniqueId++); } //TODO: is this necessary? FilteringSelects always seem to have an id?
|
||||
var label = dojo.doc.createElement("label");
|
||||
label.setAttribute("for", forRef.id);
|
||||
var strings = dojo.i18n.getLocalization("dijit._editor", "FontChoice");
|
||||
label.appendChild(dojo.doc.createTextNode(strings[this.command]));
|
||||
dojo.place(label, this.button.domNode, "before");
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
@@ -10,7 +10,7 @@ dojo.require("dijit.form.Button");
|
||||
dojo.require("dijit.form.ValidationTextBox");
|
||||
dojo.require("dojo.i18n");
|
||||
dojo.require("dojo.string");
|
||||
dojo.requireLocalization("dijit._editor", "LinkDialog", null, "ROOT");
|
||||
dojo.requireLocalization("dijit._editor", "LinkDialog", null, "ko,zh,ja,zh-tw,ru,it,ROOT,hu,fr,pt,pl,es,de,cs");
|
||||
|
||||
dojo.declare("dijit._editor.plugins.DualStateDropDownButton",
|
||||
dijit.form.DropDownButton,
|
||||
@@ -31,7 +31,7 @@ dojo.declare("dijit._editor.plugins.UrlTextBox",
|
||||
required: true,
|
||||
|
||||
postMixInProperties: function(){
|
||||
dijit._editor.plugins.UrlTextBox.superclass.postMixInProperties.apply(this, arguments);
|
||||
this.inherited("postMixInProperties", arguments);
|
||||
this.invalidMessage = dojo.i18n.getLocalization("dijit._editor", "LinkDialog", this.lang).urlInvalidMessage;
|
||||
},
|
||||
|
||||
@@ -44,11 +44,12 @@ dojo.declare("dijit._editor.plugins.UrlTextBox",
|
||||
}
|
||||
);
|
||||
|
||||
dojo.declare("dijit._editor.plugins.LinkDialog",
|
||||
dijit._editor._Plugin,
|
||||
dojo.declare("dijit._editor.plugins.LinkDialog",
|
||||
dijit._editor._Plugin,
|
||||
{
|
||||
buttonClass: dijit._editor.plugins.DualStateDropDownButton,
|
||||
|
||||
useDefaultCommand: false,
|
||||
command: "createLink",
|
||||
linkDialogTemplate: [
|
||||
"<label for='urlInput'>${url} </label>",
|
||||
"<input dojoType=dijit._editor.plugins.UrlTextBox name='urlInput'><br>",
|
||||
@@ -58,12 +59,6 @@ dojo.declare("dijit._editor.plugins.LinkDialog",
|
||||
"<button dojoType=dijit.form.Button type='submit'>${set}</button>"
|
||||
].join(""),
|
||||
|
||||
useDefaultCommand: false,
|
||||
|
||||
command: "createLink",
|
||||
|
||||
dropDown: null,
|
||||
|
||||
constructor: function(){
|
||||
var _this = this;
|
||||
var messages = dojo.i18n.getLocalization("dijit._editor", "LinkDialog", this.lang);
|
||||
@@ -82,7 +77,7 @@ dojo.declare("dijit._editor.plugins.LinkDialog",
|
||||
this.dropDown.setContent(dojo.string.substitute(this.linkDialogTemplate, messages));
|
||||
this.dropDown.startup();
|
||||
},
|
||||
|
||||
|
||||
setValue: function(args){
|
||||
// summary: callback from the dialog when user hits "set" button
|
||||
//TODO: prevent closing popup if the text is empty
|
||||
@@ -145,7 +140,7 @@ dojo.declare("dijit._editor.plugins.LinkDialog",
|
||||
var hasA = dojo.withGlobal(this.editor.window, "hasAncestorElement",dijit._editor.selection, ['a']);
|
||||
this.button.setChecked(hasA);
|
||||
}catch(e){
|
||||
console.debug(e);
|
||||
console.debug(e); //FIXME: probably shouldn't squelch an exception here
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
if(!dojo._hasResource["dijit._editor.plugins.TextColor"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dijit._editor.plugins.TextColor"] = true;
|
||||
dojo.provide("dijit._editor.plugins.TextColor");
|
||||
|
||||
dojo.require("dijit._editor._Plugin");
|
||||
dojo.require("dijit.ColorPalette");
|
||||
|
||||
dojo.declare("dijit._editor.plugins.TextColor",
|
||||
dijit._editor._Plugin,
|
||||
{
|
||||
buttonClass: dijit.form.DropDownButton,
|
||||
|
||||
//TODO: set initial focus/selection state?
|
||||
|
||||
constructor: function(){
|
||||
this.dropDown = new dijit.ColorPalette();
|
||||
dojo.connect(this.dropDown, "onChange", this, function(color){
|
||||
this.editor.execCommand(this.command, color);
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
@@ -101,7 +101,7 @@ dijit.range.getAncestor = function(/*DomNode*/node, /*RegEx?*/regex, /*DomNode?*
|
||||
if(regex.test(name)){
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
return null;
|
||||
@@ -120,7 +120,7 @@ dijit.range.getBlockAncestor = function(/*DomNode*/node, /*RegEx?*/regex, /*DomN
|
||||
if(!blockContainer && (/^(?:BODY|TD|TH|CAPTION)$/).test(name)){
|
||||
blockContainer = node;
|
||||
}
|
||||
|
||||
|
||||
node = node.parentNode;
|
||||
}
|
||||
return {blockNode:block, blockContainer:blockContainer || node.ownerDocument.body};
|
||||
@@ -218,7 +218,7 @@ dijit.range.getSelection = function(win, /*Boolean?*/ignoreUpdate){
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!dijit.range._w3c){
|
||||
dijit.range.ie={
|
||||
cachedSelection: {},
|
||||
@@ -378,7 +378,7 @@ if(!dijit.range._w3c){
|
||||
if(offset > 0){
|
||||
var node = container.childNodes[offset-1];
|
||||
if(node.nodeType==3){
|
||||
container = node;
|
||||
container = node;
|
||||
offset = node.length;
|
||||
//pass through
|
||||
}else{
|
||||
@@ -412,7 +412,7 @@ if(!dijit.range._w3c){
|
||||
atmrange.collapse(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return atmrange;
|
||||
},
|
||||
decomposeTextRange: function(range){
|
||||
@@ -430,7 +430,7 @@ if(!dijit.range._w3c){
|
||||
}
|
||||
return [[startContainter, startOffset],[endContainter, endOffset], range.parentElement()];
|
||||
},
|
||||
setRange: function(range, startContainter,
|
||||
setRange: function(range, startContainter,
|
||||
startOffset, endContainter, endOffset, check){
|
||||
var startrange = dijit.range.ie.setEndPoint(range, startContainter, startOffset);
|
||||
range.setEndPoint('StartToStart', startrange);
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
>
|
||||
<div dojoAttachPoint="contentNode" class="dijitTreeContent" waiRole="presentation">
|
||||
<div dojoAttachPoint="iconNode" class="dijitInline dijitTreeIcon" waiRole="presentation"></div>
|
||||
<span dojoAttachPoint=labelNode class="dijitTreeLabel" wairole="treeitem" expanded="true" tabindex="-1"></span>
|
||||
<span dojoAttachPoint="labelNode" class="dijitTreeLabel" wairole="treeitem" tabindex="-1"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
<div class="dijitTreeContainer" style="" waiRole="tree"
|
||||
dojoAttachEvent="onclick:_onClick,onkeypress:_onKeyPress"
|
||||
></div>
|
||||
dojoAttachEvent="onclick:_onClick,onkeypress:_onKeyPress">
|
||||
<div class="dijitTreeNode dijitTreeIsRoot dijitTreeExpandLeaf dijitTreeChildrenNo" waiRole="presentation"
|
||||
dojoAttachPoint="rowNode"
|
||||
><span dojoAttachPoint="expandoNode" class="dijitTreeExpando" waiRole="presentation"
|
||||
></span
|
||||
><span dojoAttachPoint="expandoNodeText" class="dijitExpandoText" waiRole="presentation"
|
||||
></span
|
||||
>
|
||||
<div dojoAttachPoint="contentNode" class="dijitTreeContent" waiRole="presentation">
|
||||
<div dojoAttachPoint="iconNode" class="dijitInline dijitTreeIcon" waiRole="presentation"></div>
|
||||
<span dojoAttachPoint="labelNode" class="dijitTreeLabel" wairole="treeitem" tabindex="0"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
146
spring-faces/src/main/java/META-INF/dijit/_tree/dndContainer.js
Normal file
146
spring-faces/src/main/java/META-INF/dijit/_tree/dndContainer.js
Normal file
@@ -0,0 +1,146 @@
|
||||
if(!dojo._hasResource["dijit._tree.dndContainer"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dijit._tree.dndContainer"] = true;
|
||||
dojo.provide("dijit._tree.dndContainer");
|
||||
dojo.require("dojo.dnd.common");
|
||||
dojo.require("dojo.dnd.Container");
|
||||
|
||||
dojo.declare("dijit._tree.dndContainer",
|
||||
null,
|
||||
{
|
||||
constructor: function(tree, params){
|
||||
// summary: a constructor of the Container
|
||||
// tree: Node: node or node's id to build the container on
|
||||
// params: Object: a dict of parameters, which gets mixed into the object
|
||||
this.tree = tree;
|
||||
this.node = tree.domNode;
|
||||
dojo.mixin(this, params);
|
||||
|
||||
// class-specific variables
|
||||
this.map = {};
|
||||
this.current = null;
|
||||
|
||||
// states
|
||||
this.ContainerState = "";
|
||||
dojo.addClass(this.node, "dojoDndContainer");
|
||||
|
||||
// mark up children
|
||||
if(!(params && params._skipStartup)){
|
||||
this.startup();
|
||||
}
|
||||
|
||||
// set up events
|
||||
this.events = [
|
||||
dojo.connect(this.node, "onmouseover", this, "onMouseOver"),
|
||||
dojo.connect(this.node, "onmouseout", this, "onMouseOut"),
|
||||
|
||||
// cancel text selection and text dragging
|
||||
dojo.connect(this.node, "ondragstart", dojo, "stopEvent"),
|
||||
dojo.connect(this.node, "onselectstart", dojo, "stopEvent")
|
||||
];
|
||||
},
|
||||
|
||||
|
||||
// abstract access to the map
|
||||
getItem: function(/*String*/ key){
|
||||
// summary: returns a data item by its key (id)
|
||||
//console.log("Container getItem()", arguments,this.map, this.map[key], this.selection[key]);
|
||||
return this.selection[key];
|
||||
//return this.map[key]; // Object
|
||||
},
|
||||
|
||||
// mouse events
|
||||
onMouseOver: function(e){
|
||||
// summary: event processor for onmouseover
|
||||
// e: Event: mouse event
|
||||
var n = e.relatedTarget;
|
||||
while(n){
|
||||
if(n == this.node){ break; }
|
||||
try{
|
||||
n = n.parentNode;
|
||||
}catch(x){
|
||||
n = null;
|
||||
}
|
||||
}
|
||||
if(!n){
|
||||
this._changeState("Container", "Over");
|
||||
this.onOverEvent();
|
||||
}
|
||||
n = this._getChildByEvent(e);
|
||||
if(this.current == n){ return; }
|
||||
if(this.current){ this._removeItemClass(this.current, "Over"); }
|
||||
if(n){ this._addItemClass(n, "Over"); }
|
||||
this.current = n;
|
||||
},
|
||||
|
||||
onMouseOut: function(e){
|
||||
// summary: event processor for onmouseout
|
||||
// e: Event: mouse event
|
||||
for(var n = e.relatedTarget; n;){
|
||||
if(n == this.node){ return; }
|
||||
try{
|
||||
n = n.parentNode;
|
||||
}catch(x){
|
||||
n = null;
|
||||
}
|
||||
}
|
||||
if(this.current){
|
||||
this._removeItemClass(this.current, "Over");
|
||||
this.current = null;
|
||||
}
|
||||
this._changeState("Container", "");
|
||||
this.onOutEvent();
|
||||
},
|
||||
|
||||
_changeState: function(type, newState){
|
||||
// summary: changes a named state to new state value
|
||||
// type: String: a name of the state to change
|
||||
// newState: String: new state
|
||||
var prefix = "dojoDnd" + type;
|
||||
var state = type.toLowerCase() + "State";
|
||||
//dojo.replaceClass(this.node, prefix + newState, prefix + this[state]);
|
||||
dojo.removeClass(this.node, prefix + this[state]);
|
||||
dojo.addClass(this.node, prefix + newState);
|
||||
this[state] = newState;
|
||||
},
|
||||
|
||||
_getChildByEvent: function(e){
|
||||
// summary: gets a child, which is under the mouse at the moment, or null
|
||||
// e: Event: a mouse event
|
||||
var node = e.target;
|
||||
|
||||
if (node && dojo.hasClass(node,"dijitTreeLabel")){
|
||||
return node;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
markupFactory: function(tree, params){
|
||||
params._skipStartup = true;
|
||||
return new dijit._tree.dndContainer(tree, params);
|
||||
},
|
||||
|
||||
_addItemClass: function(node, type){
|
||||
// summary: adds a class with prefix "dojoDndItem"
|
||||
// node: Node: a node
|
||||
// type: String: a variable suffix for a class name
|
||||
dojo.addClass(node, "dojoDndItem" + type);
|
||||
},
|
||||
|
||||
_removeItemClass: function(node, type){
|
||||
// summary: removes a class with prefix "dojoDndItem"
|
||||
// node: Node: a node
|
||||
// type: String: a variable suffix for a class name
|
||||
dojo.removeClass(node, "dojoDndItem" + type);
|
||||
},
|
||||
|
||||
onOverEvent: function(){
|
||||
// summary: this function is called once, when mouse is over our container
|
||||
console.log("onOverEvent parent");
|
||||
},
|
||||
|
||||
onOutEvent: function(){
|
||||
// summary: this function is called once, when mouse is out of our container
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
171
spring-faces/src/main/java/META-INF/dijit/_tree/dndSelector.js
Normal file
171
spring-faces/src/main/java/META-INF/dijit/_tree/dndSelector.js
Normal file
@@ -0,0 +1,171 @@
|
||||
if(!dojo._hasResource["dijit._tree.dndSelector"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dijit._tree.dndSelector"] = true;
|
||||
dojo.provide("dijit._tree.dndSelector");
|
||||
dojo.require("dojo.dnd.common");
|
||||
dojo.require("dijit._tree.dndContainer");
|
||||
|
||||
dojo.declare("dijit._tree.dndSelector",
|
||||
dijit._tree.dndContainer,
|
||||
{
|
||||
constructor: function(tree, params){
|
||||
this.selection={};
|
||||
this.anchor = null;
|
||||
this.simpleSelection=false;
|
||||
|
||||
this.events.push(
|
||||
dojo.connect(this.tree.domNode, "onmousedown", this,"onMouseDown"),
|
||||
dojo.connect(this.tree.domNode, "onmouseup", this,"onMouseUp")
|
||||
);
|
||||
},
|
||||
|
||||
// object attributes (for markup)
|
||||
singular: false, // is singular property
|
||||
|
||||
// methods
|
||||
getSelectedItems: function(){
|
||||
var selectedItems = []
|
||||
for (var i in this.selection){
|
||||
selectedItems.push(dijit.getEnclosingWidget(this.selection[i]).item);
|
||||
}
|
||||
return selectedItems;
|
||||
},
|
||||
|
||||
getSelectedNodes: function(){
|
||||
return this.selection;
|
||||
},
|
||||
|
||||
selectNone: function(){
|
||||
// summary: unselects all items
|
||||
return this._removeSelection()._removeAnchor(); // self
|
||||
},
|
||||
|
||||
insertItems: function(item, parent){
|
||||
// summary: inserts new data items (see Container's insertNodes method for details)
|
||||
|
||||
//we actually need to add things to the store here instead of adding noes to the tree directly
|
||||
},
|
||||
|
||||
destroy: function(){
|
||||
// summary: prepares the object to be garbage-collected
|
||||
dojo.dnd.Selector.superclass.destroy.call(this);
|
||||
this.selection = this.anchor = null;
|
||||
},
|
||||
|
||||
// mouse events
|
||||
onMouseDown: function(e){
|
||||
// summary: event processor for onmousedown
|
||||
// e: Event: mouse event
|
||||
if(!this.current){ return; }
|
||||
|
||||
var item = dijit.getEnclosingWidget(this.current).item
|
||||
var id = this.tree.store.getIdentity(item);
|
||||
|
||||
if (!this.current.id) {
|
||||
this.current.id=id;
|
||||
}
|
||||
|
||||
if (!this.current.type) {
|
||||
this.current.type="data";
|
||||
}
|
||||
|
||||
if(!this.singular && !dojo.dnd.getCopyKeyState(e) && !e.shiftKey && (this.current.id in this.selection)){
|
||||
this.simpleSelection = true;
|
||||
dojo.stopEvent(e);
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.singular){
|
||||
if(this.anchor == this.current){
|
||||
if(dojo.dnd.getCopyKeyState(e)){
|
||||
this.selectNone();
|
||||
}
|
||||
}else{
|
||||
this.selectNone();
|
||||
this.anchor = this.current;
|
||||
this._addItemClass(this.anchor, "Anchor");
|
||||
|
||||
this.selection[this.current.id] = this.current;
|
||||
}
|
||||
}else{
|
||||
if(!this.singular && e.shiftKey){
|
||||
if (dojo.dnd.getCopyKeyState(e)){
|
||||
//TODO add range to selection
|
||||
}else{
|
||||
//TODO select new range from anchor
|
||||
}
|
||||
}else{
|
||||
if(dojo.dnd.getCopyKeyState(e)){
|
||||
if(this.anchor == this.current){
|
||||
delete this.selection[this.anchor.id];
|
||||
this._removeAnchor();
|
||||
}else{
|
||||
if(this.current.id in this.selection){
|
||||
this._removeItemClass(this.current, "Selected");
|
||||
delete this.selection[this.current.id];
|
||||
}else{
|
||||
if(this.anchor){
|
||||
this._removeItemClass(this.anchor, "Anchor");
|
||||
this._addItemClass(this.anchor, "Selected");
|
||||
}
|
||||
this.anchor = this.current;
|
||||
this._addItemClass(this.current, "Anchor");
|
||||
this.selection[this.current.id] = this.current;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
var item = dijit.getEnclosingWidget(this.current).item
|
||||
var id = this.tree.store.getIdentity(item);
|
||||
if(!(id in this.selection)){
|
||||
this.selectNone();
|
||||
this.anchor = this.current;
|
||||
this._addItemClass(this.current, "Anchor");
|
||||
this.selection[id] = this.current;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dojo.stopEvent(e);
|
||||
},
|
||||
|
||||
onMouseMove: function() {
|
||||
|
||||
},
|
||||
|
||||
onOverEvent: function() {
|
||||
this.onmousemoveEvent = dojo.connect(this.node, "onmousemove", this, "onMouseMove");
|
||||
},
|
||||
|
||||
onMouseUp: function(e){
|
||||
// summary: event processor for onmouseup
|
||||
// e: Event: mouse event
|
||||
if(!this.simpleSelection){ return; }
|
||||
this.simpleSelection = false;
|
||||
this.selectNone();
|
||||
if(this.current){
|
||||
this.anchor = this.current;
|
||||
this._addItemClass(this.anchor, "Anchor");
|
||||
this.selection[this.current.id] = this.current;
|
||||
}
|
||||
},
|
||||
_removeSelection: function(){
|
||||
// summary: unselects all items
|
||||
var e = dojo.dnd._empty;
|
||||
for(var i in this.selection){
|
||||
if(i in e){ continue; }
|
||||
var node = dojo.byId(i);
|
||||
if(node){ this._removeItemClass(node, "Selected"); }
|
||||
}
|
||||
this.selection = {};
|
||||
return this; // self
|
||||
},
|
||||
_removeAnchor: function(){
|
||||
if(this.anchor){
|
||||
this._removeItemClass(this.anchor, "Anchor");
|
||||
this.anchor = null;
|
||||
}
|
||||
return this; // self
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
346
spring-faces/src/main/java/META-INF/dijit/_tree/dndSource.js
Normal file
346
spring-faces/src/main/java/META-INF/dijit/_tree/dndSource.js
Normal file
@@ -0,0 +1,346 @@
|
||||
if(!dojo._hasResource["dijit._tree.dndSource"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dijit._tree.dndSource"] = true;
|
||||
dojo.provide("dijit._tree.dndSource");
|
||||
|
||||
dojo.require("dijit._tree.dndSelector");
|
||||
dojo.require("dojo.dnd.Manager");
|
||||
|
||||
dojo.declare("dijit._tree.dndSource", dijit._tree.dndSelector, {
|
||||
// summary: a Source object, which can be used as a DnD source, or a DnD target
|
||||
|
||||
// object attributes (for markup)
|
||||
isSource: true,
|
||||
copyOnly: false,
|
||||
skipForm: false,
|
||||
accept: ["text"],
|
||||
|
||||
constructor: function(node, params){
|
||||
// summary: a constructor of the Source
|
||||
// node: Node: node or node's id to build the source on
|
||||
// params: Object: a dict of parameters, recognized parameters are:
|
||||
// isSource: Boolean: can be used as a DnD source, if true; assumed to be "true" if omitted
|
||||
// accept: Array: list of accepted types (text strings) for a target; assumed to be ["text"] if omitted
|
||||
// horizontal: Boolean: a horizontal container, if true, vertical otherwise or when omitted
|
||||
// copyOnly: Boolean: always copy items, if true, use a state of Ctrl key otherwise
|
||||
// skipForm: Boolean: don't start the drag operation, if clicked on form elements
|
||||
// the rest of parameters are passed to the selector
|
||||
if(!params){ params = {}; }
|
||||
dojo.mixin(this, params);
|
||||
this.isSource = typeof params.isSource == "undefined" ? true : params.isSource;
|
||||
var type = params.accept instanceof Array ? params.accept : ["text"];
|
||||
this.accept = null;
|
||||
if(type.length){
|
||||
this.accept = {};
|
||||
for(var i = 0; i < type.length; ++i){
|
||||
this.accept[type[i]] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// class-specific variables
|
||||
this.isDragging = false;
|
||||
this.mouseDown = false;
|
||||
this.targetAnchor = null;
|
||||
this.targetBox = null;
|
||||
this.before = true;
|
||||
|
||||
// states
|
||||
this.sourceState = "";
|
||||
if(this.isSource){
|
||||
dojo.addClass(this.node, "dojoDndSource");
|
||||
}
|
||||
this.targetState = "";
|
||||
if(this.accept){
|
||||
dojo.addClass(this.node, "dojoDndTarget");
|
||||
}
|
||||
if(this.horizontal){
|
||||
dojo.addClass(this.node, "dojoDndHorizontal");
|
||||
}
|
||||
// set up events
|
||||
this.topics = [
|
||||
dojo.subscribe("/dnd/source/over", this, "onDndSourceOver"),
|
||||
dojo.subscribe("/dnd/start", this, "onDndStart"),
|
||||
dojo.subscribe("/dnd/drop", this, "onDndDrop"),
|
||||
dojo.subscribe("/dnd/cancel", this, "onDndCancel")
|
||||
];
|
||||
},
|
||||
|
||||
startup: function(){
|
||||
},
|
||||
|
||||
// methods
|
||||
checkAcceptance: function(source, nodes){
|
||||
// summary: checks, if the target can accept nodes from this source
|
||||
// source: Object: the source which provides items
|
||||
// nodes: Array: the list of transferred items
|
||||
return true; // Boolean
|
||||
},
|
||||
copyState: function(keyPressed){
|
||||
// summary: Returns true, if we need to copy items, false to move.
|
||||
// It is separated to be overwritten dynamically, if needed.
|
||||
// keyPressed: Boolean: the "copy" was pressed
|
||||
return this.copyOnly || keyPressed; // Boolean
|
||||
},
|
||||
destroy: function(){
|
||||
// summary: prepares the object to be garbage-collected
|
||||
this.inherited("destroy",arguments);
|
||||
dojo.forEach(this.topics, dojo.unsubscribe);
|
||||
this.targetAnchor = null;
|
||||
},
|
||||
|
||||
// markup methods
|
||||
markupFactory: function(params, node){
|
||||
params._skipStartup = true;
|
||||
return new dijit._tree.dndSource(node, params);
|
||||
},
|
||||
|
||||
// mouse event processors
|
||||
onMouseMove: function(e){
|
||||
// summary: event processor for onmousemove
|
||||
// e: Event: mouse event
|
||||
if(this.isDragging && this.targetState == "Disabled"){ return; }
|
||||
this.inherited("onMouseMove", arguments);
|
||||
var m = dojo.dnd.manager();
|
||||
if(this.isDragging){
|
||||
// calculate before/after
|
||||
|
||||
if (this.allowBetween){ // not implemented yet for tree since it has no concept of order
|
||||
var before = false;
|
||||
if(this.current){
|
||||
if(!this.targetBox || this.targetAnchor != this.current){
|
||||
this.targetBox = {
|
||||
xy: dojo.coords(this.current, true),
|
||||
w: this.current.offsetWidth,
|
||||
h: this.current.offsetHeight
|
||||
};
|
||||
}
|
||||
if(this.horizontal){
|
||||
before = (e.pageX - this.targetBox.xy.x) < (this.targetBox.w / 2);
|
||||
}else{
|
||||
before = (e.pageY - this.targetBox.xy.y) < (this.targetBox.h / 2);
|
||||
}
|
||||
}
|
||||
if(this.current != this.targetAnchor || before != this.before){
|
||||
this._markTargetAnchor(before);
|
||||
m.canDrop(!this.current || m.source != this || !(this.current.id in this.selection));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(this.mouseDown && this.isSource){
|
||||
var n = this.getSelectedNodes();
|
||||
var nodes=[];
|
||||
for (var i in n){
|
||||
nodes.push(n[i]);
|
||||
}
|
||||
if(nodes.length){
|
||||
m.startDrag(this, nodes, this.copyState(dojo.dnd.getCopyKeyState(e)));
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
onMouseDown: function(e){
|
||||
// summary: event processor for onmousedown
|
||||
// e: Event: mouse event
|
||||
this.mouseDown = true;
|
||||
this.inherited("onMouseDown",arguments);
|
||||
},
|
||||
|
||||
onMouseUp: function(e){
|
||||
// summary: event processor for onmouseup
|
||||
// e: Event: mouse event
|
||||
if(this.mouseDown){
|
||||
this.mouseDown = false;
|
||||
this.inherited("onMouseUp",arguments);
|
||||
}
|
||||
},
|
||||
|
||||
onMouseOver: function(e){
|
||||
// summary: event processor for onmouseover
|
||||
// e: Event: mouse event
|
||||
var n = e.relatedTarget;
|
||||
while(n){
|
||||
if(n == this.node){ break; }
|
||||
try{
|
||||
n = n.parentNode;
|
||||
}catch(x){
|
||||
n = null;
|
||||
}
|
||||
}
|
||||
if(!n){
|
||||
this._changeState("Container", "Over");
|
||||
this.onOverEvent();
|
||||
}
|
||||
n = this._getChildByEvent(e);
|
||||
if(this.current == n){ return; }
|
||||
if(this.current){ this._removeItemClass(this.current, "Over"); }
|
||||
if(n){
|
||||
this._addItemClass(n, "Over");
|
||||
if (this.isDragging){
|
||||
var m = dojo.dnd.manager();
|
||||
if (this.checkItemAcceptance(n,m.source)){
|
||||
m.canDrop(this.targetState != "Disabled" && (!this.current || m.source != this || !(this.current.id in this.selection)));
|
||||
}else{
|
||||
m.canDrop(false);
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
if (this.isDragging ){
|
||||
var m = dojo.dnd.manager();
|
||||
if (m.source && this.checkAcceptance(m.source,m.source.getSelectedNodes())){
|
||||
m.canDrop(this.targetState != "Disabled" && (!this.current || m.source != this || !(this.current.id in this.selection)));
|
||||
}else{
|
||||
m.canDrop(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.current = n;
|
||||
},
|
||||
|
||||
checkItemAcceptance: function(node, source){
|
||||
// summary: stub funciton to be overridden if one wants to check for the ability to drop at the node/item level
|
||||
return true;
|
||||
},
|
||||
|
||||
// topic event processors
|
||||
onDndSourceOver: function(source){
|
||||
// summary: topic event processor for /dnd/source/over, called when detected a current source
|
||||
// source: Object: the source which has the mouse over it
|
||||
if(this != source){
|
||||
this.mouseDown = false;
|
||||
if(this.targetAnchor){
|
||||
this._unmarkTargetAnchor();
|
||||
}
|
||||
}else if(this.isDragging){
|
||||
var m = dojo.dnd.manager();
|
||||
m.canDrop(this.targetState != "Disabled" && (!this.current || m.source != this || !(this.current.id in this.selection)));
|
||||
}
|
||||
},
|
||||
onDndStart: function(source, nodes, copy){
|
||||
// summary: topic event processor for /dnd/start, called to initiate the DnD operation
|
||||
// source: Object: the source which provides items
|
||||
// nodes: Array: the list of transferred items
|
||||
// copy: Boolean: copy items, if true, move items otherwise
|
||||
|
||||
console.log("onDndStart");
|
||||
if(this.isSource){
|
||||
this._changeState("Source", this == source ? (copy ? "Copied" : "Moved") : "");
|
||||
}
|
||||
var accepted = this.checkAcceptance(source, nodes);
|
||||
|
||||
this._changeState("Target", accepted ? "" : "Disabled");
|
||||
|
||||
if(accepted){
|
||||
dojo.dnd.manager().overSource(this);
|
||||
}
|
||||
|
||||
this.isDragging = true;
|
||||
console.log("isDragging=true now");
|
||||
},
|
||||
|
||||
itemCreator: function(nodes){
|
||||
var items = []
|
||||
|
||||
for(var i=0;i<nodes.length;i++){
|
||||
items.push({
|
||||
"name":nodes[i].textContent,
|
||||
"id": nodes[i].id
|
||||
});
|
||||
}
|
||||
|
||||
return items;
|
||||
},
|
||||
|
||||
onDndDrop: function(source, nodes, copy){
|
||||
// summary: topic event processor for /dnd/drop, called to finish the DnD operation
|
||||
// source: Object: the source which provides items
|
||||
// nodes: Array: the list of transferred items
|
||||
// copy: Boolean: copy items, if true, move items otherwise
|
||||
|
||||
if (this.containerState=="Over"){
|
||||
this.isDragging=false;
|
||||
var target= this.current;
|
||||
var items = this.itemCreator(nodes, target);
|
||||
if (!target || target==this.tree.domNode){
|
||||
for (var i=0; i<items.length;i++){
|
||||
this.tree.store.newItem(items[i],null);
|
||||
}
|
||||
}else {
|
||||
for (var i=0; i<items.length;i++){
|
||||
pInfo={parent:dijit.getEnclosingWidget(target).item, attribute:"children"};
|
||||
var newItem = this.tree.store.newItem(items[i],pInfo);
|
||||
console.log("newItem: ", newItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onDndCancel: function(){
|
||||
// summary: topic event processor for /dnd/cancel, called to cancel the DnD operation
|
||||
if(this.targetAnchor){
|
||||
this._unmarkTargetAnchor();
|
||||
this.targetAnchor = null;
|
||||
}
|
||||
this.before = true;
|
||||
this.isDragging = false;
|
||||
this.mouseDown = false;
|
||||
this._changeState("Source", "");
|
||||
this._changeState("Target", "");
|
||||
},
|
||||
|
||||
// utilities
|
||||
|
||||
onOverEvent: function(){
|
||||
// summary: this function is called once, when mouse is over our container
|
||||
this.inherited("onOverEvent",arguments);
|
||||
dojo.dnd.manager().overSource(this);
|
||||
},
|
||||
onOutEvent: function(){
|
||||
// summary: this function is called once, when mouse is out of our container
|
||||
this.inherited("onOutEvent",arguments);
|
||||
dojo.dnd.manager().outSource(this);
|
||||
},
|
||||
_markTargetAnchor: function(before){
|
||||
// summary: assigns a class to the current target anchor based on "before" status
|
||||
// before: Boolean: insert before, if true, after otherwise
|
||||
if(this.current == this.targetAnchor && this.before == before){ return; }
|
||||
if(this.targetAnchor){
|
||||
this._removeItemClass(this.targetAnchor, this.before ? "Before" : "After");
|
||||
}
|
||||
this.targetAnchor = this.current;
|
||||
this.targetBox = null;
|
||||
this.before = before;
|
||||
if(this.targetAnchor){
|
||||
this._addItemClass(this.targetAnchor, this.before ? "Before" : "After");
|
||||
}
|
||||
},
|
||||
_unmarkTargetAnchor: function(){
|
||||
// summary: removes a class of the current target anchor based on "before" status
|
||||
if(!this.targetAnchor){ return; }
|
||||
this._removeItemClass(this.targetAnchor, this.before ? "Before" : "After");
|
||||
this.targetAnchor = null;
|
||||
this.targetBox = null;
|
||||
this.before = true;
|
||||
},
|
||||
_markDndStatus: function(copy){
|
||||
// summary: changes source's state based on "copy" status
|
||||
this._changeState("Source", copy ? "Copied" : "Moved");
|
||||
}
|
||||
});
|
||||
|
||||
dojo.declare("dijit._tree.dndTarget", dijit._tree.dndSource, {
|
||||
// summary: a Target object, which can be used as a DnD target
|
||||
|
||||
constructor: function(node, params){
|
||||
// summary: a constructor of the Target --- see the Source constructor for details
|
||||
this.isSource = false;
|
||||
dojo.removeClass(this.node, "dojoDndSource");
|
||||
},
|
||||
|
||||
// markup methods
|
||||
markupFactory: function(params, node){
|
||||
params._skipStartup = true;
|
||||
return new dijit._tree.dndTarget(node, params);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
@@ -49,7 +49,7 @@
|
||||
|
||||
|
||||
<H3>If you want to play:</H3>
|
||||
<p>
|
||||
<p></p>
|
||||
<ol>
|
||||
<li> Run the following tests:
|
||||
<ul>
|
||||
@@ -61,8 +61,6 @@
|
||||
<br><br>
|
||||
Restart the browser between each test/count. Run each test 3 times and record the smallest number.
|
||||
</li>
|
||||
<li>Record your tests in the copy of this file in SVN: <code>dijit/bench/test_Button-results.html</code> and check it in. Reference ticket #2968.
|
||||
<li>Record your tests in the copy of this file in SVN: <code>dijit/bench/test_Button-results.html</code> and check it in. Reference ticket #2968.</li>
|
||||
</ol>
|
||||
</p>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -25,7 +25,7 @@ Create widgets via
|
||||
|
||||
createWidget() call removed since multiple renderers are no longer supported (see next section).
|
||||
|
||||
At least for the dijit widgets, all widgets are guaranteed to work programatically, which in
|
||||
At least for the dijit widgets, all widgets are guaranteed to work programmatically, which in
|
||||
effect means that all widgets must have templates, unless the default <div> works.
|
||||
|
||||
Renderers
|
||||
@@ -58,6 +58,9 @@ dojoAttachEvent="onclick: onClick"
|
||||
lists within dojoAttachPoint, dojoAttachEvent, waiRole, and waiState are now comma-separated
|
||||
(not separated by semi-colons)
|
||||
|
||||
Standard HTML attributes like 'id', 'name', 'lang', etc. are carried over programmatically
|
||||
by the _Widget constructor and do not need to be declared in the template (see _Widget.attributeMap)
|
||||
|
||||
Parent/Child relationships
|
||||
--------------------------
|
||||
By default widgets exist as islands, not knowing about their parent widget or children widgets.
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@ dojo.declare("dijit.form.Button", dijit.form._FormWidget, {
|
||||
label: "",
|
||||
|
||||
// showLabel: Boolean
|
||||
// whether or not to display the text label in button
|
||||
// whether or not to display the text label in button
|
||||
showLabel: true,
|
||||
|
||||
// iconClass: String
|
||||
@@ -30,15 +30,36 @@ dojo.declare("dijit.form.Button", dijit.form._FormWidget, {
|
||||
|
||||
type: "button",
|
||||
baseClass: "dijitButton",
|
||||
templateString:"<div class=\"dijit dijitLeft dijitInline dijitButton\" baseClass=\"${baseClass}\"\n\tdojoAttachEvent=\"onclick:_onButtonClick,onmouseover:_onMouse,onmouseout:_onMouse,onmousedown:_onMouse\"\n\t><div class='dijitRight'\n\t><button class=\"dijitStretch dijitButtonNode dijitButtonContents\" dojoAttachPoint=\"focusNode,titleNode\"\n\t\ttabIndex=\"${tabIndex}\" type=\"${type}\" id=\"${id}\" name=\"${name}\" waiRole=\"button\" waiState=\"labelledby-${id}_label\"\n\t\t><div class=\"dijitInline ${iconClass}\"></div\n\t\t><span class=\"dijitButtonText\" id=\"${id}_label\" dojoAttachPoint=\"containerNode\">${label}</span\n\t></button\n></div></div>\n",
|
||||
templateString:"<div class=\"dijit dijitLeft dijitInline dijitButton\"\n\tdojoAttachEvent=\"onclick:_onButtonClick,onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse\"\n\t><div class='dijitRight'\n\t\t><button class=\"dijitStretch dijitButtonNode dijitButtonContents\" dojoAttachPoint=\"focusNode,titleNode\"\n\t\t\ttype=\"${type}\" waiRole=\"button\" waiState=\"labelledby-${id}_label\"\n\t\t\t><span class=\"dijitInline ${iconClass}\" dojoAttachPoint=\"iconNode\" \n \t\t\t\t><span class=\"dijitToggleButtonIconChar\">✓</span \n\t\t\t></span\n\t\t\t><span class=\"dijitButtonText\" id=\"${id}_label\" dojoAttachPoint=\"containerNode\">${label}</span\n\t\t></button\n\t></div\n></div>\n",
|
||||
|
||||
// TODO: set button's title to this.containerNode.innerText
|
||||
|
||||
_onClick: function(/*Event*/ e){
|
||||
// summary: internal function to handle click actions
|
||||
if(this.disabled){ return false; }
|
||||
this._clicked(); // widget click actions
|
||||
return this.onClick(e); // user click actions
|
||||
},
|
||||
|
||||
_onButtonClick: function(/*Event*/ e){
|
||||
// summary: callback when the user mouse clicks the button portion
|
||||
dojo.stopEvent(e);
|
||||
if(this.disabled){ return; }
|
||||
return this.onClick(e);
|
||||
var okToSubmit = this._onClick(e) !== false; // returning nothing is same as true
|
||||
|
||||
// for some reason type=submit buttons don't automatically submit the form; do it manually
|
||||
if(this.type=="submit" && okToSubmit){
|
||||
for(var node=this.domNode; node; node=node.parentNode){
|
||||
var widget=dijit.byNode(node);
|
||||
if(widget && widget._onSubmit){
|
||||
widget._onSubmit(e);
|
||||
break;
|
||||
}
|
||||
if(node.tagName.toLowerCase() == "form"){
|
||||
node.submit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
@@ -52,26 +73,17 @@ dojo.declare("dijit.form.Button", dijit.form._FormWidget, {
|
||||
this.titleNode.title=labelText;
|
||||
dojo.addClass(this.containerNode,"dijitDisplayNone");
|
||||
}
|
||||
dijit.form._FormWidget.prototype.postCreate.apply(this, arguments);
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
onClick: function(/*Event*/ e){
|
||||
// summary: callback for when button is clicked; user can override this function
|
||||
// summary: user callback for when button is clicked
|
||||
// if type="submit", return value != false to perform submit
|
||||
return true;
|
||||
},
|
||||
|
||||
// for some reason type=submit buttons don't automatically submit the form; do it manually
|
||||
if(this.type=="submit"){
|
||||
for(var node=this.domNode; node; node=node.parentNode){
|
||||
var widget=dijit.byNode(node);
|
||||
if(widget && widget._onSubmit){
|
||||
widget._onSubmit(e);
|
||||
break;
|
||||
}
|
||||
if(node.tagName.toLowerCase() == "form"){
|
||||
node.submit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_clicked: function(/*Event*/ e){
|
||||
// summary: internal replaceable function for when the button is clicked
|
||||
},
|
||||
|
||||
setLabel: function(/*String*/ content){
|
||||
@@ -102,7 +114,7 @@ dojo.declare("dijit.form.DropDownButton", [dijit.form.Button, dijit._Container],
|
||||
|
||||
baseClass : "dijitDropDownButton",
|
||||
|
||||
templateString:"<div class=\"dijit dijitLeft dijitInline dijitDropDownButton\" baseClass=\"dijitDropDownButton\"\n\tdojoAttachEvent=\"onmouseover:_onMouse,onmouseout:_onMouse,onmousedown:_onMouse,onclick:_onArrowClick,onkeypress:_onKey\"\n\t><div class='dijitRight'>\n\t<button tabIndex=\"${tabIndex}\" class=\"dijitStretch dijitButtonNode dijitButtonContents\" type=\"${type}\" id=\"${id}\" name=\"${name}\"\n\t\tdojoAttachPoint=\"focusNode,titleNode\" waiRole=\"button\" waiState=\"haspopup-true,labelledby-${id}_label\"\n\t\t><div class=\"dijitInline ${iconClass}\"></div\n\t\t><span class=\"dijitButtonText\" \tdojoAttachPoint=\"containerNode,popupStateNode\"\n\t\tid=\"${id}_label\">${label}</span\n\t\t><span class='dijitA11yDownArrow'>▼</span>\n\t</button>\n</div></div>\n",
|
||||
templateString:"<div class=\"dijit dijitLeft dijitInline\"\n\tdojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse,onclick:_onDropDownClick,onkeydown:_onDropDownKeydown,onblur:_onDropDownBlur,onkeypress:_onKey\"\n\t><div class='dijitRight'>\n\t<button class=\"dijitStretch dijitButtonNode dijitButtonContents\" type=\"${type}\"\n\t\tdojoAttachPoint=\"focusNode,titleNode\" waiRole=\"button\" waiState=\"haspopup-true,labelledby-${id}_label\"\n\t\t><div class=\"dijitInline ${iconClass}\" dojoAttachPoint=\"iconNode\"></div\n\t\t><span class=\"dijitButtonText\" \tdojoAttachPoint=\"containerNode,popupStateNode\"\n\t\tid=\"${id}_label\">${label}</span\n\t\t><span class='dijitA11yDownArrow'>▼</span>\n\t</button>\n</div></div>\n",
|
||||
|
||||
_fillContent: function(){
|
||||
// my inner HTML contains both the button contents and a drop down widget, like
|
||||
@@ -137,6 +149,29 @@ dojo.declare("dijit.form.DropDownButton", [dijit.form.Button, dijit._Container],
|
||||
this._toggleDropDown();
|
||||
},
|
||||
|
||||
_onDropDownClick: function(/*Event*/ e){
|
||||
// on Firefox 2 on the Mac it is possible to fire onclick
|
||||
// by pressing enter down on a second element and transferring
|
||||
// focus to the DropDownButton;
|
||||
// we want to prevent opening our menu in this situation
|
||||
// and only do so if we have seen a keydown on this button;
|
||||
// e.detail != 0 means that we were fired by mouse
|
||||
var isMacFFlessThan3 = dojo.isFF && dojo.isFF < 3
|
||||
&& navigator.appVersion.indexOf("Macintosh") != -1;
|
||||
if(!isMacFFlessThan3 || e.detail != 0 || this._seenKeydown){
|
||||
this._onArrowClick(e);
|
||||
}
|
||||
this._seenKeydown = false;
|
||||
},
|
||||
|
||||
_onDropDownKeydown: function(/*Event*/ e){
|
||||
this._seenKeydown = true;
|
||||
},
|
||||
|
||||
_onDropDownBlur: function(/*Event*/ e){
|
||||
this._seenKeydown = false;
|
||||
},
|
||||
|
||||
_onKey: function(/*Event*/ e){
|
||||
// summary: callback when the user presses a key on menu popup node
|
||||
if(this.disabled){ return; }
|
||||
@@ -150,7 +185,7 @@ dojo.declare("dijit.form.DropDownButton", [dijit.form.Button, dijit._Container],
|
||||
|
||||
_onBlur: function(){
|
||||
// summary: called magically when focus has shifted away from this widget and it's dropdown
|
||||
dijit.popup.closeAll();
|
||||
this._closeDropDown();
|
||||
// don't focus on button. the user has explicitly focused on something else.
|
||||
},
|
||||
|
||||
@@ -174,11 +209,10 @@ dojo.declare("dijit.form.DropDownButton", [dijit.form.Button, dijit._Container],
|
||||
this._openDropDown();
|
||||
}
|
||||
}else{
|
||||
dijit.popup.closeAll();
|
||||
this._opened = false;
|
||||
this._closeDropDown();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
_openDropDown: function(){
|
||||
var dropDown = this.dropDown;
|
||||
var oldWidth=dropDown.domNode.style.width;
|
||||
@@ -191,22 +225,21 @@ dojo.declare("dijit.form.DropDownButton", [dijit.form.Button, dijit._Container],
|
||||
orient: this.isLeftToRight() ? {'BL':'TL', 'BR':'TR', 'TL':'BL', 'TR':'BR'}
|
||||
: {'BR':'TR', 'BL':'TL', 'TR':'BR', 'TL':'BL'},
|
||||
onExecute: function(){
|
||||
dijit.popup.closeAll();
|
||||
self.focus();
|
||||
self._closeDropDown(true);
|
||||
},
|
||||
onCancel: function(){
|
||||
dijit.popup.closeAll();
|
||||
self.focus();
|
||||
self._closeDropDown(true);
|
||||
},
|
||||
onClose: function(){
|
||||
dropDown.domNode.style.width = oldWidth;
|
||||
self.popupStateNode.removeAttribute("popupActive");
|
||||
this._opened = false;
|
||||
}
|
||||
});
|
||||
if(this.domNode.offsetWidth > dropDown.domNode.offsetWidth){
|
||||
var adjustNode = null;
|
||||
if(!this.isLeftToRight()){
|
||||
adjustNode = dropDown.domNode.parentNode;
|
||||
adjustNode = dropDown.domNode.parentNode;
|
||||
var oldRight = adjustNode.offsetLeft + adjustNode.offsetWidth;
|
||||
}
|
||||
// make menu at least as wide as the button
|
||||
@@ -221,6 +254,14 @@ dojo.declare("dijit.form.DropDownButton", [dijit.form.Button, dijit._Container],
|
||||
dropDown.focus();
|
||||
}
|
||||
// TODO: set this.checked and call setStateClass(), to affect button look while drop down is shown
|
||||
},
|
||||
|
||||
_closeDropDown: function(/*Boolean*/ focus){
|
||||
if(this._opened){
|
||||
dijit.popup.close(this.dropDown);
|
||||
if(focus){ this.focus(); }
|
||||
this._opened = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -234,13 +275,78 @@ dojo.declare("dijit.form.DropDownButton", [dijit.form.Button, dijit._Container],
|
||||
dojo.declare("dijit.form.ComboButton", dijit.form.DropDownButton, {
|
||||
// summary
|
||||
// left side is normal button, right side displays menu
|
||||
templateString:"<table class='dijit dijitReset dijitInline dijitLeft dijitComboButton' baseClass='dijitComboButton'\n\tid=\"${id}\" name=\"${name}\" cellspacing='0' cellpadding='0'\n\tdojoAttachEvent=\"onmouseover:_onMouse,onmouseout:_onMouse,onmousedown:_onMouse\">\n\t<tr>\n\t\t<td\tclass=\"dijitStretch dijitButtonContents dijitButtonNode\"\n\t\t\ttabIndex=\"${tabIndex}\"\n\t\t\tdojoAttachEvent=\"ondijitclick:_onButtonClick\" dojoAttachPoint=\"titleNode\"\n\t\t\twaiRole=\"button\" waiState=\"labelledby-${id}_label\">\n\t\t\t<div class=\"dijitInline ${iconClass}\"></div>\n\t\t\t<span class=\"dijitButtonText\" id=\"${id}_label\" dojoAttachPoint=\"containerNode\">${label}</span>\n\t\t</td>\n\t\t<td class='dijitReset dijitRight dijitButtonNode dijitDownArrowButton'\n\t\t\tdojoAttachPoint=\"popupStateNode,focusNode\"\n\t\t\tdojoAttachEvent=\"onmouseover:_onMouse,onmouseout:_onMouse,onmousedown:_onMouse,ondijitclick:_onArrowClick, onkeypress:_onKey\"\n\t\t\tbaseClass=\"dijitComboButtonDownArrow\"\n\t\t\ttitle=\"${optionsTitle}\"\n\t\t\ttabIndex=\"${tabIndex}\"\n\t\t\twaiRole=\"button\" waiState=\"haspopup-true\"\n\t\t><div waiRole=\"presentation\">▼</div>\n\t</td></tr>\n</table>\n",
|
||||
templateString:"<table class='dijit dijitReset dijitInline dijitLeft'\n\tcellspacing='0' cellpadding='0'\n\tdojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse\">\n\t<tr>\n\t\t<td\tclass=\"dijitStretch dijitButtonContents dijitButtonNode\"\n\t\t\ttabIndex=\"${tabIndex}\"\n\t\t\tdojoAttachEvent=\"ondijitclick:_onButtonClick\" dojoAttachPoint=\"titleNode\"\n\t\t\twaiRole=\"button\" waiState=\"labelledby-${id}_label\">\n\t\t\t<div class=\"dijitInline ${iconClass}\" dojoAttachPoint=\"iconNode\"></div>\n\t\t\t<span class=\"dijitButtonText\" id=\"${id}_label\" dojoAttachPoint=\"containerNode\">${label}</span>\n\t\t</td>\n\t\t<td class='dijitReset dijitRight dijitButtonNode dijitDownArrowButton'\n\t\t\tdojoAttachPoint=\"popupStateNode,focusNode\"\n\t\t\tdojoAttachEvent=\"ondijitclick:_onArrowClick, onkeypress:_onKey\"\n\t\t\tstateModifier=\"DownArrow\"\n\t\t\ttitle=\"${optionsTitle}\" name=\"${name}\"\n\t\t\twaiRole=\"button\" waiState=\"haspopup-true\"\n\t\t><div waiRole=\"presentation\">▼</div>\n\t</td></tr>\n</table>\n",
|
||||
|
||||
attributeMap: dojo.mixin(dojo.clone(dijit.form._FormWidget.prototype.attributeMap),
|
||||
{id:"", name:""}),
|
||||
|
||||
// optionsTitle: String
|
||||
// text that describes the options menu (accessibility)
|
||||
optionsTitle: "",
|
||||
|
||||
baseClass: "dijitComboButton"
|
||||
baseClass: "dijitComboButton",
|
||||
|
||||
_focusedNode: null,
|
||||
|
||||
postCreate: function(){
|
||||
this.inherited(arguments);
|
||||
this._focalNodes = [this.titleNode, this.popupStateNode];
|
||||
dojo.forEach(this._focalNodes, dojo.hitch(this, function(node){
|
||||
if(dojo.isIE){
|
||||
this.connect(node, "onactivate", this._onNodeFocus);
|
||||
}else{
|
||||
this.connect(node, "onfocus", this._onNodeFocus);
|
||||
}
|
||||
}));
|
||||
},
|
||||
|
||||
focusFocalNode: function(node){
|
||||
// summary: Focus the focal node node.
|
||||
this._focusedNode = node;
|
||||
dijit.focus(node);
|
||||
},
|
||||
|
||||
hasNextFocalNode: function(){
|
||||
// summary: Returns true if this widget has no node currently
|
||||
// focused or if there is a node following the focused one.
|
||||
// False is returned if the last node has focus.
|
||||
return this._focusedNode !== this.getFocalNodes()[1];
|
||||
},
|
||||
|
||||
focusNext: function(){
|
||||
// summary: Focus the focal node following the current node with focus
|
||||
// or the first one if no node currently has focus.
|
||||
this._focusedNode = this.getFocalNodes()[this._focusedNode ? 1 : 0];
|
||||
dijit.focus(this._focusedNode);
|
||||
},
|
||||
|
||||
hasPrevFocalNode: function(){
|
||||
// summary: Returns true if this widget has no node currently
|
||||
// focused or if there is a node before the focused one.
|
||||
// False is returned if the first node has focus.
|
||||
return this._focusedNode !== this.getFocalNodes()[0];
|
||||
},
|
||||
|
||||
focusPrev: function(){
|
||||
// summary: Focus the focal node before the current node with focus
|
||||
// or the last one if no node currently has focus.
|
||||
this._focusedNode = this.getFocalNodes()[this._focusedNode ? 0 : 1];
|
||||
dijit.focus(this._focusedNode);
|
||||
},
|
||||
|
||||
getFocalNodes: function(){
|
||||
// summary: Returns an array of focal nodes for this widget.
|
||||
return this._focalNodes;
|
||||
},
|
||||
|
||||
_onNodeFocus: function(evt){
|
||||
this._focusedNode = evt.currentTarget;
|
||||
},
|
||||
|
||||
_onBlur: function(evt){
|
||||
this.inherited(arguments);
|
||||
this._focusedNode = null;
|
||||
}
|
||||
});
|
||||
|
||||
dojo.declare("dijit.form.ToggleButton", dijit.form.Button, {
|
||||
@@ -257,7 +363,7 @@ dojo.declare("dijit.form.ToggleButton", dijit.form.Button, {
|
||||
// or the radio button is selected, etc.
|
||||
checked: false,
|
||||
|
||||
onClick: function(/*Event*/ evt){
|
||||
_clicked: function(/*Event*/ evt){
|
||||
this.setChecked(!this.checked);
|
||||
},
|
||||
|
||||
@@ -265,7 +371,8 @@ dojo.declare("dijit.form.ToggleButton", dijit.form.Button, {
|
||||
// summary
|
||||
// Programatically deselect the button
|
||||
this.checked = checked;
|
||||
this._setStateClass();
|
||||
dijit.setWaiState(this.focusNode || this.domNode, "pressed", this.checked);
|
||||
this._setStateClass();
|
||||
this.onChange(checked);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,12 +24,12 @@ dojo.declare(
|
||||
// In case 2, the regular html inputs are invisible but still used by
|
||||
// the user. They are turned quasi-invisible and overlay the background-image.
|
||||
|
||||
templateString:"<span class=\"${baseClass}\" baseClass=\"${baseClass}\"\n\t><input\n\t \tid=\"${id}\" tabIndex=\"${tabIndex}\" type=\"${_type}\" name=\"${name}\" value=\"${value}\"\n\t\tclass=\"dijitCheckBoxInput\"\n\t\tdojoAttachPoint=\"inputNode,focusNode\"\n\t \tdojoAttachEvent=\"onmouseover:_onMouse,onmouseout:_onMouse,onclick:onClick\"\n></span>\n",
|
||||
templateString:"<fieldset class=\"dijitReset dijitInline\" waiRole=\"presentation\"\n\t><input\n\t \ttype=\"${type}\" name=\"${name}\"\n\t\tclass=\"dijitReset dijitCheckBoxInput\"\n\t\tdojoAttachPoint=\"inputNode,focusNode\"\n\t \tdojoAttachEvent=\"onmouseover:_onMouse,onmouseout:_onMouse,onclick:_onClick\"\n/></fieldset>\n",
|
||||
|
||||
baseClass: "dijitCheckBox",
|
||||
|
||||
// Value of "type" attribute for <input>
|
||||
_type: "checkbox",
|
||||
type: "checkbox",
|
||||
|
||||
// value: Value
|
||||
// equivalent to value field on normal checkbox (if checked, the value is passed as
|
||||
@@ -39,16 +39,15 @@ dojo.declare(
|
||||
postCreate: function(){
|
||||
dojo.setSelectable(this.inputNode, false);
|
||||
this.setChecked(this.checked);
|
||||
dijit.form.ToggleButton.prototype.postCreate.apply(this, arguments);
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
setChecked: function(/*Boolean*/ checked){
|
||||
this.checked = checked;
|
||||
if(dojo.isIE){
|
||||
if(checked){ this.inputNode.setAttribute('checked', 'checked'); }
|
||||
else{ this.inputNode.removeAttribute('checked'); }
|
||||
}else{ this.inputNode.checked = checked; }
|
||||
dijit.form.ToggleButton.prototype.setChecked.apply(this, arguments);
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
setValue: function(/*String*/ value){
|
||||
@@ -74,7 +73,7 @@ dojo.declare(
|
||||
// of all the siblings (the "context") in a group based on input
|
||||
// events. We don't rely on browser radio grouping.
|
||||
|
||||
_type: "radio",
|
||||
type: "radio",
|
||||
baseClass: "dijitRadio",
|
||||
|
||||
// This shared object keeps track of all widgets, grouped by name
|
||||
@@ -84,7 +83,7 @@ dojo.declare(
|
||||
// add this widget to _groups
|
||||
(this._groups[this.name] = this._groups[this.name] || []).push(this);
|
||||
|
||||
dijit.form.CheckBox.prototype.postCreate.apply(this, arguments);
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
uninitialize: function(){
|
||||
@@ -106,10 +105,10 @@ dojo.declare(
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
dijit.form.CheckBox.prototype.setChecked.apply(this, arguments);
|
||||
this.inherited(arguments);
|
||||
},
|
||||
|
||||
onClick: function(/*Event*/ e){
|
||||
_clicked: function(/*Event*/ e){
|
||||
if(!this.checked){
|
||||
this.setChecked(true);
|
||||
}
|
||||
|
||||
@@ -3,13 +3,12 @@ dojo._hasResource["dijit.form.ComboBox"] = true;
|
||||
dojo.provide("dijit.form.ComboBox");
|
||||
|
||||
dojo.require("dojo.data.ItemFileReadStore");
|
||||
dojo.require("dijit.form._DropDownTextBox");
|
||||
dojo.require("dijit.form.ValidationTextBox");
|
||||
dojo.requireLocalization("dijit.form", "ComboBox", null, "ROOT");
|
||||
dojo.requireLocalization("dijit.form", "ComboBox", null, "ko,zh,ja,zh-tw,ru,it,hu,ROOT,fr,pt,pl,es,de,cs");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.form.ComboBoxMixin",
|
||||
dijit.form._DropDownTextBox,
|
||||
null,
|
||||
{
|
||||
// summary:
|
||||
// Auto-completing text box, and base class for FilteringSelect widget.
|
||||
@@ -20,19 +19,28 @@ dojo.declare(
|
||||
//
|
||||
// Some of the options to the ComboBox are actually arguments to the data
|
||||
// provider.
|
||||
//
|
||||
// You can assume that all the form widgets (and thus anything that mixes
|
||||
// in ComboBoxMixin) will inherit from _FormWidget and thus the "this"
|
||||
// reference will also "be a" _FormWidget.
|
||||
|
||||
// item: Object
|
||||
// This is the item returned by the dojo.data.store implementation that
|
||||
// provides the data for this cobobox, it's the currently selected item.
|
||||
item: null,
|
||||
|
||||
// pageSize: Integer
|
||||
// Argument to data provider.
|
||||
// Specifies number of search results per page (before hitting "next" button)
|
||||
pageSize: 30,
|
||||
pageSize: Infinity,
|
||||
|
||||
// store: Object
|
||||
// Reference to data provider object used by this ComboBox
|
||||
store: null,
|
||||
|
||||
// query: Object
|
||||
// A query that can be passed to 'store' to initially filter the items,
|
||||
// before doing further filtering based on searchAttr and the key.
|
||||
// query: Object
|
||||
// A query that can be passed to 'store' to initially filter the items,
|
||||
// before doing further filtering based on searchAttr and the key.
|
||||
query: {},
|
||||
|
||||
// autoComplete: Boolean
|
||||
@@ -51,12 +59,24 @@ dojo.declare(
|
||||
searchAttr: "name",
|
||||
|
||||
// ignoreCase: Boolean
|
||||
// Does the ComboBox menu ignore case?
|
||||
// Set true if the ComboBox should ignore case when matching possible items
|
||||
ignoreCase: true,
|
||||
|
||||
_hasMasterPopup:true,
|
||||
// hasDownArrow: Boolean
|
||||
// Set this textbox to have a down arrow button.
|
||||
// Defaults to true.
|
||||
hasDownArrow:true,
|
||||
|
||||
_popupClass:"dijit.form._ComboBoxMenu",
|
||||
// _hasFocus: Boolean
|
||||
// Represents focus state of the textbox
|
||||
// TODO: get rid of this; it's unnecessary (but currently referenced in FilteringSelect)
|
||||
_hasFocus:false,
|
||||
|
||||
templateString:"<table style=\"display: -moz-inline-stack;\" class=\"dijit dijitReset dijitInlineTable dijitLeft\" cellspacing=\"0\" cellpadding=\"0\"\n\tid=\"widget_${id}\" name=\"${name}\" dojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse\" waiRole=\"presentation\"\n\t><tr class=\"dijitReset\"\n\t\t><td class='dijitReset dijitStretch dijitInputField' width=\"100%\"\n\t\t\t><input type=\"text\" autocomplete=\"off\" name=\"${name}\"\n\t\t\tdojoAttachEvent=\"onkeypress, onkeyup, onfocus, onblur, compositionend\"\n\t\t\tdojoAttachPoint=\"textbox,focusNode\" waiRole=\"combobox\"\n\t\t/></td\n\t\t><td class=\"dijitReset dijitValidationIconField\" width=\"0%\"\n\t\t\t><div dojoAttachPoint='iconNode' class='dijitValidationIcon'></div><div class='dijitInline dijitValidationIconText'>Χ</div\n\t\t></td\n\t\t><td class='dijitReset dijitRight dijitButtonNode dijitDownArrowButton' width=\"0%\"\n\t\t\tdojoAttachPoint=\"downArrowNode\"\n\t\t\tdojoAttachEvent=\"ondijitclick:_onArrowClick,onmousedown:_onArrowMouseDown,onmouseup:_onMouse,onmouseenter:_onMouse,onmouseleave:_onMouse\"\n\t\t\t><div class=\"dijitDownArrowButtonInner\" waiRole=\"presentation\" tabIndex=\"-1\"\n\t\t\t\t><div class=\"dijitDownArrowButtonChar\">▼</div\n\t\t\t></div\n\t\t></td\t\n\t></tr\n></table>\n",
|
||||
|
||||
baseClass:"dijitComboBox",
|
||||
|
||||
_lastDisplayedValue: "",
|
||||
|
||||
getValue:function(){
|
||||
// don't get the textbox value but rather the previously set hidden value
|
||||
@@ -64,6 +84,7 @@ dojo.declare(
|
||||
},
|
||||
|
||||
setDisplayedValue:function(/*String*/ value){
|
||||
this._lastDisplayedValue = value;
|
||||
this.setValue(value, true);
|
||||
},
|
||||
|
||||
@@ -87,8 +108,7 @@ dojo.declare(
|
||||
// There appears to be no workaround for this - googled for quite a while.
|
||||
ntr.setEndPoint("EndToEnd", tr);
|
||||
return String(ntr.text).replace(/\r/g,"").length;
|
||||
}
|
||||
catch(e){
|
||||
}catch(e){
|
||||
return 0; // If focus has shifted, 0 is fine for caret pos.
|
||||
}
|
||||
}
|
||||
@@ -135,10 +155,13 @@ dojo.declare(
|
||||
|
||||
onkeypress: function(/*Event*/ evt){
|
||||
// summary: handles keyboard events
|
||||
if(evt.ctrlKey || evt.altKey){
|
||||
|
||||
//except for pasting case - ctrl + v(118)
|
||||
if(evt.altKey || (evt.ctrlKey && evt.charCode != 118)){
|
||||
return;
|
||||
}
|
||||
var doSearch = false;
|
||||
this.item = null; // #4872
|
||||
if(this._isShowingNow){this._popupWidget.handleKey(evt);}
|
||||
switch(evt.keyCode){
|
||||
case dojo.keys.PAGE_DOWN:
|
||||
@@ -167,9 +190,9 @@ dojo.declare(
|
||||
case dojo.keys.ENTER:
|
||||
// prevent submitting form if user presses enter
|
||||
// also prevent accepting the value if either Next or Previous are selected
|
||||
if(this._isShowingNow){
|
||||
var highlighted;
|
||||
if(this._isShowingNow&&(highlighted=this._popupWidget.getHighlightedOption())){
|
||||
// only stop event on prev/next
|
||||
var highlighted=this._popupWidget.getHighlightedOption();
|
||||
if(highlighted==this._popupWidget.nextButton){
|
||||
this._nextSearch(1);
|
||||
dojo.stopEvent(evt);
|
||||
@@ -180,6 +203,8 @@ dojo.declare(
|
||||
dojo.stopEvent(evt);
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
this.setDisplayedValue(this.getDisplayedValue());
|
||||
}
|
||||
// default case:
|
||||
// prevent submit, but allow event to bubble
|
||||
@@ -187,18 +212,20 @@ dojo.declare(
|
||||
// fall through
|
||||
|
||||
case dojo.keys.TAB:
|
||||
var newvalue=this.getDisplayedValue();
|
||||
// #4617: if the user had More Choices selected fall into the _onBlur handler
|
||||
if(this._popupWidget &&
|
||||
(newvalue == this._popupWidget._messages["previousMessage"] ||
|
||||
newvalue == this._popupWidget._messages["nextMessage"])){
|
||||
break;
|
||||
}
|
||||
if(this._isShowingNow){
|
||||
this._prev_key_backspace = false;
|
||||
this._prev_key_esc = false;
|
||||
if(this._isShowingNow&&this._popupWidget.getHighlightedOption()){
|
||||
if(this._popupWidget.getHighlightedOption()){
|
||||
this._popupWidget.setValue({target:this._popupWidget.getHighlightedOption()}, true);
|
||||
}else{
|
||||
this.setDisplayedValue(this.getDisplayedValue());
|
||||
}
|
||||
this._hideResultList();
|
||||
}else{
|
||||
// also allow arbitrary user input
|
||||
this.setDisplayedValue(this.getDisplayedValue());
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -209,22 +236,28 @@ dojo.declare(
|
||||
dojo.stopEvent(evt);
|
||||
this._selectOption();
|
||||
this._hideResultList();
|
||||
}else{
|
||||
doSearch = true;
|
||||
}
|
||||
else{doSearch=true;}
|
||||
break;
|
||||
|
||||
case dojo.keys.ESCAPE:
|
||||
this._prev_key_backspace = false;
|
||||
this._prev_key_esc = true;
|
||||
this._hideResultList();
|
||||
this.setValue(this.getValue());
|
||||
if(this._lastDisplayedValue != this.getDisplayedValue()){
|
||||
this.setDisplayedValue(this._lastDisplayedValue);
|
||||
dojo.stopEvent(evt);
|
||||
}else{
|
||||
this.setValue(this.getValue());
|
||||
}
|
||||
break;
|
||||
|
||||
case dojo.keys.DELETE:
|
||||
case dojo.keys.BACKSPACE:
|
||||
this._prev_key_esc = false;
|
||||
this._prev_key_backspace = true;
|
||||
doSearch=true;
|
||||
doSearch = true;
|
||||
break;
|
||||
|
||||
case dojo.keys.RIGHT_ARROW: // fall through
|
||||
@@ -237,7 +270,7 @@ dojo.declare(
|
||||
default:// non char keys (F1-F12 etc..) shouldn't open list
|
||||
this._prev_key_backspace = false;
|
||||
this._prev_key_esc = false;
|
||||
if(evt.charCode!=0){
|
||||
if(dojo.isIE || evt.charCode != 0){
|
||||
doSearch=true;
|
||||
}
|
||||
}
|
||||
@@ -272,16 +305,18 @@ dojo.declare(
|
||||
this.focusNode.value = text;//.substr(cpos);
|
||||
// visually highlight the autocompleted characters
|
||||
this._setSelectedRange(this.focusNode, cpos, this.focusNode.value.length);
|
||||
dijit.setWaiState(this.focusNode, "valuenow", text);
|
||||
}
|
||||
}else{
|
||||
// text does not autoComplete; replace the whole value and highlight
|
||||
this.focusNode.value = text;
|
||||
this._setSelectedRange(this.focusNode, 0, this.focusNode.value.length);
|
||||
dijit.setWaiState(this.focusNode, "valuenow", text);
|
||||
}
|
||||
},
|
||||
|
||||
_openResultList: function(/*Object*/ results, /*Object*/ dataObject){
|
||||
if(this.disabled||dataObject.query[this.searchAttr]!=this._lastQuery){
|
||||
if(this.disabled || dataObject.query[this.searchAttr] != this._lastQuery){
|
||||
return;
|
||||
}
|
||||
this._popupWidget.clearResultList();
|
||||
@@ -296,39 +331,105 @@ dojo.declare(
|
||||
// "California" and "ifornia" would be highlighted.
|
||||
|
||||
var zerothvalue=new String(this.store.getValue(results[0], this.searchAttr));
|
||||
if(zerothvalue&&(this.autoComplete)&&
|
||||
(!this._prev_key_backspace)&&
|
||||
if(zerothvalue && this.autoComplete && !this._prev_key_backspace &&
|
||||
// when the user clicks the arrow button to show the full list,
|
||||
// startSearch looks for "*".
|
||||
// it does not make sense to autocomplete
|
||||
// if they are just previewing the options available.
|
||||
(dataObject.query[this.searchAttr]!="*")){
|
||||
(dataObject.query[this.searchAttr] != "*")){
|
||||
this._autoCompleteText(zerothvalue);
|
||||
// announce the autocompleted value
|
||||
dijit.wai.setAttr(this.focusNode || this.domNode, "waiState", "valuenow", zerothvalue);
|
||||
dijit.setWaiState(this.focusNode || this.domNode, "valuenow", zerothvalue);
|
||||
}
|
||||
this._popupWidget.createOptions(results, dataObject, dojo.hitch(this, this._getMenuLabelFromItem));
|
||||
|
||||
// show our list (only if we have content, else nothing)
|
||||
this._showResultList();
|
||||
},
|
||||
|
||||
onfocus:function(){
|
||||
dijit.form._DropDownTextBox.prototype.onfocus.apply(this, arguments);
|
||||
this.inherited('onfocus', arguments);
|
||||
},
|
||||
|
||||
onblur:function(){ /* not _onBlur! */
|
||||
// call onblur first to avoid race conditions with _hasFocus
|
||||
dijit.form._DropDownTextBox.prototype.onblur.apply(this, arguments);
|
||||
if(!this._isShowingNow){
|
||||
// if the user clicks away from the textbox, set the value to the textbox value
|
||||
this.setDisplayedValue(this.getDisplayedValue());
|
||||
// #4091: tell the screen reader that the paging callback finished by shouting the next choice
|
||||
if(dataObject.direction){
|
||||
if(dataObject.direction==1){
|
||||
this._popupWidget.highlightFirstOption();
|
||||
}else if(dataObject.direction==-1){
|
||||
this._popupWidget.highlightLastOption();
|
||||
}
|
||||
this._announceOption(this._popupWidget.getHighlightedOption());
|
||||
}
|
||||
},
|
||||
|
||||
_showResultList: function(){
|
||||
this._hideResultList();
|
||||
var items = this._popupWidget.getItems(),
|
||||
visibleCount = Math.min(items.length,this.maxListLength);
|
||||
this._arrowPressed();
|
||||
// hide the tooltip
|
||||
this._displayMessage("");
|
||||
|
||||
// Position the list and if it's too big to fit on the screen then
|
||||
// size it to the maximum possible height
|
||||
// Our dear friend IE doesnt take max-height so we need to calculate that on our own every time
|
||||
// TODO: want to redo this, see http://trac.dojotoolkit.org/ticket/3272, http://trac.dojotoolkit.org/ticket/4108
|
||||
with(this._popupWidget.domNode.style){
|
||||
// natural size of the list has changed, so erase old width/height settings,
|
||||
// which were hardcoded in a previous call to this function (via dojo.marginBox() call)
|
||||
width="";
|
||||
height="";
|
||||
}
|
||||
var best=this.open();
|
||||
// #3212: only set auto scroll bars if necessary
|
||||
// prevents issues with scroll bars appearing when they shouldn't when node is made wider (fractional pixels cause this)
|
||||
var popupbox=dojo.marginBox(this._popupWidget.domNode);
|
||||
this._popupWidget.domNode.style.overflow=((best.h==popupbox.h)&&(best.w==popupbox.w))?"hidden":"auto";
|
||||
// #4134: borrow TextArea scrollbar test so content isn't covered by scrollbar and horizontal scrollbar doesn't appear
|
||||
var newwidth=best.w;
|
||||
if(best.h<this._popupWidget.domNode.scrollHeight){newwidth+=16;}
|
||||
dojo.marginBox(this._popupWidget.domNode, {h:best.h,w:Math.max(newwidth,this.domNode.offsetWidth)});
|
||||
},
|
||||
|
||||
_hideResultList: function(){
|
||||
if(this._isShowingNow){
|
||||
dijit.popup.close(this._popupWidget);
|
||||
this._arrowIdle();
|
||||
this._isShowingNow=false;
|
||||
}
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
// summary: called magically when focus has shifted away from this widget and it's dropdown
|
||||
this._hasFocus=false;
|
||||
this._hasBeenBlurred = true;
|
||||
this._hideResultList();
|
||||
// if the user clicks away from the textbox OR tabs away, set the value to the textbox value
|
||||
// #4617: if value is now more choices or previous choices, revert the value
|
||||
var newvalue=this.getDisplayedValue();
|
||||
if(this._popupWidget&&(newvalue==this._popupWidget._messages["previousMessage"]||newvalue==this._popupWidget._messages["nextMessage"])){
|
||||
this.setValue(this._lastValueReported);
|
||||
}else{
|
||||
this.setDisplayedValue(newvalue);
|
||||
}
|
||||
},
|
||||
|
||||
onfocus:function(/*Event*/ evt){
|
||||
this._hasFocus=true;
|
||||
|
||||
// update styling to reflect that we are focused
|
||||
this._onMouse(evt);
|
||||
},
|
||||
|
||||
onblur:function(/*Event*/ evt){ /* not _onBlur! */
|
||||
this._arrowIdle();
|
||||
|
||||
// hide the Tooltip
|
||||
// TODO: isn't this handled by ValidationTextBox?
|
||||
this.validate(false);
|
||||
|
||||
// don't call this since the TextBox setValue is asynchronous
|
||||
// if you uncomment this line, when you click away from the textbox,
|
||||
// the value in the textbox reverts to match the hidden value
|
||||
//this.parentClass.onblur.apply(this, arguments);
|
||||
|
||||
// update styling since we are no longer focused
|
||||
this._onMouse(evt);
|
||||
},
|
||||
|
||||
_announceOption: function(/*Node*/ node){
|
||||
@@ -372,6 +473,7 @@ dojo.declare(
|
||||
},
|
||||
|
||||
_doSelect: function(tgt){
|
||||
this.item = tgt.item;
|
||||
this.setValue(this.store.getValue(tgt.item, this.searchAttr), true);
|
||||
},
|
||||
|
||||
@@ -381,7 +483,6 @@ dojo.declare(
|
||||
return;
|
||||
}
|
||||
this.focus();
|
||||
this.makePopup();
|
||||
if(this._isShowingNow){
|
||||
this._hideResultList();
|
||||
}else{
|
||||
@@ -391,18 +492,29 @@ dojo.declare(
|
||||
}
|
||||
},
|
||||
|
||||
_onArrowMouseDown: function(evt){
|
||||
this._layoutHack(); // hack for FF2, see http://trac.dojotoolkit.org/ticket/5007
|
||||
this._onMouse(evt);
|
||||
},
|
||||
|
||||
_startSearchFromInput: function(){
|
||||
this._startSearch(this.focusNode.value);
|
||||
},
|
||||
|
||||
_startSearch: function(/*String*/ key){
|
||||
this.makePopup();
|
||||
if(!this._popupWidget){
|
||||
this._popupWidget = new dijit.form._ComboBoxMenu({
|
||||
onChange: dojo.hitch(this, this._selectOption)
|
||||
});
|
||||
}
|
||||
// create a new query to prevent accidentally querying for a hidden value from FilteringSelect's keyField
|
||||
var query=this.query;
|
||||
this._lastQuery=query[this.searchAttr]=key+"*";
|
||||
var dataObject=this.store.fetch({queryOptions:{ignoreCase:this.ignoreCase, deep:true}, query: query, onComplete:dojo.hitch(this, "_openResultList"), start:0, count:this.pageSize});
|
||||
function nextSearch(dataObject, direction){
|
||||
dataObject.start+=dataObject.count*direction;
|
||||
// #4091: tell callback the direction of the paging so the screen reader knows which menu option to shout
|
||||
dataObject.direction=direction;
|
||||
dataObject.store.fetch(dataObject);
|
||||
}
|
||||
this._nextSearch=this._popupWidget.onPage=dojo.hitch(this, nextSearch, dataObject);
|
||||
@@ -412,32 +524,60 @@ dojo.declare(
|
||||
return this.searchAttr;
|
||||
},
|
||||
|
||||
/////////////// Event handlers /////////////////////
|
||||
|
||||
_arrowPressed: function(){
|
||||
if(!this.disabled&&this.hasDownArrow){
|
||||
dojo.addClass(this.downArrowNode, "dijitArrowButtonActive");
|
||||
}
|
||||
},
|
||||
|
||||
_arrowIdle: function(){
|
||||
if(!this.disabled&&this.hasDownArrow){
|
||||
dojo.removeClass(this.downArrowNode, "dojoArrowButtonPushed");
|
||||
}
|
||||
},
|
||||
|
||||
compositionend: function(/*Event*/ evt){
|
||||
// summary: When inputting characters using an input method, such as Asian
|
||||
// languages, it will generate this event instead of onKeyDown event
|
||||
// Note: this event is only triggered in FF (not in IE)
|
||||
this.onkeypress({charCode:-1});
|
||||
},
|
||||
|
||||
//////////// INITIALIZATION METHODS ///////////////////////////////////////
|
||||
constructor: function(){
|
||||
this.query={};
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
dijit.form._DropDownTextBox.prototype.postMixInProperties.apply(this, arguments);
|
||||
if(!this.hasDownArrow){
|
||||
this.baseClass = "dijitTextBox";
|
||||
}
|
||||
if(!this.store){
|
||||
// if user didn't specify store, then assume there are option tags
|
||||
var items = dojo.query("> option", this.srcNodeRef).map(function(node){
|
||||
var items = this.srcNodeRef ? dojo.query("> option", this.srcNodeRef).map(function(node){
|
||||
node.style.display="none";
|
||||
return { value: node.getAttribute("value"), name: String(node.innerHTML) };
|
||||
});
|
||||
}) : {};
|
||||
this.store = new dojo.data.ItemFileReadStore({data: {identifier:this._getValueField(), items:items}});
|
||||
|
||||
// if there is no value set and there is an option list,
|
||||
// set the value to the first value to be consistent with native Select
|
||||
if(items&&items.length&&!this.value){
|
||||
if(items && items.length && !this.value){
|
||||
// For <select>, IE does not let you set the value attribute of the srcNodeRef (and thus dojo.mixin does not copy it).
|
||||
// IE does understand selectedIndex though, which is automatically set by the selected attribute of an option tag
|
||||
this.value=items[this.srcNodeRef.selectedIndex!=-1?this.srcNodeRef.selectedIndex:0][this._getValueField()];
|
||||
this.value = items[this.srcNodeRef.selectedIndex != -1 ? this.srcNodeRef.selectedIndex : 0]
|
||||
[this._getValueField()];
|
||||
}
|
||||
}
|
||||
// instantiate query so comboboxes with different data stores and default query work together
|
||||
if(this.query==dijit.form.ComboBoxMixin.prototype.query){this.query={};}
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
// call the associated TextBox postCreate
|
||||
// ValidationTextBox for ComboBox; MappedTextBox for FilteringSelect
|
||||
this.inherited('postCreate', arguments);
|
||||
uninitialize:function(){
|
||||
if(this._popupWidget){
|
||||
this._hideResultList();
|
||||
this._popupWidget.destroy()
|
||||
};
|
||||
},
|
||||
|
||||
_getMenuLabelFromItem:function(/*Item*/ item){
|
||||
@@ -445,10 +585,12 @@ dojo.declare(
|
||||
},
|
||||
|
||||
open:function(){
|
||||
this._popupWidget.onChange=dojo.hitch(this, this._selectOption);
|
||||
// connect onkeypress to ComboBox
|
||||
this._popupWidget._onkeypresshandle=this._popupWidget.connect(this._popupWidget.domNode, "onkeypress", dojo.hitch(this, this.onkeypress));
|
||||
return dijit.form._DropDownTextBox.prototype.open.apply(this, arguments);
|
||||
this._isShowingNow=true;
|
||||
return dijit.popup.open({
|
||||
popup: this._popupWidget,
|
||||
around: this.domNode,
|
||||
parent: this
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -461,13 +603,11 @@ dojo.declare(
|
||||
// summary:
|
||||
// Focus-less div based menu for internal use in ComboBox
|
||||
|
||||
templateString:"<div class='dijitMenu' dojoAttachEvent='onclick,onmouseover,onmouseout' tabIndex='-1' style='display:none; position:absolute; overflow:\"auto\";'>"
|
||||
+"<div class='dijitMenuItem' dojoAttachPoint='previousButton'></div>"
|
||||
+"<div class='dijitMenuItem' dojoAttachPoint='nextButton'></div>"
|
||||
templateString:"<div class='dijitMenu' dojoAttachEvent='onclick,onmouseover,onmouseout' tabIndex='-1' style='overflow:\"auto\";'>"
|
||||
+"<div class='dijitMenuItem dijitMenuPreviousButton' dojoAttachPoint='previousButton'></div>"
|
||||
+"<div class='dijitMenuItem dijitMenuNextButton' dojoAttachPoint='nextButton'></div>"
|
||||
+"</div>",
|
||||
_onkeypresshandle:null,
|
||||
_messages:null,
|
||||
_comboBox:null,
|
||||
|
||||
postMixInProperties:function(){
|
||||
this._messages = dojo.i18n.getLocalization("dijit.form", "ComboBox", this.lang);
|
||||
@@ -490,7 +630,6 @@ dojo.declare(
|
||||
},
|
||||
|
||||
onClose:function(){
|
||||
this.disconnect(this._onkeypresshandle);
|
||||
this._blurOptionNode();
|
||||
},
|
||||
|
||||
@@ -563,7 +702,15 @@ dojo.declare(
|
||||
|
||||
onmouseover:function(/*Event*/ evt){
|
||||
if(evt.target === this.domNode){ return; }
|
||||
this._focusOptionNode(evt.target);
|
||||
var tgt=evt.target;
|
||||
if(!(tgt==this.previousButton||tgt==this.nextButton)){
|
||||
// while the clicked node is inside the div
|
||||
while(!tgt.item){
|
||||
// recurse to the top
|
||||
tgt=tgt.parentNode;
|
||||
}
|
||||
}
|
||||
this._focusOptionNode(tgt);
|
||||
},
|
||||
|
||||
onmouseout:function(/*Event*/ evt){
|
||||
@@ -599,9 +746,21 @@ dojo.declare(
|
||||
}else if(this._highlighted_option.nextSibling&&this._highlighted_option.nextSibling.style.display!="none"){
|
||||
this._focusOptionNode(this._highlighted_option.nextSibling);
|
||||
}
|
||||
// scrollIntoView is called outside of _focusOptionNode because in IE putting it inside causes the menu to scroll up on mouseover
|
||||
dijit.scrollIntoView(this._highlighted_option);
|
||||
},
|
||||
|
||||
highlightFirstOption:function(){
|
||||
// highlight the non-Previous choices option
|
||||
this._focusOptionNode(this.domNode.firstChild.nextSibling);
|
||||
dijit.scrollIntoView(this._highlighted_option);
|
||||
},
|
||||
|
||||
highlightLastOption:function(){
|
||||
// highlight the noon-More choices option
|
||||
this._focusOptionNode(this.domNode.lastChild.previousSibling);
|
||||
dijit.scrollIntoView(this._highlighted_option);
|
||||
},
|
||||
|
||||
_highlightPrevOption:function(){
|
||||
// if nothing selected, highlight last option
|
||||
@@ -673,7 +832,12 @@ dojo.declare(
|
||||
dojo.declare(
|
||||
"dijit.form.ComboBox",
|
||||
[dijit.form.ValidationTextBox, dijit.form.ComboBoxMixin],
|
||||
{}
|
||||
{
|
||||
postMixInProperties: function(){
|
||||
dijit.form.ComboBoxMixin.prototype.postMixInProperties.apply(this, arguments);
|
||||
dijit.form.ValidationTextBox.prototype.postMixInProperties.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ dojo.provide("dijit.form.CurrencyTextBox");
|
||||
//dojo.experimental("dijit.form.CurrencyTextBox");
|
||||
|
||||
dojo.require("dojo.currency");
|
||||
dojo.require("dijit.form.NumberTextBox");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.form.CurrencyTextBox",
|
||||
dijit.form.NumberTextBox,
|
||||
|
||||
@@ -11,9 +11,9 @@ dojo.declare(
|
||||
{
|
||||
// summary:
|
||||
// A validating, serializable, range-bound date text box.
|
||||
|
||||
|
||||
_popupClass: "dijit._Calendar",
|
||||
|
||||
|
||||
postMixInProperties: function(){
|
||||
this.inherited('postMixInProperties', arguments);
|
||||
this.constraints.selector = 'date';
|
||||
|
||||
@@ -14,13 +14,13 @@ dojo.declare(
|
||||
*
|
||||
* Similar features:
|
||||
* - There is a drop down list of possible values.
|
||||
* - You can only enter a value from the drop down list. (You can't enter an arbitrary value.)
|
||||
* - The value submitted with the form is the hidden value (ex: CA),
|
||||
* not the displayed value a.k.a. label (ex: California)
|
||||
* - You can only enter a value from the drop down list. (You can't enter an arbitrary value.)
|
||||
* - The value submitted with the form is the hidden value (ex: CA),
|
||||
* not the displayed value a.k.a. label (ex: California)
|
||||
*
|
||||
* Enhancements over plain HTML version:
|
||||
* - If you type in some text then it will filter down the list of possible values in the drop down list.
|
||||
* - List can be specified either as a static list or via a javascript function (that can get the list from a server)
|
||||
* - If you type in some text then it will filter down the list of possible values in the drop down list.
|
||||
* - List can be specified either as a static list or via a javascript function (that can get the list from a server)
|
||||
*/
|
||||
|
||||
// searchAttr: String
|
||||
@@ -46,7 +46,7 @@ dojo.declare(
|
||||
// Callback function that dynamically sets the label of the ComboBox
|
||||
|
||||
// setValue does a synchronous lookup,
|
||||
// so it calls _callbackSetLabel directly,
|
||||
// so it calls _callbackSetLabel directly,
|
||||
// and so does not pass dataObject
|
||||
// dataObject==null means do not test the lastQuery, just continue
|
||||
if(dataObject&&dataObject.query[this.searchAttr]!=this._lastQuery){return;}
|
||||
@@ -54,6 +54,8 @@ dojo.declare(
|
||||
//#3268: do nothing on bad input
|
||||
//this._setValue("", "");
|
||||
//#3285: change CSS to indicate error
|
||||
if(!this._hasFocus){ this.valueNode.value=""; }
|
||||
dijit.form.TextBox.superclass.setValue.call(this, undefined, !this._hasFocus);
|
||||
this._isvalid=false;
|
||||
this.validate(this._hasFocus);
|
||||
}else{
|
||||
@@ -82,6 +84,7 @@ dojo.declare(
|
||||
_setValue:function(/*String*/ value, /*String*/ displayedValue){
|
||||
this.valueNode.value = value;
|
||||
dijit.form.FilteringSelect.superclass.setValue.call(this, value, true, displayedValue);
|
||||
this._lastDisplayedValue = displayedValue;
|
||||
},
|
||||
|
||||
setValue: function(/*String*/ value){
|
||||
@@ -131,7 +134,7 @@ dojo.declare(
|
||||
// summary:
|
||||
// ComboBox's menu callback function
|
||||
// FilteringSelect overrides this to set both the visible and hidden value from the information stored in the menu
|
||||
|
||||
this.item = tgt.item;
|
||||
this._setValueFromItem(tgt.item);
|
||||
},
|
||||
|
||||
@@ -148,6 +151,7 @@ dojo.declare(
|
||||
// so the last valid value will get the warning textbox
|
||||
// set the textbox value now so that the impending warning will make sense to the user
|
||||
this.textbox.value=label;
|
||||
this._lastDisplayedValue=label;
|
||||
this.store.fetch({query:query, queryOptions:{ignoreCase:this.ignoreCase, deep:true}, onComplete: dojo.hitch(this, this._callbackSetLabel)});
|
||||
}
|
||||
},
|
||||
@@ -159,6 +163,11 @@ dojo.declare(
|
||||
// because this function is called by ComboBoxMenu, this.inherited tries to find the superclass of ComboBoxMenu
|
||||
return dijit.form.ComboBoxMixin.prototype._getMenuLabelFromItem.apply(this, arguments);
|
||||
}
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
dijit.form.ComboBoxMixin.prototype.postMixInProperties.apply(this, arguments);
|
||||
dijit.form.MappedTextBox.prototype.postMixInProperties.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -8,10 +8,10 @@ dojo.require("dijit._Templated");
|
||||
dojo.declare("dijit.form._FormMixin", null,
|
||||
{
|
||||
/*
|
||||
summary:
|
||||
summary:
|
||||
Widget corresponding to <form> tag, for validation and serialization
|
||||
|
||||
usage:
|
||||
|
||||
usage:
|
||||
<form dojoType="dijit.form.Form" id="myForm">
|
||||
Name: <input type="text" name="name" />
|
||||
</form>
|
||||
@@ -26,6 +26,19 @@ dojo.declare("dijit.form._FormMixin", null,
|
||||
|
||||
*/
|
||||
|
||||
// HTML <FORM> attributes
|
||||
|
||||
action: "",
|
||||
method: "",
|
||||
enctype: "",
|
||||
name: "",
|
||||
"accept-charset": "",
|
||||
accept: "",
|
||||
target: "",
|
||||
|
||||
attributeMap: dojo.mixin(dojo.clone(dijit._Widget.prototype.attributeMap),
|
||||
{action: "", method: "", enctype: "", "accept-charset": "", accept: "", target: ""}),
|
||||
|
||||
// execute: Function
|
||||
// User defined function to do stuff when the user hits the submit button
|
||||
execute: function(/*Object*/ formContents){},
|
||||
@@ -40,7 +53,7 @@ dojo.declare("dijit.form._FormMixin", null,
|
||||
// (user shouldn't override)
|
||||
onExecute: function(){},
|
||||
|
||||
templateString: "<form dojoAttachPoint='containerNode' dojoAttachEvent='onsubmit:_onSubmit' enctype='multipart/form-data'></form>",
|
||||
templateString: "<form dojoAttachPoint='containerNode' dojoAttachEvent='onsubmit:_onSubmit' name='${name}' enctype='multipart/form-data'></form>",
|
||||
|
||||
_onSubmit: function(/*event*/e) {
|
||||
// summary: callback when user hits submit button
|
||||
@@ -56,7 +69,7 @@ dojo.declare("dijit.form._FormMixin", null,
|
||||
|
||||
setValues: function(/*object*/obj) {
|
||||
// summary: fill in form values from a JSON structure
|
||||
|
||||
|
||||
// generate map from name --> [list of widgets with that name]
|
||||
var map = {};
|
||||
dojo.forEach(this.getDescendants(), function(widget){
|
||||
@@ -84,7 +97,7 @@ dojo.declare("dijit.form._FormMixin", null,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* TODO: code for plain input boxes (this shouldn't run for inputs that are part of widgets
|
||||
|
||||
@@ -128,7 +141,7 @@ dojo.declare("dijit.form._FormMixin", null,
|
||||
|
||||
switch(element.type) {
|
||||
case "checkbox":
|
||||
element.checked = (name in myObj) &&
|
||||
element.checked = (name in myObj) &&
|
||||
dojo.some(myObj[name], function(val){ return val==element.value; });
|
||||
break;
|
||||
case "radio":
|
||||
@@ -153,8 +166,8 @@ dojo.declare("dijit.form._FormMixin", null,
|
||||
element.value = myObj[name] || "";
|
||||
break;
|
||||
}
|
||||
});
|
||||
*/
|
||||
});
|
||||
*/
|
||||
},
|
||||
|
||||
getValues: function() {
|
||||
@@ -260,7 +273,7 @@ dojo.declare("dijit.form._FormMixin", null,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
dojo.declare(
|
||||
"dijit.form.Form",
|
||||
[dijit._Widget, dijit._Templated, dijit.form._FormMixin],
|
||||
|
||||
@@ -8,7 +8,9 @@ dojo.require("dijit.form._FormWidget");
|
||||
dojo.require("dijit._Container");
|
||||
dojo.require("dijit.form.Button");
|
||||
|
||||
dojo.requireLocalization("dijit", "common", null, "ROOT,de");
|
||||
dojo.requireLocalization("dijit", "common", null, "ko,zh,ja,zh-tw,ru,it,hu,fr,pt,ROOT,pl,es,de,cs");
|
||||
|
||||
dojo.deprecated("dijit.form.InlineEditBox is deprecated, use dijit.InlineEditBox instead", "", "1.1");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.form.InlineEditBox",
|
||||
@@ -24,31 +26,31 @@ dojo.declare(
|
||||
// Currently all textboxes that inherit from dijit.form.TextBox
|
||||
// are supported edit widgets.
|
||||
// An edit widget must support the following API to be used:
|
||||
// String getTextValue() OR String getValue()
|
||||
// void setTextValue(String) OR void setValue(String)
|
||||
// String getDisplayedValue() OR String getValue()
|
||||
// void setDisplayedValue(String) OR void setValue(String)
|
||||
// void focus()
|
||||
// It must also be able to initialize with style="display:none;" set.
|
||||
{
|
||||
templateString:"<span\n\t><span class='dijitInlineValue' tabIndex=\"0\" dojoAttachPoint=\"editable,focusNode\" style=\"\" waiRole=\"button\"\n\t\tdojoAttachEvent=\"onkeypress:_onKeyPress,onclick:_onClick,onmouseout:_onMouseOut,onmouseover:_onMouseOver,onfocus:_onMouseOver,onblur:_onMouseOut\"></span\n\t><fieldset style=\"display:none;\" dojoAttachPoint=\"editNode\" class=\"dijitInlineEditor\"\n\t\t><div dojoAttachPoint=\"containerNode\" dojoAttachEvent=\"onkeypress:_onEditWidgetKeyPress\"></div\n\t\t><span dojoAttachPoint=\"buttonSpan\"\n\t\t\t><button class='saveButton' dojoAttachPoint=\"saveButton\" dojoType=\"dijit.form.Button\" dojoAttachEvent=\"onClick:save\">${buttonSave}</button\n\t\t\t><button class='cancelButton' dojoAttachPoint=\"cancelButton\" dojoType=\"dijit.form.Button\" dojoAttachEvent=\"onClick:cancel\">${buttonCancel}</button\n\t\t</span\n\t></fieldset\n></span>\n",
|
||||
templateString:"<span\n\t><fieldset dojoAttachPoint=\"editNode\" style=\"display:none;\" waiRole=\"presentation\"\n\t\t><div dojoAttachPoint=\"containerNode\" dojoAttachEvent=\"onkeypress:_onEditWidgetKeyPress\"></div\n\t\t><div dojoAttachPoint=\"buttonContainer\"\n\t\t\t><button class='saveButton' dojoAttachPoint=\"saveButton\" dojoType=\"dijit.form.Button\" dojoAttachEvent=\"onClick:save\">${buttonSave}</button\n\t\t\t><button class='cancelButton' dojoAttachPoint=\"cancelButton\" dojoType=\"dijit.form.Button\" dojoAttachEvent=\"onClick:cancel\">${buttonCancel}</button\n\t\t></div\n\t></fieldset\n\t><span tabIndex=\"0\" dojoAttachPoint=\"textNode,focusNode\" waiRole=\"button\" style=\"display:none;\"\n\t\tdojoAttachEvent=\"onkeypress:_onKeyPress,onclick:_onClick,onmouseout:_onMouseOut,onmouseover:_onMouseOver,onfocus:_onMouseOver,onblur:_onMouseOut\"\n\t></span\n></span>\n",
|
||||
|
||||
// editing: Boolean
|
||||
// Is the node currently in edit mode?
|
||||
editing: false,
|
||||
|
||||
// autoSave: Boolean
|
||||
// Changing the value automatically saves it, don't have to push save button
|
||||
// Changing the value automatically saves it, don't have to push save button
|
||||
autoSave: true,
|
||||
|
||||
// buttonSave: String
|
||||
// Save button label
|
||||
// Save button label
|
||||
buttonSave: "",
|
||||
|
||||
// buttonCancel: String
|
||||
// Cancel button label
|
||||
// Cancel button label
|
||||
buttonCancel: "",
|
||||
|
||||
// renderAsHtml: Boolean
|
||||
// should text render as HTML(true) or plain text(false)
|
||||
// should text render as HTML(true) or plain text(false)
|
||||
renderAsHtml: false,
|
||||
|
||||
widgetsInTemplate: true,
|
||||
@@ -68,13 +70,14 @@ dojo.declare(
|
||||
}
|
||||
// #3209: copy the style from the source
|
||||
// don't copy ALL properties though, just the necessary/applicable ones
|
||||
dojo.forEach(["fontSize","fontFamily","fontWeight"], function(prop){
|
||||
this.editWidget.focusNode.style[prop]=this._srcStyle[prop];
|
||||
this.editable.style[prop]=this._srcStyle[prop];
|
||||
var srcStyle=dojo.getComputedStyle(this.domNode);
|
||||
dojo.forEach(["fontWeight","fontFamily","fontSize","fontStyle"], function(prop){
|
||||
this.editWidget.focusNode.style[prop]=srcStyle[prop];
|
||||
}, this);
|
||||
this._setEditValue = dojo.hitch(this.editWidget,this.editWidget.setDisplayedValue||this.editWidget.setValue);
|
||||
this._getEditValue = dojo.hitch(this.editWidget,this.editWidget.getDisplayedValue||this.editWidget.getValue);
|
||||
this._setEditFocus = dojo.hitch(this.editWidget,this.editWidget.focus);
|
||||
this._isEditValid = dojo.hitch(this.editWidget,this.editWidget.isValid || function(){return true;});
|
||||
this.editWidget.onChange = dojo.hitch(this, "_onChange");
|
||||
|
||||
if(!this.autoSave){ // take over the setValue method so we can know when the value changes
|
||||
@@ -91,25 +94,40 @@ dojo.declare(
|
||||
}
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
if(this.autoSave){
|
||||
this.buttonSpan.style.display="none";
|
||||
}
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
this._srcTag = this.srcNodeRef.tagName;
|
||||
this._srcStyle=dojo.getComputedStyle(this.srcNodeRef);
|
||||
// getComputedStyle is not good until after onLoad is called
|
||||
var srcNodeStyle = this.srcNodeRef.style;
|
||||
this._display="";
|
||||
if(srcNodeStyle && srcNodeStyle.display){ this._display=srcNodeStyle.display; }
|
||||
dijit.form.InlineEditBox.superclass.postMixInProperties.apply(this, arguments);
|
||||
else{
|
||||
switch(this.srcNodeRef.tagName.toLowerCase()){
|
||||
case 'span':
|
||||
case 'input':
|
||||
case 'img':
|
||||
case 'button':
|
||||
this._display='inline';
|
||||
break;
|
||||
default:
|
||||
this._display='block';
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.inherited('postMixInProperties', arguments);
|
||||
this.messages = dojo.i18n.getLocalization("dijit", "common", this.lang);
|
||||
dojo.forEach(["buttonSave", "buttonCancel"], function(prop){
|
||||
if(!this[prop]){ this[prop] = this.messages[prop]; }
|
||||
}, this);
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
// don't call setValue yet since the editing widget is not setup
|
||||
if(this.autoSave){
|
||||
dojo.style(this.buttonContainer, "display", "none");
|
||||
}
|
||||
},
|
||||
|
||||
_onKeyPress: function(e){
|
||||
// summary: handle keypress when edit box is not open
|
||||
if(this.disabled || e.altKey || e.ctrlKey){ return; }
|
||||
@@ -122,14 +140,14 @@ dojo.declare(
|
||||
_onMouseOver: function(){
|
||||
if(!this.editing){
|
||||
var classname = this.disabled ? "dijitDisabledClickableRegion" : "dijitClickableRegion";
|
||||
dojo.addClass(this.editable, classname);
|
||||
dojo.addClass(this.textNode, classname);
|
||||
}
|
||||
},
|
||||
|
||||
_onMouseOut: function(){
|
||||
if(!this.editing){
|
||||
var classStr = this.disabled ? "dijitDisabledClickableRegion" : "dijitClickableRegion";
|
||||
dojo.removeClass(this.editable, classStr);
|
||||
dojo.removeClass(this.textNode, classStr);
|
||||
}
|
||||
},
|
||||
|
||||
@@ -143,7 +161,7 @@ dojo.declare(
|
||||
this.editing = true;
|
||||
|
||||
// show the edit form and hide the read only version of the text
|
||||
this._setEditValue(this._isEmpty ? '' : (this.renderAsHtml ? this.editable.innerHTML : this.editable.innerHTML.replace(/\s*\r?\n\s*/g,"").replace(/<br\/?>/gi, "\n").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")));
|
||||
this._setEditValue(this._isEmpty ? '' : (this.renderAsHtml ? this.textNode.innerHTML : this.textNode.innerHTML.replace(/\s*\r?\n\s*/g,"").replace(/<br\/?>/gi, "\n").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")));
|
||||
this._initialText = this._getEditValue();
|
||||
this._visualize();
|
||||
// Before changing the focus, give the browser time to render.
|
||||
@@ -156,9 +174,9 @@ dojo.declare(
|
||||
_visualize: function(){
|
||||
dojo.style(this.editNode, "display", this.editing ? this._display : "none");
|
||||
// #3749: try to set focus now to fix missing caret
|
||||
// #3997: call right before this.editable disappears
|
||||
// #3997: call right after this.containerNode appears
|
||||
if(this.editing){this._setEditFocus();}
|
||||
dojo.style(this.editable, "display", this.editing ? "none" : this._display);
|
||||
dojo.style(this.textNode, "display", this.editing ? "none" : this._display);
|
||||
},
|
||||
|
||||
_showText: function(){
|
||||
@@ -169,21 +187,22 @@ dojo.declare(
|
||||
if(/^\s*$/.test(value)){ value = "?"; this._isEmpty = true; }
|
||||
else { this._isEmpty = false; }
|
||||
if(this.renderAsHtml){
|
||||
this.editable.innerHTML = value;
|
||||
this.textNode.innerHTML = value;
|
||||
}else{
|
||||
this.editable.innerHTML = "";
|
||||
this.textNode.innerHTML = "";
|
||||
if(value.split){
|
||||
var _this=this;
|
||||
var isFirst = true;
|
||||
dojo.forEach(value.split("\n"), function(line){
|
||||
if(isFirst){ isFirst = false; }
|
||||
else {
|
||||
_this.editable.appendChild(document.createElement("BR")); // preserve line breaks
|
||||
if(isFirst){
|
||||
isFirst = false;
|
||||
}else{
|
||||
_this.textNode.appendChild(document.createElement("BR")); // preserve line breaks
|
||||
}
|
||||
_this.editable.appendChild(document.createTextNode(line)); // use text nodes so that imbedded tags can be edited
|
||||
_this.textNode.appendChild(document.createTextNode(line)); // use text nodes so that imbedded tags can be edited
|
||||
});
|
||||
}else{
|
||||
this.editable.appendChild(document.createTextNode(value));
|
||||
this.textNode.appendChild(document.createTextNode(value));
|
||||
}
|
||||
}
|
||||
this._visualize();
|
||||
@@ -193,7 +212,8 @@ dojo.declare(
|
||||
// summary: Callback when user presses "Save" button or it's simulated.
|
||||
// e is passed in if click on save button or user presses Enter. It's not
|
||||
// passed in when called by _onBlur.
|
||||
if(e){ dojo.stopEvent(e); }
|
||||
if(typeof e == "object"){ dojo.stopEvent(e); }
|
||||
if(!this.enableSave()){ return; }
|
||||
this.editing = false;
|
||||
this._showText();
|
||||
// If save button pressed on non-autoSave widget or Enter pressed on autoSave
|
||||
@@ -228,7 +248,7 @@ dojo.declare(
|
||||
// summary:
|
||||
// Callback when keypress in the edit box (see template).
|
||||
// For autoSave widgets, if Esc/Enter, call cancel/save.
|
||||
// For non-autoSave widgets, enable save button if the text value is
|
||||
// For non-autoSave widgets, enable save button if the text value is
|
||||
// different than the original value.
|
||||
if(!this.editing){ return; }
|
||||
if(this.autoSave){
|
||||
@@ -240,17 +260,18 @@ dojo.declare(
|
||||
}
|
||||
}else{
|
||||
var _this = this;
|
||||
// Delay before calling _getEditValue.
|
||||
// The delay gives the browser a chance to update the textarea.
|
||||
setTimeout(
|
||||
function(){
|
||||
_this.saveButton.setDisabled(_this._getEditValue() == _this._initialText); // ignore the tab key
|
||||
}, 100); // the delay gives the browser a chance to update the textarea
|
||||
_this.saveButton.setDisabled(_this._getEditValue() == _this._initialText);
|
||||
}, 100);
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
// summary:
|
||||
// Called by the focus manager in focus.js when focus moves outside of the
|
||||
// Called by the focus manager in focus.js when focus moves outside of the
|
||||
// InlineEditBox widget (or it's descendants).
|
||||
if(this.autoSave && this.editing){
|
||||
if(this._getEditValue() == this._initialText){
|
||||
@@ -261,6 +282,13 @@ dojo.declare(
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
enableSave: function(){
|
||||
// summary: User replacable function returning a Boolean to indicate
|
||||
// if the Save button should be enabled or not - usually due to invalid conditions
|
||||
return this._isEditValid();
|
||||
},
|
||||
|
||||
_onChange: function(){
|
||||
// summary:
|
||||
// This is called when the underlying widget fires an onChange event,
|
||||
@@ -268,19 +296,19 @@ dojo.declare(
|
||||
if(!this.editing){
|
||||
this._showText(); // asynchronous update made famous by ComboBox/FilteringSelect
|
||||
}else if(this.autoSave){
|
||||
this.save();
|
||||
this.save(1);
|
||||
}else{
|
||||
// #3752
|
||||
// if the keypress does not bubble up to the div, (iframe in TextArea blocks it for example)
|
||||
// make sure the save button gets enabled
|
||||
this.saveButton.setDisabled(this._getEditValue() == this._initialText);
|
||||
this.saveButton.setDisabled((this._getEditValue() == this._initialText) || !this.enabledSave());
|
||||
}
|
||||
},
|
||||
|
||||
setDisabled: function(/*Boolean*/ disabled){
|
||||
this.saveButton.setDisabled(disabled);
|
||||
this.cancelButton.setDisabled(disabled);
|
||||
this.editable.disabled = disabled;
|
||||
this.textNode.disabled = disabled;
|
||||
this.editWidget.setDisabled(disabled);
|
||||
this.inherited('setDisabled', arguments);
|
||||
}
|
||||
|
||||
@@ -12,15 +12,19 @@ dojo.declare(
|
||||
// summary:
|
||||
// A mixin for all number textboxes
|
||||
regExpGen: dojo.number.regexp,
|
||||
|
||||
format: function(/*Number*/ value, /*Object*/ constraints){
|
||||
if(isNaN(value)){ return null; }
|
||||
if(isNaN(value)){ return ""; }
|
||||
return dojo.number.format(value, constraints);
|
||||
},
|
||||
serialize: function(/*Number*/ value){
|
||||
if(isNaN(value)){ return null; }
|
||||
return this.inherited('serialize', arguments);
|
||||
},
|
||||
|
||||
parse: dojo.number.parse,
|
||||
|
||||
filter: function(/*Number*/ value){
|
||||
if(typeof value == "string"){ return this.inherited('filter', arguments); }
|
||||
return (isNaN(value) ? '' : value);
|
||||
},
|
||||
|
||||
value: NaN
|
||||
}
|
||||
);
|
||||
|
||||
@@ -6,6 +6,7 @@ dojo.require("dijit.form._FormWidget");
|
||||
dojo.require("dijit._Container");
|
||||
dojo.require("dojo.dnd.move");
|
||||
dojo.require("dijit.form.Button");
|
||||
dojo.require("dojo.number");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.form.HorizontalSlider",
|
||||
@@ -14,7 +15,7 @@ dojo.declare(
|
||||
// summary
|
||||
// A form widget that allows one to select a value with a horizontally draggable image
|
||||
|
||||
templateString:"<table class=\"dijit dijitReset dijitSlider\" cellspacing=0 cellpadding=0 border=0 rules=none id=\"${id}\"\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\" colspan=2></td\n\t\t><td dojoAttachPoint=\"containerNode,topDecoration\" class=\"dijitReset\" style=\"text-align:center;width:100%;\"></td\n\t\t><td class=\"dijitReset\" colspan=2></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset dijitSliderButtonContainer dijitHorizontalSliderButtonContainer\"\n\t\t\t><button dojoType=\"dijit.form.Button\" tabIndex=\"-1\" alt=\"-\" style=\"display:none\" dojoAttachPoint=\"decrementButton\" dojoAttachEvent=\"onClick: decrement\">-</button\n\t\t></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><div class=\"dijitSliderBar dijitSliderBumper dijitHorizontalSliderBumper dijitSliderLeftBumper dijitHorizontalSliderLeftBumper\"></div\n\t\t></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><input dojoAttachPoint=\"valueNode\" name=\"${name}\" type=\"hidden\"\n\t\t\t><div style=\"position:relative;\" dojoAttachPoint=\"sliderBarContainer\"\n\t\t\t\t><div dojoAttachPoint=\"progressBar\" class=\"dijitSliderBar dijitHorizontalSliderBar dijitSliderProgressBar dijitHorizontalSliderProgressBar\" dojoAttachEvent=\"onclick:_onBarClick\"\n\t\t\t\t\t><div tabIndex=\"${tabIndex}\" dojoAttachPoint=\"sliderHandle,focusNode\" class=\"dijitSliderMoveable dijitHorizontalSliderMoveable\" dojoAttachEvent=\"onkeypress:_onKeyPress,onclick:_onHandleClick\" waiRole=\"slider\" valuemin=\"${minimum}\" valuemax=\"${maximum}\"\n\t\t\t\t\t\t><div class=\"dijitSliderImageHandle dijitHorizontalSliderImageHandle\"></div\n\t\t\t\t\t></div\n\t\t\t\t></div\n\t\t\t\t><div dojoAttachPoint=\"remainingBar\" class=\"dijitSliderBar dijitHorizontalSliderBar dijitSliderRemainingBar dijitHorizontalSliderRemainingBar\" dojoAttachEvent=\"onclick:_onBarClick\"></div\n\t\t\t></div\n\t\t></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><div class=\"dijitSliderBar dijitSliderBumper dijitHorizontalSliderBumper dijitSliderRightBumper dijitHorizontalSliderRightBumper\"></div\n\t\t></td\n\t\t><td class=\"dijitReset dijitSliderButtonContainer dijitHorizontalSliderButtonContainer\" style=\"right:0px;\"\n\t\t\t><button dojoType=\"dijit.form.Button\" tabIndex=\"-1\" alt=\"+\" style=\"display:none\" dojoAttachPoint=\"incrementButton\" dojoAttachEvent=\"onClick: increment\">+</button\n\t\t></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\" colspan=2></td\n\t\t><td dojoAttachPoint=\"containerNode,bottomDecoration\" class=\"dijitReset\" style=\"text-align:center;\"></td\n\t\t><td class=\"dijitReset\" colspan=2></td\n\t></tr\n></table>\n",
|
||||
templateString:"<table class=\"dijit dijitReset dijitSlider\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" rules=\"none\"\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\" colspan=\"2\"></td\n\t\t><td dojoAttachPoint=\"containerNode,topDecoration\" class=\"dijitReset\" style=\"text-align:center;width:100%;\"></td\n\t\t><td class=\"dijitReset\" colspan=\"2\"></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset dijitSliderButtonContainer dijitHorizontalSliderButtonContainer\"\n\t\t\t><div class=\"dijitHorizontalSliderDecrementIcon\" tabIndex=\"-1\" style=\"display:none\" dojoAttachPoint=\"decrementButton\" dojoAttachEvent=\"onclick: decrement\"><span class=\"dijitSliderButtonInner\">-</span></div\n\t\t></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><div class=\"dijitSliderBar dijitSliderBumper dijitHorizontalSliderBumper dijitSliderLeftBumper dijitHorizontalSliderLeftBumper\"></div\n\t\t></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><input dojoAttachPoint=\"valueNode\" type=\"hidden\" name=\"${name}\"\n\t\t\t/><div style=\"position:relative;\" dojoAttachPoint=\"sliderBarContainer\"\n\t\t\t\t><div dojoAttachPoint=\"progressBar\" class=\"dijitSliderBar dijitHorizontalSliderBar dijitSliderProgressBar dijitHorizontalSliderProgressBar\" dojoAttachEvent=\"onclick:_onBarClick\"\n\t\t\t\t\t><div dojoAttachPoint=\"sliderHandle,focusNode\" class=\"dijitSliderMoveable dijitHorizontalSliderMoveable\" dojoAttachEvent=\"onkeypress:_onKeyPress,onclick:_onHandleClick\" waiRole=\"slider\" valuemin=\"${minimum}\" valuemax=\"${maximum}\"\n\t\t\t\t\t\t><div class=\"dijitSliderImageHandle dijitHorizontalSliderImageHandle\"></div\n\t\t\t\t\t></div\n\t\t\t\t></div\n\t\t\t\t><div dojoAttachPoint=\"remainingBar\" class=\"dijitSliderBar dijitHorizontalSliderBar dijitSliderRemainingBar dijitHorizontalSliderRemainingBar\" dojoAttachEvent=\"onclick:_onBarClick\"></div\n\t\t\t></div\n\t\t></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><div class=\"dijitSliderBar dijitSliderBumper dijitHorizontalSliderBumper dijitSliderRightBumper dijitHorizontalSliderRightBumper\"></div\n\t\t></td\n\t\t><td class=\"dijitReset dijitSliderButtonContainer dijitHorizontalSliderButtonContainer\" style=\"right:0px;\"\n\t\t\t><div class=\"dijitHorizontalSliderIncrementIcon\" tabIndex=\"-1\" style=\"display:none\" dojoAttachPoint=\"incrementButton\" dojoAttachEvent=\"onclick: increment\"><span class=\"dijitSliderButtonInner\">+</span></div\n\t\t></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\" colspan=\"2\"></td\n\t\t><td dojoAttachPoint=\"containerNode,bottomDecoration\" class=\"dijitReset\" style=\"text-align:center;\"></td\n\t\t><td class=\"dijitReset\" colspan=\"2\"></td\n\t></tr\n></table>\n",
|
||||
value: 0,
|
||||
|
||||
// showButtons: boolean
|
||||
@@ -24,25 +25,30 @@ dojo.declare(
|
||||
// minimum:: integer
|
||||
// The minimum value allowed.
|
||||
minimum: 0,
|
||||
|
||||
|
||||
// maximum: integer
|
||||
// The maximum allowed value.
|
||||
maximum: 100,
|
||||
|
||||
|
||||
// discreteValues: integer
|
||||
// The maximum allowed values dispersed evenly between minimum and maximum (inclusive).
|
||||
discreteValues: Infinity,
|
||||
|
||||
|
||||
// pageIncrement: integer
|
||||
// The amount of change with shift+arrow
|
||||
pageIncrement: 2,
|
||||
|
||||
|
||||
// clickSelect: boolean
|
||||
// If clicking the progress bar changes the value or not
|
||||
clickSelect: true,
|
||||
|
||||
widgetsInTemplate: true,
|
||||
|
||||
attributeMap: dojo.mixin(dojo.clone(dijit.form._FormWidget.prototype.attributeMap),
|
||||
{id:"", name:"valueNode"}),
|
||||
|
||||
baseClass: "dijitSlider",
|
||||
|
||||
_mousePixelCoord: "pageX",
|
||||
_pixelCount: "w",
|
||||
_startingPixelCoord: "x",
|
||||
@@ -51,14 +57,6 @@ dojo.declare(
|
||||
_progressPixelSize: "width",
|
||||
_upsideDown: false,
|
||||
|
||||
setDisabled: function(/*Boolean*/ disabled){
|
||||
if(this.showButtons){
|
||||
this.incrementButton.disabled = disabled;
|
||||
this.decrementButton.disabled = disabled;
|
||||
}
|
||||
dijit.form.HorizontalSlider.superclass.setDisabled.apply(this, arguments);
|
||||
},
|
||||
|
||||
_onKeyPress: function(/*Event*/ e){
|
||||
if(this.disabled || e.altKey || e.ctrlKey){ return; }
|
||||
switch(e.keyCode){
|
||||
@@ -69,12 +67,12 @@ dojo.declare(
|
||||
this.setValue(this.maximum);
|
||||
break;
|
||||
case dojo.keys.UP_ARROW:
|
||||
case dojo.keys.RIGHT_ARROW:
|
||||
case (this._isReversed() ? dojo.keys.LEFT_ARROW : dojo.keys.RIGHT_ARROW):
|
||||
case dojo.keys.PAGE_UP:
|
||||
this.increment(e);
|
||||
break;
|
||||
case dojo.keys.DOWN_ARROW:
|
||||
case dojo.keys.LEFT_ARROW:
|
||||
case (this._isReversed() ? dojo.keys.RIGHT_ARROW : dojo.keys.LEFT_ARROW):
|
||||
case dojo.keys.PAGE_DOWN:
|
||||
this.decrement(e);
|
||||
break;
|
||||
@@ -87,22 +85,32 @@ dojo.declare(
|
||||
|
||||
_onHandleClick: function(e){
|
||||
if(this.disabled){ return; }
|
||||
dijit.focus(this.sliderHandle);
|
||||
if(!dojo.isIE){
|
||||
// make sure you get focus when dragging the handle
|
||||
// (but don't do on IE because it causes a flicker on mouse up (due to blur then focus)
|
||||
dijit.focus(this.sliderHandle);
|
||||
}
|
||||
dojo.stopEvent(e);
|
||||
},
|
||||
|
||||
_isReversed: function() {
|
||||
return !(this._upsideDown || this.isLeftToRight());
|
||||
},
|
||||
|
||||
_onBarClick: function(e){
|
||||
if(this.disabled || !this.clickSelect){ return; }
|
||||
dijit.focus(this.sliderHandle);
|
||||
dojo.stopEvent(e);
|
||||
var abspos = dojo.coords(this.sliderBarContainer, true);
|
||||
var pixelValue = e[this._mousePixelCoord] - abspos[this._startingPixelCoord];
|
||||
this._setPixelValue(this._upsideDown ? (abspos[this._pixelCount] - pixelValue) : pixelValue, abspos[this._pixelCount], true);
|
||||
this._setPixelValue(this._isReversed() || this._upsideDown ? (abspos[this._pixelCount] - pixelValue) : pixelValue, abspos[this._pixelCount], true);
|
||||
},
|
||||
|
||||
_setPixelValue: function(/*Number*/ pixelValue, /*Number*/ maxPixels, /*Boolean, optional*/ priorityChange){
|
||||
if(this.disabled){ return; }
|
||||
pixelValue = pixelValue < 0 ? 0 : maxPixels < pixelValue ? maxPixels : pixelValue;
|
||||
var count = this.discreteValues;
|
||||
if(count > maxPixels || count <= 1){ count = maxPixels; }
|
||||
if(count <= 1 || count == Infinity){ count = maxPixels; }
|
||||
count--;
|
||||
var pixelsPerValue = maxPixels / count;
|
||||
var wholeIncrements = Math.round(pixelValue / pixelsPerValue);
|
||||
@@ -118,16 +126,17 @@ dojo.declare(
|
||||
},
|
||||
|
||||
_bumpValue: function(signedChange){
|
||||
if(this.disabled){ return; }
|
||||
var s = dojo.getComputedStyle(this.sliderBarContainer);
|
||||
var c = dojo._getContentBox(this.sliderBarContainer, s);
|
||||
var count = this.discreteValues;
|
||||
if(count > c[this._pixelCount] || count <= 1){ count = c[this._pixelCount]; }
|
||||
if(count <= 1 || count == Infinity){ count = c[this._pixelCount]; }
|
||||
count--;
|
||||
var value = (this.value - this.minimum) * count / (this.maximum - this.minimum) + signedChange;
|
||||
if(value < 0){ value = 0; }
|
||||
if(value > count){ value = count; }
|
||||
value = value * (this.maximum - this.minimum) / count + this.minimum;
|
||||
this.setValue(value);
|
||||
this.setValue(value, true);
|
||||
},
|
||||
|
||||
decrement: function(e){
|
||||
@@ -171,27 +180,26 @@ dojo.declare(
|
||||
|
||||
postCreate: function(){
|
||||
if(this.showButtons){
|
||||
this.incrementButton.domNode.style.display="";
|
||||
this.decrementButton.domNode.style.display="";
|
||||
this.incrementButton.style.display="";
|
||||
this.decrementButton.style.display="";
|
||||
}
|
||||
this.connect(this.domNode, dojo.isIE ? "onmousewheel" : 'DOMMouseScroll', "_mouseWheeled");
|
||||
|
||||
// define a custom constructor for a SliderMover that points back to me
|
||||
var _self = this;
|
||||
var mover = function(node, e){
|
||||
dijit.form._SliderMover.call(this, node, e);
|
||||
var mover = function(){
|
||||
dijit.form._SliderMover.apply(this, arguments);
|
||||
this.widget = _self;
|
||||
};
|
||||
dojo.extend(mover, dijit.form._SliderMover.prototype);
|
||||
|
||||
|
||||
this._movable = new dojo.dnd.Moveable(this.sliderHandle, {mover: mover});
|
||||
this.inherited('postCreate', arguments);
|
||||
},
|
||||
|
||||
|
||||
destroy: function(){
|
||||
this._movable.destroy();
|
||||
dijit.form.HorizontalSlider.superclass.destroy.apply(this, arguments);
|
||||
this.inherited('destroy', arguments);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -202,7 +210,7 @@ dojo.declare(
|
||||
// summary
|
||||
// A form widget that allows one to select a value with a vertically draggable image
|
||||
|
||||
templateString:"<table class=\"dijitReset dijitSlider\" cellspacing=0 cellpadding=0 border=0 rules=none id=\"${id}\"\n><tbody class=\"dijitReset\"\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\"></td\n\t\t><td class=\"dijitReset dijitSliderButtonContainer dijitVerticalSliderButtonContainer\"\n\t\t\t><button dojoType=\"dijit.form.Button\" tabIndex=-1 alt=\"+\" style=\"display:none\" dojoAttachPoint=\"incrementButton\" dojoAttachEvent=\"onClick: increment\">+</button\n\t\t></td\n\t\t><td class=\"dijitReset\"></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\"></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><center><div class=\"dijitSliderBar dijitSliderBumper dijitVerticalSliderBumper dijitSliderTopBumper dijitVerticalSliderTopBumper\"></div></center\n\t\t></td\n\t\t><td class=\"dijitReset\"></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td dojoAttachPoint=\"leftDecoration\" class=\"dijitReset\" style=\"text-align:center;height:100%;\"></td\n\t\t><td class=\"dijitReset\" style=\"height:100%;\"\n\t\t\t><input dojoAttachPoint=\"valueNode\" type=\"hidden\" name=\"${name}\"\n\t\t\t><center style=\"position:relative;height:100%;\" dojoAttachPoint=\"sliderBarContainer\"\n\t\t\t\t><div dojoAttachPoint=\"remainingBar\" class=\"dijitSliderBar dijitVerticalSliderBar dijitSliderRemainingBar dijitVerticalSliderRemainingBar\" dojoAttachEvent=\"onclick:_onBarClick\"></div\n\t\t\t\t><div dojoAttachPoint=\"progressBar\" class=\"dijitSliderBar dijitVerticalSliderBar dijitSliderProgressBar dijitVerticalSliderProgressBar\" dojoAttachEvent=\"onclick:_onBarClick\"\n\t\t\t\t\t><div tabIndex=\"${tabIndex}\" dojoAttachPoint=\"sliderHandle,focusNode\" class=\"dijitSliderMoveable\" dojoAttachEvent=\"onkeypress:_onKeyPress,onclick:_onHandleClick\" style=\"vertical-align:top;\" waiRole=\"slider\" valuemin=\"${minimum}\" valuemax=\"${maximum}\"\n\t\t\t\t\t\t><div class=\"dijitSliderImageHandle dijitVerticalSliderImageHandle\"></div\n\t\t\t\t\t></div\n\t\t\t\t></div\n\t\t\t></center\n\t\t></td\n\t\t><td dojoAttachPoint=\"containerNode,rightDecoration\" class=\"dijitReset\" style=\"text-align:center;height:100%;\"></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\"></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><center><div class=\"dijitSliderBar dijitSliderBumper dijitVerticalSliderBumper dijitSliderBottomBumper dijitVerticalSliderBottomBumper\"></div></center\n\t\t></td\n\t\t><td class=\"dijitReset\"></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\"></td\n\t\t><td class=\"dijitReset dijitSliderButtonContainer dijitVerticalSliderButtonContainer\"\n\t\t\t><button dojoType=\"dijit.form.Button\" tabIndex=-1 alt=\"-\" style=\"display:none\" dojoAttachPoint=\"decrementButton\" dojoAttachEvent=\"onClick: decrement\">-</button\n\t\t></td\n\t\t><td class=\"dijitReset\"></td\n\t></tr\n></tbody></table>\n",
|
||||
templateString:"<table class=\"dijitReset dijitSlider\" cellspacing=\"0\" cellpadding=\"0\" border=\"0\" rules=\"none\"\n><tbody class=\"dijitReset\"\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\"></td\n\t\t><td class=\"dijitReset dijitSliderButtonContainer dijitVerticalSliderButtonContainer\"\n\t\t\t><div class=\"dijitVerticalSliderIncrementIcon\" tabIndex=\"-1\" style=\"display:none\" dojoAttachPoint=\"incrementButton\" dojoAttachEvent=\"onclick: increment\"><span class=\"dijitSliderButtonInner\">+</span></div\n\t\t></td\n\t\t><td class=\"dijitReset\"></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\"></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><center><div class=\"dijitSliderBar dijitSliderBumper dijitVerticalSliderBumper dijitSliderTopBumper dijitVerticalSliderTopBumper\"></div></center\n\t\t></td\n\t\t><td class=\"dijitReset\"></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td dojoAttachPoint=\"leftDecoration\" class=\"dijitReset\" style=\"text-align:center;height:100%;\"></td\n\t\t><td class=\"dijitReset\" style=\"height:100%;\"\n\t\t\t><input dojoAttachPoint=\"valueNode\" type=\"hidden\" name=\"${name}\"\n\t\t\t/><center style=\"position:relative;height:100%;\" dojoAttachPoint=\"sliderBarContainer\"\n\t\t\t\t><div dojoAttachPoint=\"remainingBar\" class=\"dijitSliderBar dijitVerticalSliderBar dijitSliderRemainingBar dijitVerticalSliderRemainingBar\" dojoAttachEvent=\"onclick:_onBarClick\"></div\n\t\t\t\t><div dojoAttachPoint=\"progressBar\" class=\"dijitSliderBar dijitVerticalSliderBar dijitSliderProgressBar dijitVerticalSliderProgressBar\" dojoAttachEvent=\"onclick:_onBarClick\"\n\t\t\t\t\t><div dojoAttachPoint=\"sliderHandle,focusNode\" class=\"dijitSliderMoveable\" dojoAttachEvent=\"onkeypress:_onKeyPress,onclick:_onHandleClick\" style=\"vertical-align:top;\" waiRole=\"slider\" valuemin=\"${minimum}\" valuemax=\"${maximum}\"\n\t\t\t\t\t\t><div class=\"dijitSliderImageHandle dijitVerticalSliderImageHandle\"></div\n\t\t\t\t\t></div\n\t\t\t\t></div\n\t\t\t></center\n\t\t></td\n\t\t><td dojoAttachPoint=\"containerNode,rightDecoration\" class=\"dijitReset\" style=\"text-align:center;height:100%;\"></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\"></td\n\t\t><td class=\"dijitReset\"\n\t\t\t><center><div class=\"dijitSliderBar dijitSliderBumper dijitVerticalSliderBumper dijitSliderBottomBumper dijitVerticalSliderBottomBumper\"></div></center\n\t\t></td\n\t\t><td class=\"dijitReset\"></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset\"></td\n\t\t><td class=\"dijitReset dijitSliderButtonContainer dijitVerticalSliderButtonContainer\"\n\t\t\t><div class=\"dijitVerticalSliderDecrementIcon\" tabIndex=\"-1\" style=\"display:none\" dojoAttachPoint=\"decrementButton\" dojoAttachEvent=\"onclick: decrement\"><span class=\"dijitSliderButtonInner\">-</span></div\n\t\t></td\n\t\t><td class=\"dijitReset\"></td\n\t></tr\n></tbody></table>\n",
|
||||
_mousePixelCoord: "pageY",
|
||||
_pixelCount: "h",
|
||||
_startingPixelCoord: "y",
|
||||
@@ -226,10 +234,12 @@ dojo.declare("dijit.form._SliderMover",
|
||||
this.constraintBox = c;
|
||||
}
|
||||
var m = this.marginBox;
|
||||
var pixelValue = m[widget._startingPixelCount] + e[widget._mousePixelCoord];
|
||||
dojo.hitch(widget, "_setPixelValue")(widget._upsideDown? (c[widget._pixelCount]-pixelValue) : pixelValue, c[widget._pixelCount]);
|
||||
var pixelValue = widget._isReversed() ?
|
||||
e[widget._mousePixelCoord] - dojo._abs(widget.sliderBarContainer).x :
|
||||
m[widget._startingPixelCount] + e[widget._mousePixelCoord];
|
||||
dojo.hitch(widget, "_setPixelValue")(widget._isReversed() || widget._upsideDown? (c[widget._pixelCount]-pixelValue) : pixelValue, c[widget._pixelCount]);
|
||||
},
|
||||
|
||||
|
||||
destroy: function(e){
|
||||
var widget = this.widget;
|
||||
widget.setValue(widget.value, true);
|
||||
@@ -245,15 +255,15 @@ dojo.declare("dijit.form.HorizontalRule", [dijit._Widget, dijit._Templated],
|
||||
templateString: '<div class="RuleContainer HorizontalRuleContainer"></div>',
|
||||
|
||||
// count: Integer
|
||||
// Number of hash marks to generate
|
||||
// Number of hash marks to generate
|
||||
count: 3,
|
||||
|
||||
// container: Node
|
||||
// If this is a child widget, connect it to this parent node
|
||||
// If this is a child widget, connect it to this parent node
|
||||
container: "containerNode",
|
||||
|
||||
// ruleStyle: String
|
||||
// CSS style to apply to individual hash marks
|
||||
// CSS style to apply to individual hash marks
|
||||
ruleStyle: "",
|
||||
|
||||
_positionPrefix: '<div class="RuleMark HorizontalRuleMark" style="left:',
|
||||
@@ -263,17 +273,27 @@ dojo.declare("dijit.form.HorizontalRule", [dijit._Widget, dijit._Templated],
|
||||
_genHTML: function(pos, ndx){
|
||||
return this._positionPrefix + pos + this._positionSuffix + this.ruleStyle + this._suffix;
|
||||
},
|
||||
|
||||
_isHorizontal: true,
|
||||
|
||||
postCreate: function(){
|
||||
if(this.count==1){
|
||||
var innerHTML = this._genHTML(50, 0);
|
||||
}else{
|
||||
var innerHTML = this._genHTML(0, 0);
|
||||
var interval = 100 / (this.count-1);
|
||||
for(var i=1; i < this.count-1; i++){
|
||||
innerHTML += this._genHTML(interval*i, i);
|
||||
if(!this._isHorizontal || this.isLeftToRight()){
|
||||
var innerHTML = this._genHTML(0, 0);
|
||||
for(var i=1; i < this.count-1; i++){
|
||||
innerHTML += this._genHTML(interval*i, i);
|
||||
}
|
||||
innerHTML += this._genHTML(100, this.count-1);
|
||||
}else{
|
||||
var innerHTML = this._genHTML(100, 0);
|
||||
for(var i=1; i < this.count-1; i++){
|
||||
innerHTML += this._genHTML(100-interval*i, i);
|
||||
}
|
||||
innerHTML += this._genHTML(0, this.count-1);
|
||||
}
|
||||
innerHTML += this._genHTML(100, this.count-1);
|
||||
}
|
||||
this.domNode.innerHTML = innerHTML;
|
||||
}
|
||||
@@ -284,7 +304,9 @@ dojo.declare("dijit.form.VerticalRule", dijit.form.HorizontalRule,
|
||||
// Summary:
|
||||
// Create hash marks for the Vertical slider
|
||||
templateString: '<div class="RuleContainer VerticalRuleContainer"></div>',
|
||||
_positionPrefix: '<div class="RuleMark VerticalRuleMark" style="top:'
|
||||
_positionPrefix: '<div class="RuleMark VerticalRuleMark" style="top:',
|
||||
|
||||
_isHorizontal: false
|
||||
});
|
||||
|
||||
dojo.declare("dijit.form.HorizontalRuleLabels", dijit.form.HorizontalRule,
|
||||
@@ -294,13 +316,29 @@ dojo.declare("dijit.form.HorizontalRuleLabels", dijit.form.HorizontalRule,
|
||||
templateString: '<div class="RuleContainer HorizontalRuleContainer"></div>',
|
||||
|
||||
// labelStyle: String
|
||||
// CSS style to apply to individual text labels
|
||||
// CSS style to apply to individual text labels
|
||||
labelStyle: "",
|
||||
|
||||
// labels: Array
|
||||
// Array of text labels to render - evenly spaced from left-to-right or bottom-to-top
|
||||
labels: [],
|
||||
|
||||
// numericMargin: Integer
|
||||
// Number of generated numeric labels that should be rendered as '' on the ends when labels[] are not specified
|
||||
numericMargin: 0,
|
||||
|
||||
// numericMinimum: Integer
|
||||
// Leftmost label value for generated numeric labels when labels[] are not specified
|
||||
minimum: 0,
|
||||
|
||||
// numericMaximum: Integer
|
||||
// Rightmost label value for generated numeric labels when labels[] are not specified
|
||||
maximum: 1,
|
||||
|
||||
// constraints: object
|
||||
// pattern, places, lang, et al (see dojo.number) for generated numeric labels when labels[] are not specified
|
||||
constraints: {pattern:"#%"},
|
||||
|
||||
_positionPrefix: '<div class="RuleLabelContainer HorizontalRuleLabelContainer" style="left:',
|
||||
_labelPrefix: '"><span class="RuleLabel HorizontalRuleLabel">',
|
||||
_suffix: '</span></div>',
|
||||
@@ -313,20 +351,34 @@ dojo.declare("dijit.form.HorizontalRuleLabels", dijit.form.HorizontalRule,
|
||||
return this._positionPrefix + this._calcPosition(pos) + this._positionSuffix + this.labelStyle + this._labelPrefix + this.labels[ndx] + this._suffix;
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
dijit.form.HorizontalRuleLabels.superclass.postMixInProperties.apply(this);
|
||||
if(!this.labels.length){
|
||||
getLabels: function(){
|
||||
// summary: user replaceable function to return the labels array
|
||||
|
||||
// if the labels array was not specified directly, then see if <li> children were
|
||||
var labels = this.labels;
|
||||
if(!labels.length){
|
||||
// for markup creation, labels are specified as child elements
|
||||
this.labels = dojo.query("> li", this.srcNodeRef).map(function(node){
|
||||
labels = dojo.query("> li", this.srcNodeRef).map(function(node){
|
||||
return String(node.innerHTML);
|
||||
});
|
||||
}
|
||||
this.srcNodeRef.innerHTML="";
|
||||
this.srcNodeRef.innerHTML = '';
|
||||
// if the labels were not specified directly and not as <li> children, then calculate numeric labels
|
||||
if(!labels.length && this.count > 1){
|
||||
var start = this.minimum;
|
||||
var inc = (this.maximum - start) / (this.count-1);
|
||||
for (var i=0; i < this.count; i++){
|
||||
labels.push((i<this.numericMargin||i>=(this.count-this.numericMargin))? '' : dojo.number.format(start, this.constraints));
|
||||
start += inc;
|
||||
}
|
||||
}
|
||||
return labels;
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
postMixInProperties: function(){
|
||||
this.inherited('postMixInProperties', arguments);
|
||||
this.labels = this.getLabels();
|
||||
this.count = this.labels.length;
|
||||
dijit.form.HorizontalRuleLabels.superclass.postCreate.apply(this);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -341,7 +393,9 @@ dojo.declare("dijit.form.VerticalRuleLabels", dijit.form.HorizontalRuleLabels,
|
||||
|
||||
_calcPosition: function(pos){
|
||||
return 100-pos;
|
||||
}
|
||||
},
|
||||
|
||||
_isHorizontal: false
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -28,45 +28,47 @@ dojo.declare(
|
||||
// Converts the first character of each word to uppercase if true.
|
||||
propercase: false,
|
||||
|
||||
// size: String
|
||||
// HTML INPUT tag size declaration.
|
||||
size: "20",
|
||||
// maxLength: String
|
||||
// HTML INPUT tag maxLength declaration.
|
||||
maxLength: "",
|
||||
|
||||
// maxlength: String
|
||||
// HTML INPUT tag maxlength declaration.
|
||||
maxlength: "999999",
|
||||
templateString:"<input class=\"dojoTextBox\" dojoAttachPoint='textbox,focusNode' name=\"${name}\"\n\tdojoAttachEvent='onmouseenter:_onMouse,onmouseleave:_onMouse,onfocus:_onMouse,onblur:_onMouse,onkeyup,onkeypress:_onKeyPress'\n\tautocomplete=\"off\" type=\"${type}\"\n\t/>\n",
|
||||
baseClass: "dijitTextBox",
|
||||
|
||||
templateString:"<input dojoAttachPoint='textbox,focusNode' dojoAttachEvent='onfocus,onkeyup,onkeypress:_onKeyPress' autocomplete=\"off\"\n\tid='${id}' name='${name}' class=\"dijitInputField\" type='${type}' size='${size}' maxlength='${maxlength}' tabIndex='${tabIndex}'>\n",
|
||||
attributeMap: dojo.mixin(dojo.clone(dijit.form._FormWidget.prototype.attributeMap),
|
||||
{maxLength:"focusNode"}),
|
||||
|
||||
getTextValue: function(){
|
||||
getDisplayedValue: function(){
|
||||
return this.filter(this.textbox.value);
|
||||
},
|
||||
|
||||
getValue: function(){
|
||||
return this.parse(this.getTextValue(), this.constraints);
|
||||
return this.parse(this.getDisplayedValue(), this.constraints);
|
||||
},
|
||||
|
||||
setValue: function(value, /*Boolean, optional*/ priorityChange, /*String, optional*/ formattedValue){
|
||||
if(value == null){ value = ""; }
|
||||
value = this.filter(value);
|
||||
if(typeof formattedValue == "undefined" ){
|
||||
formattedValue = (typeof value == "undefined" || value == null || value == NaN) ? null : this.format(value, this.constraints);
|
||||
var filteredValue = this.filter(value);
|
||||
if((typeof filteredValue == typeof value) && (formattedValue == null || formattedValue == undefined)){
|
||||
formattedValue = this.format(filteredValue, this.constraints);
|
||||
}
|
||||
if(formattedValue != null){
|
||||
var _this = this;
|
||||
// synchronous value set needed for InlineEditBox
|
||||
if(formattedValue != null && formattedValue != undefined){
|
||||
this.textbox.value = formattedValue;
|
||||
}
|
||||
dijit.form.TextBox.superclass.setValue.call(this, value, priorityChange);
|
||||
dijit.form.TextBox.superclass.setValue.call(this, filteredValue, priorityChange);
|
||||
},
|
||||
|
||||
setDisplayedValue: function(/*String*/value){
|
||||
this.textbox.value = value;
|
||||
this.setValue(this.getValue(), true);
|
||||
},
|
||||
|
||||
forWaiValuenow: function(){
|
||||
return this.getTextValue();
|
||||
return this.getDisplayedValue();
|
||||
},
|
||||
|
||||
format: function(/* String */ value, /* Object */ constraints){
|
||||
// summary: Replacable function to convert a value to a properly formatted string
|
||||
return value;
|
||||
return ((value == null || value == undefined) ? "" : (value.toString ? value.toString() : value));
|
||||
},
|
||||
|
||||
parse: function(/* String */ value, /* Object */ constraints){
|
||||
@@ -75,19 +77,36 @@ dojo.declare(
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
// get the node for which the background color will be updated
|
||||
if(typeof this.nodeWithBorder != "object"){
|
||||
this.nodeWithBorder = this.textbox;
|
||||
}
|
||||
// setting the value here is needed since value="" in the template causes "undefined"
|
||||
// and setting in the DOM (instead of the JS object) helps with form reset actions
|
||||
this.textbox.setAttribute("value", this.getTextValue());
|
||||
this.textbox.setAttribute("value", this.getDisplayedValue());
|
||||
this.inherited('postCreate', arguments);
|
||||
|
||||
if(this.srcNodeRef){
|
||||
dojo.style(this.textbox, "cssText", this.style);
|
||||
this.textbox.className += " " + this["class"];
|
||||
}
|
||||
this._layoutHack();
|
||||
},
|
||||
|
||||
_layoutHack: function(){
|
||||
// summary: work around table sizing bugs on FF2 by forcing redraw
|
||||
if(dojo.isFF == 2 && this.domNode.tagName=="TABLE"){
|
||||
var node=this.domNode, _this = this;
|
||||
setTimeout(function(){
|
||||
var oldWidth = node.style.width;
|
||||
node.style.width = "0";
|
||||
setTimeout(function(){
|
||||
node.style.width = oldWidth;
|
||||
}, 0);
|
||||
}, 0);
|
||||
}
|
||||
},
|
||||
|
||||
filter: function(val){
|
||||
// summary: Apply various filters to textbox value
|
||||
if(val == null){ return null; }
|
||||
if(val == undefined || val == null){ return ""; }
|
||||
else if(typeof val != "string"){ return val; }
|
||||
if(this.trim){
|
||||
val = dojo.trim(val);
|
||||
}
|
||||
@@ -106,15 +125,8 @@ dojo.declare(
|
||||
},
|
||||
|
||||
// event handlers, you can over-ride these in your own subclasses
|
||||
// TODO: this should be _onFocus (and onfocus removed from the template)
|
||||
onfocus: function(){
|
||||
dojo.addClass(this.nodeWithBorder, "dijitInputFieldFocused");
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
dojo.removeClass(this.nodeWithBorder, "dijitInputFieldFocused");
|
||||
|
||||
this.setValue(this.getValue(), true);
|
||||
this.setValue(this.getValue(), (this.isValid ? this.isValid() : true));
|
||||
},
|
||||
|
||||
onkeyup: function(){
|
||||
|
||||
@@ -4,7 +4,7 @@ dojo.provide("dijit.form.Textarea");
|
||||
|
||||
dojo.require("dijit.form._FormWidget");
|
||||
dojo.require("dojo.i18n");
|
||||
dojo.requireLocalization("dijit.form", "Textarea", null, "ROOT");
|
||||
dojo.requireLocalization("dijit", "Textarea", null, "ROOT");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.form.Textarea",
|
||||
@@ -17,14 +17,18 @@ dojo.declare(
|
||||
// Rows is not supported since this widget adjusts the height.
|
||||
// usage:
|
||||
// <textarea dojoType="dijit.form.TextArea">...</textarea>
|
||||
|
||||
attributeMap: dojo.mixin(dojo.clone(dijit.form._FormWidget.prototype.attributeMap),
|
||||
{style:"styleNode", 'class':"styleNode"}),
|
||||
|
||||
templateString: (dojo.isIE || dojo.isSafari || dojo.isMozilla) ?
|
||||
((dojo.isIE || dojo.isSafari) ? '<fieldset id="${id}" class="dijitInlineBox dijitInputField dijitTextArea"><div dojoAttachPoint="editNode" waiRole="textarea" tabIndex="${tabIndex}" style="text-decoration:none;_padding-bottom:16px;display:block;overflow:auto;" contentEditable="true"></div>'
|
||||
: '<span id="${id}" class="dijitReset"><iframe dojoAttachPoint="iframe, styleNode" dojoAttachEvent="onblur:_onIframeBlur" src="javascript:void(0)" class="dijitInlineBox dijitInputField dijitTextArea"></iframe>')
|
||||
((dojo.isIE || dojo.isSafari) ? '<fieldset id="${id}" class="dijitInline dijitInputField dijitTextArea" dojoAttachPoint="styleNode" waiRole="presentation"><div dojoAttachPoint="editNode,focusNode,eventNode" dojoAttachEvent="onpaste:_changing,oncut:_changing" waiRole="textarea" style="text-decoration:none;_padding-bottom:16px;display:block;overflow:auto;" contentEditable="true"></div>'
|
||||
: '<span id="${id}" class="dijitReset">'+
|
||||
'<iframe src="javascript:<html><head><title>${_iframeEditTitle}</title></head><body><script>var _postCreate=window.frameElement?window.frameElement.postCreate:null;if(_postCreate)_postCreate();</script></body></html>"'+
|
||||
' dojoAttachPoint="iframe,styleNode" dojoAttachEvent="onblur:_onIframeBlur" class="dijitInline dijitInputField dijitTextArea"></iframe>')
|
||||
+ '<textarea name="${name}" value="${value}" dojoAttachPoint="formValueNode" style="display:none;"></textarea>'
|
||||
+ ((dojo.isIE || dojo.isSafari) ? '</fieldset>':'</span>')
|
||||
: '<textarea id="${id}" name="${name}" value="${value}" dojoAttachPoint="formValueNode,editNode" class="dijitInputField dijitTextArea"></textarea>',
|
||||
|
||||
_nlsResources: null, // Needed for screen readers on FF2
|
||||
: '<textarea id="${id}" name="${name}" value="${value}" dojoAttachPoint="formValueNode,editNode,focusNode,styleNode" class="dijitInputField dijitTextArea"></textarea>',
|
||||
|
||||
focus: function(){
|
||||
// summary: Received focus, needed for the InlineEditBox widget
|
||||
@@ -55,10 +59,6 @@ dojo.declare(
|
||||
}else{
|
||||
editNode.appendChild(document.createTextNode(value));
|
||||
}
|
||||
if(this.iframe){
|
||||
this.sizeNode = document.createElement('div');
|
||||
editNode.appendChild(this.sizeNode);
|
||||
}
|
||||
}else{
|
||||
// blah<BR>blah --> blah\nblah
|
||||
// <P>blah</P><P>blah</P> --> blah\nblah
|
||||
@@ -70,21 +70,24 @@ dojo.declare(
|
||||
}
|
||||
value = value.replace(/\s*\r?\n|^\s+|\s+$| /g,"").replace(/>\s+</g,"><").replace(/<\/(p|div)>$|^<(p|div)[^>]*>/gi,"").replace(/([^>])<div>/g,"$1\n").replace(/<\/p>\s*<p[^>]*>|<br[^>]*>/gi,"\n").replace(/<[^>]*>/g,"").replace(/&/gi,"\&").replace(/</gi,"<").replace(/>/gi,">");
|
||||
}
|
||||
this.formValueNode.value = value;
|
||||
this.value = this.formValueNode.value = value;
|
||||
if(this.iframe){
|
||||
var newHeight = this.sizeNode.offsetTop;
|
||||
var sizeNode = document.createElement('div');
|
||||
editNode.appendChild(sizeNode);
|
||||
var newHeight = sizeNode.offsetTop;
|
||||
if(editNode.scrollWidth > editNode.clientWidth){ newHeight+=16; } // scrollbar space needed?
|
||||
if(this.lastHeight != newHeight){ // cache size so that we don't get a resize event because of a resize event
|
||||
if(newHeight == 0){ newHeight = 16; } // height = 0 causes the browser to not set scrollHeight
|
||||
dojo.contentBox(this.iframe, {h: newHeight});
|
||||
this.lastHeight = newHeight;
|
||||
}
|
||||
editNode.removeChild(sizeNode);
|
||||
}
|
||||
dijit.form.Textarea.superclass.setValue.call(this, value, priorityChange);
|
||||
dijit.form.Textarea.superclass.setValue.call(this, this.getValue(), priorityChange);
|
||||
},
|
||||
|
||||
getValue: function(){
|
||||
return this.formValueNode.value;
|
||||
return this.formValueNode.value.replace(/\r/g,"");
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
@@ -99,17 +102,7 @@ dojo.declare(
|
||||
}
|
||||
if(!this.value){ this.value = ""; }
|
||||
this.value = this.value.replace(/\r\n/g,"\n").replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&");
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
if(dojo.isIE || dojo.isSafari){
|
||||
this.domNode.style.overflowY = 'hidden';
|
||||
this.eventNode = this.focusNode = this.editNode;
|
||||
this.connect(this.eventNode, "oncut", this._changing);
|
||||
this.connect(this.eventNode, "onpaste", this._changing);
|
||||
}else if(dojo.isMozilla){
|
||||
var w = this.iframe.contentWindow;
|
||||
var d = w.document;
|
||||
if(dojo.isMozilla){
|
||||
// In the case of Firefox an iframe is used and when the text gets focus,
|
||||
// focus is fired from the document object. There isn't a way to put a
|
||||
// waiRole on the document object and as a result screen readers don't
|
||||
@@ -117,7 +110,7 @@ dojo.declare(
|
||||
//
|
||||
// An additional problem is that the browser gives the document object a
|
||||
// very cryptic accessible name, e.g.
|
||||
// wyciwyg://13/http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/form/test_InlineEditBox.html
|
||||
// wysiwyg://13/http://archive.dojotoolkit.org/nightly/dojotoolkit/dijit/tests/form/test_InlineEditBox.html
|
||||
// When focus is fired from the document object, the screen reader speaks
|
||||
// the accessible name. The cyptic accessile name is confusing.
|
||||
//
|
||||
@@ -126,19 +119,38 @@ dojo.declare(
|
||||
// "edit area". This will be used as the accessible name which will replace
|
||||
// the cryptic name and will also convey the role information to the user.
|
||||
// Because it is read directly to the user, the string must be localized.
|
||||
this._nlsResources = dojo.i18n.getLocalization("dijit.form", "Textarea");
|
||||
d.open();
|
||||
d.write('<html><head><title>' +
|
||||
this._nlsResources.iframeTitle1 + // "edit area"
|
||||
'</title></head><body style="margin:0px;padding:0px;border:0px;"></body></html>');
|
||||
// body > br style is to remove the <br> that gets added by FF
|
||||
d.close();
|
||||
this.editNode = d.body;
|
||||
var _nlsResources = dojo.i18n.getLocalization("dijit", "Textarea");
|
||||
this._iframeEditTitle = _nlsResources.iframeEditTitle;
|
||||
this._iframeFocusTitle = _nlsResources.iframeFocusTitle;
|
||||
var body = this.focusNode = this.editNode = document.createElement('BODY');
|
||||
body.style.margin="0px";
|
||||
body.style.padding="0px";
|
||||
body.style.border="0px";
|
||||
}
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
if(dojo.isIE || dojo.isSafari){
|
||||
this.domNode.style.overflowY = 'hidden';
|
||||
}else if(dojo.isMozilla){
|
||||
var w = this.iframe.contentWindow;
|
||||
try { // #4715: peeking at the title can throw a security exception during iframe setup
|
||||
var title = this.iframe.contentDocument.title;
|
||||
} catch(e) { var title = ''; }
|
||||
if(!w || !title){
|
||||
this.iframe.postCreate = dojo.hitch(this, this.postCreate);
|
||||
return;
|
||||
}
|
||||
var d = w.document;
|
||||
d.getElementsByTagName('HTML')[0].replaceChild(this.editNode, d.getElementsByTagName('BODY')[0]);
|
||||
if(!this.isLeftToRight()){
|
||||
d.getElementsByTagName('HTML')[0].dir = "rtl";
|
||||
}
|
||||
this.iframe.style.overflowY = 'hidden';
|
||||
// resize is a method of window, not document
|
||||
this.eventNode = d;
|
||||
this.focusNode = this.editNode;
|
||||
this.connect(w, "resize", this._changed); // resize is only on the window object
|
||||
// this.connect won't destroy this handler cleanly since its on the iframe's window object
|
||||
// resize is a method of window, not document
|
||||
w.addEventListener("resize", dojo.hitch(this, this._changed), false); // resize is only on the window object
|
||||
}else{
|
||||
this.focusNode = this.domNode;
|
||||
}
|
||||
@@ -167,7 +179,7 @@ dojo.declare(
|
||||
|
||||
_onIframeBlur: function(){
|
||||
// Reset the title back to "edit area".
|
||||
this.iframe.contentDocument.title = this._nlsResources.iframeTitle1;
|
||||
this.iframe.contentDocument.title = this._iframeEditTitle;
|
||||
},
|
||||
|
||||
_onKeyPress: function(e){
|
||||
@@ -180,10 +192,10 @@ dojo.declare(
|
||||
// announced twice which causes confusion. By setting the
|
||||
// contentDocument's title to "edit area frame" the confusion should be
|
||||
// eliminated.
|
||||
this.iframe.contentDocument.title = this._nlsResources.iframeTitle2;
|
||||
this.iframe.contentDocument.title = this._iframeFocusTitle;
|
||||
// Place focus on the iframe. A subsequent tab or shift tab will put focus
|
||||
// on the correct control.
|
||||
// Note: Can't use this.focus() because that results in a call to
|
||||
// Note: Can't use this.focus() because that results in a call to
|
||||
// dijit.focus and if that receives an iframe target it will set focus
|
||||
// on the iframe's contentWindow.
|
||||
this.iframe.focus(); // this.focus(); won't work
|
||||
|
||||
@@ -5,7 +5,7 @@ dojo.provide("dijit.form.TimeTextBox");
|
||||
dojo.require("dojo.date");
|
||||
dojo.require("dojo.date.locale");
|
||||
dojo.require("dojo.date.stamp");
|
||||
dojo.require("dijit.form._TimePicker");
|
||||
dojo.require("dijit._TimePicker");
|
||||
dojo.require("dijit.form.ValidationTextBox");
|
||||
|
||||
dojo.declare(
|
||||
@@ -28,11 +28,11 @@ dojo.declare(
|
||||
value: new Date(""), // NaN
|
||||
_invalid: (new Date("")).toString(), // NaN
|
||||
|
||||
_popupClass: "dijit.form._TimePicker",
|
||||
_popupClass: "dijit._TimePicker",
|
||||
|
||||
postMixInProperties: function(){
|
||||
dijit.form.RangeBoundTextBox.prototype.postMixInProperties.apply(this, arguments);
|
||||
|
||||
//dijit.form.RangeBoundTextBox.prototype.postMixInProperties.apply(this, arguments);
|
||||
this.inherited("postMixInProperties",arguments);
|
||||
var constraints = this.constraints;
|
||||
constraints.selector = 'time';
|
||||
if(typeof constraints.min == "string"){ constraints.min = dojo.date.stamp.fromISOString(constraints.min); }
|
||||
@@ -40,7 +40,7 @@ dojo.declare(
|
||||
},
|
||||
|
||||
_onFocus: function(/*Event*/ evt){
|
||||
// open the calendar
|
||||
// summary: open the TimePicker popup
|
||||
this._open();
|
||||
},
|
||||
|
||||
@@ -57,7 +57,10 @@ dojo.declare(
|
||||
|
||||
_open: function(){
|
||||
// summary:
|
||||
// opens the Calendar, and sets the onValueSelected for the Calendar
|
||||
// opens the TimePicker, and sets the onValueSelected value
|
||||
|
||||
if(this.disabled){return;}
|
||||
|
||||
var self = this;
|
||||
|
||||
if(!this._picker){
|
||||
@@ -66,7 +69,7 @@ dojo.declare(
|
||||
onValueSelected: function(value){
|
||||
|
||||
self.focus(); // focus the textbox before the popup closes to avoid reopening the popup
|
||||
setTimeout(dijit.popup.close, 1); // allow focus time to take
|
||||
setTimeout(dojo.hitch(self, "_close"), 1); // allow focus time to take
|
||||
|
||||
// this will cause InlineEditBox and other handlers to do stuff so make sure it's last
|
||||
dijit.form.TimeTextBox.superclass.setValue.call(self, value, true);
|
||||
@@ -86,15 +89,25 @@ dojo.declare(
|
||||
parent: this,
|
||||
popup: this._picker,
|
||||
around: this.domNode,
|
||||
onCancel: dojo.hitch(this, this._close),
|
||||
onClose: function(){ self._opened=false; }
|
||||
});
|
||||
this._opened=true;
|
||||
}
|
||||
|
||||
dojo.marginBox(this._picker.domNode,{ w:this.domNode.offsetWidth });
|
||||
},
|
||||
|
||||
_close: function(){
|
||||
if(this._opened){
|
||||
dijit.popup.close(this._picker);
|
||||
this._opened=false;
|
||||
}
|
||||
},
|
||||
|
||||
_onBlur: function(){
|
||||
// summary: called magically when focus has shifted away from this widget and it's dropdown
|
||||
dijit.popup.closeAll();
|
||||
this._close();
|
||||
this.inherited('_onBlur', arguments);
|
||||
// don't focus on <input>. the user has explicitly focused on something else.
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@ dojo.require("dojo.i18n");
|
||||
dojo.require("dijit.form.TextBox");
|
||||
dojo.require("dijit.Tooltip");
|
||||
|
||||
dojo.requireLocalization("dijit.form", "validate", null, "zh-cn,ja,it,ROOT,fr,de");
|
||||
dojo.requireLocalization("dijit.form", "validate", null, "ko,zh-cn,zh,ja,zh-tw,ru,it,hu,ROOT,fr,pt,pl,es,de,cs");
|
||||
|
||||
dojo.declare(
|
||||
"dijit.form.ValidationTextBox",
|
||||
@@ -17,6 +17,9 @@ dojo.declare(
|
||||
// A subclass of TextBox.
|
||||
// Over-ride isValid in subclasses to perform specific kinds of validation.
|
||||
|
||||
templateString:"<table style=\"display: -moz-inline-stack;\" class=\"dijit dijitReset dijitInlineTable\" cellspacing=\"0\" cellpadding=\"0\"\n\tid=\"widget_${id}\" name=\"${name}\"\n\tdojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse\" waiRole=\"presentation\"\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset dijitInputField\" width=\"100%\"\n\t\t\t><input dojoAttachPoint='textbox,focusNode' dojoAttachEvent='onfocus,onblur:_onMouse,onkeyup,onkeypress:_onKeyPress' autocomplete=\"off\"\n\t\t\ttype='${type}' name='${name}'\n\t\t/></td\n\t\t><td class=\"dijitReset dijitValidationIconField\" width=\"0%\"\n\t\t\t><div dojoAttachPoint='iconNode' class='dijitValidationIcon'></div><div class='dijitValidationIconText'>Χ</div\n\t\t></td\n\t></tr\n></table>\n",
|
||||
baseClass: "dijitTextBox",
|
||||
|
||||
// default values for new subclass properties
|
||||
// required: Boolean
|
||||
// Can be true or false, default is false.
|
||||
@@ -26,7 +29,7 @@ dojo.declare(
|
||||
promptMessage: "",
|
||||
// invalidMessage: String
|
||||
// The message to display if value is invalid.
|
||||
invalidMessage: "",
|
||||
invalidMessage: "\x00", // read from the message file if not overridden
|
||||
// constraints: Object
|
||||
// user-defined object needed to pass parameters to the validator functions
|
||||
constraints: {},
|
||||
@@ -38,6 +41,10 @@ dojo.declare(
|
||||
// user replaceable function used to generate regExp when dependent on constraints
|
||||
// Do not specify both regExp and regExpGen
|
||||
regExpGen: function(constraints){ return this.regExp; },
|
||||
|
||||
// state: String
|
||||
// Shows current state (ie, validation result) of input (Normal, Warning, or Error)
|
||||
state: "",
|
||||
|
||||
setValue: function(){
|
||||
this.inherited('setValue', arguments);
|
||||
@@ -46,7 +53,9 @@ dojo.declare(
|
||||
|
||||
validator: function(value,constraints){
|
||||
// summary: user replaceable function used to validate the text input against the regular expression.
|
||||
return (new RegExp("^(" + this.regExpGen(constraints) + ")"+(this.required?"":"?")+"$")).test(value)&&(!this.required||!this._isEmpty(value));
|
||||
return (new RegExp("^(" + this.regExpGen(constraints) + ")"+(this.required?"":"?")+"$")).test(value) &&
|
||||
(!this.required || !this._isEmpty(value)) &&
|
||||
(this._isEmpty(value) || this.parse(value, constraints) !== null);
|
||||
},
|
||||
|
||||
isValid: function(/* Boolean*/ isFocused){
|
||||
@@ -76,14 +85,12 @@ dojo.declare(
|
||||
// Show missing or invalid messages if appropriate, and highlight textbox field.
|
||||
var message = "";
|
||||
var isValid = this.isValid(isFocused);
|
||||
var className = isValid ? "Normal" : "Error";
|
||||
if(!dojo.hasClass(this.nodeWithBorder, "dijitInputFieldValidation"+className)){
|
||||
dojo.removeClass(this.nodeWithBorder, "dijitInputFieldValidation"+((className=="Normal")?"Error":"Normal"));
|
||||
dojo.addClass(this.nodeWithBorder, "dijitInputFieldValidation"+className);
|
||||
}
|
||||
dijit.wai.setAttr(this.focusNode, "waiState", "invalid", (isValid? "false" : "true"));
|
||||
var isEmpty = this._isEmpty(this.textbox.value);
|
||||
this.state = (isValid || (!this._hasBeenBlurred && isEmpty)) ? "" : "Error";
|
||||
this._setStateClass();
|
||||
dijit.setWaiState(this.focusNode, "invalid", (isValid? "false" : "true"));
|
||||
if(isFocused){
|
||||
if(this._isEmpty(this.textbox.value)){
|
||||
if(isEmpty){
|
||||
message = this.getPromptMessage(true);
|
||||
}
|
||||
if(!message && !isValid){
|
||||
@@ -101,42 +108,46 @@ dojo.declare(
|
||||
this._message = message;
|
||||
this.displayMessage(message);
|
||||
},
|
||||
|
||||
|
||||
displayMessage: function(/*String*/ message){
|
||||
// summary:
|
||||
// User overridable method to display validation errors/hints.
|
||||
// By default uses a tooltip.
|
||||
if(message){
|
||||
dijit.MasterTooltip.show(message, this.domNode);
|
||||
dijit.showTooltip(message, this.domNode);
|
||||
}else{
|
||||
dijit.MasterTooltip.hide();
|
||||
dijit.hideTooltip(this.domNode);
|
||||
}
|
||||
},
|
||||
|
||||
_hasBeenBlurred: false,
|
||||
|
||||
_onBlur: function(evt){
|
||||
this._hasBeenBlurred = true;
|
||||
this.validate(false);
|
||||
this.inherited('_onBlur', arguments);
|
||||
},
|
||||
|
||||
onfocus: function(evt){
|
||||
this.inherited('onfocus', arguments);
|
||||
// TODO: change to _onFocus?
|
||||
this.validate(true);
|
||||
this._onMouse(evt); // update CSS classes
|
||||
},
|
||||
|
||||
onkeyup: function(evt){
|
||||
this.onfocus(evt);
|
||||
},
|
||||
|
||||
//////////// INITIALIZATION METHODS ///////////////////////////////////////
|
||||
constructor: function(){
|
||||
this.constraints = {};
|
||||
},
|
||||
|
||||
postMixInProperties: function(){
|
||||
if(this.constraints == dijit.form.ValidationTextBox.prototype.constraints){
|
||||
this.constraints = {};
|
||||
}
|
||||
this.inherited('postMixInProperties', arguments);
|
||||
this.constraints.locale=this.lang;
|
||||
this.messages = dojo.i18n.getLocalization("dijit.form", "validate", this.lang);
|
||||
dojo.forEach(["invalidMessage", "missingMessage"], function(prop){
|
||||
if(!this[prop]){ this[prop] = this.messages[prop]; }
|
||||
}, this);
|
||||
if(this.invalidMessage == "\x00"){ this.invalidMessage = this.messages.invalidMessage; }
|
||||
var p = this.regExpGen(this.constraints);
|
||||
this.regExp = p;
|
||||
// make value a string for all types so that form reset works well
|
||||
@@ -152,14 +163,14 @@ dojo.declare(
|
||||
// A subclass of ValidationTextBox.
|
||||
// Provides a hidden input field and a serialize method to override
|
||||
|
||||
serialize: function(val){
|
||||
serialize: function(val, /*Object?*/options){
|
||||
// summary: user replaceable function used to convert the getValue() result to a String
|
||||
return val.toString();
|
||||
return (val.toString ? val.toString() : "");
|
||||
},
|
||||
|
||||
toString: function(){
|
||||
// summary: display the widget as a printable string using the widget's value
|
||||
var val = this.getValue();
|
||||
var val = this.filter(this.getValue());
|
||||
return (val!=null) ? ((typeof val == "string") ? val : this.serialize(val, this.constraints)) : "";
|
||||
},
|
||||
|
||||
@@ -175,8 +186,8 @@ dojo.declare(
|
||||
valueNode.setAttribute("value", this.toString());
|
||||
dojo.style(valueNode, "display", "none");
|
||||
valueNode.name = this.textbox.name;
|
||||
this.textbox.name = "_" + this.textbox.name + "_displayed_";
|
||||
this.textbox.removeAttribute("name");
|
||||
|
||||
dojo.place(valueNode, textbox, "after");
|
||||
|
||||
this.inherited('postCreate', arguments);
|
||||
@@ -201,7 +212,7 @@ dojo.declare(
|
||||
=====*/
|
||||
|
||||
// rangeMessage: String
|
||||
// The message to display if value is out-of-range
|
||||
// The message to display if value is out-of-range
|
||||
rangeMessage: "",
|
||||
|
||||
compare: function(val1, val2){
|
||||
@@ -245,10 +256,10 @@ dojo.declare(
|
||||
postCreate: function(){
|
||||
this.inherited('postCreate', arguments);
|
||||
if(typeof this.constraints.min != "undefined"){
|
||||
dijit.wai.setAttr(this.domNode, "waiState", "valuemin", this.constraints.min);
|
||||
dijit.setWaiState(this.focusNode, "valuemin", this.constraints.min);
|
||||
}
|
||||
if(typeof this.constraints.max != "undefined"){
|
||||
dijit.wai.setAttr(this.domNode, "waiState", "valuemax", this.constraints.max);
|
||||
dijit.setWaiState(this.focusNode, "valuemax", this.constraints.max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,9 @@ dojo.declare("dijit.form._FormWidget", [dijit._Widget, dijit._Templated],
|
||||
*/
|
||||
|
||||
// baseClass: String
|
||||
// Used to add CSS classes like FormElementDisabled
|
||||
// TODO: remove this in favor of this.domNode.baseClass?
|
||||
// Root CSS class of the widget (ex: dijitTextBox), used to add CSS classes of widget
|
||||
// (ex: "dijitTextBox dijitTextBoxInvalid dijitTextBoxFocused dijitTextBoxInvalidFocused")
|
||||
// See _setStateClass().
|
||||
baseClass: "",
|
||||
|
||||
// value: String
|
||||
@@ -56,9 +57,16 @@ dojo.declare("dijit.form._FormWidget", [dijit._Widget, dijit._Templated],
|
||||
disabled: false,
|
||||
|
||||
// intermediateChanges: Boolean
|
||||
// Fires onChange for each value change or only on demand
|
||||
// Fires onChange for each value change or only on demand
|
||||
intermediateChanges: false,
|
||||
|
||||
// These mixins assume that the focus node is an INPUT, as many but not all _FormWidgets are.
|
||||
// Don't attempt to mixin the 'type', 'name' attributes here programatically -- they must be declared
|
||||
// directly in the template as read by the parser in order to function. IE is known to specifically
|
||||
// require the 'name' attribute at element creation time.
|
||||
attributeMap: dojo.mixin(dojo.clone(dijit._Widget.prototype.attributeMap),
|
||||
{id:"focusNode", tabIndex:"focusNode", alt:"focusNode"}),
|
||||
|
||||
setDisabled: function(/*Boolean*/ disabled){
|
||||
// summary:
|
||||
// Set disabled state of widget.
|
||||
@@ -73,35 +81,34 @@ dojo.declare("dijit.form._FormWidget", [dijit._Widget, dijit._Templated],
|
||||
this._hovering = false;
|
||||
this._active = false;
|
||||
}
|
||||
dijit.wai.setAttr(this.focusNode || this.domNode, "waiState", "disabled", disabled);
|
||||
dijit.setWaiState(this.focusNode || this.domNode, "disabled", disabled);
|
||||
this._setStateClass();
|
||||
},
|
||||
|
||||
|
||||
_onMouse : function(/*Event*/ event){
|
||||
// summary:
|
||||
// Sets _hovering, _active, and baseClass attributes depending on mouse state,
|
||||
// then calls setStateClass() to set appropriate CSS class for this.domNode.
|
||||
// Sets _hovering, _active, and stateModifier properties depending on mouse state,
|
||||
// then calls setStateClass() to set appropriate CSS classes for this.domNode.
|
||||
//
|
||||
// To get a different CSS class for hover, send onmouseover and onmouseout events to this method.
|
||||
// To get a different CSS class while mouse button is depressed, send onmousedown to this method.
|
||||
|
||||
var mouseNode = event.target;
|
||||
if(mouseNode && mouseNode.getAttribute){
|
||||
this.stateModifier = mouseNode.getAttribute("stateModifier") || "";
|
||||
}
|
||||
|
||||
if(!this.disabled){
|
||||
switch(event.type){
|
||||
case "mouseenter" :
|
||||
case "mouseover" :
|
||||
this._hovering = true;
|
||||
var baseClass, node=mouseNode;
|
||||
while( node.nodeType===1 && !(baseClass=node.getAttribute("baseClass")) && node != this.domNode ){
|
||||
node=node.parentNode;
|
||||
}
|
||||
this.baseClass= baseClass || "dijit"+this.declaredClass.replace(/.*\./g,"");
|
||||
break;
|
||||
|
||||
case "mouseout" :
|
||||
this._hovering = false;
|
||||
this.baseClass=null;
|
||||
case "mouseleave" :
|
||||
this._hovering = false;
|
||||
break;
|
||||
|
||||
case "mousedown" :
|
||||
@@ -121,41 +128,53 @@ dojo.declare("dijit.form._FormWidget", [dijit._Widget, dijit._Templated],
|
||||
}
|
||||
},
|
||||
|
||||
isFocusable: function(){
|
||||
return !this.disabled && (dojo.style(this.domNode, "display") != "none");
|
||||
},
|
||||
|
||||
focus: function(){
|
||||
dijit.focus(this.focusNode);
|
||||
},
|
||||
|
||||
_setStateClass: function(/*String*/ base){
|
||||
// summary:
|
||||
// Update the visual state of the widget by changing the css class on the domnode
|
||||
// according to widget state.
|
||||
_setStateClass: function(){
|
||||
// summary
|
||||
// Update the visual state of the widget by setting the css classes on this.domNode
|
||||
// (or this.stateNode if defined) by combining this.baseClass with
|
||||
// various suffixes that represent the current widget state(s).
|
||||
//
|
||||
// State will be one of:
|
||||
// <baseClass>
|
||||
// <baseClass> + "Disabled" - if the widget is disabled
|
||||
// <baseClass> + "Active" - if the mouse (or space/enter key?) is being pressed down
|
||||
// <baseClass> + "Hover" - if the mouse is over the widget
|
||||
// <baseClass> + "Focused" - if the widget has focus
|
||||
// In the case where a widget has multiple
|
||||
// states, it sets the class based on all possible
|
||||
// combinations. For example, an invalid form widget that is being hovered
|
||||
// will be "dijitInput dijitInputInvalid dijitInputHover dijitInputInvalidHover".
|
||||
//
|
||||
// Note: if you don't want to change the way the widget looks on hover, then don't call
|
||||
// this routine on hover. Similarly for mousedown --> active
|
||||
// For complex widgets with multiple regions, there can be various hover/active states,
|
||||
// such as "Hover" or "CloseButtonHover" (for tab buttons).
|
||||
// This is controlled by a stateModifier="CloseButton" attribute on the close button node.
|
||||
//
|
||||
// For widgets which can be in a checked state (like checkbox or radio),
|
||||
// in addition to the above classes...
|
||||
// <baseClass> + "Checked"
|
||||
// <baseClass> + "CheckedDisabled" - if the widget is disabled
|
||||
// <baseClass> + "CheckedActive" - if the mouse is being pressed down
|
||||
// <baseClass> + "CheckedHover" - if the mouse is over the widget
|
||||
// <baseClass> + "CheckedFocused" - if the widget has focus
|
||||
// The widget may have one or more of the following states, determined
|
||||
// by this.state, this.checked, this.valid, and this.selected:
|
||||
// Error - ValidationTextBox sets this.state to "Error" if the current input value is invalid
|
||||
// Checked - ex: a checkmark or a ToggleButton in a checked state, will have this.checked==true
|
||||
// Selected - ex: currently selected tab will have this.selected==true
|
||||
//
|
||||
// In addition, it may have at most one of the following states,
|
||||
// based on this.disabled and flags set in _onMouse (this._active, this._hovering, this._focused):
|
||||
// Disabled - if the widget is disabled
|
||||
// Active - if the mouse (or space/enter key?) is being pressed down
|
||||
// Focused - if the widget has focus
|
||||
// Hover - if the mouse is over the widget
|
||||
//
|
||||
// (even if multiple af the above conditions are true we only pick the first matching one)
|
||||
|
||||
// get original class (non state related) specified in template
|
||||
var origClass = (this.styleNode||this.domNode).className;
|
||||
|
||||
// compute list of classname representing the states of the widget
|
||||
var base = this.baseClass || this.domNode.getAttribute("baseClass") || "dijitFormWidget";
|
||||
origClass = origClass.replace(new RegExp("\\b"+base+"(Checked)?(Selected)?(Disabled|Active|Focused|Hover)?\\b\\s*", "g"), "");
|
||||
var classes = [ base ];
|
||||
|
||||
// Get original (non state related, non baseClass related) class specified in template
|
||||
if(!("staticClass" in this)){
|
||||
this.staticClass = (this.stateNode||this.domNode).className;
|
||||
}
|
||||
|
||||
// Compute new set of classes
|
||||
var classes = [ this.baseClass ];
|
||||
|
||||
function multiply(modifier){
|
||||
classes=classes.concat(dojo.map(classes, function(c){ return c+modifier; }));
|
||||
}
|
||||
@@ -163,23 +182,26 @@ dojo.declare("dijit.form._FormWidget", [dijit._Widget, dijit._Templated],
|
||||
if(this.checked){
|
||||
multiply("Checked");
|
||||
}
|
||||
if(this.state){
|
||||
multiply(this.state);
|
||||
}
|
||||
if(this.selected){
|
||||
multiply("Selected");
|
||||
}
|
||||
|
||||
|
||||
// Only one of these four can be applied.
|
||||
// Active trumps Focused, Focused trumps Hover, and Disabled trumps all.
|
||||
if(this.disabled){
|
||||
multiply("Disabled");
|
||||
}else if(this._active){
|
||||
multiply("Active");
|
||||
multiply(this.stateModifier+"Active");
|
||||
}else if(this._focused){
|
||||
multiply("Focused");
|
||||
}else if(this._hovering){
|
||||
multiply("Hover");
|
||||
multiply(this.stateModifier+"Hover");
|
||||
}
|
||||
|
||||
(this.styleNode || this.domNode).className = origClass + " " + classes.join(" ");
|
||||
(this.stateNode || this.domNode).className = this.staticClass + " " + classes.join(" ");
|
||||
},
|
||||
|
||||
onChange: function(newValue){
|
||||
@@ -187,7 +209,7 @@ dojo.declare("dijit.form._FormWidget", [dijit._Widget, dijit._Templated],
|
||||
},
|
||||
|
||||
postCreate: function(){
|
||||
this.setValue(this.value, true);
|
||||
this.setValue(this.value, null); // null reserved for initial value
|
||||
this.setDisabled(this.disabled);
|
||||
this._setStateClass();
|
||||
},
|
||||
@@ -195,8 +217,11 @@ dojo.declare("dijit.form._FormWidget", [dijit._Widget, dijit._Templated],
|
||||
setValue: function(/*anything*/ newValue, /*Boolean, optional*/ priorityChange){
|
||||
// summary: set the value of the widget.
|
||||
this._lastValue = newValue;
|
||||
dijit.wai.setAttr(this.focusNode || this.domNode, "waiState", "valuenow", this.forWaiValuenow());
|
||||
if((this.intermediateChanges || priorityChange) && newValue != this._lastValueReported){
|
||||
dijit.setWaiState(this.focusNode || this.domNode, "valuenow", this.forWaiValuenow());
|
||||
if(this._lastValueReported == undefined && priorityChange === null){ // don't report the initial value
|
||||
this._lastValueReported = newValue;
|
||||
}
|
||||
if((this.intermediateChanges || priorityChange) && newValue !== this._lastValueReported){
|
||||
this._lastValueReported = newValue;
|
||||
this.onChange(newValue);
|
||||
}
|
||||
@@ -216,10 +241,10 @@ dojo.declare("dijit.form._FormWidget", [dijit._Widget, dijit._Templated],
|
||||
if(e.keyCode == dojo.keys.ESCAPE && !e.shiftKey && !e.ctrlKey && !e.altKey){
|
||||
var v = this.getValue();
|
||||
var lv = this._lastValueReported;
|
||||
// Equality comparison of objects such as dates are done by reference so
|
||||
// two distinct objects are != even if they have the same data. So use
|
||||
// Equality comparison of objects such as dates are done by reference so
|
||||
// two distinct objects are != even if they have the same data. So use
|
||||
// toStrings in case the values are objects.
|
||||
if(lv != undefined && v.toString() != lv.toString()){
|
||||
if((typeof lv != "undefined") && ((v!==null && v.toString)?v.toString():null) !== lv.toString()){
|
||||
this.undo();
|
||||
dojo.stopEvent(e);
|
||||
return false;
|
||||
|
||||
@@ -14,23 +14,24 @@ dojo.declare(
|
||||
// It modifies the template to have up/down arrows, and provides related handling code.
|
||||
|
||||
// defaultTimeout: Number
|
||||
// number of milliseconds before a held key or button becomes typematic
|
||||
// number of milliseconds before a held key or button becomes typematic
|
||||
defaultTimeout: 500,
|
||||
|
||||
// timeoutChangeRate: Number
|
||||
// fraction of time used to change the typematic timer between events
|
||||
// 1.0 means that each typematic event fires at defaultTimeout intervals
|
||||
// < 1.0 means that each typematic event fires at an increasing faster rate
|
||||
// fraction of time used to change the typematic timer between events
|
||||
// 1.0 means that each typematic event fires at defaultTimeout intervals
|
||||
// < 1.0 means that each typematic event fires at an increasing faster rate
|
||||
timeoutChangeRate: 0.90,
|
||||
|
||||
// smallDelta: Number
|
||||
// adjust the value by this much when spinning using the arrow keys/buttons
|
||||
// adjust the value by this much when spinning using the arrow keys/buttons
|
||||
smallDelta: 1,
|
||||
// largeDelta: Number
|
||||
// adjust the value by this much when spinning using the PgUp/Dn keys
|
||||
// adjust the value by this much when spinning using the PgUp/Dn keys
|
||||
largeDelta: 10,
|
||||
|
||||
templateString:"<table class=\"dijit dijitReset dijitInline dijitLeft dijitSpinner\" baseClass=\"dijitSpinner\" cellspacing=\"0\" cellpadding=\"0\"\n\tid=\"widget_${id}\" name=\"${name}\"\n\tdojoAttachEvent=\"onmouseover:_onMouse,onmouseout:_onMouse,onkeypress:_onKeyPress\"\n\twaiRole=\"presentation\">\n\t<tr class=\"dijitReset\">\n\t\t<td rowspan=\"2\" class=\"dijitReset dijitStretch dijitSpinnerInput\">\n\t\t\t<input dojoAttachPoint=\"textbox,focusNode\" type=\"${type}\" dojoAttachEvent=\"onfocus,onkeyup\"\n\t\t\t\tvalue=\"${value}\" name=\"${name}\" size=\"${size}\" maxlength=\"${maxlength}\"\n\t\t\t\twaiRole=\"spinbutton\" autocomplete=\"off\" tabIndex=\"${tabIndex}\" id=\"${id}\"\n\t\t\t></td>\n\t\t<td class=\"dijitReset dijitRight dijitButtonNode dijitUpArrowButton\" \n\t\t\t\tdojoAttachPoint=\"upArrowNode\"\n\t\t\t\tdojoAttachEvent=\"onmousedown:_handleUpArrowEvent,onmouseup:_handleUpArrowEvent,onmouseover:_handleUpArrowEvent,onmouseout:_handleUpArrowEvent\"\n\t\t\t\tbaseClass=\"dijitSpinnerUpArrow\"\n\t\t\t><div class=\"dijitA11yUpArrow\" waiRole=\"presentation\" tabIndex=\"-1\">▲</div></td>\n\t</tr><tr class=\"dijitReset\">\n\t\t<td class=\"dijitReset dijitRight dijitButtonNode dijitDownArrowButton\" \n\t\t\t\tdojoAttachPoint=\"downArrowNode\"\n\t\t\t\tdojoAttachEvent=\"onmousedown:_handleDownArrowEvent,onmouseup:_handleDownArrowEvent,onmouseover:_handleDownArrowEvent,onmouseout:_handleDownArrowEvent\"\n\t\t\t\tbaseClass=\"dijitSpinnerDownArrow\"\n\t\t\t><div class=\"dijitA11yDownArrow\" waiRole=\"presentation\" tabIndex=\"-1\">▼</div></td>\n\t</tr>\n</table>\n\n",
|
||||
templateString:"<table style=\"-moz-inline-stack;\" class=\"dijit dijitReset dijitInlineTable dijitLeft\" cellspacing=\"0\" cellpadding=\"0\"\n\tid=\"widget_${id}\" name=\"${name}\"\n\tdojoAttachEvent=\"onmouseenter:_onMouse,onmouseleave:_onMouse,onkeypress:_onKeyPress\"\n\twaiRole=\"presentation\"\n\t><tr class=\"dijitReset\"\n\t\t><td rowspan=\"2\" class=\"dijitReset dijitStretch dijitInputField\" width=\"100%\"\n\t\t\t><input dojoAttachPoint=\"textbox,focusNode\" type=\"${type}\" dojoAttachEvent=\"onfocus,onkeyup\"\n\t\t\t\twaiRole=\"spinbutton\" autocomplete=\"off\" name=\"${name}\"\n\t\t></td\n\t\t><td rowspan=\"2\" class=\"dijitReset dijitValidationIconField\" width=\"0%\" \n\t\t\t><div dojoAttachPoint='iconNode' class='dijitInline dijitValidationIcon'></div\n\t\t></td\n\t\t><td class=\"dijitReset dijitRight dijitButtonNode dijitUpArrowButton\" width=\"0%\"\n\t\t\t\tdojoAttachPoint=\"upArrowNode\"\n\t\t\t\tdojoAttachEvent=\"onmousedown:_handleUpArrowEvent,onmouseup:_handleUpArrowEvent,onmouseover:_handleUpArrowEvent,onmouseout:_handleUpArrowEvent\"\n\t\t\t\tstateModifier=\"UpArrow\"\n\t\t\t><div class=\"dijitA11yUpArrow\">▲</div\n\t\t></td\n\t></tr\n\t><tr class=\"dijitReset\"\n\t\t><td class=\"dijitReset dijitRight dijitButtonNode dijitDownArrowButton\" width=\"0%\"\n\t\t\t\tdojoAttachPoint=\"downArrowNode\"\n\t\t\t\tdojoAttachEvent=\"onmousedown:_handleDownArrowEvent,onmouseup:_handleDownArrowEvent,onmouseover:_handleDownArrowEvent,onmouseout:_handleDownArrowEvent\"\n\t\t\t\tstateModifier=\"DownArrow\"\n\t\t\t><div class=\"dijitA11yDownArrow\">▼</div\n\t\t></td\n\t></tr\n></table>\n\n",
|
||||
baseClass: "dijitSpinner",
|
||||
|
||||
adjust: function(/* Object */ val, /*Number*/ delta){
|
||||
// summary: user replaceable function used to adjust a primitive value(Number/Date/...) by the delta amount specified
|
||||
@@ -93,12 +94,6 @@ dojo.declare(
|
||||
postCreate: function(){
|
||||
this.inherited('postCreate', arguments);
|
||||
|
||||
// textbox and domNode get the same style but the css separates the 2 using !important
|
||||
if(this.srcNodeRef){
|
||||
dojo.style(this.textbox, "cssText", this.srcNodeRef.style.cssText);
|
||||
this.textbox.className += " " + this.srcNodeRef.className;
|
||||
}
|
||||
|
||||
// extra listeners
|
||||
this.connect(this.textbox, dojo.isIE ? "onmousewheel" : 'DOMMouseScroll', "_mouseWheeled");
|
||||
dijit.typematic.addListener(this.upArrowNode, this.textbox, {keyCode:dojo.keys.UP_ARROW,ctrlKey:false,altKey:false,shiftKey:false}, this, "_typematicCallback", this.timeoutChangeRate, this.defaultTimeout);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
({"previousMessage": "Předchozí volby", "nextMessage": "Další volby"})
|
||||
@@ -0,0 +1 @@
|
||||
({"iframeTitle1": "oblast úprav", "iframeTitle2": "rámec oblasti úprav"})
|
||||
@@ -0,0 +1 @@
|
||||
({"rangeMessage": "* Tato hodnota je mimo rozsah.", "invalidMessage": "* Zadaná hodnota není platná.", "missingMessage": "* Tato hodnota je vyžadována."})
|
||||
@@ -0,0 +1 @@
|
||||
({"previousMessage": "Vorherige Auswahl", "nextMessage": "Weitere Auswahlmöglichkeiten"})
|
||||
@@ -0,0 +1 @@
|
||||
({"iframeTitle1": "Editierbereich", "iframeTitle2": "Rahmen für Editierbereich"})
|
||||
@@ -1 +1 @@
|
||||
({"rangeMessage": "* Der Wert liegt außerhalb des gültigen Bereichs.", "invalidMessage": "* Der eingegebene Wert ist ungültig.", "missingMessage": "* Der Wert wird benötigt."})
|
||||
({"rangeMessage": "* Dieser Wert ist außerhalb des gültigen Bereichs. ", "invalidMessage": "* Der eingegebene Wert ist ungültig. ", "missingMessage": "* Dieser Wert ist erforderlich."})
|
||||
@@ -0,0 +1 @@
|
||||
({"previousMessage": "Opciones anteriores", "nextMessage": "Más opciones"})
|
||||
@@ -0,0 +1 @@
|
||||
({"iframeTitle1": "área de edición", "iframeTitle2": "marco del área de edición"})
|
||||
@@ -0,0 +1 @@
|
||||
({"rangeMessage": "* Este valor está fuera del intervalo.", "invalidMessage": "* El valor especificado no es válido.", "missingMessage": "* Este valor es necesario."})
|
||||
@@ -0,0 +1 @@
|
||||
({"previousMessage": "Choix précédents", "nextMessage": "Plus de choix"})
|
||||
@@ -0,0 +1 @@
|
||||
({"iframeTitle1": "zone d'édition", "iframeTitle2": "cadre de la zone d'édition"})
|
||||
@@ -1 +1 @@
|
||||
({"rangeMessage": "* Cette valeur est hors limites.", "invalidMessage": "* La valeur saisie est incorrecte.", "missingMessage": "* Cette valeur est obligatoire."})
|
||||
({"rangeMessage": "* Cette valeur n'est pas comprise dans la plage autorisée. ", "invalidMessage": "* La valeur indiquée n'est pas correcte. ", "missingMessage": "* Cette valeur est requise. "})
|
||||
@@ -0,0 +1 @@
|
||||
({"previousMessage": "Előző menüpontok", "nextMessage": "További menüpontok"})
|
||||
@@ -0,0 +1 @@
|
||||
({"iframeTitle1": "szerkesztési terület", "iframeTitle2": "szerkesztési terület keret"})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user