--- rat/client/Attic/code.html 2000/06/08 16:19:50 1.4 +++ rat/client/Attic/code.html 2000/07/31 15:36:22 1.9 @@ -9,7 +9,7 @@ Resource Assembly Tool 1/7,1/8,1/10,1/14,1/15,1/16,1/21,1/22,1/29,1/30,1/31, 2/2,2/3,2/10,2/12,2/13,2/14,2/15,2/17,2/18,2/19,2/20,2/21,2/22, 5/2,5/3,5/4,5/5,5/6,5/8,5/9,5/13,5/18,5/20,5/22,5/24,5/25, -6/7,6/8 +6/7,6/8,6/9,6/10,6/12,6/15,7/4,7/26,7/28,7/31 Gerd Kortemeyer with Scott Harrison --> @@ -21,7 +21,7 @@ var row=new Array(); var maxrow=-1; var col=new Array(); var maxcol=-1; -var lastempty=-2; + var colmap=new Array(); var colmap2=new Array(); var colmap3=new Array(); @@ -47,6 +47,7 @@ var notclear=0; var linkmode=0; var lastinfo=''; var graphdef='no'; +var mode=''; var mainrun=0; var tablemode=0; var mostrecent=0; @@ -55,12 +56,19 @@ var zscale=3; var disrows=0; var discols=0; +var finishdone=0; +var tim=0; +var funny='|'; +var reqaction=''; +var canceltim; + var data1=new Array(1024); var data2=new Array(1024); var data3=new Array(1024); var data4=new Array(1024); var data5=new Array(1024); +var inf; // ------------------------------------------------ Insert a row into the table @@ -482,13 +490,7 @@ function cleanup () { var j,kj,i; disrows=0; discols=0; - - if (lastempty!=obj.length) { - insertrow(maxrow); - insertcol(maxcol); - addobj(maxrow,'e&'+maxcol); - lastempty=obj.length; - } + var emptyspots=0; for (kj=0;kj<=maxcol;kj++) { data1[kj]=0; } for (kj=0;kj<=maxrow;kj++) { @@ -512,6 +514,7 @@ function cleanup () { } if (obj[colmap[j]].substring(0,2)=='b&') { data1[j]=2; + if (colmap[maxcol]==0) { emptyspots++; } rowtype[kj]=2; } } @@ -526,6 +529,16 @@ function cleanup () { if (rowtype[j]==2) { disrows+=3; } if (rowtype[j]==1) { disrows+=1; } } + if (emptyspots==0) { + insertrow(maxrow); + insertcol(maxcol); + addobj(maxrow,'e&'+maxcol); + discols++; + disrows++; + rowtype[maxrow]=2; + coltype[maxcol]=2; + } + } // -------------------------------------------- Delete a condition from a block @@ -853,9 +866,21 @@ function drawcell (rtype,ctype,what,cm,o (''); } else { - parent.mapout.document.write - (''); + if (what=='rs:') { + parent.mapout.document.write + (''); + } else { + if (what=='rf:') { + parent.mapout.document.write + (''); + } else { + parent.mapout.document.write + (''); + } + } } } if (obj1!='') { @@ -887,7 +912,7 @@ function rescolor (ext,typ) { if (ext=='true') { bc='55'; } else { bc='99'; } if (typ=='mandatory') { rc='FF'; } else { rc='BB'; } if (typ=='optional') { gc='BB'; } else { gc='FF'; } - if ((typ=='start') || (typ=='end')) { rc='AA'; gc='AA'; bc='FF'; } + if ((typ=='start') || (typ=='finish')) { rc='AA'; gc='AA'; bc='FF'; } return '#'+rc+gc+bc; } @@ -902,7 +927,7 @@ function condcolor(typ) { // ----------------------------------------------------------------- Draw a row function drawrow (jid) { -var j; var jk; var k; var ck; +var j; var jk; var k; var ck; var rtype; var objd1=new Array(); var objd2=new Array(); var notempty=new Array(); @@ -921,6 +946,7 @@ if (rowtype[jid]!=0) { data3=obj[data2[jk]].split('&'); if (data3[0]=='b') { data1=objcont[data2[jk]].split(':'); + rtype=data1[3]; ck=rescolor(data1[2],data1[3]); left=maxcol; leftin=maxcol; @@ -958,7 +984,15 @@ if (rowtype[jid]!=0) { } for (k=left;k<=right;k++) { notempty[k]=1; colmap5[k]=ck; } middle=Math.round((left+right)/2); - colmap[middle]='r:'; + if (rtype=='start') { + colmap[middle]='rs:'; + } else { + if (rtype=='finish') { + colmap[middle]='rf:'; + } else { + colmap[middle]='r:'; + } + } objd1[middle]+='r&'+data2[jk]; if (rightin>middle) { @@ -1077,13 +1111,13 @@ if (rowtype[jid]!=0) { } if (rowtype[jid]==2) { parent.mapout.document.writeln(''); - parent.mapout.document.writeln(''); + parent.mapout.document.writeln(''); for (k=0;k<=maxcol;k++) { drawcell(1,coltype[rcol[k]],colmap2[k],colmap5[k],objd2[k],jid,k, notempty[k]); } parent.mapout.document.writeln(''); - parent.mapout.document.writeln(''); + parent.mapout.document.writeln(''); for (k=0;k<=maxcol;k++) { drawcell(1,coltype[rcol[k]],colmap3[k],colmap6[k],objd2[k],jid,k, notempty[k]); @@ -1125,7 +1159,7 @@ function draw () { parent.mapout.document.writeln( ''); - for (kr=0;kr<=maxrow;kr++) { + for (kr=0;kr<=maxrow;kr++) { message("Generating Output Row "+kr); drawrow(rrow[kr]); } @@ -1153,8 +1187,7 @@ function draw () { function infoclear() { if (notclear!=1) { - var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300"; - var inf=open("","infout",options); + infcheck(); inf.document.clear(); inf.document.writeln ('
'+ @@ -1189,13 +1222,27 @@ function infoclear() { } } +// ------------------------------------------------------------ Open inf window + +function infopen() { + var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300"; + inf=open("","infout",options); +} + +// -------------------------------------------------------- Do inf status check + +function infcheck() { + if (inf.closed) { + infopen(); + } +} + // --------------------------------------------------- Prints out resource info function info(infostr) { if ((editmode!=1) && (infostr!=lastinfo)) { notclear=1; - var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300"; - var inf=open("","infout",options); + infcheck(); inf.document.clear(); inf.document.writeln( ''+ @@ -1225,7 +1272,15 @@ function info(infostr) { data2=objcont[data1[1]].split(':'); inf.document.write(''); if (data2[2]=='true') { inf.document.write('External '); } - inf.document.write('Resource'); + if (data2[3]=='start') { + inf.document.writeln('Start'); + } else { + if (data2[3]=='finish') { + inf.document.writeln('Finish'); + } else { + inf.document.writeln('Resource'); + } + } if (data2[3]=='mandatory') { inf.document.write(' (Mandatory)'); } @@ -1285,6 +1340,8 @@ function insertreslink(infostr) { var tobj; var nobj; var cobj; + var cid; + var rid; data1=infostr.split('&'); data2=obj[data1[0]].split('&'); lnr=data2[data2.length-2]; @@ -1306,14 +1363,33 @@ function insertreslink(infostr) { joinres(nobj,tobj,0); } +// -------------------------------------------- Insert resource after condition + +function insertcondlink(cid,lnr) { + var fobj; + var tobj; + var nobj; + var cobj; + data3=objlinks[lnr].split(':'); + fobj=data3[0]; + tobj=data3[1]; + cobj=data3[2]; + rid=(obj[fobj].split('&'))[1]; + insertrow(row[rid]); + dellink(lnr); + newresource(maxrow,cid,'','','false','normal'); + nobj=obj.length-1; + joinres(fobj,nobj,cobj); + joinres(nobj,tobj,0); +} + // ---------------------------------------------------- Handles "click to edit" function handler(infostr) { var k; editmode=1; notclear=1; - var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300"; - var inf=open("","infout",options); + infcheck(); inf.document.clear(); inf.document.writeln( ''+ @@ -1366,6 +1442,13 @@ function handler(infostr) { 'Delete Link'); + + inf.document.writeln('
Insert Resource Into Link'); + + } else { if (data1[0]=='r') { if (linkmode!=0) { @@ -1376,18 +1459,28 @@ function handler(infostr) { inf.document.writeln('Linked Resources'); draw(); } else { - inf.document.writeln('Resource'); data2=objcont[data1[1]].split(':'); + if (data2[3]=='start') { + inf.document.writeln('Start'); + } else { + if (data2[3]=='finish') { + inf.document.writeln('Finish'); + } else { + inf.document.writeln('Resource'); + } + } inf.document.write( '
'); + if ((data2[3]!='start') && (data2[3]!='finish')) { + inf.document.write('' +'' - +'' - +''); + } + inf.document.writeln( + '
Title:' +'
URL:' + +data2[0]+'">
URL:' +'
External:
' + +' Mandatory   Optional
Change to above values  ' +' Reset' +'
'); + if ((data2[3]!='start') && (data2[3]!='finish')) { inf.document.writeln( 'Delete Resource (preserving links)'); + } + if (data2[3]!='finish') { inf.document.writeln( '
Link Resource'); + } } } else { linkmode=0; @@ -1457,8 +1560,7 @@ function empty(rid,k) { editmode=1; notclear=1; linkmode=0; - var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300"; - var inf=open("","infout",options); + infcheck(); inf.document.clear(); inf.document.writeln( ''+ @@ -1523,7 +1625,7 @@ function save() { var k; if (graphdef=='yes') { parent.server.document.forms.storage.output.value='graphdef<:>yes'; - for (k=0;k'+obj[k]; } @@ -1593,10 +1695,13 @@ function graphreset() { insertcol(-1); objcont[0]=''; - objcont[1]='Start::false:start:res' - objcont[2]='Finish::false:end:res'; - objlinks[0]=''; - objlinks[1]='1:2:0'; + if (((objcont[1]==undefined)&&(objcont[2]==undefined)) || + ((objcont[1]=='')&&(objcont[2]==''))) { + objcont[1]='Start::false:start:res' + objcont[2]='Finish::false:finish:res'; + objlinks[0]=''; + objlinks[1]='1:2:0'; + } graphdef='no'; @@ -1633,7 +1738,7 @@ function tabledraw() { var cck; var condid; var sortstr=sortobjs(); - insrestab(1,-1,-1); + insrestab(1,-1,-1,''); if (sortstr!='') { objsorted=sortstr.split('&'); for (k=0;k'); data2=obj[i].split('&'); parent.mapout.document.write(''); + if (data1[3]=='start') { + parent.mapout.document.writeln(''); + } + if (data1[3]=='finish') { + parent.mapout.document.writeln(''); + } parent.mapout.document.write( ''); + +data1[0]+'">'); + if ((data1[3]!='start') && (data1[3]!='finish')) { parent.mapout.document.write( '' +'' - +'' - +''); + } + parent.mapout.document.write( + ''); - + } parent.mapout.document.writeln('
Start
Finish
Title:
URL:
External:
Optional
' + +'
' +'Change to above values  ' +' Reset
' -+'Reset
'); + if ((data1[3]!='start') && (data1[3]!='finish')) { + parent.mapout.document.writeln( + '' +'Delete Resource (cutting links)
' +'' -+'Delete Resource (preserving links)
' - +''+ 'Link resource
'); for (j=2;j
'); - insrestab(rrow[data2[1]],i,nr); + insrestab(rrow[data2[1]],i,nr,data1[3]); } } @@ -1760,14 +1883,14 @@ function tabledraw() { // ----------------------------------------------------- Insert Resource Output -function insrestab(irow,be,af) { +function insrestab(irow,be,af,typ) { parent.mapout.document.writeln('
'+ '
' +'Insert resource'); - if (be!=-1) { + if ((be!=-1) && (typ!='finish')) { parent.mapout.document.writeln( '' +'Insert resource linked to from above
'); } - if ((be!=-1) && (af!=-1)) { + if ((be!=-1) && (af!=-1) && (typ!='finish')) { parent.mapout.document.writeln( ''); data2=obj[i].split('&'); parent.mapout.document.write(''); + if (data1[3]=='start') { + parent.mapout.document.writeln(''); + } + if (data1[3]=='finish') { + parent.mapout.document.writeln(''); + } parent.mapout.document.write( ''); parent.mapout.document.write( @@ -1883,7 +2012,7 @@ function simpletabledraw() { // ---------------------------------- Sort objects to straighten graph or table function sortobjs() { - message("Sorting Resources"); + message("Sorting Resources: "+funny); var k; var ij; var dol; @@ -1901,6 +2030,8 @@ function sortobjs() { } if (objsort.length==0) { return ''; } for (k=1;kallcolmax) { allcolmax=thiscolmax; } thiscolmax=1; } kj=rowcont.length-1; - obj[thisnewobj]='b&'+kj+'&'+thiscolmax+':0:0:0'; + obj[thisnewobj]='b&'+kj+'&'+thiscolmax+':0:0:0'; + if (thiscolmax>allcolmax) { allcolmax=thiscolmax; } } for (k=0;k
Start
Finish
Title:'+data1[0]+'