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