Annotation of rat/client/rat.html, revision 1.1
1.1 ! albertel 1: <html>
! 2:
! 3: <!--
! 4: The LearningOnline Network
! 5: Resource Assembly Tool
! 6: 7/23,7/24,7/26,
! 7: 8/11,8/14,8/18,8/19,8/20,8/21,8/22,8/25,8/26,8/28,8/30,8/31,
! 8: 9/1,9/2,9/4,9/5,9/6 Gerd Kortemeyer with Scott Harrison
! 9: -->
! 10:
! 11:
! 12: <head>
! 13: <script language="JavaScript">
! 14:
! 15: var row=new Array();
! 16: var maxrow=-1;
! 17: var col=new Array();
! 18: var maxcol=-1;
! 19: var colmap=new Array();
! 20: var colmap2=new Array();
! 21: var colmap3=new Array();
! 22: var colmap4=new Array();
! 23: var colmap5=new Array();
! 24: var obj=new Array();
! 25: var maxobj=-1;
! 26: var rowcont=new Array();
! 27: var rowtype=new Array();
! 28: var coltype=new Array();
! 29: var rcol=new Array();
! 30: var rrow=new Array();
! 31: var cw=new Array();
! 32: var rh=new Array();
! 33:
! 34: var data1=new Array(1024);
! 35: var data2=new Array(1024);
! 36: var data3=new Array(1024);
! 37: var data4=new Array(1024);
! 38:
! 39: // ----------------------------------------- Functions to switch between images
! 40:
! 41: function ssws(doc,i,j) {
! 42: var name='s'+i+'_'+j;
! 43: doc.document[name].src='insrow.gif';
! 44: }
! 45:
! 46: function sswe(doc,i,j) {
! 47: var name='s'+i+'_'+j;
! 48: doc.document[name].src='sempty.gif';
! 49: }
! 50:
! 51: function sswet(doc,i,j) {
! 52: var name='s'+i+'_'+j;
! 53: doc.document[name].src='std.gif';
! 54: }
! 55:
! 56: function csws(doc,i,j) {
! 57: var name='c'+i+'_'+j;
! 58: doc.document[name].src='inscond.gif';
! 59: }
! 60:
! 61: function cswe(doc,i,j) {
! 62: var name='c'+i+'_'+j;
! 63: doc.document[name].src='sctd.gif';
! 64: }
! 65:
! 66: function isws(doc,i,j) {
! 67: var name='i'+i+'_'+j;
! 68: doc.document[name].src='inscol.gif';
! 69: }
! 70:
! 71: function iswel(doc,i,j) {
! 72: var name='i'+i+'_'+j;
! 73: doc.document[name].src='sld.gif';
! 74: }
! 75:
! 76: function iswed(doc,i,j) {
! 77: var name='i'+i+'_'+j;
! 78: doc.document[name].src='std.gif';
! 79: }
! 80:
! 81: function iswedt(doc,i,j) {
! 82: var name='i'+i+'_'+j;
! 83: doc.document[name].src='stdl.gif';
! 84: }
! 85:
! 86:
! 87: function isweb(doc,i,j) {
! 88: var name='i'+i+'_'+j;
! 89: doc.document[name].src='sempty.gif';
! 90: }
! 91:
! 92: function bsws(doc,i,j) {
! 93: var name='b'+i+'_'+j;
! 94: doc.document[name].src='insres.gif';
! 95: }
! 96:
! 97: function bswe(doc,i,j) {
! 98: var name='b'+i+'_'+j;
! 99: doc.document[name].src='bempty.gif';
! 100: }
! 101:
! 102: function bswet(doc,i,j) {
! 103: var name='b'+i+'_'+j;
! 104: doc.document[name].src='btd.gif';
! 105: }
! 106:
! 107: // Insert a resource
! 108:
! 109: function insertresource(i,j) {
! 110: var cols=tr[i].split(":");
! 111: cols[j]='r'+i+j;
! 112: tr[i]=cols.join(':');
! 113:
! 114: // This is only a test
! 115: joinres(tti,ttj,i,j,'nodraw');
! 116:
! 117: draw('edit');
! 118: }
! 119:
! 120: // Insert a condition
! 121:
! 122: function insertcondition(i,j) {
! 123: var cols=tc[i].split(":");
! 124: cols[j]='r'+i+j;
! 125: tc[i]=cols.join(':');
! 126: draw('edit');
! 127: }
! 128:
! 129: // ------------------------------------------------ Insert a row into the table
! 130:
! 131: function insertrow(j,size,ex1,ex2) {
! 132: objects1='';
! 133: objects2='';
! 134: for (kj=0;kj<=maxrow;kj++) {
! 135: if ( row[kj]==j ) { objects1=rowcont[kj]; }
! 136: if ( row[kj]==j+1 ) { objects2=rowcont[kj]; }
! 137: if ( row[kj]>j ) { row[kj]++; }
! 138: }
! 139: maxrow++;
! 140: row[maxrow]=j+1;
! 141: rowtype[maxrow]=size;
! 142: rowcont[maxrow]=':';
! 143: colcover=':'+ex1+':'+ex2+':';
! 144: objects=objects1+':'+objects2;
! 145: data1=objects.split(':');
! 146: for (kj=0;kj<data1.length;kj++) {
! 147: if (data1[kj]!='') {
! 148: thisisobj=obj[data1[kj]];
! 149: thisobjtype=thisisobj.split('&')[0];
! 150: if (thisobjtype=='v') {
! 151: if (rowcont[maxrow].indexOf(':'+data1[kj]+':',0)==-1) {
! 152: thisobjcol=thisisobj.split('&')[1];
! 153: if (colcover.indexOf(':'+thisobjcol+':',0)==-1) {
! 154: colcover+=thisobjcol+':';
! 155: rowcont[maxrow]+=data1[kj]+':';
! 156: }
! 157: }
! 158: }
! 159: if (thisobjtype=='h') {
! 160: updown=thisisobj.split('&')[4];
! 161: leftupdown=updown.split(':')[0];
! 162: rightupdown=updown.split(':')[1];
! 163: thisobjdest=thisisobj.split('&')[3];
! 164: thisobjtofrom=thisisobj.split('&')[2];
! 165: thisobjfrom=thisobjtofrom.split(':')[0];
! 166: thisobjto=thisobjtofrom.split(':')[1];
! 167: thisobjdir=col[thisobjto]-col[thisobjfrom];
! 168: thisobjrow=row[thisisobj.split('&')[1]];
! 169: topbottom=thisobjrow-j-1;
! 170: newobj='';
! 171: if (leftupdown==-1) {
! 172: if (topbottom<0) {
! 173: if (thisobjdir<0) {
! 174: newobj='v&'+thisobjto+'&'+thisobjdest+'&-1';
! 175: } else {
! 176: newobj='v&'+thisobjfrom+'&'+thisobjdest+'&1';
! 177: }
! 178: }
! 179: } else {
! 180: if (topbottom>0) {
! 181: if (thisobjdir<0) {
! 182: newobj='v&'+thisobjto+'&'+thisobjdest+'&1';
! 183: } else {
! 184: newobj='v&'+thisobjfrom+'&'+thisobjdest+'&-1';
! 185: }
! 186: }
! 187: }
! 188: if (newobj!='') {
! 189: thisobjcol=newobj.split('&')[1];
! 190: if (colcover.indexOf(':'+thisobjcol+':',0)==-1) {
! 191: colcover+=thisobjcol+':';
! 192: rowcont[maxrow]+=obj.length+':';
! 193: obj[obj.length]=newobj;
! 194: }
! 195: }
! 196: newobj='';
! 197: if (rightupdown==-1) {
! 198: if (topbottom<0) {
! 199: if (thisobjdir<0) {
! 200: newobj='v&'+thisobjfrom+'&'+thisobjdest+'&1';
! 201: } else {
! 202: newobj='v&'+thisobjto+'&'+thisobjdest+'&-1';
! 203: }
! 204: }
! 205: } else {
! 206: if (topbottom>0) {
! 207: if (thisobjdir<0) {
! 208: newobj='v&'+thisobjfrom+'&'+thisobjdest+'&-1';
! 209: } else {
! 210: newobj='v&'+thisobjto+'&'+thisobjdest+'&1';
! 211: }
! 212: }
! 213: }
! 214: if (newobj!='') {
! 215: thisobjcol=newobj.split('&')[1];
! 216: if (colcover.indexOf(':'+thisobjcol+':',0)==-1) {
! 217: colcover+=thisobjcol+':';
! 218: rowcont[maxrow]+=obj.length+':';
! 219: obj[obj.length]=newobj;
! 220: }
! 221: }
! 222: }
! 223: }
! 224: }
! 225: if (rowcont[maxrow]!=':') {
! 226: rowcont[maxrow]=rowcont[maxrow].substring(1,rowcont[maxrow].length-1);
! 227: } else {
! 228: rowcont[maxrow]='';
! 229: }
! 230: }
! 231:
! 232: // --------------------------------------------- Insert a column into the table
! 233:
! 234: function insertcol(j,size) {
! 235: for (kj=0;kj<=maxcol;kj++) {
! 236: if ( col[kj]>j ) { col[kj]++; }
! 237: }
! 238: maxcol++;
! 239: col[maxcol]=j+1;
! 240: coltype[maxcol]=size;
! 241: }
! 242:
! 243: // --------------------------------------------------------------- Find the row
! 244:
! 245: function findrow(jid) {
! 246: for (j=0;j<=maxrow;j++) { if (row[j]==jid) { return j; } }
! 247: return -1;
! 248: }
! 249:
! 250: // --------------------------------------------------------------- Find the col
! 251:
! 252: function findcol(jid) {
! 253: for (j=0;j<=maxcol;j++) { if (col[j]==jid) { return j; } }
! 254: return -1;
! 255: }
! 256:
! 257: // -------------------------------------------------------------- Map out a row
! 258: //
! 259: // b&rowID&colID:inObj:outObj:outCond&...
! 260: // h&rowID&incolID:outcolID&inObj:outObj&inupdown:outupdown
! 261: // v&colID&inObj:outObj&updown
! 262: //
! 263: // returns middle (col number of middle of obj1)
! 264: // sets colmap (map of cols with object numbers)
! 265:
! 266: function maprow (jid,obj1,ign) {
! 267: middle=-1;
! 268: for (j=0;j<=maxcol;j++) { colmap[j]=0; }
! 269: if (rowcont[jid]!='') {
! 270: data2=rowcont[jid].split(':');
! 271: for (j=0;j<data2.length;j++) {
! 272: data3=obj[data2[j]].split('&');
! 273: if (data3[0]=='b') {
! 274: left=maxcol;
! 275: right=0;
! 276: for (k=2;k<data3.length;k++) {
! 277: thiscol=col[data3[k].split(':')[0]];
! 278: if (thiscol<left) { left=thiscol; }
! 279: if (thiscol>right) { right=thiscol; }
! 280: }
! 281: }
! 282: if (data3[0]=='h') {
! 283: data4=data3[2].split(':');
! 284: if (col[data4[1]]>col[data4[0]]) {
! 285: left=col[data4[0]];
! 286: right=col[data4[1]];
! 287: } else {
! 288: right=col[data4[0]];
! 289: left=col[data4[1]];
! 290: }
! 291: }
! 292: if (data3[0]=='v') { left=col[data3[1]]; right=left; }
! 293: if (data2[j]==obj1) { middle=Math.round((left+right)/2); }
! 294: if ((data3[0]!='h') || (ign!=1)) {
! 295: for (k=left;k<=right;k++) { colmap[k]=data2[j]; }
! 296: } else {
! 297: colmap[left]=data2[j];
! 298: colmap[right]=data2[j];
! 299: }
! 300: }
! 301: }
! 302: return middle;
! 303: }
! 304:
! 305: // --------------------------------------------------------- Find hole in a row
! 306: // jid: rowID
! 307: // kid: colID, find point close to this
! 308: // dkid: destination colID
! 309: // returns colID
! 310:
! 311: function comingthru (jid,kid,dkid) {
! 312: maprow(jid,-1,1);
! 313: knum=col[kid];
! 314: if (colmap[knum]==0) { return kid; }
! 315: right=-1;
! 316: for (k=knum+1;(k<colmap.length) && (right==-1);k++) {
! 317: if ((right==-1) && (colmap[k]!=colmap[knum])) { right=k; }
! 318: }
! 319: left=-1;
! 320: for (k=knum-1;(k>=0) && (left==-1);k--) {
! 321: if ((left==-1) && (colmap[k]!=colmap[knum])) { left=k; }
! 322: }
! 323: kup=-1;
! 324: // if ((left==-1) && (right==-1)) { right=colmap.length; }
! 325: dknum=col[dkid];
! 326: dleft=left-dknum;
! 327: dright=right-dknum;
! 328: if (dleft<0) { dleft=-dleft; }
! 329: if (dright<0) { dright=-dright; }
! 330: if ((dright<=dleft) && (right!=-1)) { kup=right; }
! 331: if ((dright>=dleft) && (left!=-1)) { kup=left; }
! 332: if (colmap[kup]==0) { return findcol(kup); }
! 333: if (kup==right) { kup--; }
! 334: insertcol(kup,1);
! 335: return maxcol;
! 336: }
! 337:
! 338: // ----------------------------------------------------- Insert port into block
! 339: // obj1: object number
! 340: // d: direction from middle (>0: right, <0 left)
! 341: // inout: in or out port (1: in, 2: out)
! 342: // linkobj: object that the link goes to/comes from
! 343: // sets incol,inrow or outcol,outrow
! 344:
! 345: function insertport (obj1,d,inout,linkobj) {
! 346: data1=obj[obj1].split('&');
! 347: middle=maprow(data1[1],obj1,0);
! 348: if (inout==1) {
! 349: inrow=data1[1];
! 350: } else {
! 351: outrow=data1[1];
! 352: }
! 353: if (d>0) {
! 354: for (k=middle;(colmap[k]==obj1) && (k<colmap.length);k++) { data3[k]=0; }
! 355: } else {
! 356: for (k=middle;(colmap[k]==obj1) && (k>=0);k--) { data3[k]=0; }
! 357: }
! 358: for (k=2;k<data1.length;k++) {
! 359: data2=data1[k].split(':');
! 360: data3[col[data2[0]]]=data2[inout];
! 361: }
! 362: port=-1;
! 363: if (d>0) {
! 364: for (k=middle;(colmap[k]==obj1) && (k<colmap.length);k++) {
! 365: if ((data3[k]==0) && (colmap[k]==obj1) && (port==-1)) { port=k; }
! 366: }
! 367: } else {
! 368: for (k=middle;(colmap[k]==obj1) && (k>=0);k--) {
! 369: if ((data3[k]==0) && (colmap[k]==obj1) && (port==-1)) { port=k; }
! 370: }
! 371: }
! 372:
! 373: if (port==-1) {
! 374: if (colmap[k]==0) {
! 375: port=k;
! 376: if (inout==1) {
! 377: data1[data1.length]=findcol(port)+":"+linkobj+":0:0";
! 378: } else {
! 379: data1[data1.length]=findcol(port)+":0:"+linkobj+":0";
! 380: }
! 381: } else {
! 382: if (d>0) {
! 383: insertcol(k-1,2);
! 384: port=k;
! 385: } else {
! 386: insertcol(k,2);
! 387: port=k+1;
! 388: }
! 389: if (inout==1) {
! 390: data1[data1.length]=maxcol+":"+linkobj+":0:0";
! 391: } else {
! 392: data1[data1.length]=maxcol+":0:"+linkobj+":0";
! 393: }
! 394: }
! 395: } else {
! 396: portfound=-1;
! 397: for (k=2;k<data1.length;k++) {
! 398: data2=data1[k].split(':');
! 399: if (col[data2[0]]==port) {
! 400: data2[inout]=linkobj;
! 401: data1[k]=data2.join(':');
! 402: portfound=1;
! 403: }
! 404: }
! 405: if (portfound==-1) {
! 406: if (inout==1) {
! 407: data1[data1.length]=findcol(port)+":"+linkobj+":0:0";
! 408: } else {
! 409: data1[data1.length]=findcol(port)+":0:"+linkobj+":0";
! 410: }
! 411: }
! 412: }
! 413: if (inout==1) {
! 414: incol=findcol(port);
! 415: coltype[incol]=2;
! 416: } else {
! 417: outcol=findcol(port);
! 418: coltype[outcol]=2;
! 419: }
! 420: obj[obj1]=data1.join('&');
! 421: }
! 422:
! 423: // ---------------------------- Make a new object and add it to the row content
! 424:
! 425: function addobj(kjid,objs) {
! 426: if (rowcont[kjid]!='') { rowcont[kjid]+=':'; }
! 427: rowcont[kjid]+=obj.length;
! 428: obj[obj.length]=objs;
! 429: }
! 430:
! 431: // ---------------------------------------- Make horizontal connection for hrid
! 432: // hoffs=-1: this line goes on top of hrid
! 433:
! 434: function horizontal(hrid,hoffs,hfcol,htcol,hdest,hends) {
! 435: hcrid=-1;
! 436: if (hoffs==-1) {
! 437: hbrid=findrow(row[hrid]-1);
! 438: } else {
! 439: hbrid=findrow(row[hrid]+1);
! 440: }
! 441: if (hbrid!=-1) {
! 442: maprow(hbrid,-1,0);
! 443: hcrid=hbrid;
! 444: if (col[hfcol]>col[htcol]) { left=col[htcol]; right=col[hfcol]; }
! 445: else { right=col[htcol]; left=col[hfcol]; }
! 446: if (colmap[left]!=0) {
! 447: hcrid=-1;
! 448: } else {
! 449: if (colmap[right]!=0) {
! 450: hcrid=-1;
! 451: } else {
! 452: for (kh=left+1;kh<right;kh++) {
! 453: if (colmap[kh]!=0) {
! 454: if (obj[colmap[kh]].split('&')[0]!='v') { hcrid=-1; }
! 455: }
! 456: }
! 457: }
! 458: }
! 459: }
! 460:
! 461: if (hcrid==-1) {
! 462: insertrow(row[hrid]+hoffs,1,hfcol,htcol);
! 463: addobj(maxrow,'h&'+maxrow+'&'+hfcol+':'+htcol+'&'+hdest+'&'+hends);
! 464: } else {
! 465: addobj(hcrid,'h&'+hcrid+'&'+hfcol+':'+htcol+'&'+hdest+'&'+hends);
! 466: }
! 467: }
! 468:
! 469: // ----------------------------------------------------------- Join two objects
! 470: // Links obj1 with obj2
! 471:
! 472: function joinres (obj1,obj2) {
! 473: data3=obj[obj1].split('&');
! 474: sum=0;
! 475: for (k=2;k<data3.length;k++) { sum+=col[data3[k].split(':')[0]]; }
! 476: outmiddle=sum/(data3.length-2);
! 477: data3=obj[obj2].split('&');
! 478: sum=0;
! 479: for (k=2;k<data3.length;k++) { sum+=col[data3[k].split(':')[0]]; }
! 480: inmiddle=sum/(data3.length-2);
! 481: d=inmiddle-outmiddle;
! 482: insertport(obj1,d,2,obj2);
! 483: insertport(obj2,-d,1,obj1);
! 484: dest=obj1+':'+obj2;
! 485: if (row[inrow]<row[outrow]) {
! 486: updown=1;
! 487: tcol=comingthru(inrow,incol,outcol);
! 488: horizontal(inrow,-1,tcol,incol,dest,'-1:-1');
! 489: addobj(inrow,'v&'+tcol+'&'+dest+'&1');
! 490: incol=tcol;
! 491: tcol=comingthru(outrow,outcol,incol);
! 492: horizontal(outrow,0,outcol,tcol,dest,'1:1');
! 493: addobj(outrow,'v&'+tcol+'&'+dest+'&1');
! 494: outcol=tcol;
! 495: } else {
! 496: updown=-1;
! 497: }
! 498:
! 499: if (inrow==outrow) {
! 500: tcol=comingthru(inrow,incol,outcol);
! 501: horizontal(inrow,-1,tcol,incol,dest,'-1:-1');
! 502: addobj(inrow,'v&'+tcol+'&'+dest+'&1');
! 503: horizontal(outrow,0,outcol,tcol,dest,'1:1');
! 504: } else {
! 505: if (updown==-1) {
! 506: for (kr=row[outrow]+1;kr<row[inrow];kr++) {
! 507: rid=findrow(kr);
! 508: ncol=comingthru(rid,outcol,incol);
! 509: if (ncol!=outcol) {
! 510: insertrow(k-1,1,outcol,ncol);
! 511: if (col[ncol]>col[incol]) {
! 512: addobj(maxrow,'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&-1:1');
! 513: } else {
! 514: addobj(maxrow,'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&1:-1');
! 515: }
! 516: }
! 517: addobj(rid,'v&'+ncol+'&'+dest+'&-1');
! 518: outcol=ncol;
! 519: }
! 520: if (incol!=outcol) {
! 521: insertrow(row[inrow]-1,1,outcol,incol);
! 522: if (col[outcol]>col[incol]) {
! 523: addobj(maxrow,'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&-1:1');
! 524: } else {
! 525: addobj(maxrow,'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&1:-1');
! 526: }
! 527: }
! 528: } else {
! 529: for (kr=row[outrow]-1;kr>row[inrow];kr--) {
! 530: rid=findrow(kr);
! 531: ncol=comingthru(rid,outcol,incol);
! 532: if (ncol!=outcol) {
! 533: insertrow(k,1,outcol,ncol);
! 534: if (col[outcol]>col[ncol]) {
! 535: addobj(maxrow,'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&1:-1');
! 536: } else {
! 537: addobj(maxrow,'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&-1:1');
! 538: }
! 539: }
! 540: addobj(rid,'v&'+ncol+'&'+dest+'&1');
! 541: outcol=ncol;
! 542: }
! 543: if (incol!=outcol) {
! 544: insertrow(row[inrow],1,outcol,incol);
! 545: if (col[outcol]>col[incol]) {
! 546: addobj(maxrow,'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&1:-1');
! 547: } else {
! 548: addobj(maxrow,'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&-1:1');
! 549: }
! 550: }
! 551: }
! 552: }
! 553: }
! 554: // -------------------------------------------------------------- Draw an entry
! 555:
! 556: function drawcell (rtype,ctype,what,cm,mode2) {
! 557: doc.document.write('<td width='+cw[ctype]+'>');
! 558: if (what!='') {
! 559: if (cm!=0) {
! 560: if (what.substring(0,2)=='r:') {
! 561: doc.document.write(what);
! 562: } else {
! 563: doc.document.write('<img src="'+rtype+'.'+ctype+'.'+what+'.gif">');
! 564: }
! 565: } else {
! 566: doc.document.write('<img src="'+rtype+'.'+ctype+'.'+what+'.gif">');
! 567: }
! 568: }
! 569: doc.document.write('</td>');
! 570: }
! 571:
! 572: // ----------------------------------------------------------------- Draw a row
! 573:
! 574: function drawrow (jid,mode2) {
! 575: for (j=0;j<=maxcol;j++) {
! 576: colmap[j]=''; colmap2[j]=''; colmap3[j]=''; colmap4[j]=''; colmap5[j]='';
! 577: }
! 578: doc.document.writeln('<tr height='+rh[rowtype[jid]]+'>');
! 579: if (rowcont[jid]!='') {
! 580: data2=rowcont[jid].split(':');
! 581: for (jk=0;jk<data2.length;jk++) {
! 582: data3=obj[data2[jk]].split('&');
! 583: if (data3[0]=='b') {
! 584: left=maxcol;
! 585: leftin=maxcol;
! 586: leftout=maxcol;
! 587: right=0;
! 588: rightin=0;
! 589: rightout=0;
! 590: for (k=2;k<data3.length;k++) {
! 591: data1=data3[k].split(':');
! 592: thiscol=col[data1[0]];
! 593: if (thiscol<left) { left=thiscol; }
! 594: if (thiscol>right) { right=thiscol; }
! 595: if (data1[1]!=0) {
! 596: if (thiscol<leftin) { leftin=thiscol; }
! 597: if (thiscol>rightin) { rightin=thiscol; }
! 598: colmap4[thiscol]=data1[1];
! 599: }
! 600: if (data1[2]!=0) {
! 601: if (thiscol<leftout) { leftout=thiscol; }
! 602: if (thiscol>rightout) { rightout=thiscol; }
! 603: if (data1[3]!=0) {
! 604: colmap3[thiscol]='r:'+data1[3];
! 605: colmap5[thiscol]=2;
! 606: } else {
! 607: colmap3[thiscol]='ctd';
! 608: }
! 609: }
! 610: }
! 611: middle=Math.round((left+right)/2);
! 612: colmap[middle]='r:'+data2[jk];
! 613: colmap5[middle]=1;
! 614:
! 615: if (rightin>middle) {
! 616: for (k=middle+1;k<rightin;k++) {
! 617: if (colmap4[k]!='') {
! 618: colmap[k]='rlt';
! 619: } else {
! 620: colmap[k]='rl';
! 621: }
! 622: }
! 623: colmap[rightin]='tl';
! 624: }
! 625: if (leftin<middle) {
! 626: for (k=middle-1;k>leftin;k--) {
! 627: if (colmap4[k]!='') {
! 628: colmap[k]='lrt';
! 629: } else {
! 630: colmap[k]='lr';
! 631: }
! 632: }
! 633: colmap[leftin]='tr';
! 634: }
! 635:
! 636: if (leftout>middle) {
! 637: if (colmap3[leftout]!='') {
! 638: colmap2[middle]='tr';
! 639: }
! 640: }
! 641: if (leftout==middle) {
! 642: if (rightout==middle) { colmap2[middle]='td'; }
! 643: if (rightout>middle) { colmap2[middle]='rtd'; }
! 644: }
! 645: if (leftout<middle) {
! 646: if (rightout<middle) { colmap2[middle]='tl'; }
! 647: if (rightout==middle) { colmap2[middle]='tdl'; }
! 648: if (rightout>middle) {
! 649: if (colmap3[middle]!='') {
! 650: colmap2[middle]='rtdl';
! 651: } else {
! 652: colmap2[middle]='rtl';
! 653: }
! 654: }
! 655: }
! 656: if (leftout<middle) {
! 657: for (k=middle-1;k>leftout;k--) {
! 658: if (colmap3[k]!='') {
! 659: colmap2[k]='rld';
! 660: } else {
! 661: colmap2[k]='rl';
! 662: }
! 663: }
! 664: colmap2[leftout]='rd';
! 665: }
! 666: if (rightout>middle) {
! 667: for (k=middle+1;k<rightout;k++) {
! 668: if (colmap3[k]!='') {
! 669: colmap2[k]='lrd';
! 670: } else {
! 671: colmap2[k]='lr';
! 672: }
! 673: }
! 674: colmap2[rightout]='ld';
! 675: }
! 676: }
! 677: if (data3[0]=='h') {
! 678: data4=data3[2].split(':');
! 679: if (col[data4[1]]>col[data4[0]]) {
! 680: left=col[data4[0]];
! 681: right=col[data4[1]];
! 682: thisarrow='lr';
! 683: } else {
! 684: right=col[data4[0]];
! 685: left=col[data4[1]];
! 686: thisarrow='rl';
! 687: }
! 688: if (data3[4].split(':')[0]==1) {
! 689: colmap[left]='tr';
! 690: } else {
! 691: colmap[left]='rd'; colmap2[left]='utd'; colmap3[left]='utd';
! 692: }
! 693: for (k=left+1;k<right;k++) {
! 694: if (colmap[k]=='') {
! 695: colmap[k]=thisarrow;
! 696: } else {
! 697: colmap[k]='tdrl';
! 698: }
! 699: }
! 700: if (data3[4].split(':')[1]==1) {
! 701: colmap[right]='tl';
! 702: } else {
! 703: colmap[right]='ld'; colmap2[right]='utd'; colmap3[right]='utd';
! 704: }
! 705: }
! 706: if (data3[0]=='v') {
! 707: left=col[data3[1]];
! 708: if (colmap[left]=='') {
! 709: if (data3[3]==1) { colmap[left]='dt'; } else { colmap[left]='td'; }
! 710: } else {
! 711: colmap[left]='tdrl';
! 712: }
! 713: colmap2[left]='utd'; colmap3[left]='utd';
! 714: }
! 715: }
! 716: rtype=rowtype[jid];
! 717: for (k=0;k<=maxcol;k++) {
! 718: drawcell(rtype,coltype[rcol[k]],colmap[k],colmap5[k],mode2);
! 719: }
! 720: if (rowtype[jid]==2) {
! 721: doc.document.writeln('</tr><tr>');
! 722: for (k=0;k<=maxcol;k++) {
! 723: drawcell(1,coltype[rcol[k]],colmap2[k],colmap5[k],mode2);
! 724: }
! 725: doc.document.writeln('</tr><tr>');
! 726: for (k=0;k<=maxcol;k++) {
! 727: drawcell(1,coltype[rcol[k]],colmap3[k],colmap5[k],mode2);
! 728: }
! 729: }
! 730: }
! 731: doc.document.writeln('</tr>');
! 732: }
! 733:
! 734: // ------------------------------------------------------------- Draw the table
! 735:
! 736: function draw (mode,mode2) {
! 737: if (mode=='debug') {
! 738: var options="scrollbars=1,resizable=1,menubar=0,width=200,height=300";
! 739: deb=open("","debout",options);
! 740: deb.document.clear();
! 741: deb.document.writeln('<html><body bgcolor="#FFFFFF">');
! 742:
! 743: for (k=0;k<obj.length;k++) { deb.document.writeln(k+' - '+obj[k]+'<br>'); }
! 744: deb.document.writeln('<hr>Cols: '+col+'<hr>Rows: '+row+'<hr>');
! 745: for (kr=0;kr<=maxrow;kr++) {
! 746: kid=findrow(kr);
! 747: maprow(kid,-1,0);
! 748: deb.document.writeln(kid+' : '+colmap+' '+rowcont[kid]+"<br>");
! 749: }
! 750:
! 751: deb.document.writeln('</body></html>');
! 752: deb.document.close();
! 753: }
! 754:
! 755: for (k=0;k<=maxrow;k++) { rrow[row[k]]=k; }
! 756: for (k=0;k<=maxcol;k++) { rcol[col[k]]=k; }
! 757: rh[1]=30;
! 758: rh[2]=60;
! 759: cw[1]=30;
! 760: cw[2]=60;
! 761: var options="scrollbars=1,resizable=1,menubar=0,width=200,height=300";
! 762: doc=open("","mapout",options);
! 763: doc.document.clear();
! 764: doc.document.writeln('<html><body bgcolor="#AAFFAA">');
! 765: doc.document.writeln('<table cellpadding=0 cellspacing=0 border=0>');
! 766:
! 767: for (kr=0;kr<=maxrow;kr++) { drawrow(rrow[kr],mode2); }
! 768:
! 769: doc.document.writeln('</table>');
! 770: doc.document.writeln('</body></html>');
! 771: doc.document.close();
! 772:
! 773: }
! 774:
! 775: function main() {
! 776: row[0]=0;
! 777: row[1]=1;
! 778: row[2]=2;
! 779: rowcont[0]='5:4';
! 780: rowtype[0]=2;
! 781: rowcont[1]='3';
! 782: rowtype[1]=2;
! 783: rowcont[2]='7';
! 784: rowtype[2]=2;
! 785: insertcol(0,1);
! 786: insertcol(0,1);
! 787: insertcol(0,1);
! 788: insertcol(0,1);
! 789: insertcol(0,1);
! 790: insertcol(0,1);
! 791: insertcol(0,1);
! 792: insertcol(0,1);
! 793: insertcol(0,1);
! 794: insertcol(0,1);
! 795: insertcol(0,1);
! 796: insertcol(0,1);
! 797: insertcol(0,1);
! 798: swap=col[8];
! 799: col[8]=col[3];
! 800: col[3]=swap;
! 801: swap=col[6];
! 802: col[6]=col[4];
! 803: col[4]=swap;
! 804: maxrow=2;
! 805: obj[3]='b&1&4:0:0:0';
! 806: coltype[4]=2;
! 807: obj[4]='b&0&8:0:0:0';
! 808: coltype[8]=2;
! 809: obj[5]='b&0&2:0:0:0';
! 810: coltype[2]=2;
! 811: obj[7]='b&2&5:0:0:0';
! 812: coltype[5]=2;
! 813: joinres(7,4);
! 814: joinres(4,7);
! 815: joinres(7,5);
! 816: joinres(5,7);
! 817: joinres(7,7);
! 818: joinres(4,5);
! 819: joinres(5,5);
! 820: joinres(3,4);
! 821: joinres(3,7);
! 822: joinres(5,3);
! 823: joinres(7,3);
! 824: joinres(4,3);
! 825: draw('debug','edit');
! 826: }
! 827:
! 828: </script>
! 829: </head>
! 830:
! 831: <body onLoad="main()">
! 832: Hi!
! 833: </body>
! 834:
! 835: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>