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