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