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