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