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