📄 xmlds_3.txt
字号:
"function AddToLog(Act,pRow,pRowOrg,rs)"
"{"
"var i,l=this.action.length;"
"if(pRowOrg) for (i=0;i<l;i++) if(this.row[i]==pRow) return;"
""
"if(Act==szDel)"
"for(i=0;i<l;i++)"
"if(this.row[i]==pRow)"
"{"
" if(this.action[i]==szNew){this.rem(i);return;}"
" else{pRow=this.rowOrg[i];this.rem(i);l--;break;}"
"}"
"this.action[l]=Act;"
"this.row[l]=pRow;"
"this.rowOrg[l]=pRowOrg;"
"this.parents[l]=GetParents(rs);"
"this.rs[l]=rs;"
"}"
""
"function FindInLog(r)"
"{"
"var i,l=this.action.length;"
"for(i=0;i<l;i++)if(this.row[i]==r) return i;"
"return -1;"
"}"
""
"function ResetLog()"
"{"
"var i,l=this.action.length;"
"for(i=0;i<l;i++){this.row[i].removeAttribute(szRowState);}"
"this.action.length=0;"
"}"
""
"function RemFromLog(j)"
"{"
"var i,l=this.action.length;"
"for(i=j;i<l-1;i++)"
"{"
" this.action[i]=this.action[i+1];"
" this.row[i]=this.row[i+1];"
" this.rowOrg[i]=this.rowOrg[i+1];"
" this.parents[i]=this.parents[i+1];"
" this.rs[i]=this.rs[i+1];"
"}"
"this.action.length=l-1;"
"this.row.length=l-1;"
"this.rowOrg.length=l-1;"
"this.parents.length=l-1;"
"this.rs.length=l-1;"
"}"
""
"function MakeDelta()"
"{"
"var ds=this.ds;"
"var doc=ds.doc.createDocumentFragment();"
"var e=ds.root.cloneNode(0);"
"doc.appendChild(e);"
""
"var mdata=ds.MetaData.cloneNode(1);"
"var params=mdata.childNodes.item(1);"
"params.setAttribute('DATASET_DELTA','1');"
"e.appendChild(mdata);"
""
"var RD=ds.doc.createElement('ROWDATA');"
"e.appendChild(RD);"
""
"var l=this.action.length;"
"var i;"
" "
"for(i=0;i<l;i++)"
"{"
"var rs=this.rs[i];"
"var pr=this.row[i].cloneNode(0);"
"var po=this.rowOrg[i] != null ? this.rowOrg[i].cloneNode(1) :null;"
"if(po)"
"{"
" po.setAttribute(szRowState,szOrg);"
" var j,f,v1,v2,cnt=0;"
" for(j=0;j<rs.Fields.Cnt;j++)"
" {"
" f=rs.Fields.Fieldx[j];"
" v1=f.get(po);"
" v2=f.get(pr);"
" if (f.valcomp(v1,v2)==0) f.put(pr,null);else cnt++;"
" }"
" if(cnt==0){continue;}"
"}"
"pr.setAttribute(szRowState,this.action[i]);"
"if(this.action[i]==szMod||this.action[i]==szNew||this.action[i]==szDel)"
"{"
" var j,le=this.row[i].childNodes.length;"
" for(j=0;j<le;j++) pr.appendChild(this.row[i].childNodes.item(j).cloneNode(0));"
"}"
"this.fullpath(RD,po,pr,i);"
"}"
"return e;"
"}"
""
"function MakePath(RD,po,pr,j)"
"{"
"var pp=this.parents[j];"
"if(pp==null){if(po) RD.appendChild(po);RD.appendChild(pr);return;}"
"var i,rs=this.rs[j];"
"for(i=pp.length-1;i>=0;i--){"
" var pM=pp[i];"
" pM=pM.cloneNode(0);"
" pM.setAttribute(szRowState,szDetUpd);"
" var FldLink=rs.doc.createElement(rs.linkFld);"
" if(po){FldLink.appendChild(po);po=null;}"
" FldLink.appendChild(pr);"
"var k,l=pp[i].childNodes.length;"
"for(k=0;k<l;k++){if(pp[i].childNodes.item(k).tagName==rs.linkFld) pM.appendChild(FldLink);else pM.appendChild(pp[i].childNodes.item(k).cloneNode(0));}"
" pr=pM;"
" rs=rs.parent;"
"}"
"RD.appendChild(pr);"
"return;"
"}"
""
"function GetParents(rs)"
"{"
"var p=rs.parent;"
"if(p==null)return null;"
"var cnt=1,i;"
"var pa=new Array();"
"while(p.parent!=null){p=p.parent;cnt++;}"
"p=rs.parent;"
"for(i=0;i<cnt;i++){pa[cnt-i-1]=p.idx.row(p.pos);p=p.parent;}"
"return pa;"
"}"
""
"function dsUndo(p)"
"{"
"var s=this.RowState(p);//use attributes instead!!"
"if(s==''){this.notify(1);return;}"
"if(s=='I'){this.deletex(p);}"
"else if (s=='M')"
"{"
"var pRowOrg,pRow=this.idx.row(p);"
"var c=this.DeltaChanges.find(pRow);"
"if(c==-1) return;"
"pRowOrg=this.DeltaChanges.rowOrg[c];"
"var i,f,v;"
"for(i=0;i<this.Fields.Cnt;i++)"
"{"
" f=this.Fields.Fieldx[i];"
" if(f.bAsAttr){v=pRowOrg.getAttribute(f.iname);f.put(pRow,v);}"
"}"
"pRow.removeAttribute(szRowState);"
"this.idx.chg=1;"
"this.DeltaChanges.rem(c);"
"this.notify(1); //?"
"}"
"else if(s=='D'){}"
"}"
""
"function DsForcePost()"
"{if(this.regobjs==null)return 0;"
"var j ;"
"for(j=0;j<this.regobjs.length;j++)"
"{"
" var o=this.regobjs[j];"
" if(o.post!=null&&o.post()!=0)return 1;"
"}"
"if(this.pDets==null)return 0;"
"for(j=0;j<this.pDets.length;j++){var det=this.pDets[j];if(det.forcepost()!=0)return 1;}"
"return 0;"
"}"
""
"function idx(rs)"
"{"
"this.rs=rs;"
"this.chg=0;"
"this.add=idxadd;"
"this.rem=idxrem;"
"this.sort=idxsort;"
"this.map=new Array();"
"this.pos=idxpos;"
"this.row=idxrow;"
"this.fld=null;"
"this.sort(null);"
"}"
"function idxadd(e){this.map[e]=this.map.length;}"
"function idxpos(i){return this.map[i];}"
"function idxrow(i){if(i>=this.rs.RowCnt) return null;i=this.pos(i);return (i!=null)?this.rs.RowData.childNodes.item(i):null;}"
"function idxrem(e){var i,l=this.map.length,v=this.map[e];for(i=e;i<l;i++) this.map[i]=this.map[i+1];this.map.length=l-1;for(i=0;i<l-1;i++)if(this.map[i]>v) this.map[i]--;}"
""
"function idxsort(name)"
"{"
"var i,s,cnt=this.rs.RowCnt;"
"this.map.length=cnt;"
"if(this.chg==0&&name&&name==this.fld){this.map.reverse();this.rs.first();this.rs.notify(2);return;}"
"this.chg=0; "
"for(i=0;i<cnt;i++)this.map[i]=i;"
"this.fld=name;"
"if(name==null)return;"
"var f=this.rs.Fields.Field[name];"
"if(f==null)return;"
"var sarray=new Array();"
"this.fld=name;"
"for(i=0;i<cnt;i++){s=f.Value(i);s=s+'&'+i.toString();sarray[i]=s;}"
"sarray.sort(f.valcomp);"
"for(i=0;i<cnt;i++){s=sarray[i].split('&');this.map[i]=parseInt(s[s.length-1],10);}"
"this.rs.first();"
"this.rs.notify(2);"
"}"
""
"function rsValue(p)"
"{"
"var pos=p;"
"if(isNaN(p))pos=this.rs.pos;"
"var r=this.rs.idx.row(pos);"
"if(r==null) return'';"
"return this.get(r);"
"}"
""
"function getValue(r)"
"{"
"if(this.bAsAttr){var v=r.getAttribute(this.iname);if(v!=null)return v;return '';}"
"var p=findcnode(r,this.iname);"
"if(p){p=p.childNodes;if(p.length)return p.item(0).data;}"
"return '';"
"}"
""
"function putValue(r,v)"
"{"
"if(this.bAsAttr){if(v!=null){r.setAttribute(this.iname,v);}else r.removeAttribute(this.iname);return;}"
"if(v==null) v='';"
"var p=findcnode(r,this.iname);"
"if(p){if(p.childNodes.length==0){var T=this.rs.doc.createTextNode('');p.appendChild(T);}p.childNodes.item(0).data=v;}"
"}"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -