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