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