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