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