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