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