Annotation of rat/client/code.html, revision 1.35
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.34 www 18: 06/11 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;
1862:
1.1 www 1863: for (k=0;k<objcont.length;k++) {
1864: if (objcont[k]) {
1.2 www 1865: parent.server.document.forms.storage.output.value+=
1.1 www 1866: '<&>objcont<:>'+k+'<:>'+objcont[k];
1867: }
1868: }
1869: for (k=0;k<objlinks.length;k++) {
1870: if (objlinks[k]) {
1.2 www 1871: parent.server.document.forms.storage.output.value+=
1.1 www 1872: '<&>objlinks<:>'+k+'<:>'+objlinks[k];
1873: }
1874: }
1.2 www 1875: undopointer++;
1876: undostack[undopointer]=
1877: parent.server.document.forms.storage.output.value;
1.1 www 1878: }
1879:
1880: // ----------------------------------------------- Reset all layout information
1881:
1882: function graphreset() {
1883:
1.4 www 1884: var k;
1885:
1886: for (k=0;k<obj.length;k++) { obj[k]=''; }
1.1 www 1887: obj.length=0;
1888: obj[0]='';
1889:
1890: rowcont.length=0;
1891: rowcont[0]='';
1.4 www 1892:
1.1 www 1893: row.length=0;
1894: row[0]=0;
1.4 www 1895: maxrow=0;
1.1 www 1896:
1897: col.length=0;
1898: colmap.length=0;
1899: maxcol=-1;
1900: insertcol(-1);
1.4 www 1901:
1902: objcont[0]='';
1.11 www 1903: objlinks[0]='';
1.9 www 1904: if (((objcont[1]==undefined)&&(objcont[2]==undefined)) ||
1905: ((objcont[1]=='')&&(objcont[2]==''))) {
1906: objcont[1]='Start::false:start:res'
1907: objcont[2]='Finish::false:finish:res';
1908: }
1.1 www 1909: graphdef='no';
1910:
1911: }
1912:
1913: // --------------------- Compare two resources with each other for "straighten"
1914:
1915: function rescompare(a,b) {
1916: data1=a.split(':');
1917: data2=b.split(':');
1918: var rvalue=0;
1919: var k;
1920: for (k=1;k<data1.length;k++) {
1921: if (data1[k]==data2[0]) { rvalue--; }
1922: }
1923: for (k=1;k<data3.length;k++) {
1924: if (data2[k]==data1[0]) { rvalue++; }
1925: }
1926: if (rvalue==0) { rvalue=data2.length-data1.length; }
1927: return rvalue;
1928: }
1929:
1.2 www 1930: // -------------------------------------------- Draw the table instead of graph
1931:
1932: function tabledraw() {
1.3 www 1933: var objsorted=new Array();
1934: var robjs=new Array();
1.4 www 1935: var iobjs=new Array();
1.3 www 1936: var k;
1937: var i;
1938: var j;
1939: var nr;
1.4 www 1940: var ck;
1941: var cck;
1942: var condid;
1.3 www 1943: var sortstr=sortobjs();
1.5 www 1944: insrestab(1,-1,-1,'');
1.13 www 1945: if ((sortstr!='') && (sortstr!=undefined)) {
1.3 www 1946: objsorted=sortstr.split('&');
1947: for (k=0;k<objsorted.length;k++) {
1.4 www 1948: i=(objsorted[k].split(':'))[0];
1949: iobjs[k]=i;
1950: robjs[i]=k;
1.3 www 1951: }
1.4 www 1952: for (k=0;k<iobjs.length;k++) {
1953: i=iobjs[k];
1.3 www 1954: if (k<objsorted.length-1) {
1.4 www 1955: nr=iobjs[k+1];
1.3 www 1956: } else {
1957: nr=-1;
1958: }
1959: data1=objcont[i].split(':');
1.4 www 1960: ck=rescolor(data1[2],data1[3]);
1.3 www 1961: parent.mapout.document.write('<tr><td bgcolor="'+ck
1.4 www 1962: +'"><b><a href="javascript:if (parent.code.linkmode!=0) { '
1963: +'parent.code.joinres(parent.code.linkmode,'+i+',0);'
1964: +'parent.code.linkmode=0;parent.code.editmode=0;'
1965: +'parent.code.notclear=0;parent.code.infoclear();'
1966: +'parent.code.draw(); }">'+k+'</a></b></td><td bgcolor="'+ck
1.3 www 1967: +'"><form name=r'+i+' method=post>');
1968: data2=obj[i].split('&');
1969: parent.mapout.document.write('<table bgcolor="#CCCCCC">');
1.5 www 1970: if (data1[3]=='start') {
1971: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
1972: }
1973: if (data1[3]=='finish') {
1974: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
1975: }
1.3 www 1976: parent.mapout.document.write(
1.4 www 1977: '<tr><td>Title:</td><td><input type=text name=t size=50 value="'
1.5 www 1978: +data1[0]+'"><input type=hidden name=h value='+data1[3]
1979: +'></td></tr>');
1980: if ((data1[3]!='start') && (data1[3]!='finish')) {
1.3 www 1981: parent.mapout.document.write(
1.4 www 1982: '<tr><td>URL:</td><td><input type=text name=u size=50 value="'
1.3 www 1983: +data1[1]+'"></td></tr>'
1984: +'<tr><td>External:</td><td><input type=checkbox name=e');
1985: if (data1[2]=='true') { parent.mapout.document.write(' checked'); }
1986: parent.mapout.document.write('></td></tr>'
1.5 www 1987: +'<tr><td colspan=2><input type=radio name=y value=normal '+
1.3 www 1988: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
1989: "'normal'"+'"');
1990: if (data1[3]=='normal') { parent.mapout.document.write(' checked'); }
1991: parent.mapout.document.write(
1992: '> Regular <input type=radio name=y value=mandatory '+
1993: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
1994: "'mandatory'"+'"');
1995: if (data1[3]=='mandatory') { parent.mapout.document.write(' checked'); }
1996: parent.mapout.document.write(
1997: '> Mandatory <input type=radio name=y value=optional '+
1998: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
1999: "'optional'"+'"');
2000: if (data1[3]=='optional') { parent.mapout.document.write(' checked'); }
1.5 www 2001: parent.mapout.document.write('> Optional</td></tr>');
2002: } else {
2003: parent.mapout.document.write(
2004: '<tr><td><input type=hidden name=u value="">'
2005: +'<input type=hidden name=e value=false></td></tr>');
2006: }
2007: parent.mapout.document.write(
2008: '<tr><td colspan=2><a href="javascript:parent.code.objcont['+i
1.3 www 2009: +']=parent.code.escape(parent.mapout.document.forms.r'+i
2010: +'.elements.t.value)+'+"':'"
2011: +'+parent.code.escape(parent.mapout.document.forms.r'+i
2012: +'.elements.u.value)+'+"':'"
2013: +'+parent.mapout.document.forms.r'+i+'.elements.e.checked+'+"':'"
2014: +'+parent.mapout.document.forms.r'+i+'.elements.h.value+'+"':res'"
2015: +';parent.code.draw();">'
2016: +'<b>Change to above values</b></a> '
2017: +' <a href="javascript:parent.mapout.document.forms.r'+i
1.5 www 2018: +'.reset()">Reset</a></td></tr><tr><td colspan=2>');
2019: if ((data1[3]!='start') && (data1[3]!='finish')) {
2020: parent.mapout.document.writeln(
2021: '<A href="javascript:parent.code.notclear=0;parent.code.infoclear();'
1.4 www 2022: +'parent.code.delres('+i+',0);parent.code.editmode=0;parent.code.draw();">'
2023: +'Delete Resource (cutting links)</A><br>'
2024: +'<A href="javascript:parent.code.notclear=0;parent.code.infoclear();'
2025: +'parent.code.delres('+i+',1);parent.code.editmode=0;parent.code.draw();">'
1.5 www 2026: +'Delete Resource (preserving links)</A><br>');
2027: }
2028: if (data1[3]!='finish') {
2029: parent.mapout.document.writeln(
2030: '<a href="javascript:parent.code.linkmode='+i+
1.4 www 2031: ';parent.code.notclear=0;parent.code.infoclear();">'+
1.14 www 2032: 'Link resource</a>');
1.5 www 2033: }
1.14 www 2034: parent.mapout.document.writeln(
2035: '<br><a href="javascript:'
2036: +'parent.code.setparms('+i+');">Set Parameters</a>');
2037:
2038: parent.mapout.document.writeln('</td></tr>');
1.4 www 2039: parent.mapout.document.writeln('<tr><td colspan=2><table><tr>');
1.3 www 2040: for (j=2;j<data2.length;j++) {
1.4 www 2041: data4=data2[j].split(':');
2042: data3=objlinks[data4[2]].split(':');
1.3 www 2043: if (data3.length>1) {
2044: if (data3[1]==nr) {
1.4 www 2045: cck='#AAAAAA';
2046: if (data3[2]!=0) {
2047: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2048: condid=data3[2];
2049: } else {
2050: condid='-';
2051: }
2052: parent.mapout.document.writeln(
2053: '<td bgcolor='+cck+'>Next<br>');
2054: parent.mapout.document.writeln(
2055: '<a href="javascript:parent.code.handler('+
2056: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
2057: +'">Edit</a>');
1.3 www 2058: parent.mapout.document.writeln('</td>');
2059: }
2060: }
2061: }
2062: for (j=2;j<data2.length;j++) {
1.4 www 2063: data4=data2[j].split(':');
2064: data3=objlinks[data4[2]].split(':');
1.3 www 2065: if (data3.length>1) {
2066: if ((data3[1]!=nr) && (data3[1]!=0)) {
1.4 www 2067: cck='#AAAAAA';
2068: if (data3[2]!=0) {
2069: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2070: condid=data3[2];
2071: } else {
2072: condid='-';
2073: }
1.3 www 2074: parent.mapout.document.writeln(
1.4 www 2075: '<td bgcolor='+cck+'>To: '+robjs[data3[1]]+'<br>');
2076: parent.mapout.document.writeln(
2077: '<a href="javascript:parent.code.handler('+
2078: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
2079: +'">Edit</a>');
1.3 www 2080: parent.mapout.document.writeln('</td>');
2081: }
2082: }
2083: }
2084: parent.mapout.document.writeln(
1.4 www 2085: '</tr></table></td></tr></table></form>');
1.5 www 2086: insrestab(rrow[data2[1]],i,nr,data1[3]);
1.4 www 2087:
1.3 www 2088: }
2089: }
2090: }
2091:
1.4 www 2092: // ----------------------------------------------------- Insert Resource Output
2093:
1.5 www 2094: function insrestab(irow,be,af,typ) {
1.4 www 2095: parent.mapout.document.writeln('<tr><td colspan=2>'+
2096: '<table><tr><td><a href="javascript:parent.code.insertrow('
2097: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[1]
2098: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
2099: +'parent.code.draw();">'
2100: +'Insert resource</a></td><td>');
1.5 www 2101: if ((be!=-1) && (typ!='finish')) {
1.4 www 2102: parent.mapout.document.writeln(
2103: '<a href="javascript:parent.code.insertrow('
2104: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2105: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1.15 www 2106: +"parent.code.save();"
1.4 www 2107: +'parent.code.joinres('+be+',parent.code.mostrecent,0);'
2108: +'parent.code.draw();">'
2109: +'Insert resource linked to from above</a><br>');
2110: }
1.5 www 2111: if ((be!=-1) && (af!=-1) && (typ!='finish')) {
1.4 www 2112: parent.mapout.document.writeln(
2113: '<a href="javascript:parent.code.insertrow('
2114: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2115: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1.15 www 2116: +"parent.code.save();"
1.4 www 2117: +'parent.code.joinres('+be+',parent.code.mostrecent,0);'
1.15 www 2118: +"parent.code.save();"
1.4 www 2119: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
2120: +'parent.code.draw();">'
2121: +'Insert resource linked to from above and linking to below</a><br>');
2122: }
2123: if (af!=-1) {
2124: parent.mapout.document.writeln(
2125: '<a href="javascript:parent.code.insertrow('
2126: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2127: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1.15 www 2128: +"parent.code.save();"
1.4 www 2129: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
2130: +'parent.code.draw();">'
2131: +'Insert resource linking to below</a><br>');
2132: }
2133: parent.mapout.document.writeln('</td></tr></table></tr>');
2134: }
2135: // ---------------------------------------- Draw simple table instead of graph
2136:
2137: function simpletabledraw() {
2138: var objsorted=new Array();
2139: var robjs=new Array();
2140: var iobjs=new Array();
2141: var k;
2142: var i;
2143: var j;
2144: var nr;
2145: var ck;
2146: var cck;
2147: var condid;
2148: var sortstr=sortobjs();
1.13 www 2149: if ((sortstr!='') && (sortstr!=undefined)) {
1.4 www 2150: objsorted=sortstr.split('&');
2151: for (k=0;k<objsorted.length;k++) {
2152: i=(objsorted[k].split(':'))[0];
2153: iobjs[k]=i;
2154: robjs[i]=k;
2155: }
2156: for (k=0;k<iobjs.length;k++) {
2157: i=iobjs[k];
2158: if (k<objsorted.length-1) {
2159: nr=iobjs[k+1];
2160: } else {
2161: nr=-1;
2162: }
2163: data1=objcont[i].split(':');
2164: ck=rescolor(data1[2],data1[3]);
2165: parent.mapout.document.write('<tr><td bgcolor="'+ck
2166: +'"><b>'+k+'</b></td><td bgcolor="'+ck
2167: +'">');
2168: data2=obj[i].split('&');
2169: parent.mapout.document.write('<table>');
1.5 www 2170: if (data1[3]=='start') {
2171: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
2172: }
2173: if (data1[3]=='finish') {
2174: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
2175: }
1.4 www 2176: parent.mapout.document.write(
2177: '<tr><td>Title:</td><td>'+data1[0]+'</td></tr>');
2178: parent.mapout.document.write(
2179: '<tr><td>URL:</td><td>'+data1[1]+'</td></tr>'
2180: +'<tr><td colspan=2><table><tr>');
2181: for (j=2;j<data2.length;j++) {
2182: data4=data2[j].split(':');
2183: data3=objlinks[data4[2]].split(':');
2184: if (data3.length>1) {
2185: if (data3[1]==nr) {
2186: cck='#AAAAAA';
2187: if (data3[2]!=0) {
2188: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2189: condid=data3[2];
2190: } else {
2191: condid='-';
2192: }
2193: parent.mapout.document.writeln(
2194: '<td bgcolor='+cck+'>Next<br>');
2195: parent.mapout.document.writeln('</td>');
2196: }
2197: }
2198: }
2199: for (j=2;j<data2.length;j++) {
2200: data4=data2[j].split(':');
2201: data3=objlinks[data4[2]].split(':');
2202: if (data3.length>1) {
2203: if ((data3[1]!=nr) && (data3[1]!=0)) {
2204: cck='#AAAAAA';
2205: if (data3[2]!=0) {
2206: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2207: condid=data3[2];
2208: } else {
2209: condid='-';
2210: }
2211: parent.mapout.document.writeln(
2212: '<td bgcolor='+cck+'>To: '+robjs[data3[1]]+'<br>');
2213: parent.mapout.document.writeln('</td>');
2214: }
2215: }
2216: }
2217: parent.mapout.document.writeln('</tr></table></td></tr></table></tr>');
2218: }
2219: } else {
2220: parent.mapout.document.writeln('<tr><td>No Resources</td></tr>');
2221: }
2222: }
2223:
1.3 www 2224: // ---------------------------------- Sort objects to straighten graph or table
2225:
2226: function sortobjs() {
1.8 www 2227: message("Sorting Resources: "+funny);
1.2 www 2228: var k;
2229: var ij;
1.3 www 2230: var dol;
2231: var dtl;
1.2 www 2232: var kj;
1.3 www 2233: var sortthis=0;
1.2 www 2234: var objsort=new Array();
2235: for (k=1;k<objcont.length;k++) {
2236: if (objcont[k]) {
2237: data1=objcont[k].split(':');
2238: if (data1[data1.length-1]=='res') {
2239: objsort[objsort.length]=''+k;
2240: }
2241: }
2242: }
1.3 www 2243: if (objsort.length==0) { return ''; }
1.2 www 2244: for (k=1;k<objlinks.length;k++) {
1.8 www 2245: wheelswitch();
2246: message("Sorting Resources: "+funny);
1.13 www 2247: if ((objlinks[k]!=undefined) && (objlinks[k]!='')) {
1.3 www 2248: sortthis=1;
1.2 www 2249: data1=objlinks[k].split(':');
2250: kj=-1;
2251: for (j=0;j<objsort.length;j++) {
2252: if ((objsort[j].split(':'))[0]==data1[0]) {
2253: kj=j;
2254: }
2255: }
1.8 www 2256: if (kj!=-1) { objsort[kj]+=':'+data1[1]; }
1.3 www 2257: }
1.2 www 2258: }
1.3 www 2259: if (sortthis!=0) {
2260: for (k=0;k<objsort.length;k++) {
1.8 www 2261: wheelswitch();
2262: message("Sorting Resources: "+funny);
1.3 www 2263: for (j=0;j<objsort.length;j++) {
2264: if (k!=j) {
2265: data1=objsort[k].split(':');
2266: data2=objsort[j].split(':');
2267: dol=data1.length;
2268: dtl=data2.length;
1.8 www 2269: if (dol+dtl<200) {
2270: for (kj=1;kj<dol;kj++) {
1.3 www 2271: if (data1[kj]==data2[0]) {
2272: for (ij=1;ij<dtl;ij++) {
2273: data1[data1.length]=data2[ij];
2274: }
2275: }
1.8 www 2276: }
2277: for (kj=1;kj<dtl;kj++) {
1.3 www 2278: if (data2[kj]==data1[0]) {
2279: for (ij=1;ij<dol;ij++) {
1.8 www 2280: data2[data2.length]=data1[ij];
2281: }
2282: }
2283: }
2284: objsort[k]=data1.join(':');
2285: objsort[j]=data2.join(':');
1.3 www 2286: }
2287: }
2288: }
1.2 www 2289: }
1.8 www 2290: message("Sorting Resources: finishing up.");
1.3 www 2291: return objsort.sort(rescompare).join('&');
2292: } else {
2293: return objsort.join('&');
2294: }
1.2 www 2295: }
2296:
1.3 www 2297: // ----------------------------------------------------------- Straighten graph
1.1 www 2298:
2299: function graphopt() {
1.3 www 2300: var k;
2301: var kj;
2302: var ij;
2303:
2304: var objsorted=new Array();
2305: condense();
2306: graphreset();
2307: objsorted=(sortobjs()).split('&');
2308: if (objsorted.length==0) { return; }
2309: message("Creating Optimized Graph");
1.1 www 2310: var thisnewobj=''+(objsorted[0].split(':'))[0];
2311: rowcont[1]=thisnewobj;
2312: var thiscolmax=1;
2313: obj[thisnewobj]='b&1&'+thiscolmax+':0:0:0';
2314: var allcolmax=0;
2315: for (k=1;k<objsorted.length;k++) {
2316: thisnewobj=(objsorted[k].split(':'))[0];
2317: if (rescompare(objsorted[k-1],objsorted[k])==0) {
2318: rowcont[rowcont.length-1]+=':'+thisnewobj;
2319: thiscolmax++;
2320: } else {
2321: rowcont[rowcont.length]=thisnewobj;
2322: thiscolmax=1;
2323: }
2324: kj=rowcont.length-1;
1.5 www 2325: obj[thisnewobj]='b&'+kj+'&'+thiscolmax+':0:0:0';
2326: if (thiscolmax>allcolmax) { allcolmax=thiscolmax; }
1.1 www 2327: }
2328: for (k=0;k<obj.length;k++) {
2329: if (!obj[k]) { obj[k]=''; }
2330: }
2331: for (k=0;k<=allcolmax;k++) { insertcol(0); }
2332: for (k=0;k<rowcont.length;k++) {
2333: row[k]=k;
2334: }
2335: maxrow=rowcont.length-1;
2336: var oldlinks=new Array();
1.11 www 2337: for (k=0;k<objlinks.length;k++) {
2338: oldlinks[k]=objlinks[k];
2339: objlinks[k]='';
2340: }
1.1 www 2341: objlinks.length=0;
2342: objlinks[0]='';
1.11 www 2343: graphdef='yes';
2344: save();
2345:
1.1 www 2346: for (k=0;k<objsorted.length;k++) {
1.11 www 2347: wheelswitch();
2348: message("Connecting Resources: "+funny);
2349: kj=(objsorted[k].split(':'))[0];
1.1 www 2350: for (ij=1;ij<oldlinks.length;ij++) {
2351: if (oldlinks[ij]) {
2352: data1=oldlinks[ij].split(':');
2353: if (data1[0]==kj) {
2354: joinres(data1[0],data1[1],data1[2]);
1.11 www 2355: save();
1.1 www 2356: }
2357: }
2358: }
2359: }
2360: }
2361:
2362: // ----------------------------------------------------------- Remove e-objects
2363:
2364: function condense() {
1.3 www 2365: message("Condensing");
1.1 www 2366: var j;
2367: for (j=0;j<=maxrow;j++) {
1.13 www 2368: if ((rowcont[j]!='') && (rowcont[j]!=undefined)) {
1.1 www 2369: data1=rowcont[j].split(':');
2370: rowcont[j]='';
2371: for (k=0;k<data1.length;k++) {
2372: if (obj[data1[k]].substring(0,2)!='e&') {
1.13 www 2373: if ((rowcont[j]!='') && (rowcont[j]!=undefined)) {
2374: rowcont[j]+=':';
2375: }
1.1 www 2376: rowcont[j]+=data1[k];
2377: }
2378: }
2379: }
2380: }
2381: }
2382:
2383: // ---------------------------------------------------- Load from hidden fields
2384:
2385: function load() {
1.4 www 2386: message("Loading");
1.8 www 2387: schedule('load');
2388: }
2389:
2390: function finishload() {
1.4 www 2391: var k;
2392: for (k=0;k<objcont.length;k++) { objcont[k]=''; }
1.1 www 2393: objcont.length=0;
1.4 www 2394: for (k=0;k<objlinks.length;k++) { objlinks[k]=''; }
1.1 www 2395: objlinks.length=0;
2396: objlinks[0]='';
2397: objcont[0]='';
2398: editmode=0;
2399: notclear=0;
2400: lastinfo='';
2401: graphreset();
1.2 www 2402: var inputstr=parent.server.document.forms.storage.output.value;
1.13 www 2403: if ((inputstr!='') && (inputstr!=undefined)) {
1.1 www 2404: data1=inputstr.split('<&>');
2405: var k;
2406: for (k=0;k<data1.length;k++) {
2407: data2=data1[k].split('<:>');
2408: if (data2[0]=='graphdef') { graphdef=data2[1]; }
2409: if (data2[0]=='maxcol') { maxcol=1*data2[1]; }
2410: if (data2[0]=='maxrow') { maxrow=1*data2[1]; }
2411: if (data2[0]=='obj') { obj[data2[1]]=data2[2]; }
2412: if (data2[0]=='objcont') { objcont[data2[1]]=data2[2]; }
2413: if (data2[0]=='objlinks') { objlinks[data2[1]]=data2[2]; }
2414: if (data2[0]=='rowcont') { rowcont[data2[1]]=data2[2]; }
2415: if (data2[0]=='row') { row[data2[1]]=1*data2[2]; }
2416: if (data2[0]=='col') { col[data2[1]]=1*data2[2]; }
1.6 www 2417: if (data2[0]=='mode') { mode=data2[1]; }
1.3 www 2418: if (data2[0]=='tablemode') { tablemode=1*data2[1]; }
1.4 www 2419: if (data2[0]=='zscale') { zscale=1*data2[1]; }
1.1 www 2420: }
1.9 www 2421: }
2422: if (graphdef=='yes') {
2423: for (k=1;k<=maxrow;k++) {
2424: if (rowcont[k]==undefined) { rowcont[k]=''; }
2425: }
1.3 www 2426: }
1.1 www 2427: }
2428:
1.14 www 2429: // -------------------------------------------------------------- Parameter set
2430:
2431: function setparms(resid) {
1.34 www 2432: var options="scrollbars=1,resizable=1,menubar=0";
2433: parmflag=1;
2434: data1=objcont[resid].split(':');
1.35 ! www 2435: parm=open("/adm/ratparms?url="+data1[1]+"&parms="+objparms[resid]+
! 2436: "&resid="+resid,"parmout",options);
1.34 www 2437: parm.focus();
1.14 www 2438: }
2439:
1.2 www 2440: // -------------------------------------------------------------- Undo function
2441:
2442: function undo() {
2443: if (undopointer>1) {
2444: undopointer--;
2445: parent.server.document.forms.storage.output.value
2446: =undostack[undopointer];
1.8 www 2447: finishload();
1.2 www 2448: undopointer--;
2449: draw();
2450: stored=0;
2451: } else {
2452: alert("Cannot undo: reached beginning of edit session");
2453: }
2454: }
2455:
2456: // -------------------------------------------------------------- Redo function
2457:
2458: function redo() {
2459: if (undopointer<undostack.length-1) {
2460: undopointer++;
2461: parent.server.document.forms.storage.output.value
2462: =undostack[undopointer];
1.8 www 2463: finishload();
1.2 www 2464: undopointer--;
2465: draw();
2466: stored=0;
2467: } else {
2468: alert("Cannot redo: reached end of edit session");
2469: }
2470: }
2471:
2472: // ------------------------------------------------------------ Revert function
2473:
2474: function revert() {
2475: if (confirm("Revert to beginning of edit session?")) {
2476: undopointer=2;
2477: undo();
2478: }
2479: }
2480:
1.8 www 2481: // ---------------------------------------------------------------- Wheelswitch
2482:
2483: function wheelswitch() {
2484: if (funny=='|') {
2485: funny='/';
2486: } else {
2487: if (funny=='/') {
2488: funny='-';
2489: } else {
2490: if (funny=='-') {
2491: funny='\\';
2492: } else {
2493: if (funny=='\\') { funny='|'; }
2494: }
2495: }
2496: }
2497: }
2498:
2499: // --------------------------------------------- Checks if server frame defined
2500:
2501: function checkdef() {
1.30 harris41 2502: if (parent.flag==1) {
2503: srvloaded();
1.8 www 2504: }
2505: if ((finishdone==0) && (tim==0)) { setTimeout('checkdef()',100); }
2506: }
2507:
2508: // ---------------------------------------------------------- The wait function
2509:
2510: function wait() {
2511: if ((finishdone==1) || (tim==1)) {
2512: if (tim==0) {
2513: clearTimeout(canceltim);
2514: if (reqaction=='save') { finishsave(); }
2515: if (reqaction=='load') { finishload(); draw(); }
2516: } else {
2517: alert("Server Communication Timed Out.");
2518: }
2519: } else {
2520: wheelswitch();
2521: message('Waiting for server reply: '+funny);
2522: setTimeout('wait();',100);
2523: }
2524: }
2525:
2526: // ---------------------------------------------------------- Schedule function
2527:
2528: function schedule(action) {
2529: reqaction=action;
2530: tim=0;
2531: finishdone=0;
1.31 www 2532: canceltim=setTimeout('tim=1;',20000);
2533: checkdef();
1.8 www 2534: wait();
2535: }
2536:
1.32 harris41 2537: // ----------------------------------------------------- launch indexer browser
2538:
1.33 harris41 2539: function groupsearch() {
1.32 harris41 2540: alert('not yet implemented');
2541: }
2542:
2543: function groupimport() {
1.33 harris41 2544: idxcheck('groupimport');
1.32 harris41 2545: }
2546:
1.2 www 2547: // -------------------------------------------------------------- Store changes
2548:
2549: function storechange() {
1.8 www 2550: var k;
1.31 www 2551: parent.flag=0;
1.2 www 2552: parent.server.document.forms.storage.submit();
1.8 www 2553: schedule('save');
2554: }
2555:
2556: function finishsave() {
2557: finishload();
1.7 www 2558: draw();
1.2 www 2559: stored=1;
2560: }
2561:
1.8 www 2562: // --------------------------------------- Gets called when submission finished
2563:
2564: function srvloaded() {
2565: finishdone=1;
2566: message("Server replied.");
2567: }
2568:
1.2 www 2569: // ---------------------------------------------------------------- Toggle Mode
2570:
2571: function togglemode() {
1.4 www 2572: if (tablemode==0) {
2573: tablemode=1;
2574: } else {
2575: if (tablemode==1) {
2576: tablemode=2;
2577: } else {
2578: tablemode=0;
2579: }
2580: }
2581: notclear=0;
2582: infoclear();
1.2 www 2583: draw();
2584: }
2585:
1.1 www 2586: // -------------------------------------------------------- Main program onLoad
2587:
2588: function main() {
2589:
2590: if (mainrun==0) {
1.5 www 2591: infopen();
2592: infoclear();
1.1 www 2593: load();
1.2 www 2594: stored=1;
1.1 www 2595: mainrun=1;
2596: }
2597:
2598: }
2599:
1.14 www 2600: // ---------------------------------------------------------- Close the window?
1.2 www 2601:
2602: function leave() {
1.5 www 2603: if (!inf.closed) {
2604: inf.close();
1.17 harris41 2605: }
1.24 harris41 2606: if (srch && !srch.closed) {
1.22 harris41 2607: srchclose();
1.2 www 2608: }
1.32 harris41 2609: if (idx && !idx.closed) {
2610: srchclose();
2611: }
1.2 www 2612: }
2613:
1.1 www 2614: </script>
2615: </head>
2616:
1.2 www 2617: <body bgcolor="#FFFFFF" onLoad="main();" onUnload="leave();">
2618: <a href="javascript:togglemode();">Toggle Display Mode</a>
1.4 www 2619: <a href="javascript:if (zscale>1) { zscale--; draw();}">Zoom Out</a>
2620: <a href="javascript:if (zscale<3) { zscale++; draw();}">Zoom In</a>
1.2 www 2621: <a href="javascript:condense();draw();">Condense</a>
2622: <a href="javascript:graphopt();draw();">Straighten</a>
2623: <a href="javascript:revert();">Revert</a>
2624: <a href="javascript:undo();">Undo</a>
2625: <a href="javascript:redo();">Redo</a>
1.33 harris41 2626: <a href="javascript:groupsearch();">Group Search</a>
1.32 harris41 2627: <a href="javascript:groupimport();">Group Import</a>
1.2 www 2628: <a href="javascript:storechange();">Store</a>
1.1 www 2629: </body>
1.2 www 2630: </html>
2631:
2632:
2633:
2634:
2635:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>