From 3446d08ec4d8140c9217a431bb5a26a8abeefb2d Mon Sep 17 00:00:00 2001 From: "Sebastian G. Marinescu" Date: Fri, 22 Mar 2024 15:22:00 +0100 Subject: [PATCH] Add guard-clause to clearDirty method (#16467) ### What does it do? This makes sure the JS doesn't throw an error in the case that the items-object is an array, just like in https://github.com/modxcms/revolution/pull/16404 for 3.x ### Why is it needed? When using ExtJS to create components of the xtype: 'radiogroup' to be used in CMPs inside a form, this function gets called and tries to iterate over it's items array with a method that doesn't exist. This PR isn't changing the way forms or the clearDirty-method are handled, it just assures no error is thrown when using radiogroup-components. ### Related issue(s)/PR(s) Resolves https://github.com/modmore/ClientConfig/issues/202 Resolves https://github.com/modmore/ClientConfig/pull/176 Resolves https://github.com/modmore/ClientConfig/issues/143 --------- Co-authored-by: Jason Coward --- manager/assets/modext/modx.jsgrps-min.js | 2 +- manager/assets/modext/util/utilities.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manager/assets/modext/modx.jsgrps-min.js b/manager/assets/modext/modx.jsgrps-min.js index 88baa71b123..7eb884146a6 100644 --- a/manager/assets/modext/modx.jsgrps-min.js +++ b/manager/assets/modext/modx.jsgrps-min.js @@ -16,7 +16,7 @@ * */ -Ext.onReady((function(){if("en"==MODx.config.manager_language)return!1;Date.dayNames=[_("sunday"),_("monday"),_("tuesday"),_("wednesday"),_("thursday"),_("friday"),_("saturday")],Date.monthNames=[_("january"),_("february"),_("march"),_("april"),_("may"),_("june"),_("july"),_("august"),_("september"),_("october"),_("november"),_("december")],Ext.apply(Ext.grid.GridView.prototype,{sortAscText:_("ext_sortasc"),sortDescText:_("ext_sortdesc"),lockText:_("ext_column_lock"),unlockText:_("ext_column_unlock"),columnsText:_("ext_columns"),emptyText:_("ext_emptymsg")}),Ext.apply(Ext.DatePicker.prototype,{todayText:_("today"),todayTip:_("ext_today_tip"),minText:_("ext_mindate"),maxText:_("ext_maxdate"),monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:_("ext_nextmonth"),prevText:_("ext_prevmonth"),monthYearText:_("ext_choosemonth")}),Ext.MessageBox.buttonText={yes:_("yes"),no:_("no"),ok:_("ok"),cancel:_("cancel")},Ext.apply(Ext.PagingToolbar.prototype,{afterPageText:_("ext_afterpage"),beforePageText:_("ext_beforepage"),displayMsg:_("ext_displaying"),emptyMsg:_("ext_emptymsg"),firstText:_("ext_first"),prevText:_("ext_prev"),nextText:_("ext_next"),lastText:_("ext_last"),refreshText:_("ext_refresh")}),Ext.apply(Ext.Updater.prototype,{text:_("loading")}),Ext.apply(Ext.LoadMask.prototype,{msg:_("loading")}),Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype,{splitTip:_("ext_splittip")}),Ext.apply(Ext.form.BasicForm.prototype,{waitTitle:_("please_wait")}),Ext.apply(Ext.form.ComboBox.prototype,{loadingText:_("loading")}),Ext.apply(Ext.form.Field.prototype,{invalidText:_("ext_invalidfield")}),Ext.apply(Ext.form.TextField.prototype,{minLengthText:_("ext_minlenfield"),maxLengthText:_("ext_maxlenfield"),invalidText:_("ext_invalidfield"),blankText:_("field_required")}),Ext.apply(Ext.form.NumberField.prototype,{minText:_("ext_minvalfield"),maxText:_("ext_maxvalfield"),nanText:_("ext_nanfield")}),Ext.apply(Ext.form.DateField.prototype,{disabledDaysText:_("disabled"),disabledDatesText:_("disabled"),minText:_("ext_datemin"),maxText:_("ext_datemax"),invalidText:_("ext_dateinv")}),Ext.apply(Ext.form.VTypes,{emailText:_("ext_inv_email"),urlText:_("ext_inv_url"),alphaText:_("ext_inv_alpha"),alphanumText:_("ext_inv_alphanum")}),Ext.apply(Ext.grid.GroupingView.prototype,{emptyGroupText:_("ext_emptygroup"),groupByText:_("ext_groupby"),showGroupsText:_("ext_showgroups")}),Ext.apply(Ext.grid.PropertyColumnModel.prototype,{nameText:_("name"),valueText:_("value")}),Ext.apply(Ext.form.CheckboxGroup.prototype,{blankText:_("ext_checkboxinv")}),Ext.apply(Ext.form.RadioGroup.prototype,{blankText:_("ext_checkboxinv")}),Ext.apply(Ext.form.TimeField.prototype,{minText:_("ext_timemin"),maxText:_("ext_timemax"),invalidText:_("ext_timeinv")})})),Ext.namespace("MODx.util.Progress"),MODx.util.JSONReader=function(config){config=config||{},Ext.applyIf(config,{successProperty:"success",totalProperty:"total",root:"data"}),MODx.util.JSONReader.superclass.constructor.call(this,config,["id","msg"])},Ext.extend(MODx.util.JSONReader,Ext.data.JsonReader),Ext.reg("modx-json-reader",MODx.util.JSONReader),MODx.util.Progress={id:0,time:function(v,id,msg){msg=msg||_("saving"),MODx.util.Progress.id===id&&v<11&&Ext.MessageBox.updateProgress(v/10,msg)},reset:function(){MODx.util.Progress.id=MODx.util.Progress.id+1}},MODx.LockMask=function(config){config=config||{},Ext.applyIf(config,{msg:_("locked"),msgCls:"modx-lockmask"}),MODx.LockMask.superclass.constructor.call(this,config.el,config)},Ext.extend(MODx.LockMask,Ext.LoadMask,{locked:!1,toggle:function(){this.locked?(this.hide(),this.locked=!1):(this.show(),this.locked=!0)},lock:function(){this.locked=!0,this.show()},unlock:function(){this.locked=!1,this.hide()}}),Ext.reg("modx-lockmask",MODx.LockMask),Ext.override(Ext.form.NumberField,{strictDecimalPrecision:!1,fixPrecision:function(value){var nan=isNaN(value);return this.allowDecimals&&-1!=this.decimalPrecision&&!nan&&value?this.allowDecimals&&this.strictDecimalPrecision?parseFloat(value).toFixed(this.decimalPrecision):parseFloat(parseFloat(value).toFixed(this.decimalPrecision)):nan?"":value}}),Ext.override(Ext.form.BasicForm,{clearDirty:function(nodeToRecurse){(nodeToRecurse=nodeToRecurse||this).items.each((function(f){f.getValue&&(f.items?this.clearDirty(f):f.originalValue!=f.getValue()&&(f.originalValue=f.getValue()))}),this)}}),MODx.StaticTextField=Ext.extend(Ext.form.TextField,{fieldClass:"x-static-text-field",onRender:function(){this.readOnly=!0,this.disabled=!this.initialConfig.submitValue,MODx.StaticTextField.superclass.onRender.apply(this,arguments)}}),Ext.reg("statictextfield",MODx.StaticTextField),MODx.StaticBoolean=Ext.extend(Ext.form.TextField,{fieldClass:"x-static-text-field",onRender:function(tf){this.readOnly=!0,this.disabled=!this.initialConfig.submitValue,MODx.StaticBoolean.superclass.onRender.apply(this,arguments),this.on("change",this.onChange,this)},setValue:function(v){1===v?(this.addClass("green"),v=_("yes")):(this.addClass("red"),v=_("no")),MODx.StaticBoolean.superclass.setValue.apply(this,arguments)}}),Ext.reg("staticboolean",MODx.StaticBoolean),MODx.util.safeHtml=function(input,allowedTags,allowedAttributes){var strip=function(input,allowedTags,allowedAttributes){return input.replace(tags,(function($0,$1){return allowedTags.indexOf("<"+$1.toLowerCase()+">")>-1?$0:""})).replace(attributes,(function($0,$1){return allowedAttributes.indexOf($1.toLowerCase()+",")>-1?$0:""}))};allowedTags=(((allowedTags||"
")+"").toLowerCase().match(/<[a-z][a-z0-9]*>/g)||[]).join(""),allowedAttributes=(((allowedAttributes||"href,class")+"").toLowerCase().match(/[a-z\-,]*/g)||[]).join("").concat(",");var length,tags=/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,attributes=/([a-z][a-z0-9]*)\s*=\s*".*?"/gi;input=input.replace(/|<\?(?:php)?[\s\S]*?\?>/gi,"").replace(/href(\s*?=\s*?(["'])javascript:.*?\2|\s*?=\s*?javascript:.*?(?![^> ]))/gi,'href="javascript:void(0)"');do{length=input.length,input=strip(input,allowedTags,allowedAttributes)}while(length!==input.length);return input.replace(/on([a-z][a-z0-9]*\s*=)/gi,"on​$1")},Ext.override(Ext.form.Checkbox,{setBoxLabel:function(boxLabel){this.boxLabel=boxLabel,this.rendered&&this.wrap.child(".x-form-cb-label").update(boxLabel)}}),Array.prototype.in_array=function(p_val){for(var i=0,l=this.length;i0){this.items.addAll(fields);for(var f=0;f',elbowMarkup=n.attributes.pseudoroot?'':'',buf=['
  • ",'',"
  • "].join("");!0!==bulkRender&&n.nextSibling&&(nel=n.nextSibling.ui.getEl())?this.wrap=Ext.DomHelper.insertHtml("beforeBegin",nel,buf):this.wrap=Ext.DomHelper.insertHtml("beforeEnd",targetNode,buf),this.elNode=this.wrap.childNodes[0],this.ctNode=this.wrap.childNodes[1];var cs=this.elNode.childNodes;this.indentNode=cs[0],this.ecNode=cs[1],this.iconNode=cs[2];var index=3;cb&&(this.checkbox=cs[3],this.checkbox.defaultChecked=this.checkbox.checked,index++),this.anchor=cs[index],this.textNode=cs[index].firstChild},renderItemText:function(item){return Ext.util.Format.htmlEncode(item.text)},getChildIndent:function(){if(!this.childIndent){for(var buf=[],p=this.node;p;)(!p.isRoot||p.isRoot&&p.ownerTree.rootVisible)&&!p.attributes.pseudoroot&&(p.isLast()?buf.unshift(''):buf.unshift('')),p=p.parentNode;this.childIndent=buf.join("")}return this.childIndent}}),Ext.override(Ext.form.Action.Submit,{handleResponse:function(response){var m=Ext.decode(response.responseText);if(this.form.errorReader){var rs=this.form.errorReader.read(response),errors=[];if(rs.records)for(var i=0,len=rs.records.length;i';document.getElementById("flashcopier").innerHTML=divinfo}}},Ext.util.Format.trimCommas=function(s){var len=(s=s.replace(",,",",")).length;return","==s.substr(len-1,1)&&(s=s.substring(0,len-1)),","==s.substr(0,1)&&(s=s.substring(1)),","==s&&(s=""),s},Ext.ns("Ext.ux.grid"),"function"!=typeof RegExp.escape&&(RegExp.escape=function(s){return"string"!=typeof s?s:s.replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1")}),Ext.ux.grid.RowActions=function(a){Ext.apply(this,a),this.addEvents("beforeaction","action","beforegroupaction","groupaction"),Ext.ux.grid.RowActions.superclass.constructor.call(this)},Ext.extend(Ext.ux.grid.RowActions,Ext.util.Observable,{actionEvent:"click",autoWidth:!0,dataIndex:"",editable:!1,header:"",isColumn:!0,keepSelection:!1,menuDisabled:!0,sortable:!1,tplGroup:'
    ux-action-right {cls}" style="{style}" qtip="{qtip}">{text}
    ',tplRow:'
    ux-row-action-text" style="{hide}{style}" qtip="{qtip}">{text}
    ',hideMode:"visibility",widthIntercept:4,widthSlope:21,init:function(g){this.grid=g,this.id=this.id||Ext.id();var h=g.getColumnModel().lookup;delete h[void 0],h[this.id]=this,this.tpl||(this.tpl=this.processActions(this.actions)),this.autoWidth&&(this.width=this.widthSlope*this.actions.length+this.widthIntercept,this.fixed=!0);var i=g.getView(),j={scope:this};j[this.actionEvent]=this.onClick,g.afterRender=g.afterRender.createSequence((function(){i.mainBody.on(j),g.on("destroy",this.purgeListeners,this)}),this),this.renderer||(this.renderer=function(a,b,c,d,e,f){return b.css+=(b.css?" ":"")+"ux-row-action-cell",this.tpl.apply(this.getData(a,b,c,d,e,f))}.createDelegate(this)),i.groupTextTpl&&this.groupActions&&(i.interceptMouse=i.interceptMouse.createInterceptor((function(e){if(e.getTarget(".ux-grow-action-item"))return!1})),i.groupTextTpl='
    '+i.groupTextTpl+"
    "+this.processActions(this.groupActions,this.tplGroup).apply()),!0===this.keepSelection&&(g.processEvent=g.processEvent.createInterceptor((function(a,e){if("mousedown"===a)return!this.getAction(e)}),this))},getData:function(a,b,c,d,e,f){return c.data||{}},processActions:function(b,c){var d=[];Ext.each(b,(function(a,i){a.iconCls&&"function"==typeof(a.callback||a.cb)&&(this.callbacks=this.callbacks||{},this.callbacks[a.iconCls]=a.callback||a.cb);var o={cls:a.iconIndex?"{"+a.iconIndex+"}":a.iconCls?a.iconCls:"",qtip:a.qtipIndex?"{"+a.qtipIndex+"}":a.tooltip||a.qtip?a.tooltip||a.qtip:"",text:a.textIndex?"{"+a.textIndex+"}":a.text?a.text:"",hide:a.hideIndex?''+("display"===this.hideMode?"display:none":"visibility:hidden")+";":a.hide?"display"===this.hideMode?"display:none":"visibility:hidden;":"",align:a.align||"right",style:a.style?a.style:""};d.push(o)}),this);var e=new Ext.XTemplate(c||this.tplRow);return new Ext.XTemplate(e.apply({actions:d}))},getAction:function(e){var a=!1,t=e.getTarget(".ux-row-action-item");return t&&(a=t.className.replace(/ux-row-action-item /,""))&&(a=(a=a.replace(/ ux-row-action-text/,"")).trim()),a},onClick:function(e,a){var b=this.grid.getView(),c=e.getTarget(".x-grid3-row"),d=b.findCellIndex(a.parentNode.parentNode),f=this.getAction(e);if(!1!==c&&!1!==d&&!1!==f){var g=this.grid.store.getAt(c.rowIndex);if(this.callbacks&&"function"==typeof this.callbacks[f]&&this.callbacks[f](this.grid,g,f,c.rowIndex,d),!0!==this.eventsSuspended&&!1===this.fireEvent("beforeaction",this.grid,g,f,c.rowIndex,d))return;!0!==this.eventsSuspended&&this.fireEvent("action",this.grid,g,f,c.rowIndex,d)}if(t=e.getTarget(".ux-grow-action-item"),t){var j,h=b.findGroup(a),i=h?h.id.replace(/ext-gen[0-9]+-gp-/,""):null;if(i){var k=new RegExp(RegExp.escape(i));j=(j=this.grid.store.queryBy((function(r){return r._groupId.match(k)})))?j.items:[]}if(f=t.className.replace(/ux-grow-action-item (ux-action-right )*/,""),"function"==typeof this.callbacks[f]&&this.callbacks[f](this.grid,j,f,i),!0!==this.eventsSuspended&&!1===this.fireEvent("beforegroupaction",this.grid,j,f,i))return!1;this.fireEvent("groupaction",this.grid,j,f,i)}}}),Ext.reg("rowactions",Ext.ux.grid.RowActions),Ext.SwitchButton=Ext.extend(Ext.Component,{initComponent:function(){Ext.SwitchButton.superclass.initComponent.call(this);var mc=new Ext.util.MixedCollection;mc.addAll(this.items),this.items=mc,this.addEvents("change"),this.handler&&this.on("change",this.handler,this.scope||this)},onRender:function(ct,position){var el=document.createElement("table");el.cellSpacing=0,el.className="x-rbtn",el.id=this.id;var row=document.createElement("tr");el.appendChild(document.createElement("tbody")).appendChild(row);var count=this.items.length,last=count-1;this.activeItem=this.items.get(this.activeItem);for(var i=0;idata.rowIndex&&this.rowPosition<0&&rindex--,rindex0&&rindex++,rindex>data.rowIndex&&data.selections.length>1&&(rindex-=data.selections.length-1),rindex==data.rowIndex)return!1;if(!self.copy)for(i=0;i=0;i--){var insertIndex=rindex;ds.insert(insertIndex,selections[i])}var sm=this.grid.getSelectionModel();return sm&&sm.selectRecords(data.selections),this.gridDropTarget.fireEvent(self.copy?"afterrowcopy":"afterrowmove",this.gridDropTarget,data.rowIndex,rindex,data.selections),!0},notifyOver:function(dd,e,data){var t=Ext.lib.Event.getTarget(e),rindex=this.grid.getView().findRowIndex(t),keys=this.grid.getStore().data.keys;for(var key in keys)for(var i=0;i0)this.currentRowEl=new Ext.Element(currentRow),this.currentRowEl.addClass("grid-row-insert-below");else if(rindex-1>=0){var previousRow=this.grid.getView().getRow(rindex-1);this.currentRowEl=new Ext.Element(previousRow),this.currentRowEl.addClass("grid-row-insert-below")}else this.currentRowEl.addClass("grid-row-insert-above")}catch(err){console.warn(err),rindex=!1}return!1===rindex?this.dropNotAllowed:this.dropAllowed},notifyOut:function(dd,e,data){this.currentRowEl&&(this.currentRowEl.removeClass("grid-row-insert-above"),this.currentRowEl.removeClass("grid-row-insert-below"))}}),this.targetCfg&&Ext.apply(this.target,this.targetCfg),this.scrollable&&(Ext.dd.ScrollManager.register(grid.getView().getEditorParent()),grid.on({beforedestroy:this.onBeforeDestroy,scope:this,single:!0}))},getTarget:function(){return this.target},getGrid:function(){return this.grid},getCopy:function(){return!!this.copy},setCopy:function(b){this.copy=!!b},onBeforeDestroy:function(grid){Ext.dd.ScrollManager.unregister(grid.getView().getEditorParent())}}),Ext.grid.GridView.prototype.templates||(Ext.grid.GridView.prototype.templates={}),Ext.grid.GridView.prototype.templates.cell=new Ext.Template('','
    {value}
    ',""),MODx.grid||(MODx.grid={}),MODx.grid.ComboColumn=Ext.extend(Ext.grid.Column,{gridId:void 0,constructor:function(cfg){MODx.grid.ComboColumn.superclass.constructor.call(this,cfg),this.renderer=this.editor&&this.editor.triggerAction?MODx.grid.ComboBoxRenderer(this.editor,this.gridId):function(value){return value}}}),Ext.grid.Column.types.combocolumn=MODx.grid.ComboColumn,MODx.grid.ComboBoxRenderer=function(combo,gridId){return function(value){return 0==combo.store.getCount()&&gridId?(combo.store.on("load",(function(){var grid=Ext.getCmp(gridId);grid&&grid.getView().refresh()}),this,{single:!0}),value):function(value){var idx=combo.store.find(combo.valueField,value),rec=combo.store.getAt(idx);return rec?rec.get(combo.displayField):value}(value)}},Ext.Button.buttonTemplate=new Ext.Template(''),Ext.Button.buttonTemplate.compile(),Ext.TabPanel.prototype.itemTpl=new Ext.Template('
  • ','{text}
  • '),Ext.TabPanel.prototype.itemTpl.disableFormats=!0,Ext.TabPanel.prototype.itemTpl.compile(),Ext.override(Ext.form.TimeField,{initDate:"2/1/2008"}),Ext.ns("Ext.ux.form"),Ext.ux.form.DateTime=Ext.extend(Ext.form.Field,{dateValidator:null,defaultAutoCreate:{tag:"input",type:"hidden"},dtSeparator:" ",hiddenFormat:"Y-m-d H:i:s",otherToNow:!0,timePosition:"right",timeValidator:null,timeWidth:100,dateFormat:"m/d/y",timeFormat:"g:i A",maxDateValue:"",minDateValue:"",timeIncrement:15,maxTimeValue:null,minTimeValue:null,disabledDates:null,hideTime:!1,initComponent:function(){Ext.ux.form.DateTime.superclass.initComponent.call(this),this.hasOwnProperty("offset_time")&&!isNaN(this.offset_time)||(this.offset_time=0);var dateConfig=Ext.apply({},{id:this.id+"-date",format:this.dateFormat||Ext.form.DateField.prototype.format,width:this.timeWidth,selectOnFocus:this.selectOnFocus,validator:this.dateValidator,disabledDates:this.disabledDates||null,disabledDays:this.disabledDays||[],showToday:this.showToday||!0,maxValue:this.maxDateValue||"",minValue:this.minDateValue||"",startDay:this.startDay||0,allowBlank:this.allowBlank,listeners:{blur:{scope:this,fn:this.onBlur},focus:{scope:this,fn:this.onFocus}}},this.dateConfig);this.df=new Ext.form.DateField(dateConfig),this.df.ownerCt=this,delete this.dateFormat,delete this.disabledDates,delete this.disabledDays,delete this.maxDateValue,delete this.minDateValue,delete this.startDay;var timeConfig=Ext.apply({},{id:this.id+"-time",format:this.timeFormat||Ext.form.TimeField.prototype.format,width:this.timeWidth,selectOnFocus:this.selectOnFocus,validator:this.timeValidator,increment:this.timeIncrement||15,maxValue:this.maxTimeValue||null,minValue:this.minTimeValue||null,hidden:this.hideTime,allowBlank:this.allowBlank,listeners:{blur:{scope:this,fn:this.onBlur},focus:{scope:this,fn:this.onFocus}}},this.timeConfig);this.tf=new Ext.form.TimeField(timeConfig),this.tf.ownerCt=this,delete this.timeFormat,delete this.maxTimeValue,delete this.minTimeValue,delete this.timeIncrement,this.relayEvents(this.df,["focus","specialkey","invalid","valid"]),this.relayEvents(this.tf,["focus","specialkey","invalid","valid"]),this.on("specialkey",this.onSpecialKey,this)},onRender:function(ct,position){if(!this.isRendered){var t;if(Ext.ux.form.DateTime.superclass.onRender.call(this,ct,position),t="below"===this.timePosition||"bellow"===this.timePosition?Ext.DomHelper.append(ct,{tag:"table",style:"border-collapse:collapse",children:[{tag:"tr",children:[{tag:"td",style:"padding-bottom:1px",cls:"ux-datetime-date"}]},{tag:"tr",children:[{tag:"td",cls:"ux-datetime-time"}]}]},!0):Ext.DomHelper.append(ct,{tag:"table",style:"border-collapse:collapse",children:[{tag:"tr",children:[{tag:"td",style:"padding-right:4px",cls:"ux-datetime-date"},{tag:"td",cls:"ux-datetime-time"}]}]},!0),this.tableEl=t,this.wrap=t.wrap({cls:"x-form-field-wrap x-datetime-wrap"}),this.wrap.on("mousedown",this.onMouseDown,this,{delay:10}),this.df.render(t.child("td.ux-datetime-date")),this.tf.render(t.child("td.ux-datetime-time")),this.df.el.swallowEvent(["keydown","keypress"]),this.tf.el.swallowEvent(["keydown","keypress"]),"side"===this.msgTarget){var elp=this.el.findParent(".x-form-element",10,!0);elp&&(this.errorIcon=elp.createChild({cls:"x-form-invalid-icon"}));var o={errorIcon:this.errorIcon,msgTarget:"side",alignErrorIcon:this.alignErrorIcon.createDelegate(this)};Ext.apply(this.df,o),Ext.apply(this.tf,o)}this.el.dom.name=this.hiddenName||this.name||this.id,this.df.el.dom.removeAttribute("name"),this.tf.el.dom.removeAttribute("name"),this.isRendered=!0,this.updateHidden()}},adjustSize:Ext.BoxComponent.prototype.adjustSize,alignErrorIcon:function(){this.errorIcon.alignTo(this.tableEl,"tl-tr",[2,0])},initDateValue:function(){this.dateValue=this.otherToNow?new Date:new Date(1970,0,1,0,0,0)},clearInvalid:function(){this.df.clearInvalid(),this.tf.clearInvalid()},markInvalid:function(msg){this.df.markInvalid(msg),this.tf.markInvalid(msg)},beforeDestroy:function(){this.isRendered&&(this.wrap.removeAllListeners(),this.wrap.remove(),this.tableEl.remove(),this.df.destroy(),this.tf.destroy())},disable:function(){return this.isRendered&&(this.df.disabled=this.disabled,this.df.onDisable(),this.tf.onDisable()),this.disabled=!0,this.df.disabled=!0,this.tf.disabled=!0,this.fireEvent("disable",this),this},enable:function(){return this.rendered&&(this.df.onEnable(),this.tf.onEnable()),this.disabled=!1,this.df.disabled=!1,this.tf.disabled=!1,this.fireEvent("enable",this),this},focus:function(){this.df.focus()},getPositionEl:function(){return this.wrap},getResizeEl:function(){return this.wrap},getValue:function(){return this.dateValue?new Date(this.dateValue):""},isValid:function(){return this.df.isValid()&&this.tf.isValid()},isVisible:function(){return this.df.rendered&&this.df.getActionEl().isVisible()},onBlur:function(f){this.wrapClick&&(f.focus(),this.wrapClick=!1),f===this.df?this.updateDate():this.updateTime(),this.updateHidden(),this.validate(),function(){if(!this.df.hasFocus&&!this.tf.hasFocus){var v=this.getValue();String(v)!==String(this.startValue)&&this.fireEvent("change",this,v,this.startValue),this.hasFocus=!1,this.fireEvent("blur",this)}}.defer(100,this)},onFocus:function(){this.hasFocus||(this.hasFocus=!0,this.startValue=this.getValue(),this.fireEvent("focus",this))},onMouseDown:function(e){this.disabled||(this.wrapClick="td"===e.target.nodeName.toLowerCase())},onSpecialKey:function(t,e){var key=e.getKey();key===e.TAB&&(t!==this.df||e.shiftKey||(e.stopEvent(),this.tf.focus()),t===this.tf&&e.shiftKey&&(e.stopEvent(),this.df.focus()),this.updateValue()),key===e.ENTER&&this.updateValue()},reset:function(){this.df.setValue(this.originalValue),this.tf.setValue(this.originalValue)},setDate:function(date){date&&0!=this.offset_time&&(date=date.add(Date.MINUTE,60*new Number(this.offset_time))),this.df.setValue(date)},setTime:function(date){date&&0!=this.offset_time&&(date=date.add(Date.MINUTE,60*new Number(this.offset_time))),this.tf.setValue(date)},setSize:function(w,h){w&&("below"===this.timePosition?(this.df.setSize(w,h),this.tf.setSize(w,h),Ext.isIE&&(this.df.el.up("td").setWidth(w),this.tf.el.up("td").setWidth(w))):(this.df.setSize(w-this.timeWidth-4,h),this.tf.setSize(this.timeWidth,h),Ext.isIE&&(this.df.el.up("td").setWidth(w-this.timeWidth-4),this.tf.el.up("td").setWidth(this.timeWidth))))},setValue:function(val){if(val||!0!==this.emptyToNow){if(!val)return this.setDate(""),this.setTime(""),void this.updateValue();var da;"number"==typeof val?val=new Date(val):"string"==typeof val&&this.hiddenFormat&&(val=Date.parseDate(val,this.hiddenFormat)),(val=val||new Date(1970,0,1,0,0,0))instanceof Date?(this.setDate(val),this.setTime(val),this.dateValue=new Date(Ext.isIE?val.getTime():val)):(da=val.split(this.dtSeparator),this.setDate(da[0]),da[1]&&(da[2]&&(da[1]+=da[2]),this.setTime(da[1]))),this.updateValue()}else this.setValue(new Date)},setVisible:function(visible){return visible?(this.df.show(),this.tf.show()):(this.df.hide(),this.tf.hide()),this},show:function(){return this.setVisible(!0)},hide:function(){return this.setVisible(!1)},updateDate:function(){var d=this.df.getValue();d?(this.dateValue instanceof Date||(this.initDateValue(),this.tf.getValue()||this.setTime(this.dateValue)),this.dateValue.setMonth(0),this.dateValue.setFullYear(d.getFullYear()),this.dateValue.setMonth(d.getMonth(),d.getDate())):(this.dateValue="",this.setTime(""))},updateTime:function(){var t=this.tf.getValue();!t||t instanceof Date||(t=Date.parseDate(t,this.tf.format)),t&&!this.df.getValue()&&(this.initDateValue(),this.setDate(this.dateValue)),this.dateValue instanceof Date&&(t?(this.dateValue.setHours(t.getHours()),this.dateValue.setMinutes(t.getMinutes()),this.dateValue.setSeconds(t.getSeconds())):(this.dateValue.setHours(0),this.dateValue.setMinutes(0),this.dateValue.setSeconds(0)))},updateHidden:function(){if(this.isRendered){var value="";this.dateValue instanceof Date&&(value=this.dateValue.add(Date.MINUTE,0-60*new Number(this.offset_time)).format(this.hiddenFormat)),this.el.dom.value=value}},updateValue:function(){this.updateDate(),this.updateTime(),this.updateHidden()},validate:function(){return this.df.validate()&&this.tf.validate()},renderer:function(field){var format=field.editor.dateFormat||Ext.ux.form.DateTime.prototype.dateFormat;format+=" "+(field.editor.timeFormat||Ext.ux.form.DateTime.prototype.timeFormat);return function(val){return Ext.util.Format.date(val,format)}}}),Ext.reg("xdatetime",Ext.ux.form.DateTime),Ext.namespace("Ext.ux.Utils"),Ext.ux.Utils.EventQueue=function(handler,scope){if(!handler)throw"Handler is required.";this.handler=handler,this.scope=scope||window,this.queue=[],this.is_processing=!1,this.postEvent=function(event,data){data=data||null,this.queue.push({event,data}),this.is_processing||this.process()},this.flushEventQueue=function(){this.queue=[]},this.process=function(){for(;this.queue.length>0;){this.is_processing=!0;var event_data=this.queue.shift();this.handler.call(this.scope,event_data.event,event_data.data)}this.is_processing=!1}},Ext.ux.Utils.FSA=function(initial_state,trans_table,trans_table_scope){this.current_state=initial_state,this.trans_table=trans_table||{},this.trans_table_scope=trans_table_scope||window,Ext.ux.Utils.FSA.superclass.constructor.call(this,this.processEvent,this)},Ext.extend(Ext.ux.Utils.FSA,Ext.ux.Utils.EventQueue,{current_state:null,trans_table:null,trans_table_scope:null,state:function(){return this.current_state},processEvent:function(event,data){var transitions=this.currentStateEventTransitions(event);if(!transitions)throw"State '"+this.current_state+"' has no transition for event '"+event+"'.";for(var i=0,len=transitions.length;i ").compile()},createForm:function(){this.form=Ext.DomHelper.append(this.body,{tag:"form",method:"post",action:this.url,style:"position: absolute; left: -100px; top: -100px; width: 100px; height: 100px; clear: both;"})},createProgressBar:function(){this.progress_bar=this.add(new Ext.ProgressBar({x:0,y:0,anchor:"0",value:0,text:this.i18n.progress_waiting_text}))},createGrid:function(){var store=new Ext.data.Store({proxy:new Ext.data.MemoryProxy([]),reader:new Ext.data.JsonReader({},Ext.ux.UploadDialog.FileRecord),sortInfo:{field:"state",direction:"DESC"},pruneModifiedRecords:!0}),cm=new Ext.grid.ColumnModel([{header:this.i18n.state_col_title,width:this.i18n.state_col_width,resizable:!1,dataIndex:"state",sortable:!0,renderer:this.renderStateCell.createDelegate(this)},{header:this.i18n.filename_col_title,width:this.i18n.filename_col_width,dataIndex:"filename",sortable:!0,renderer:this.renderFilenameCell.createDelegate(this)},{header:this.i18n.note_col_title,width:this.i18n.note_col_width,dataIndex:"note",sortable:!0,renderer:this.renderNoteCell.createDelegate(this)}]);this.grid_panel=new Ext.grid.GridPanel({ds:store,cm,layout:"fit",height:this.height-100,region:"center",x:0,y:22,border:!0,viewConfig:{autoFill:!0,forceFit:!0},bbar:new Ext.Toolbar}),this.grid_panel.on("render",this.onGridRender,this),this.add(this.grid_panel),this.grid_panel.getSelectionModel().on("selectionchange",this.onGridSelectionChange,this)},fillToolbar:function(){var tb=this.grid_panel.getBottomToolbar();tb.x_buttons={},tb.x_buttons.add=tb.addItem(new Ext.ux.UploadDialog.TBBrowseButton({input_name:this.post_var_name,text:this.i18n.add_btn_text,tooltip:this.i18n.add_btn_tip,iconCls:"ext-ux-uploaddialog-addbtn",handler:this.onAddButtonFileSelected,scope:this})),tb.x_buttons.remove=tb.addButton({text:this.i18n.remove_btn_text,tooltip:this.i18n.remove_btn_tip,iconCls:"ext-ux-uploaddialog-removebtn",handler:this.onRemoveButtonClick,scope:this}),tb.x_buttons.reset=tb.addButton({text:this.i18n.reset_btn_text,tooltip:this.i18n.reset_btn_tip,iconCls:"ext-ux-uploaddialog-resetbtn",handler:this.onResetButtonClick,scope:this}),tb.x_buttons.upload=tb.addButton({text:this.i18n.upload_btn_start_text,tooltip:this.i18n.upload_btn_start_tip,iconCls:"ext-ux-uploaddialog-uploadstartbtn",handler:this.onUploadButtonClick,scope:this}),tb.x_buttons.close=tb.addButton({text:this.i18n.close_btn_text,tooltip:this.i18n.close_btn_tip,handler:this.onCloseButtonClick,scope:this})},renderStateCell:function(data,cell,record,row_index,column_index,store){return this.state_tpl.apply({state:data})},renderFilenameCell:function(data,cell,record,row_index,column_index,store){var view=this.grid_panel.getView();return function(){try{Ext.fly(view.getCell(row_index,column_index)).child(".x-grid3-cell-inner").dom.qtip=data}catch(e){}}.defer(1e3),data},renderNoteCell:function(data,cell,record,row_index,column_index,store){var view=this.grid_panel.getView();return function(){try{Ext.fly(view.getCell(row_index,column_index)).child(".x-grid3-cell-inner").dom.qtip=data}catch(e){}}.defer(1e3),data},getFileExtension:function(filename){var result=null,parts=filename.split(".");return parts.length>1&&(result=parts.pop()),result},isPermittedFileType:function(filename){var result=!0;return this.permitted_extensions.length>0&&(result=-1!=this.permitted_extensions.indexOf(this.getFileExtension(filename))),result},isPermittedFile:function(browse_btn){var result=!1,filename=browse_btn.getInputFile().dom.value;return this.isPermittedFileType(filename)?result=!0:(Ext.Msg.alert(this.i18n.error_msgbox_title,String.format(this.i18n.err_file_type_not_permitted,filename,this.permitted_extensions.join(this.i18n.permitted_extensions_join_str))),result=!1),result},fireFileTestEvent:function(browse_btn){return!1!==this.fireEvent("filetest",this,browse_btn.getInputFile().dom.value)},addFileToUploadQueue:function(browse_btn){var input_file=browse_btn.detachInputFile();input_file.appendTo(this.form),input_file.setStyle("width","100px"),input_file.dom.disabled=!0;var store=this.grid_panel.getStore(),fileApi=input_file.dom.files,filename=void 0!==fileApi?fileApi[0].name:input_file.dom.value.replace("C:\\fakepath\\","");store.add(new Ext.ux.UploadDialog.FileRecord({state:Ext.ux.UploadDialog.FileRecord.STATE_QUEUE,filename,note:this.i18n.note_queued_to_upload,input_element:input_file})),this.fsa.postEvent("file-added",input_file.dom.value)},fireFileAddEvent:function(filename){this.fireEvent("fileadd",this,filename)},updateProgressBar:function(){if(this.is_uploading){var queued=this.getQueuedCount(!0),value=1-queued/this.initial_queued_count;this.progress_bar.updateProgress(value,String.format(this.i18n.progress_uploading_text,this.initial_queued_count-queued,this.initial_queued_count))}else this.progress_bar.updateProgress(0,this.i18n.progress_waiting_text)},updateToolbar:function(){var tb=this.grid_panel.getBottomToolbar();this.is_uploading?(tb.x_buttons.remove.disable(),tb.x_buttons.reset.disable(),tb.x_buttons.upload.enable(),this.getAllowCloseOnUpload()||tb.x_buttons.close.disable(),tb.x_buttons.upload.setIconClass("ext-ux-uploaddialog-uploadstopbtn"),tb.x_buttons.upload.setText(this.i18n.upload_btn_stop_text),tb.x_buttons.upload.getEl().child(tb.x_buttons.upload.buttonSelector).dom[tb.x_buttons.upload.tooltipType]=this.i18n.upload_btn_stop_tip):(tb.x_buttons.remove.enable(),tb.x_buttons.reset.enable(),tb.x_buttons.close.enable(),tb.x_buttons.upload.setIconClass("ext-ux-uploaddialog-uploadstartbtn"),tb.x_buttons.upload.setText(this.i18n.upload_btn_start_text),this.getQueuedCount()>0?tb.x_buttons.upload.enable():tb.x_buttons.upload.disable(),this.grid_panel.getSelectionModel().hasSelection()?tb.x_buttons.remove.enable():tb.x_buttons.remove.disable(),this.grid_panel.getStore().getCount()>0?tb.x_buttons.reset.enable():tb.x_buttons.reset.disable())},saveInitialQueuedCount:function(){this.initial_queued_count=this.getQueuedCount()},incInitialQueuedCount:function(){this.initial_queued_count++},setUploadingFlag:function(){this.is_uploading=!0},resetUploadingFlag:function(){this.is_uploading=!1},prepareNextUploadTask:function(){var store=this.grid_panel.getStore(),record=null;store.each((function(r){record||r.get("state")!=Ext.ux.UploadDialog.FileRecord.STATE_QUEUE?r.get("input_element").dom.disabled=!0:record=r})),record.get("input_element").dom.disabled=!1,record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING),record.set("note",this.i18n.note_processing),record.commit(),this.fsa.postEvent("file-upload-start",record)},fireUploadStartEvent:function(){this.fireEvent("uploadstart",this)},removeFiles:function(file_records){for(var store=this.grid_panel.getStore(),i=0,len=file_records.length;i((?:.|\n)*)<\/pre>$/i);filter&&(rt=filter[1]),json_response=Ext.util.JSON.decode(rt)}catch(e){}var data={record:options.record,response:json_response};"success"in json_response&&json_response.success?this.fsa.postEvent("file-upload-success",data):this.fsa.postEvent("file-upload-error",data)},onAjaxFailure:function(response,options){var data={record:options.record,response:{success:!1,error:this.i18n.note_upload_failed}};this.fsa.postEvent("file-upload-failed",data)},startUpload:function(){this.fsa.postEvent("start-upload")},stopUpload:function(){this.fsa.postEvent("stop-upload")},getUrl:function(){return this.url},setUrl:function(url){this.url=url},getBaseParams:function(){return this.base_params},setBaseParams:function(params){this.base_params=params},getUploadAutostart:function(){return this.upload_autostart},setUploadAutostart:function(value){this.upload_autostart=value},getMakeReload:function(){return this.Make_Reload},setMakeReload:function(value){this.Make_Reload=value},getAllowCloseOnUpload:function(){return this.allow_close_on_upload},setAllowCloseOnUpload:function(value){this.allow_close_on_upload},getResetOnHide:function(){return this.reset_on_hide},setResetOnHide:function(value){this.reset_on_hide=value},getPermittedExtensions:function(){return this.permitted_extensions},setPermittedExtensions:function(value){this.permitted_extensions=value},isUploading:function(){return this.is_uploading},isNotEmptyQueue:function(){return this.grid_panel.getStore().getCount()>0},getQueuedCount:function(count_processing){var count=0;return this.grid_panel.getStore().each((function(r){r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_QUEUE&&count++,count_processing&&r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING&&count++})),count},hasUnuploadedFiles:function(){return this.getQueuedCount()>0}});var p=Ext.ux.UploadDialog.Dialog.prototype;p.i18n={title:_("upload_files"),state_col_title:_("upf_state"),state_col_width:70,filename_col_title:_("upf_filename"),filename_col_width:230,note_col_title:_("upf_note"),note_col_width:150,add_btn_text:_("upf_add"),add_btn_tip:_("upf_add_desc"),remove_btn_text:_("upf_remove"),remove_btn_tip:_("upf_remove_desc"),reset_btn_text:_("upf_reset"),reset_btn_tip:_("upf_reset_desc"),upload_btn_start_text:_("upf_upload"),upload_btn_start_tip:_("upf_upload_desc"),upload_btn_stop_text:_("upf_abort"),upload_btn_stop_tip:_("upf_abort_desc"),close_btn_text:_("upf_close"),close_btn_tip:_("upf_close_desc"),progress_waiting_text:_("upf_progress_wait"),progress_uploading_text:_("upf_uploading_desc"),error_msgbox_title:_("upf_error"),permitted_extensions_join_str:",",err_file_type_not_permitted:_("upf_err_filetype"),note_queued_to_upload:_("upf_queued"),note_processing:_("upf_uploading"),note_upload_failed:_("upf_err_failed"),note_upload_success:_("upf_success"),note_upload_error:_("upf_upload_err"),note_aborted:_("upf_aborted")}, +Ext.onReady((function(){if("en"==MODx.config.manager_language)return!1;Date.dayNames=[_("sunday"),_("monday"),_("tuesday"),_("wednesday"),_("thursday"),_("friday"),_("saturday")],Date.monthNames=[_("january"),_("february"),_("march"),_("april"),_("may"),_("june"),_("july"),_("august"),_("september"),_("october"),_("november"),_("december")],Ext.apply(Ext.grid.GridView.prototype,{sortAscText:_("ext_sortasc"),sortDescText:_("ext_sortdesc"),lockText:_("ext_column_lock"),unlockText:_("ext_column_unlock"),columnsText:_("ext_columns"),emptyText:_("ext_emptymsg")}),Ext.apply(Ext.DatePicker.prototype,{todayText:_("today"),todayTip:_("ext_today_tip"),minText:_("ext_mindate"),maxText:_("ext_maxdate"),monthNames:Date.monthNames,dayNames:Date.dayNames,nextText:_("ext_nextmonth"),prevText:_("ext_prevmonth"),monthYearText:_("ext_choosemonth")}),Ext.MessageBox.buttonText={yes:_("yes"),no:_("no"),ok:_("ok"),cancel:_("cancel")},Ext.apply(Ext.PagingToolbar.prototype,{afterPageText:_("ext_afterpage"),beforePageText:_("ext_beforepage"),displayMsg:_("ext_displaying"),emptyMsg:_("ext_emptymsg"),firstText:_("ext_first"),prevText:_("ext_prev"),nextText:_("ext_next"),lastText:_("ext_last"),refreshText:_("ext_refresh")}),Ext.apply(Ext.Updater.prototype,{text:_("loading")}),Ext.apply(Ext.LoadMask.prototype,{msg:_("loading")}),Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype,{splitTip:_("ext_splittip")}),Ext.apply(Ext.form.BasicForm.prototype,{waitTitle:_("please_wait")}),Ext.apply(Ext.form.ComboBox.prototype,{loadingText:_("loading")}),Ext.apply(Ext.form.Field.prototype,{invalidText:_("ext_invalidfield")}),Ext.apply(Ext.form.TextField.prototype,{minLengthText:_("ext_minlenfield"),maxLengthText:_("ext_maxlenfield"),invalidText:_("ext_invalidfield"),blankText:_("field_required")}),Ext.apply(Ext.form.NumberField.prototype,{minText:_("ext_minvalfield"),maxText:_("ext_maxvalfield"),nanText:_("ext_nanfield")}),Ext.apply(Ext.form.DateField.prototype,{disabledDaysText:_("disabled"),disabledDatesText:_("disabled"),minText:_("ext_datemin"),maxText:_("ext_datemax"),invalidText:_("ext_dateinv")}),Ext.apply(Ext.form.VTypes,{emailText:_("ext_inv_email"),urlText:_("ext_inv_url"),alphaText:_("ext_inv_alpha"),alphanumText:_("ext_inv_alphanum")}),Ext.apply(Ext.grid.GroupingView.prototype,{emptyGroupText:_("ext_emptygroup"),groupByText:_("ext_groupby"),showGroupsText:_("ext_showgroups")}),Ext.apply(Ext.grid.PropertyColumnModel.prototype,{nameText:_("name"),valueText:_("value")}),Ext.apply(Ext.form.CheckboxGroup.prototype,{blankText:_("ext_checkboxinv")}),Ext.apply(Ext.form.RadioGroup.prototype,{blankText:_("ext_checkboxinv")}),Ext.apply(Ext.form.TimeField.prototype,{minText:_("ext_timemin"),maxText:_("ext_timemax"),invalidText:_("ext_timeinv")})})),Ext.namespace("MODx.util.Progress"),MODx.util.JSONReader=function(config){config=config||{},Ext.applyIf(config,{successProperty:"success",totalProperty:"total",root:"data"}),MODx.util.JSONReader.superclass.constructor.call(this,config,["id","msg"])},Ext.extend(MODx.util.JSONReader,Ext.data.JsonReader),Ext.reg("modx-json-reader",MODx.util.JSONReader),MODx.util.Progress={id:0,time:function(v,id,msg){msg=msg||_("saving"),MODx.util.Progress.id===id&&v<11&&Ext.MessageBox.updateProgress(v/10,msg)},reset:function(){MODx.util.Progress.id=MODx.util.Progress.id+1}},MODx.LockMask=function(config){config=config||{},Ext.applyIf(config,{msg:_("locked"),msgCls:"modx-lockmask"}),MODx.LockMask.superclass.constructor.call(this,config.el,config)},Ext.extend(MODx.LockMask,Ext.LoadMask,{locked:!1,toggle:function(){this.locked?(this.hide(),this.locked=!1):(this.show(),this.locked=!0)},lock:function(){this.locked=!0,this.show()},unlock:function(){this.locked=!1,this.hide()}}),Ext.reg("modx-lockmask",MODx.LockMask),Ext.override(Ext.form.NumberField,{strictDecimalPrecision:!1,fixPrecision:function(value){var nan=isNaN(value);return this.allowDecimals&&-1!=this.decimalPrecision&&!nan&&value?this.allowDecimals&&this.strictDecimalPrecision?parseFloat(value).toFixed(this.decimalPrecision):parseFloat(parseFloat(value).toFixed(this.decimalPrecision)):nan?"":value}}),Ext.override(Ext.form.BasicForm,{clearDirty:function(nodeToRecurse){nodeToRecurse=nodeToRecurse||this,nodeToRecurse?.items?.each?.((function(f){f.getValue&&(f.items?this.clearDirty(f):f.originalValue!=f.getValue()&&(f.originalValue=f.getValue()))}),this)}}),MODx.StaticTextField=Ext.extend(Ext.form.TextField,{fieldClass:"x-static-text-field",onRender:function(){this.readOnly=!0,this.disabled=!this.initialConfig.submitValue,MODx.StaticTextField.superclass.onRender.apply(this,arguments)}}),Ext.reg("statictextfield",MODx.StaticTextField),MODx.StaticBoolean=Ext.extend(Ext.form.TextField,{fieldClass:"x-static-text-field",onRender:function(tf){this.readOnly=!0,this.disabled=!this.initialConfig.submitValue,MODx.StaticBoolean.superclass.onRender.apply(this,arguments),this.on("change",this.onChange,this)},setValue:function(v){1===v?(this.addClass("green"),v=_("yes")):(this.addClass("red"),v=_("no")),MODx.StaticBoolean.superclass.setValue.apply(this,arguments)}}),Ext.reg("staticboolean",MODx.StaticBoolean),MODx.util.safeHtml=function(input,allowedTags,allowedAttributes){var strip=function(input,allowedTags,allowedAttributes){return input.replace(tags,(function($0,$1){return allowedTags.indexOf("<"+$1.toLowerCase()+">")>-1?$0:""})).replace(attributes,(function($0,$1){return allowedAttributes.indexOf($1.toLowerCase()+",")>-1?$0:""}))};allowedTags=(((allowedTags||"
    ")+"").toLowerCase().match(/<[a-z][a-z0-9]*>/g)||[]).join(""),allowedAttributes=(((allowedAttributes||"href,class")+"").toLowerCase().match(/[a-z\-,]*/g)||[]).join("").concat(",");var length,tags=/<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,attributes=/([a-z][a-z0-9]*)\s*=\s*".*?"/gi;input=input.replace(/|<\?(?:php)?[\s\S]*?\?>/gi,"").replace(/href(\s*?=\s*?(["'])javascript:.*?\2|\s*?=\s*?javascript:.*?(?![^> ]))/gi,'href="javascript:void(0)"');do{length=input.length,input=strip(input,allowedTags,allowedAttributes)}while(length!==input.length);return input.replace(/on([a-z][a-z0-9]*\s*=)/gi,"on​$1")},Ext.override(Ext.form.Checkbox,{setBoxLabel:function(boxLabel){this.boxLabel=boxLabel,this.rendered&&this.wrap.child(".x-form-cb-label").update(boxLabel)}}),Array.prototype.in_array=function(p_val){for(var i=0,l=this.length;i0){this.items.addAll(fields);for(var f=0;f',elbowMarkup=n.attributes.pseudoroot?'':'',buf=['
  • ",'',"
  • "].join("");!0!==bulkRender&&n.nextSibling&&(nel=n.nextSibling.ui.getEl())?this.wrap=Ext.DomHelper.insertHtml("beforeBegin",nel,buf):this.wrap=Ext.DomHelper.insertHtml("beforeEnd",targetNode,buf),this.elNode=this.wrap.childNodes[0],this.ctNode=this.wrap.childNodes[1];var cs=this.elNode.childNodes;this.indentNode=cs[0],this.ecNode=cs[1],this.iconNode=cs[2];var index=3;cb&&(this.checkbox=cs[3],this.checkbox.defaultChecked=this.checkbox.checked,index++),this.anchor=cs[index],this.textNode=cs[index].firstChild},renderItemText:function(item){return Ext.util.Format.htmlEncode(item.text)},getChildIndent:function(){if(!this.childIndent){for(var buf=[],p=this.node;p;)(!p.isRoot||p.isRoot&&p.ownerTree.rootVisible)&&!p.attributes.pseudoroot&&(p.isLast()?buf.unshift(''):buf.unshift('')),p=p.parentNode;this.childIndent=buf.join("")}return this.childIndent}}),Ext.override(Ext.form.Action.Submit,{handleResponse:function(response){var m=Ext.decode(response.responseText);if(this.form.errorReader){var rs=this.form.errorReader.read(response),errors=[];if(rs.records)for(var i=0,len=rs.records.length;i';document.getElementById("flashcopier").innerHTML=divinfo}}},Ext.util.Format.trimCommas=function(s){var len=(s=s.replace(",,",",")).length;return","==s.substr(len-1,1)&&(s=s.substring(0,len-1)),","==s.substr(0,1)&&(s=s.substring(1)),","==s&&(s=""),s},Ext.ns("Ext.ux.grid"),"function"!=typeof RegExp.escape&&(RegExp.escape=function(s){return"string"!=typeof s?s:s.replace(/([.*+?\^=!:${}()|\[\]\/\\])/g,"\\$1")}),Ext.ux.grid.RowActions=function(a){Ext.apply(this,a),this.addEvents("beforeaction","action","beforegroupaction","groupaction"),Ext.ux.grid.RowActions.superclass.constructor.call(this)},Ext.extend(Ext.ux.grid.RowActions,Ext.util.Observable,{actionEvent:"click",autoWidth:!0,dataIndex:"",editable:!1,header:"",isColumn:!0,keepSelection:!1,menuDisabled:!0,sortable:!1,tplGroup:'
    ux-action-right {cls}" style="{style}" qtip="{qtip}">{text}
    ',tplRow:'
    ux-row-action-text" style="{hide}{style}" qtip="{qtip}">{text}
    ',hideMode:"visibility",widthIntercept:4,widthSlope:21,init:function(g){this.grid=g,this.id=this.id||Ext.id();var h=g.getColumnModel().lookup;delete h[void 0],h[this.id]=this,this.tpl||(this.tpl=this.processActions(this.actions)),this.autoWidth&&(this.width=this.widthSlope*this.actions.length+this.widthIntercept,this.fixed=!0);var i=g.getView(),j={scope:this};j[this.actionEvent]=this.onClick,g.afterRender=g.afterRender.createSequence((function(){i.mainBody.on(j),g.on("destroy",this.purgeListeners,this)}),this),this.renderer||(this.renderer=function(a,b,c,d,e,f){return b.css+=(b.css?" ":"")+"ux-row-action-cell",this.tpl.apply(this.getData(a,b,c,d,e,f))}.createDelegate(this)),i.groupTextTpl&&this.groupActions&&(i.interceptMouse=i.interceptMouse.createInterceptor((function(e){if(e.getTarget(".ux-grow-action-item"))return!1})),i.groupTextTpl='
    '+i.groupTextTpl+"
    "+this.processActions(this.groupActions,this.tplGroup).apply()),!0===this.keepSelection&&(g.processEvent=g.processEvent.createInterceptor((function(a,e){if("mousedown"===a)return!this.getAction(e)}),this))},getData:function(a,b,c,d,e,f){return c.data||{}},processActions:function(b,c){var d=[];Ext.each(b,(function(a,i){a.iconCls&&"function"==typeof(a.callback||a.cb)&&(this.callbacks=this.callbacks||{},this.callbacks[a.iconCls]=a.callback||a.cb);var o={cls:a.iconIndex?"{"+a.iconIndex+"}":a.iconCls?a.iconCls:"",qtip:a.qtipIndex?"{"+a.qtipIndex+"}":a.tooltip||a.qtip?a.tooltip||a.qtip:"",text:a.textIndex?"{"+a.textIndex+"}":a.text?a.text:"",hide:a.hideIndex?''+("display"===this.hideMode?"display:none":"visibility:hidden")+";":a.hide?"display"===this.hideMode?"display:none":"visibility:hidden;":"",align:a.align||"right",style:a.style?a.style:""};d.push(o)}),this);var e=new Ext.XTemplate(c||this.tplRow);return new Ext.XTemplate(e.apply({actions:d}))},getAction:function(e){var a=!1,t=e.getTarget(".ux-row-action-item");return t&&(a=t.className.replace(/ux-row-action-item /,""))&&(a=(a=a.replace(/ ux-row-action-text/,"")).trim()),a},onClick:function(e,a){var b=this.grid.getView(),c=e.getTarget(".x-grid3-row"),d=b.findCellIndex(a.parentNode.parentNode),f=this.getAction(e);if(!1!==c&&!1!==d&&!1!==f){var g=this.grid.store.getAt(c.rowIndex);if(this.callbacks&&"function"==typeof this.callbacks[f]&&this.callbacks[f](this.grid,g,f,c.rowIndex,d),!0!==this.eventsSuspended&&!1===this.fireEvent("beforeaction",this.grid,g,f,c.rowIndex,d))return;!0!==this.eventsSuspended&&this.fireEvent("action",this.grid,g,f,c.rowIndex,d)}if(t=e.getTarget(".ux-grow-action-item"),t){var j,h=b.findGroup(a),i=h?h.id.replace(/ext-gen[0-9]+-gp-/,""):null;if(i){var k=new RegExp(RegExp.escape(i));j=(j=this.grid.store.queryBy((function(r){return r._groupId.match(k)})))?j.items:[]}if(f=t.className.replace(/ux-grow-action-item (ux-action-right )*/,""),"function"==typeof this.callbacks[f]&&this.callbacks[f](this.grid,j,f,i),!0!==this.eventsSuspended&&!1===this.fireEvent("beforegroupaction",this.grid,j,f,i))return!1;this.fireEvent("groupaction",this.grid,j,f,i)}}}),Ext.reg("rowactions",Ext.ux.grid.RowActions),Ext.SwitchButton=Ext.extend(Ext.Component,{initComponent:function(){Ext.SwitchButton.superclass.initComponent.call(this);var mc=new Ext.util.MixedCollection;mc.addAll(this.items),this.items=mc,this.addEvents("change"),this.handler&&this.on("change",this.handler,this.scope||this)},onRender:function(ct,position){var el=document.createElement("table");el.cellSpacing=0,el.className="x-rbtn",el.id=this.id;var row=document.createElement("tr");el.appendChild(document.createElement("tbody")).appendChild(row);var count=this.items.length,last=count-1;this.activeItem=this.items.get(this.activeItem);for(var i=0;idata.rowIndex&&this.rowPosition<0&&rindex--,rindex0&&rindex++,rindex>data.rowIndex&&data.selections.length>1&&(rindex-=data.selections.length-1),rindex==data.rowIndex)return!1;if(!self.copy)for(i=0;i=0;i--){var insertIndex=rindex;ds.insert(insertIndex,selections[i])}var sm=this.grid.getSelectionModel();return sm&&sm.selectRecords(data.selections),this.gridDropTarget.fireEvent(self.copy?"afterrowcopy":"afterrowmove",this.gridDropTarget,data.rowIndex,rindex,data.selections),!0},notifyOver:function(dd,e,data){var t=Ext.lib.Event.getTarget(e),rindex=this.grid.getView().findRowIndex(t),keys=this.grid.getStore().data.keys;for(var key in keys)for(var i=0;i0)this.currentRowEl=new Ext.Element(currentRow),this.currentRowEl.addClass("grid-row-insert-below");else if(rindex-1>=0){var previousRow=this.grid.getView().getRow(rindex-1);this.currentRowEl=new Ext.Element(previousRow),this.currentRowEl.addClass("grid-row-insert-below")}else this.currentRowEl.addClass("grid-row-insert-above")}catch(err){console.warn(err),rindex=!1}return!1===rindex?this.dropNotAllowed:this.dropAllowed},notifyOut:function(dd,e,data){this.currentRowEl&&(this.currentRowEl.removeClass("grid-row-insert-above"),this.currentRowEl.removeClass("grid-row-insert-below"))}}),this.targetCfg&&Ext.apply(this.target,this.targetCfg),this.scrollable&&(Ext.dd.ScrollManager.register(grid.getView().getEditorParent()),grid.on({beforedestroy:this.onBeforeDestroy,scope:this,single:!0}))},getTarget:function(){return this.target},getGrid:function(){return this.grid},getCopy:function(){return!!this.copy},setCopy:function(b){this.copy=!!b},onBeforeDestroy:function(grid){Ext.dd.ScrollManager.unregister(grid.getView().getEditorParent())}}),Ext.grid.GridView.prototype.templates||(Ext.grid.GridView.prototype.templates={}),Ext.grid.GridView.prototype.templates.cell=new Ext.Template('','
    {value}
    ',""),MODx.grid||(MODx.grid={}),MODx.grid.ComboColumn=Ext.extend(Ext.grid.Column,{gridId:void 0,constructor:function(cfg){MODx.grid.ComboColumn.superclass.constructor.call(this,cfg),this.renderer=this.editor&&this.editor.triggerAction?MODx.grid.ComboBoxRenderer(this.editor,this.gridId):function(value){return value}}}),Ext.grid.Column.types.combocolumn=MODx.grid.ComboColumn,MODx.grid.ComboBoxRenderer=function(combo,gridId){return function(value){return 0==combo.store.getCount()&&gridId?(combo.store.on("load",(function(){var grid=Ext.getCmp(gridId);grid&&grid.getView().refresh()}),this,{single:!0}),value):function(value){var idx=combo.store.find(combo.valueField,value),rec=combo.store.getAt(idx);return rec?rec.get(combo.displayField):value}(value)}},Ext.Button.buttonTemplate=new Ext.Template(''),Ext.Button.buttonTemplate.compile(),Ext.TabPanel.prototype.itemTpl=new Ext.Template('
  • ','{text}
  • '),Ext.TabPanel.prototype.itemTpl.disableFormats=!0,Ext.TabPanel.prototype.itemTpl.compile(),Ext.override(Ext.form.TimeField,{initDate:"2/1/2008"}),Ext.ns("Ext.ux.form"),Ext.ux.form.DateTime=Ext.extend(Ext.form.Field,{dateValidator:null,defaultAutoCreate:{tag:"input",type:"hidden"},dtSeparator:" ",hiddenFormat:"Y-m-d H:i:s",otherToNow:!0,timePosition:"right",timeValidator:null,timeWidth:100,dateFormat:"m/d/y",timeFormat:"g:i A",maxDateValue:"",minDateValue:"",timeIncrement:15,maxTimeValue:null,minTimeValue:null,disabledDates:null,hideTime:!1,initComponent:function(){Ext.ux.form.DateTime.superclass.initComponent.call(this),this.hasOwnProperty("offset_time")&&!isNaN(this.offset_time)||(this.offset_time=0);var dateConfig=Ext.apply({},{id:this.id+"-date",format:this.dateFormat||Ext.form.DateField.prototype.format,width:this.timeWidth,selectOnFocus:this.selectOnFocus,validator:this.dateValidator,disabledDates:this.disabledDates||null,disabledDays:this.disabledDays||[],showToday:this.showToday||!0,maxValue:this.maxDateValue||"",minValue:this.minDateValue||"",startDay:this.startDay||0,allowBlank:this.allowBlank,listeners:{blur:{scope:this,fn:this.onBlur},focus:{scope:this,fn:this.onFocus}}},this.dateConfig);this.df=new Ext.form.DateField(dateConfig),this.df.ownerCt=this,delete this.dateFormat,delete this.disabledDates,delete this.disabledDays,delete this.maxDateValue,delete this.minDateValue,delete this.startDay;var timeConfig=Ext.apply({},{id:this.id+"-time",format:this.timeFormat||Ext.form.TimeField.prototype.format,width:this.timeWidth,selectOnFocus:this.selectOnFocus,validator:this.timeValidator,increment:this.timeIncrement||15,maxValue:this.maxTimeValue||null,minValue:this.minTimeValue||null,hidden:this.hideTime,allowBlank:this.allowBlank,listeners:{blur:{scope:this,fn:this.onBlur},focus:{scope:this,fn:this.onFocus}}},this.timeConfig);this.tf=new Ext.form.TimeField(timeConfig),this.tf.ownerCt=this,delete this.timeFormat,delete this.maxTimeValue,delete this.minTimeValue,delete this.timeIncrement,this.relayEvents(this.df,["focus","specialkey","invalid","valid"]),this.relayEvents(this.tf,["focus","specialkey","invalid","valid"]),this.on("specialkey",this.onSpecialKey,this)},onRender:function(ct,position){if(!this.isRendered){var t;if(Ext.ux.form.DateTime.superclass.onRender.call(this,ct,position),t="below"===this.timePosition||"bellow"===this.timePosition?Ext.DomHelper.append(ct,{tag:"table",style:"border-collapse:collapse",children:[{tag:"tr",children:[{tag:"td",style:"padding-bottom:1px",cls:"ux-datetime-date"}]},{tag:"tr",children:[{tag:"td",cls:"ux-datetime-time"}]}]},!0):Ext.DomHelper.append(ct,{tag:"table",style:"border-collapse:collapse",children:[{tag:"tr",children:[{tag:"td",style:"padding-right:4px",cls:"ux-datetime-date"},{tag:"td",cls:"ux-datetime-time"}]}]},!0),this.tableEl=t,this.wrap=t.wrap({cls:"x-form-field-wrap x-datetime-wrap"}),this.wrap.on("mousedown",this.onMouseDown,this,{delay:10}),this.df.render(t.child("td.ux-datetime-date")),this.tf.render(t.child("td.ux-datetime-time")),this.df.el.swallowEvent(["keydown","keypress"]),this.tf.el.swallowEvent(["keydown","keypress"]),"side"===this.msgTarget){var elp=this.el.findParent(".x-form-element",10,!0);elp&&(this.errorIcon=elp.createChild({cls:"x-form-invalid-icon"}));var o={errorIcon:this.errorIcon,msgTarget:"side",alignErrorIcon:this.alignErrorIcon.createDelegate(this)};Ext.apply(this.df,o),Ext.apply(this.tf,o)}this.el.dom.name=this.hiddenName||this.name||this.id,this.df.el.dom.removeAttribute("name"),this.tf.el.dom.removeAttribute("name"),this.isRendered=!0,this.updateHidden()}},adjustSize:Ext.BoxComponent.prototype.adjustSize,alignErrorIcon:function(){this.errorIcon.alignTo(this.tableEl,"tl-tr",[2,0])},initDateValue:function(){this.dateValue=this.otherToNow?new Date:new Date(1970,0,1,0,0,0)},clearInvalid:function(){this.df.clearInvalid(),this.tf.clearInvalid()},markInvalid:function(msg){this.df.markInvalid(msg),this.tf.markInvalid(msg)},beforeDestroy:function(){this.isRendered&&(this.wrap.removeAllListeners(),this.wrap.remove(),this.tableEl.remove(),this.df.destroy(),this.tf.destroy())},disable:function(){return this.isRendered&&(this.df.disabled=this.disabled,this.df.onDisable(),this.tf.onDisable()),this.disabled=!0,this.df.disabled=!0,this.tf.disabled=!0,this.fireEvent("disable",this),this},enable:function(){return this.rendered&&(this.df.onEnable(),this.tf.onEnable()),this.disabled=!1,this.df.disabled=!1,this.tf.disabled=!1,this.fireEvent("enable",this),this},focus:function(){this.df.focus()},getPositionEl:function(){return this.wrap},getResizeEl:function(){return this.wrap},getValue:function(){return this.dateValue?new Date(this.dateValue):""},isValid:function(){return this.df.isValid()&&this.tf.isValid()},isVisible:function(){return this.df.rendered&&this.df.getActionEl().isVisible()},onBlur:function(f){this.wrapClick&&(f.focus(),this.wrapClick=!1),f===this.df?this.updateDate():this.updateTime(),this.updateHidden(),this.validate(),function(){if(!this.df.hasFocus&&!this.tf.hasFocus){var v=this.getValue();String(v)!==String(this.startValue)&&this.fireEvent("change",this,v,this.startValue),this.hasFocus=!1,this.fireEvent("blur",this)}}.defer(100,this)},onFocus:function(){this.hasFocus||(this.hasFocus=!0,this.startValue=this.getValue(),this.fireEvent("focus",this))},onMouseDown:function(e){this.disabled||(this.wrapClick="td"===e.target.nodeName.toLowerCase())},onSpecialKey:function(t,e){var key=e.getKey();key===e.TAB&&(t!==this.df||e.shiftKey||(e.stopEvent(),this.tf.focus()),t===this.tf&&e.shiftKey&&(e.stopEvent(),this.df.focus()),this.updateValue()),key===e.ENTER&&this.updateValue()},reset:function(){this.df.setValue(this.originalValue),this.tf.setValue(this.originalValue)},setDate:function(date){date&&0!=this.offset_time&&(date=date.add(Date.MINUTE,60*new Number(this.offset_time))),this.df.setValue(date)},setTime:function(date){date&&0!=this.offset_time&&(date=date.add(Date.MINUTE,60*new Number(this.offset_time))),this.tf.setValue(date)},setSize:function(w,h){w&&("below"===this.timePosition?(this.df.setSize(w,h),this.tf.setSize(w,h),Ext.isIE&&(this.df.el.up("td").setWidth(w),this.tf.el.up("td").setWidth(w))):(this.df.setSize(w-this.timeWidth-4,h),this.tf.setSize(this.timeWidth,h),Ext.isIE&&(this.df.el.up("td").setWidth(w-this.timeWidth-4),this.tf.el.up("td").setWidth(this.timeWidth))))},setValue:function(val){if(val||!0!==this.emptyToNow){if(!val)return this.setDate(""),this.setTime(""),void this.updateValue();var da;"number"==typeof val?val=new Date(val):"string"==typeof val&&this.hiddenFormat&&(val=Date.parseDate(val,this.hiddenFormat)),(val=val||new Date(1970,0,1,0,0,0))instanceof Date?(this.setDate(val),this.setTime(val),this.dateValue=new Date(Ext.isIE?val.getTime():val)):(da=val.split(this.dtSeparator),this.setDate(da[0]),da[1]&&(da[2]&&(da[1]+=da[2]),this.setTime(da[1]))),this.updateValue()}else this.setValue(new Date)},setVisible:function(visible){return visible?(this.df.show(),this.tf.show()):(this.df.hide(),this.tf.hide()),this},show:function(){return this.setVisible(!0)},hide:function(){return this.setVisible(!1)},updateDate:function(){var d=this.df.getValue();d?(this.dateValue instanceof Date||(this.initDateValue(),this.tf.getValue()||this.setTime(this.dateValue)),this.dateValue.setMonth(0),this.dateValue.setFullYear(d.getFullYear()),this.dateValue.setMonth(d.getMonth(),d.getDate())):(this.dateValue="",this.setTime(""))},updateTime:function(){var t=this.tf.getValue();!t||t instanceof Date||(t=Date.parseDate(t,this.tf.format)),t&&!this.df.getValue()&&(this.initDateValue(),this.setDate(this.dateValue)),this.dateValue instanceof Date&&(t?(this.dateValue.setHours(t.getHours()),this.dateValue.setMinutes(t.getMinutes()),this.dateValue.setSeconds(t.getSeconds())):(this.dateValue.setHours(0),this.dateValue.setMinutes(0),this.dateValue.setSeconds(0)))},updateHidden:function(){if(this.isRendered){var value="";this.dateValue instanceof Date&&(value=this.dateValue.add(Date.MINUTE,0-60*new Number(this.offset_time)).format(this.hiddenFormat)),this.el.dom.value=value}},updateValue:function(){this.updateDate(),this.updateTime(),this.updateHidden()},validate:function(){return this.df.validate()&&this.tf.validate()},renderer:function(field){var format=field.editor.dateFormat||Ext.ux.form.DateTime.prototype.dateFormat;format+=" "+(field.editor.timeFormat||Ext.ux.form.DateTime.prototype.timeFormat);return function(val){return Ext.util.Format.date(val,format)}}}),Ext.reg("xdatetime",Ext.ux.form.DateTime),Ext.namespace("Ext.ux.Utils"),Ext.ux.Utils.EventQueue=function(handler,scope){if(!handler)throw"Handler is required.";this.handler=handler,this.scope=scope||window,this.queue=[],this.is_processing=!1,this.postEvent=function(event,data){data=data||null,this.queue.push({event,data}),this.is_processing||this.process()},this.flushEventQueue=function(){this.queue=[]},this.process=function(){for(;this.queue.length>0;){this.is_processing=!0;var event_data=this.queue.shift();this.handler.call(this.scope,event_data.event,event_data.data)}this.is_processing=!1}},Ext.ux.Utils.FSA=function(initial_state,trans_table,trans_table_scope){this.current_state=initial_state,this.trans_table=trans_table||{},this.trans_table_scope=trans_table_scope||window,Ext.ux.Utils.FSA.superclass.constructor.call(this,this.processEvent,this)},Ext.extend(Ext.ux.Utils.FSA,Ext.ux.Utils.EventQueue,{current_state:null,trans_table:null,trans_table_scope:null,state:function(){return this.current_state},processEvent:function(event,data){var transitions=this.currentStateEventTransitions(event);if(!transitions)throw"State '"+this.current_state+"' has no transition for event '"+event+"'.";for(var i=0,len=transitions.length;i ").compile()},createForm:function(){this.form=Ext.DomHelper.append(this.body,{tag:"form",method:"post",action:this.url,style:"position: absolute; left: -100px; top: -100px; width: 100px; height: 100px; clear: both;"})},createProgressBar:function(){this.progress_bar=this.add(new Ext.ProgressBar({x:0,y:0,anchor:"0",value:0,text:this.i18n.progress_waiting_text}))},createGrid:function(){var store=new Ext.data.Store({proxy:new Ext.data.MemoryProxy([]),reader:new Ext.data.JsonReader({},Ext.ux.UploadDialog.FileRecord),sortInfo:{field:"state",direction:"DESC"},pruneModifiedRecords:!0}),cm=new Ext.grid.ColumnModel([{header:this.i18n.state_col_title,width:this.i18n.state_col_width,resizable:!1,dataIndex:"state",sortable:!0,renderer:this.renderStateCell.createDelegate(this)},{header:this.i18n.filename_col_title,width:this.i18n.filename_col_width,dataIndex:"filename",sortable:!0,renderer:this.renderFilenameCell.createDelegate(this)},{header:this.i18n.note_col_title,width:this.i18n.note_col_width,dataIndex:"note",sortable:!0,renderer:this.renderNoteCell.createDelegate(this)}]);this.grid_panel=new Ext.grid.GridPanel({ds:store,cm,layout:"fit",height:this.height-100,region:"center",x:0,y:22,border:!0,viewConfig:{autoFill:!0,forceFit:!0},bbar:new Ext.Toolbar}),this.grid_panel.on("render",this.onGridRender,this),this.add(this.grid_panel),this.grid_panel.getSelectionModel().on("selectionchange",this.onGridSelectionChange,this)},fillToolbar:function(){var tb=this.grid_panel.getBottomToolbar();tb.x_buttons={},tb.x_buttons.add=tb.addItem(new Ext.ux.UploadDialog.TBBrowseButton({input_name:this.post_var_name,text:this.i18n.add_btn_text,tooltip:this.i18n.add_btn_tip,iconCls:"ext-ux-uploaddialog-addbtn",handler:this.onAddButtonFileSelected,scope:this})),tb.x_buttons.remove=tb.addButton({text:this.i18n.remove_btn_text,tooltip:this.i18n.remove_btn_tip,iconCls:"ext-ux-uploaddialog-removebtn",handler:this.onRemoveButtonClick,scope:this}),tb.x_buttons.reset=tb.addButton({text:this.i18n.reset_btn_text,tooltip:this.i18n.reset_btn_tip,iconCls:"ext-ux-uploaddialog-resetbtn",handler:this.onResetButtonClick,scope:this}),tb.x_buttons.upload=tb.addButton({text:this.i18n.upload_btn_start_text,tooltip:this.i18n.upload_btn_start_tip,iconCls:"ext-ux-uploaddialog-uploadstartbtn",handler:this.onUploadButtonClick,scope:this}),tb.x_buttons.close=tb.addButton({text:this.i18n.close_btn_text,tooltip:this.i18n.close_btn_tip,handler:this.onCloseButtonClick,scope:this})},renderStateCell:function(data,cell,record,row_index,column_index,store){return this.state_tpl.apply({state:data})},renderFilenameCell:function(data,cell,record,row_index,column_index,store){var view=this.grid_panel.getView();return function(){try{Ext.fly(view.getCell(row_index,column_index)).child(".x-grid3-cell-inner").dom.qtip=data}catch(e){}}.defer(1e3),data},renderNoteCell:function(data,cell,record,row_index,column_index,store){var view=this.grid_panel.getView();return function(){try{Ext.fly(view.getCell(row_index,column_index)).child(".x-grid3-cell-inner").dom.qtip=data}catch(e){}}.defer(1e3),data},getFileExtension:function(filename){var result=null,parts=filename.split(".");return parts.length>1&&(result=parts.pop()),result},isPermittedFileType:function(filename){var result=!0;return this.permitted_extensions.length>0&&(result=-1!=this.permitted_extensions.indexOf(this.getFileExtension(filename))),result},isPermittedFile:function(browse_btn){var result=!1,filename=browse_btn.getInputFile().dom.value;return this.isPermittedFileType(filename)?result=!0:(Ext.Msg.alert(this.i18n.error_msgbox_title,String.format(this.i18n.err_file_type_not_permitted,filename,this.permitted_extensions.join(this.i18n.permitted_extensions_join_str))),result=!1),result},fireFileTestEvent:function(browse_btn){return!1!==this.fireEvent("filetest",this,browse_btn.getInputFile().dom.value)},addFileToUploadQueue:function(browse_btn){var input_file=browse_btn.detachInputFile();input_file.appendTo(this.form),input_file.setStyle("width","100px"),input_file.dom.disabled=!0;var store=this.grid_panel.getStore(),fileApi=input_file.dom.files,filename=void 0!==fileApi?fileApi[0].name:input_file.dom.value.replace("C:\\fakepath\\","");store.add(new Ext.ux.UploadDialog.FileRecord({state:Ext.ux.UploadDialog.FileRecord.STATE_QUEUE,filename,note:this.i18n.note_queued_to_upload,input_element:input_file})),this.fsa.postEvent("file-added",input_file.dom.value)},fireFileAddEvent:function(filename){this.fireEvent("fileadd",this,filename)},updateProgressBar:function(){if(this.is_uploading){var queued=this.getQueuedCount(!0),value=1-queued/this.initial_queued_count;this.progress_bar.updateProgress(value,String.format(this.i18n.progress_uploading_text,this.initial_queued_count-queued,this.initial_queued_count))}else this.progress_bar.updateProgress(0,this.i18n.progress_waiting_text)},updateToolbar:function(){var tb=this.grid_panel.getBottomToolbar();this.is_uploading?(tb.x_buttons.remove.disable(),tb.x_buttons.reset.disable(),tb.x_buttons.upload.enable(),this.getAllowCloseOnUpload()||tb.x_buttons.close.disable(),tb.x_buttons.upload.setIconClass("ext-ux-uploaddialog-uploadstopbtn"),tb.x_buttons.upload.setText(this.i18n.upload_btn_stop_text),tb.x_buttons.upload.getEl().child(tb.x_buttons.upload.buttonSelector).dom[tb.x_buttons.upload.tooltipType]=this.i18n.upload_btn_stop_tip):(tb.x_buttons.remove.enable(),tb.x_buttons.reset.enable(),tb.x_buttons.close.enable(),tb.x_buttons.upload.setIconClass("ext-ux-uploaddialog-uploadstartbtn"),tb.x_buttons.upload.setText(this.i18n.upload_btn_start_text),this.getQueuedCount()>0?tb.x_buttons.upload.enable():tb.x_buttons.upload.disable(),this.grid_panel.getSelectionModel().hasSelection()?tb.x_buttons.remove.enable():tb.x_buttons.remove.disable(),this.grid_panel.getStore().getCount()>0?tb.x_buttons.reset.enable():tb.x_buttons.reset.disable())},saveInitialQueuedCount:function(){this.initial_queued_count=this.getQueuedCount()},incInitialQueuedCount:function(){this.initial_queued_count++},setUploadingFlag:function(){this.is_uploading=!0},resetUploadingFlag:function(){this.is_uploading=!1},prepareNextUploadTask:function(){var store=this.grid_panel.getStore(),record=null;store.each((function(r){record||r.get("state")!=Ext.ux.UploadDialog.FileRecord.STATE_QUEUE?r.get("input_element").dom.disabled=!0:record=r})),record.get("input_element").dom.disabled=!1,record.set("state",Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING),record.set("note",this.i18n.note_processing),record.commit(),this.fsa.postEvent("file-upload-start",record)},fireUploadStartEvent:function(){this.fireEvent("uploadstart",this)},removeFiles:function(file_records){for(var store=this.grid_panel.getStore(),i=0,len=file_records.length;i((?:.|\n)*)<\/pre>$/i);filter&&(rt=filter[1]),json_response=Ext.util.JSON.decode(rt)}catch(e){}var data={record:options.record,response:json_response};"success"in json_response&&json_response.success?this.fsa.postEvent("file-upload-success",data):this.fsa.postEvent("file-upload-error",data)},onAjaxFailure:function(response,options){var data={record:options.record,response:{success:!1,error:this.i18n.note_upload_failed}};this.fsa.postEvent("file-upload-failed",data)},startUpload:function(){this.fsa.postEvent("start-upload")},stopUpload:function(){this.fsa.postEvent("stop-upload")},getUrl:function(){return this.url},setUrl:function(url){this.url=url},getBaseParams:function(){return this.base_params},setBaseParams:function(params){this.base_params=params},getUploadAutostart:function(){return this.upload_autostart},setUploadAutostart:function(value){this.upload_autostart=value},getMakeReload:function(){return this.Make_Reload},setMakeReload:function(value){this.Make_Reload=value},getAllowCloseOnUpload:function(){return this.allow_close_on_upload},setAllowCloseOnUpload:function(value){this.allow_close_on_upload},getResetOnHide:function(){return this.reset_on_hide},setResetOnHide:function(value){this.reset_on_hide=value},getPermittedExtensions:function(){return this.permitted_extensions},setPermittedExtensions:function(value){this.permitted_extensions=value},isUploading:function(){return this.is_uploading},isNotEmptyQueue:function(){return this.grid_panel.getStore().getCount()>0},getQueuedCount:function(count_processing){var count=0;return this.grid_panel.getStore().each((function(r){r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_QUEUE&&count++,count_processing&&r.get("state")==Ext.ux.UploadDialog.FileRecord.STATE_PROCESSING&&count++})),count},hasUnuploadedFiles:function(){return this.getQueuedCount()>0}});var p=Ext.ux.UploadDialog.Dialog.prototype;p.i18n={title:_("upload_files"),state_col_title:_("upf_state"),state_col_width:70,filename_col_title:_("upf_filename"),filename_col_width:230,note_col_title:_("upf_note"),note_col_width:150,add_btn_text:_("upf_add"),add_btn_tip:_("upf_add_desc"),remove_btn_text:_("upf_remove"),remove_btn_tip:_("upf_remove_desc"),reset_btn_text:_("upf_reset"),reset_btn_tip:_("upf_reset_desc"),upload_btn_start_text:_("upf_upload"),upload_btn_start_tip:_("upf_upload_desc"),upload_btn_stop_text:_("upf_abort"),upload_btn_stop_tip:_("upf_abort_desc"),close_btn_text:_("upf_close"),close_btn_tip:_("upf_close_desc"),progress_waiting_text:_("upf_progress_wait"),progress_uploading_text:_("upf_uploading_desc"),error_msgbox_title:_("upf_error"),permitted_extensions_join_str:",",err_file_type_not_permitted:_("upf_err_filetype"),note_queued_to_upload:_("upf_queued"),note_processing:_("upf_uploading"),note_upload_failed:_("upf_err_failed"),note_upload_success:_("upf_success"),note_upload_error:_("upf_upload_err"),note_aborted:_("upf_aborted")}, /*! * Ext JS Library 3.4.0 * Copyright(c) 2006-2011 Sencha Inc. diff --git a/manager/assets/modext/util/utilities.js b/manager/assets/modext/util/utilities.js index ff8d3236a78..952a4736a5d 100644 --- a/manager/assets/modext/util/utilities.js +++ b/manager/assets/modext/util/utilities.js @@ -82,7 +82,7 @@ Ext.override(Ext.form.NumberField, { Ext.override(Ext.form.BasicForm,{ clearDirty : function(nodeToRecurse){ nodeToRecurse = nodeToRecurse || this; - nodeToRecurse.items.each(function(f){ + nodeToRecurse?.items?.each?.(function(f){ if (!f.getValue) return; if(f.items){