Annotation of rat/client/code.html, revision 1.18
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";
1.18 ! harris41 1476: srch=open("/adm/searchcat","srchout",options);
! 1477: return;
1.17 harris41 1478: srchclear();
1479: srch.document.writeln(
1480: '<html><body bgcolor="#AAFFAA"><form>'+
1481: '<table width="100%">'+
1482: '<tr><td><b>Resource Library Search</b></td>'+
1483: '<td align=right><input type=button value="Close"'+
1484: ' onClick="javascript:opener.srchclose();"></td>'+
1485: '</tr></table>'+
1486: '<table bgcolor="#ffffff">'+
1487: '<tr><td><b>title</b> </td>'+
1488: '<td><INPUT TYPE="TEXT" NAME="title"></td>'+
1489: '</tr><tr><td><b>author</b> </td>'+
1490: '<td><INPUT TYPE="TEXT" NAME="author"></td>'+
1491: '</tr><tr><td><b>subject</b> </td>'+
1492: '<td><INPUT TYPE="TEXT" NAME="subject"></td>'+
1493: '</tr><tr><td><b>notes</b> </td>'+
1494: '<td><INPUT TYPE="TEXT" NAME="notes"></td>'+
1495: '</tr><tr><td><b>abstract</b> </td>'+
1496: '<td><INPUT TYPE="TEXT" NAME="abstract"></td>'+
1497: '</tr><tr><td><b>mime</b> </td>'+
1498: '<td><INPUT TYPE="TEXT" NAME="mime"></td>'+
1499: '</tr><tr><td><b>language</b> </td>'+
1500: '<td><INPUT TYPE="TEXT" NAME="language"></td>'+
1501: '</tr><tr><td><b>creationdate</b> </td>'+
1502: '<td><INPUT TYPE="TEXT" NAME="creationdate"></td>'+
1503: '</tr><tr><td><b>lastrevisiondate</b> </td>'+
1504: '<td><INPUT TYPE="TEXT" NAME="lastrevisiondate"></td>'+
1505: '</tr><tr><td><b>owner</b> </td>'+
1506: '<td><INPUT TYPE="TEXT" NAME="owner"></td>'+
1507: '</tr><tr><td><b>copyright</b> </td>'+
1508: '<td><INPUT TYPE="TEXT" NAME="copyright"></td>'+
1509: '</tr>'+
1510: '</table>'+
1511: '<input type="button" value="Search the global catalog"'+
1512: ' onClick="javascript:opener.search()">'+
1513: '</form></body></html>');
1514: }
1515:
1516: // -------------------------------------------- Interface function to searching
1517:
1518: function search() {
1519: alert("Searching not yet implemented");
1520: }
1521:
1522: // ------------------------------------------------------- Do srch status check
1523:
1524: function srchcheck() {
1525: if (srch.closed) {
1526: srchopen();
1527: }
1528: }
1529:
1.1 www 1530: // ---------------------------------------------------- Handles "click to edit"
1531:
1532: function handler(infostr) {
1533: var k;
1534: editmode=1;
1535: notclear=1;
1.5 www 1536: infcheck();
1.1 www 1537: inf.document.clear();
1538: inf.document.writeln(
1539: '<html><body bgcolor="#FFFFFF">'+
1540: '<table><tr><td width=32><img src="edit.gif"></td><td bgcolor="#AAFFAA">');
1541: data1=infostr.split('&');
1542: if (data1[0]=='c') {
1543: inf.document.writeln('<b>Condition</b><hr>');
1544: linkmode=0;
1545: if (data1[4]=='-') {
1546: data2[0]=''; data2[1]='normal';
1547: } else {
1548: data2=objcont[data1[4]].split(':');
1549: }
1550: inf.document.writeln(
1.3 www 1551: '<form name=condinfo><textarea name=c cols=30 rows=3>'
1.1 www 1552: +data2[0]+'</textarea><br><input type=radio name=s value=normal '+
1553: 'onClick="self.document.forms.condinfo.elements.h.value='+"'normal'"+'"');
1554: if (data2[1]=='normal') { inf.document.write(' checked'); }
1555: inf.document.write(
1556: '> Recommendation if true<br><input type=radio name=s value=stop '+
1557: 'onClick="self.document.forms.condinfo.elements.h.value='+"'stop'"+'"');
1558: if (data2[1]=='stop') { inf.document.write(' checked'); }
1559: inf.document.write(
1560: '> Blocking this link if false<br><input type=radio name=s value=force '+
1561: 'onClick="self.document.forms.condinfo.elements.h.value='+"'force'"+'"');
1562: if (data2[1]=='force') { inf.document.write(' checked'); }
1563: inf.document.write(
1564: '> Blocking other links if true<br><a href="javascript:opener.editmode=0;'
1565: +'opener.notclear=0;');
1566: if (data1[4]=='-') {
1567: inf.document.write('opener.crecond('+data1[2]+','+data1[1]+','
1568: +'opener.escape(self.document.forms.condinfo.elements.c.value),'
1569: +'self.document.forms.condinfo.elements.h.value);');
1570: } else {
1571: inf.document.write('opener.objcont['+data1[4]+']='
1572: +'opener.escape(self.document.forms.condinfo.elements.c.value)+'+"':'"
1573: +'+self.document.forms.condinfo.elements.h.value+'+"':cond';");
1574: }
1575: inf.document.writeln(
1576: 'opener.infoclear();opener.editmode=0;opener.draw('
1.3 www 1577: +');"><b>Change to above values</b></a> '
1578: +' <a href="javascript:self.document.forms.condinfo.reset()">Reset</a><br>'
1579: +'<input type=hidden name=h value='+data2[1]+'>');
1.1 www 1580:
1581: inf.document.writeln(
1582: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1583: +'opener.delcond('+data1[2]+','+data1[1]+');opener.editmode=0;opener.draw('
1.3 www 1584: +');">Delete Condition</a><br>');
1585: inf.document.writeln(
1586: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1587: +'opener.dellink('+data1[3]+');opener.editmode=0;opener.draw('
1588: +');">Delete Link</a>');
1.5 www 1589:
1590: inf.document.writeln('<br><a href="javascript:'+
1591: 'opener.insertcondlink('+data1[1]+','+data1[3]+');'+
1592: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1593: +');">Insert Resource Into Link</a>');
1594:
1595:
1.3 www 1596: } else {
1.1 www 1597: if (data1[0]=='r') {
1598: if (linkmode!=0) {
1599: joinres(linkmode,data1[1],0);
1600: editmode=0;
1601: notclear=0;
1602: linkmode=0;
1603: inf.document.writeln('<b>Linked Resources</b>');
1.2 www 1604: draw();
1.1 www 1605: } else {
1606: data2=objcont[data1[1]].split(':');
1.5 www 1607: if (data2[3]=='start') {
1608: inf.document.writeln('<b>Start</b>');
1609: } else {
1610: if (data2[3]=='finish') {
1611: inf.document.writeln('<b>Finish</b>');
1612: } else {
1613: inf.document.writeln('<b>Resource</b>');
1614: }
1615: }
1.1 www 1616: inf.document.write(
1.17 harris41 1617: '<form name=resinfo><table><tr><td>Title:</td><td colspan=2>'
1.3 www 1618: +'<input type=text name=t size=30 value="'
1.5 www 1619: +data2[0]+'"><input type=hidden name=h value='+data2[3]+'></td></tr>');
1620: if ((data2[3]!='start') && (data2[3]!='finish')) {
1.17 harris41 1621: inf.document.write('<tr><td>URL:</td><td colspan=2>'
1.3 www 1622: +'<input type=text name=u size=30 value="'+data2[1]+'"></td></tr>'
1.1 www 1623: +'<tr><td>External:</td><td><input type=checkbox name=e');
1624: if (data2[2]=='true') { inf.document.write(' checked'); }
1.17 harris41 1625: inf.document.write('></td><td align=right><a href="javascript:opener.srchopen()">Search</a></td></tr>'
1626: +'<tr><td colspan=3>'
1.5 www 1627: +'<input type=radio name=y value=normal '+
1.3 www 1628: 'onClick="self.document.forms.resinfo.elements.h.value='+"'normal'"+'"');
1629: if (data2[3]=='normal') { inf.document.write(' checked'); }
1630: inf.document.write(
1631: '> Regular <input type=radio name=y value=mandatory '+
1632: 'onClick="self.document.forms.resinfo.elements.h.value='+"'mandatory'"+'"');
1633: if (data2[3]=='mandatory') { inf.document.write(' checked'); }
1634: inf.document.write(
1635: '> Mandatory <input type=radio name=y value=optional '+
1636: 'onClick="self.document.forms.resinfo.elements.h.value='+"'optional'"+'"');
1637: if (data2[3]=='optional') { inf.document.write(' checked'); }
1.5 www 1638: inf.document.write('> Optional</td></tr>');
1639: } else {
1640: inf.document.write(
1641: '<tr><td><input type=hidden name=e value=false>'
1642: +'<input type=hidden name=u value=""></td></tr>');
1643: }
1644: inf.document.writeln(
1.17 harris41 1645: '<tr><td colspan=3><a href="javascript:opener.editmode=0;'
1.1 www 1646: +'opener.notclear=0;opener.objcont['+data1[1]
1647: +']=opener.escape(self.document.forms.resinfo.elements.t.value)+'+"':'"
1648: +'+opener.escape(self.document.forms.resinfo.elements.u.value)+'+"':'"
1.3 www 1649: +'+self.document.forms.resinfo.elements.e.checked+'+"':'"
1650: +'+self.document.forms.resinfo.elements.h.value+'+"':res'"
1651: +';opener.infoclear();opener.editmode=0;opener.draw();">'
1652: +'<b>Change to above values</b></a> '
1.1 www 1653: +' <a href="javascript:self.document.forms.resinfo.reset()">Reset</a>'
1.3 www 1654: +'</td></tr></table>');
1.5 www 1655: if ((data2[3]!='start') && (data2[3]!='finish')) {
1.1 www 1656: inf.document.writeln(
1657: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1658: +'opener.delres('+data1[1]+',0);opener.editmode=0;opener.draw('
1.2 www 1659: +');">Delete Resource (cutting links)</a>');
1.1 www 1660: inf.document.writeln(
1661: '<br><a href="javascript:opener.notclear=0;opener.infoclear();'
1662: +'opener.delres('+data1[1]+',1);opener.editmode=0;opener.draw('
1.2 www 1663: +');">Delete Resource (preserving links)</a>');
1.5 www 1664: }
1665: if (data2[3]!='finish') {
1.1 www 1666: inf.document.writeln(
1667: '<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
1668: +'opener.linkmode='+data1[1]+';'
1669: +'opener.infoclear();">Link Resource</a>');
1.5 www 1670: }
1.14 www 1671: inf.document.writeln(
1672: '<br><a href="javascript:'
1673: +'opener.setparms('+data1[1]+');'
1674: +'opener.infoclear();">Set Parameters</a>');
1675:
1.1 www 1676: }
1677: } else {
1678: linkmode=0;
1.3 www 1679: inf.document.writeln('<b>Link</b><hr><form>');
1.1 www 1680: data2=obj[data1[0]].split('&');
1681: k=data2[data2.length-2];
1682: data3=objlinks[k].split(':');
1683: inf.document.writeln('From <b>'+objcont[data3[0]].split(':')[0]+
1684: '</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
1685: inf.document.writeln('<br><a href="javascript:opener.dellink('+
1686: k+');opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1687: +');">Delete Link</a>');
1688: inf.document.writeln('<br><a href="javascript:'+
1.3 www 1689: "opener.insertreslink('"+infostr+"');"+
1.2 www 1690: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1691: +');">Insert Resource Into Link</a>');
1.1 www 1692: }
1693: }
1694: inf.document.writeln(
1695: '<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
1696: +'opener.infoclear();">Done</a>');
1.3 www 1697: inf.document.writeln('</form></td></tr></table></body></html>');
1.1 www 1698: inf.document.close();
1699: inf.focus();
1700: }
1701:
1702: // ----------------------------------------------------- Clicks on empty fields
1703:
1704: function empty(rid,k) {
1705: var cid=findcol(k);
1706: var lcol=k-1;
1707: trow=row[rid];
1708: lrow=trow-1;
1709: editmode=1;
1710: notclear=1;
1711: linkmode=0;
1.5 www 1712: infcheck();
1.1 www 1713: inf.document.clear();
1714: inf.document.writeln(
1715: '<html><body bgcolor="#FFFFFF">'+
1716: '<table><tr><td width=32><img src="edit.gif"></td><td bgcolor="#AAFFAA">'+
1717: '<b>Empty Field</b><hr>');
1718:
1719: inf.document.writeln('<br><a href="javascript:opener.newresource('+
1.3 www 1720: rid+','+cid+",'','','false','normal');"+
1721: 'opener.mostrecent=opener.obj.length-1;'+
1722: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1723: +');">Insert resource</a>');
1724:
1.13 www 1725: if ((mostrecent!=0) && (objcont[mostrecent]!='') &&
1726: (objcont[mostrecent]!=undefined)) {
1.3 www 1727:
1728: inf.document.writeln('<br><a href="javascript:opener.newresource('+
1729: rid+','+cid+",'','','false','normal');"+
1730: 'opener.mostrecent=opener.obj.length-1;'+
1731: 'opener.joinres('+mostrecent+',opener.obj.length-1,0);'+
1.1 www 1732: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.3 www 1733: +');">Insert resource linked to from most recent one</a>');
1734:
1735: inf.document.writeln('<br><a href="javascript:opener.newresource('+
1736: rid+','+cid+",'','','false','normal');"+
1737: 'opener.mostrecent=opener.obj.length-1;'+
1738: 'opener.joinres(opener.obj.length-1,'+mostrecent+',0);'+
1739: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1740: +');">Insert resource linking to most recent one</a>');
1741: }
1742:
1743:
1.1 www 1744: inf.document.writeln('<hr>Insert column:');
1745: inf.document.writeln('<a href="javascript:opener.insertcol('+
1746: lcol+');opener.addobj('+rid+",'e&'+opener.maxcol);"
1747: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1748: +');">left</a>');
1.1 www 1749: inf.document.writeln('<a href="javascript:opener.insertcol('+
1750: k+');opener.addobj('+rid+",'e&'+opener.maxcol);"
1751: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1752: +');">right</a> ');
1.1 www 1753: inf.document.writeln('<br>Insert row:');
1754: inf.document.writeln('<a href="javascript:opener.insertrow('+
1755: trow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
1756: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1757: +');">below</a>');
1.1 www 1758: inf.document.writeln('<a href="javascript:opener.insertrow('+
1759: lrow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
1760: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1761: +');">above</a> ');
1.1 www 1762:
1763:
1764: inf.document.writeln(
1765: '<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
1766: +'opener.infoclear();">Done</a>');
1767: inf.document.writeln('</td></tr></table></body></html>');
1768: inf.document.close();
1769: inf.focus();
1770: }
1771:
1772: // ---------------------------------------------------- Save into hidden fields
1773:
1774: function save() {
1.3 www 1775: var k;
1776: if (graphdef=='yes') {
1.2 www 1777: parent.server.document.forms.storage.output.value='graphdef<:>yes';
1.6 www 1778: for (k=1;k<obj.length;k++) {
1.2 www 1779: parent.server.document.forms.storage.output.value+=
1.1 www 1780: '<&>obj<:>'+k+'<:>'+obj[k];
1781: }
1782: for (k=0;k<row.length;k++) {
1.2 www 1783: parent.server.document.forms.storage.output.value+=
1.1 www 1784: '<&>row<:>'+k+'<:>'+row[k];
1785: }
1786: for (k=0;k<col.length;k++) {
1.2 www 1787: parent.server.document.forms.storage.output.value+=
1.1 www 1788: '<&>col<:>'+k+'<:>'+col[k];
1789: }
1790: for (k=0;k<rowcont.length;k++) {
1791: if (rowcont[k]) {
1.2 www 1792: parent.server.document.forms.storage.output.value+=
1.1 www 1793: '<&>rowcont<:>'+k+'<:>'+rowcont[k];
1794: }
1795: }
1.2 www 1796: parent.server.document.forms.storage.output.value+=
1.1 www 1797: '<&>maxcol<:>'+maxcol;
1.2 www 1798: parent.server.document.forms.storage.output.value+=
1.1 www 1799: '<&>maxrow<:>'+maxrow;
1.4 www 1800: parent.server.document.forms.storage.output.value+=
1801: '<&>zscale<:>'+zscale;
1802: } else {
1.3 www 1803: parent.server.document.forms.storage.output.value='graphdef<:>no';
1804: }
1805: parent.server.document.forms.storage.output.value+=
1806: '<&>tablemode<:>'+tablemode;
1807:
1.1 www 1808: for (k=0;k<objcont.length;k++) {
1809: if (objcont[k]) {
1.2 www 1810: parent.server.document.forms.storage.output.value+=
1.1 www 1811: '<&>objcont<:>'+k+'<:>'+objcont[k];
1812: }
1813: }
1814: for (k=0;k<objlinks.length;k++) {
1815: if (objlinks[k]) {
1.2 www 1816: parent.server.document.forms.storage.output.value+=
1.1 www 1817: '<&>objlinks<:>'+k+'<:>'+objlinks[k];
1818: }
1819: }
1.2 www 1820: undopointer++;
1821: undostack[undopointer]=
1822: parent.server.document.forms.storage.output.value;
1.1 www 1823: }
1824:
1825: // ----------------------------------------------- Reset all layout information
1826:
1827: function graphreset() {
1828:
1.4 www 1829: var k;
1830:
1831: for (k=0;k<obj.length;k++) { obj[k]=''; }
1.1 www 1832: obj.length=0;
1833: obj[0]='';
1834:
1835: rowcont.length=0;
1836: rowcont[0]='';
1.4 www 1837:
1.1 www 1838: row.length=0;
1839: row[0]=0;
1.4 www 1840: maxrow=0;
1.1 www 1841:
1842: col.length=0;
1843: colmap.length=0;
1844: maxcol=-1;
1845: insertcol(-1);
1.4 www 1846:
1847: objcont[0]='';
1.11 www 1848: objlinks[0]='';
1.9 www 1849: if (((objcont[1]==undefined)&&(objcont[2]==undefined)) ||
1850: ((objcont[1]=='')&&(objcont[2]==''))) {
1851: objcont[1]='Start::false:start:res'
1852: objcont[2]='Finish::false:finish:res';
1853: }
1.1 www 1854: graphdef='no';
1855:
1856: }
1857:
1858: // --------------------- Compare two resources with each other for "straighten"
1859:
1860: function rescompare(a,b) {
1861: data1=a.split(':');
1862: data2=b.split(':');
1863: var rvalue=0;
1864: var k;
1865: for (k=1;k<data1.length;k++) {
1866: if (data1[k]==data2[0]) { rvalue--; }
1867: }
1868: for (k=1;k<data3.length;k++) {
1869: if (data2[k]==data1[0]) { rvalue++; }
1870: }
1871: if (rvalue==0) { rvalue=data2.length-data1.length; }
1872: return rvalue;
1873: }
1874:
1.2 www 1875: // -------------------------------------------- Draw the table instead of graph
1876:
1877: function tabledraw() {
1.3 www 1878: var objsorted=new Array();
1879: var robjs=new Array();
1.4 www 1880: var iobjs=new Array();
1.3 www 1881: var k;
1882: var i;
1883: var j;
1884: var nr;
1.4 www 1885: var ck;
1886: var cck;
1887: var condid;
1.3 www 1888: var sortstr=sortobjs();
1.5 www 1889: insrestab(1,-1,-1,'');
1.13 www 1890: if ((sortstr!='') && (sortstr!=undefined)) {
1.3 www 1891: objsorted=sortstr.split('&');
1892: for (k=0;k<objsorted.length;k++) {
1.4 www 1893: i=(objsorted[k].split(':'))[0];
1894: iobjs[k]=i;
1895: robjs[i]=k;
1.3 www 1896: }
1.4 www 1897: for (k=0;k<iobjs.length;k++) {
1898: i=iobjs[k];
1.3 www 1899: if (k<objsorted.length-1) {
1.4 www 1900: nr=iobjs[k+1];
1.3 www 1901: } else {
1902: nr=-1;
1903: }
1904: data1=objcont[i].split(':');
1.4 www 1905: ck=rescolor(data1[2],data1[3]);
1.3 www 1906: parent.mapout.document.write('<tr><td bgcolor="'+ck
1.4 www 1907: +'"><b><a href="javascript:if (parent.code.linkmode!=0) { '
1908: +'parent.code.joinres(parent.code.linkmode,'+i+',0);'
1909: +'parent.code.linkmode=0;parent.code.editmode=0;'
1910: +'parent.code.notclear=0;parent.code.infoclear();'
1911: +'parent.code.draw(); }">'+k+'</a></b></td><td bgcolor="'+ck
1.3 www 1912: +'"><form name=r'+i+' method=post>');
1913: data2=obj[i].split('&');
1914: parent.mapout.document.write('<table bgcolor="#CCCCCC">');
1.5 www 1915: if (data1[3]=='start') {
1916: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
1917: }
1918: if (data1[3]=='finish') {
1919: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
1920: }
1.3 www 1921: parent.mapout.document.write(
1.4 www 1922: '<tr><td>Title:</td><td><input type=text name=t size=50 value="'
1.5 www 1923: +data1[0]+'"><input type=hidden name=h value='+data1[3]
1924: +'></td></tr>');
1925: if ((data1[3]!='start') && (data1[3]!='finish')) {
1.3 www 1926: parent.mapout.document.write(
1.4 www 1927: '<tr><td>URL:</td><td><input type=text name=u size=50 value="'
1.3 www 1928: +data1[1]+'"></td></tr>'
1929: +'<tr><td>External:</td><td><input type=checkbox name=e');
1930: if (data1[2]=='true') { parent.mapout.document.write(' checked'); }
1931: parent.mapout.document.write('></td></tr>'
1.5 www 1932: +'<tr><td colspan=2><input type=radio name=y value=normal '+
1.3 www 1933: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
1934: "'normal'"+'"');
1935: if (data1[3]=='normal') { parent.mapout.document.write(' checked'); }
1936: parent.mapout.document.write(
1937: '> Regular <input type=radio name=y value=mandatory '+
1938: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
1939: "'mandatory'"+'"');
1940: if (data1[3]=='mandatory') { parent.mapout.document.write(' checked'); }
1941: parent.mapout.document.write(
1942: '> Mandatory <input type=radio name=y value=optional '+
1943: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
1944: "'optional'"+'"');
1945: if (data1[3]=='optional') { parent.mapout.document.write(' checked'); }
1.5 www 1946: parent.mapout.document.write('> Optional</td></tr>');
1947: } else {
1948: parent.mapout.document.write(
1949: '<tr><td><input type=hidden name=u value="">'
1950: +'<input type=hidden name=e value=false></td></tr>');
1951: }
1952: parent.mapout.document.write(
1953: '<tr><td colspan=2><a href="javascript:parent.code.objcont['+i
1.3 www 1954: +']=parent.code.escape(parent.mapout.document.forms.r'+i
1955: +'.elements.t.value)+'+"':'"
1956: +'+parent.code.escape(parent.mapout.document.forms.r'+i
1957: +'.elements.u.value)+'+"':'"
1958: +'+parent.mapout.document.forms.r'+i+'.elements.e.checked+'+"':'"
1959: +'+parent.mapout.document.forms.r'+i+'.elements.h.value+'+"':res'"
1960: +';parent.code.draw();">'
1961: +'<b>Change to above values</b></a> '
1962: +' <a href="javascript:parent.mapout.document.forms.r'+i
1.5 www 1963: +'.reset()">Reset</a></td></tr><tr><td colspan=2>');
1964: if ((data1[3]!='start') && (data1[3]!='finish')) {
1965: parent.mapout.document.writeln(
1966: '<A href="javascript:parent.code.notclear=0;parent.code.infoclear();'
1.4 www 1967: +'parent.code.delres('+i+',0);parent.code.editmode=0;parent.code.draw();">'
1968: +'Delete Resource (cutting links)</A><br>'
1969: +'<A href="javascript:parent.code.notclear=0;parent.code.infoclear();'
1970: +'parent.code.delres('+i+',1);parent.code.editmode=0;parent.code.draw();">'
1.5 www 1971: +'Delete Resource (preserving links)</A><br>');
1972: }
1973: if (data1[3]!='finish') {
1974: parent.mapout.document.writeln(
1975: '<a href="javascript:parent.code.linkmode='+i+
1.4 www 1976: ';parent.code.notclear=0;parent.code.infoclear();">'+
1.14 www 1977: 'Link resource</a>');
1.5 www 1978: }
1.14 www 1979: parent.mapout.document.writeln(
1980: '<br><a href="javascript:'
1981: +'parent.code.setparms('+i+');">Set Parameters</a>');
1982:
1983: parent.mapout.document.writeln('</td></tr>');
1.4 www 1984: parent.mapout.document.writeln('<tr><td colspan=2><table><tr>');
1.3 www 1985: for (j=2;j<data2.length;j++) {
1.4 www 1986: data4=data2[j].split(':');
1987: data3=objlinks[data4[2]].split(':');
1.3 www 1988: if (data3.length>1) {
1989: if (data3[1]==nr) {
1.4 www 1990: cck='#AAAAAA';
1991: if (data3[2]!=0) {
1992: cck=condcolor((objcont[data3[2]].split(':'))[1]);
1993: condid=data3[2];
1994: } else {
1995: condid='-';
1996: }
1997: parent.mapout.document.writeln(
1998: '<td bgcolor='+cck+'>Next<br>');
1999: parent.mapout.document.writeln(
2000: '<a href="javascript:parent.code.handler('+
2001: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
2002: +'">Edit</a>');
1.3 www 2003: parent.mapout.document.writeln('</td>');
2004: }
2005: }
2006: }
2007: for (j=2;j<data2.length;j++) {
1.4 www 2008: data4=data2[j].split(':');
2009: data3=objlinks[data4[2]].split(':');
1.3 www 2010: if (data3.length>1) {
2011: if ((data3[1]!=nr) && (data3[1]!=0)) {
1.4 www 2012: cck='#AAAAAA';
2013: if (data3[2]!=0) {
2014: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2015: condid=data3[2];
2016: } else {
2017: condid='-';
2018: }
1.3 www 2019: parent.mapout.document.writeln(
1.4 www 2020: '<td bgcolor='+cck+'>To: '+robjs[data3[1]]+'<br>');
2021: parent.mapout.document.writeln(
2022: '<a href="javascript:parent.code.handler('+
2023: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
2024: +'">Edit</a>');
1.3 www 2025: parent.mapout.document.writeln('</td>');
2026: }
2027: }
2028: }
2029: parent.mapout.document.writeln(
1.4 www 2030: '</tr></table></td></tr></table></form>');
1.5 www 2031: insrestab(rrow[data2[1]],i,nr,data1[3]);
1.4 www 2032:
1.3 www 2033: }
2034: }
2035: }
2036:
1.4 www 2037: // ----------------------------------------------------- Insert Resource Output
2038:
1.5 www 2039: function insrestab(irow,be,af,typ) {
1.4 www 2040: parent.mapout.document.writeln('<tr><td colspan=2>'+
2041: '<table><tr><td><a href="javascript:parent.code.insertrow('
2042: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[1]
2043: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
2044: +'parent.code.draw();">'
2045: +'Insert resource</a></td><td>');
1.5 www 2046: if ((be!=-1) && (typ!='finish')) {
1.4 www 2047: parent.mapout.document.writeln(
2048: '<a href="javascript:parent.code.insertrow('
2049: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2050: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1.15 www 2051: +"parent.code.save();"
1.4 www 2052: +'parent.code.joinres('+be+',parent.code.mostrecent,0);'
2053: +'parent.code.draw();">'
2054: +'Insert resource linked to from above</a><br>');
2055: }
1.5 www 2056: if ((be!=-1) && (af!=-1) && (typ!='finish')) {
1.4 www 2057: parent.mapout.document.writeln(
2058: '<a href="javascript:parent.code.insertrow('
2059: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2060: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1.15 www 2061: +"parent.code.save();"
1.4 www 2062: +'parent.code.joinres('+be+',parent.code.mostrecent,0);'
1.15 www 2063: +"parent.code.save();"
1.4 www 2064: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
2065: +'parent.code.draw();">'
2066: +'Insert resource linked to from above and linking to below</a><br>');
2067: }
2068: if (af!=-1) {
2069: parent.mapout.document.writeln(
2070: '<a href="javascript:parent.code.insertrow('
2071: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2072: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1.15 www 2073: +"parent.code.save();"
1.4 www 2074: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
2075: +'parent.code.draw();">'
2076: +'Insert resource linking to below</a><br>');
2077: }
2078: parent.mapout.document.writeln('</td></tr></table></tr>');
2079: }
2080: // ---------------------------------------- Draw simple table instead of graph
2081:
2082: function simpletabledraw() {
2083: var objsorted=new Array();
2084: var robjs=new Array();
2085: var iobjs=new Array();
2086: var k;
2087: var i;
2088: var j;
2089: var nr;
2090: var ck;
2091: var cck;
2092: var condid;
2093: var sortstr=sortobjs();
1.13 www 2094: if ((sortstr!='') && (sortstr!=undefined)) {
1.4 www 2095: objsorted=sortstr.split('&');
2096: for (k=0;k<objsorted.length;k++) {
2097: i=(objsorted[k].split(':'))[0];
2098: iobjs[k]=i;
2099: robjs[i]=k;
2100: }
2101: for (k=0;k<iobjs.length;k++) {
2102: i=iobjs[k];
2103: if (k<objsorted.length-1) {
2104: nr=iobjs[k+1];
2105: } else {
2106: nr=-1;
2107: }
2108: data1=objcont[i].split(':');
2109: ck=rescolor(data1[2],data1[3]);
2110: parent.mapout.document.write('<tr><td bgcolor="'+ck
2111: +'"><b>'+k+'</b></td><td bgcolor="'+ck
2112: +'">');
2113: data2=obj[i].split('&');
2114: parent.mapout.document.write('<table>');
1.5 www 2115: if (data1[3]=='start') {
2116: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
2117: }
2118: if (data1[3]=='finish') {
2119: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
2120: }
1.4 www 2121: parent.mapout.document.write(
2122: '<tr><td>Title:</td><td>'+data1[0]+'</td></tr>');
2123: parent.mapout.document.write(
2124: '<tr><td>URL:</td><td>'+data1[1]+'</td></tr>'
2125: +'<tr><td colspan=2><table><tr>');
2126: for (j=2;j<data2.length;j++) {
2127: data4=data2[j].split(':');
2128: data3=objlinks[data4[2]].split(':');
2129: if (data3.length>1) {
2130: if (data3[1]==nr) {
2131: cck='#AAAAAA';
2132: if (data3[2]!=0) {
2133: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2134: condid=data3[2];
2135: } else {
2136: condid='-';
2137: }
2138: parent.mapout.document.writeln(
2139: '<td bgcolor='+cck+'>Next<br>');
2140: parent.mapout.document.writeln('</td>');
2141: }
2142: }
2143: }
2144: for (j=2;j<data2.length;j++) {
2145: data4=data2[j].split(':');
2146: data3=objlinks[data4[2]].split(':');
2147: if (data3.length>1) {
2148: if ((data3[1]!=nr) && (data3[1]!=0)) {
2149: cck='#AAAAAA';
2150: if (data3[2]!=0) {
2151: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2152: condid=data3[2];
2153: } else {
2154: condid='-';
2155: }
2156: parent.mapout.document.writeln(
2157: '<td bgcolor='+cck+'>To: '+robjs[data3[1]]+'<br>');
2158: parent.mapout.document.writeln('</td>');
2159: }
2160: }
2161: }
2162: parent.mapout.document.writeln('</tr></table></td></tr></table></tr>');
2163: }
2164: } else {
2165: parent.mapout.document.writeln('<tr><td>No Resources</td></tr>');
2166: }
2167: }
2168:
1.3 www 2169: // ---------------------------------- Sort objects to straighten graph or table
2170:
2171: function sortobjs() {
1.8 www 2172: message("Sorting Resources: "+funny);
1.2 www 2173: var k;
2174: var ij;
1.3 www 2175: var dol;
2176: var dtl;
1.2 www 2177: var kj;
1.3 www 2178: var sortthis=0;
1.2 www 2179: var objsort=new Array();
2180: for (k=1;k<objcont.length;k++) {
2181: if (objcont[k]) {
2182: data1=objcont[k].split(':');
2183: if (data1[data1.length-1]=='res') {
2184: objsort[objsort.length]=''+k;
2185: }
2186: }
2187: }
1.3 www 2188: if (objsort.length==0) { return ''; }
1.2 www 2189: for (k=1;k<objlinks.length;k++) {
1.8 www 2190: wheelswitch();
2191: message("Sorting Resources: "+funny);
1.13 www 2192: if ((objlinks[k]!=undefined) && (objlinks[k]!='')) {
1.3 www 2193: sortthis=1;
1.2 www 2194: data1=objlinks[k].split(':');
2195: kj=-1;
2196: for (j=0;j<objsort.length;j++) {
2197: if ((objsort[j].split(':'))[0]==data1[0]) {
2198: kj=j;
2199: }
2200: }
1.8 www 2201: if (kj!=-1) { objsort[kj]+=':'+data1[1]; }
1.3 www 2202: }
1.2 www 2203: }
1.3 www 2204: if (sortthis!=0) {
2205: for (k=0;k<objsort.length;k++) {
1.8 www 2206: wheelswitch();
2207: message("Sorting Resources: "+funny);
1.3 www 2208: for (j=0;j<objsort.length;j++) {
2209: if (k!=j) {
2210: data1=objsort[k].split(':');
2211: data2=objsort[j].split(':');
2212: dol=data1.length;
2213: dtl=data2.length;
1.8 www 2214: if (dol+dtl<200) {
2215: for (kj=1;kj<dol;kj++) {
1.3 www 2216: if (data1[kj]==data2[0]) {
2217: for (ij=1;ij<dtl;ij++) {
2218: data1[data1.length]=data2[ij];
2219: }
2220: }
1.8 www 2221: }
2222: for (kj=1;kj<dtl;kj++) {
1.3 www 2223: if (data2[kj]==data1[0]) {
2224: for (ij=1;ij<dol;ij++) {
1.8 www 2225: data2[data2.length]=data1[ij];
2226: }
2227: }
2228: }
2229: objsort[k]=data1.join(':');
2230: objsort[j]=data2.join(':');
1.3 www 2231: }
2232: }
2233: }
1.2 www 2234: }
1.8 www 2235: message("Sorting Resources: finishing up.");
1.3 www 2236: return objsort.sort(rescompare).join('&');
2237: } else {
2238: return objsort.join('&');
2239: }
1.2 www 2240: }
2241:
1.3 www 2242: // ----------------------------------------------------------- Straighten graph
1.1 www 2243:
2244: function graphopt() {
1.3 www 2245: var k;
2246: var kj;
2247: var ij;
2248:
2249: var objsorted=new Array();
2250: condense();
2251: graphreset();
2252: objsorted=(sortobjs()).split('&');
2253: if (objsorted.length==0) { return; }
2254: message("Creating Optimized Graph");
1.1 www 2255: var thisnewobj=''+(objsorted[0].split(':'))[0];
2256: rowcont[1]=thisnewobj;
2257: var thiscolmax=1;
2258: obj[thisnewobj]='b&1&'+thiscolmax+':0:0:0';
2259: var allcolmax=0;
2260: for (k=1;k<objsorted.length;k++) {
2261: thisnewobj=(objsorted[k].split(':'))[0];
2262: if (rescompare(objsorted[k-1],objsorted[k])==0) {
2263: rowcont[rowcont.length-1]+=':'+thisnewobj;
2264: thiscolmax++;
2265: } else {
2266: rowcont[rowcont.length]=thisnewobj;
2267: thiscolmax=1;
2268: }
2269: kj=rowcont.length-1;
1.5 www 2270: obj[thisnewobj]='b&'+kj+'&'+thiscolmax+':0:0:0';
2271: if (thiscolmax>allcolmax) { allcolmax=thiscolmax; }
1.1 www 2272: }
2273: for (k=0;k<obj.length;k++) {
2274: if (!obj[k]) { obj[k]=''; }
2275: }
2276: for (k=0;k<=allcolmax;k++) { insertcol(0); }
2277: for (k=0;k<rowcont.length;k++) {
2278: row[k]=k;
2279: }
2280: maxrow=rowcont.length-1;
2281: var oldlinks=new Array();
1.11 www 2282: for (k=0;k<objlinks.length;k++) {
2283: oldlinks[k]=objlinks[k];
2284: objlinks[k]='';
2285: }
1.1 www 2286: objlinks.length=0;
2287: objlinks[0]='';
1.11 www 2288: graphdef='yes';
2289: save();
2290:
1.1 www 2291: for (k=0;k<objsorted.length;k++) {
1.11 www 2292: wheelswitch();
2293: message("Connecting Resources: "+funny);
2294: kj=(objsorted[k].split(':'))[0];
1.1 www 2295: for (ij=1;ij<oldlinks.length;ij++) {
2296: if (oldlinks[ij]) {
2297: data1=oldlinks[ij].split(':');
2298: if (data1[0]==kj) {
2299: joinres(data1[0],data1[1],data1[2]);
1.11 www 2300: save();
1.1 www 2301: }
2302: }
2303: }
2304: }
2305: }
2306:
2307: // ----------------------------------------------------------- Remove e-objects
2308:
2309: function condense() {
1.3 www 2310: message("Condensing");
1.1 www 2311: var j;
2312: for (j=0;j<=maxrow;j++) {
1.13 www 2313: if ((rowcont[j]!='') && (rowcont[j]!=undefined)) {
1.1 www 2314: data1=rowcont[j].split(':');
2315: rowcont[j]='';
2316: for (k=0;k<data1.length;k++) {
2317: if (obj[data1[k]].substring(0,2)!='e&') {
1.13 www 2318: if ((rowcont[j]!='') && (rowcont[j]!=undefined)) {
2319: rowcont[j]+=':';
2320: }
1.1 www 2321: rowcont[j]+=data1[k];
2322: }
2323: }
2324: }
2325: }
2326: }
2327:
2328: // ---------------------------------------------------- Load from hidden fields
2329:
2330: function load() {
1.4 www 2331: message("Loading");
1.8 www 2332: schedule('load');
2333: checkdef();
2334: }
2335:
2336: function finishload() {
1.4 www 2337: var k;
2338: for (k=0;k<objcont.length;k++) { objcont[k]=''; }
1.1 www 2339: objcont.length=0;
1.4 www 2340: for (k=0;k<objlinks.length;k++) { objlinks[k]=''; }
1.1 www 2341: objlinks.length=0;
2342: objlinks[0]='';
2343: objcont[0]='';
2344: editmode=0;
2345: notclear=0;
2346: lastinfo='';
2347: graphreset();
1.2 www 2348: var inputstr=parent.server.document.forms.storage.output.value;
1.13 www 2349: if ((inputstr!='') && (inputstr!=undefined)) {
1.1 www 2350: data1=inputstr.split('<&>');
2351: var k;
2352: for (k=0;k<data1.length;k++) {
2353: data2=data1[k].split('<:>');
2354: if (data2[0]=='graphdef') { graphdef=data2[1]; }
2355: if (data2[0]=='maxcol') { maxcol=1*data2[1]; }
2356: if (data2[0]=='maxrow') { maxrow=1*data2[1]; }
2357: if (data2[0]=='obj') { obj[data2[1]]=data2[2]; }
2358: if (data2[0]=='objcont') { objcont[data2[1]]=data2[2]; }
2359: if (data2[0]=='objlinks') { objlinks[data2[1]]=data2[2]; }
2360: if (data2[0]=='rowcont') { rowcont[data2[1]]=data2[2]; }
2361: if (data2[0]=='row') { row[data2[1]]=1*data2[2]; }
2362: if (data2[0]=='col') { col[data2[1]]=1*data2[2]; }
1.6 www 2363: if (data2[0]=='mode') { mode=data2[1]; }
1.3 www 2364: if (data2[0]=='tablemode') { tablemode=1*data2[1]; }
1.4 www 2365: if (data2[0]=='zscale') { zscale=1*data2[1]; }
1.1 www 2366: }
1.9 www 2367: }
2368: if (graphdef=='yes') {
2369: for (k=1;k<=maxrow;k++) {
2370: if (rowcont[k]==undefined) { rowcont[k]=''; }
2371: }
1.3 www 2372: }
1.1 www 2373: }
2374:
1.14 www 2375: // -------------------------------------------------------------- Parameter set
2376:
2377: function setparms(resid) {
2378: alert('Called setparms for '+resid);
2379: }
2380:
1.2 www 2381: // -------------------------------------------------------------- Undo function
2382:
2383: function undo() {
2384: if (undopointer>1) {
2385: undopointer--;
2386: parent.server.document.forms.storage.output.value
2387: =undostack[undopointer];
1.8 www 2388: finishload();
1.2 www 2389: undopointer--;
2390: draw();
2391: stored=0;
2392: } else {
2393: alert("Cannot undo: reached beginning of edit session");
2394: }
2395: }
2396:
2397: // -------------------------------------------------------------- Redo function
2398:
2399: function redo() {
2400: if (undopointer<undostack.length-1) {
2401: undopointer++;
2402: parent.server.document.forms.storage.output.value
2403: =undostack[undopointer];
1.8 www 2404: finishload();
1.2 www 2405: undopointer--;
2406: draw();
2407: stored=0;
2408: } else {
2409: alert("Cannot redo: reached end of edit session");
2410: }
2411: }
2412:
2413: // ------------------------------------------------------------ Revert function
2414:
2415: function revert() {
2416: if (confirm("Revert to beginning of edit session?")) {
2417: undopointer=2;
2418: undo();
2419: }
2420: }
2421:
1.8 www 2422: // ---------------------------------------------------------------- Wheelswitch
2423:
2424: function wheelswitch() {
2425: if (funny=='|') {
2426: funny='/';
2427: } else {
2428: if (funny=='/') {
2429: funny='-';
2430: } else {
2431: if (funny=='-') {
2432: funny='\\';
2433: } else {
2434: if (funny=='\\') { funny='|'; }
2435: }
2436: }
2437: }
2438: }
2439:
2440: // --------------------------------------------- Checks if server frame defined
2441:
2442: function checkdef() {
2443: if (parent.server.document.forms.storage.output.value!=undefined) {
2444: srvloaded();
2445: }
2446: if ((finishdone==0) && (tim==0)) { setTimeout('checkdef()',100); }
2447: }
2448:
2449: // ---------------------------------------------------------- The wait function
2450:
2451: function wait() {
2452: if ((finishdone==1) || (tim==1)) {
2453: if (tim==0) {
2454: clearTimeout(canceltim);
2455: if (reqaction=='save') { finishsave(); }
2456: if (reqaction=='load') { finishload(); draw(); }
2457: } else {
2458: alert("Server Communication Timed Out.");
2459: }
2460: } else {
2461: wheelswitch();
2462: message('Waiting for server reply: '+funny);
2463: setTimeout('wait();',100);
2464: }
2465: }
2466:
2467: // ---------------------------------------------------------- Schedule function
2468:
2469: function schedule(action) {
2470: reqaction=action;
2471: tim=0;
2472: finishdone=0;
2473: canceltim=setTimeout('tim=1;',20000)
2474: wait();
2475: }
2476:
1.2 www 2477: // -------------------------------------------------------------- Store changes
2478:
2479: function storechange() {
1.8 www 2480: var k;
1.2 www 2481: parent.server.document.forms.storage.submit();
1.8 www 2482: schedule('save');
2483: }
2484:
2485: function finishsave() {
2486: finishload();
1.7 www 2487: draw();
1.2 www 2488: stored=1;
2489: }
2490:
1.8 www 2491: // --------------------------------------- Gets called when submission finished
2492:
2493: function srvloaded() {
2494: finishdone=1;
2495: message("Server replied.");
2496: }
2497:
1.2 www 2498: // ---------------------------------------------------------------- Toggle Mode
2499:
2500: function togglemode() {
1.4 www 2501: if (tablemode==0) {
2502: tablemode=1;
2503: } else {
2504: if (tablemode==1) {
2505: tablemode=2;
2506: } else {
2507: tablemode=0;
2508: }
2509: }
2510: notclear=0;
2511: infoclear();
1.2 www 2512: draw();
2513: }
2514:
1.1 www 2515: // -------------------------------------------------------- Main program onLoad
2516:
2517: function main() {
2518:
2519: if (mainrun==0) {
1.5 www 2520: infopen();
2521: infoclear();
1.1 www 2522: load();
1.2 www 2523: stored=1;
1.1 www 2524: mainrun=1;
2525: }
2526:
2527: }
2528:
1.14 www 2529: // ---------------------------------------------------------- Close the window?
1.2 www 2530:
2531: function leave() {
1.5 www 2532: if (!inf.closed) {
2533: inf.close();
1.17 harris41 2534: }
2535: if (!srch.closed) {
2536: srch.close();
1.2 www 2537: }
2538: }
2539:
1.1 www 2540: </script>
2541: </head>
2542:
1.2 www 2543: <body bgcolor="#FFFFFF" onLoad="main();" onUnload="leave();">
2544: <a href="javascript:togglemode();">Toggle Display Mode</a>
1.4 www 2545: <a href="javascript:if (zscale>1) { zscale--; draw();}">Zoom Out</a>
2546: <a href="javascript:if (zscale<3) { zscale++; draw();}">Zoom In</a>
1.2 www 2547: <a href="javascript:condense();draw();">Condense</a>
2548: <a href="javascript:graphopt();draw();">Straighten</a>
2549: <a href="javascript:revert();">Revert</a>
2550: <a href="javascript:undo();">Undo</a>
2551: <a href="javascript:redo();">Redo</a>
2552: <a href="javascript:storechange();">Store</a>
1.1 www 2553: </body>
1.2 www 2554: </html>
2555:
2556:
2557:
2558:
2559:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>