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