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