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