Annotation of rat/client/ratcode.js, revision 1.13.10.1
1.1 raeburn 1: <!--
2: The LearningOnline Network
3: Resource Assembly Tool
1.13.10.1! raeburn 4: // $Id: ratcode.js,v 1.13 2011/11/21 14:29:06 raeburn 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();
1.13 raeburn 1406: inf.document.open();
1.1 raeburn 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();
1.13 raeburn 1471: inf.document.open();
1.1 raeburn 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() {
1.13 raeburn 1625: idx.document.open();
1626: idx.document.close();
1.1 raeburn 1627: }
1628:
1629: // --------------------------------------------------------- Clears copy window
1630: function copydxclear() {
1.13 raeburn 1631: copydx.document.open();
1632: copydx.document.close();
1.1 raeburn 1633: }
1634: // ------------------------------------------------------- Clears search window
1635: function srchclear() {
1.13 raeburn 1636: srch.document.open();
1637: srch.document.close();
1.1 raeburn 1638: }
1639:
1640: // --------------------------------------------------------- Clears parm window
1641: function parmclear() {
1.13 raeburn 1642: parm.document.open();
1643: parm.document.close();
1.1 raeburn 1644: }
1645:
1646: // ------------------------------------------------------ Closes indexer window
1647: function idxclose() {
1648: if (idx && !idx.closed) {
1649: idxflag=0;
1650: idx.close();
1651: }
1652: }
1653:
1654: // --------------------------------------------------------- Closes copy window
1655: function copydxclose() {
1656: if (copydx && !copydx.closed) {
1657: copydxflag=0;
1658: copydx.close();
1659: }
1660: }
1661:
1662: // ------------------------------------------------------- Closes search window
1663: function srchclose() {
1664: if (srch && !srch.closed) {
1665: srchflag=0;
1666: srch.close();
1667: }
1668: }
1669:
1670: // ------------------------------------------------------- Closes search window
1671: function parmclose() {
1672: if (parm && !parm.closed) {
1673: parmflag=0;
1674: parm.close();
1675: }
1676: }
1677:
1678: // -------------------------------------------------------- Open indexer window
1679: function idxopen(mode) {
1680: var options="scrollbars=1,resizable=1,menubar=0";
1681: idxmode=mode;
1682: idxflag=1;
1683: idx=open("/res/?launch=1&mode=rat&catalogmode="+mode,"idxout",options);
1684: idx.focus();
1685: }
1.4 www 1686: // -------------------------------------------------------- Open zombie window
1687: function groupopen(url) {
1688: var options="scrollbars=1,resizable=1,menubar=0";
1689: idxmode=mode;
1690: idxflag=1;
1.11 bisitz 1691: idx=open("/adm/groupsort?inhibitmenu=yes&mode=rat&recover=1&readfile="+url,"idxout",options);
1.4 www 1692: idx.focus();
1693: }
1.13.10.1! raeburn 1694: // ------------------------------------------------------- Open bookmark window
! 1695: function bookmarkopen() {
! 1696: var options="scrollbars=1,resizable=1,menubar=0";
! 1697: idxmode=mode;
! 1698: idxflag=1;
! 1699: idx=open("/adm/groupsort?inhibitmenu=yes&mode=rat&bookmarks=1","idxout",options);
! 1700: idx.focus();
! 1701: }
1.1 raeburn 1702: // ------------------------------------------------- Open browser to select map
1703: var editbrowser;
1704: function openbrowser(formname,elementname,only,omit) {
1705: var url = '/res/?';
1706: if (editbrowser == null) {
1707: url += 'launch=1&';
1708: }
1709: url += 'catalogmode=interactive&';
1710: url += 'mode=edit&';
1711: url += 'form=' + formname + '&';
1712: if (only != null) {
1713: url += 'only=' + only + '&';
1714: }
1715: if (omit != null) {
1716: url += 'omit=' + omit + '&';
1717: }
1718: url += 'element=' + elementname + '';
1719: var title = 'Browser';
1720: var options = 'scrollbars=1,resizable=1,menubar=0';
1721: options += ',width=700,height=600';
1722: editbrowser = copydx.open(url,title,options,'1');
1723: editbrowser.focus();
1724: }
1725: // ----------------------------------------------------------- Open copy window
1726: function copydxopen(mode) {
1727: var options="scrollbars=1,resizable=1,menubar=0";
1728: copydxmode=mode;
1729: copydxflag=1;
1730: copydx=open("",'copydxout',options);
1.13 raeburn 1731: copydx.document.open('');
1.1 raeburn 1732: copydx.document.writeln(
1733: '<html><body bgcolor="#FFFFFF"><h1>Copy from Map</h1>'+
1.10 bisitz 1734: '<form name="mapload"><input type="text" size="40" name="importmap">'+
1735: '<input type="button" onClick="javascript:opener.openbrowser'+
1.1 raeburn 1736: "('mapload','importmap','sequence,page','')"+
1.10 bisitz 1737: '" value="Browse"><input type="button" value="Load Map" '+
1.1 raeburn 1738: 'onClick="window.location=document.mapload.importmap.value+'+
1739: "'?launch=1&forceselect=1'"+'"></form>');
1740:
1741: copydx.document.writeln('</body></html>');
1742: copydx.focus();
1743: }
1744:
1745: // --------------------------------------------------------- Open search window
1746: function srchopen(mode) {
1747: var options="scrollbars=1,resizable=1,menubar=0";
1748: srchmode=mode;
1749: srchflag=1;
1750: srch=open("/adm/searchcat?launch=1&mode=rat&catalogmode="+mode,"srchout",options);
1751: srch.focus();
1752: }
1753:
1754: // -------------------------------------------- Interface function to searching
1755: function search() {
1756: alert("Searching not yet implemented");
1757: }
1758:
1759: // ------------------------------------------------------- Do srch status check
1760: function srchcheck(mode) {
1761: if (!srch || srch.closed || srchmode!=mode) {
1762: srchopen(mode);
1763: }
1764: srch.focus();
1765: }
1766:
1767: // -------------------------------------------------------- Do idx status check
1768: function idxcheck(mode) {
1769: if (!idx || idx.closed || idxmode!=mode) {
1770: idxopen(mode);
1771: }
1772: idx.focus();
1773: }
1774:
1775: // -------------------------------------------------------- Do idx status check
1776: function copydxcheck(mode) {
1777: if (!copydx || copydx.closed || copydxmode!=mode) {
1778: copydxopen(mode);
1779: }
1780: copydx.focus();
1781: }
1782:
1783: // ---------------------------------------------------- Handles "click to edit"
1784: function handler(infostr) {
1785: var k;
1786: editmode=1;
1787: notclear=1;
1788: infcheck();
1.13 raeburn 1789: inf.document.open();
1.1 raeburn 1790: inf.document.writeln(
1791: '<html><body bgcolor="#FFFFFF">'+
1.10 bisitz 1792: '<table><tr><td width="32"><img src="'+raticons+'edit.gif" /></td><td bgcolor="#AAFFAA">');
1.1 raeburn 1793: data1=infostr.split('&');
1794: if (data1[0]=='c') {
1.10 bisitz 1795: inf.document.writeln('<b>Condition</b><hr />');
1.1 raeburn 1796: linkmode=0;
1797: if (data1[4]=='-') {
1798: data2[0]=''; data2[1]='normal';
1799: } else {
1800: data2=objcont[data1[4]].split(':');
1801: }
1802: inf.document.writeln(
1.10 bisitz 1803: '<form name="condinfo"><textarea name="c" cols="30" rows="3">'
1804: +data2[0]+'</textarea><br /><input type="radio" name="s" value="normal" '+
1.1 raeburn 1805: 'onClick="self.document.forms.condinfo.elements.h.value='+"'normal'"+'"');
1806: if (data2[1]=='normal') { inf.document.write(' checked'); }
1807: inf.document.write(
1.10 bisitz 1808: '> Recommendation if true<br /><input type="radio" name="s" value="stop" '+
1.1 raeburn 1809: 'onClick="self.document.forms.condinfo.elements.h.value='+"'stop'"+'"');
1810: if (data2[1]=='stop') { inf.document.write(' checked'); }
1811: inf.document.write(
1.10 bisitz 1812: '> Blocking this link if false<br /><input type="radio" name="s" value="force" '+
1.1 raeburn 1813: 'onClick="self.document.forms.condinfo.elements.h.value='+"'force'"+'"');
1814: if (data2[1]=='force') { inf.document.write(' checked'); }
1815: inf.document.write(
1.10 bisitz 1816: '> Blocking other links if true<br /><a href="javascript:opener.editmode=0;'
1.1 raeburn 1817: +'opener.notclear=0;');
1818: if (data1[4]=='-') {
1819: inf.document.write('opener.crecond('+data1[2]+','+data1[1]+','
1820: +'opener.escape(self.document.forms.condinfo.elements.c.value),'
1821: +'self.document.forms.condinfo.elements.h.value);');
1822: } else {
1823: inf.document.write('opener.objcont['+data1[4]+']='
1824: +'opener.escape(self.document.forms.condinfo.elements.c.value)+'+"':'"
1825: +'+self.document.forms.condinfo.elements.h.value+'+"':cond';");
1826: }
1827: inf.document.writeln(
1828: 'opener.infoclear();opener.editmode=0;opener.draw('
1829: +');"><b>Save Changes</b></a> '
1.10 bisitz 1830: +' <a href="javascript:self.document.forms.condinfo.reset()">Reset</a><br />'
1831: +'<input type="hidden" name="h" value="'+data2[1]+'">');
1.1 raeburn 1832:
1833: inf.document.writeln(
1834: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1835: +'opener.delcond('+data1[2]+','+data1[1]+');opener.editmode=0;opener.draw('
1.10 bisitz 1836: +');">Delete Condition</a><br />');
1.1 raeburn 1837: inf.document.writeln(
1838: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1839: +'opener.dellink('+data1[3]+');opener.editmode=0;opener.draw('
1840: +');">Delete Link</a>');
1841:
1.10 bisitz 1842: inf.document.writeln('<br /><a href="javascript:'+
1.1 raeburn 1843: 'opener.insertcondlink('+data1[1]+','+data1[3]+');'+
1844: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1845: +');">Insert Resource Into Link</a>');
1846: } else {
1847: if (data1[0]=='r') {
1848: if (linkmode!=0) {
1849: joinres(linkmode,data1[1],0);
1850: editmode=0;
1851: notclear=0;
1852: linkmode=0;
1853: inf.document.writeln('<b>Linked Resources</b>');
1854: draw();
1855: } else {
1856: data2=objcont[data1[1]].split(':');
1857: if (data2[3]=='start') {
1858: inf.document.writeln('<b>Start</b>');
1859: } else {
1860: if (data2[3]=='finish') {
1861: inf.document.writeln('<b>Finish</b>');
1862: } else {
1863: inf.document.writeln('<b>Resource</b>');
1864: }
1865: }
1866: inf.document.write(
1.10 bisitz 1867: '<form name="resinfo"><table><tr><td>Title:</td><td colspan="2">'
1868: +'<input type="text" name="t" size="30" value="'
1869: +escape(data2[0])+'"><input type="hidden" name="h" value='+data2[3]+'></td></tr>');
1870: inf.document.write('<tr><td>URL:</td><td colspan="2">'
1871: +'<input type="text" name="u" size="30" value="'+data2[1]+'"></td></tr>'
1872: +'<tr><td>External:</td><td><input type="checkbox" name="e"');
1873: if (data2[2]=='true') { inf.document.write(' checked="checked"'); }
1874: inf.document.write('></td><td align="right">'
1.1 raeburn 1875: +'<a href="javascript:opener.idxcheck(\'interactive\')">Browse</a> '
1876: +'<a href="javascript:opener'
1877: +'.srchcheck(\'interactive\')">Search</a></td></tr>');
1878: if ((data2[3]!='start') && (data2[3]!='finish')) {
1.10 bisitz 1879: inf.document.write('<tr><td colspan="3">'
1880: +'<input type="radio" name="y" value="normal" '+
1.1 raeburn 1881: 'onClick="self.document.forms.resinfo.elements.h.value='+"'normal'"+'"');
1.10 bisitz 1882: if (data2[3]=='normal') { inf.document.write(' checked="checked"'); }
1.1 raeburn 1883: inf.document.write(
1.10 bisitz 1884: '> Regular <input type="radio" name="y" value="mandatory" '+
1.1 raeburn 1885: 'onClick="self.document.forms.resinfo.elements.h.value='+"'mandatory'"+'"');
1.10 bisitz 1886: if (data2[3]=='mandatory') { inf.document.write(' checked="checked"'); }
1.1 raeburn 1887: inf.document.write(
1.10 bisitz 1888: '> Mandatory <input type="radio" name="y" value="optional" '+
1.1 raeburn 1889: 'onClick="self.document.forms.resinfo.elements.h.value='+"'optional'"+'"');
1.10 bisitz 1890: if (data2[3]=='optional') { inf.document.write(' checked="checked"'); }
1.1 raeburn 1891: inf.document.write('> Optional</td></tr>');
1892: }
1893: inf.document.writeln(
1.10 bisitz 1894: '<tr><td colspan="3"><a href="javascript:opener.editmode=0;'
1.1 raeburn 1895: +'opener.notclear=0;opener.objcont['+data1[1]
1896: +']=opener.escape(self.document.forms.resinfo.elements.t.value)+'+"':'"
1897: +'+opener.escape(self.document.forms.resinfo.elements.u.value)+'+"':'"
1898: +'+self.document.forms.resinfo.elements.e.checked+'+"':'"
1899: +'+self.document.forms.resinfo.elements.h.value+'+"':res'"
1900: +';opener.infoclear();opener.editmode=0;opener.draw();">'
1901: +'<b>Save Changes</b></a> '
1902: +' <a href="javascript:self.document.forms.resinfo.reset()">Reset</a>'
1903: +'</td></tr></table>');
1904: if ((data2[3]!='start') && (data2[3]!='finish')) {
1905: inf.document.writeln(
1906: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1907: +'opener.delres('+data1[1]+',0);opener.editmode=0;opener.draw('
1908: +');">Delete Resource (cutting links)</a>');
1909: inf.document.writeln(
1.10 bisitz 1910: '<br /><a href="javascript:opener.notclear=0;opener.infoclear();'
1.1 raeburn 1911: +'opener.delres('+data1[1]+',1);opener.editmode=0;opener.draw('
1912: +');">Delete Resource (preserving links)</a>');
1913: }
1914: if (data2[3]!='finish') {
1915: inf.document.writeln(
1.10 bisitz 1916: '<br /><a href="javascript:opener.editmode=0;opener.notclear=0;'
1.1 raeburn 1917: +'opener.linkmode='+data1[1]+';'
1918: +'opener.infoclear();">Link Resource</a>');
1919: }
1920: inf.document.writeln(
1.10 bisitz 1921: '<br /><a href="javascript:'
1.1 raeburn 1922: +'opener.setparms('+data1[1]+');'
1923: +'opener.infoclear();">Set Parameters</a>');
1924:
1925: }
1926: } else {
1927: linkmode=0;
1.10 bisitz 1928: inf.document.writeln('<b>Link</b><hr /><form>');
1.1 raeburn 1929: data2=obj[data1[0]].split('&');
1930: k=data2[data2.length-2];
1931: data3=objlinks[k].split(':');
1932: inf.document.writeln('From <b>'+objcont[data3[0]].split(':')[0]+
1.10 bisitz 1933: '</b><br />to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
1934: inf.document.writeln('<br /><a href="javascript:opener.dellink('+
1.1 raeburn 1935: k+');opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1936: +');">Delete Link</a>');
1.10 bisitz 1937: inf.document.writeln('<br /><a href="javascript:'+
1.1 raeburn 1938: "opener.insertreslink('"+infostr+"');"+
1939: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1940: +');">Insert Resource Into Link</a>');
1941: }
1942: }
1943: inf.document.writeln(
1.10 bisitz 1944: '<br /><a href="javascript:opener.editmode=0;opener.notclear=0;'
1.1 raeburn 1945: +'opener.infoclear();">Cancel</a>');
1946: inf.document.writeln('</form></td></tr></table></body></html>');
1947: inf.document.close();
1948: inf.focus();
1949: }
1950:
1951: // ----------------------------------------------------- Clicks on empty fields
1952: function empty(rid,k) {
1953: var cid=findcol(k);
1954: var lcol=k-1;
1955: trow=row[rid];
1956: lrow=trow-1;
1957: editmode=1;
1958: notclear=1;
1959: linkmode=0;
1960: infcheck();
1.13 raeburn 1961: inf.document.open();
1.1 raeburn 1962: inf.document.writeln(
1963: '<html><body bgcolor="#FFFFFF">'+
1.10 bisitz 1964: '<table><tr><td width="32"><img src="'+raticons+'edit.gif" /></td><td bgcolor="#AAFFAA">'+
1965: '<b>Empty Field</b><hr />');
1.1 raeburn 1966:
1.10 bisitz 1967: inf.document.writeln('<br /><a href="javascript:opener.newresource('+
1.1 raeburn 1968: rid+','+cid+",'','','false','normal');"+
1969: 'opener.mostrecent=opener.obj.length-1;'+
1970: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1971: +');">Insert resource</a>');
1972:
1973: if ((mostrecent!=0) && (objcont[mostrecent]!='') &&
1974: (typeof(objcont[mostrecent])!="undefined")) {
1975:
1.10 bisitz 1976: inf.document.writeln('<br /><a href="javascript:opener.newresource('+
1.1 raeburn 1977: rid+','+cid+",'','','false','normal');"+
1978: 'opener.mostrecent=opener.obj.length-1;'+
1979: 'opener.joinres('+mostrecent+',opener.obj.length-1,0);'+
1980: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1981: +');">Insert resource linked to from most recent one</a>');
1982:
1.10 bisitz 1983: inf.document.writeln('<br /><a href="javascript:opener.newresource('+
1.1 raeburn 1984: rid+','+cid+",'','','false','normal');"+
1985: 'opener.mostrecent=opener.obj.length-1;'+
1986: 'opener.joinres(opener.obj.length-1,'+mostrecent+',0);'+
1987: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1988: +');">Insert resource linking to most recent one</a>');
1989: }
1990:
1991:
1.10 bisitz 1992: inf.document.writeln('<hr />Insert column:');
1.1 raeburn 1993: inf.document.writeln('<a href="javascript:opener.insertcol('+
1994: lcol+');opener.addobj('+rid+",'e&'+opener.maxcol);"
1995: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1996: +');">left</a>');
1997: inf.document.writeln('<a href="javascript:opener.insertcol('+
1998: k+');opener.addobj('+rid+",'e&'+opener.maxcol);"
1999: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
2000: +');">right</a> ');
1.10 bisitz 2001: inf.document.writeln('<br />Insert row:');
1.1 raeburn 2002: inf.document.writeln('<a href="javascript:opener.insertrow('+
2003: trow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
2004: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
2005: +');">below</a>');
2006: inf.document.writeln('<a href="javascript:opener.insertrow('+
2007: lrow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
2008: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
2009: +');">above</a> ');
2010:
2011:
2012: inf.document.writeln(
1.10 bisitz 2013: '<br /><a href="javascript:opener.editmode=0;opener.notclear=0;'
1.1 raeburn 2014: +'opener.infoclear();">Cancel</a>');
2015: inf.document.writeln('</td></tr></table></body></html>');
2016: inf.document.close();
2017: inf.focus();
2018: }
2019:
2020: // ---------------------------------------------------- Save into hidden fields
2021: function save() {
2022: var k;
2023: if (graphdef=='yes') {
2024: parent.server.document.forms.storage.output.value='graphdef<:>yes';
2025: for (k=1;k<obj.length;k++) {
2026: parent.server.document.forms.storage.output.value+=
2027: '<&>obj<:>'+k+'<:>'+obj[k];
2028: }
2029: for (k=0;k<row.length;k++) {
2030: parent.server.document.forms.storage.output.value+=
2031: '<&>row<:>'+k+'<:>'+row[k];
2032: }
2033: for (k=0;k<col.length;k++) {
2034: parent.server.document.forms.storage.output.value+=
2035: '<&>col<:>'+k+'<:>'+col[k];
2036: }
2037: for (k=0;k<rowcont.length;k++) {
2038: if (rowcont[k]) {
2039: parent.server.document.forms.storage.output.value+=
2040: '<&>rowcont<:>'+k+'<:>'+rowcont[k];
2041: }
2042: }
2043: parent.server.document.forms.storage.output.value+=
2044: '<&>maxcol<:>'+maxcol;
2045: parent.server.document.forms.storage.output.value+=
2046: '<&>maxrow<:>'+maxrow;
2047: parent.server.document.forms.storage.output.value+=
2048: '<&>zscale<:>'+zscale;
2049: } else {
2050: parent.server.document.forms.storage.output.value='graphdef<:>no';
2051: }
2052: parent.server.document.forms.storage.output.value+=
2053: '<&>tablemode<:>'+tablemode;
2054:
2055: for (k=0;k<objparms.length;k++) {
2056: if (objparms[k]) {
2057: parent.server.document.forms.storage.output.value+=
2058: '<&>objparms<:>'+k+'<:>'+objparms[k];
2059: }
2060: }
2061: for (k=0;k<objcont.length;k++) {
2062: if (objcont[k]) {
2063: parent.server.document.forms.storage.output.value+=
2064: '<&>objcont<:>'+k+'<:>'+objcont[k];
2065: }
2066: }
2067: for (k=0;k<objlinks.length;k++) {
2068: if (objlinks[k]) {
2069: parent.server.document.forms.storage.output.value+=
2070: '<&>objlinks<:>'+k+'<:>'+objlinks[k];
2071: }
2072: }
2073: undopointer++;
2074: undostack[undopointer]=
2075: parent.server.document.forms.storage.output.value;
2076: }
2077:
2078: // ----------------------------------------------- Reset all layout information
2079: function graphreset() {
2080:
2081: var k;
2082:
2083: for (k=0;k<obj.length;k++) { obj[k]=''; }
2084: obj.length=0;
2085: obj[0]='';
2086:
2087: rowcont.length=0;
2088: rowcont[0]='';
2089:
2090: row.length=0;
2091: row[0]=0;
2092: maxrow=0;
2093:
2094: col.length=0;
2095: colmap.length=0;
2096: maxcol=-1;
2097: insertcol(-1);
2098:
2099: objcont[0]='';
2100: objlinks[0]='';
2101:
2102: graphdef='no';
2103:
2104: }
2105:
2106: // --------------------- Compare two resources with each other for "straighten"
2107: function rescompare(a,b) {
2108: data1=a.split(':');
2109: data2=b.split(':');
2110: var rvalue=0;
2111: var k;
2112: for (k=1;k<data1.length;k++) {
2113: if (data1[k]==data2[0]) { rvalue--; }
2114: }
2115: for (k=1;k<data2.length;k++) {
2116: if (data2[k]==data1[0]) { rvalue++; }
2117: }
2118: if (rvalue==0) { rvalue=data2.length-data1.length; }
2119: return rvalue;
2120: }
2121:
2122: // -------------------------------------------- Draw the table instead of graph
2123: function tabledraw() {
2124: var objsorted=new Array();
2125: var robjs=new Array();
2126: var iobjs=new Array();
2127: var k;
2128: var i;
2129: var j;
2130: var nr;
2131: var ck;
2132: var cck;
2133: var condid;
2134: var url='';
2135: var mime='';
2136: var ext='';
2137: var urlparts=new Array;
2138: var sortstr=sortobjs();
2139: insrestab(1,-1,-1,'');
2140: if ((sortstr!='') && (typeof(sortstr)!="undefined")) {
2141: objsorted=sortstr.split('&');
2142: for (k=0;k<objsorted.length;k++) {
2143: i=(objsorted[k].split(':'))[0];
2144: iobjs[k]=i;
2145: robjs[i]=k;
2146: }
2147: for (k=0;k<iobjs.length;k++) {
2148: i=iobjs[k];
2149: if (k<objsorted.length-1) {
2150: nr=iobjs[k+1];
2151: } else {
2152: nr=-1;
2153: }
2154: data1=objcont[i].split(':');
2155: ck=rescolor(data1[2],data1[3]);
2156: parent.mapout.document.write('<tr><td bgcolor="'+ck+'">');
2157: url=data1[1];
2158: ext=data1[2];
2159: urlparts=url.split('.');
2160: mime=urlparts[urlparts.length-1];
2161: if (typeof(mime)=="undefined") { mime=''; }
2162: if ((mime!='') && (ext!='true')) {
2163: parent.mapout.document.write
2164: ('<a target="preview" align="right" href="'+url+'.meta'+
1.10 bisitz 2165: '"><img width="20" src="'+iconpath+'meta.gif" /></a><p>'+
1.1 raeburn 2166: '<a target="preview" align="right"href="'+url+
1.10 bisitz 2167: '"><img width="20" src="'+iconpath+mime+'.gif" /></a><p>');
1.1 raeburn 2168: }
2169: parent.mapout.document.write(
2170: '<b><a href="javascript:if (parent.code.linkmode!=0) { '
2171: +'parent.code.joinres(parent.code.linkmode,'+i+',0);'
2172: +'parent.code.linkmode=0;parent.code.editmode=0;'
2173: +'parent.code.notclear=0;parent.code.infoclear();'
2174: +'parent.code.draw(); }">'+k+'</a></b></td><td bgcolor="'+ck
1.10 bisitz 2175: +'"><form name="r'+i+'" method="post">');
1.1 raeburn 2176: data2=obj[i].split('&');
2177: parent.mapout.document.write('<table bgcolor="#CCCCCC">');
2178:
2179: if (data1[3]=='start') {
2180: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
2181: }
2182: if (data1[3]=='finish') {
2183: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
2184: }
2185: parent.mapout.document.write(
1.10 bisitz 2186: '<tr><td>Title:</td><td><input type="text" name="t" size="50" value="'
2187: +data1[0]+'"><input type="hidden" name="h" value="'+data1[3]
2188: +'"></td></tr>');
1.1 raeburn 2189: parent.mapout.document.write(
1.10 bisitz 2190: '<tr><td>URL:</td><td><input type="text" name="u" size="50" value="'
1.1 raeburn 2191: +data1[1]+'"></td></tr>'
1.10 bisitz 2192: +'<tr><td>External:</td><td><input type="checkbox" name="e"');
2193: if (data1[2]=='true') { parent.mapout.document.write(' checked="checked"'); }
1.1 raeburn 2194: parent.mapout.document.write('></td></tr>');
2195: if ((data1[3]!='start') && (data1[3]!='finish')) {
2196: parent.mapout.document.write(
1.10 bisitz 2197: '<tr><td colspan="2"><input type="radio" name="y" value="normal" '+
1.1 raeburn 2198: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
2199: "'normal'"+'"');
1.10 bisitz 2200: if (data1[3]=='normal') { parent.mapout.document.write(' checked="checked"'); }
1.1 raeburn 2201: parent.mapout.document.write(
1.10 bisitz 2202: '> Regular <input type="radio" name="y" value="mandatory" '+
1.1 raeburn 2203: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
2204: "'mandatory'"+'"');
1.10 bisitz 2205: if (data1[3]=='mandatory') { parent.mapout.document.write(' checked="checked"'); }
1.1 raeburn 2206: parent.mapout.document.write(
1.10 bisitz 2207: '> Mandatory <input type="radio" name="y" value="optional" '+
1.1 raeburn 2208: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
2209: "'optional'"+'"');
1.10 bisitz 2210: if (data1[3]=='optional') { parent.mapout.document.write(' checked="checked"'); }
1.1 raeburn 2211: parent.mapout.document.write('> Optional</td></tr>');
2212: }
2213: parent.mapout.document.write(
1.10 bisitz 2214: '<tr><td colspan="2"><a href="javascript:parent.code.objcont['+i
1.1 raeburn 2215: +']=parent.code.escape(parent.mapout.document.forms.r'+i
2216: +'.elements.t.value)+'+"':'"
2217: +'+parent.code.escape(parent.mapout.document.forms.r'+i
2218: +'.elements.u.value)+'+"':'"
2219: +'+parent.mapout.document.forms.r'+i+'.elements.e.checked+'+"':'"
2220: +'+parent.mapout.document.forms.r'+i+'.elements.h.value+'+"':res'"
2221: +';parent.code.draw();">'
2222: +'<b>Save Changes</b></a> '
2223: +' <a href="javascript:parent.mapout.document.forms.r'+i
1.10 bisitz 2224: +'.reset()">Reset</a></td></tr><tr><td colspan="2">');
1.1 raeburn 2225: if ((data1[3]!='start') && (data1[3]!='finish')) {
2226: parent.mapout.document.writeln(
1.10 bisitz 2227: '<a href="javascript:parent.code.notclear=0;parent.code.infoclear();'
1.1 raeburn 2228: +'parent.code.delres('+i+',0);parent.code.editmode=0;parent.code.draw();">'
1.10 bisitz 2229: +'Delete Resource (cutting links)</a><br />'
2230: +'<a href="javascript:parent.code.notclear=0;parent.code.infoclear();'
1.1 raeburn 2231: +'parent.code.delres('+i+',1);parent.code.editmode=0;parent.code.draw();">'
1.10 bisitz 2232: +'Delete Resource (preserving links)</a><br />');
1.1 raeburn 2233: }
2234: if (data1[3]!='finish') {
2235: parent.mapout.document.writeln(
2236: '<a href="javascript:parent.code.linkmode='+i+
2237: ';parent.code.notclear=0;parent.code.infoclear();">'+
2238: 'Link resource</a>');
2239: }
2240: parent.mapout.document.writeln(
1.10 bisitz 2241: '<br /><a href="javascript:'
1.1 raeburn 2242: +'parent.code.setparms('+i+');">Set Parameters</a>');
2243:
2244: parent.mapout.document.writeln('</td></tr>');
1.10 bisitz 2245: parent.mapout.document.writeln('<tr><td colspan="2"><table><tr>');
1.1 raeburn 2246: for (j=2;j<data2.length;j++) {
2247: data4=data2[j].split(':');
2248: data3=objlinks[data4[2]].split(':');
2249: if (data3.length>1) {
2250: if (data3[1]==nr) {
2251: cck='#AAAAAA';
2252: if (data3[2]!=0) {
2253: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2254: condid=data3[2];
2255: } else {
2256: condid='-';
2257: }
2258: parent.mapout.document.writeln(
1.10 bisitz 2259: '<td bgcolor="'+cck+'">Next<br />');
1.1 raeburn 2260: parent.mapout.document.writeln(
2261: '<a href="javascript:parent.code.handler('+
2262: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
2263: +'">Edit</a>');
2264: parent.mapout.document.writeln('</td>');
2265: }
2266: }
2267: }
2268: for (j=2;j<data2.length;j++) {
2269: data4=data2[j].split(':');
2270: data3=objlinks[data4[2]].split(':');
2271: if (data3.length>1) {
2272: if ((data3[1]!=nr) && (data3[1]!=0)) {
2273: cck='#AAAAAA';
2274: if (data3[2]!=0) {
2275: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2276: condid=data3[2];
2277: } else {
2278: condid='-';
2279: }
2280: parent.mapout.document.writeln(
1.10 bisitz 2281: '<td bgcolor="'+cck+'">To: '+robjs[data3[1]]+'<br />');
1.1 raeburn 2282: parent.mapout.document.writeln(
2283: '<a href="javascript:parent.code.handler('+
2284: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
2285: +'">Edit</a>');
2286: parent.mapout.document.writeln('</td>');
2287: }
2288: }
2289: }
2290: parent.mapout.document.writeln(
2291: '</tr></table></td></tr></table></form>');
2292: insrestab(rrow[data2[1]],i,nr,data1[3]);
2293:
2294: }
2295: }
2296: }
2297:
2298: // ----------------------------------------------------- Insert Resource Output
2299: function insrestab(irow,be,af,typ) {
1.10 bisitz 2300: parent.mapout.document.writeln('<tr><td colspan="2">'+
1.1 raeburn 2301: '<table><tr><td><a href="javascript:parent.code.insertrow('
2302: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[1]
2303: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
2304: +'parent.code.draw();">'
2305: +'Insert resource</a></td><td>');
2306: if ((be!=-1) && (typ!='finish')) {
2307: parent.mapout.document.writeln(
2308: '<a href="javascript:parent.code.insertrow('
2309: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2310: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
2311: +"parent.code.save();"
2312: +'parent.code.joinres('+be+',parent.code.mostrecent,0);'
2313: +'parent.code.draw();">'
1.10 bisitz 2314: +'Insert resource linked to from above</a><br />');
1.1 raeburn 2315: }
2316: if ((be!=-1) && (af!=-1) && (typ!='finish')) {
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('+be+',parent.code.mostrecent,0);'
2323: +"parent.code.save();"
2324: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
2325: +'parent.code.draw();">'
1.10 bisitz 2326: +'Insert resource linked to from above and linking to below</a><br />');
1.1 raeburn 2327: }
2328: if (af!=-1) {
2329: parent.mapout.document.writeln(
2330: '<a href="javascript:parent.code.insertrow('
2331: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2332: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
2333: +"parent.code.save();"
2334: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
2335: +'parent.code.draw();">'
1.10 bisitz 2336: +'Insert resource linking to below</a><br />');
1.1 raeburn 2337: }
2338: parent.mapout.document.writeln('</td></tr></table></tr>');
2339: }
2340:
2341: // ---------------------------------------- Draw simple table instead of graph
2342: function simpletabledraw() {
2343: var objsorted=new Array();
2344: var robjs=new Array();
2345: var iobjs=new Array();
2346: var k;
2347: var i;
2348: var j;
2349: var nr;
2350: var ck;
2351: var cck;
2352: var mime;
2353: var ext;
2354: var url;
2355: var urlparts=new Array;
2356: var condid;
2357: var sortstr=sortobjs();
2358: if ((sortstr!='') && (typeof(sortstr)!="undefined")) {
2359: objsorted=sortstr.split('&');
2360: for (k=0;k<objsorted.length;k++) {
2361: i=(objsorted[k].split(':'))[0];
2362: iobjs[k]=i;
2363: robjs[i]=k;
2364: }
2365: for (k=0;k<iobjs.length;k++) {
2366: i=iobjs[k];
2367: if (k<objsorted.length-1) {
2368: nr=iobjs[k+1];
2369: } else {
2370: nr=-1;
2371: }
2372: data1=objcont[i].split(':');
2373: ck=rescolor(data1[2],data1[3]);
2374: parent.mapout.document.write('<tr><td bgcolor="'+ck+'">');
2375: url=data1[1];
2376: ext=data1[2];
2377: urlparts=url.split('.');
2378: mime=urlparts[urlparts.length-1];
2379: if (typeof(mime)=="undefined") { mime=''; }
2380: if ((mime!='') && (ext!='true')) {
2381: parent.mapout.document.write
2382: ('<a target="preview" align="right" href="'+url+'.meta'+
1.10 bisitz 2383: '"><img width="20" src="'+iconpath+'meta.gif" /></a><p>'+
1.1 raeburn 2384: '<a target="preview" align="right"href="'+url+
1.10 bisitz 2385: '"><img width="20" src="'+iconpath+mime+'.gif" /></a><p>');
1.1 raeburn 2386: }
2387: parent.mapout.document.write('<b>'+k+'</b></td><td bgcolor="'+ck+'">');
2388: data2=obj[i].split('&');
2389: parent.mapout.document.write('<table>');
2390:
2391: if (data1[3]=='start') {
2392: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
2393: }
2394: if (data1[3]=='finish') {
2395: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
2396: }
2397: parent.mapout.document.write(
2398: '<tr><td>Title:</td><td>'+data1[0]+'</td></tr>');
2399: parent.mapout.document.write(
2400: '<tr><td>URL:</td><td>'+data1[1]+'</td></tr>'
1.10 bisitz 2401: +'<tr><td colspan="2"><table><tr>');
1.1 raeburn 2402: for (j=2;j<data2.length;j++) {
2403: data4=data2[j].split(':');
2404: data3=objlinks[data4[2]].split(':');
2405: if (data3.length>1) {
2406: if (data3[1]==nr) {
2407: cck='#AAAAAA';
2408: if (data3[2]!=0) {
2409: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2410: condid=data3[2];
2411: } else {
2412: condid='-';
2413: }
2414: parent.mapout.document.writeln(
1.10 bisitz 2415: '<td bgcolor='+cck+'>Next<br />');
1.1 raeburn 2416: parent.mapout.document.writeln('</td>');
2417: }
2418: }
2419: }
2420: for (j=2;j<data2.length;j++) {
2421: data4=data2[j].split(':');
2422: data3=objlinks[data4[2]].split(':');
2423: if (data3.length>1) {
2424: if ((data3[1]!=nr) && (data3[1]!=0)) {
2425: cck='#AAAAAA';
2426: if (data3[2]!=0) {
2427: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2428: condid=data3[2];
2429: } else {
2430: condid='-';
2431: }
2432: parent.mapout.document.writeln(
1.10 bisitz 2433: '<td bgcolor="'+cck+'">To: '+robjs[data3[1]]+'<br />');
1.1 raeburn 2434: parent.mapout.document.writeln('</td>');
2435: }
2436: }
2437: }
2438: parent.mapout.document.writeln('</tr></table></td></tr></table></tr>');
2439: }
2440: } else {
2441: parent.mapout.document.writeln('<tr><td>No Resources</td></tr>');
2442: }
2443: }
2444:
2445: // ---------------------------------- Sort objects to straighten graph or table
2446: function sortobjs() {
2447: message("Sorting Resources: "+funny);
2448: var k;
2449: var ij;
2450: var dol;
2451: var dtl;
2452: var kj;
2453: var sortthis=0;
2454: var objsort=new Array();
2455: for (k=1;k<objcont.length;k++) {
2456: if (objcont[k]) {
2457: data1=objcont[k].split(':');
2458: if (data1[data1.length-1]=='res') {
2459: objsort[objsort.length]=''+k;
2460: }
2461: }
2462: }
2463: if (objsort.length==0) { return ''; }
2464: for (k=1;k<objlinks.length;k++) {
2465: wheelswitch();
2466: message("Sorting Resources: "+funny);
2467: if ((typeof(objlinks[k])!="undefined") && (objlinks[k]!='')) {
2468: sortthis=1;
2469: data1=objlinks[k].split(':');
2470: kj=-1;
2471: for (j=0;j<objsort.length;j++) {
2472: if ((objsort[j].split(':'))[0]==data1[0]) {
2473: kj=j;
2474: }
2475: }
2476: if (kj!=-1) { objsort[kj]+=':'+data1[1]; }
2477: }
2478: }
2479: if (sortthis!=0) {
2480: for (k=0;k<objsort.length;k++) {
2481: wheelswitch();
2482: message("Sorting Resources: "+funny);
2483: for (j=0;j<objsort.length;j++) {
2484: if (k!=j) {
2485: data1=objsort[k].split(':');
2486: data2=objsort[j].split(':');
2487: dol=data1.length;
2488: dtl=data2.length;
2489: if (dol+dtl<200) {
2490: for (kj=1;kj<dol;kj++) {
2491: if (data1[kj]==data2[0]) {
2492: for (ij=1;ij<dtl;ij++) {
2493: data1[data1.length]=data2[ij];
2494: }
2495: }
2496: }
2497: for (kj=1;kj<dtl;kj++) {
2498: if (data2[kj]==data1[0]) {
2499: for (ij=1;ij<dol;ij++) {
2500: data2[data2.length]=data1[ij];
2501: }
2502: }
2503: }
2504: objsort[k]=data1.join(':');
2505: objsort[j]=data2.join(':');
2506: }
2507: }
2508: }
2509: }
2510: message("Sorting Resources: finishing up.");
2511: return objsort.sort(rescompare).join('&');
2512: } else {
2513: return objsort.join('&');
2514: }
2515: }
2516:
2517: // ----------------------------------------------------------- Straighten graph
2518: function graphopt() {
2519: var k;
2520: var kj;
2521: var ij;
2522: var objsorted=new Array();
2523: condense();
2524: graphreset();
2525: objsorted=(sortobjs()).split('&');
2526: if (objsorted.length==0) { return; }
2527: message("Creating Optimized Graph");
2528: var thisnewobj=''+(objsorted[0].split(':'))[0];
2529: rowcont[1]=thisnewobj;
2530: var thiscolmax=1;
2531: obj[thisnewobj]='b&1&'+thiscolmax+':0:0:0';
2532: var allcolmax=0;
2533: for (k=1;k<objsorted.length;k++) {
2534: thisnewobj=(objsorted[k].split(':'))[0];
2535: if (rescompare(objsorted[k-1],objsorted[k])==0) {
2536: rowcont[rowcont.length-1]+=':'+thisnewobj;
2537: thiscolmax++;
2538: } else {
2539: rowcont[rowcont.length]=thisnewobj;
2540: thiscolmax=1;
2541: }
2542: kj=rowcont.length-1;
2543: obj[thisnewobj]='b&'+kj+'&'+thiscolmax+':0:0:0';
2544: if (thiscolmax>allcolmax) { allcolmax=thiscolmax; }
2545: }
2546: for (k=0;k<obj.length;k++) {
2547: if (!obj[k]) { obj[k]=''; }
2548: }
2549: for (k=0;k<=allcolmax;k++) { insertcol(0); }
2550: for (k=0;k<rowcont.length;k++) {
2551: row[k]=k;
2552: }
2553: maxrow=rowcont.length-1;
2554: var oldlinks=new Array();
2555: for (k=0;k<objlinks.length;k++) {
2556: oldlinks[k]=objlinks[k];
2557: objlinks[k]='';
2558: }
2559: objlinks.length=0;
2560: objlinks[0]='';
2561: graphdef='yes';
2562: save();
2563:
2564: for (k=0;k<objsorted.length;k++) {
2565: wheelswitch();
2566: message("Connecting Resources: "+funny);
2567: kj=(objsorted[k].split(':'))[0];
2568: for (ij=1;ij<oldlinks.length;ij++) {
2569: if (oldlinks[ij]) {
2570: data1=oldlinks[ij].split(':');
2571: if (data1[0]==kj) {
2572: joinres(data1[0],data1[1],data1[2]);
2573: save();
2574: }
2575: }
2576: }
2577: }
2578: }
2579:
2580: // ----------------------------------------------------------- Remove e-objects
2581: function condense() {
2582: message("Condensing");
2583: var j;
2584: for (j=0;j<=maxrow;j++) {
2585: if ((rowcont[j]!='') && (typeof(rowcont[j])!="undefined")) {
2586: data1=rowcont[j].split(':');
2587: rowcont[j]='';
2588: for (k=0;k<data1.length;k++) {
2589: if (obj[data1[k]].substring(0,2)!='e&') {
2590: if ((rowcont[j]!='') && (typeof(rowcont[j])!="undefined")) {
2591: rowcont[j]+=':';
2592: }
2593: rowcont[j]+=data1[k];
2594: }
2595: }
2596: }
2597: }
2598: }
2599:
2600: // ---------------------------------------------------- Load from hidden fields
2601: function load() {
2602: message("Loading");
2603: schedule('load');
2604: }
2605:
2606: function finishload() {
2607: var k;
2608: for (k=0;k<objcont.length;k++) { objcont[k]=''; }
2609: objcont.length=0;
2610: for (k=0;k<objlinks.length;k++) { objlinks[k]=''; }
2611: objlinks.length=0;
2612: for (k=0;k<objparms.length;k++) { objparms[k]=''; }
2613: objparms.length=0;
2614: objlinks[0]='';
2615: objcont[0]='';
2616: editmode=0;
2617: notclear=0;
2618: lastinfo='';
2619: graphreset();
2620: var inputstr=parent.server.document.forms.storage.output.value;
2621: if ((inputstr!='') && (typeof(inputstr)!="undefined")) {
2622: data1=inputstr.split('<&>');
2623: var k;
2624: for (k=0;k<data1.length;k++) {
2625: data2=data1[k].split(':').join(':').split('<:>');
2626: if (data2[0]=='graphdef') { graphdef=data2[1]; }
2627: if (data2[0]=='maxcol') { maxcol=1*data2[1]; }
2628: if (data2[0]=='maxrow') { maxrow=1*data2[1]; }
2629: if (data2[0]=='obj') { obj[data2[1]]=data2[2]; }
2630: if (data2[0]=='objcont') { objcont[data2[1]]=data2[2]; }
2631: if (data2[0]=='objlinks') { objlinks[data2[1]]=data2[2]; }
2632: if (data2[0]=='objparms') {
2633: if (typeof(objparms[data2[1]])=="undefined") {
2634: objparms[data2[1]]=data2[2];
2635: } else {
2636: if (objparms[data2[2]]=='') {
2637: objparms[data2[1]]=data2[2];
2638: } else {
2639: objparms[data2[1]]+=':'+data2[2];
2640: }
2641: }
2642: }
2643: if (data2[0]=='rowcont') { rowcont[data2[1]]=data2[2]; }
2644: if (data2[0]=='row') { row[data2[1]]=1*data2[2]; }
2645: if (data2[0]=='col') { col[data2[1]]=1*data2[2]; }
2646: if (data2[0]=='mode') { mode=data2[1]; }
2647: if (data2[0]=='tablemode') { tablemode=1*data2[1]; }
2648: if (data2[0]=='zscale') { zscale=1*data2[1]; }
2649: }
2650: }
2651: if (graphdef=='yes') {
2652: for (k=1;k<=maxrow;k++) {
2653: if (typeof(rowcont[k])=="undefined") { rowcont[k]=''; }
2654: }
2655: } else {
2656: var hasstart=0;
2657: var hasfinish=0;
2658: for (k=0;k<objcont.length;k++) {
2659: if (typeof(objcont[k])!="undefined") {
2660: var objfunctype=(objcont[k].split(':'))[3];
2661: if (objfunctype=='start') { hasstart=1; }
2662: if (objfunctype=='finish') { hasfinish=1; }
2663: }
2664: }
2665: if (!hasstart) {
2666: if ((typeof(objcont[1])=="undefined") || (objcont[1]=='')) {
2667: objcont[1]='Start::false:start:res';
2668: }
2669: }
2670: if (!hasfinish) {
2671: if ((typeof(objcont[2])=="undefined") || (objcont[2]=='')) {
2672: objcont[2]='Finish::false:finish:res';
2673: }
2674: }
2675: }
2676: }
2677:
2678: // -------------------------------------------------------------- Parameter set
2679: function setparms(resid) {
2680: var options="scrollbars=1,resizable=1,menubar=0";
2681: parmflag=1;
2682: data1=objcont[resid].split(':');
2683: parm=open("/adm/ratparms?url="+data1[1]+"&parms="+objparms[resid]+
2684: "&resid="+resid,"parmout",options);
2685: parm.focus();
2686: }
2687:
2688: // -------------------------------------------------------------- Undo function
2689: function undo() {
2690: if (undopointer>1) {
2691: undopointer--;
2692: parent.server.document.forms.storage.output.value
2693: =undostack[undopointer];
2694: finishload();
2695: undopointer--;
2696: draw();
2697: stored=0;
2698: } else {
2699: alert("Cannot undo: reached beginning of edit session");
2700: }
2701: }
2702:
2703: // -------------------------------------------------------------- Redo function
2704: function redo() {
2705: if (undopointer<undostack.length-1) {
2706: undopointer++;
2707: parent.server.document.forms.storage.output.value
2708: =undostack[undopointer];
2709: finishload();
2710: undopointer--;
2711: draw();
2712: stored=0;
2713: } else {
2714: alert("Cannot redo: reached end of edit session");
2715: }
2716: }
2717:
2718: // ------------------------------------------------------------ Revert function
2719: function revert() {
2720: if (confirm("Revert to beginning of edit session?")) {
2721: undopointer=2;
2722: undo();
2723: }
2724: }
2725:
2726: // ---------------------------------------------------------------- Wheelswitch
2727: function wheelswitch() {
2728: if (funny=='|') {
2729: funny='/';
2730: } else {
2731: if (funny=='/') {
2732: funny='-';
2733: } else {
2734: if (funny=='-') {
2735: funny='\\';
2736: } else {
2737: if (funny=='\\') { funny='|'; }
2738: }
2739: }
2740: }
2741: }
2742:
2743: // --------------------------------------------- Checks if server frame defined
2744: function checkdef() {
2745: if (parent.flag==1) {
2746: srvloaded();
2747: }
2748: if ((finishdone==0) && (tim==0)) { setTimeout('checkdef()',100); }
2749: }
2750:
2751: // ---------------------------------------------------------- The wait function
2752: function wait() {
2753: if ((finishdone==1) || (tim==1)) {
2754: if (tim==0) {
2755: clearTimeout(canceltim);
2756: if (reqaction=='save') { finishsave(); }
2757: if (reqaction=='load') { finishload(); draw(); }
2758: } else {
2759: alert("Server Communication Timed Out.");
2760: }
2761: } else {
2762: wheelswitch();
2763: message('Waiting for server reply: '+funny);
2764: setTimeout('wait();',100);
2765: }
2766: }
2767:
2768: // ---------------------------------------------------------- Schedule function
2769: function schedule(action) {
2770: reqaction=action;
2771: tim=0;
2772: finishdone=0;
2773: canceltim=setTimeout('tim=1;',20000);
2774: checkdef();
2775: wait();
2776: }
2777:
2778: // ----------------------------------------------------- launch indexer browser
2779: function groupsearch() {
1.5 www 2780: srchcheck('import');
1.1 raeburn 2781: }
2782:
2783: function groupimport() {
1.5 www 2784: idxcheck('import');
1.1 raeburn 2785: }
2786:
2787: function groupcopy() {
1.5 www 2788: copydxcheck('import');
1.1 raeburn 2789: }
2790:
2791: // -------------------------------------------------------------- Store changes
2792: function storechange() {
2793: var k;
2794: parent.flag=0;
2795: parent.server.document.forms.storage.submit();
2796: schedule('save');
2797: }
2798:
2799: function finishsave() {
2800: finishload();
2801: draw();
2802: stored=1;
2803: }
2804:
2805: // --------------------------------------- Gets called when submission finished
2806: function srvloaded() {
2807: finishdone=1;
2808: message("Server replied.");
2809: }
2810:
2811: // ---------------------------------------------------------------- Toggle Mode
2812: function togglemode() {
2813: if (tablemode==0) {
2814: tablemode=1;
2815: } else {
2816: if (tablemode==1) {
2817: tablemode=2;
2818: } else {
2819: tablemode=0;
2820: }
2821: }
2822: notclear=0;
2823: infoclear();
2824: draw();
2825: }
2826:
2827: // -------------------------------------------------------- Main program onLoad
2828: function main() {
2829: if (mainrun==0) {
2830: infopen();
2831: infoclear();
2832: load();
2833: stored=1;
2834: mainrun=1;
2835: }
2836: }
2837:
2838: // ---------------------------------------------------------- Close the window?
2839: function leave() {
2840: if (!inf.closed) {
2841: inf.close();
2842: }
2843: if (srch && !srch.closed) {
2844: srchclose();
2845: }
2846: if (idx && !idx.closed) {
2847: idxclose();
2848: }
2849: if (copydx && !copydx.closed) {
2850: copydxclose();
2851: }
2852: }
2853:
2854: </script>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>