require({cache:{ 'dijit/form/Textarea':function(){ define("dijit/form/Textarea", [ "dojo/_base/declare", // declare "dojo/dom-style", // domStyle.set "./_ExpandingTextAreaMixin", "./SimpleTextarea" ], function(declare, domStyle, _ExpandingTextAreaMixin, SimpleTextarea){ /*===== var _ExpandingTextAreaMixin = dijit.form._ExpandingTextAreaMixin; var SimpleTextarea = dijit.form.SimpleTextarea; =====*/ // module: // dijit/form/Textarea // summary: // A textarea widget that adjusts it's height according to the amount of data. return declare("dijit.form.Textarea", [SimpleTextarea, _ExpandingTextAreaMixin], { // summary: // A textarea widget that adjusts it's height according to the amount of data. // // description: // A textarea that dynamically expands/contracts (changing it's height) as // the user types, to display all the text without requiring a scroll bar. // // Takes nearly all the parameters (name, value, etc.) that a vanilla textarea takes. // Rows is not supported since this widget adjusts the height. // // example: // | // TODO: for 2.0, rename this to ExpandingTextArea, and rename SimpleTextarea to TextArea baseClass: "dijitTextBox dijitTextArea dijitExpandingTextArea", // Override SimpleTextArea.cols to default to width:100%, for backward compatibility cols: "", buildRendering: function(){ this.inherited(arguments); // tweak textarea style to reduce browser differences domStyle.set(this.textbox, { overflowY: 'hidden', overflowX: 'auto', boxSizing: 'border-box', MsBoxSizing: 'border-box', WebkitBoxSizing: 'border-box', MozBoxSizing: 'border-box' }); } }); }); }, 'dijit/form/_ExpandingTextAreaMixin':function(){ define("dijit/form/_ExpandingTextAreaMixin", [ "dojo/_base/declare", // declare "dojo/dom-construct", // domConstruct.create "dojo/_base/lang", // lang.hitch "dojo/_base/window" // win.body ], function(declare, domConstruct, lang, win){ // module: // dijit/form/_ExpandingTextAreaMixin // summary: // Mixin for textarea widgets to add auto-expanding capability // feature detection var needsHelpShrinking; return declare("dijit.form._ExpandingTextAreaMixin", null, { // summary: // Mixin for textarea widgets to add auto-expanding capability _setValueAttr: function(){ this.inherited(arguments); this.resize(); }, postCreate: function(){ this.inherited(arguments); var textarea = this.textbox; if(needsHelpShrinking == undefined){ var te = domConstruct.create('textarea', {rows:"5", cols:"20", value: ' ', style: {zoom:1, fontSize:"12px", height:"96px", overflow:'hidden', visibility:'hidden', position:'absolute', border:"5px solid white", margin:"0", padding:"0", boxSizing: 'border-box', MsBoxSizing: 'border-box', WebkitBoxSizing: 'border-box', MozBoxSizing: 'border-box' }}, win.body(), "last"); needsHelpShrinking = te.scrollHeight >= te.clientHeight; win.body().removeChild(te); } this.connect(textarea, "onresize", "_resizeLater"); this.connect(textarea, "onfocus", "_resizeLater"); textarea.style.overflowY = "hidden"; }, startup: function(){ this.inherited(arguments); this._resizeLater(); }, _onInput: function(e){ this.inherited(arguments); this.resize(); }, _estimateHeight: function(){ // summary: // Approximate the height when the textarea is invisible with the number of lines in the text. // Fails when someone calls setValue with a long wrapping line, but the layout fixes itself when the user clicks inside so . . . // In IE, the resize event is supposed to fire when the textarea becomes visible again and that will correct the size automatically. // var textarea = this.textbox; // #rows = #newlines+1 textarea.rows = (textarea.value.match(/\n/g) || []).length + 1; }, _resizeLater: function(){ this.defer("resize"); }, resize: function(){ // summary: // Resizes the textarea vertically (should be called after a style/value change) var textarea = this.textbox; function textareaScrollHeight(){ var empty = false; if(textarea.value === ''){ textarea.value = ' '; empty = true; } var sh = textarea.scrollHeight; if(empty){ textarea.value = ''; } return sh; } if(textarea.style.overflowY == "hidden"){ textarea.scrollTop = 0; } if(this.busyResizing){ return; } this.busyResizing = true; if(textareaScrollHeight() || textarea.offsetHeight){ var newH = textareaScrollHeight() + Math.max(textarea.offsetHeight - textarea.clientHeight, 0); var newHpx = newH + "px"; if(newHpx != textarea.style.height){ textarea.style.height = newHpx; textarea.rows = 1; // rows can act like a minHeight if not cleared } if(needsHelpShrinking){ var origScrollHeight = textareaScrollHeight(), newScrollHeight = origScrollHeight, origMinHeight = textarea.style.minHeight, decrement = 4, // not too fast, not too slow thisScrollHeight, origScrollTop = textarea.scrollTop; textarea.style.minHeight = newHpx; // maintain current height textarea.style.height = "auto"; // allow scrollHeight to change while(newH > 0){ textarea.style.minHeight = Math.max(newH - decrement, 4) + "px"; thisScrollHeight = textareaScrollHeight(); var change = newScrollHeight - thisScrollHeight; newH -= change; if(change < decrement){ break; // scrollHeight didn't shrink } newScrollHeight = thisScrollHeight; decrement <<= 1; } textarea.style.height = newH + "px"; textarea.style.minHeight = origMinHeight; textarea.scrollTop = origScrollTop; } textarea.style.overflowY = textareaScrollHeight() > textarea.clientHeight ? "auto" : "hidden"; if(textarea.style.overflowY == "hidden"){ textarea.scrollTop = 0; } }else{ // hidden content of unknown size this._estimateHeight(); } this.busyResizing = false; } }); }); }, 'dijit/form/SimpleTextarea':function(){ define("dijit/form/SimpleTextarea", [ "dojo/_base/declare", // declare "dojo/dom-class", // domClass.add "dojo/_base/sniff", // has("ie") has("opera") "dojo/_base/window", // win.doc.selection win.doc.selection.createRange "./TextBox" ], function(declare, domClass, has, win, TextBox){ /*===== var TextBox = dijit.form.TextBox; =====*/ // module: // dijit/form/SimpleTextarea // summary: // A simple textarea that degrades, and responds to // minimal LayoutContainer usage, and works with dijit.form.Form. // Doesn't automatically size according to input, like Textarea. return declare("dijit.form.SimpleTextarea", TextBox, { // summary: // A simple textarea that degrades, and responds to // minimal LayoutContainer usage, and works with dijit.form.Form. // Doesn't automatically size according to input, like Textarea. // // example: // | // // example: // | new dijit.form.SimpleTextarea({ rows:20, cols:30 }, "foo"); baseClass: "dijitTextBox dijitTextArea", // rows: Number // The number of rows of text. rows: "3", // rows: Number // The number of characters per line. cols: "20", templateString: "", postMixInProperties: function(){ // Copy value from srcNodeRef, unless user specified a value explicitly (or there is no srcNodeRef) // TODO: parser will handle this in 2.0 if(!this.value && this.srcNodeRef){ this.value = this.srcNodeRef.value; } this.inherited(arguments); }, buildRendering: function(){ this.inherited(arguments); if(has("ie") && this.cols){ // attribute selectors is not supported in IE6 domClass.add(this.textbox, "dijitTextAreaCols"); } }, filter: function(/*String*/ value){ // Override TextBox.filter to deal with newlines... specifically (IIRC) this is for IE which writes newlines // as \r\n instead of just \n if(value){ value = value.replace(/\r/g,""); } return this.inherited(arguments); }, _onInput: function(/*Event?*/ e){ // Override TextBox._onInput() to enforce maxLength restriction if(this.maxLength){ var maxLength = parseInt(this.maxLength); var value = this.textbox.value.replace(/\r/g,''); var overflow = value.length - maxLength; if(overflow > 0){ var textarea = this.textbox; if(textarea.selectionStart){ var pos = textarea.selectionStart; var cr = 0; if(has("opera")){ cr = (this.textbox.value.substring(0,pos).match(/\r/g) || []).length; } this.textbox.value = value.substring(0,pos-overflow-cr)+value.substring(pos-cr); textarea.setSelectionRange(pos-overflow, pos-overflow); }else if(win.doc.selection){ //IE textarea.focus(); var range = win.doc.selection.createRange(); // delete overflow characters range.moveStart("character", -overflow); range.text = ''; // show cursor range.select(); } } } this.inherited(arguments); } }); }); }, 'dojox/xml/DomParser':function(){ define("dojox/xml/DomParser", [ "dojo/_base/kernel",// dojo.getObject "dojo/_base/array" // dojo.forEach ], function(dojo){ dojo.getObject("xml", true, dojox); dojox.xml.DomParser=new (function(){ /********************************************************** * The DomParser is a close-to (but not entirely) * conforming XML parser based on regular * expressions. It will take any XML fragment * and return a lightweight JS structure that is * similar to (but not exactly) the DOM specification. * * Getter and setter methods are NOT available; the goal * was to keep the resulting object model entirely JS-like. * * All node types but document fragments are supported; * all nodes support getElementsByTagName and * getElementsByTagNameNS (with short names byName and * byNameNS). The document node supports getElementById * (byId), and all nodes support a supplimental * childrenByName/childrenByNameNS method as well. * * The object model is intended to be a READONLY format; * mutation events are NOT supported, and though you * can change properties on a node-by-node basis, certain * operations are not supported (such as changing the ID * of an element). **********************************************************/ // internal use only. var nodeTypes={ ELEMENT:1, ATTRIBUTE:2, TEXT:3, CDATA_SECTION:4, PROCESSING_INSTRUCTION:7, COMMENT:8, DOCUMENT:9 }; // compile the regular expressions once. var reTags=/<([^>\/\s+]*)([^>]*)>([^<]*)/g; var reAttr=/([^=]*)=(("([^"]*)")|('([^']*)'))/g; // patch from tdedischew AT gmail, with additional grouping var reEntity=//g; var reCData=//g; var reComments=//g; var trim=/^\s+|\s+$/g; var normalize=/\s+/g; var egt=/\>/g; var elt=/\</g; var equot=/\"/g; var eapos=/\'/g; var eamp=/\&/g; var dNs="_def_"; // create a root node. function _doc(){ return new (function(){ var all={}; this.nodeType=nodeTypes.DOCUMENT; this.nodeName="#document"; this.namespaces={}; this._nsPaths={}; this.childNodes=[]; this.documentElement=null; // any element with an ID attribute will be added to the internal hashtable. this._add=function(obj){ if(typeof(obj.id)!="undefined"){ all[obj.id]=obj; } }; this._remove=function(id){ if(all[id]){ delete all[id]; } }; this.byId=this.getElementById=function(id){ return all[id]; }; this.byName=this.getElementsByTagName=byName; this.byNameNS=this.getElementsByTagNameNS=byNameNS; this.childrenByName=childrenByName; this.childrenByNameNS=childrenByNameNS; })(); } // functions attached to element nodes function byName(name){ // return all descendants with name. Fully qualified (i.e. svg:svg) function __(node, name, arr){ dojo.forEach(node.childNodes, function(c){ if(c.nodeType==nodeTypes.ELEMENT){ if(name=="*"){ arr.push(c); } else if(c.nodeName==name){ arr.push(c); } __(c, name, arr); } }); } var a=[]; __(this, name, a); return a; } function byNameNS(name, ns){ // return all descendants with name by namespace. If no namespace passed, the default is used. function __(node, name, ns, arr){ dojo.forEach(node.childNodes, function(c){ if(c.nodeType==nodeTypes.ELEMENT){ if(name=="*"&&c.ownerDocument._nsPaths[ns]==c.namespace){ arr.push(c); } else if(c.localName==name&&c.ownerDocument._nsPaths[ns]==c.namespace){ arr.push(c); } __(c, name, ns, arr); } }); } if(!ns){ ns=dNs; } var a=[]; __(this, name, ns, a); return a; } // Only child nodes with name. function childrenByName(name){ var a=[]; dojo.forEach(this.childNodes, function(c){ if(c.nodeType==nodeTypes.ELEMENT){ if(name=="*"){ a.push(c); } else if(c.nodeName==name){ a.push(c); } } }); return a; } function childrenByNameNS(name, ns){ var a=[]; dojo.forEach(this.childNodes, function(c){ if(c.nodeType==nodeTypes.ELEMENT){ if(name=="*"&&c.ownerDocument._nsPaths[ns]==c.namespace){ a.push(c); } else if(c.localName==name&&c.ownerDocument._nsPaths[ns]==c.namespace){ a.push(c); } } }); return a; } function _createTextNode(v){ return { nodeType:nodeTypes.TEXT, nodeName:"#text", nodeValue:v.replace(normalize," ").replace(egt,">").replace(elt,"<").replace(eapos,"'").replace(equot,'"').replace(eamp,"&") }; } // attribute functions function getAttr(name){ for(var i=0; i0){ return p.childNodes[i-1]; } } } return null; } function next(){ var p=this.parentNode; if(p){ for(var i=0;i0){ var entity, eRe=[]; if(reEntity.test(str)){ reEntity.lastIndex=0; // match entities while((entity=reEntity.exec(str))!=null){ eRe.push({ entity:"&"+entity[1].replace(trim,"")+";", expression:entity[2] }); } // replace instances in the document. for(var i=0; i1){ if(obj.parentNode){ obj=obj.parentNode; } var text=(res[3]||"").replace(trim, ""); if(text.length>0) { obj.childNodes.push(_createTextNode(text)); } } // open tags. else if(res[1].length>0){ // figure out the type of node. if(res[1].charAt(0)=="?"){ // processing instruction var name=res[1].substr(1); var target=res[2].substr(0,res[2].length-2); obj.childNodes.push({ nodeType:nodeTypes.PROCESSING_INSTRUCTION, nodeName:name, nodeValue:target }); } else if(res[1].charAt(0)=="!"){ // CDATA; skip over any declaration elements. if(res[1].indexOf("![CDATA[")==0){ var val=parseInt(res[1].replace("![CDATA[","").replace("]]","")); obj.childNodes.push({ nodeType:nodeTypes.CDATA_SECTION, nodeName:"#cdata-section", nodeValue:cdSections[val] }); } // Comments. else if(res[1].substr(0,3)=="!--"){ var val=parseInt(res[1].replace("!--","").replace("--","")); obj.childNodes.push({ nodeType:nodeTypes.COMMENT, nodeName:"#comment", nodeValue:comments[val] }); } } else { // Elements (with attribute and text) var name=res[1].replace(trim,""); var o={ nodeType:nodeTypes.ELEMENT, nodeName:name, localName:name, namespace:dNs, ownerDocument:root, attributes:[], parentNode:null, childNodes:[] }; // check to see if it's namespaced. if(name.indexOf(":")>-1){ var t=name.split(":"); o.namespace=t[0]; o.localName=t[1]; } // set the function references. o.byName=o.getElementsByTagName=byName; o.byNameNS=o.getElementsByTagNameNS=byNameNS; o.childrenByName=childrenByName; o.childrenByNameNS=childrenByNameNS; o.getAttribute=getAttr; o.getAttributeNS=getAttrNS; o.setAttribute=setAttr; o.setAttributeNS=setAttrNS; o.previous=o.previousSibling=prev; o.next=o.nextSibling=next; // parse the attribute string. var attr; while((attr=reAttr.exec(res[2]))!=null){ if(attr.length>0){ var name=attr[1].replace(trim,""); var val=(attr[4]||attr[6]||"").replace(normalize," ") .replace(egt,">") .replace(elt,"<") .replace(eapos,"'") .replace(equot,'"') .replace(eamp,"&"); if(name.indexOf("xmlns")==0){ if(name.indexOf(":")>0){ var ns=name.split(":"); root.namespaces[ns[1]]=val; root._nsPaths[val]=ns[1]; } else { root.namespaces[dNs]=val; root._nsPaths[val]=dNs; } } else { var ln=name; var ns=dNs; if(name.indexOf(":")>0){ var t=name.split(":"); ln=t[1]; ns=t[0]; } o.attributes.push({ nodeType:nodeTypes.ATTRIBUTE, nodeName:name, localName:ln, namespace:ns, nodeValue:val }); // only add id as a property. if(ln=="id"){ o.id=val; } } } } root._add(o); if(obj){ obj.childNodes.push(o); o.parentNode=obj; // if it's not a self-closing node. if(res[2].charAt(res[2].length-1)!="/"){ obj=o; } } var text=res[3]; if(text.length>0){ obj.childNodes.push(_createTextNode(text)); } } } } // set the document element for(var i=0; i