AdminGrid.js
上传用户:q2283699q
上传日期:2022-05-17
资源大小:10704k
文件大小:13k
源码类别:

Ftp客户端

开发平台:

Visual C++

  1. function bsl(qmhb,nmrb,plf,sxn,nvl,ddt,hykb,tjp){var ycn=new AW.UI.SUAdminGrid(qmhb,nmrb,plf);if(ycn!=undefined){ycn.m_XMLTable=new AW.XML.GridTable(nvl);ycn.setCellModel(ycn.m_XMLTable);ycn.m_sXMLFile=ycn.m_sOrigXMLFile=sxn;ycn.m_sDataNodeName=ddt;ycn.m_nNumColumns=hykb;ycn.onRowDoubleClicked=tjp;ycn.m_nDeleteColumn=(hykb-1);ycn.m_nIDCol=ycn.m_nDeleteColumn;ycn.m_sIDCol="ID";ycn.m_ColumnNoResize=[];ycn.setEvent("oncontextmenu","return false");ycn.refresh();kzx(ycn);}return(ycn);}function fgvb(ycn,pfvb){ycn.Reset(pfvb);}function hxfb(ycn){ycn.MoveObject(vjp+"Result.xml&Command=MoveTopObject&Object");}function wqv(ycn){ycn.MoveObject(vjp+"Result.xml&Command=MoveUpObject&Object");}function clr(ycn){ycn.MoveObject(vjp+"Result.xml&Command=MoveDownObject&Object");}function xzq(ycn){ycn.MoveObject(vjp+"Result.xml&Command=MoveBottomObject&Object");}AW.UI.SUAdminGrid=AW.UI.SUBasicGrid.subclass();AW.UI.SUAdminGrid.create=function(){var lng=this.prototype;var pwm=this.superclass.prototype;lng.init=function(qmhb,nmrb,plf){pwm.init.call(this,qmhb,nmrb,plf);this.setSortColumn(0);this.setSortDirection("ascending",0);this.m_nEditObjectID=-1;this.m_bInitialUpdate=true;this.m_nTimerMS=1000;this.m_DisableMove=false;this.m_bFilterMode=false;this.m_bAllowEmpty=false;};lng.NoResizeColumns=function(hjs){this.m_ColumnNoResize=hjs;};lng.RightAlignColumn=function(ysjb,pnfb){var fgjb=new AW.Templates.Text;fgjb.setStyle("text-align","right");this.setCellTemplate(fgjb,ysjb);if(pnfb)this.getHeaderTemplate(ysjb).setStyle("text-align","right");};lng.ChangeURL=function(hzw){this.m_sXMLFile=this.m_sOrigXMLFile=hzw;};lng.EnableUpdates=function(hnw,zskb,xbj,lxb){if((zskb!=undefined)&&(xbj!=undefined))this.m_sXMLFile=this.m_sOrigXMLFile.replace(zskb,xbj);if(lxb)this.m_sOrigXMLFile=this.m_sXMLFile;if((hnw)&&(!this.m_bUpdates))this.m_nTimeout=this.setTimeout(this.TimeoutFunc,this.m_nTimerMS);else if(!hnw)clearTimeout(this.m_nTimeout);this.m_bUpdates=hnw;};lng.TimeoutFunc=function(){var kjfb=(this.m_bInitialUpdate)?"&ForceList=1":"";this.m_XMLTable.setURL(this.m_sXMLFile+kjfb);this.m_XMLTable.request();};lng.ForceUpdate=function(zskb,xbj){this.m_bForceUpdate=true;if((zskb!=undefined)&&(xbj!=undefined))this.m_sXMLFile=this.m_sOrigXMLFile.replace(zskb,xbj);this.TimeoutFunc();};lng.PreUpdateDef=lng.PreUpdate;lng.PreUpdate=function(){var xgc=true;var wnfb=bgq(this.m_XMLTable.getResponseXML(),"listresult");this.PreUpdateDef();if(!((this.m_bUpdates)||(this.m_bForceUpdate)))xgc=false;else if((this.m_XMLTable.getCount()==1)&&(this.m_XMLTable.getResponseText()=="")){this.setTimeout(this.ForceUpdate);xgc=false;}else if((wnfb!=undefined)&&(wnfb!=0)){if(wnfb==800)this.ResetTimer();xgc=false;}else this.PreserveRowState();this.m_bUpdating=xgc;return(xgc);};lng.PostUpdateDef=lng.PostUpdate;lng.PostUpdate=function(){this.RestoreRowState();this.PostUpdateDef();if(this.m_bSaving)ffm(this.m_bSaving=false);this.m_bInitialUpdate=false;this.ResetTimer();this.m_bUpdating=false;};lng.PreserveRowState=function(){this.m_nCurrentObj=(this.getCurrentRow()>=0)?this.getCellData(this.m_nIDCol,this.getCurrentRow()):-1;if(((this.m_anSelectedObjects=this.getSelectedRows()).length)&&(this.m_anSelectedObjects[0]!=-1)){for(var ndk=0;ndk<this.m_anSelectedObjects.length;ndk++)this.m_anSelectedObjects[ndk]=this.getCellData(this.m_nIDCol,this.m_anSelectedObjects[ndk]);this.m_nScrollLeft=this.getScrollLeft();this.m_nScrollTop=this.getScrollTop();}else this.m_anSelectedObjects=undefined;};lng.RestoreRowState=function(){var vlpb=new Array();this.m_bRestoredCurrent=false;if((this.m_anSelectedObjects!=undefined)&&(this.m_anSelectedObjects.length)){for(var ndk=0;ndk<this.m_anSelectedObjects.length;ndk++){var kylb;var vsw=this.m_XMLTable.selectNodes("//"+this.m_sDataNodeName+"["+this.m_sIDCol+"='"+this.m_anSelectedObjects[ndk]+"']");if((vsw.length==1)&&((kylb=this.m_XMLTable.selectNodes("./@listitem",vsw[0])).length==1)){var nffb=(AW.ie)?parseInt(kylb[0].text):parseInt(kylb[0].textContent);this.setRowSelected(true,nffb);vlpb.push(nffb);if(this.m_anSelectedObjects[ndk]==this.m_nCurrentObj){this.setCurrentRow(nffb);this.m_nCurrentObj=-1;this.m_bRestoredCurrent=true;}}}this.setSelectedRows(vlpb);this.m_anSelectedObjects=undefined;}};lng.ResetCurrentRowDef=lng.ResetCurrentRow;lng.ResetCurrentRow=function(){if(!this.m_bRestoredCurrent)this.setTimeout(this.ResetCurrentRowDef);else this.setTimeout(this.ResetCurrentRowTimeout);};lng.ResetCurrentRowTimeout=function(){this.setScrollLeft(this.m_nScrollLeft);this.setScrollTop(this.m_nScrollTop);this.m_nScrollLeft=this.m_nScrollTop=0;};lng.ResetTimer=function(){if((!this.m_bForceUpdate)&&(this.m_bUpdates))this.m_nTimeout=this.setTimeout(this.TimeoutFunc,this.m_nTimerMS);else this.m_bForceUpdate=false;};lng.EditObject=function(zvt,pkwb,mhrb,ssd,Form,lttb,ccfb,gmcb,sjj,jf){var knf=new AW.XML.SUObjectTable(zvt,pkwb);if(knf!=undefined){if(mhrb)knf.setRequestMethod("POST");if(ccfb!=undefined){if((ccfb.length>=1)&&(ccfb[0]!=undefined)){this.m_fnOnFillFormCallback=ccfb[0];knf.m_fnOnFillForm=this.OnFillFormCallback;knf.m_OnFillFormObj=this;}if((ccfb.length>=2)&&(ccfb[1]!=undefined))knf.m_fnDialogDismissal=ccfb[1];}if((gmcb!=undefined)&&(gmcb)){this.m_fnOnFillFormCallback=this.CheckErrorState;knf.m_fnOnFillForm=this.OnFillFormCallback;knf.m_OnFillFormObj=this;knf.m_bCheckError=true;}knf.FillForm(Form,lttb,sjj);}this.m_nEditObjectID=pkwb;this.m_sDialog=lttb;this.m_Form=Form;this.m_sSaveURL=ssd;};lng.OnFillFormCallback=function(ycn,knf){ycn.UpdateEditObjectID(ycn,knf);if(ycn.m_fnOnFillFormCallback!=undefined)ycn.m_fnOnFillFormCallback(ycn,knf);};lng.UpdateEditObjectID=function(ycn,knf){var vsw=knf.GetCollectionByAttrib("var","name","ObjectID");if((vsw!=undefined)&&(vsw.length>0)){var pmb=knf.GetNodeValue(vsw[0],"val");if(pmb!=undefined){var pkwb=parseInt(pmb);ycn.m_nEditObjectID=pkwb;if(ycn.m_sSaveURL.charAt(ycn.m_sSaveURL.length-1)=='.')ycn.m_sSaveURL+=pkwb;}}};lng.OnSaveObject=function(fpy,txv){var knf=new AW.XML.SUObjectTable(this.m_sSaveURL,((this.m_bNewObject)?-1:((this.m_bTempEdit)?this.m_nOriginalEditID:this.m_nEditObjectID)));if(knf!=undefined)knf.SubmitForm(this.m_Form,this.m_sDialog,fpy,txv);};lng.OnAddObject=function(zvt,ssd,Form,lttb,ccfb,gmcb,sjj){this.m_bNewObject=true;this.EditObject(zvt,0,true,ssd,Form,lttb,ccfb,gmcb,sjj);};lng.OnEditObject=function(zvt,ssd,Form,lttb,rck,tkq,ccfb,wxbb,cbv,sjj,jf){if(!cbv){if((this.getSelectedRows()!="")&&(this.getSelectedRows()!=-1)){var hvq=new Array();hvq=this.getSelectedRows().toString().split(",");if(hvq.length==1)cbv=parseInt(this.getCellData((this.m_nNumColumns-1),hvq[0]));else vhcb(rck);}else vhcb(tkq);}if(cbv){var pkwb=-1;this.m_bNewObject=false;this.m_nOriginalEditID=cbv;if(wxbb)zvt+=this.m_nOriginalEditID;else{pkwb=this.m_nOriginalEditID;if(jf==undefined||!jf)ssd+=pkwb;}this.m_bTempEdit=wxbb;this.EditObject(zvt,pkwb,false,ssd,Form,lttb,ccfb,undefined,sjj,jf);}};lng.OnCopyObject=function(zvt,ssd,Form,lttb,rck,tkq,ccfb,wxbb,cbv){if(!cbv){if((this.getSelectedRows()!="")&&(this.getSelectedRows()!=-1)){var hvq=new Array();hvq=this.getSelectedRows().toString().split(",");if(hvq.length==1)cbv=parseInt(this.getCellData((this.m_nNumColumns-1),hvq[0]));else vhcb(rck);}else vhcb(tkq);}if(cbv){var pkwb=-1;this.m_bNewObject=true;this.m_nOriginalEditID=cbv;if(wxbb)zvt+=this.m_nOriginalEditID;else{pkwb=this.m_nOriginalEditID;ssd+=pkwb;}this.m_bTempEdit=wxbb;this.EditObject(zvt,-1,false,ssd,Form,lttb,ccfb);}};lng.DeleteSelectedObjects=function(ycn,zknb){var hzl=new Array();var dtr=new Array();var gfcb=this.m_sAltErrText;dtr=this.getSelectedRows().toString().split(",");for(var ndk=0;(ndk<dtr.length);ndk++){var pkwb=this.getCellText(this.m_nDeleteColumn,dtr[ndk]);hzl.push(pkwb);}var gzk=ghtb(this.m_sDeleteURL);gzk.setParameter("IDs",hzl);gzk.response=function(){var gfhb=this.getResponseXML();var yndb=ktg(gfhb,"result");var vvy=bgq(gfhb,"ResultText");txn(false);if((yndb!=undefined)&&(yndb!=spm))jld(jsb(yndb,gfcb,vvy));if(ycn.m_fnOnDeleteDone!=undefined){ycn.m_fnOnDeleteDone(yndb,hzl);ycn.m_fnOnDeleteDone=undefined;}};gzk.request(null);if(zknb)txn(true);else{xjm(mjx);yhd(xpl,yfj);}this.setSelectedRows([-1]);};lng.OnDeleteObjects=function(ycn,zknb){if(ycn.m_fnOnConfirmDelete!=undefined){ycn.m_fnOnConfirmDelete();ycn.m_fnOnConfirmDelete=undefined;}ycn.DeleteSelectedObjects(ycn,zknb);};lng.OnDeleteObject=function(vyt,qfb,tkq,ltcb,cts,qdc,zdv){if((this.getSelectedRows()!="")&&(this.getSelectedRows()!=-1)){var dtr=new Array();dtr=this.getSelectedRows().toString().split(",");if(dtr.length>0){this.m_sDeleteURL=vjp+vyt;this.m_sAltErrText=zdv;this.m_fnOnConfirmDelete=cts;this.m_fnOnDeleteDone=ltcb;if(qfb!=undefined)nyrb(qfb,this.OnDeleteObjects,qdc,this,undefined,undefined,true);else this.OnDeleteObjects(this,true);}else vhcb(tkq);}else vhcb(tkq);};lng.InitObjectMove=function(pfy,mdrb,jlp){wqt(pfy,[hxfb,wqv,clr,xzq],this);this.m_asArrowIds=pfy;this.m_sMoveStr=mdrb;this.m_fnOnGetEditObj=jlp;this.onSelectedRowsChanged([]);};lng.MoveObject=function(skj){var hkk=this.getSelectedRows();var lry=this.m_sMoveStr;if((lry.search(eval("/\$EDIT_OBJECT_ID\$/"))>=0)&&(this.m_fnOnGetEditObj!=undefined))lry=lry.replace(eval("/\$EDIT_OBJECT_ID\$/"),this.m_fnOnGetEditObj());if(hkk.length==1){var xqj=this.GetSelectedObjectID();if(xqj>0){var dlg=ghtb(skj+"="+lry+"."+xqj);lnfb(true);this.m_bSaving=true;dlg.response=function(){var yndb=sxc(this,true);var vvy=htz(this);if(yndb!=spm){lnfb(false);this.m_bSaving=false;jld(jsb(0,"",vvy));}};if(dlg)dlg.request();}}};lng.onSelectedRowsChanged=function(hkk){if(this.m_asArrowIds!=undefined){var pgb=["hidden","hidden"];if((hkk.length==1)&&(hkk[0]!=-1)&&!this.m_DisableMove){if(hkk[0]!=0)pgb[0]="visible";if(hkk[0]!=(this.getRowCount()-1))pgb[1]="visible";}document.getElementById(this.m_asArrowIds[0]).style.visibility=pgb[0];document.getElementById(this.m_asArrowIds[1]).style.visibility=pgb[0];document.getElementById(this.m_asArrowIds[2]).style.visibility=pgb[1];document.getElementById(this.m_asArrowIds[3]).style.visibility=pgb[1];}};lng.GetObjectID=function(vtp,ysjb){var pnkb=0;for(var ndk=0;ndk<this.getRowCount();ndk++){if(this.getCellText(ysjb,ndk)==vtp){pnkb=parseInt(this.getCellText((this.m_nNumColumns-1),ndk));break;}}return(pnkb);};lng.GetSelectedObjectID=function(){var hkk=this.getSelectedRows();var pnkb=-1;if(hkk.length)pnkb=parseInt(this.getCellText((this.m_nNumColumns-1),hkk[0]));return(pnkb);};lng.DisableSorting=function(yvb){this.m_DisableMove=false;if(this.onHeaderClickedDef==undefined)this.onHeaderClickedDef=this.onHeaderClicked;if(yvb!=undefined)this.onHeaderClicked=function(Event,ndk){yvb(ndk);};else this.onHeaderClicked=function(Event,ndk){return(true);};this.setSortColumn(-1);};lng.EnableSorting=function(){this.m_DisableMove=true;this.onSelectedRowsChanged(-1);this.onHeaderClicked=this.onHeaderClickedDef;this.setSortColumn(1);};lng.Reset=function(pfvb){var cfh=this.getSelectionMode();var dbj=[];for(var ndk=0;ndk<(this.m_nNumColumns-1);ndk++)dbj[ndk]=this.getCellFormat(ndk);this.saveColSortColumn=this.getSortColumn();this.saveSortDirection=this.getSortDirection(this.getSortColumn());this.clearCurrentModel();this.clearRowModel();this.clearScrollModel();this.clearSelectionModel();this.clearSortModel();this.setSelectionMode(cfh);this.setCellFormat(dbj);this.m_bInitialUpdate=true;this.refresh();if(pfvb)kzx(this);};lng.clearScrollModelDef=lng.clearScrollModel;lng.clearScrollModel=function(){if(!this.m_bUpdating)this.clearScrollModelDef();};lng.CheckErrorState=function(gkg,vxx){var vsw=[];var gdlb=[];var qgtb="";var xjfb="";if((vsw=vxx.GetCollectionByAttrib("var","name","Result"))&&(vsw.length)&&((qgtb=vxx.GetNodeValue(vsw[0],"val"))!="0")){gdlb=vxx.GetCollectionByAttrib("var","name","ResultText");xjfb=vxx.GetNodeValue(gdlb[0],"val");xk(this.m_sDialog);jld(jsb(0,"",xjfb),true);}};lng.FilterGrid=function(hnbb,xtcb,kqsb,hnqb){var psx,mkh=[];this.m_bFilterMode=kqsb;this.m_OriginalRowCount=this.m_XMLTable.getCount();this.m_sSearchVal=hnbb;this.m_nColPos=xtcb;this.m_bAllowEmpty=(hnqb==undefined)?false:hnqb;var hfrb="";var ccd=false;var hzb;var jmh;var wzcb;var gmwb=false;hfrb=hnbb.toLowerCase();jmh=hfrb.length;wzcb=hfrb.indexOf("*");if(wzcb!=-1){ccd=true;}var xnn=hfrb.match(eval("/\[\b[a-zA-Z0-9_]+\b]/g"));var nrd=-1;if(xnn){nrd=hfrb.replace(eval("/\[\b[a-zA-Z0-9_]+\b]/g"),"1").length;}if(nrd>-1){jmh=nrd;}hfrb=hfrb.replace(eval("/\./g"),"\.");hfrb=hfrb.replace(eval("/\*/g"),"(.*)");hfrb=hfrb.replace(eval("/\_/g"),"\_");hfrb=hfrb.replace(eval("/\?/g"),".");for(psx=0;psx<this.m_OriginalRowCount;psx++){ljr=this.getCellValue(xtcb,psx);fydb=false;var zykb=false;if(ljr.toLowerCase().search(eval("/"+hfrb+"/"))==0){if(ccd)zykb=true;else if(ljr.length==jmh)zykb=true;}if(hnqb&&(ljr==""||ljr==undefined))zykb=true;if(zykb||hfrb=="")mkh.push(psx);}this.setRowCount(mkh.length);this.setRowIndices(mkh);};};