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