Annotation of rat/client/code.html, revision 1.13
1.1 www 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,
1.2 www 9: 1/7,1/8,1/10,1/14,1/15,1/16,1/21,1/22,1/29,1/30,1/31,
10: 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,
1.4 www 11: 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,
1.13 ! www 12: 6/7,6/8,6/9,6/10,6/12,6/15,7/4,7/26,7/28,7/31,8/5,8/19,8/24,
! 13: 01/17/01 Gerd Kortemeyer with Scott Harrison
1.1 www 14: -->
15:
16:
17: <head>
18: <script language="JavaScript">
19:
20: var row=new Array();
21: var maxrow=-1;
22: var col=new Array();
23: var maxcol=-1;
1.5 www 24:
1.1 www 25: var colmap=new Array();
26: var colmap2=new Array();
27: var colmap3=new Array();
28: var colmap4=new Array();
29: var colmap5=new Array();
30: var colmap6=new Array();
31: var obj=new Array();
32: var objcont=new Array();
33: var objlinks=new Array();
34: var rowcont=new Array();
35: var rowtype=new Array();
36: var coltype=new Array();
37: var rcol=new Array();
38: var rrow=new Array();
39: var cw=new Array();
40: var rh=new Array();
41:
1.2 www 42: var undostack=new Array();
43: var undopointer=0;
44: var stored=0;
1.1 www 45: var editmode=0;
46: var notclear=0;
47: var linkmode=0;
48: var lastinfo='';
49: var graphdef='no';
1.6 www 50: var mode='';
1.1 www 51: var mainrun=0;
1.2 www 52: var tablemode=0;
1.3 www 53: var mostrecent=0;
1.4 www 54: var zscale=3;
1.3 www 55:
56: var disrows=0;
57: var discols=0;
1.1 www 58:
1.8 www 59: var finishdone=0;
60: var tim=0;
61: var funny='|';
62: var reqaction='';
63: var canceltim;
64:
1.10 www 65: var expense=0;
66:
1.1 www 67: var data1=new Array(1024);
68: var data2=new Array(1024);
69: var data3=new Array(1024);
70: var data4=new Array(1024);
71: var data5=new Array(1024);
72:
1.5 www 73: var inf;
1.1 www 74:
75: // ------------------------------------------------ Insert a row into the table
76:
77: function insertrow(j,ex1,ex2) {
78: var kj;
1.2 www 79: stored=0;
1.10 www 80: expense++; expense++;
1.1 www 81: objects1='';
82: objects2='';
83: for (kj=0;kj<=maxrow;kj++) {
84: if ( row[kj]==j ) { objects1=rowcont[kj]; }
85: if ( row[kj]==j+1 ) { objects2=rowcont[kj]; }
86: if ( row[kj]>j ) { row[kj]++; }
87: }
88: maxrow++;
89: row[maxrow]=j+1;
90: rowcont[maxrow]=':';
91: colcover=':'+ex1+':'+ex2+':';
92: objects=objects1+':'+objects2;
93: data1=objects.split(':');
94: for (kj=0;kj<data1.length;kj++) {
1.13 ! www 95: if ((data1[kj]!='') && (data1[kj]!=undefined)) {
1.1 www 96: thisisobj=obj[data1[kj]];
97: thisobjtype=thisisobj.split('&')[0];
98: if (thisobjtype=='v') {
99: if (rowcont[maxrow].indexOf(':'+data1[kj]+':',0)==-1) {
100: thisobjcol=thisisobj.split('&')[1];
101: if (colcover.indexOf(':'+thisobjcol+':',0)==-1) {
102: colcover+=thisobjcol+':';
103: rowcont[maxrow]+=data1[kj]+':';
104: }
105: }
106: }
107: if (thisobjtype=='h') {
108: updown=thisisobj.split('&')[4];
109: leftupdown=updown.split(':')[0];
110: rightupdown=updown.split(':')[1];
111: thisobjdest=thisisobj.split('&')[3];
112: thisobjtofrom=thisisobj.split('&')[2];
113: thisobjfrom=thisobjtofrom.split(':')[0];
114: thisobjto=thisobjtofrom.split(':')[1];
115: thisobjdir=col[thisobjto]-col[thisobjfrom];
116: thisobjrow=row[thisisobj.split('&')[1]];
117: topbottom=thisobjrow-j-1;
118: newobj='';
119: if (leftupdown==-1) {
120: if (topbottom<0) {
121: if (thisobjdir<0) {
122: newobj='v&'+thisobjto+'&'+thisobjdest+'&-1';
123: } else {
124: newobj='v&'+thisobjfrom+'&'+thisobjdest+'&1';
125: }
126: }
127: } else {
128: if (topbottom>0) {
129: if (thisobjdir<0) {
130: newobj='v&'+thisobjto+'&'+thisobjdest+'&1';
131: } else {
132: newobj='v&'+thisobjfrom+'&'+thisobjdest+'&-1';
133: }
134: }
135: }
1.13 ! www 136: if ((newobj!='') && (newobj!=undefined)) {
1.1 www 137: thisobjcol=newobj.split('&')[1];
138: if (colcover.indexOf(':'+thisobjcol+':',0)==-1) {
139: colcover+=thisobjcol+':';
140: rowcont[maxrow]+=obj.length+':';
141: obj[obj.length]=newobj;
142: }
143: }
144: newobj='';
145: if (rightupdown==-1) {
146: if (topbottom<0) {
147: if (thisobjdir<0) {
148: newobj='v&'+thisobjfrom+'&'+thisobjdest+'&1';
149: } else {
150: newobj='v&'+thisobjto+'&'+thisobjdest+'&-1';
151: }
152: }
153: } else {
154: if (topbottom>0) {
155: if (thisobjdir<0) {
156: newobj='v&'+thisobjfrom+'&'+thisobjdest+'&-1';
157: } else {
158: newobj='v&'+thisobjto+'&'+thisobjdest+'&1';
159: }
160: }
161: }
1.13 ! www 162: if ((newobj!='') && (newobj!=undefined)) {
1.1 www 163: thisobjcol=newobj.split('&')[1];
164: if (colcover.indexOf(':'+thisobjcol+':',0)==-1) {
165: colcover+=thisobjcol+':';
166: rowcont[maxrow]+=obj.length+':';
167: obj[obj.length]=newobj;
168: }
169: }
170: }
171: }
172: }
173: if (rowcont[maxrow]!=':') {
174: rowcont[maxrow]=rowcont[maxrow].substring(1,rowcont[maxrow].length-1);
175: } else {
176: rowcont[maxrow]='';
177: }
178: }
179:
180: // --------------------------------------------- Creates a new condition object
181:
182: function newcondition(content,type) {
183: var ko;
1.2 www 184: stored=0;
1.1 www 185: ko=obj.length;
186: obj[ko]='c';
187: objcont[ko]=content+':'+type+':cond';
188: return ko;
189: }
190:
191: // ---------------------------------------------- Creates a new resource object
192:
1.3 www 193: function newresource(rid,cid,text,url,ext,type) {
1.2 www 194: stored=0;
1.3 www 195: objcont[addobj(rid,'b&'+rid+'&'+cid+':0:0:0')]=
196: text+':'+url+':'+ext+':'+type+':res';
1.1 www 197: }
198:
199:
200: // -------------------------------- Insert a condition into a port of an object
201:
202: function insertcond(obj1,portnr,cond) {
203: var k;
1.2 www 204: stored=0;
1.1 www 205: data1=obj[obj1].split('&');
206: for (k=2;k<data1.length;k++) {
207: data2=data1[k].split(':');
208: if (data2[0]==portnr) {
209: data2[3]=cond;
210: data1[k]=data2.join(':');
211: }
212: }
213: obj[obj1]=data1.join('&');
214: }
215:
216: // --------------------------------------------- Insert a column into the table
217: // Inserts a new table column after table column j
218:
219: function insertcol(j) {
220: var kj;
1.2 www 221: stored=0;
1.1 www 222: for (kj=0;kj<=maxcol;kj++) {
223: if ( col[kj]>j ) { col[kj]++; }
224: }
225: maxcol++;
1.10 www 226: expense++; expense++;
1.1 www 227: col[maxcol]=j+1;
228: }
229:
230: // --------------------------------------------------------------- Find the row
231:
232: function findrow(jid) {
233: var j;
234: for (j=0;j<=maxrow;j++) { if (row[j]==jid) { return j; } }
235: return -1;
236: }
237:
238: // --------------------------------------------------------------- Find the col
239:
240: function findcol(jid) {
241: var j;
242: for (j=0;j<=maxcol;j++) { if (col[j]==jid) { return j; } }
243: return -1;
244: }
245:
246: // -------------------------------------------------------------- Map out a row
247: //
248: // b&rowID&colID:inObj:outObj:outCond&...
249: // h&rowID&incolID:outcolID&inObj:outObj&inupdown:outupdown
250: // v&colID&inObj:outObj&updown
251: //
252: // returns middle (col number of middle of obj1)
253: // sets colmap (map of cols with object numbers)
254:
255: function maprow (jid,obj1,ign) {
256: var j; var k; var left; var right; var middle;
257: middle=-1;
258: for (j=0;j<=maxcol;j++) { colmap[j]=0; }
1.13 ! www 259: if ((rowcont[jid]!='') && (rowcont[jid]!=undefined)) {
1.1 www 260: data2=rowcont[jid].split(':');
261: for (j=0;j<data2.length;j++) {
262: data3=obj[data2[j]].split('&');
263: if (data3[0]=='b') {
264: left=maxcol;
265: right=0;
266: for (k=2;k<data3.length;k++) {
267: thiscol=col[data3[k].split(':')[0]];
268: if (thiscol<left) { left=thiscol; }
269: if (thiscol>right) { right=thiscol; }
270: }
271: }
272: if (data3[0]=='h') {
273: data4=data3[2].split(':');
274: if (col[data4[1]]>col[data4[0]]) {
275: left=col[data4[0]];
276: right=col[data4[1]];
277: } else {
278: right=col[data4[0]];
279: left=col[data4[1]];
280: }
281: }
282: if (data3[0]=='v') { left=col[data3[1]]; right=left; }
283: if (data2[j]==obj1) { middle=Math.round((left+right)/2); }
284: if ((data3[0]!='h') || (ign!=1)) {
285: for (k=left;k<=right;k++) { colmap[k]=data2[j]; }
286: } else {
287: colmap[left]=data2[j];
288: colmap[right]=data2[j];
289: }
290: }
291: }
292: return middle;
293: }
294:
295: // --------------------------------------------------------- Find hole in a row
296: // jid: rowID
297: // kid: colID, find point close to this
298: // dkid: destination colID
299: // returns colID
300:
301: function comingthru (jid,kid,dkid) {
302: var k;
303: maprow(jid,-1,1);
304: knum=col[kid];
305: if (colmap[knum]==0) { return kid; }
306: right=-1;
307: for (k=knum+1;(k<colmap.length) && (right==-1);k++) {
308: if ((right==-1) && (colmap[k]!=colmap[knum])) { right=k; }
309: }
310: left=-1;
311: for (k=knum-1;(k>=0) && (left==-1);k--) {
312: if ((left==-1) && (colmap[k]!=colmap[knum])) { left=k; }
313: }
314: kup=-1;
315:
316: if ((left==-1) && (right==-1)) { right=colmap.length; }
317:
318: dknum=col[dkid];
319: dleft=left-dknum;
320: dright=right-dknum;
321:
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:
328: if (kup==right) { kup--; }
329:
330: if (kup<0) {
331: insertcol(-1);
332: insertcol(0);
333: } else {
334: insertcol(kup);
335: }
336: return maxcol;
337: }
338:
339: // ----------------------------------------------------- Insert port into block
340: // obj1: object number
341: // d: direction from middle (>0: right, <0 left)
342: // inout: in or out port (1: in, 2: out)
343: // linkobj: object that the link goes to/comes from
344: // sets inrow or outrow
345: // return column
346:
347:
348: function insertport (obj1,d,inout,linkobj) {
349:
350: var k; var port; var revport;
1.2 www 351: stored=0;
1.1 www 352: data1=obj[obj1].split('&');
353: middle=maprow(data1[1],obj1,0);
354: if (inout==1) {
355: inrow=data1[1];
356: } else {
357: outrow=data1[1];
358: }
359: if (d>0) {
360: for (k=middle;(colmap[k]==obj1) && (k<colmap.length);k++) { data3[k]=0; }
361: } else {
362: for (k=middle;(colmap[k]==obj1) && (k>=0);k--) { data3[k]=0; }
363: }
364: for (k=2;k<data1.length;k++) {
365: data2=data1[k].split(':');
366: data3[col[data2[0]]]=data2[inout];
367: }
368: port=-1;
369: if (d>0) {
370: for (k=middle;(colmap[k]==obj1) && (k<colmap.length);k++) {
371: if ((data3[k]==0) && (colmap[k]==obj1) && (port==-1)) { port=k; }
372: }
373: } else {
374: for (k=middle;(colmap[k]==obj1) && (k>=0);k--) {
375: if ((data3[k]==0) && (colmap[k]==obj1) && (port==-1)) { port=k; }
376: }
377: }
378:
379: if (port==-1) {
380: if (colmap[k]==0) {
381: revport=findcol(k);
382: if (inout==1) {
383: data1[data1.length]=revport+":"+linkobj+":0:0";
384: } else {
385: data1[data1.length]=revport+":0:"+linkobj+":0";
386: }
387: } else {
388: if (d>0) {
389: insertcol(k-1);
390: } else {
391: insertcol(k);
392: }
393: revport=maxcol;
394: if (inout==1) {
395: data1[data1.length]=revport+":"+linkobj+":0:0";
396: } else {
397: data1[data1.length]=revport+":0:"+linkobj+":0";
398: }
399: }
400: } else {
401: portfound=-1;
402: for (k=2;k<data1.length;k++) {
403: data2=data1[k].split(':');
404: if (col[data2[0]]==port) {
405: data2[inout]=linkobj;
406: data1[k]=data2.join(':');
407: portfound=1;
408: }
409: }
410: revport=findcol(port);
411: if (portfound==-1) {
412: if (inout==1) {
413: data1[data1.length]=revport+":"+linkobj+":0:0";
414: } else {
415: data1[data1.length]=revport+":0:"+linkobj+":0";
416: }
417: }
418: }
419: obj[obj1]=data1.join('&');
420: return revport;
421: }
422:
423: // ---------------------------- Make a new object and add it to the row content
424: // returns object number of generated object
425:
426: function addobj(kjid,objs) {
1.2 www 427: stored=0;
1.10 www 428: expense++;
1.13 ! www 429: if ((rowcont[kjid]!='') && (rowcont[kjid]!=undefined)) {
! 430: rowcont[kjid]+=':';
! 431: }
1.1 www 432: rowcont[kjid]+=obj.length;
433: obj[obj.length]=objs;
434: return obj.length-1;
435: }
436:
437: // ---------------------------------------- Make horizontal connection for hrid
438: // hoffs=-1: this line goes on top of hrid
439:
440: function horizontal(hrid,hoffs,hfcol,htcol,hdest,hends) {
441: hcrid=-1;
442: if (hoffs==-1) {
443: hbrid=findrow(row[hrid]-1);
444: } else {
445: hbrid=findrow(row[hrid]+1);
446: }
447: if (hbrid!=-1) {
448: maprow(hbrid,-1,0);
449: hcrid=hbrid;
450: if (col[hfcol]>col[htcol]) { left=col[htcol]; right=col[hfcol]; }
451: else { right=col[htcol]; left=col[hfcol]; }
452: if (colmap[left]!=0) {
453: hcrid=-1;
454: } else {
455: if (colmap[right]!=0) {
456: hcrid=-1;
457: } else {
458: for (kh=left+1;kh<right;kh++) {
459: if (colmap[kh]!=0) {
460: if (obj[colmap[kh]].split('&')[0]!='v') { hcrid=-1; }
461: }
462: }
463: }
464: }
465: }
466:
467: if (hcrid==-1) {
468: insertrow(row[hrid]+hoffs,hfcol,htcol);
469: addobj(maxrow,'h&'+maxrow+'&'+hfcol+':'+htcol+'&'+hdest+'&'+hends);
470: } else {
471: addobj(hcrid,'h&'+hcrid+'&'+hfcol+':'+htcol+'&'+hdest+'&'+hends);
472: }
473: }
474:
475: // --------------------------------------- Deletes all references to object obj
476:
477: function delobj(obj1) {
478: var k;
1.2 www 479: stored=0;
1.1 www 480: for (k=0;k<rowcont.length;k++) {
481: data4=rowcont[k].split(':');
482: rowcont[k]='';
483: for (k2=0;k2<data4.length;k2++) {
484: if (data4[k2]!=obj1) {
1.13 ! www 485: if ((rowcont[k]!='') && (rowcont[k]!=undefined)) {
! 486: rowcont[k]+=':';
! 487: }
1.1 www 488: rowcont[k]+=data4[k2];
489: }
490: }
491: }
1.11 www 492: obj[obj1]='';
1.1 www 493: }
494:
495: // --------------------------------------------------------- Garbage collection
496:
497: function cleanup () {
1.3 www 498: message("Garbage Collection");
1.1 www 499: var j,kj,i;
1.3 www 500: disrows=0;
501: discols=0;
1.5 www 502: var emptyspots=0;
1.3 www 503:
1.1 www 504: for (kj=0;kj<=maxcol;kj++) { data1[kj]=0; }
505: for (kj=0;kj<=maxrow;kj++) {
506: rowtype[kj]=0;
1.13 ! www 507: if ((rowcont[kj]!='') && (rowcont[kj]!=undefined)) {
1.1 www 508: data2=rowcont[kj].split(':');
509: for (j=0;j<data2.length;j++) {
510: if (obj[data2[j]].substring(0,2)=='e&') {
511: rowtype[kj]=2;
512: data1[(obj[data2[j]].split('&'))[1]]=2;
513: }
514: }
515: maprow(kj,-1,1);
516: for (j=0;j<=maxcol;j++) {
517: if (colmap[j]!=0) {
518: if (data1[j]==0) { data1[j]=1; }
519: if (rowtype[kj]==0) {
520: if (obj[colmap[j]].substring(0,2)!='v&') {
521: rowtype[kj]=1;
522: }
523: }
524: if (obj[colmap[j]].substring(0,2)=='b&') {
525: data1[j]=2;
1.5 www 526: if (colmap[maxcol]==0) { emptyspots++; }
1.1 www 527: rowtype[kj]=2;
528: }
529: }
530: }
531: }
532: }
533: for (j=0;j<=maxcol;j++) {
1.3 www 534: coltype[j]=data1[col[j]];
535: if (coltype[j]!=0) { discols+=1; }
536: }
537: for (j=0;j<=maxrow;j++) {
538: if (rowtype[j]==2) { disrows+=3; }
539: if (rowtype[j]==1) { disrows+=1; }
1.1 www 540: }
1.5 www 541: if (emptyspots==0) {
542: insertrow(maxrow);
543: insertcol(maxcol);
544: addobj(maxrow,'e&'+maxcol);
545: discols++;
546: disrows++;
547: rowtype[maxrow]=2;
548: coltype[maxcol]=2;
549: }
550:
1.1 www 551: }
552:
553: // -------------------------------------------- Delete a condition from a block
554:
555: function delcond(obj1,colid) {
556: var k;
1.2 www 557: stored=0;
1.1 www 558: data3=obj[obj1].split('&');
559: obj[obj1]=data3[0]+'&'+data3[1];
560: for (k=2;k<data3.length;k++) {
561: data4=data3[k].split(':');
1.4 www 562: if (data4[0]==colid) {
563: data4[3]=0;
564: objlinks[data4[2]]=(objlinks[data4[2]].split(':'))[0]+':'+
565: (objlinks[data4[2]].split(':'))[1]+':0';
566: }
1.1 www 567: if ((data4[1]!=0) || (data4[2]!=0) || (data3.length==3)) {
568: obj[obj1]+='&'+data4[0]+':'+data4[1]+':'+data4[2]+':'+data4[3];
569: }
570: }
571: }
1.3 www 572:
1.1 www 573: // ----------------------------------------- Creates a new condition in a block
574:
575: function crecond(obj1,colid,condtext,condtype) {
576: var k;
577: data3=obj[obj1].split('&');
578: obj[obj1]=data3[0]+'&'+data3[1];
579: for (k=2;k<data3.length;k++) {
580: data4=data3[k].split(':');
581: if (data4[0]==colid) {
582: data4[3]=newcondition(condtext,condtype);
583: data2=objlinks[data4[2]].split(':');
584: objlinks[data4[2]]=data2[0]+':'+data2[1]+':'+data4[3];
585: }
586: if ((data4[1]!=0) || (data4[2]!=0) || (data3.length==3)) {
587: obj[obj1]+='&'+data4[0]+':'+data4[1]+':'+data4[2]+':'+data4[3];
588: }
589: }
590: }
591:
592: // ---------------------------------------- Delete the path between two objects
593: // deletes the link linknr
594: // h&rowID&incolID:outcolID&inObj:outObj&inupdown:outupdown
595: // v&colID&inObj:outObj&updown
596:
597: function dellink (linknr) {
598: var k; var obj1; var obj2;
1.2 www 599: stored=0;
1.13 ! www 600: if ((objlinks[linknr]!='') && (objlinks[linknr]!=undefined)) {
1.1 www 601: data3=objlinks[linknr].split(':');
602: obj1=data3[0];
603: obj2=data3[1];
604: data3=obj[obj1].split('&');
605: obj[obj1]=data3[0]+'&'+data3[1];
606: for (k=2;k<data3.length;k++) {
607: data4=data3[k].split(':');
608: if (data4[2]==linknr) { data4[2]=0; data4[3]==0; }
609: if ((data4[1]!=0) || (data4[2]!=0) || (data3.length==3)) {
610: obj[obj1]+='&'+data4[0]+':'+data4[1]+':'+data4[2]+':'+data4[3];
611: }
612: }
613: data3=obj[obj2].split('&');
614: obj[obj2]=data3[0]+'&'+data3[1];
615: for (k=2;k<data3.length;k++) {
616: data4=data3[k].split(':');
617: if (data4[1]==linknr) { data4[1]=0; }
618: if ((data4[1]!=0) || (data4[2]!=0) || (data3.length==3)) {
619: obj[obj2]+='&'+data4[0]+':'+data4[1]+':'+data4[2]+':'+data4[3];
620: }
621: }
622: for (k=0;k<obj.length;k++) {
1.13 ! www 623: if ((obj[k]!='') && (obj[k]!=undefined)) {
1.1 www 624: data3=obj[k].split('&');
625: if (((data3[0]=='v') || (data3[0]=='h')) &&
626: (data3[data3.length-2]==linknr)) {
627: delobj(k);
628: }
629: }
630: }
631: objlinks[linknr]='';
632: }
633: }
634:
635: // ----------------------------------------------------------- Join two objects
636: // Links obj1 with obj2, creates new objlink, marks all elements with number
637:
638: function joinres (obj1,obj2,cond) {
1.10 www 639: stored=0;
640: var minexpense;
641: var best;
642:
643: expense=0;
644: tryjoin(obj1,obj2,cond,1,1);
645: minexpense=expense;
646: best=0;
647: finishload();
648:
649: expense=0;
650: tryjoin(obj1,obj2,cond,1,-1);
651: if (expense<minexpense) {
652: best=1;
653: minexpense=expense;
654: }
655: finishload();
656:
657: expense=0;
658: tryjoin(obj1,obj2,cond,-1,1);
659: if (expense<minexpense) {
660: best=2;
661: minexpense=expense;
662: }
663: finishload();
664:
665: expense=0;
666: tryjoin(obj1,obj2,cond,-1,-1);
667: if (expense<minexpense) {
668: best=3;
669: minexpense=expense;
670: }
671:
672:
673: if (best==0) {
674: finishload();
675: tryjoin(obj1,obj2,cond,1,1);
676: }
677: if (best==1) {
678: finishload();
679: tryjoin(obj1,obj2,cond,1,-1);
680: }
681: if (best==2) {
682: finishload();
683: tryjoin(obj1,obj2,cond,-1,1);
684: }
1.11 www 685:
1.10 www 686: }
687:
688:
689: function tryjoin(obj1,obj2,cond,d1,d2) {
1.11 www 690: var k; var kr; var outcol; var incol; var d; var dest;
1.10 www 691:
1.1 www 692: dest=objlinks.length;
693: objlinks[dest]=obj1+':'+obj2+':'+cond;
1.10 www 694:
695: outcol=insertport(obj1,d1,2,dest);
1.1 www 696: insertcond(obj1,outcol,cond);
1.10 www 697: incol=insertport(obj2,d2,1,dest);
1.1 www 698: if (row[inrow]==(row[outrow]+1)) {
699: insertrow(row[outrow],-1,-1);
700: }
701: if (row[inrow]<row[outrow]) {
702: updown=1;
703: tcol=comingthru(inrow,incol,outcol);
704: horizontal(inrow,-1,tcol,incol,dest,'-1:-1');
705: addobj(inrow,'v&'+tcol+'&'+dest+'&1');
706: incol=tcol;
707: tcol=comingthru(outrow,outcol,incol);
708: horizontal(outrow,0,outcol,tcol,dest,'1:1');
709: addobj(outrow,'v&'+tcol+'&'+dest+'&1');
710: outcol=tcol;
711: } else {
712: updown=-1;
713: }
714:
715: if (inrow==outrow) {
716: tcol=comingthru(inrow,incol,outcol);
717: horizontal(inrow,-1,tcol,incol,dest,'-1:-1');
718: addobj(inrow,'v&'+tcol+'&'+dest+'&1');
719: horizontal(outrow,0,outcol,tcol,dest,'1:1');
720: } else {
721:
722: if (updown==-1) {
723: for (kr=row[outrow]+1;kr<row[inrow];kr++) {
724: rid=findrow(kr);
725: ncol=comingthru(rid,outcol,incol);
726:
727: if (ncol!=outcol) {
728: insertrow(kr-1,outcol,ncol);
729: kr++;
730: if (col[outcol]>col[ncol]) {
731: addobj(maxrow,
732: 'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&-1:1');
733: } else {
734: addobj(maxrow,
735: 'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&1:-1');
736: }
737: }
738: addobj(rid,'v&'+ncol+'&'+dest+'&-1');
739: outcol=ncol;
740: }
741:
742: if (incol!=outcol) {
743: insertrow(row[inrow]-1,outcol,incol);
744: if (col[outcol]>col[incol]) {
745: addobj(maxrow,
746: 'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&-1:1');
747: } else {
748: addobj(maxrow,
749: 'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&1:-1');
750: }
751: }
752:
753: } else {
754: for (kr=row[outrow]-1;kr>row[inrow];kr--) {
755: rid=findrow(kr);
756: ncol=comingthru(rid,outcol,incol);
757: if (ncol!=outcol) {
758: insertrow(kr,outcol,ncol);
759: if (col[outcol]>col[ncol]) {
760: addobj(maxrow,
761: 'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&1:-1');
762: } else {
763: addobj(maxrow,
764: 'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&-1:1');
765: }
766: }
767: addobj(rid,'v&'+ncol+'&'+dest+'&1');
768: outcol=ncol;
769: }
770: if (incol!=outcol) {
771: insertrow(row[inrow],outcol,incol);
772: if (col[outcol]>col[incol]) {
773: addobj(maxrow,
774: 'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&1:-1');
775: } else {
776: addobj(maxrow,
777: 'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&-1:1');
778: }
779: }
780: }
781: }
782: }
783:
784: // ---------------------------------------------------------- Delete a resource
785: // Deletes resource obj1
786: // Reconnects resources going thru this one if recon=1
787:
788: function delres (obj1,recon) {
789: var infromobj=new Array();
790: var inwithcon=new Array();
791: var inwithlink=new Array();
792: var outtoobj=new Array();
793: var outwithcon=new Array();
794: var outwithlink=new Array();
795: var inobjs=new Array();
796: var inobjscond=new Array();
797: var outobjs=new Array();
798: var outobjscond=new Array();
799:
800: var k; var k1; var k2; var found;
801:
1.2 www 802: stored=0;
803:
1.1 www 804: data1=obj[obj1].split('&');
805: for (k=2;k<data1.length;k++) {
806: data2=data1[k].split(':');
807: if (data2[1]!=0) {
808: k2=inwithlink.length;
809: inwithlink[k2]=data2[1];
810: data3=objlinks[data2[1]].split(':');
811: infromobj[k2]=data3[0];
812: inwithcon[k2]=data3[2];
813: }
814: if (data2[2]!=0) {
815: k2=outwithlink.length;
816: outwithlink[k2]=data2[2];
817: data3=objlinks[data2[2]].split(':');
818: outtoobj[k2]=data3[1];
819: outwithcon[k2]=data3[2];
820: }
821: }
822: for (k=0;k<inwithlink.length;k++) { dellink(inwithlink[k]); }
823: for (k=0;k<outwithlink.length;k++) { dellink(outwithlink[k]); }
824: delobj(obj1);
1.3 www 825: objcont[obj1]='';
1.1 www 826: if (recon==1) {
1.3 www 827: message("Reconnecting");
1.1 www 828: for (k=0;k<inwithlink.length;k++) {
829: if (infromobj[k]!=obj1) {
830: found=0;
831: for (k2=0;k2<inobjs.length;k2++) {
832: if (inobjs[k2]==infromobj[k]) {
833: if (inwithcon[k]!=0) {
1.13 ! www 834: if ((inobjscond[k2]!='') &&
! 835: (inobjscond[k2]!=undefined)) {
! 836: inobjscond[k2]+='||';
! 837: }
1.1 www 838: inobjscond[k2]+=
839: '('+(objcont[inwithcon[k]].split(':'))[0]+')';
840: }
841: found=1;
842: }
843: }
844: if (found==0) {
845: k2=inobjs.length;
846: inobjs[k2]=infromobj[k];
847: if (inwithcon[k]==0) {
848: inobjscond[k2]='';
849: } else {
850: inobjscond[k2]=
851: '('+(objcont[inwithcon[k]].split(':'))[0]+')';
852: }
853: }
854: }
855: }
856:
857: for (k=0;k<outwithlink.length;k++) {
858: if (outtoobj[k]!=obj1) {
859: found=0;
860: for (k2=0;k2<outobjs.length;k2++) {
861: if (outobjs[k2]==outtoobj[k]) {
862: if (outwithcon[k]!=0) {
1.13 ! www 863: if ((outobjscond[k2]!='') &&
! 864: (outobjscond[k2]!=undefined)) {
! 865: outobjscond[k2]+='||';
! 866: }
1.1 www 867: outobjscond[k2]+=
868: '('+(objcont[outwithcon[k]].split(':'))[0]+')';
869: }
870: found=1;
871: }
872: }
873: if (found==0) {
874: k2=outobjs.length;
875: outobjs[k2]=outtoobj[k];
876: if (outwithcon[k]==0) {
877: outobjscond[k2]='';
878: } else {
879: outobjscond[k2]=
880: '('+(objcont[outwithcon[k]].split(':'))[0]+')';
881: }
882: }
883: }
884: }
885:
886: for (k=0;k<inobjs.length;k++) {
887: cond='';
1.13 ! www 888: if ((inobjscond[k]!='') && (inobjscond[k]!=undefined)) {
! 889: cond='('+inobjscond[k]+')';
! 890: }
1.1 www 891: for (k2=0;k2<outobjs.length;k2++) {
892: thiscond=cond;
1.13 ! www 893: if ((outobjscond[k2]!='') && (outobjscond[k2]!=undefined)) {
! 894: if ((thiscond!='') && (thiscond!=undefined)) {
! 895: thiscond+='&&';
! 896: }
1.1 www 897: thiscond+='('+outobjscond[k2]+')';
898: }
899: condnr=0;
1.13 ! www 900: if ((thiscond!='') && (thiscond!=undefined)) {
! 901: condnr=newcondition(thiscond,'normal');
! 902: }
1.12 www 903: save();
1.1 www 904: joinres(inobjs[k],outobjs[k2],condnr);
905: }
906: }
907: }
908: }
909:
910: // -------------------------------------------------------------- Draw an entry
911:
1.2 www 912: function drawcell (rtype,ctype,what,cm,obj1,ej,ek,ne) {
1.1 www 913: var bgcolor;
1.4 www 914: if ((what=='') && (ne==0)) { cm="#DDDDDD"; }
1.1 www 915: if (ctype!=0) {
916: parent.mapout.document.write('<td bgcolor='+cm+' width='+cw[ctype]+'>');
1.13 ! www 917: if ((what!='') && (what!=undefined)) {
! 918: if ((obj1!='') && (obj1!=undefined)) {
1.1 www 919: obj1="'"+obj1+"'";
920: parent.mapout.document.write
921: ('<a href="javascript:parent.code.handler('+obj1
922: +');" onMouseOver="parent.code.info('+obj1+');">');
923: }
924: if (what=='r:') {
925: parent.mapout.document.write
1.4 www 926: ('<img border=0 width='+cw[ctype]+' height='+rh[rtype]
927: +' src="resource.gif">');
1.1 www 928: } else {
929: if (what=='c:') {
930: parent.mapout.document.write
1.4 www 931: ('<img border=0 width='+cw[ctype]+' height='+rh[rtype]
932: +' src="condition.gif">');
1.1 www 933: } else {
1.5 www 934: if (what=='rs:') {
935: parent.mapout.document.write
936: ('<img border=0 width='+cw[ctype]+' height='+rh[rtype]
937: +' src="start.gif">');
938: } else {
939: if (what=='rf:') {
940: parent.mapout.document.write
941: ('<img border=0 width='+cw[ctype]+' height='+rh[rtype]
942: +' src="finish.gif">');
943: } else {
944: parent.mapout.document.write
945: ('<img border=0 width='+cw[ctype]+' height='+rh[rtype]
946: +' src="'+rtype+'.'+ctype+'.'+what+'.gif">');
947: }
948: }
1.1 www 949: }
950: }
1.13 ! www 951: if ((obj1!='') && (obj1!=undefined)) {
1.1 www 952: parent.mapout.document.write('</a>');
953: }
954: } else {
955: if (ne!=1) {
956: parent.mapout.document.write
957: ('<a href="javascript:parent.code.empty('+ej+','+ek+');" ');
958: } else {
959: parent.mapout.document.write
960: ('<a href="javascript:parent.code.infoclear();" ');
961: }
962: parent.mapout.document.write
963: ('onMouseOver="parent.code.infoclear();">');
964: parent.mapout.document.write
1.4 www 965: (
966: '<img border=0 width='+cw[ctype]+' height='+rh[rtype]
967: +' src="'+rtype+'.'+ctype+'.empty.gif"></a>');
1.1 www 968: }
969: parent.mapout.document.write('</td>');
970: }
971: }
972:
1.4 www 973: // --------------------------------------------------------- Color of resources
974:
975: function rescolor (ext,typ) {
976: var rc; var gc; var bc;
977: if (ext=='true') { bc='55'; } else { bc='99'; }
978: if (typ=='mandatory') { rc='FF'; } else { rc='BB'; }
979: if (typ=='optional') { gc='BB'; } else { gc='FF'; }
1.5 www 980: if ((typ=='start') || (typ=='finish')) { rc='AA'; gc='AA'; bc='FF'; }
1.4 www 981: return '#'+rc+gc+bc;
982: }
983:
984: // -------------------------------------------------------- Color of conditions
985:
986: function condcolor(typ) {
987: if (typ=='stop') { return '#EEAAAA'; }
988: if (typ=='force') { return '#AAAAEE'; }
989: return '#EEEEAA';
990: }
991:
1.1 www 992: // ----------------------------------------------------------------- Draw a row
993:
1.2 www 994: function drawrow (jid) {
1.5 www 995: var j; var jk; var k; var ck; var rtype;
1.1 www 996: var objd1=new Array();
997: var objd2=new Array();
998: var notempty=new Array();
999: var condtype;
1000: if (rowtype[jid]!=0) {
1001: for (j=0;j<=maxcol;j++) {
1002: colmap[j]=''; colmap2[j]=''; colmap3[j]=''; colmap4[j]='';
1.3 www 1003: colmap5[j]='#CCCCCC'; colmap6[j]='#CCCCCC';
1.1 www 1004: objd1[j]=''; objd2[j]=''; notempty[j]=0;
1005: }
1.3 www 1006:
1.1 www 1007: parent.mapout.document.writeln('<tr height='+rh[rowtype[jid]]+'>');
1.13 ! www 1008: if ((rowcont[jid]!='') && (rowcont[jid]!=undefined)) {
1.1 www 1009: data2=rowcont[jid].split(':');
1010: for (jk=0;jk<data2.length;jk++) {
1011: data3=obj[data2[jk]].split('&');
1012: if (data3[0]=='b') {
1.3 www 1013: data1=objcont[data2[jk]].split(':');
1.5 www 1014: rtype=data1[3];
1.4 www 1015: ck=rescolor(data1[2],data1[3]);
1.1 www 1016: left=maxcol;
1017: leftin=maxcol;
1018: leftout=maxcol;
1019: right=0;
1020: rightin=0;
1021: rightout=0;
1022: anyout=0;
1023: for (k=2;k<data3.length;k++) {
1024: data1=data3[k].split(':');
1025: thiscol=col[data1[0]];
1026: if (thiscol<left) { left=thiscol; }
1027: if (thiscol>right) { right=thiscol; }
1028: if (data1[1]!=0) {
1029: if (thiscol<leftin) { leftin=thiscol; }
1030: if (thiscol>rightin) { rightin=thiscol; }
1031: colmap4[thiscol]=data1[1];
1032: }
1033: if (data1[2]!=0) {
1034: if (thiscol<leftout) { anyout=1; leftout=thiscol; }
1035: if (thiscol>rightout) { anyout=1; rightout=thiscol; }
1036: if (data1[3]!=0) {
1037: colmap3[thiscol]='c:';
1038: condtype=(objcont[data1[3]].split(':'))[1];
1.4 www 1039: colmap6[thiscol]=condcolor(condtype);
1.1 www 1040: objd2[thiscol]='c&'
1041: +data1[0]+'&'+data2[jk]+'&'+data1[2]+'&'+data1[3];
1042: } else {
1043: colmap3[thiscol]='ctd';
1044: colmap6[thiscol]=ck;
1045: objd2[thiscol]='c&'
1046: +data1[0]+'&'+data2[jk]+'&'+data1[2]+'&-';
1047: }
1048: }
1049: }
1050: for (k=left;k<=right;k++) { notempty[k]=1; colmap5[k]=ck; }
1051: middle=Math.round((left+right)/2);
1.5 www 1052: if (rtype=='start') {
1053: colmap[middle]='rs:';
1054: } else {
1055: if (rtype=='finish') {
1056: colmap[middle]='rf:';
1057: } else {
1058: colmap[middle]='r:';
1059: }
1060: }
1.1 www 1061: objd1[middle]+='r&'+data2[jk];
1062:
1063: if (rightin>middle) {
1064: for (k=middle+1;k<rightin;k++) {
1.13 ! www 1065: if ((colmap4[k]!='') && (colmap4[k]!=undefined)) {
1.1 www 1066: colmap[k]='rlt';
1067: } else {
1068: colmap[k]='rl';
1069: }
1070: }
1071: colmap[rightin]='tl';
1072: }
1073: if (leftin<middle) {
1074: for (k=middle-1;k>leftin;k--) {
1.13 ! www 1075: if ((colmap4[k]!='') && (colmap4[k]!=undefined)) {
1.1 www 1076: colmap[k]='lrt';
1077: } else {
1078: colmap[k]='lr';
1079: }
1080: }
1081: colmap[leftin]='tr';
1082: }
1083:
1084: if ((leftout>middle) && (anyout)) {
1085: colmap2[middle]='tr';
1086: }
1087: if (leftout==middle) {
1088: if (rightout==middle) { colmap2[middle]='td'; }
1089: if (rightout>middle) { colmap2[middle]='rtd'; }
1090: }
1091: if (leftout<middle) {
1092: if (rightout<middle) { colmap2[middle]='tl'; }
1093: if (rightout==middle) { colmap2[middle]='tdl'; }
1094: if (rightout>middle) {
1.13 ! www 1095: if ((colmap3[middle]!='') && (colmap3[middle]!=undefined)) {
1.1 www 1096: colmap2[middle]='rtdl';
1097: } else {
1098: colmap2[middle]='rtl';
1099: }
1100: }
1101: }
1102: if (leftout<middle) {
1103: for (k=middle-1;k>leftout;k--) {
1.13 ! www 1104: if ((colmap3[k]!='') && (colmap3[k]!=undefined)) {
1.1 www 1105: colmap2[k]='rld';
1106: } else {
1107: colmap2[k]='rl';
1108: }
1109: }
1110: colmap2[leftout]='rd';
1111: }
1112: if (rightout>middle) {
1113: for (k=middle+1;k<rightout;k++) {
1.13 ! www 1114: if ((colmap3[k]!='') && (colmap3[k]!=undefined)) {
1.1 www 1115: colmap2[k]='lrd';
1116: } else {
1117: colmap2[k]='lr';
1118: }
1119: }
1120: colmap2[rightout]='ld';
1121: }
1122: }
1123: if (data3[0]=='h') {
1124: data4=data3[2].split(':');
1125: if (col[data4[1]]>col[data4[0]]) {
1126: left=col[data4[0]];
1127: right=col[data4[1]];
1128: thisarrow='lr';
1129: } else {
1130: right=col[data4[0]];
1131: left=col[data4[1]];
1132: thisarrow='rl';
1133: }
1134: if (data3[4].split(':')[0]==1) {
1135: colmap[left]='tr';
1136: } else {
1137: colmap[left]='rd'; colmap2[left]='utd'; colmap3[left]='utd';
1138: }
1.4 www 1139: notempty[left]=1;
1140: notempty[right]=1;
1.1 www 1141: for (k=left+1;k<right;k++) {
1.4 www 1142: notempty[k]=1;
1.1 www 1143: if (colmap[k]=='') {
1144: colmap[k]=thisarrow;
1145: objd1[k]=data2[jk];
1146: } else {
1147: colmap[k]='tdrl';
1148: objd1[k]='';
1149: }
1150: }
1151: if (data3[4].split(':')[1]==1) {
1152: colmap[right]='tl';
1153: } else {
1154: colmap[right]='ld'; colmap2[right]='utd'; colmap3[right]='utd';
1155: }
1156: objd1[left]=data2[jk];
1157: objd1[right]=data2[jk];
1158: }
1159: if (data3[0]=='v') {
1160: left=col[data3[1]];
1161: if (colmap[left]=='') {
1162: if (data3[3]==1) { colmap[left]='dt'; } else { colmap[left]='td'; }
1.3 www 1163: objd1[left]=data2[jk]+'&'+jid;
1.1 www 1164: objd2[left]=objd1[left];
1165: } else {
1166: colmap[left]='tdrl';
1167: objd1[left]='';
1168: }
1169: colmap2[left]='utd'; colmap3[left]='utd';
1170: }
1171: }
1172: rtype=rowtype[jid];
1173: for (k=0;k<=maxcol;k++) {
1.2 www 1174: drawcell(rtype,coltype[rcol[k]],colmap[k],colmap5[k],objd1[k],jid,k,
1.1 www 1175: notempty[k]);
1176: }
1177: if (rowtype[jid]==2) {
1.3 www 1178: parent.mapout.document.writeln('</tr>');
1.5 www 1179: parent.mapout.document.writeln('<tr height='+rh[1]+'>');
1.1 www 1180: for (k=0;k<=maxcol;k++) {
1.3 www 1181: drawcell(1,coltype[rcol[k]],colmap2[k],colmap5[k],objd2[k],jid,k,
1182: notempty[k]);
1.1 www 1183: }
1.3 www 1184: parent.mapout.document.writeln('</tr>');
1.5 www 1185: parent.mapout.document.writeln('<tr height='+rh[1]+'>');
1.1 www 1186: for (k=0;k<=maxcol;k++) {
1.3 www 1187: drawcell(1,coltype[rcol[k]],colmap3[k],colmap6[k],objd2[k],jid,k,
1188: notempty[k]);
1.1 www 1189: }
1190: }
1191: }
1192: parent.mapout.document.writeln('</tr>');
1193: }
1194: }
1195:
1.3 www 1196: // -------------------------------------------------------------- Print message
1197:
1198: function message(txt) {
1199: parent.window.status=txt;
1200: }
1201:
1.1 www 1202: // ------------------------------------------------------------- Draw the table
1203:
1.2 www 1204: function draw () {
1.1 www 1205: var k; var kr;
1206:
1207: cleanup();
1.2 www 1208: save();
1.1 www 1209:
1210: rh[0]=0;
1.4 www 1211: rh[1]=zscale*10;
1212: rh[2]=zscale*20;
1.1 www 1213: cw[0]=0;
1.4 www 1214: cw[1]=zscale*10;
1215: cw[2]=zscale*20;
1216:
1.1 www 1217: parent.mapout.document.open('text/html','replace');
1218: parent.mapout.document.writeln('<html><body bgcolor="#FFFFFF">');
1.3 www 1219:
1.2 www 1220: if (tablemode==0) {
1.3 www 1221: if (graphdef=='no') { graphopt(); cleanup(); }
1222: for (k=0;k<=maxrow;k++) { rrow[row[k]]=k; }
1223: for (k=0;k<=maxcol;k++) { rcol[col[k]]=k; }
1.4 www 1224: parent.mapout.document.writeln(
1.3 www 1225: '<table cellpadding=0 cellspacing=0 border=0 rows='
1226: +disrows+' cols='+discols+'>');
1.7 www 1227: for (kr=0;kr<=maxrow;kr++) {
1.4 www 1228: message("Generating Output Row "+kr);
1229: drawrow(rrow[kr]);
1230: }
1.2 www 1231: } else {
1.3 www 1232: message("Generating Table Output");
1.4 www 1233: for (k=0;k<=maxrow;k++) { rrow[row[k]]=k; }
1234: for (k=0;k<=maxcol;k++) { rcol[col[k]]=k; }
1235:
1.3 www 1236: parent.mapout.document.writeln( '<table>');
1.4 www 1237: if (tablemode==1) {
1238: tabledraw();
1239: } else {
1240: simpletabledraw();
1241: }
1.2 www 1242: }
1.1 www 1243:
1244: parent.mapout.document.writeln('</table>');
1245: parent.mapout.document.writeln('</body></html>');
1246: parent.mapout.document.close();
1247: parent.focus();
1248: parent.mapout.focus();
1249: }
1250:
1251: // --------------------------------------------------------- Clears info window
1252:
1253: function infoclear() {
1254: if (notclear!=1) {
1.5 www 1255: infcheck();
1.1 www 1256: inf.document.clear();
1257: inf.document.writeln
1258: ('<html><body bgcolor="#FFFFFF"><table><tr><td>'+
1259: '<img src="/adm/lonIcons/lonlogos.gif"></td>');
1260: if (linkmode!=0) {
1.4 www 1261: if (tablemode==0) {
1.1 www 1262: inf.document.writeln(
1263: '<td><b>Link Mode</b><hr>Click on a resource to link it with<br><b>'+
1264: (objcont[linkmode].split(':'))[0]+
1265: '</b><br>click anywhere else to cancel.</td>');
1.4 www 1266: } else {
1267: inf.document.writeln(
1268: '<td><b>Link Mode</b><hr>Click on a resource number to link it with<br><b>'+
1269: (objcont[linkmode].split(':'))[0]+'</b><br>'+
1270: '<a href="javascript:opener.linkmode=0;opener.notclear=0;opener.infoclear();">'
1271: +'Cancel</a></td>');
1272: }
1.3 www 1273: } else {
1.4 www 1274: if (tablemode==0) {
1.3 www 1275: inf.document.writeln(
1.4 www 1276: '<td><b>Click to Edit</b><hr>Click in a light gray area<br>'
1277: +'to insert resources, columns and rows</td>'
1.3 www 1278: );
1.4 www 1279: }
1.1 www 1280: }
1281: inf.document.writeln('</tr></table></body></html>');
1282: inf.document.close();
1283: parent.focus();
1284: parent.mapout.focus();
1285: notclear=1;
1286: lastinfo='';
1287: }
1288: }
1289:
1.5 www 1290: // ------------------------------------------------------------ Open inf window
1291:
1292: function infopen() {
1293: var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300";
1294: inf=open("","infout",options);
1295: }
1296:
1297: // -------------------------------------------------------- Do inf status check
1298:
1299: function infcheck() {
1300: if (inf.closed) {
1301: infopen();
1302: }
1303: }
1304:
1.1 www 1305: // --------------------------------------------------- Prints out resource info
1306:
1307: function info(infostr) {
1308: if ((editmode!=1) && (infostr!=lastinfo)) {
1309: notclear=1;
1.5 www 1310: infcheck();
1.1 www 1311: inf.document.clear();
1312: inf.document.writeln(
1313: '<html><body bgcolor="#FFFFFF">'+
1314: '<table><tr><td width=32><img src="info.gif"></td><td bgcolor="#AAFFAA">');
1315: data1=infostr.split('&');
1316: if (data1[0]=='c') {
1317: inf.document.write('<b>Condition (');
1318: data3=objlinks[data1[3]].split(':');
1319: if (data1[4]=='-') {
1320: inf.document.write('not set');
1321: } else {
1322: data2=objcont[data1[4]].split(':');
1323: if (data2[1]=='force') {
1324: inf.document.write('Blocking Other Links');
1325: } else {
1326: if (data2[1]=='stop') {
1327: inf.document.write('Blocking This Link');
1328: } else {
1329: inf.document.write('Recommendation');
1330: }
1331: }
1332: }
1333: inf.document.writeln(')</b><hr>From <b>'+objcont[data3[0]].split(':')[0]+
1334: '</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
1335: } else {
1336: if (data1[0]=='r') {
1337: data2=objcont[data1[1]].split(':');
1.3 www 1338: inf.document.write('<b>');
1339: if (data2[2]=='true') { inf.document.write('External '); }
1.5 www 1340: if (data2[3]=='start') {
1341: inf.document.writeln('<b>Start</b>');
1342: } else {
1343: if (data2[3]=='finish') {
1344: inf.document.writeln('<b>Finish</b>');
1345: } else {
1346: inf.document.writeln('<b>Resource</b>');
1347: }
1348: }
1.3 www 1349: if (data2[3]=='mandatory') {
1350: inf.document.write(' (Mandatory)');
1351: }
1352: if (data2[3]=='optional') {
1353: inf.document.write(' (Optional)');
1354: }
1355: inf.document.writeln('</b><hr><b>'+data2[0]+'</b><br>');
1.1 www 1356: inf.document.writeln((data2[1].split('/')).join(' / '));
1357: } else {
1358: inf.document.writeln('<b>Link</b><hr>');
1359: data2=obj[data1[0]].split('&');
1360: data3=objlinks[data2[data2.length-2]].split(':');
1361: inf.document.writeln('From <b>'+objcont[data3[0]].split(':')[0]+
1362: '</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
1363: }
1364: }
1365: if (linkmode==0) {
1366: inf.document.writeln('<p>(click to edit)');
1367: } else {
1368: if (data1[0]=='r') {
1369: inf.document.writeln('<p>(click to link)');
1370: } else {
1371: inf.document.writeln('<p>(click to cancel linking and edit)');
1372: }
1373: }
1374: inf.document.writeln('</td></tr></table></body></html>');
1375: inf.document.close();
1376: parent.focus();
1377: parent.mapout.focus();
1378: notclear=0;
1379: lastinfo=infostr;
1380: }
1381: }
1382:
1383: // ------------------------------------------------ "Escapes" out special chars
1384:
1385: function escape(instring) {
1386: var outstring='';
1387: var thischar;
1388: var k;
1389: for (k=0;k<instring.length;k++) {
1390: thischar=instring.charAt(k);
1391: if (thischar==':') { thischar=':'; }
1392: if (thischar=='"') { thischar='"'; }
1393: if (thischar=="'") { thischar='''; }
1394: if (thischar==',') { thischar=','; }
1395: outstring+=thischar;
1396: }
1397: return outstring;
1398: }
1399:
1.2 www 1400: // -------------------------------------------------- Insert resource into link
1401:
1402: function insertreslink(infostr) {
1.3 www 1403: var lnr;
1404: var fobj;
1405: var tobj;
1406: var nobj;
1407: var cobj;
1.5 www 1408: var cid;
1409: var rid;
1.3 www 1410: data1=infostr.split('&');
1411: data2=obj[data1[0]].split('&');
1412: lnr=data2[data2.length-2];
1413: data3=objlinks[lnr].split(':');
1414: fobj=data3[0];
1415: tobj=data3[1];
1416: cobj=data3[2];
1417: if (data2[0]=='v') {
1418: rid=data1[1];
1419: cid=data2[1];
1420: } else {
1421: rid=data2[1];
1422: cid=(data2[2].split(':'))[0];
1423: }
1424: dellink(lnr);
1425: newresource(rid,cid,'','','false','normal');
1426: nobj=obj.length-1;
1.12 www 1427: save();
1.3 www 1428: joinres(fobj,nobj,cobj);
1.12 www 1429: save();
1.3 www 1430: joinres(nobj,tobj,0);
1.2 www 1431: }
1432:
1.5 www 1433: // -------------------------------------------- Insert resource after condition
1434:
1435: function insertcondlink(cid,lnr) {
1436: var fobj;
1437: var tobj;
1438: var nobj;
1439: var cobj;
1440: data3=objlinks[lnr].split(':');
1441: fobj=data3[0];
1442: tobj=data3[1];
1443: cobj=data3[2];
1444: rid=(obj[fobj].split('&'))[1];
1445: insertrow(row[rid]);
1446: dellink(lnr);
1447: newresource(maxrow,cid,'','','false','normal');
1448: nobj=obj.length-1;
1.12 www 1449: save();
1.5 www 1450: joinres(fobj,nobj,cobj);
1.12 www 1451: save();
1.5 www 1452: joinres(nobj,tobj,0);
1453: }
1454:
1.1 www 1455: // ---------------------------------------------------- Handles "click to edit"
1456:
1457: function handler(infostr) {
1458: var k;
1459: editmode=1;
1460: notclear=1;
1.5 www 1461: infcheck();
1.1 www 1462: inf.document.clear();
1463: inf.document.writeln(
1464: '<html><body bgcolor="#FFFFFF">'+
1465: '<table><tr><td width=32><img src="edit.gif"></td><td bgcolor="#AAFFAA">');
1466: data1=infostr.split('&');
1467: if (data1[0]=='c') {
1468: inf.document.writeln('<b>Condition</b><hr>');
1469: linkmode=0;
1470: if (data1[4]=='-') {
1471: data2[0]=''; data2[1]='normal';
1472: } else {
1473: data2=objcont[data1[4]].split(':');
1474: }
1475: inf.document.writeln(
1.3 www 1476: '<form name=condinfo><textarea name=c cols=30 rows=3>'
1.1 www 1477: +data2[0]+'</textarea><br><input type=radio name=s value=normal '+
1478: 'onClick="self.document.forms.condinfo.elements.h.value='+"'normal'"+'"');
1479: if (data2[1]=='normal') { inf.document.write(' checked'); }
1480: inf.document.write(
1481: '> Recommendation if true<br><input type=radio name=s value=stop '+
1482: 'onClick="self.document.forms.condinfo.elements.h.value='+"'stop'"+'"');
1483: if (data2[1]=='stop') { inf.document.write(' checked'); }
1484: inf.document.write(
1485: '> Blocking this link if false<br><input type=radio name=s value=force '+
1486: 'onClick="self.document.forms.condinfo.elements.h.value='+"'force'"+'"');
1487: if (data2[1]=='force') { inf.document.write(' checked'); }
1488: inf.document.write(
1489: '> Blocking other links if true<br><a href="javascript:opener.editmode=0;'
1490: +'opener.notclear=0;');
1491: if (data1[4]=='-') {
1492: inf.document.write('opener.crecond('+data1[2]+','+data1[1]+','
1493: +'opener.escape(self.document.forms.condinfo.elements.c.value),'
1494: +'self.document.forms.condinfo.elements.h.value);');
1495: } else {
1496: inf.document.write('opener.objcont['+data1[4]+']='
1497: +'opener.escape(self.document.forms.condinfo.elements.c.value)+'+"':'"
1498: +'+self.document.forms.condinfo.elements.h.value+'+"':cond';");
1499: }
1500: inf.document.writeln(
1501: 'opener.infoclear();opener.editmode=0;opener.draw('
1.3 www 1502: +');"><b>Change to above values</b></a> '
1503: +' <a href="javascript:self.document.forms.condinfo.reset()">Reset</a><br>'
1504: +'<input type=hidden name=h value='+data2[1]+'>');
1.1 www 1505:
1506: inf.document.writeln(
1507: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1508: +'opener.delcond('+data1[2]+','+data1[1]+');opener.editmode=0;opener.draw('
1.3 www 1509: +');">Delete Condition</a><br>');
1510: inf.document.writeln(
1511: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1512: +'opener.dellink('+data1[3]+');opener.editmode=0;opener.draw('
1513: +');">Delete Link</a>');
1.5 www 1514:
1515: inf.document.writeln('<br><a href="javascript:'+
1516: 'opener.insertcondlink('+data1[1]+','+data1[3]+');'+
1517: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1518: +');">Insert Resource Into Link</a>');
1519:
1520:
1.3 www 1521: } else {
1.1 www 1522: if (data1[0]=='r') {
1523: if (linkmode!=0) {
1524: joinres(linkmode,data1[1],0);
1525: editmode=0;
1526: notclear=0;
1527: linkmode=0;
1528: inf.document.writeln('<b>Linked Resources</b>');
1.2 www 1529: draw();
1.1 www 1530: } else {
1531: data2=objcont[data1[1]].split(':');
1.5 www 1532: if (data2[3]=='start') {
1533: inf.document.writeln('<b>Start</b>');
1534: } else {
1535: if (data2[3]=='finish') {
1536: inf.document.writeln('<b>Finish</b>');
1537: } else {
1538: inf.document.writeln('<b>Resource</b>');
1539: }
1540: }
1.1 www 1541: inf.document.write(
1542: '<form name=resinfo><table><tr><td>Title:</td><td>'
1.3 www 1543: +'<input type=text name=t size=30 value="'
1.5 www 1544: +data2[0]+'"><input type=hidden name=h value='+data2[3]+'></td></tr>');
1545: if ((data2[3]!='start') && (data2[3]!='finish')) {
1546: inf.document.write('<tr><td>URL:</td><td>'
1.3 www 1547: +'<input type=text name=u size=30 value="'+data2[1]+'"></td></tr>'
1.1 www 1548: +'<tr><td>External:</td><td><input type=checkbox name=e');
1549: if (data2[2]=='true') { inf.document.write(' checked'); }
1.3 www 1550: inf.document.write('></td></tr>'
1.5 www 1551: +'<tr><td colspan=2>'
1552: +'<input type=radio name=y value=normal '+
1.3 www 1553: 'onClick="self.document.forms.resinfo.elements.h.value='+"'normal'"+'"');
1554: if (data2[3]=='normal') { inf.document.write(' checked'); }
1555: inf.document.write(
1556: '> Regular <input type=radio name=y value=mandatory '+
1557: 'onClick="self.document.forms.resinfo.elements.h.value='+"'mandatory'"+'"');
1558: if (data2[3]=='mandatory') { inf.document.write(' checked'); }
1559: inf.document.write(
1560: '> Mandatory <input type=radio name=y value=optional '+
1561: 'onClick="self.document.forms.resinfo.elements.h.value='+"'optional'"+'"');
1562: if (data2[3]=='optional') { inf.document.write(' checked'); }
1.5 www 1563: inf.document.write('> Optional</td></tr>');
1564: } else {
1565: inf.document.write(
1566: '<tr><td><input type=hidden name=e value=false>'
1567: +'<input type=hidden name=u value=""></td></tr>');
1568: }
1569: inf.document.writeln(
1570: '<tr><td colspan=2><a href="javascript:opener.editmode=0;'
1.1 www 1571: +'opener.notclear=0;opener.objcont['+data1[1]
1572: +']=opener.escape(self.document.forms.resinfo.elements.t.value)+'+"':'"
1573: +'+opener.escape(self.document.forms.resinfo.elements.u.value)+'+"':'"
1.3 www 1574: +'+self.document.forms.resinfo.elements.e.checked+'+"':'"
1575: +'+self.document.forms.resinfo.elements.h.value+'+"':res'"
1576: +';opener.infoclear();opener.editmode=0;opener.draw();">'
1577: +'<b>Change to above values</b></a> '
1.1 www 1578: +' <a href="javascript:self.document.forms.resinfo.reset()">Reset</a>'
1.3 www 1579: +'</td></tr></table>');
1.5 www 1580: if ((data2[3]!='start') && (data2[3]!='finish')) {
1.1 www 1581: inf.document.writeln(
1582: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1583: +'opener.delres('+data1[1]+',0);opener.editmode=0;opener.draw('
1.2 www 1584: +');">Delete Resource (cutting links)</a>');
1.1 www 1585: inf.document.writeln(
1586: '<br><a href="javascript:opener.notclear=0;opener.infoclear();'
1587: +'opener.delres('+data1[1]+',1);opener.editmode=0;opener.draw('
1.2 www 1588: +');">Delete Resource (preserving links)</a>');
1.5 www 1589: }
1590: if (data2[3]!='finish') {
1.1 www 1591: inf.document.writeln(
1592: '<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
1593: +'opener.linkmode='+data1[1]+';'
1594: +'opener.infoclear();">Link Resource</a>');
1.5 www 1595: }
1.1 www 1596: }
1597: } else {
1598: linkmode=0;
1.3 www 1599: inf.document.writeln('<b>Link</b><hr><form>');
1.1 www 1600: data2=obj[data1[0]].split('&');
1601: k=data2[data2.length-2];
1602: data3=objlinks[k].split(':');
1603: inf.document.writeln('From <b>'+objcont[data3[0]].split(':')[0]+
1604: '</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
1605: inf.document.writeln('<br><a href="javascript:opener.dellink('+
1606: k+');opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1607: +');">Delete Link</a>');
1608: inf.document.writeln('<br><a href="javascript:'+
1.3 www 1609: "opener.insertreslink('"+infostr+"');"+
1.2 www 1610: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1611: +');">Insert Resource Into Link</a>');
1.1 www 1612: }
1613: }
1614: inf.document.writeln(
1615: '<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
1616: +'opener.infoclear();">Done</a>');
1.3 www 1617: inf.document.writeln('</form></td></tr></table></body></html>');
1.1 www 1618: inf.document.close();
1619: inf.focus();
1620: }
1621:
1622: // ----------------------------------------------------- Clicks on empty fields
1623:
1624: function empty(rid,k) {
1625: var cid=findcol(k);
1626: var lcol=k-1;
1627: trow=row[rid];
1628: lrow=trow-1;
1629: editmode=1;
1630: notclear=1;
1631: linkmode=0;
1.5 www 1632: infcheck();
1.1 www 1633: inf.document.clear();
1634: inf.document.writeln(
1635: '<html><body bgcolor="#FFFFFF">'+
1636: '<table><tr><td width=32><img src="edit.gif"></td><td bgcolor="#AAFFAA">'+
1637: '<b>Empty Field</b><hr>');
1638:
1639: inf.document.writeln('<br><a href="javascript:opener.newresource('+
1.3 www 1640: rid+','+cid+",'','','false','normal');"+
1641: 'opener.mostrecent=opener.obj.length-1;'+
1642: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1643: +');">Insert resource</a>');
1644:
1.13 ! www 1645: if ((mostrecent!=0) && (objcont[mostrecent]!='') &&
! 1646: (objcont[mostrecent]!=undefined)) {
1.3 www 1647:
1648: inf.document.writeln('<br><a href="javascript:opener.newresource('+
1649: rid+','+cid+",'','','false','normal');"+
1650: 'opener.mostrecent=opener.obj.length-1;'+
1651: 'opener.joinres('+mostrecent+',opener.obj.length-1,0);'+
1.1 www 1652: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.3 www 1653: +');">Insert resource linked to from most recent one</a>');
1654:
1655: inf.document.writeln('<br><a href="javascript:opener.newresource('+
1656: rid+','+cid+",'','','false','normal');"+
1657: 'opener.mostrecent=opener.obj.length-1;'+
1658: 'opener.joinres(opener.obj.length-1,'+mostrecent+',0);'+
1659: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1660: +');">Insert resource linking to most recent one</a>');
1661: }
1662:
1663:
1.1 www 1664: inf.document.writeln('<hr>Insert column:');
1665: inf.document.writeln('<a href="javascript:opener.insertcol('+
1666: lcol+');opener.addobj('+rid+",'e&'+opener.maxcol);"
1667: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1668: +');">left</a>');
1.1 www 1669: inf.document.writeln('<a href="javascript:opener.insertcol('+
1670: k+');opener.addobj('+rid+",'e&'+opener.maxcol);"
1671: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1672: +');">right</a> ');
1.1 www 1673: inf.document.writeln('<br>Insert row:');
1674: inf.document.writeln('<a href="javascript:opener.insertrow('+
1675: trow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
1676: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1677: +');">below</a>');
1.1 www 1678: inf.document.writeln('<a href="javascript:opener.insertrow('+
1679: lrow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
1680: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1681: +');">above</a> ');
1.1 www 1682:
1683:
1684: inf.document.writeln(
1685: '<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
1686: +'opener.infoclear();">Done</a>');
1687: inf.document.writeln('</td></tr></table></body></html>');
1688: inf.document.close();
1689: inf.focus();
1690: }
1691:
1692: // ---------------------------------------------------- Save into hidden fields
1693:
1694: function save() {
1.3 www 1695: var k;
1696: if (graphdef=='yes') {
1.2 www 1697: parent.server.document.forms.storage.output.value='graphdef<:>yes';
1.6 www 1698: for (k=1;k<obj.length;k++) {
1.2 www 1699: parent.server.document.forms.storage.output.value+=
1.1 www 1700: '<&>obj<:>'+k+'<:>'+obj[k];
1701: }
1702: for (k=0;k<row.length;k++) {
1.2 www 1703: parent.server.document.forms.storage.output.value+=
1.1 www 1704: '<&>row<:>'+k+'<:>'+row[k];
1705: }
1706: for (k=0;k<col.length;k++) {
1.2 www 1707: parent.server.document.forms.storage.output.value+=
1.1 www 1708: '<&>col<:>'+k+'<:>'+col[k];
1709: }
1710: for (k=0;k<rowcont.length;k++) {
1711: if (rowcont[k]) {
1.2 www 1712: parent.server.document.forms.storage.output.value+=
1.1 www 1713: '<&>rowcont<:>'+k+'<:>'+rowcont[k];
1714: }
1715: }
1.2 www 1716: parent.server.document.forms.storage.output.value+=
1.1 www 1717: '<&>maxcol<:>'+maxcol;
1.2 www 1718: parent.server.document.forms.storage.output.value+=
1.1 www 1719: '<&>maxrow<:>'+maxrow;
1.4 www 1720: parent.server.document.forms.storage.output.value+=
1721: '<&>zscale<:>'+zscale;
1722: } else {
1.3 www 1723: parent.server.document.forms.storage.output.value='graphdef<:>no';
1724: }
1725: parent.server.document.forms.storage.output.value+=
1726: '<&>tablemode<:>'+tablemode;
1727:
1.1 www 1728: for (k=0;k<objcont.length;k++) {
1729: if (objcont[k]) {
1.2 www 1730: parent.server.document.forms.storage.output.value+=
1.1 www 1731: '<&>objcont<:>'+k+'<:>'+objcont[k];
1732: }
1733: }
1734: for (k=0;k<objlinks.length;k++) {
1735: if (objlinks[k]) {
1.2 www 1736: parent.server.document.forms.storage.output.value+=
1.1 www 1737: '<&>objlinks<:>'+k+'<:>'+objlinks[k];
1738: }
1739: }
1.2 www 1740: undopointer++;
1741: undostack[undopointer]=
1742: parent.server.document.forms.storage.output.value;
1.1 www 1743: }
1744:
1745: // ----------------------------------------------- Reset all layout information
1746:
1747: function graphreset() {
1748:
1.4 www 1749: var k;
1750:
1751: for (k=0;k<obj.length;k++) { obj[k]=''; }
1.1 www 1752: obj.length=0;
1753: obj[0]='';
1754:
1755: rowcont.length=0;
1756: rowcont[0]='';
1.4 www 1757:
1.1 www 1758: row.length=0;
1759: row[0]=0;
1.4 www 1760: maxrow=0;
1.1 www 1761:
1762: col.length=0;
1763: colmap.length=0;
1764: maxcol=-1;
1765: insertcol(-1);
1.4 www 1766:
1767: objcont[0]='';
1.11 www 1768: objlinks[0]='';
1.9 www 1769: if (((objcont[1]==undefined)&&(objcont[2]==undefined)) ||
1770: ((objcont[1]=='')&&(objcont[2]==''))) {
1771: objcont[1]='Start::false:start:res'
1772: objcont[2]='Finish::false:finish:res';
1773: }
1.1 www 1774: graphdef='no';
1775:
1776: }
1777:
1778: // --------------------- Compare two resources with each other for "straighten"
1779:
1780: function rescompare(a,b) {
1781: data1=a.split(':');
1782: data2=b.split(':');
1783: var rvalue=0;
1784: var k;
1785: for (k=1;k<data1.length;k++) {
1786: if (data1[k]==data2[0]) { rvalue--; }
1787: }
1788: for (k=1;k<data3.length;k++) {
1789: if (data2[k]==data1[0]) { rvalue++; }
1790: }
1791: if (rvalue==0) { rvalue=data2.length-data1.length; }
1792: return rvalue;
1793: }
1794:
1.2 www 1795: // -------------------------------------------- Draw the table instead of graph
1796:
1797: function tabledraw() {
1.3 www 1798: var objsorted=new Array();
1799: var robjs=new Array();
1.4 www 1800: var iobjs=new Array();
1.3 www 1801: var k;
1802: var i;
1803: var j;
1804: var nr;
1.4 www 1805: var ck;
1806: var cck;
1807: var condid;
1.3 www 1808: var sortstr=sortobjs();
1.5 www 1809: insrestab(1,-1,-1,'');
1.13 ! www 1810: if ((sortstr!='') && (sortstr!=undefined)) {
1.3 www 1811: objsorted=sortstr.split('&');
1812: for (k=0;k<objsorted.length;k++) {
1.4 www 1813: i=(objsorted[k].split(':'))[0];
1814: iobjs[k]=i;
1815: robjs[i]=k;
1.3 www 1816: }
1.4 www 1817: for (k=0;k<iobjs.length;k++) {
1818: i=iobjs[k];
1.3 www 1819: if (k<objsorted.length-1) {
1.4 www 1820: nr=iobjs[k+1];
1.3 www 1821: } else {
1822: nr=-1;
1823: }
1824: data1=objcont[i].split(':');
1.4 www 1825: ck=rescolor(data1[2],data1[3]);
1.3 www 1826: parent.mapout.document.write('<tr><td bgcolor="'+ck
1.4 www 1827: +'"><b><a href="javascript:if (parent.code.linkmode!=0) { '
1828: +'parent.code.joinres(parent.code.linkmode,'+i+',0);'
1829: +'parent.code.linkmode=0;parent.code.editmode=0;'
1830: +'parent.code.notclear=0;parent.code.infoclear();'
1831: +'parent.code.draw(); }">'+k+'</a></b></td><td bgcolor="'+ck
1.3 www 1832: +'"><form name=r'+i+' method=post>');
1833: data2=obj[i].split('&');
1834: parent.mapout.document.write('<table bgcolor="#CCCCCC">');
1.5 www 1835: if (data1[3]=='start') {
1836: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
1837: }
1838: if (data1[3]=='finish') {
1839: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
1840: }
1.3 www 1841: parent.mapout.document.write(
1.4 www 1842: '<tr><td>Title:</td><td><input type=text name=t size=50 value="'
1.5 www 1843: +data1[0]+'"><input type=hidden name=h value='+data1[3]
1844: +'></td></tr>');
1845: if ((data1[3]!='start') && (data1[3]!='finish')) {
1.3 www 1846: parent.mapout.document.write(
1.4 www 1847: '<tr><td>URL:</td><td><input type=text name=u size=50 value="'
1.3 www 1848: +data1[1]+'"></td></tr>'
1849: +'<tr><td>External:</td><td><input type=checkbox name=e');
1850: if (data1[2]=='true') { parent.mapout.document.write(' checked'); }
1851: parent.mapout.document.write('></td></tr>'
1.5 www 1852: +'<tr><td colspan=2><input type=radio name=y value=normal '+
1.3 www 1853: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
1854: "'normal'"+'"');
1855: if (data1[3]=='normal') { parent.mapout.document.write(' checked'); }
1856: parent.mapout.document.write(
1857: '> Regular <input type=radio name=y value=mandatory '+
1858: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
1859: "'mandatory'"+'"');
1860: if (data1[3]=='mandatory') { parent.mapout.document.write(' checked'); }
1861: parent.mapout.document.write(
1862: '> Mandatory <input type=radio name=y value=optional '+
1863: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
1864: "'optional'"+'"');
1865: if (data1[3]=='optional') { parent.mapout.document.write(' checked'); }
1.5 www 1866: parent.mapout.document.write('> Optional</td></tr>');
1867: } else {
1868: parent.mapout.document.write(
1869: '<tr><td><input type=hidden name=u value="">'
1870: +'<input type=hidden name=e value=false></td></tr>');
1871: }
1872: parent.mapout.document.write(
1873: '<tr><td colspan=2><a href="javascript:parent.code.objcont['+i
1.3 www 1874: +']=parent.code.escape(parent.mapout.document.forms.r'+i
1875: +'.elements.t.value)+'+"':'"
1876: +'+parent.code.escape(parent.mapout.document.forms.r'+i
1877: +'.elements.u.value)+'+"':'"
1878: +'+parent.mapout.document.forms.r'+i+'.elements.e.checked+'+"':'"
1879: +'+parent.mapout.document.forms.r'+i+'.elements.h.value+'+"':res'"
1880: +';parent.code.draw();">'
1881: +'<b>Change to above values</b></a> '
1882: +' <a href="javascript:parent.mapout.document.forms.r'+i
1.5 www 1883: +'.reset()">Reset</a></td></tr><tr><td colspan=2>');
1884: if ((data1[3]!='start') && (data1[3]!='finish')) {
1885: parent.mapout.document.writeln(
1886: '<A href="javascript:parent.code.notclear=0;parent.code.infoclear();'
1.4 www 1887: +'parent.code.delres('+i+',0);parent.code.editmode=0;parent.code.draw();">'
1888: +'Delete Resource (cutting links)</A><br>'
1889: +'<A href="javascript:parent.code.notclear=0;parent.code.infoclear();'
1890: +'parent.code.delres('+i+',1);parent.code.editmode=0;parent.code.draw();">'
1.5 www 1891: +'Delete Resource (preserving links)</A><br>');
1892: }
1893: if (data1[3]!='finish') {
1894: parent.mapout.document.writeln(
1895: '<a href="javascript:parent.code.linkmode='+i+
1.4 www 1896: ';parent.code.notclear=0;parent.code.infoclear();">'+
1897: 'Link resource</a></td></tr>');
1.5 www 1898: }
1.4 www 1899: parent.mapout.document.writeln('<tr><td colspan=2><table><tr>');
1.3 www 1900: for (j=2;j<data2.length;j++) {
1.4 www 1901: data4=data2[j].split(':');
1902: data3=objlinks[data4[2]].split(':');
1.3 www 1903: if (data3.length>1) {
1904: if (data3[1]==nr) {
1.4 www 1905: cck='#AAAAAA';
1906: if (data3[2]!=0) {
1907: cck=condcolor((objcont[data3[2]].split(':'))[1]);
1908: condid=data3[2];
1909: } else {
1910: condid='-';
1911: }
1912: parent.mapout.document.writeln(
1913: '<td bgcolor='+cck+'>Next<br>');
1914: parent.mapout.document.writeln(
1915: '<a href="javascript:parent.code.handler('+
1916: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
1917: +'">Edit</a>');
1.3 www 1918: parent.mapout.document.writeln('</td>');
1919: }
1920: }
1921: }
1922: for (j=2;j<data2.length;j++) {
1.4 www 1923: data4=data2[j].split(':');
1924: data3=objlinks[data4[2]].split(':');
1.3 www 1925: if (data3.length>1) {
1926: if ((data3[1]!=nr) && (data3[1]!=0)) {
1.4 www 1927: cck='#AAAAAA';
1928: if (data3[2]!=0) {
1929: cck=condcolor((objcont[data3[2]].split(':'))[1]);
1930: condid=data3[2];
1931: } else {
1932: condid='-';
1933: }
1.3 www 1934: parent.mapout.document.writeln(
1.4 www 1935: '<td bgcolor='+cck+'>To: '+robjs[data3[1]]+'<br>');
1936: parent.mapout.document.writeln(
1937: '<a href="javascript:parent.code.handler('+
1938: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
1939: +'">Edit</a>');
1.3 www 1940: parent.mapout.document.writeln('</td>');
1941: }
1942: }
1943: }
1944: parent.mapout.document.writeln(
1.4 www 1945: '</tr></table></td></tr></table></form>');
1.5 www 1946: insrestab(rrow[data2[1]],i,nr,data1[3]);
1.4 www 1947:
1.3 www 1948: }
1949: }
1950: }
1951:
1.4 www 1952: // ----------------------------------------------------- Insert Resource Output
1953:
1.5 www 1954: function insrestab(irow,be,af,typ) {
1.4 www 1955: parent.mapout.document.writeln('<tr><td colspan=2>'+
1956: '<table><tr><td><a href="javascript:parent.code.insertrow('
1957: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[1]
1958: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1959: +'parent.code.draw();">'
1960: +'Insert resource</a></td><td>');
1.5 www 1961: if ((be!=-1) && (typ!='finish')) {
1.4 www 1962: parent.mapout.document.writeln(
1963: '<a href="javascript:parent.code.insertrow('
1964: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
1965: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1966: +'parent.code.joinres('+be+',parent.code.mostrecent,0);'
1967: +'parent.code.draw();">'
1968: +'Insert resource linked to from above</a><br>');
1969: }
1.5 www 1970: if ((be!=-1) && (af!=-1) && (typ!='finish')) {
1.4 www 1971: parent.mapout.document.writeln(
1972: '<a href="javascript:parent.code.insertrow('
1973: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
1974: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1975: +'parent.code.joinres('+be+',parent.code.mostrecent,0);'
1976: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
1977: +'parent.code.draw();">'
1978: +'Insert resource linked to from above and linking to below</a><br>');
1979: }
1980: if (af!=-1) {
1981: parent.mapout.document.writeln(
1982: '<a href="javascript:parent.code.insertrow('
1983: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
1984: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1985: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
1986: +'parent.code.draw();">'
1987: +'Insert resource linking to below</a><br>');
1988: }
1989: parent.mapout.document.writeln('</td></tr></table></tr>');
1990: }
1991: // ---------------------------------------- Draw simple table instead of graph
1992:
1993: function simpletabledraw() {
1994: var objsorted=new Array();
1995: var robjs=new Array();
1996: var iobjs=new Array();
1997: var k;
1998: var i;
1999: var j;
2000: var nr;
2001: var ck;
2002: var cck;
2003: var condid;
2004: var sortstr=sortobjs();
1.13 ! www 2005: if ((sortstr!='') && (sortstr!=undefined)) {
1.4 www 2006: objsorted=sortstr.split('&');
2007: for (k=0;k<objsorted.length;k++) {
2008: i=(objsorted[k].split(':'))[0];
2009: iobjs[k]=i;
2010: robjs[i]=k;
2011: }
2012: for (k=0;k<iobjs.length;k++) {
2013: i=iobjs[k];
2014: if (k<objsorted.length-1) {
2015: nr=iobjs[k+1];
2016: } else {
2017: nr=-1;
2018: }
2019: data1=objcont[i].split(':');
2020: ck=rescolor(data1[2],data1[3]);
2021: parent.mapout.document.write('<tr><td bgcolor="'+ck
2022: +'"><b>'+k+'</b></td><td bgcolor="'+ck
2023: +'">');
2024: data2=obj[i].split('&');
2025: parent.mapout.document.write('<table>');
1.5 www 2026: if (data1[3]=='start') {
2027: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
2028: }
2029: if (data1[3]=='finish') {
2030: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
2031: }
1.4 www 2032: parent.mapout.document.write(
2033: '<tr><td>Title:</td><td>'+data1[0]+'</td></tr>');
2034: parent.mapout.document.write(
2035: '<tr><td>URL:</td><td>'+data1[1]+'</td></tr>'
2036: +'<tr><td colspan=2><table><tr>');
2037: for (j=2;j<data2.length;j++) {
2038: data4=data2[j].split(':');
2039: data3=objlinks[data4[2]].split(':');
2040: if (data3.length>1) {
2041: if (data3[1]==nr) {
2042: cck='#AAAAAA';
2043: if (data3[2]!=0) {
2044: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2045: condid=data3[2];
2046: } else {
2047: condid='-';
2048: }
2049: parent.mapout.document.writeln(
2050: '<td bgcolor='+cck+'>Next<br>');
2051: parent.mapout.document.writeln('</td>');
2052: }
2053: }
2054: }
2055: for (j=2;j<data2.length;j++) {
2056: data4=data2[j].split(':');
2057: data3=objlinks[data4[2]].split(':');
2058: if (data3.length>1) {
2059: if ((data3[1]!=nr) && (data3[1]!=0)) {
2060: cck='#AAAAAA';
2061: if (data3[2]!=0) {
2062: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2063: condid=data3[2];
2064: } else {
2065: condid='-';
2066: }
2067: parent.mapout.document.writeln(
2068: '<td bgcolor='+cck+'>To: '+robjs[data3[1]]+'<br>');
2069: parent.mapout.document.writeln('</td>');
2070: }
2071: }
2072: }
2073: parent.mapout.document.writeln('</tr></table></td></tr></table></tr>');
2074: }
2075: } else {
2076: parent.mapout.document.writeln('<tr><td>No Resources</td></tr>');
2077: }
2078: }
2079:
1.3 www 2080: // ---------------------------------- Sort objects to straighten graph or table
2081:
2082: function sortobjs() {
1.8 www 2083: message("Sorting Resources: "+funny);
1.2 www 2084: var k;
2085: var ij;
1.3 www 2086: var dol;
2087: var dtl;
1.2 www 2088: var kj;
1.3 www 2089: var sortthis=0;
1.2 www 2090: var objsort=new Array();
2091: for (k=1;k<objcont.length;k++) {
2092: if (objcont[k]) {
2093: data1=objcont[k].split(':');
2094: if (data1[data1.length-1]=='res') {
2095: objsort[objsort.length]=''+k;
2096: }
2097: }
2098: }
1.3 www 2099: if (objsort.length==0) { return ''; }
1.2 www 2100: for (k=1;k<objlinks.length;k++) {
1.8 www 2101: wheelswitch();
2102: message("Sorting Resources: "+funny);
1.13 ! www 2103: if ((objlinks[k]!=undefined) && (objlinks[k]!='')) {
1.3 www 2104: sortthis=1;
1.2 www 2105: data1=objlinks[k].split(':');
2106: kj=-1;
2107: for (j=0;j<objsort.length;j++) {
2108: if ((objsort[j].split(':'))[0]==data1[0]) {
2109: kj=j;
2110: }
2111: }
1.8 www 2112: if (kj!=-1) { objsort[kj]+=':'+data1[1]; }
1.3 www 2113: }
1.2 www 2114: }
1.3 www 2115: if (sortthis!=0) {
2116: for (k=0;k<objsort.length;k++) {
1.8 www 2117: wheelswitch();
2118: message("Sorting Resources: "+funny);
1.3 www 2119: for (j=0;j<objsort.length;j++) {
2120: if (k!=j) {
2121: data1=objsort[k].split(':');
2122: data2=objsort[j].split(':');
2123: dol=data1.length;
2124: dtl=data2.length;
1.8 www 2125: if (dol+dtl<200) {
2126: for (kj=1;kj<dol;kj++) {
1.3 www 2127: if (data1[kj]==data2[0]) {
2128: for (ij=1;ij<dtl;ij++) {
2129: data1[data1.length]=data2[ij];
2130: }
2131: }
1.8 www 2132: }
2133: for (kj=1;kj<dtl;kj++) {
1.3 www 2134: if (data2[kj]==data1[0]) {
2135: for (ij=1;ij<dol;ij++) {
1.8 www 2136: data2[data2.length]=data1[ij];
2137: }
2138: }
2139: }
2140: objsort[k]=data1.join(':');
2141: objsort[j]=data2.join(':');
1.3 www 2142: }
2143: }
2144: }
1.2 www 2145: }
1.8 www 2146: message("Sorting Resources: finishing up.");
1.3 www 2147: return objsort.sort(rescompare).join('&');
2148: } else {
2149: return objsort.join('&');
2150: }
1.2 www 2151: }
2152:
1.3 www 2153: // ----------------------------------------------------------- Straighten graph
1.1 www 2154:
2155: function graphopt() {
1.3 www 2156: var k;
2157: var kj;
2158: var ij;
2159:
2160: var objsorted=new Array();
2161: condense();
2162: graphreset();
2163: objsorted=(sortobjs()).split('&');
2164: if (objsorted.length==0) { return; }
2165: message("Creating Optimized Graph");
1.1 www 2166: var thisnewobj=''+(objsorted[0].split(':'))[0];
2167: rowcont[1]=thisnewobj;
2168: var thiscolmax=1;
2169: obj[thisnewobj]='b&1&'+thiscolmax+':0:0:0';
2170: var allcolmax=0;
2171: for (k=1;k<objsorted.length;k++) {
2172: thisnewobj=(objsorted[k].split(':'))[0];
2173: if (rescompare(objsorted[k-1],objsorted[k])==0) {
2174: rowcont[rowcont.length-1]+=':'+thisnewobj;
2175: thiscolmax++;
2176: } else {
2177: rowcont[rowcont.length]=thisnewobj;
2178: thiscolmax=1;
2179: }
2180: kj=rowcont.length-1;
1.5 www 2181: obj[thisnewobj]='b&'+kj+'&'+thiscolmax+':0:0:0';
2182: if (thiscolmax>allcolmax) { allcolmax=thiscolmax; }
1.1 www 2183: }
2184: for (k=0;k<obj.length;k++) {
2185: if (!obj[k]) { obj[k]=''; }
2186: }
2187: for (k=0;k<=allcolmax;k++) { insertcol(0); }
2188: for (k=0;k<rowcont.length;k++) {
2189: row[k]=k;
2190: }
2191: maxrow=rowcont.length-1;
2192: var oldlinks=new Array();
1.11 www 2193: for (k=0;k<objlinks.length;k++) {
2194: oldlinks[k]=objlinks[k];
2195: objlinks[k]='';
2196: }
1.1 www 2197: objlinks.length=0;
2198: objlinks[0]='';
1.11 www 2199: graphdef='yes';
2200: save();
2201:
1.1 www 2202: for (k=0;k<objsorted.length;k++) {
1.11 www 2203: wheelswitch();
2204: message("Connecting Resources: "+funny);
2205: kj=(objsorted[k].split(':'))[0];
1.1 www 2206: for (ij=1;ij<oldlinks.length;ij++) {
2207: if (oldlinks[ij]) {
2208: data1=oldlinks[ij].split(':');
2209: if (data1[0]==kj) {
2210: joinres(data1[0],data1[1],data1[2]);
1.11 www 2211: save();
1.1 www 2212: }
2213: }
2214: }
2215: }
2216: }
2217:
2218: // ----------------------------------------------------------- Remove e-objects
2219:
2220: function condense() {
1.3 www 2221: message("Condensing");
1.1 www 2222: var j;
2223: for (j=0;j<=maxrow;j++) {
1.13 ! www 2224: if ((rowcont[j]!='') && (rowcont[j]!=undefined)) {
1.1 www 2225: data1=rowcont[j].split(':');
2226: rowcont[j]='';
2227: for (k=0;k<data1.length;k++) {
2228: if (obj[data1[k]].substring(0,2)!='e&') {
1.13 ! www 2229: if ((rowcont[j]!='') && (rowcont[j]!=undefined)) {
! 2230: rowcont[j]+=':';
! 2231: }
1.1 www 2232: rowcont[j]+=data1[k];
2233: }
2234: }
2235: }
2236: }
2237: }
2238:
2239: // ---------------------------------------------------- Load from hidden fields
2240:
2241: function load() {
1.4 www 2242: message("Loading");
1.8 www 2243: schedule('load');
2244: checkdef();
2245: }
2246:
2247: function finishload() {
1.4 www 2248: var k;
2249: for (k=0;k<objcont.length;k++) { objcont[k]=''; }
1.1 www 2250: objcont.length=0;
1.4 www 2251: for (k=0;k<objlinks.length;k++) { objlinks[k]=''; }
1.1 www 2252: objlinks.length=0;
2253: objlinks[0]='';
2254: objcont[0]='';
2255: editmode=0;
2256: notclear=0;
2257: lastinfo='';
2258: graphreset();
1.2 www 2259: var inputstr=parent.server.document.forms.storage.output.value;
1.13 ! www 2260: if ((inputstr!='') && (inputstr!=undefined)) {
1.1 www 2261: data1=inputstr.split('<&>');
2262: var k;
2263: for (k=0;k<data1.length;k++) {
2264: data2=data1[k].split('<:>');
2265: if (data2[0]=='graphdef') { graphdef=data2[1]; }
2266: if (data2[0]=='maxcol') { maxcol=1*data2[1]; }
2267: if (data2[0]=='maxrow') { maxrow=1*data2[1]; }
2268: if (data2[0]=='obj') { obj[data2[1]]=data2[2]; }
2269: if (data2[0]=='objcont') { objcont[data2[1]]=data2[2]; }
2270: if (data2[0]=='objlinks') { objlinks[data2[1]]=data2[2]; }
2271: if (data2[0]=='rowcont') { rowcont[data2[1]]=data2[2]; }
2272: if (data2[0]=='row') { row[data2[1]]=1*data2[2]; }
2273: if (data2[0]=='col') { col[data2[1]]=1*data2[2]; }
1.6 www 2274: if (data2[0]=='mode') { mode=data2[1]; }
1.3 www 2275: if (data2[0]=='tablemode') { tablemode=1*data2[1]; }
1.4 www 2276: if (data2[0]=='zscale') { zscale=1*data2[1]; }
1.1 www 2277: }
1.9 www 2278: }
2279: if (graphdef=='yes') {
2280: for (k=1;k<=maxrow;k++) {
2281: if (rowcont[k]==undefined) { rowcont[k]=''; }
2282: }
1.3 www 2283: }
1.1 www 2284: }
2285:
1.2 www 2286: // -------------------------------------------------------------- Undo function
2287:
2288: function undo() {
2289: if (undopointer>1) {
2290: undopointer--;
2291: parent.server.document.forms.storage.output.value
2292: =undostack[undopointer];
1.8 www 2293: finishload();
1.2 www 2294: undopointer--;
2295: draw();
2296: stored=0;
2297: } else {
2298: alert("Cannot undo: reached beginning of edit session");
2299: }
2300: }
2301:
2302: // -------------------------------------------------------------- Redo function
2303:
2304: function redo() {
2305: if (undopointer<undostack.length-1) {
2306: undopointer++;
2307: parent.server.document.forms.storage.output.value
2308: =undostack[undopointer];
1.8 www 2309: finishload();
1.2 www 2310: undopointer--;
2311: draw();
2312: stored=0;
2313: } else {
2314: alert("Cannot redo: reached end of edit session");
2315: }
2316: }
2317:
2318: // ------------------------------------------------------------ Revert function
2319:
2320: function revert() {
2321: if (confirm("Revert to beginning of edit session?")) {
2322: undopointer=2;
2323: undo();
2324: }
2325: }
2326:
1.8 www 2327: // ---------------------------------------------------------------- Wheelswitch
2328:
2329: function wheelswitch() {
2330: if (funny=='|') {
2331: funny='/';
2332: } else {
2333: if (funny=='/') {
2334: funny='-';
2335: } else {
2336: if (funny=='-') {
2337: funny='\\';
2338: } else {
2339: if (funny=='\\') { funny='|'; }
2340: }
2341: }
2342: }
2343: }
2344:
2345: // --------------------------------------------- Checks if server frame defined
2346:
2347: function checkdef() {
2348: if (parent.server.document.forms.storage.output.value!=undefined) {
2349: srvloaded();
2350: }
2351: if ((finishdone==0) && (tim==0)) { setTimeout('checkdef()',100); }
2352: }
2353:
2354: // ---------------------------------------------------------- The wait function
2355:
2356: function wait() {
2357: if ((finishdone==1) || (tim==1)) {
2358: if (tim==0) {
2359: clearTimeout(canceltim);
2360: if (reqaction=='save') { finishsave(); }
2361: if (reqaction=='load') { finishload(); draw(); }
2362: } else {
2363: alert("Server Communication Timed Out.");
2364: }
2365: } else {
2366: wheelswitch();
2367: message('Waiting for server reply: '+funny);
2368: setTimeout('wait();',100);
2369: }
2370: }
2371:
2372: // ---------------------------------------------------------- Schedule function
2373:
2374: function schedule(action) {
2375: reqaction=action;
2376: tim=0;
2377: finishdone=0;
2378: canceltim=setTimeout('tim=1;',20000)
2379: wait();
2380: }
2381:
1.2 www 2382: // -------------------------------------------------------------- Store changes
2383:
2384: function storechange() {
1.8 www 2385: var k;
1.2 www 2386: parent.server.document.forms.storage.submit();
1.8 www 2387: schedule('save');
2388: }
2389:
2390: function finishsave() {
2391: finishload();
1.7 www 2392: draw();
1.2 www 2393: stored=1;
2394: }
2395:
1.8 www 2396: // --------------------------------------- Gets called when submission finished
2397:
2398: function srvloaded() {
2399: finishdone=1;
2400: message("Server replied.");
2401: }
2402:
1.2 www 2403: // ---------------------------------------------------------------- Toggle Mode
2404:
2405: function togglemode() {
1.4 www 2406: if (tablemode==0) {
2407: tablemode=1;
2408: } else {
2409: if (tablemode==1) {
2410: tablemode=2;
2411: } else {
2412: tablemode=0;
2413: }
2414: }
2415: notclear=0;
2416: infoclear();
1.2 www 2417: draw();
2418: }
2419:
1.1 www 2420: // -------------------------------------------------------- Main program onLoad
2421:
2422: function main() {
2423:
2424: if (mainrun==0) {
1.5 www 2425: infopen();
2426: infoclear();
1.1 www 2427: load();
1.2 www 2428: stored=1;
1.1 www 2429: mainrun=1;
2430: }
2431:
2432: }
2433:
1.2 www 2434: // ------------------------------------------------------------- Save on leave?
2435:
2436: function leave() {
1.5 www 2437: if (!inf.closed) {
2438: inf.close();
1.2 www 2439: }
2440: }
2441:
1.1 www 2442: </script>
2443: </head>
2444:
1.2 www 2445: <body bgcolor="#FFFFFF" onLoad="main();" onUnload="leave();">
2446: <a href="javascript:togglemode();">Toggle Display Mode</a>
1.4 www 2447: <a href="javascript:if (zscale>1) { zscale--; draw();}">Zoom Out</a>
2448: <a href="javascript:if (zscale<3) { zscale++; draw();}">Zoom In</a>
1.2 www 2449: <a href="javascript:condense();draw();">Condense</a>
2450: <a href="javascript:graphopt();draw();">Straighten</a>
2451: <a href="javascript:revert();">Revert</a>
2452: <a href="javascript:undo();">Undo</a>
2453: <a href="javascript:redo();">Redo</a>
2454: <a href="javascript:storechange();">Store</a>
1.1 www 2455: </body>
1.2 www 2456: </html>
2457:
2458:
2459:
2460:
2461:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>