--- rat/client/Attic/code.html 2000/02/22 21:14:59 1.1 +++ rat/client/Attic/code.html 2000/05/25 12:14:01 1.3 @@ -6,10 +6,10 @@ Resource Assembly Tool 7/23,7/24,7/26, 8/11,8/14,8/18,8/19,8/20,8/21,8/22,8/25,8/26,8/28,8/30,8/31, 9/1,9/2,9/4,9/5,9/6, -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 Gerd Kortemeyer with Scott Harrison +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 +Gerd Kortemeyer with Scott Harrison --> @@ -20,6 +20,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(); @@ -37,12 +38,20 @@ var rrow=new Array(); var cw=new Array(); var rh=new Array(); +var undostack=new Array(); +var undopointer=0; +var stored=0; var editmode=0; var notclear=0; var linkmode=0; var lastinfo=''; var graphdef='no'; var mainrun=0; +var tablemode=0; +var mostrecent=0; + +var disrows=0; +var discols=0; var data1=new Array(1024); var data2=new Array(1024); @@ -55,6 +64,7 @@ var data5=new Array(1024); function insertrow(j,ex1,ex2) { var kj; + stored=0; objects1=''; objects2=''; for (kj=0;kj<=maxrow;kj++) { @@ -158,6 +168,7 @@ function insertrow(j,ex1,ex2) { function newcondition(content,type) { var ko; + stored=0; ko=obj.length; obj[ko]='c'; objcont[ko]=content+':'+type+':cond'; @@ -166,8 +177,10 @@ function newcondition(content,type) { // ---------------------------------------------- Creates a new resource object -function newresource(rid,cid,text,url) { - objcont[addobj(rid,'b&'+rid+'&'+cid+':0:0:0')]=text+':'+url+':res'; +function newresource(rid,cid,text,url,ext,type) { + stored=0; + objcont[addobj(rid,'b&'+rid+'&'+cid+':0:0:0')]= + text+':'+url+':'+ext+':'+type+':res'; } @@ -175,6 +188,7 @@ function newresource(rid,cid,text,url) { function insertcond(obj1,portnr,cond) { var k; + stored=0; data1=obj[obj1].split('&'); for (k=2;kj ) { col[kj]++; } } @@ -320,6 +335,7 @@ function insertport (obj1,d,inout,linkob var k; var port; var revport; + stored=0; data1=obj[obj1].split('&'); middle=maprow(data1[1],obj1,0); if (inout==1) { @@ -395,6 +411,7 @@ function insertport (obj1,d,inout,linkob // returns object number of generated object function addobj(kjid,objs) { + stored=0; if (rowcont[kjid]!='') { rowcont[kjid]+=':'; } rowcont[kjid]+=obj.length; obj[obj.length]=objs; @@ -443,6 +460,7 @@ function horizontal(hrid,hoffs,hfcol,htc function delobj(obj1) { var k; + stored=0; for (k=0;k'); @@ -833,7 +870,7 @@ function drawcell (rtype,ctype,what,cm,o // ----------------------------------------------------------------- Draw a row -function drawrow (jid,mode2) { +function drawrow (jid) { var j; var jk; var k; var rc; var gc; var bc; var ck; var objd1=new Array(); var objd2=new Array(); @@ -842,18 +879,20 @@ var condtype; if (rowtype[jid]!=0) { for (j=0;j<=maxcol;j++) { colmap[j]=''; colmap2[j]=''; colmap3[j]=''; colmap4[j]=''; - colmap5[j]='#FFFFFF'; colmap6[j]='#FFFFFF'; + colmap5[j]='#CCCCCC'; colmap6[j]='#CCCCCC'; objd1[j]=''; objd2[j]=''; notempty[j]=0; } + parent.mapout.document.writeln(''); if (rowcont[jid]!='') { data2=rowcont[jid].split(':'); for (jk=0;jk'); + 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],mode2,jid,k, - 1); + 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],mode2,jid,k, - 1); + drawcell(1,coltype[rcol[k]],colmap3[k],colmap6[k],objd2[k],jid,k, + notempty[k]); } } } @@ -1024,48 +1065,46 @@ if (rowtype[jid]!=0) { } } +// -------------------------------------------------------------- Print message + +function message(txt) { + parent.window.status=txt; +} + // ------------------------------------------------------------- Draw the table -function draw (mode,mode2) { +function draw () { var k; var kr; - cleanup(); + save(); - - if (mode=='debug') { - var options="scrollbars=1,resizable=1,menubar=0,width=500,height=300"; - deb=open("","debout",options); - deb.document.clear(); - deb.document.writeln(''); - -for (k=0;k'); } - deb.document.writeln('
Cols: '+col+'
Rows: '+row+'
'); - deb.document.writeln(objcont+'
'+objlinks+'
'); - for (kr=0;kr<=maxrow;kr++) { - kid=findrow(kr); - maprow(kid,-1,0); - deb.document.writeln(kid+' : '+colmap+' '+rowcont[kid]+"
"); - } - deb.document.writeln('
Rowtype: '+rowtype+'
Coltype: '+coltype); - deb.document.writeln('
maxcol: '+maxcol+'
maxrow: '+maxrow); - deb.document.writeln(''); - deb.document.close(); - } - for (k=0;k<=maxrow;k++) { rrow[row[k]]=k; } - for (k=0;k<=maxcol;k++) { rcol[col[k]]=k; } rh[0]=0; rh[1]=30; rh[2]=60; cw[0]=0; cw[1]=30; cw[2]=60; + parent.mapout.document.clear(); parent.mapout.document.open('text/html','replace'); parent.mapout.document.writeln(''); - parent.mapout.document.writeln( - ''); - - for (kr=0;kr<=maxrow;kr++) { drawrow(rrow[kr],mode2); } + + if (tablemode==0) { + if (graphdef=='no') { graphopt(); cleanup(); } + for (k=0;k<=maxrow;k++) { rrow[row[k]]=k; } + for (k=0;k<=maxcol;k++) { rcol[col[k]]=k; } + parent.mapout.document.writeln( + '
'); + for (kr=0;kr<=maxrow;kr++) { + message("Generating Output Row "+kr); + drawrow(rrow[kr]); + } + } else { + message("Generating Table Output"); + parent.mapout.document.writeln( '
'); + tabledraw(); + } parent.mapout.document.writeln('
'); parent.mapout.document.writeln(''); @@ -1089,6 +1128,10 @@ function infoclear() { 'Link Mode
Click on a resource to link it with
'+ (objcont[linkmode].split(':'))[0]+ '
click anywhere else to cancel.'); + } else { + inf.document.writeln( +'Click to Edit
Click to insert resources, columns and rows' + ); } inf.document.writeln(''); inf.document.close(); @@ -1132,9 +1175,17 @@ function info(infostr) { '
to '+objcont[data3[1]].split(':')[0]+''); } else { if (data1[0]=='r') { - inf.document.writeln('Resource
'); data2=objcont[data1[1]].split(':'); - inf.document.writeln(''+data2[0]+'
'); + inf.document.write(''); + if (data2[2]=='true') { inf.document.write('External '); } + inf.document.write('Resource'); + if (data2[3]=='mandatory') { + inf.document.write(' (Mandatory)'); + } + if (data2[3]=='optional') { + inf.document.write(' (Optional)'); + } + inf.document.writeln('
'+data2[0]+'
'); inf.document.writeln((data2[1].split('/')).join(' / ')); } else { inf.document.writeln('Link
'); @@ -1179,6 +1230,35 @@ function escape(instring) { return outstring; } +// -------------------------------------------------- Insert resource into link + +function insertreslink(infostr) { + var lnr; + var fobj; + var tobj; + var nobj; + var cobj; + data1=infostr.split('&'); + data2=obj[data1[0]].split('&'); + lnr=data2[data2.length-2]; + data3=objlinks[lnr].split(':'); + fobj=data3[0]; + tobj=data3[1]; + cobj=data3[2]; + if (data2[0]=='v') { + rid=data1[1]; + cid=data2[1]; + } else { + rid=data2[1]; + cid=(data2[2].split(':'))[0]; + } + dellink(lnr); + newresource(rid,cid,'','','false','normal'); + nobj=obj.length-1; + joinres(fobj,nobj,cobj); + joinres(nobj,tobj,0); +} + // ---------------------------------------------------- Handles "click to edit" function handler(infostr) { @@ -1201,7 +1281,7 @@ function handler(infostr) { data2=objcont[data1[4]].split(':'); } inf.document.writeln( - '

Change to above values  ' - +' Reset' - +'
'); + +');">Change to above values  ' + +' Reset
' + +''); inf.document.writeln( 'Delete Condition'); - } else { + +');">Delete Condition
'); + inf.document.writeln( + 'Delete Link'); +} else { if (data1[0]=='r') { if (linkmode!=0) { joinres(linkmode,data1[1],0); @@ -1244,35 +1327,49 @@ function handler(infostr) { notclear=0; linkmode=0; inf.document.writeln('Linked Resources'); - draw('debug','edit'); + draw(); } else { inf.document.writeln('Resource'); data2=objcont[data1[1]].split(':'); inf.document.write( '
' + +'' +'' + inf.document.write('>' + +'' +'
Title:' - +'
URL:' - +'
External:
Regular   Mandatory   Optional
' - +'Change to above values  ' + +'+self.document.forms.resinfo.elements.e.checked+'+"':'" + +'+self.document.forms.resinfo.elements.h.value+'+"':res'" + +';opener.infoclear();opener.editmode=0;opener.draw();">' + +'Change to above values  ' +' Reset' - +'
'); + +''); inf.document.writeln( 'Delete Resource (cutting links)'); + +');">Delete Resource (cutting links)'); inf.document.writeln( '
Delete Resource (preserving links)'); + +');">Delete Resource (preserving links)'); inf.document.writeln( '
Delete Link'); + +');">Delete Link'); + inf.document.writeln('
Insert Resource Into Link'); } } inf.document.writeln( '
Done'); - inf.document.writeln(''); + inf.document.writeln(''); inf.document.close(); inf.focus(); } @@ -1318,27 +1419,47 @@ function empty(rid,k) { 'Empty Field
'); inf.document.writeln('
Insert resource'); + + if ((mostrecent!=0) && (objcont[mostrecent]!='')) { + + inf.document.writeln('
Insert Resource'); + +');">Insert resource linked to from most recent one'); + + inf.document.writeln('
Insert resource linking to most recent one'); + } + + inf.document.writeln('
Insert column:'); inf.document.writeln('left'); + +');">left'); inf.document.writeln('right '); + +');">right '); inf.document.writeln('
Insert row:'); inf.document.writeln('below'); + +');">below'); inf.document.writeln('above '); + +');">above '); inf.document.writeln( @@ -1352,43 +1473,52 @@ function empty(rid,k) { // ---------------------------------------------------- Save into hidden fields function save() { - var k; - self.document.forms.storage.output.value='graphdef<:>yes'; + var k; + if (graphdef=='yes') { + parent.server.document.forms.storage.output.value='graphdef<:>yes'; for (k=0;k'+obj[k]; } for (k=0;k'+row[k]; } for (k=0;k'+col[k]; } for (k=0;k'+rowcont[k]; } } - self.document.forms.storage.output.value+= + parent.server.document.forms.storage.output.value+= '<&>maxcol<:>'+maxcol; - self.document.forms.storage.output.value+= + parent.server.document.forms.storage.output.value+= '<&>maxrow<:>'+maxrow; - + } else { + parent.server.document.forms.storage.output.value='graphdef<:>no'; + } + parent.server.document.forms.storage.output.value+= + '<&>tablemode<:>'+tablemode; + for (k=0;k'+objcont[k]; } } for (k=0;k'+objlinks[k]; } } + undopointer++; + undostack[undopointer]= + parent.server.document.forms.storage.output.value; } // ----------------------------------------------- Reset all layout information @@ -1431,20 +1561,114 @@ function rescompare(a,b) { if (data2[k]==data1[0]) { rvalue++; } } if (rvalue==0) { rvalue=data2.length-data1.length; } - return rvalue; } -// ------------------------------------------- Sort objects to straighten graph +// -------------------------------------------- Draw the table instead of graph -function graphopt() { +function tabledraw() { + var objsorted=new Array(); + var robjs=new Array(); + var k; + var i; + var j; + var nr; + var bc; var rc; var gc; var ck; + var sortstr=sortobjs(); + if (sortstr!='') { + objsorted=sortstr.split('&'); + for (k=0;k'+k+'
'); + data2=obj[i].split('&'); + parent.mapout.document.write(''); + parent.mapout.document.write( + ''); + parent.mapout.document.write( + '' + +'' + +'' + +'
Title:
URL:
External:
Regular   Mandatory   Optional
' + +'Change to above values  ' + +' Reset
'); + for (j=2;j1) { + if (data3[1]==nr) { + parent.mapout.document.writeln(''); + } + } + } + for (j=2;j1) { + if ((data3[1]!=nr) && (data3[1]!=0)) { + parent.mapout.document.writeln( + ''); + } + } + } + parent.mapout.document.writeln( + '
Next
'+data3); + parent.mapout.document.writeln('
To: '+robjs[data3[1]]+'
'); + parent.mapout.document.writeln('
'); + } + } +} + +// ---------------------------------- Sort objects to straighten graph or table + +function sortobjs() { + message("Sorting Resources"); var k; var ij; + var dol; + var dtl; var kj; + var sortthis=0; var objsort=new Array(); - var objsorted=new Array(); - condense(); - graphreset(); for (k=1;k