Ext.ux.prompt=Ext.extend(Ext.Window,{cls:"fr-prompt",closeAction:"close",closable:false,skipDefaultKeys:true,numericInput:false,modal:true,confirmBtnLabel:false,cancelBtnLabel:false,defaultValue:null,allowEmpty:false,placeHolder:null,selectFilename:true,autoScroll:true,width:350,initComponent:function(){var items=[];this.btnLabels={confirm:this.confirmBtnLabel||"Ok",cancel:this.cancelBtnLabel||"Cancel"};if(this.text){this.textDisplayField=new Ext.form.DisplayField({cls:"fr-prompt-text",value:FR.T(this.text)});items.push(this.textDisplayField)}var anchorTop;if(this.defaultValue!==null||this.placeHolder!==null){var fieldCfg={width:"100%",emptyText:this.placeHolder,allowBlank:this.allowEmpty};if(this.defaultValue){fieldCfg.value=this.defaultValue}if(this.numericInput&&Ext.isSmallScreen){fieldCfg.inputType="number";fieldCfg.inputmode="numeric";fieldCfg.inputPattern="[0-9]*"}if(this.textFieldStyle){fieldCfg.style=this.textFieldStyle}this.input=new Ext.form.TextField(fieldCfg);this.selectField=new Ext.util.DelayedTask(function(){this.input.focus(true);if(this.defaultValue){if(this.selectFilename){var dotpos=this.defaultValue.lastIndexOf(".");if(dotpos!==-1){this.input.selectText(0,dotpos);return true}}this.input.selectText()}},this);items.push(this.input);if(Ext.isSmallScreen){anchorTop=true}}else{if(!this.callback&&this.confirmHandler){this.btnLabels={confirm:this.confirmBtnLabel||"Yes",cancel:this.cancelBtnLabel||"No"}}}var buttons=[];buttons.push({text:this.btnLabels.confirm,cls:"fr-btn-primary",style:"margin-left: 0;",handler:function(){if(this.input&&(!this.input.isValid()&&!this.allowEmpty)){return false}this.doAction(this.confirmHandler||this.callback)},scope:this});if(this.confirmHandler||this.cancelHandler){buttons.push({text:this.btnLabels.cancel,style:"margin-left:10px;",handler:function(){this.doAction(this.cancelHandler)},scope:this})}var canvasSize=Ext.getBody().getViewSize();if(canvasSize.width<this.width){this.width=canvasSize.width-20}Ext.apply(this,{items:{layout:"form",bodyStyle:"padding:"+(this.text?"20px 0 20px":"24px 0 24px"),defaults:{hideLabel:true},items:items},buttons:buttons,keys:[{key:Ext.EventObject.ENTER,fn:function(){if(this.input&&(!this.input.isValid()&&!this.allowEmpty)){return false}this.doAction(this.confirmHandler||this.callback)},scope:this},{key:Ext.EventObject.ESC,fn:function(){this.doAction(this.cancelHandler)},scope:this}],listeners:{beforeshow:function(){var bodyHeight=Ext.getBody().getHeight();if(this.getHeight()>bodyHeight){this.setHeight(bodyHeight-20)}},show:function(){if(this.input){this.selectField.delay(20)}},hide:function(){if(FR.UI&&FR.UI.gridPanel){FR.UI.gridPanel.view.focusEl.focus()}}}});Ext.ux.prompt.superclass.initComponent.apply(this,arguments);this.show();if(anchorTop){this.alignTo(Ext.getBody(),"t-t",[0,10])}},doAction:function(handler){if(handler){var scope=this.scope||this;var params=[];if(this.input){params=[this.input.getValue(),this.defaultValue,this]}if(Ext.createDelegate(handler,scope,params)()===false){return true}}if(this.closeAction=="hide"){this.hide()}else{this.close()}},setText:function(text){this.textDisplayField.setValue(text)}});