/* Copyright (c) 2004-2009, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dijit.InlineEditBox"]){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,"ROOT,ar,ca,cs,da,de,el,es,fi,fr,he,hu,it,ja,ko,nb,nl,pl,pt,pt-pt,ru,sk,sl,sv,th,tr,zh,zh-tw");dojo.declare("dijit.InlineEditBox",dijit._Widget,{editing:false,autoSave:true,buttonSave:"",buttonCancel:"",renderAsHtml:false,editor:"dijit.form.TextBox",editorWrapper:"dijit._InlineEditor",editorParams:{},onChange:function(_1){},onCancel:function(){},width:"100%",value:"",noValueIndicator:"    ✍    ",constructor:function(){this.editorParams={};},postMixInProperties:function(){this.inherited(arguments);this.displayNode=this.srcNodeRef;var _2={ondijitclick:"_onClick",onmouseover:"_onMouseOver",onmouseout:"_onMouseOut",onfocus:"_onMouseOver",onblur:"_onMouseOut"};for(var _3 in _2){this.connect(this.displayNode,_3,_2[_3]);}dijit.setWaiRole(this.displayNode,"button");if(!this.displayNode.getAttribute("tabIndex")){this.displayNode.setAttribute("tabIndex",0);}this.attr("value",this.value||this.displayNode.innerHTML);},setDisabled:function(_4){dojo.deprecated("dijit.InlineEditBox.setDisabled() is deprecated. Use attr('disabled', bool) instead.","","2.0");this.attr("disabled",_4);},_setDisabledAttr:function(_5){this.disabled=_5;dijit.setWaiState(this.domNode,"disabled",_5);if(_5){this.displayNode.removeAttribute("tabIndex");}else{this.displayNode.setAttribute("tabIndex",0);}},_onMouseOver:function(){dojo.addClass(this.displayNode,this.disabled?"dijitDisabledClickableRegion":"dijitClickableRegion");},_onMouseOut:function(){dojo.removeClass(this.displayNode,this.disabled?"dijitDisabledClickableRegion":"dijitClickableRegion");},_onClick:function(e){if(this.disabled){return;}if(e){dojo.stopEvent(e);}this._onMouseOut();setTimeout(dojo.hitch(this,"edit"),0);},edit:function(){if(this.disabled||this.editing){return;}this.editing=true;this._savedPosition=dojo.style(this.displayNode,"position")||"static";this._savedOpacity=dojo.style(this.displayNode,"opacity")||"1";this._savedTabIndex=dojo.attr(this.displayNode,"tabIndex")||"0";if(this.wrapperWidget){this.wrapperWidget.editWidget.attr("displayedValue" in this.editorParams?"displayedValue":"value",this.value);}else{var _6=dojo.create("span",null,this.domNode,"before");var _7=dojo.getObject(this.editorWrapper);this.wrapperWidget=new _7({value:this.value,buttonSave:this.buttonSave,buttonCancel:this.buttonCancel,tabIndex:this._savedTabIndex,editor:this.editor,inlineEditBox:this,sourceStyle:dojo.getComputedStyle(this.displayNode),save:dojo.hitch(this,"save"),cancel:dojo.hitch(this,"cancel")},_6);}var ww=this.wrapperWidget;if(dojo.isIE){dijit.focus(dijit.getFocus());}dojo.style(this.displayNode,{position:"absolute",opacity:"0",display:"none"});dojo.style(ww.domNode,{position:this._savedPosition,visibility:"visible",opacity:"1"});dojo.attr(this.displayNode,"tabIndex","-1");setTimeout(dojo.hitch(this,function(){ww.focus();ww._resetValue=ww.getValue();}),0);},_onBlur:function(){this.inherited(arguments);if(!this.editing){setTimeout(dojo.hitch(this,function(){if(this.wrapperWidget){this.wrapperWidget.destroy();delete this.wrapperWidget;}}),0);}},_showText:function(_8){var ww=this.wrapperWidget;dojo.style(ww.domNode,{position:"absolute",visibility:"hidden",opacity:"0"});dojo.style(this.displayNode,{position:this._savedPosition,opacity:this._savedOpacity,display:""});dojo.attr(this.displayNode,"tabIndex",this._savedTabIndex);if(_8){dijit.focus(this.displayNode);}},save:function(_9){if(this.disabled||!this.editing){return;}this.editing=false;var ww=this.wrapperWidget;var _a=ww.getValue();this.attr("value",_a);setTimeout(dojo.hitch(this,"onChange",_a),0);this._showText(_9);},setValue:function(_b){dojo.deprecated("dijit.InlineEditBox.setValue() is deprecated. Use attr('value', ...) instead.","","2.0");return this.attr("value",_b);},_setValueAttr:function(_c){this.value=_c=dojo.trim(_c);if(!this.renderAsHtml){_c=_c.replace(/&/gm,"&").replace(//gm,">").replace(/"/gm,""").replace(/\n/g,"
");}this.displayNode.innerHTML=_c||this.noValueIndicator;},getValue:function(){dojo.deprecated("dijit.InlineEditBox.getValue() is deprecated. Use attr('value') instead.","","2.0");return this.attr("value");},cancel:function(_d){if(this.disabled||!this.editing){return;}this.editing=false;setTimeout(dojo.hitch(this,"onCancel"),0);this._showText(_d);}});dojo.declare("dijit._InlineEditor",[dijit._Widget,dijit._Templated],{templateString:dojo.cache("dijit","templates/InlineEditBox.html","