require({cache:{ 'dojo/uacss':function(){ define(["./dom-geometry", "./_base/lang", "./ready", "./sniff", "./_base/window"], function(geometry, lang, ready, has, baseWindow){ // module: // dojo/uacss /*===== return { // summary: // Applies pre-set CSS classes to the top-level HTML node, based on: // // - browser (ex: dj_ie) // - browser version (ex: dj_ie6) // - box model (ex: dj_contentBox) // - text direction (ex: dijitRtl) // // In addition, browser, browser version, and box model are // combined with an RTL flag when browser text is RTL. ex: dj_ie-rtl. // // Returns the has() method. }; =====*/ var html = baseWindow.doc.documentElement, ie = has("ie"), opera = has("opera"), maj = Math.floor, ff = has("ff"), boxModel = geometry.boxModel.replace(/-/,''), classes = { "dj_ie": ie, "dj_ie6": maj(ie) == 6, "dj_ie7": maj(ie) == 7, "dj_ie8": maj(ie) == 8, "dj_ie9": maj(ie) == 9, "dj_quirks": has("quirks"), "dj_iequirks": ie && has("quirks"), // NOTE: Opera not supported by dijit "dj_opera": opera, "dj_khtml": has("khtml"), "dj_webkit": has("webkit"), "dj_safari": has("safari"), "dj_chrome": has("chrome"), "dj_gecko": has("mozilla"), "dj_ff3": maj(ff) == 3 }; // no dojo unsupported browsers classes["dj_" + boxModel] = true; // apply browser, browser version, and box model class names var classStr = ""; for(var clz in classes){ if(classes[clz]){ classStr += clz + " "; } } html.className = lang.trim(html.className + " " + classStr); // If RTL mode, then add dj_rtl flag plus repeat existing classes with -rtl extension. // We can't run the code below until the tag has loaded (so we can check for dir=rtl). // priority is 90 to run ahead of parser priority of 100 ready(90, function(){ if(!geometry.isBodyLtr()){ var rtlClassStr = "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl "); html.className = lang.trim(html.className + " " + rtlClassStr + "dj_rtl dijitRtl " + classStr.replace(/ /g, "-rtl ")); } }); return has; }); }, 'dijit/hccss':function(){ define("dijit/hccss", ["dojo/dom-class", "dojo/hccss", "dojo/ready", "dojo/_base/window"], function(domClass, has, ready, win){ // module: // dijit/hccss /*===== return function(){ // summary: // Test if computer is in high contrast mode, and sets `dijit_a11y` flag on `` if it is. // Deprecated, use ``dojo/hccss`` instead. }; =====*/ // Priority is 90 to run ahead of parser priority of 100. For 2.0, remove the ready() call and instead // change this module to depend on dojo/domReady! ready(90, function(){ if(has("highcontrast")){ domClass.add(win.body(), "dijit_a11y"); } }); return has; }); }, 'dojox/grid/_View':function(){ define([ "dojo", "dijit/registry", "../main", "dojo/_base/declare", "dojo/_base/array", "dojo/_base/lang", "dojo/_base/connect", "dojo/_base/sniff", "dojo/query", "dojo/_base/window", "dojo/text!./resources/View.html", "dojo/dnd/Source", "dijit/_Widget", "dijit/_TemplatedMixin", "dojox/html/metrics", "./util", "dojo/_base/html", "./_Builder", "dojo/dnd/Avatar", "dojo/dnd/Manager" ], function(dojo, dijit, dojox, declare, array, lang, connect, has, query, win, template, Source, _Widget, _TemplatedMixin, metrics, util, html, _Builder, Avatar, Manager){ // a private function var getStyleText = function(inNode, inStyleText){ return inNode.style.cssText == undefined ? inNode.getAttribute("style") : inNode.style.cssText; }; // some public functions var _View = declare('dojox.grid._View', [_Widget, _TemplatedMixin], { // summary: // A collection of grid columns. A grid is comprised of a set of views that stack horizontally. // Grid creates views automatically based on grid's layout structure. // Users should typically not need to access individual views directly. // // defaultWidth: String // Default width of the view defaultWidth: "18em", // viewWidth: String // Width for the view, in valid css unit viewWidth: "", templateString: template, classTag: 'dojoxGrid', marginBottom: 0, rowPad: 2, // _togglingColumn: int // Width of the column being toggled (-1 for none) _togglingColumn: -1, // _headerBuilderClass: Object // The class to use for our header builder _headerBuilderClass: _Builder._HeaderBuilder, // _contentBuilderClass: Object // The class to use for our content builder _contentBuilderClass: _Builder._ContentBuilder, postMixInProperties: function(){ this.rowNodes = {}; }, postCreate: function(){ this.connect(this.scrollboxNode,"onscroll","doscroll"); util.funnelEvents(this.contentNode, this, "doContentEvent", [ 'mouseover', 'mouseout', 'click', 'dblclick', 'contextmenu', 'mousedown' ]); util.funnelEvents(this.headerNode, this, "doHeaderEvent", [ 'dblclick', 'mouseover', 'mouseout', 'mousemove', 'mousedown', 'click', 'contextmenu' ]); this.content = new this._contentBuilderClass(this); this.header = new this._headerBuilderClass(this); //BiDi: in RTL case, style width='9000em' causes scrolling problem in head node if(!this.grid.isLeftToRight()){ this.headerNodeContainer.style.width = ""; } }, destroy: function(){ html.destroy(this.headerNode); delete this.headerNode; for(var i in this.rowNodes){ this._cleanupRowWidgets(this.rowNodes[i]); html.destroy(this.rowNodes[i]); } this.rowNodes = {}; if(this.source){ this.source.destroy(); } this.inherited(arguments); }, // focus focus: function(){ if(has('ie') || has('webkit') || has('opera')){ this.hiddenFocusNode.focus(); }else{ this.scrollboxNode.focus(); } }, setStructure: function(inStructure){ var vs = (this.structure = inStructure); // FIXME: similar logic is duplicated in layout if(vs.width && !isNaN(vs.width)){ this.viewWidth = vs.width + 'em'; }else{ this.viewWidth = vs.width || (vs.noscroll ? 'auto' : this.viewWidth); //|| this.defaultWidth; } this._onBeforeRow = vs.onBeforeRow||function(){}; this._onAfterRow = vs.onAfterRow||function(){}; this.noscroll = vs.noscroll; if(this.noscroll){ this.scrollboxNode.style.overflow = "hidden"; } this.simpleStructure = Boolean(vs.cells.length == 1); // bookkeeping this.testFlexCells(); // accomodate new structure this.updateStructure(); }, _cleanupRowWidgets: function(inRowNode){ // Summary: // Cleans up the widgets for the given row node so that // we can reattach them if needed if(inRowNode){ array.forEach(query("[widgetId]", inRowNode).map(dijit.byNode), function(w){ if(w._destroyOnRemove){ w.destroy(); delete w; }else if(w.domNode && w.domNode.parentNode){ w.domNode.parentNode.removeChild(w.domNode); } }); } }, onBeforeRow: function(inRowIndex, cells){ this._onBeforeRow(inRowIndex, cells); if(inRowIndex >= 0){ this._cleanupRowWidgets(this.getRowNode(inRowIndex)); } }, onAfterRow: function(inRowIndex, cells, inRowNode){ this._onAfterRow(inRowIndex, cells, inRowNode); var g = this.grid; array.forEach(query(".dojoxGridStubNode", inRowNode), function(n){ if(n && n.parentNode){ var lw = n.getAttribute("linkWidget"); var cellIdx = window.parseInt(html.attr(n, "cellIdx"), 10); var cellDef = g.getCell(cellIdx); var w = dijit.byId(lw); if(w){ n.parentNode.replaceChild(w.domNode, n); if(!w._started){ w.startup(); } dojo.destroy(n); }else{ n.innerHTML = ""; } } }, this); }, testFlexCells: function(){ // FIXME: cheater, this function does double duty as initializer and tester this.flexCells = false; for(var j=0, row; (row=this.structure.cells[j]); j++){ for(var i=0, cell; (cell=row[i]); i++){ cell.view = this; this.flexCells = this.flexCells || cell.isFlex(); } } return this.flexCells; }, updateStructure: function(){ // header builder needs to update table map this.header.update(); // content builder needs to update markup cache this.content.update(); }, getScrollbarWidth: function(){ var hasScrollSpace = this.hasVScrollbar(); var overflow = html.style(this.scrollboxNode, "overflow"); if(this.noscroll || !overflow || overflow == "hidden"){ hasScrollSpace = false; }else if(overflow == "scroll"){ hasScrollSpace = true; } return (hasScrollSpace ? metrics.getScrollbar().w : 0); // Integer }, getColumnsWidth: function(){ var h = this.headerContentNode; return h && h.firstChild ? h.firstChild.offsetWidth : 0; // Integer }, setColumnsWidth: function(width){ this.headerContentNode.firstChild.style.width = width + 'px'; if(this.viewWidth){ this.viewWidth = width + 'px'; } }, getWidth: function(){ return this.viewWidth || (this.getColumnsWidth()+this.getScrollbarWidth()) +'px'; // String }, getContentWidth: function(){ return Math.max(0, html._getContentBox(this.domNode).w - this.getScrollbarWidth()) + 'px'; // String }, render: function(){ this.scrollboxNode.style.height = ''; this.renderHeader(); if(this._togglingColumn >= 0){ this.setColumnsWidth(this.getColumnsWidth() - this._togglingColumn); this._togglingColumn = -1; } var cells = this.grid.layout.cells; var getSibling = lang.hitch(this, function(node, before){ !this.grid.isLeftToRight() && (before = !before); var inc = before?-1:1; var idx = this.header.getCellNodeIndex(node) + inc; var cell = cells[idx]; while(cell && cell.getHeaderNode() && cell.getHeaderNode().style.display == "none"){ idx += inc; cell = cells[idx]; } if(cell){ return cell.getHeaderNode(); } return null; }); if(this.grid.columnReordering && this.simpleStructure){ if(this.source){ this.source.destroy(); } // Create the top and bottom markers var bottomMarkerId = "dojoxGrid_bottomMarker"; var topMarkerId = "dojoxGrid_topMarker"; if(this.bottomMarker){ html.destroy(this.bottomMarker); } this.bottomMarker = html.byId(bottomMarkerId); if(this.topMarker){ html.destroy(this.topMarker); } this.topMarker = html.byId(topMarkerId); if (!this.bottomMarker) { this.bottomMarker = html.create("div", { "id": bottomMarkerId, "class": "dojoxGridColPlaceBottom" }, win.body()); this._hide(this.bottomMarker); this.topMarker = html.create("div", { "id": topMarkerId, "class": "dojoxGridColPlaceTop" }, win.body()); this._hide(this.topMarker); } this.arrowDim = html.contentBox(this.bottomMarker); var headerHeight = html.contentBox(this.headerContentNode.firstChild.rows[0]).h; this.source = new Source(this.headerContentNode.firstChild.rows[0], { horizontal: true, accept: [ "gridColumn_" + this.grid.id ], viewIndex: this.index, generateText: false, onMouseDown: lang.hitch(this, function(e){ this.header.decorateEvent(e); if((this.header.overRightResizeArea(e) || this.header.overLeftResizeArea(e)) && this.header.canResize(e) && !this.header.moveable){ this.header.beginColumnResize(e); }else{ if(this.grid.headerMenu){ this.grid.headerMenu.onCancel(true); } // IE reports a left click as 1, where everything else reports 0 if(e.button === (has('ie') < 9 ? 1 : 0)){ Source.prototype.onMouseDown.call(this.source, e); } } }), onMouseOver: lang.hitch(this, function(e){ var src = this.source; if(src._getChildByEvent(e)){ Source.prototype.onMouseOver.apply(src, arguments); } }), _markTargetAnchor: lang.hitch(this, function(before){ var src = this.source; if(src.current == src.targetAnchor && src.before == before){ return; } if(src.targetAnchor && getSibling(src.targetAnchor, src.before)){ src._removeItemClass(getSibling(src.targetAnchor, src.before), src.before ? "After" : "Before"); } Source.prototype._markTargetAnchor.call(src, before); var target = before ? src.targetAnchor : getSibling(src.targetAnchor, src.before); var endAdd = 0; if (!target) { target = src.targetAnchor; endAdd = html.contentBox(target).w + this.arrowDim.w/2 + 2; } var pos = html.position(target, true); var left = Math.floor(pos.x - this.arrowDim.w/2 + endAdd); html.style(this.bottomMarker, "visibility", "visible"); html.style(this.topMarker, "visibility", "visible"); html.style(this.bottomMarker, { "left": left + "px", "top" : (headerHeight + pos.y) + "px" }); html.style(this.topMarker, { "left": left + "px", "top" : (pos.y - this.arrowDim.h) + "px" }); if(src.targetAnchor && getSibling(src.targetAnchor, src.before)){ src._addItemClass(getSibling(src.targetAnchor, src.before), src.before ? "After" : "Before"); } }), _unmarkTargetAnchor: lang.hitch(this, function(){ var src = this.source; if(!src.targetAnchor){ return; } if(src.targetAnchor && getSibling(src.targetAnchor, src.before)){ src._removeItemClass(getSibling(src.targetAnchor, src.before), src.before ? "After" : "Before"); } this._hide(this.bottomMarker); this._hide(this.topMarker); Source.prototype._unmarkTargetAnchor.call(src); }), destroy: lang.hitch(this, function(){ connect.disconnect(this._source_conn); connect.unsubscribe(this._source_sub); Source.prototype.destroy.call(this.source); if(this.bottomMarker){ html.destroy(this.bottomMarker); delete this.bottomMarker; } if(this.topMarker){ html.destroy(this.topMarker); delete this.topMarker; } }), onDndCancel: lang.hitch(this, function(){ Source.prototype.onDndCancel.call(this.source); this._hide(this.bottomMarker); this._hide(this.topMarker); }) }); this._source_conn = connect.connect(this.source, "onDndDrop", this, "_onDndDrop"); this._source_sub = connect.subscribe("/dnd/drop/before", this, "_onDndDropBefore"); this.source.startup(); } }, _hide: function(node){ html.style(node, { top: "-10000px", "visibility": "hidden" }); }, _onDndDropBefore: function(source, nodes, copy){ if(Manager.manager().target !== this.source){ return; } this.source._targetNode = this.source.targetAnchor; this.source._beforeTarget = this.source.before; var views = this.grid.views.views; var srcView = views[source.viewIndex]; var tgtView = views[this.index]; if(tgtView != srcView){ srcView.convertColPctToFixed(); tgtView.convertColPctToFixed(); } }, _onDndDrop: function(source, nodes, copy){ if(Manager.manager().target !== this.source){ if(Manager.manager().source === this.source){ this._removingColumn = true; } return; } this._hide(this.bottomMarker); this._hide(this.topMarker); var getIdx = function(n){ return n ? html.attr(n, "idx") : null; }; var w = html.marginBox(nodes[0]).w; if(source.viewIndex !== this.index){ var views = this.grid.views.views; var srcView = views[source.viewIndex]; var tgtView = views[this.index]; if(srcView.viewWidth && srcView.viewWidth != "auto"){ srcView.setColumnsWidth(srcView.getColumnsWidth() - w); } if(tgtView.viewWidth && tgtView.viewWidth != "auto"){ tgtView.setColumnsWidth(tgtView.getColumnsWidth()); } } var stn = this.source._targetNode; var stb = this.source._beforeTarget; !this.grid.isLeftToRight() && (stb = !stb); var layout = this.grid.layout; var idx = this.index; delete this.source._targetNode; delete this.source._beforeTarget; layout.moveColumn( source.viewIndex, idx, getIdx(nodes[0]), getIdx(stn), stb); }, renderHeader: function(){ this.headerContentNode.innerHTML = this.header.generateHtml(this._getHeaderContent); if(this.flexCells){ this.contentWidth = this.getContentWidth(); this.headerContentNode.firstChild.style.width = this.contentWidth; } util.fire(this, "onAfterRow", [-1, this.structure.cells, this.headerContentNode]); }, // note: not called in 'view' context _getHeaderContent: function(inCell){ var n = inCell.name || inCell.grid.getCellName(inCell); if(/^\s+$/.test(n)){ n = ' '//otherwise arrow styles will be messed up } var ret = [ '
'); }else{ ret = ret.concat([ ' ', inCell.grid.sortInfo > 0 ? 'dojoxGridSortUp' : 'dojoxGridSortDown', '">
', inCell.grid.sortInfo > 0 ? '▲' : '▼', '
', '
']); } ret = ret.concat([n, '
']); return ret.join(''); }, resize: function(){ this.adaptHeight(); this.adaptWidth(); }, hasHScrollbar: function(reset){ var hadScroll = this._hasHScroll||false; if(this._hasHScroll == undefined || reset){ if(this.noscroll){ this._hasHScroll = false; }else{ var style = html.style(this.scrollboxNode, "overflow"); if(style == "hidden"){ this._hasHScroll = false; }else if(style == "scroll"){ this._hasHScroll = true; }else{ this._hasHScroll = (this.scrollboxNode.offsetWidth - this.getScrollbarWidth() < this.contentNode.offsetWidth ); } } } if(hadScroll !== this._hasHScroll){ this.grid.update(); } return this._hasHScroll; // Boolean }, hasVScrollbar: function(reset){ var hadScroll = this._hasVScroll||false; if(this._hasVScroll == undefined || reset){ if(this.noscroll){ this._hasVScroll = false; }else{ var style = html.style(this.scrollboxNode, "overflow"); if(style == "hidden"){ this._hasVScroll = false; }else if(style == "scroll"){ this._hasVScroll = true; }else{ this._hasVScroll = (this.scrollboxNode.scrollHeight > this.scrollboxNode.clientHeight); } } } if(hadScroll !== this._hasVScroll){ this.grid.update(); } return this._hasVScroll; // Boolean }, convertColPctToFixed: function(){ // Fix any percentage widths to be pixel values var hasPct = false; this.grid.initialWidth = ""; var cellNodes = query("th", this.headerContentNode); var fixedWidths = array.map(cellNodes, function(c, vIdx){ var w = c.style.width; html.attr(c, "vIdx", vIdx); if(w && w.slice(-1) == "%"){ hasPct = true; }else if(w && w.slice(-2) == "px"){ return window.parseInt(w, 10); } return html.contentBox(c).w; }); if(hasPct){ array.forEach(this.grid.layout.cells, function(cell, idx){ if(cell.view == this){ var cellNode = cell.view.getHeaderCellNode(cell.index); if(cellNode && html.hasAttr(cellNode, "vIdx")){ var vIdx = window.parseInt(html.attr(cellNode, "vIdx")); this.setColWidth(idx, fixedWidths[vIdx]); html.removeAttr(cellNode, "vIdx"); } } }, this); return true; } return false; }, adaptHeight: function(minusScroll){ if(!this.grid._autoHeight){ var h = (this.domNode.style.height && parseInt(this.domNode.style.height.replace(/px/,''), 10)) || this.domNode.clientHeight; var self = this; var checkOtherViewScrollers = function(){ var v; for(var i in self.grid.views.views){ v = self.grid.views.views[i]; if(v !== self && v.hasHScrollbar()){ return true; } } return false; }; if(minusScroll || (this.noscroll && checkOtherViewScrollers())){ h -= metrics.getScrollbar().h; } util.setStyleHeightPx(this.scrollboxNode, h); } this.hasVScrollbar(true); }, adaptWidth: function(){ if(this.flexCells){ // the view content width this.contentWidth = this.getContentWidth(); this.headerContentNode.firstChild.style.width = this.contentWidth; } // FIXME: it should be easier to get w from this.scrollboxNode.clientWidth, // but clientWidth seemingly does not include scrollbar width in some cases var w = this.scrollboxNode.offsetWidth - this.getScrollbarWidth(); if(!this._removingColumn){ w = Math.max(w, this.getColumnsWidth()) + 'px'; }else{ w = Math.min(w, this.getColumnsWidth()) + 'px'; this._removingColumn = false; } var cn = this.contentNode; cn.style.width = w; this.hasHScrollbar(true); }, setSize: function(w, h){ var ds = this.domNode.style; var hs = this.headerNode.style; if(w){ ds.width = w; hs.width = w; } ds.height = (h >= 0 ? h + 'px' : ''); }, renderRow: function(inRowIndex){ var rowNode = this.createRowNode(inRowIndex); this.buildRow(inRowIndex, rowNode); //this.grid.edit.restore(this, inRowIndex); return rowNode; }, createRowNode: function(inRowIndex){ var node = document.createElement("div"); node.className = this.classTag + 'Row'; if (this instanceof dojox.grid._RowSelector){ html.attr(node,"role","presentation"); }else{ html.attr(node,"role","row"); if (this.grid.selectionMode != "none") { node.setAttribute("aria-selected", "false"); //rows can be selected so add aria-selected prop } } node[util.gridViewTag] = this.id; node[util.rowIndexTag] = inRowIndex; this.rowNodes[inRowIndex] = node; return node; }, buildRow: function(inRowIndex, inRowNode){ this.buildRowContent(inRowIndex, inRowNode); this.styleRow(inRowIndex, inRowNode); }, buildRowContent: function(inRowIndex, inRowNode){ inRowNode.innerHTML = this.content.generateHtml(inRowIndex, inRowIndex); if(this.flexCells && this.contentWidth){ // FIXME: accessing firstChild here breaks encapsulation inRowNode.firstChild.style.width = this.contentWidth; } util.fire(this, "onAfterRow", [inRowIndex, this.structure.cells, inRowNode]); }, rowRemoved:function(inRowIndex){ if(inRowIndex >= 0){ this._cleanupRowWidgets(this.getRowNode(inRowIndex)); } this.grid.edit.save(this, inRowIndex); delete this.rowNodes[inRowIndex]; }, getRowNode: function(inRowIndex){ return this.rowNodes[inRowIndex]; }, getCellNode: function(inRowIndex, inCellIndex){ var row = this.getRowNode(inRowIndex); if(row){ return this.content.getCellNode(row, inCellIndex); } }, getHeaderCellNode: function(inCellIndex){ if(this.headerContentNode){ return this.header.getCellNode(this.headerContentNode, inCellIndex); } }, // styling styleRow: function(inRowIndex, inRowNode){ inRowNode._style = getStyleText(inRowNode); this.styleRowNode(inRowIndex, inRowNode); }, styleRowNode: function(inRowIndex, inRowNode){ if(inRowNode){ this.doStyleRowNode(inRowIndex, inRowNode); } }, doStyleRowNode: function(inRowIndex, inRowNode){ this.grid.styleRowNode(inRowIndex, inRowNode); }, // updating updateRow: function(inRowIndex){ var rowNode = this.getRowNode(inRowIndex); if(rowNode){ rowNode.style.height = ''; this.buildRow(inRowIndex, rowNode); } return rowNode; }, updateRowStyles: function(inRowIndex){ this.styleRowNode(inRowIndex, this.getRowNode(inRowIndex)); }, // scrolling lastTop: 0, firstScroll:0, _nativeScroll: false, doscroll: function(inEvent){ if(has('ff') >= 13){ this._nativeScroll = true; } //var s = dojo.marginBox(this.headerContentNode.firstChild); var isLtr = this.grid.isLeftToRight(); if(this.firstScroll < 2){ if((!isLtr && this.firstScroll == 1) || (isLtr && this.firstScroll === 0)){ var s = html.marginBox(this.headerNodeContainer); if(has('ie')){ this.headerNodeContainer.style.width = s.w + this.getScrollbarWidth() + 'px'; }else if(has('mozilla')){ //TODO currently only for FF, not sure for safari and opera this.headerNodeContainer.style.width = s.w - this.getScrollbarWidth() + 'px'; //this.headerNodeContainer.style.width = s.w + 'px'; //set scroll to right in FF this.scrollboxNode.scrollLeft = isLtr ? this.scrollboxNode.clientWidth - this.scrollboxNode.scrollWidth : this.scrollboxNode.scrollWidth - this.scrollboxNode.clientWidth; } } this.firstScroll++; } this.headerNode.scrollLeft = this.scrollboxNode.scrollLeft; // 'lastTop' is a semaphore to prevent feedback-loop with setScrollTop below var top = this.scrollboxNode.scrollTop; if(top !== this.lastTop){ this.grid.scrollTo(top); } this._nativeScroll = false; }, setScrollTop: function(inTop){ // 'lastTop' is a semaphore to prevent feedback-loop with doScroll above this.lastTop = inTop; if(!this._nativeScroll){ //fix #15487 this.scrollboxNode.scrollTop = inTop; } return this.scrollboxNode.scrollTop; }, // event handlers (direct from DOM) doContentEvent: function(e){ if(this.content.decorateEvent(e)){ this.grid.onContentEvent(e); } }, doHeaderEvent: function(e){ if(this.header.decorateEvent(e)){ this.grid.onHeaderEvent(e); } }, // event dispatch(from Grid) dispatchContentEvent: function(e){ return this.content.dispatchEvent(e); }, dispatchHeaderEvent: function(e){ return this.header.dispatchEvent(e); }, // column resizing setColWidth: function(inIndex, inWidth){ this.grid.setCellWidth(inIndex, inWidth + 'px'); }, update: function(){ if(!this.domNode){ return; } this.content.update(); this.grid.update(); //get scroll after update or scroll left setting goes wrong on IE. //See trac: #8040 var left = this.scrollboxNode.scrollLeft; this.scrollboxNode.scrollLeft = left; this.headerNode.scrollLeft = left; } }); var _GridAvatar = declare("dojox.grid._GridAvatar", Avatar, { construct: function(){ var dd = win.doc; var a = dd.createElement("table"); a.cellPadding = a.cellSpacing = "0"; a.className = "dojoxGridDndAvatar"; a.style.position = "absolute"; a.style.zIndex = 1999; a.style.margin = "0px"; // to avoid dojo.marginBox() problems with table's margins var b = dd.createElement("tbody"); var tr = dd.createElement("tr"); var td = dd.createElement("td"); var img = dd.createElement("td"); tr.className = "dojoxGridDndAvatarItem"; img.className = "dojoxGridDndAvatarItemImage"; img.style.width = "16px"; var source = this.manager.source, node; if(source.creator){ // create an avatar representation of the node node = source._normalizedCreator(source.getItem(this.manager.nodes[0].id).data, "avatar").node; }else{ // or just clone the node and hope it works node = this.manager.nodes[0].cloneNode(true); var table, tbody; if(node.tagName.toLowerCase() == "tr"){ // insert extra table nodes table = dd.createElement("table"); tbody = dd.createElement("tbody"); tbody.appendChild(node); table.appendChild(tbody); node = table; }else if(node.tagName.toLowerCase() == "th"){ // insert extra table nodes table = dd.createElement("table"); tbody = dd.createElement("tbody"); var r = dd.createElement("tr"); table.cellPadding = table.cellSpacing = "0"; r.appendChild(node); tbody.appendChild(r); table.appendChild(tbody); node = table; } } node.id = ""; td.appendChild(node); tr.appendChild(img); tr.appendChild(td); html.style(tr, "opacity", 0.9); b.appendChild(tr); a.appendChild(b); this.node = a; var m = Manager.manager(); this.oldOffsetY = m.OFFSET_Y; m.OFFSET_Y = 1; }, destroy: function(){ Manager.manager().OFFSET_Y = this.oldOffsetY; this.inherited(arguments); } }); var oldMakeAvatar = Manager.manager().makeAvatar; Manager.manager().makeAvatar = function(){ var src = this.source; if(src.viewIndex !== undefined && !html.hasClass(win.body(),"dijit_a11y")){ return new _GridAvatar(this); } return oldMakeAvatar.call(Manager.manager()); }; return _View; }); }, 'dijit/_Contained':function(){ define("dijit/_Contained", [ "dojo/_base/declare", // declare "./registry" // registry.getEnclosingWidget(), registry.byNode() ], function(declare, registry){ // module: // dijit/_Contained return declare("dijit._Contained", null, { // summary: // Mixin for widgets that are children of a container widget // // example: // | // make a basic custom widget that knows about it's parents // | declare("my.customClass",[dijit._Widget,dijit._Contained],{}); _getSibling: function(/*String*/ which){ // summary: // Returns next or previous sibling // which: // Either "next" or "previous" // tags: // private var node = this.domNode; do{ node = node[which+"Sibling"]; }while(node && node.nodeType != 1); return node && registry.byNode(node); // dijit/_WidgetBase }, getPreviousSibling: function(){ // summary: // Returns null if this is the first child of the parent, // otherwise returns the next element sibling to the "left". return this._getSibling("previous"); // dijit/_WidgetBase }, getNextSibling: function(){ // summary: // Returns null if this is the last child of the parent, // otherwise returns the next element sibling to the "right". return this._getSibling("next"); // dijit/_WidgetBase }, getIndexInParent: function(){ // summary: // Returns the index of this widget within its container parent. // It returns -1 if the parent does not exist, or if the parent // is not a dijit._Container var p = this.getParent(); if(!p || !p.getIndexOfChild){ return -1; // int } return p.getIndexOfChild(this); // int } }); }); }, 'dojo/dnd/Selector':function(){ define([ "../_base/array", "../_base/declare", "../_base/event", "../_base/kernel", "../_base/lang", "../dom", "../dom-construct", "../mouse", "../_base/NodeList", "../on", "../touch", "./common", "./Container" ], function(array, declare, event, kernel, lang, dom, domConstruct, mouse, NodeList, on, touch, dnd, Container){ // module: // dojo/dnd/Selector /* Container item states: "" - an item is not selected "Selected" - an item is selected "Anchor" - an item is selected, and is an anchor for a "shift" selection */ /*===== var __SelectorArgs = declare([Container.__ContainerArgs], { // singular: Boolean // allows selection of only one element, if true singular: false, // autoSync: Boolean // autosynchronizes the source with its list of DnD nodes, autoSync: false }); =====*/ var Selector = declare("dojo.dnd.Selector", Container, { // summary: // a Selector object, which knows how to select its children /*===== // selection: Set // The set of id's that are currently selected, such that this.selection[id] == 1 // if the node w/that id is selected. Can iterate over selected node's id's like: // | for(var id in this.selection) selection: {}, =====*/ constructor: function(node, params){ // summary: // constructor of the Selector // node: Node||String // node or node's id to build the selector on // params: __SelectorArgs? // a dictionary of parameters if(!params){ params = {}; } this.singular = params.singular; this.autoSync = params.autoSync; // class-specific variables this.selection = {}; this.anchor = null; this.simpleSelection = false; // set up events this.events.push( on(this.node, touch.press, lang.hitch(this, "onMouseDown")), on(this.node, touch.release, lang.hitch(this, "onMouseUp")) ); }, // object attributes (for markup) singular: false, // is singular property // methods getSelectedNodes: function(){ // summary: // returns a list (an array) of selected nodes var t = new NodeList(); var e = dnd._empty; for(var i in this.selection){ if(i in e){ continue; } t.push(dom.byId(i)); } return t; // NodeList }, selectNone: function(){ // summary: // unselects all items return this._removeSelection()._removeAnchor(); // self }, selectAll: function(){ // summary: // selects all items this.forInItems(function(data, id){ this._addItemClass(dom.byId(id), "Selected"); this.selection[id] = 1; }, this); return this._removeAnchor(); // self }, deleteSelectedNodes: function(){ // summary: // deletes all selected items var e = dnd._empty; for(var i in this.selection){ if(i in e){ continue; } var n = dom.byId(i); this.delItem(i); domConstruct.destroy(n); } this.anchor = null; this.selection = {}; return this; // self }, forInSelectedItems: function(/*Function*/ f, /*Object?*/ o){ // summary: // iterates over selected items; // see `dojo/dnd/Container.forInItems()` for details o = o || kernel.global; var s = this.selection, e = dnd._empty; for(var i in s){ if(i in e){ continue; } f.call(o, this.getItem(i), i, this); } }, sync: function(){ // summary: // sync up the node list with the data map Selector.superclass.sync.call(this); // fix the anchor if(this.anchor){ if(!this.getItem(this.anchor.id)){ this.anchor = null; } } // fix the selection var t = [], e = dnd._empty; for(var i in this.selection){ if(i in e){ continue; } if(!this.getItem(i)){ t.push(i); } } array.forEach(t, function(i){ delete this.selection[i]; }, this); return this; // self }, insertNodes: function(addSelected, data, before, anchor){ // summary: // inserts new data items (see `dojo/dnd/Container.insertNodes()` method for details) // addSelected: Boolean // all new nodes will be added to selected items, if true, no selection change otherwise // data: Array // a list of data items, which should be processed by the creator function // before: Boolean // insert before the anchor, if true, and after the anchor otherwise // anchor: Node // the anchor node to be used as a point of insertion var oldCreator = this._normalizedCreator; this._normalizedCreator = function(item, hint){ var t = oldCreator.call(this, item, hint); if(addSelected){ if(!this.anchor){ this.anchor = t.node; this._removeItemClass(t.node, "Selected"); this._addItemClass(this.anchor, "Anchor"); }else if(this.anchor != t.node){ this._removeItemClass(t.node, "Anchor"); this._addItemClass(t.node, "Selected"); } this.selection[t.node.id] = 1; }else{ this._removeItemClass(t.node, "Selected"); this._removeItemClass(t.node, "Anchor"); } return t; }; Selector.superclass.insertNodes.call(this, data, before, anchor); this._normalizedCreator = oldCreator; return this; // self }, destroy: function(){ // summary: // prepares the object to be garbage-collected 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.autoSync){ this.sync(); } if(!this.current){ return; } if(!this.singular && !dnd.getCopyKeyState(e) && !e.shiftKey && (this.current.id in this.selection)){ this.simpleSelection = true; if(mouse.isLeft(e)){ // accept the left button and stop the event // for IE we don't stop event when multiple buttons are pressed event.stop(e); } return; } if(!this.singular && e.shiftKey){ if(!dnd.getCopyKeyState(e)){ this._removeSelection(); } var c = this.getAllNodes(); if(c.length){ if(!this.anchor){ this.anchor = c[0]; this._addItemClass(this.anchor, "Anchor"); } this.selection[this.anchor.id] = 1; if(this.anchor != this.current){ var i = 0, node; for(; i < c.length; ++i){ node = c[i]; if(node == this.anchor || node == this.current){ break; } } for(++i; i < c.length; ++i){ node = c[i]; if(node == this.anchor || node == this.current){ break; } this._addItemClass(node, "Selected"); this.selection[node.id] = 1; } this._addItemClass(this.current, "Selected"); this.selection[this.current.id] = 1; } } }else{ if(this.singular){ if(this.anchor == this.current){ if(dnd.getCopyKeyState(e)){ this.selectNone(); } }else{ this.selectNone(); this.anchor = this.current; this._addItemClass(this.anchor, "Anchor"); this.selection[this.current.id] = 1; } }else{ if(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] = 1; } } }else{ if(!(this.current.id in this.selection)){ this.selectNone(); this.anchor = this.current; this._addItemClass(this.current, "Anchor"); this.selection[this.current.id] = 1; } } } } event.stop(e); }, 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] = 1; } }, onMouseMove: function(/*===== e =====*/){ // summary: // event processor for onmousemove // e: Event // mouse event this.simpleSelection = false; }, // utilities onOverEvent: function(){ // summary: // this function is called once, when mouse is over our container this.onmousemoveEvent = on(this.node, touch.move, lang.hitch(this, "onMouseMove")); }, onOutEvent: function(){ // summary: // this function is called once, when mouse is out of our container if(this.onmousemoveEvent){ this.onmousemoveEvent.remove(); delete this.onmousemoveEvent; } }, _removeSelection: function(){ // summary: // unselects all items var e = dnd._empty; for(var i in this.selection){ if(i in e){ continue; } var node = dom.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 } }); return Selector; }); }, 'dojox/grid/DataSelection':function(){ define("dojox/grid/DataSelection", [ "dojo/_base/declare", "./_SelectionPreserver", "./Selection" ], function(declare, _SelectionPreserver, Selection){ return declare("dojox.grid.DataSelection", Selection, { constructor: function(grid){ if(grid.keepSelection){ this.preserver = new _SelectionPreserver(this); } }, destroy: function(){ if(this.preserver){ this.preserver.destroy(); } }, getFirstSelected: function(){ var idx = Selection.prototype.getFirstSelected.call(this); if(idx == -1){ return null; } return this.grid.getItem(idx); }, getNextSelected: function(inPrev){ var old_idx = this.grid.getItemIndex(inPrev); var idx = Selection.prototype.getNextSelected.call(this, old_idx); if(idx == -1){ return null; } return this.grid.getItem(idx); }, getSelected: function(){ var result = []; for(var i=0, l=this.selected.length; i\n\t\n\t\t\"\"\n\t\t\n\t\n\t\n\t\n\t \n\n", 'dojo/dnd/Manager':function(){ define([ "../_base/array", "../_base/declare", "../_base/event", "../_base/lang", "../_base/window", "../dom-class", "../Evented", "../has", "../keys", "../on", "../topic", "../touch", "./common", "./autoscroll", "./Avatar" ], function(array, declare, event, lang, win, domClass, Evented, has, keys, on, topic, touch, dnd, autoscroll, Avatar){ // module: // dojo/dnd/Manager var Manager = declare("dojo.dnd.Manager", [Evented], { // summary: // the manager of DnD operations (usually a singleton) constructor: function(){ this.avatar = null; this.source = null; this.nodes = []; this.copy = true; this.target = null; this.canDropFlag = false; this.events = []; }, // avatar's offset from the mouse OFFSET_X: has("touch") ? 0 : 16, OFFSET_Y: has("touch") ? -64 : 16, // methods overSource: function(source){ // summary: // called when a source detected a mouse-over condition // source: Object // the reporter if(this.avatar){ this.target = (source && source.targetState != "Disabled") ? source : null; this.canDropFlag = Boolean(this.target); this.avatar.update(); } topic.publish("/dnd/source/over", source); }, outSource: function(source){ // summary: // called when a source detected a mouse-out condition // source: Object // the reporter if(this.avatar){ if(this.target == source){ this.target = null; this.canDropFlag = false; this.avatar.update(); topic.publish("/dnd/source/over", null); } }else{ topic.publish("/dnd/source/over", null); } }, startDrag: function(source, nodes, copy){ // summary: // 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 // Tell autoscroll that a drag is starting autoscroll.autoScrollStart(win.doc); this.source = source; this.nodes = nodes; this.copy = Boolean(copy); // normalizing to true boolean this.avatar = this.makeAvatar(); win.body().appendChild(this.avatar.node); topic.publish("/dnd/start", source, nodes, this.copy); this.events = [ on(win.doc, touch.move, lang.hitch(this, "onMouseMove")), on(win.doc, touch.release, lang.hitch(this, "onMouseUp")), on(win.doc, "keydown", lang.hitch(this, "onKeyDown")), on(win.doc, "keyup", lang.hitch(this, "onKeyUp")), // cancel text selection and text dragging on(win.doc, "dragstart", event.stop), on(win.body(), "selectstart", event.stop) ]; var c = "dojoDnd" + (copy ? "Copy" : "Move"); domClass.add(win.body(), c); }, canDrop: function(flag){ // summary: // called to notify if the current target can accept items var canDropFlag = Boolean(this.target && flag); if(this.canDropFlag != canDropFlag){ this.canDropFlag = canDropFlag; this.avatar.update(); } }, stopDrag: function(){ // summary: // stop the DnD in progress domClass.remove(win.body(), ["dojoDndCopy", "dojoDndMove"]); array.forEach(this.events, function(handle){ handle.remove(); }); this.events = []; this.avatar.destroy(); this.avatar = null; this.source = this.target = null; this.nodes = []; }, makeAvatar: function(){ // summary: // makes the avatar; it is separate to be overwritten dynamically, if needed return new Avatar(this); }, updateAvatar: function(){ // summary: // updates the avatar; it is separate to be overwritten dynamically, if needed this.avatar.update(); }, // mouse event processors onMouseMove: function(e){ // summary: // event processor for onmousemove // e: Event // mouse event var a = this.avatar; if(a){ autoscroll.autoScrollNodes(e); //autoscroll.autoScroll(e); var s = a.node.style; s.left = (e.pageX + this.OFFSET_X) + "px"; s.top = (e.pageY + this.OFFSET_Y) + "px"; var copy = Boolean(this.source.copyState(dnd.getCopyKeyState(e))); if(this.copy != copy){ this._setCopyStatus(copy); } } if(has("touch")){ // Prevent page from scrolling so that user can drag instead. e.preventDefault(); } }, onMouseUp: function(e){ // summary: // event processor for onmouseup // e: Event // mouse event if(this.avatar){ if(this.target && this.canDropFlag){ var copy = Boolean(this.source.copyState(dnd.getCopyKeyState(e))); topic.publish("/dnd/drop/before", this.source, this.nodes, copy, this.target, e); topic.publish("/dnd/drop", this.source, this.nodes, copy, this.target, e); }else{ topic.publish("/dnd/cancel"); } this.stopDrag(); } }, // keyboard event processors onKeyDown: function(e){ // summary: // event processor for onkeydown: // watching for CTRL for copy/move status, watching for ESCAPE to cancel the drag // e: Event // keyboard event if(this.avatar){ switch(e.keyCode){ case keys.CTRL: var copy = Boolean(this.source.copyState(true)); if(this.copy != copy){ this._setCopyStatus(copy); } break; case keys.ESCAPE: topic.publish("/dnd/cancel"); this.stopDrag(); break; } } }, onKeyUp: function(e){ // summary: // event processor for onkeyup, watching for CTRL for copy/move status // e: Event // keyboard event if(this.avatar && e.keyCode == keys.CTRL){ var copy = Boolean(this.source.copyState(false)); if(this.copy != copy){ this._setCopyStatus(copy); } } }, // utilities _setCopyStatus: function(copy){ // summary: // changes the copy status // copy: Boolean // the copy status this.copy = copy; this.source._markDndStatus(this.copy); this.updateAvatar(); domClass.replace(win.body(), "dojoDnd" + (this.copy ? "Copy" : "Move"), "dojoDnd" + (this.copy ? "Move" : "Copy")); } }); // dnd._manager: // The manager singleton variable. Can be overwritten if needed. dnd._manager = null; Manager.manager = dnd.manager = function(){ // summary: // Returns the current DnD manager. Creates one if it is not created yet. if(!dnd._manager){ dnd._manager = new Manager(); } return dnd._manager; // Object }; return Manager; }); }, 'dijit/a11yclick':function(){ define("dijit/a11yclick", [ "dojo/on", "dojo/_base/array", // array.forEach "dojo/keys", // keys.ENTER keys.SPACE "dojo/_base/declare", // declare "dojo/has", // has("dom-addeventlistener") "dojo/_base/unload", // unload.addOnWindowUnload "dojo/_base/window" // win.doc.addEventListener win.doc.attachEvent win.doc.detachEvent ], function(on, array, keys, declare, has, unload, win){ // module: // dijit/a11yclick // Keep track of where the last keydown event was, to help avoid generating // spurious ondijitclick events when: // 1. focus is on a