Annotation of rat/client/code.html, revision 1.57
1.1 www 1: <html>
2:
3: <!--
4: The LearningOnline Network
5: Resource Assembly Tool
1.48 www 6: //
1.57 ! www 7: // $Id: code.html,v 1.56 2002/05/24 16:39:23 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.38 www 977: }
1.1 www 978: parent.mapout.document.write
1.38 www 979: ('<img border=0 width='+cw[ctype]+' height='+rh[1]
1.51 matthew 980: +' src="'+raticons+'resource.gif">');
1.40 www 981: if ((mime!='') && (ext!='true')) {
1.38 www 982: parent.mapout.document.write
1.51 matthew 983: ('<br><img border=0 src="'+raticons+'left.gif"></a><a target="preview" href="'+
1.39 www 984: url+'.meta"><img border=0 src="'+iconpath+
985: 'meta.gif"><a target="preview" href="'+url+
986: '"><img border=0 src="'+iconpath+mime+'.gif">'+
1.51 matthew 987: '<img border=0 src="'+raticons+'right.gif">');
1.39 www 988: } else {
989: parent.mapout.document.write
1.51 matthew 990: ('<br><img border=0 src="'+raticons+'middle.gif">');
1.38 www 991: }
1.39 www 992: parent.mapout.document.write
1.51 matthew 993: ('<br><img border=0 src="'+raticons+'bottom.gif">');
1.1 www 994: } else {
995: if (what=='c:') {
996: parent.mapout.document.write
1.4 www 997: ('<img border=0 width='+cw[ctype]+' height='+rh[rtype]
1.51 matthew 998: +' src="'+raticons+'condition.gif">');
1.1 www 999: } else {
1.5 www 1000: if (what=='rs:') {
1.40 www 1001: mime='';
1002: objnum=(obj1.split('&'))[1];
1.43 harris41 1003: if (typeof(objcont[objnum])!="undefined") {
1.40 www 1004: urlparts=objcont[objnum].split(':');
1005: url=urlparts[1];
1006: ext=urlparts[2];
1007: urlparts=url.split('.');
1008: mime=urlparts[urlparts.length-1];
1.43 harris41 1009: if (typeof(mime)=="undefined") { mime=''; }
1.40 www 1010: }
1.5 www 1011: parent.mapout.document.write
1.40 www 1012: ('<img border=0 width='+cw[ctype]+' height='+rh[1]
1.51 matthew 1013: +' src="'+raticons+'start.gif">');
1.40 www 1014: if ((mime!='') && (ext!='true')) {
1015: parent.mapout.document.write
1.51 matthew 1016: ('<br><img border=0 src="'+raticons+'left.gif"></a><a target="preview" href="'+
1.40 www 1017: url+'.meta"><img border=0 src="'+iconpath+
1018: 'meta.gif"><a target="preview" href="'+url+
1019: '"><img border=0 src="'+iconpath+mime+'.gif">'+
1.51 matthew 1020: '<img border=0 src="'+raticons+'right.gif">');
1.40 www 1021: } else {
1022: parent.mapout.document.write
1.51 matthew 1023: ('<br><img border=0 src="'+raticons+'middle.gif">');
1.40 www 1024: }
1025: parent.mapout.document.write
1.51 matthew 1026: ('<br><img border=0 src="'+raticons+'bottom.gif">');
1.40 www 1027:
1.5 www 1028: } else {
1029: if (what=='rf:') {
1.40 www 1030: mime='';
1031: objnum=(obj1.split('&'))[1];
1.43 harris41 1032: if (typeof(objcont[objnum])!="undefined") {
1.40 www 1033: urlparts=objcont[objnum].split(':');
1034: url=urlparts[1];
1035: ext=urlparts[2];
1036: urlparts=url.split('.');
1037: mime=urlparts[urlparts.length-1];
1.43 harris41 1038: if (typeof(mime)=="undefined") { mime=''; }
1.40 www 1039: }
1.5 www 1040: parent.mapout.document.write
1.40 www 1041: ('<img border=0 width='+cw[ctype]+' height='+rh[1]
1.51 matthew 1042: +' src="'+raticons+'finish.gif">');
1.40 www 1043: if ((mime!='') && (ext!='true')) {
1044: parent.mapout.document.write
1.51 matthew 1045: ('<br><img border=0 src="'+raticons+'left.gif"></a><a target="preview" href="'+
1.40 www 1046: url+'.meta"><img border=0 src="'+iconpath+
1047: 'meta.gif"><a target="preview" href="'+url+
1048: '"><img border=0 src="'+iconpath+mime+'.gif">'+
1.51 matthew 1049: '<img border=0 src="'+raticons+'right.gif">');
1.40 www 1050: } else {
1051: parent.mapout.document.write
1.51 matthew 1052: ('<br><img border=0 src="'+raticons+'middle.gif">');
1.40 www 1053: }
1054: parent.mapout.document.write
1.51 matthew 1055: ('<br><img border=0 src="'+raticons+'bottom.gif">');
1.5 www 1056: } else {
1057: parent.mapout.document.write
1058: ('<img border=0 width='+cw[ctype]+' height='+rh[rtype]
1.51 matthew 1059: +' src="'+raticons+rtype+'.'+ctype+'.'+what+'.gif">');
1.5 www 1060: }
1061: }
1.1 www 1062: }
1063: }
1.43 harris41 1064: if ((obj1!='') && (typeof(obj1)!="undefined")) {
1.1 www 1065: parent.mapout.document.write('</a>');
1066: }
1067: } else {
1068: if (ne!=1) {
1069: parent.mapout.document.write
1070: ('<a href="javascript:parent.code.empty('+ej+','+ek+');" ');
1071: } else {
1072: parent.mapout.document.write
1073: ('<a href="javascript:parent.code.infoclear();" ');
1074: }
1075: parent.mapout.document.write
1076: ('onMouseOver="parent.code.infoclear();">');
1077: parent.mapout.document.write
1.4 www 1078: (
1079: '<img border=0 width='+cw[ctype]+' height='+rh[rtype]
1.51 matthew 1080: +' src="'+raticons+rtype+'.'+ctype+'.empty.gif"></a>');
1.1 www 1081: }
1082: parent.mapout.document.write('</td>');
1083: }
1084: }
1085:
1.4 www 1086: // --------------------------------------------------------- Color of resources
1087: function rescolor (ext,typ) {
1088: var rc; var gc; var bc;
1089: if (ext=='true') { bc='55'; } else { bc='99'; }
1090: if (typ=='mandatory') { rc='FF'; } else { rc='BB'; }
1091: if (typ=='optional') { gc='BB'; } else { gc='FF'; }
1.5 www 1092: if ((typ=='start') || (typ=='finish')) { rc='AA'; gc='AA'; bc='FF'; }
1.4 www 1093: return '#'+rc+gc+bc;
1094: }
1095:
1096: // -------------------------------------------------------- Color of conditions
1097: function condcolor(typ) {
1098: if (typ=='stop') { return '#EEAAAA'; }
1099: if (typ=='force') { return '#AAAAEE'; }
1100: return '#EEEEAA';
1101: }
1102:
1.1 www 1103: // ----------------------------------------------------------------- Draw a row
1.2 www 1104: function drawrow (jid) {
1.5 www 1105: var j; var jk; var k; var ck; var rtype;
1.1 www 1106: var objd1=new Array();
1107: var objd2=new Array();
1108: var notempty=new Array();
1109: var condtype;
1110: if (rowtype[jid]!=0) {
1111: for (j=0;j<=maxcol;j++) {
1112: colmap[j]=''; colmap2[j]=''; colmap3[j]=''; colmap4[j]='';
1.3 www 1113: colmap5[j]='#CCCCCC'; colmap6[j]='#CCCCCC';
1.1 www 1114: objd1[j]=''; objd2[j]=''; notempty[j]=0;
1115: }
1.3 www 1116:
1.1 www 1117: parent.mapout.document.writeln('<tr height='+rh[rowtype[jid]]+'>');
1.43 harris41 1118: if ((rowcont[jid]!='') && (typeof(rowcont[jid])!="undefined")) {
1.1 www 1119: data2=rowcont[jid].split(':');
1120: for (jk=0;jk<data2.length;jk++) {
1121: data3=obj[data2[jk]].split('&');
1122: if (data3[0]=='b') {
1.3 www 1123: data1=objcont[data2[jk]].split(':');
1.5 www 1124: rtype=data1[3];
1.4 www 1125: ck=rescolor(data1[2],data1[3]);
1.1 www 1126: left=maxcol;
1127: leftin=maxcol;
1128: leftout=maxcol;
1129: right=0;
1130: rightin=0;
1131: rightout=0;
1132: anyout=0;
1133: for (k=2;k<data3.length;k++) {
1134: data1=data3[k].split(':');
1135: thiscol=col[data1[0]];
1136: if (thiscol<left) { left=thiscol; }
1137: if (thiscol>right) { right=thiscol; }
1138: if (data1[1]!=0) {
1139: if (thiscol<leftin) { leftin=thiscol; }
1140: if (thiscol>rightin) { rightin=thiscol; }
1141: colmap4[thiscol]=data1[1];
1142: }
1143: if (data1[2]!=0) {
1144: if (thiscol<leftout) { anyout=1; leftout=thiscol; }
1145: if (thiscol>rightout) { anyout=1; rightout=thiscol; }
1146: if (data1[3]!=0) {
1147: colmap3[thiscol]='c:';
1148: condtype=(objcont[data1[3]].split(':'))[1];
1.4 www 1149: colmap6[thiscol]=condcolor(condtype);
1.1 www 1150: objd2[thiscol]='c&'
1151: +data1[0]+'&'+data2[jk]+'&'+data1[2]+'&'+data1[3];
1152: } else {
1153: colmap3[thiscol]='ctd';
1154: colmap6[thiscol]=ck;
1155: objd2[thiscol]='c&'
1156: +data1[0]+'&'+data2[jk]+'&'+data1[2]+'&-';
1157: }
1158: }
1159: }
1160: for (k=left;k<=right;k++) { notempty[k]=1; colmap5[k]=ck; }
1161: middle=Math.round((left+right)/2);
1.5 www 1162: if (rtype=='start') {
1163: colmap[middle]='rs:';
1164: } else {
1165: if (rtype=='finish') {
1166: colmap[middle]='rf:';
1167: } else {
1168: colmap[middle]='r:';
1169: }
1170: }
1.1 www 1171: objd1[middle]+='r&'+data2[jk];
1172:
1173: if (rightin>middle) {
1174: for (k=middle+1;k<rightin;k++) {
1.43 harris41 1175: if ((colmap4[k]!='') && (typeof(colmap4[k])!="undefined")) {
1.1 www 1176: colmap[k]='rlt';
1177: } else {
1178: colmap[k]='rl';
1179: }
1180: }
1181: colmap[rightin]='tl';
1182: }
1183: if (leftin<middle) {
1184: for (k=middle-1;k>leftin;k--) {
1.43 harris41 1185: if ((colmap4[k]!='') && (typeof(colmap4[k])!="undefined")) {
1.1 www 1186: colmap[k]='lrt';
1187: } else {
1188: colmap[k]='lr';
1189: }
1190: }
1191: colmap[leftin]='tr';
1192: }
1193:
1194: if ((leftout>middle) && (anyout)) {
1195: colmap2[middle]='tr';
1196: }
1197: if (leftout==middle) {
1198: if (rightout==middle) { colmap2[middle]='td'; }
1199: if (rightout>middle) { colmap2[middle]='rtd'; }
1200: }
1201: if (leftout<middle) {
1202: if (rightout<middle) { colmap2[middle]='tl'; }
1203: if (rightout==middle) { colmap2[middle]='tdl'; }
1204: if (rightout>middle) {
1.43 harris41 1205: if ((colmap3[middle]!='') && (typeof(colmap3[middle])!="undefined")) {
1.1 www 1206: colmap2[middle]='rtdl';
1207: } else {
1208: colmap2[middle]='rtl';
1209: }
1210: }
1211: }
1212: if (leftout<middle) {
1213: for (k=middle-1;k>leftout;k--) {
1.43 harris41 1214: if ((colmap3[k]!='') && (typeof(colmap3[k])!="undefined")) {
1.1 www 1215: colmap2[k]='rld';
1216: } else {
1217: colmap2[k]='rl';
1218: }
1219: }
1220: colmap2[leftout]='rd';
1221: }
1222: if (rightout>middle) {
1223: for (k=middle+1;k<rightout;k++) {
1.43 harris41 1224: if ((colmap3[k]!='') && (typeof(colmap3[k])!="undefined")) {
1.1 www 1225: colmap2[k]='lrd';
1226: } else {
1227: colmap2[k]='lr';
1228: }
1229: }
1230: colmap2[rightout]='ld';
1231: }
1232: }
1233: if (data3[0]=='h') {
1234: data4=data3[2].split(':');
1235: if (col[data4[1]]>col[data4[0]]) {
1236: left=col[data4[0]];
1237: right=col[data4[1]];
1238: thisarrow='lr';
1239: } else {
1240: right=col[data4[0]];
1241: left=col[data4[1]];
1242: thisarrow='rl';
1243: }
1244: if (data3[4].split(':')[0]==1) {
1245: colmap[left]='tr';
1246: } else {
1247: colmap[left]='rd'; colmap2[left]='utd'; colmap3[left]='utd';
1248: }
1.4 www 1249: notempty[left]=1;
1250: notempty[right]=1;
1.1 www 1251: for (k=left+1;k<right;k++) {
1.4 www 1252: notempty[k]=1;
1.1 www 1253: if (colmap[k]=='') {
1254: colmap[k]=thisarrow;
1255: objd1[k]=data2[jk];
1256: } else {
1257: colmap[k]='tdrl';
1258: objd1[k]='';
1259: }
1260: }
1261: if (data3[4].split(':')[1]==1) {
1262: colmap[right]='tl';
1263: } else {
1264: colmap[right]='ld'; colmap2[right]='utd'; colmap3[right]='utd';
1265: }
1266: objd1[left]=data2[jk];
1267: objd1[right]=data2[jk];
1268: }
1269: if (data3[0]=='v') {
1270: left=col[data3[1]];
1271: if (colmap[left]=='') {
1272: if (data3[3]==1) { colmap[left]='dt'; } else { colmap[left]='td'; }
1.3 www 1273: objd1[left]=data2[jk]+'&'+jid;
1.1 www 1274: objd2[left]=objd1[left];
1275: } else {
1276: colmap[left]='tdrl';
1277: objd1[left]='';
1278: }
1279: colmap2[left]='utd'; colmap3[left]='utd';
1280: }
1281: }
1282: rtype=rowtype[jid];
1283: for (k=0;k<=maxcol;k++) {
1.2 www 1284: drawcell(rtype,coltype[rcol[k]],colmap[k],colmap5[k],objd1[k],jid,k,
1.1 www 1285: notempty[k]);
1286: }
1287: if (rowtype[jid]==2) {
1.3 www 1288: parent.mapout.document.writeln('</tr>');
1.5 www 1289: parent.mapout.document.writeln('<tr height='+rh[1]+'>');
1.1 www 1290: for (k=0;k<=maxcol;k++) {
1.3 www 1291: drawcell(1,coltype[rcol[k]],colmap2[k],colmap5[k],objd2[k],jid,k,
1292: notempty[k]);
1.1 www 1293: }
1.3 www 1294: parent.mapout.document.writeln('</tr>');
1.5 www 1295: parent.mapout.document.writeln('<tr height='+rh[1]+'>');
1.1 www 1296: for (k=0;k<=maxcol;k++) {
1.3 www 1297: drawcell(1,coltype[rcol[k]],colmap3[k],colmap6[k],objd2[k],jid,k,
1298: notempty[k]);
1.1 www 1299: }
1300: }
1301: }
1302: parent.mapout.document.writeln('</tr>');
1303: }
1304: }
1305:
1.3 www 1306: // -------------------------------------------------------------- Print message
1307: function message(txt) {
1308: parent.window.status=txt;
1309: }
1310:
1.1 www 1311: // ------------------------------------------------------------- Draw the table
1.2 www 1312: function draw () {
1.1 www 1313: var k; var kr;
1314:
1315: cleanup();
1.2 www 1316: save();
1.1 www 1317:
1318: rh[0]=0;
1.4 www 1319: rh[1]=zscale*10;
1320: rh[2]=zscale*20;
1.1 www 1321: cw[0]=0;
1.4 www 1322: cw[1]=zscale*10;
1323: cw[2]=zscale*20;
1324:
1.1 www 1325: parent.mapout.document.open('text/html','replace');
1326: parent.mapout.document.writeln('<html><body bgcolor="#FFFFFF">');
1.3 www 1327:
1.2 www 1328: if (tablemode==0) {
1.3 www 1329: if (graphdef=='no') { graphopt(); cleanup(); }
1330: for (k=0;k<=maxrow;k++) { rrow[row[k]]=k; }
1331: for (k=0;k<=maxcol;k++) { rcol[col[k]]=k; }
1.4 www 1332: parent.mapout.document.writeln(
1.3 www 1333: '<table cellpadding=0 cellspacing=0 border=0 rows='
1334: +disrows+' cols='+discols+'>');
1.7 www 1335: for (kr=0;kr<=maxrow;kr++) {
1.4 www 1336: message("Generating Output Row "+kr);
1337: drawrow(rrow[kr]);
1338: }
1.2 www 1339: } else {
1.3 www 1340: message("Generating Table Output");
1.4 www 1341: for (k=0;k<=maxrow;k++) { rrow[row[k]]=k; }
1342: for (k=0;k<=maxcol;k++) { rcol[col[k]]=k; }
1343:
1.3 www 1344: parent.mapout.document.writeln( '<table>');
1.4 www 1345: if (tablemode==1) {
1346: tabledraw();
1347: } else {
1348: simpletabledraw();
1349: }
1.2 www 1350: }
1.1 www 1351:
1352: parent.mapout.document.writeln('</table>');
1353: parent.mapout.document.writeln('</body></html>');
1354: parent.mapout.document.close();
1355: parent.focus();
1356: parent.mapout.focus();
1357: }
1358:
1359: // --------------------------------------------------------- Clears info window
1360: function infoclear() {
1361: if (notclear!=1) {
1.5 www 1362: infcheck();
1.1 www 1363: inf.document.clear();
1364: inf.document.writeln
1365: ('<html><body bgcolor="#FFFFFF"><table><tr><td>'+
1366: '<img src="/adm/lonIcons/lonlogos.gif"></td>');
1367: if (linkmode!=0) {
1.4 www 1368: if (tablemode==0) {
1.1 www 1369: inf.document.writeln(
1370: '<td><b>Link Mode</b><hr>Click on a resource to link it with<br><b>'+
1371: (objcont[linkmode].split(':'))[0]+
1372: '</b><br>click anywhere else to cancel.</td>');
1.4 www 1373: } else {
1374: inf.document.writeln(
1375: '<td><b>Link Mode</b><hr>Click on a resource number to link it with<br><b>'+
1376: (objcont[linkmode].split(':'))[0]+'</b><br>'+
1377: '<a href="javascript:opener.linkmode=0;opener.notclear=0;opener.infoclear();">'
1378: +'Cancel</a></td>');
1379: }
1.3 www 1380: } else {
1.4 www 1381: if (tablemode==0) {
1.3 www 1382: inf.document.writeln(
1.4 www 1383: '<td><b>Click to Edit</b><hr>Click in a light gray area<br>'
1384: +'to insert resources, columns and rows</td>'
1.3 www 1385: );
1.4 www 1386: }
1.1 www 1387: }
1388: inf.document.writeln('</tr></table></body></html>');
1389: inf.document.close();
1.29 harris41 1390: if (srchflag==1) {
1391: srchclose();
1392: }
1.32 harris41 1393: if (idxflag==1) {
1394: idxclose();
1395: }
1.34 www 1396: if (parmflag==1) {
1397: parmclose();
1398: }
1.16 www 1399: parent.top.focus();
1.1 www 1400: parent.mapout.focus();
1401: notclear=1;
1402: lastinfo='';
1403: }
1404: }
1405:
1.5 www 1406: // ------------------------------------------------------------ Open inf window
1407: function infopen() {
1408: var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300";
1409: inf=open("","infout",options);
1410: }
1411:
1412: // -------------------------------------------------------- Do inf status check
1413: function infcheck() {
1414: if (inf.closed) {
1415: infopen();
1416: }
1417: }
1418:
1.1 www 1419: // --------------------------------------------------- Prints out resource info
1420: function info(infostr) {
1.38 www 1421: var mime='';
1.40 www 1422: var ext;
1.38 www 1423: var urlparts=new Array;
1424: var url='';
1.1 www 1425: if ((editmode!=1) && (infostr!=lastinfo)) {
1426: notclear=1;
1.5 www 1427: infcheck();
1.1 www 1428: inf.document.clear();
1429: inf.document.writeln(
1430: '<html><body bgcolor="#FFFFFF">'+
1.51 matthew 1431: '<table><tr><td width=32><img src="'+raticons+'info.gif"></td><td bgcolor="#AAFFAA">');
1.1 www 1432: data1=infostr.split('&');
1433: if (data1[0]=='c') {
1434: inf.document.write('<b>Condition (');
1435: data3=objlinks[data1[3]].split(':');
1436: if (data1[4]=='-') {
1437: inf.document.write('not set');
1438: } else {
1439: data2=objcont[data1[4]].split(':');
1440: if (data2[1]=='force') {
1441: inf.document.write('Blocking Other Links');
1442: } else {
1443: if (data2[1]=='stop') {
1444: inf.document.write('Blocking This Link');
1445: } else {
1446: inf.document.write('Recommendation');
1447: }
1448: }
1449: }
1450: inf.document.writeln(')</b><hr>From <b>'+objcont[data3[0]].split(':')[0]+
1451: '</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
1452: } else {
1453: if (data1[0]=='r') {
1454: data2=objcont[data1[1]].split(':');
1.38 www 1455: url=data2[1];
1.40 www 1456: ext=data2[2];
1.38 www 1457: urlparts=url.split('.');
1458: mime=urlparts[urlparts.length-1];
1.43 harris41 1459: if (typeof(mime)=="undefined") { mime=''; }
1.40 www 1460: if (ext=='true') { mime=''; }
1.38 www 1461: if (mime!='') {
1462: inf.document.write
1463: ('<br><a target="preview" align="right" href="'+url+
1.39 www 1464: '"><img border=0 src="'+iconpath+mime+'.gif"></a> ');
1.38 www 1465: }
1466: inf.document.write('<b>');
1.3 www 1467: if (data2[2]=='true') { inf.document.write('External '); }
1.5 www 1468: if (data2[3]=='start') {
1469: inf.document.writeln('<b>Start</b>');
1470: } else {
1471: if (data2[3]=='finish') {
1472: inf.document.writeln('<b>Finish</b>');
1473: } else {
1474: inf.document.writeln('<b>Resource</b>');
1475: }
1476: }
1.3 www 1477: if (data2[3]=='mandatory') {
1478: inf.document.write(' (Mandatory)');
1479: }
1480: if (data2[3]=='optional') {
1481: inf.document.write(' (Optional)');
1482: }
1483: inf.document.writeln('</b><hr><b>'+data2[0]+'</b><br>');
1.1 www 1484: inf.document.writeln((data2[1].split('/')).join(' / '));
1485: } else {
1486: inf.document.writeln('<b>Link</b><hr>');
1487: data2=obj[data1[0]].split('&');
1488: data3=objlinks[data2[data2.length-2]].split(':');
1489: inf.document.writeln('From <b>'+objcont[data3[0]].split(':')[0]+
1490: '</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
1491: }
1492: }
1493: if (linkmode==0) {
1494: inf.document.writeln('<p>(click to edit)');
1495: } else {
1496: if (data1[0]=='r') {
1497: inf.document.writeln('<p>(click to link)');
1498: } else {
1499: inf.document.writeln('<p>(click to cancel linking and edit)');
1500: }
1501: }
1502: inf.document.writeln('</td></tr></table></body></html>');
1503: inf.document.close();
1.16 www 1504: parent.top.focus();
1.1 www 1505: parent.mapout.focus();
1506: notclear=0;
1507: lastinfo=infostr;
1508: }
1509: }
1510:
1511: // ------------------------------------------------ "Escapes" out special chars
1512: function escape(instring) {
1513: var outstring='';
1514: var thischar;
1515: var k;
1516: for (k=0;k<instring.length;k++) {
1517: thischar=instring.charAt(k);
1518: if (thischar==':') { thischar=':'; }
1.51 matthew 1519: if (thischar=='"') { thischar='"'; }// "
1.1 www 1520: if (thischar=="'") { thischar='''; }
1521: if (thischar==',') { thischar=','; }
1522: outstring+=thischar;
1523: }
1524: return outstring;
1525: }
1526:
1.2 www 1527: // -------------------------------------------------- Insert resource into link
1528: function insertreslink(infostr) {
1.3 www 1529: var lnr;
1530: var fobj;
1531: var tobj;
1532: var nobj;
1533: var cobj;
1.5 www 1534: var cid;
1535: var rid;
1.3 www 1536: data1=infostr.split('&');
1537: data2=obj[data1[0]].split('&');
1538: lnr=data2[data2.length-2];
1539: data3=objlinks[lnr].split(':');
1540: fobj=data3[0];
1541: tobj=data3[1];
1542: cobj=data3[2];
1543: if (data2[0]=='v') {
1544: rid=data1[1];
1545: cid=data2[1];
1546: } else {
1547: rid=data2[1];
1548: cid=(data2[2].split(':'))[0];
1549: }
1550: dellink(lnr);
1551: newresource(rid,cid,'','','false','normal');
1552: nobj=obj.length-1;
1.12 www 1553: save();
1.3 www 1554: joinres(fobj,nobj,cobj);
1.12 www 1555: save();
1.3 www 1556: joinres(nobj,tobj,0);
1.2 www 1557: }
1558:
1.5 www 1559: // -------------------------------------------- Insert resource after condition
1560: function insertcondlink(cid,lnr) {
1561: var fobj;
1562: var tobj;
1563: var nobj;
1564: var cobj;
1565: data3=objlinks[lnr].split(':');
1566: fobj=data3[0];
1567: tobj=data3[1];
1568: cobj=data3[2];
1569: rid=(obj[fobj].split('&'))[1];
1570: insertrow(row[rid]);
1571: dellink(lnr);
1572: newresource(maxrow,cid,'','','false','normal');
1573: nobj=obj.length-1;
1.12 www 1574: save();
1.5 www 1575: joinres(fobj,nobj,cobj);
1.12 www 1576: save();
1.5 www 1577: joinres(nobj,tobj,0);
1578: }
1579:
1.32 harris41 1580: // ------------------------------------------------------ Clears indexer window
1581: function idxclear() {
1582: idx.document.clear();
1583: }
1584:
1.56 www 1585: // --------------------------------------------------------- Clears copy window
1586: function copydxclear() {
1587: copydx.document.clear();
1588: }
1.17 harris41 1589: // ------------------------------------------------------- Clears search window
1590: function srchclear() {
1591: srch.document.clear();
1592: }
1593:
1.34 www 1594: // --------------------------------------------------------- Clears parm window
1595: function parmclear() {
1596: parm.document.clear();
1597: }
1598:
1.32 harris41 1599: // ------------------------------------------------------ Closes indexer window
1600: function idxclose() {
1601: if (idx && !idx.closed) {
1602: idxflag=0;
1603: idx.close();
1604: }
1605: }
1606:
1.56 www 1607: // --------------------------------------------------------- Closes copy window
1608: function copydxclose() {
1609: if (copydx && !copydx.closed) {
1610: copydxflag=0;
1611: copydx.close();
1612: }
1613: }
1614:
1.17 harris41 1615: // ------------------------------------------------------- Closes search window
1616: function srchclose() {
1.25 harris41 1617: if (srch && !srch.closed) {
1.29 harris41 1618: srchflag=0;
1.21 harris41 1619: srch.close();
1620: }
1.17 harris41 1621: }
1622:
1.34 www 1623: // ------------------------------------------------------- Closes search window
1624: function parmclose() {
1625: if (parm && !parm.closed) {
1626: parmflag=0;
1627: parm.close();
1628: }
1629: }
1630:
1.32 harris41 1631: // -------------------------------------------------------- Open indexer window
1.33 harris41 1632: function idxopen(mode) {
1.32 harris41 1633: var options="scrollbars=1,resizable=1,menubar=0";
1.33 harris41 1634: idxmode=mode;
1.32 harris41 1635: idxflag=1;
1.50 matthew 1636: idx=open("/res/?launch=1&mode=rat&catalogmode="+mode,"idxout",options);
1.32 harris41 1637: idx.focus();
1638: }
1.57 ! www 1639: // ------------------------------------------------- Open browser to select map
! 1640: var editbrowser;
! 1641: function openbrowser(formname,elementname,only,omit) {
! 1642: var url = '/res/?';
! 1643: if (editbrowser == null) {
! 1644: url += 'launch=1&';
! 1645: }
! 1646: url += 'catalogmode=interactive&';
! 1647: url += 'mode=edit&';
! 1648: url += 'form=' + formname + '&';
! 1649: if (only != null) {
! 1650: url += 'only=' + only + '&';
! 1651: }
! 1652: if (omit != null) {
! 1653: url += 'omit=' + omit + '&';
! 1654: }
! 1655: url += 'element=' + elementname + '';
! 1656: var title = 'Browser';
! 1657: var options = 'scrollbars=1,resizable=1,menubar=0';
! 1658: options += ',width=700,height=600';
! 1659: editbrowser = copydx.open(url,title,options,'1');
! 1660: editbrowser.focus();
! 1661: }
1.56 www 1662: // ----------------------------------------------------------- Open copy window
1663: function copydxopen(mode) {
1664: var options="scrollbars=1,resizable=1,menubar=0";
1665: copydxmode=mode;
1666: copydxflag=1;
1667: copydx=open("",'copydxout',options);
1668: copydx.document.clear('');
1669: copydx.document.writeln(
1.57 ! www 1670: '<html><body bgcolor="#FFFFFF"><h1>Group Copy from Map</h1>'+
! 1671: '<form name="mapload"><input type=text size=40 name=importmap>'+
! 1672: '<input type=button onClick="javascript:opener.openbrowser'+
! 1673: "('mapload','importmap','sequence,page','')"+
! 1674: '" value="Browse"><input type=button value="Load Map" '+
! 1675: 'onClick="window.location=document.mapload.importmap.value+'+
! 1676: "'?launch=1&forceselect=1'"+'"></form>');
! 1677:
1.56 www 1678: copydx.document.writeln('</body></html>');
1679: copydx.focus();
1680: }
1681:
1.17 harris41 1682: // --------------------------------------------------------- Open search window
1.33 harris41 1683: function srchopen(mode) {
1.17 harris41 1684: var options="scrollbars=1,resizable=1,menubar=0";
1.33 harris41 1685: srchmode=mode;
1.29 harris41 1686: srchflag=1;
1.50 matthew 1687: srch=open("/adm/searchcat?launch=1&mode=rat&catalogmode="+mode,"srchout",options);
1.21 harris41 1688: srch.focus();
1.17 harris41 1689: }
1690:
1691: // -------------------------------------------- Interface function to searching
1692: function search() {
1693: alert("Searching not yet implemented");
1694: }
1695:
1696: // ------------------------------------------------------- Do srch status check
1.33 harris41 1697: function srchcheck(mode) {
1698: if (!srch || srch.closed || srchmode!=mode) {
1.46 harris41 1699: srchopen(mode);
1.17 harris41 1700: }
1.21 harris41 1701: srch.focus();
1.17 harris41 1702: }
1703:
1.32 harris41 1704: // -------------------------------------------------------- Do idx status check
1.33 harris41 1705: function idxcheck(mode) {
1706: if (!idx || idx.closed || idxmode!=mode) {
1707: idxopen(mode);
1.32 harris41 1708: }
1709: idx.focus();
1710: }
1711:
1.56 www 1712: // -------------------------------------------------------- Do idx status check
1713: function copydxcheck(mode) {
1714: if (!copydx || copydx.closed || copydxmode!=mode) {
1715: copydxopen(mode);
1716: }
1717: copydx.focus();
1718: }
1719:
1.1 www 1720: // ---------------------------------------------------- Handles "click to edit"
1721: function handler(infostr) {
1722: var k;
1723: editmode=1;
1724: notclear=1;
1.5 www 1725: infcheck();
1.1 www 1726: inf.document.clear();
1727: inf.document.writeln(
1728: '<html><body bgcolor="#FFFFFF">'+
1.51 matthew 1729: '<table><tr><td width=32><img src="'+raticons+'edit.gif"></td><td bgcolor="#AAFFAA">');
1.1 www 1730: data1=infostr.split('&');
1731: if (data1[0]=='c') {
1732: inf.document.writeln('<b>Condition</b><hr>');
1733: linkmode=0;
1734: if (data1[4]=='-') {
1735: data2[0]=''; data2[1]='normal';
1736: } else {
1737: data2=objcont[data1[4]].split(':');
1738: }
1739: inf.document.writeln(
1.3 www 1740: '<form name=condinfo><textarea name=c cols=30 rows=3>'
1.1 www 1741: +data2[0]+'</textarea><br><input type=radio name=s value=normal '+
1742: 'onClick="self.document.forms.condinfo.elements.h.value='+"'normal'"+'"');
1743: if (data2[1]=='normal') { inf.document.write(' checked'); }
1744: inf.document.write(
1745: '> Recommendation if true<br><input type=radio name=s value=stop '+
1746: 'onClick="self.document.forms.condinfo.elements.h.value='+"'stop'"+'"');
1747: if (data2[1]=='stop') { inf.document.write(' checked'); }
1748: inf.document.write(
1749: '> Blocking this link if false<br><input type=radio name=s value=force '+
1750: 'onClick="self.document.forms.condinfo.elements.h.value='+"'force'"+'"');
1751: if (data2[1]=='force') { inf.document.write(' checked'); }
1752: inf.document.write(
1753: '> Blocking other links if true<br><a href="javascript:opener.editmode=0;'
1754: +'opener.notclear=0;');
1755: if (data1[4]=='-') {
1756: inf.document.write('opener.crecond('+data1[2]+','+data1[1]+','
1757: +'opener.escape(self.document.forms.condinfo.elements.c.value),'
1758: +'self.document.forms.condinfo.elements.h.value);');
1759: } else {
1760: inf.document.write('opener.objcont['+data1[4]+']='
1761: +'opener.escape(self.document.forms.condinfo.elements.c.value)+'+"':'"
1762: +'+self.document.forms.condinfo.elements.h.value+'+"':cond';");
1763: }
1764: inf.document.writeln(
1765: 'opener.infoclear();opener.editmode=0;opener.draw('
1.39 www 1766: +');"><b>Save Changes</b></a> '
1.3 www 1767: +' <a href="javascript:self.document.forms.condinfo.reset()">Reset</a><br>'
1768: +'<input type=hidden name=h value='+data2[1]+'>');
1.1 www 1769:
1770: inf.document.writeln(
1771: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1772: +'opener.delcond('+data1[2]+','+data1[1]+');opener.editmode=0;opener.draw('
1.3 www 1773: +');">Delete Condition</a><br>');
1774: inf.document.writeln(
1775: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1776: +'opener.dellink('+data1[3]+');opener.editmode=0;opener.draw('
1777: +');">Delete Link</a>');
1.5 www 1778:
1779: inf.document.writeln('<br><a href="javascript:'+
1780: 'opener.insertcondlink('+data1[1]+','+data1[3]+');'+
1781: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1782: +');">Insert Resource Into Link</a>');
1.3 www 1783: } else {
1.1 www 1784: if (data1[0]=='r') {
1785: if (linkmode!=0) {
1786: joinres(linkmode,data1[1],0);
1787: editmode=0;
1788: notclear=0;
1789: linkmode=0;
1790: inf.document.writeln('<b>Linked Resources</b>');
1.2 www 1791: draw();
1.1 www 1792: } else {
1793: data2=objcont[data1[1]].split(':');
1.5 www 1794: if (data2[3]=='start') {
1795: inf.document.writeln('<b>Start</b>');
1796: } else {
1797: if (data2[3]=='finish') {
1798: inf.document.writeln('<b>Finish</b>');
1799: } else {
1800: inf.document.writeln('<b>Resource</b>');
1801: }
1802: }
1.1 www 1803: inf.document.write(
1.17 harris41 1804: '<form name=resinfo><table><tr><td>Title:</td><td colspan=2>'
1.3 www 1805: +'<input type=text name=t size=30 value="'
1.5 www 1806: +data2[0]+'"><input type=hidden name=h value='+data2[3]+'></td></tr>');
1.17 harris41 1807: inf.document.write('<tr><td>URL:</td><td colspan=2>'
1.3 www 1808: +'<input type=text name=u size=30 value="'+data2[1]+'"></td></tr>'
1.1 www 1809: +'<tr><td>External:</td><td><input type=checkbox name=e');
1810: if (data2[2]=='true') { inf.document.write(' checked'); }
1.32 harris41 1811: inf.document.write('></td><td align=right>'
1.33 harris41 1812: +'<a href="javascript:opener.idxcheck(\'interactive\')">Browse</a> '
1.32 harris41 1813: +'<a href="javascript:opener'
1.38 www 1814: +'.srchcheck(\'interactive\')">Search</a></td></tr>');
1815: if ((data2[3]!='start') && (data2[3]!='finish')) {
1816: inf.document.write('<tr><td colspan=3>'
1.5 www 1817: +'<input type=radio name=y value=normal '+
1.3 www 1818: 'onClick="self.document.forms.resinfo.elements.h.value='+"'normal'"+'"');
1819: if (data2[3]=='normal') { inf.document.write(' checked'); }
1820: inf.document.write(
1821: '> Regular <input type=radio name=y value=mandatory '+
1822: 'onClick="self.document.forms.resinfo.elements.h.value='+"'mandatory'"+'"');
1823: if (data2[3]=='mandatory') { inf.document.write(' checked'); }
1824: inf.document.write(
1825: '> Mandatory <input type=radio name=y value=optional '+
1826: 'onClick="self.document.forms.resinfo.elements.h.value='+"'optional'"+'"');
1827: if (data2[3]=='optional') { inf.document.write(' checked'); }
1.5 www 1828: inf.document.write('> Optional</td></tr>');
1.38 www 1829: }
1.5 www 1830: inf.document.writeln(
1.17 harris41 1831: '<tr><td colspan=3><a href="javascript:opener.editmode=0;'
1.1 www 1832: +'opener.notclear=0;opener.objcont['+data1[1]
1833: +']=opener.escape(self.document.forms.resinfo.elements.t.value)+'+"':'"
1834: +'+opener.escape(self.document.forms.resinfo.elements.u.value)+'+"':'"
1.3 www 1835: +'+self.document.forms.resinfo.elements.e.checked+'+"':'"
1836: +'+self.document.forms.resinfo.elements.h.value+'+"':res'"
1837: +';opener.infoclear();opener.editmode=0;opener.draw();">'
1.39 www 1838: +'<b>Save Changes</b></a> '
1.1 www 1839: +' <a href="javascript:self.document.forms.resinfo.reset()">Reset</a>'
1.3 www 1840: +'</td></tr></table>');
1.5 www 1841: if ((data2[3]!='start') && (data2[3]!='finish')) {
1.1 www 1842: inf.document.writeln(
1843: '<a href="javascript:opener.notclear=0;opener.infoclear();'
1844: +'opener.delres('+data1[1]+',0);opener.editmode=0;opener.draw('
1.2 www 1845: +');">Delete Resource (cutting links)</a>');
1.1 www 1846: inf.document.writeln(
1847: '<br><a href="javascript:opener.notclear=0;opener.infoclear();'
1848: +'opener.delres('+data1[1]+',1);opener.editmode=0;opener.draw('
1.2 www 1849: +');">Delete Resource (preserving links)</a>');
1.5 www 1850: }
1851: if (data2[3]!='finish') {
1.1 www 1852: inf.document.writeln(
1853: '<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
1854: +'opener.linkmode='+data1[1]+';'
1855: +'opener.infoclear();">Link Resource</a>');
1.5 www 1856: }
1.14 www 1857: inf.document.writeln(
1858: '<br><a href="javascript:'
1859: +'opener.setparms('+data1[1]+');'
1860: +'opener.infoclear();">Set Parameters</a>');
1861:
1.1 www 1862: }
1863: } else {
1864: linkmode=0;
1.3 www 1865: inf.document.writeln('<b>Link</b><hr><form>');
1.1 www 1866: data2=obj[data1[0]].split('&');
1867: k=data2[data2.length-2];
1868: data3=objlinks[k].split(':');
1869: inf.document.writeln('From <b>'+objcont[data3[0]].split(':')[0]+
1870: '</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
1871: inf.document.writeln('<br><a href="javascript:opener.dellink('+
1872: k+');opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1873: +');">Delete Link</a>');
1874: inf.document.writeln('<br><a href="javascript:'+
1.3 www 1875: "opener.insertreslink('"+infostr+"');"+
1.2 www 1876: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1877: +');">Insert Resource Into Link</a>');
1.1 www 1878: }
1879: }
1880: inf.document.writeln(
1881: '<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
1.39 www 1882: +'opener.infoclear();">Cancel</a>');
1.3 www 1883: inf.document.writeln('</form></td></tr></table></body></html>');
1.1 www 1884: inf.document.close();
1885: inf.focus();
1886: }
1887:
1888: // ----------------------------------------------------- Clicks on empty fields
1889: function empty(rid,k) {
1890: var cid=findcol(k);
1891: var lcol=k-1;
1892: trow=row[rid];
1893: lrow=trow-1;
1894: editmode=1;
1895: notclear=1;
1896: linkmode=0;
1.5 www 1897: infcheck();
1.1 www 1898: inf.document.clear();
1899: inf.document.writeln(
1900: '<html><body bgcolor="#FFFFFF">'+
1.51 matthew 1901: '<table><tr><td width=32><img src="'+raticons+'edit.gif"></td><td bgcolor="#AAFFAA">'+
1.1 www 1902: '<b>Empty Field</b><hr>');
1903:
1904: inf.document.writeln('<br><a href="javascript:opener.newresource('+
1.3 www 1905: rid+','+cid+",'','','false','normal');"+
1906: 'opener.mostrecent=opener.obj.length-1;'+
1907: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1908: +');">Insert resource</a>');
1909:
1.13 www 1910: if ((mostrecent!=0) && (objcont[mostrecent]!='') &&
1.43 harris41 1911: (typeof(objcont[mostrecent])!="undefined")) {
1.3 www 1912:
1913: inf.document.writeln('<br><a href="javascript:opener.newresource('+
1914: rid+','+cid+",'','','false','normal');"+
1915: 'opener.mostrecent=opener.obj.length-1;'+
1916: 'opener.joinres('+mostrecent+',opener.obj.length-1,0);'+
1.1 www 1917: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.3 www 1918: +');">Insert resource linked to from most recent one</a>');
1919:
1920: inf.document.writeln('<br><a href="javascript:opener.newresource('+
1921: rid+','+cid+",'','','false','normal');"+
1922: 'opener.mostrecent=opener.obj.length-1;'+
1923: 'opener.joinres(opener.obj.length-1,'+mostrecent+',0);'+
1924: 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1925: +');">Insert resource linking to most recent one</a>');
1926: }
1927:
1928:
1.1 www 1929: inf.document.writeln('<hr>Insert column:');
1930: inf.document.writeln('<a href="javascript:opener.insertcol('+
1931: lcol+');opener.addobj('+rid+",'e&'+opener.maxcol);"
1932: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1933: +');">left</a>');
1.1 www 1934: inf.document.writeln('<a href="javascript:opener.insertcol('+
1935: k+');opener.addobj('+rid+",'e&'+opener.maxcol);"
1936: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1937: +');">right</a> ');
1.1 www 1938: inf.document.writeln('<br>Insert row:');
1939: inf.document.writeln('<a href="javascript:opener.insertrow('+
1940: trow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
1941: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1942: +');">below</a>');
1.1 www 1943: inf.document.writeln('<a href="javascript:opener.insertrow('+
1944: lrow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
1945: +'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
1.2 www 1946: +');">above</a> ');
1.1 www 1947:
1948:
1949: inf.document.writeln(
1950: '<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
1.39 www 1951: +'opener.infoclear();">Cancel</a>');
1.1 www 1952: inf.document.writeln('</td></tr></table></body></html>');
1953: inf.document.close();
1954: inf.focus();
1955: }
1956:
1957: // ---------------------------------------------------- Save into hidden fields
1958: function save() {
1.3 www 1959: var k;
1960: if (graphdef=='yes') {
1.2 www 1961: parent.server.document.forms.storage.output.value='graphdef<:>yes';
1.6 www 1962: for (k=1;k<obj.length;k++) {
1.2 www 1963: parent.server.document.forms.storage.output.value+=
1.1 www 1964: '<&>obj<:>'+k+'<:>'+obj[k];
1965: }
1966: for (k=0;k<row.length;k++) {
1.2 www 1967: parent.server.document.forms.storage.output.value+=
1.1 www 1968: '<&>row<:>'+k+'<:>'+row[k];
1969: }
1970: for (k=0;k<col.length;k++) {
1.2 www 1971: parent.server.document.forms.storage.output.value+=
1.1 www 1972: '<&>col<:>'+k+'<:>'+col[k];
1973: }
1974: for (k=0;k<rowcont.length;k++) {
1975: if (rowcont[k]) {
1.2 www 1976: parent.server.document.forms.storage.output.value+=
1.1 www 1977: '<&>rowcont<:>'+k+'<:>'+rowcont[k];
1978: }
1979: }
1.2 www 1980: parent.server.document.forms.storage.output.value+=
1.1 www 1981: '<&>maxcol<:>'+maxcol;
1.2 www 1982: parent.server.document.forms.storage.output.value+=
1.1 www 1983: '<&>maxrow<:>'+maxrow;
1.4 www 1984: parent.server.document.forms.storage.output.value+=
1985: '<&>zscale<:>'+zscale;
1986: } else {
1.3 www 1987: parent.server.document.forms.storage.output.value='graphdef<:>no';
1988: }
1989: parent.server.document.forms.storage.output.value+=
1990: '<&>tablemode<:>'+tablemode;
1.37 www 1991:
1992: for (k=0;k<objparms.length;k++) {
1993: if (objparms[k]) {
1994: parent.server.document.forms.storage.output.value+=
1995: '<&>objparms<:>'+k+'<:>'+objparms[k];
1996: }
1997: }
1.1 www 1998: for (k=0;k<objcont.length;k++) {
1999: if (objcont[k]) {
1.2 www 2000: parent.server.document.forms.storage.output.value+=
1.1 www 2001: '<&>objcont<:>'+k+'<:>'+objcont[k];
2002: }
2003: }
2004: for (k=0;k<objlinks.length;k++) {
2005: if (objlinks[k]) {
1.2 www 2006: parent.server.document.forms.storage.output.value+=
1.1 www 2007: '<&>objlinks<:>'+k+'<:>'+objlinks[k];
2008: }
2009: }
1.2 www 2010: undopointer++;
2011: undostack[undopointer]=
2012: parent.server.document.forms.storage.output.value;
1.1 www 2013: }
2014:
2015: // ----------------------------------------------- Reset all layout information
2016: function graphreset() {
2017:
1.4 www 2018: var k;
2019:
2020: for (k=0;k<obj.length;k++) { obj[k]=''; }
1.1 www 2021: obj.length=0;
2022: obj[0]='';
2023:
2024: rowcont.length=0;
2025: rowcont[0]='';
1.4 www 2026:
1.1 www 2027: row.length=0;
2028: row[0]=0;
1.4 www 2029: maxrow=0;
1.1 www 2030:
2031: col.length=0;
2032: colmap.length=0;
2033: maxcol=-1;
2034: insertcol(-1);
1.4 www 2035:
2036: objcont[0]='';
1.11 www 2037: objlinks[0]='';
1.43 harris41 2038: if (((typeof(objcont[1])=="undefined")&&(typeof(objcont[2])=="undefined")) ||
1.9 www 2039: ((objcont[1]=='')&&(objcont[2]==''))) {
2040: objcont[1]='Start::false:start:res'
2041: objcont[2]='Finish::false:finish:res';
2042: }
1.1 www 2043: graphdef='no';
2044:
2045: }
2046:
2047: // --------------------- Compare two resources with each other for "straighten"
2048: function rescompare(a,b) {
2049: data1=a.split(':');
2050: data2=b.split(':');
2051: var rvalue=0;
2052: var k;
2053: for (k=1;k<data1.length;k++) {
2054: if (data1[k]==data2[0]) { rvalue--; }
2055: }
1.54 www 2056: for (k=1;k<data2.length;k++) {
1.1 www 2057: if (data2[k]==data1[0]) { rvalue++; }
2058: }
2059: if (rvalue==0) { rvalue=data2.length-data1.length; }
2060: return rvalue;
2061: }
2062:
1.2 www 2063: // -------------------------------------------- Draw the table instead of graph
2064: function tabledraw() {
1.3 www 2065: var objsorted=new Array();
2066: var robjs=new Array();
1.4 www 2067: var iobjs=new Array();
1.3 www 2068: var k;
2069: var i;
2070: var j;
2071: var nr;
1.4 www 2072: var ck;
2073: var cck;
2074: var condid;
1.38 www 2075: var url='';
2076: var mime='';
1.41 www 2077: var ext='';
1.38 www 2078: var urlparts=new Array;
1.3 www 2079: var sortstr=sortobjs();
1.5 www 2080: insrestab(1,-1,-1,'');
1.43 harris41 2081: if ((sortstr!='') && (typeof(sortstr)!="undefined")) {
1.3 www 2082: objsorted=sortstr.split('&');
2083: for (k=0;k<objsorted.length;k++) {
1.4 www 2084: i=(objsorted[k].split(':'))[0];
2085: iobjs[k]=i;
2086: robjs[i]=k;
1.3 www 2087: }
1.4 www 2088: for (k=0;k<iobjs.length;k++) {
2089: i=iobjs[k];
1.3 www 2090: if (k<objsorted.length-1) {
1.4 www 2091: nr=iobjs[k+1];
1.3 www 2092: } else {
2093: nr=-1;
2094: }
2095: data1=objcont[i].split(':');
1.4 www 2096: ck=rescolor(data1[2],data1[3]);
1.38 www 2097: parent.mapout.document.write('<tr><td bgcolor="'+ck+'">');
2098: url=data1[1];
1.41 www 2099: ext=data1[2];
1.38 www 2100: urlparts=url.split('.');
2101: mime=urlparts[urlparts.length-1];
1.43 harris41 2102: if (typeof(mime)=="undefined") { mime=''; }
1.41 www 2103: if ((mime!='') && (ext!='true')) {
1.38 www 2104: parent.mapout.document.write
1.39 www 2105: ('<a target="preview" align="right" href="'+url+'.meta'+
2106: '"><img src="'+iconpath+'meta.gif"></a><p>'+
2107: '<a target="preview" align="right"href="'+url+
1.38 www 2108: '"><img src="'+iconpath+mime+'.gif"></a><p>');
2109: }
2110: parent.mapout.document.write(
2111: '<b><a href="javascript:if (parent.code.linkmode!=0) { '
1.4 www 2112: +'parent.code.joinres(parent.code.linkmode,'+i+',0);'
2113: +'parent.code.linkmode=0;parent.code.editmode=0;'
2114: +'parent.code.notclear=0;parent.code.infoclear();'
2115: +'parent.code.draw(); }">'+k+'</a></b></td><td bgcolor="'+ck
1.3 www 2116: +'"><form name=r'+i+' method=post>');
2117: data2=obj[i].split('&');
2118: parent.mapout.document.write('<table bgcolor="#CCCCCC">');
1.38 www 2119:
1.5 www 2120: if (data1[3]=='start') {
2121: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
2122: }
2123: if (data1[3]=='finish') {
2124: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
2125: }
1.3 www 2126: parent.mapout.document.write(
1.4 www 2127: '<tr><td>Title:</td><td><input type=text name=t size=50 value="'
1.5 www 2128: +data1[0]+'"><input type=hidden name=h value='+data1[3]
2129: +'></td></tr>');
1.3 www 2130: parent.mapout.document.write(
1.4 www 2131: '<tr><td>URL:</td><td><input type=text name=u size=50 value="'
1.3 www 2132: +data1[1]+'"></td></tr>'
2133: +'<tr><td>External:</td><td><input type=checkbox name=e');
2134: if (data1[2]=='true') { parent.mapout.document.write(' checked'); }
1.38 www 2135: parent.mapout.document.write('></td></tr>');
2136: if ((data1[3]!='start') && (data1[3]!='finish')) {
2137: parent.mapout.document.write(
2138: '<tr><td colspan=2><input type=radio name=y value=normal '+
1.3 www 2139: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
2140: "'normal'"+'"');
2141: if (data1[3]=='normal') { parent.mapout.document.write(' checked'); }
2142: parent.mapout.document.write(
2143: '> Regular <input type=radio name=y value=mandatory '+
2144: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
2145: "'mandatory'"+'"');
2146: if (data1[3]=='mandatory') { parent.mapout.document.write(' checked'); }
2147: parent.mapout.document.write(
2148: '> Mandatory <input type=radio name=y value=optional '+
2149: 'onClick="parent.mapout.document.forms.r'+i+'.elements.h.value='+
2150: "'optional'"+'"');
2151: if (data1[3]=='optional') { parent.mapout.document.write(' checked'); }
1.5 www 2152: parent.mapout.document.write('> Optional</td></tr>');
1.38 www 2153: }
1.5 www 2154: parent.mapout.document.write(
2155: '<tr><td colspan=2><a href="javascript:parent.code.objcont['+i
1.3 www 2156: +']=parent.code.escape(parent.mapout.document.forms.r'+i
2157: +'.elements.t.value)+'+"':'"
2158: +'+parent.code.escape(parent.mapout.document.forms.r'+i
2159: +'.elements.u.value)+'+"':'"
2160: +'+parent.mapout.document.forms.r'+i+'.elements.e.checked+'+"':'"
2161: +'+parent.mapout.document.forms.r'+i+'.elements.h.value+'+"':res'"
2162: +';parent.code.draw();">'
1.39 www 2163: +'<b>Save Changes</b></a> '
1.3 www 2164: +' <a href="javascript:parent.mapout.document.forms.r'+i
1.5 www 2165: +'.reset()">Reset</a></td></tr><tr><td colspan=2>');
2166: if ((data1[3]!='start') && (data1[3]!='finish')) {
2167: parent.mapout.document.writeln(
2168: '<A href="javascript:parent.code.notclear=0;parent.code.infoclear();'
1.4 www 2169: +'parent.code.delres('+i+',0);parent.code.editmode=0;parent.code.draw();">'
2170: +'Delete Resource (cutting links)</A><br>'
2171: +'<A href="javascript:parent.code.notclear=0;parent.code.infoclear();'
2172: +'parent.code.delres('+i+',1);parent.code.editmode=0;parent.code.draw();">'
1.5 www 2173: +'Delete Resource (preserving links)</A><br>');
2174: }
2175: if (data1[3]!='finish') {
2176: parent.mapout.document.writeln(
2177: '<a href="javascript:parent.code.linkmode='+i+
1.4 www 2178: ';parent.code.notclear=0;parent.code.infoclear();">'+
1.14 www 2179: 'Link resource</a>');
1.5 www 2180: }
1.14 www 2181: parent.mapout.document.writeln(
2182: '<br><a href="javascript:'
2183: +'parent.code.setparms('+i+');">Set Parameters</a>');
2184:
2185: parent.mapout.document.writeln('</td></tr>');
1.4 www 2186: parent.mapout.document.writeln('<tr><td colspan=2><table><tr>');
1.3 www 2187: for (j=2;j<data2.length;j++) {
1.4 www 2188: data4=data2[j].split(':');
2189: data3=objlinks[data4[2]].split(':');
1.3 www 2190: if (data3.length>1) {
2191: if (data3[1]==nr) {
1.4 www 2192: cck='#AAAAAA';
2193: if (data3[2]!=0) {
2194: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2195: condid=data3[2];
2196: } else {
2197: condid='-';
2198: }
2199: parent.mapout.document.writeln(
2200: '<td bgcolor='+cck+'>Next<br>');
2201: parent.mapout.document.writeln(
2202: '<a href="javascript:parent.code.handler('+
2203: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
2204: +'">Edit</a>');
1.3 www 2205: parent.mapout.document.writeln('</td>');
2206: }
2207: }
2208: }
2209: for (j=2;j<data2.length;j++) {
1.4 www 2210: data4=data2[j].split(':');
2211: data3=objlinks[data4[2]].split(':');
1.3 www 2212: if (data3.length>1) {
2213: if ((data3[1]!=nr) && (data3[1]!=0)) {
1.4 www 2214: cck='#AAAAAA';
2215: if (data3[2]!=0) {
2216: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2217: condid=data3[2];
2218: } else {
2219: condid='-';
2220: }
1.3 www 2221: parent.mapout.document.writeln(
1.4 www 2222: '<td bgcolor='+cck+'>To: '+robjs[data3[1]]+'<br>');
2223: parent.mapout.document.writeln(
2224: '<a href="javascript:parent.code.handler('+
2225: "'c&"+data4[0]+'&'+i+'&'+data4[2]+'&'+condid+"');"
2226: +'">Edit</a>');
1.3 www 2227: parent.mapout.document.writeln('</td>');
2228: }
2229: }
2230: }
2231: parent.mapout.document.writeln(
1.4 www 2232: '</tr></table></td></tr></table></form>');
1.5 www 2233: insrestab(rrow[data2[1]],i,nr,data1[3]);
1.4 www 2234:
1.3 www 2235: }
2236: }
2237: }
2238:
1.4 www 2239: // ----------------------------------------------------- Insert Resource Output
1.5 www 2240: function insrestab(irow,be,af,typ) {
1.4 www 2241: parent.mapout.document.writeln('<tr><td colspan=2>'+
2242: '<table><tr><td><a href="javascript:parent.code.insertrow('
2243: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[1]
2244: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
2245: +'parent.code.draw();">'
2246: +'Insert resource</a></td><td>');
1.5 www 2247: if ((be!=-1) && (typ!='finish')) {
1.4 www 2248: parent.mapout.document.writeln(
2249: '<a href="javascript:parent.code.insertrow('
2250: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2251: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1.15 www 2252: +"parent.code.save();"
1.4 www 2253: +'parent.code.joinres('+be+',parent.code.mostrecent,0);'
2254: +'parent.code.draw();">'
2255: +'Insert resource linked to from above</a><br>');
2256: }
1.5 www 2257: if ((be!=-1) && (af!=-1) && (typ!='finish')) {
1.4 www 2258: parent.mapout.document.writeln(
2259: '<a href="javascript:parent.code.insertrow('
2260: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2261: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1.15 www 2262: +"parent.code.save();"
1.4 www 2263: +'parent.code.joinres('+be+',parent.code.mostrecent,0);'
1.15 www 2264: +"parent.code.save();"
1.4 www 2265: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
2266: +'parent.code.draw();">'
2267: +'Insert resource linked to from above and linking to below</a><br>');
2268: }
2269: if (af!=-1) {
2270: parent.mapout.document.writeln(
2271: '<a href="javascript:parent.code.insertrow('
2272: +irow+');parent.code.newresource(parent.code.maxrow,'+rcol[0]
2273: +",'','','false','normal');parent.code.mostrecent=parent.code.obj.length-1;"
1.15 www 2274: +"parent.code.save();"
1.4 www 2275: +'parent.code.joinres(parent.code.mostrecent,'+af+',0);'
2276: +'parent.code.draw();">'
2277: +'Insert resource linking to below</a><br>');
2278: }
2279: parent.mapout.document.writeln('</td></tr></table></tr>');
2280: }
1.49 matthew 2281:
1.4 www 2282: // ---------------------------------------- Draw simple table instead of graph
2283: function simpletabledraw() {
2284: var objsorted=new Array();
2285: var robjs=new Array();
2286: var iobjs=new Array();
2287: var k;
2288: var i;
2289: var j;
2290: var nr;
2291: var ck;
2292: var cck;
1.41 www 2293: var mime;
2294: var ext;
2295: var url;
2296: var urlparts=new Array;
1.4 www 2297: var condid;
2298: var sortstr=sortobjs();
1.43 harris41 2299: if ((sortstr!='') && (typeof(sortstr)!="undefined")) {
1.4 www 2300: objsorted=sortstr.split('&');
2301: for (k=0;k<objsorted.length;k++) {
2302: i=(objsorted[k].split(':'))[0];
2303: iobjs[k]=i;
2304: robjs[i]=k;
2305: }
2306: for (k=0;k<iobjs.length;k++) {
2307: i=iobjs[k];
2308: if (k<objsorted.length-1) {
2309: nr=iobjs[k+1];
2310: } else {
2311: nr=-1;
2312: }
2313: data1=objcont[i].split(':');
2314: ck=rescolor(data1[2],data1[3]);
1.38 www 2315: parent.mapout.document.write('<tr><td bgcolor="'+ck+'">');
2316: url=data1[1];
1.41 www 2317: ext=data1[2];
1.38 www 2318: urlparts=url.split('.');
2319: mime=urlparts[urlparts.length-1];
1.43 harris41 2320: if (typeof(mime)=="undefined") { mime=''; }
1.41 www 2321: if ((mime!='') && (ext!='true')) {
1.38 www 2322: parent.mapout.document.write
1.39 www 2323: ('<a target="preview" align="right" href="'+url+'.meta'+
2324: '"><img src="'+iconpath+'meta.gif"></a><p>'+
2325: '<a target="preview" align="right"href="'+url+
1.38 www 2326: '"><img src="'+iconpath+mime+'.gif"></a><p>');
2327: }
2328: parent.mapout.document.write('<b>'+k+'</b></td><td bgcolor="'+ck+'">');
1.4 www 2329: data2=obj[i].split('&');
2330: parent.mapout.document.write('<table>');
1.38 www 2331:
1.5 www 2332: if (data1[3]=='start') {
2333: parent.mapout.document.writeln('<tr><td><b>Start</b></td></tr>');
2334: }
2335: if (data1[3]=='finish') {
2336: parent.mapout.document.writeln('<tr><td><b>Finish</b></td></tr>');
2337: }
1.4 www 2338: parent.mapout.document.write(
2339: '<tr><td>Title:</td><td>'+data1[0]+'</td></tr>');
2340: parent.mapout.document.write(
2341: '<tr><td>URL:</td><td>'+data1[1]+'</td></tr>'
2342: +'<tr><td colspan=2><table><tr>');
2343: for (j=2;j<data2.length;j++) {
2344: data4=data2[j].split(':');
2345: data3=objlinks[data4[2]].split(':');
2346: if (data3.length>1) {
2347: if (data3[1]==nr) {
2348: cck='#AAAAAA';
2349: if (data3[2]!=0) {
2350: cck=condcolor((objcont[data3[2]].split(':'))[1]);
2351: condid=data3[2];
2352: } else {
2353: condid='-';
2354: }
2355: parent.mapout.document.writeln(
2356: '<td bgcolor='+cck+'>Next<br>');
2357: parent.mapout.document.writeln('</td>');
2358: }
2359: }
2360: }
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) && (data3[1]!=0)) {
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+'>To: '+robjs[data3[1]]+'<br>');
2375: parent.mapout.document.writeln('</td>');
2376: }
2377: }
2378: }
2379: parent.mapout.document.writeln('</tr></table></td></tr></table></tr>');
2380: }
2381: } else {
2382: parent.mapout.document.writeln('<tr><td>No Resources</td></tr>');
2383: }
2384: }
2385:
1.3 www 2386: // ---------------------------------- Sort objects to straighten graph or table
2387: function sortobjs() {
1.8 www 2388: message("Sorting Resources: "+funny);
1.2 www 2389: var k;
2390: var ij;
1.3 www 2391: var dol;
2392: var dtl;
1.2 www 2393: var kj;
1.3 www 2394: var sortthis=0;
1.2 www 2395: var objsort=new Array();
2396: for (k=1;k<objcont.length;k++) {
2397: if (objcont[k]) {
2398: data1=objcont[k].split(':');
2399: if (data1[data1.length-1]=='res') {
2400: objsort[objsort.length]=''+k;
2401: }
2402: }
2403: }
1.3 www 2404: if (objsort.length==0) { return ''; }
1.2 www 2405: for (k=1;k<objlinks.length;k++) {
1.8 www 2406: wheelswitch();
2407: message("Sorting Resources: "+funny);
1.43 harris41 2408: if ((typeof(objlinks[k])!="undefined") && (objlinks[k]!='')) {
1.3 www 2409: sortthis=1;
1.2 www 2410: data1=objlinks[k].split(':');
2411: kj=-1;
2412: for (j=0;j<objsort.length;j++) {
2413: if ((objsort[j].split(':'))[0]==data1[0]) {
2414: kj=j;
2415: }
2416: }
1.8 www 2417: if (kj!=-1) { objsort[kj]+=':'+data1[1]; }
1.3 www 2418: }
1.2 www 2419: }
1.3 www 2420: if (sortthis!=0) {
2421: for (k=0;k<objsort.length;k++) {
1.8 www 2422: wheelswitch();
2423: message("Sorting Resources: "+funny);
1.3 www 2424: for (j=0;j<objsort.length;j++) {
2425: if (k!=j) {
2426: data1=objsort[k].split(':');
2427: data2=objsort[j].split(':');
2428: dol=data1.length;
2429: dtl=data2.length;
1.55 www 2430: if (dol+dtl<200) {
1.8 www 2431: for (kj=1;kj<dol;kj++) {
1.3 www 2432: if (data1[kj]==data2[0]) {
2433: for (ij=1;ij<dtl;ij++) {
2434: data1[data1.length]=data2[ij];
2435: }
2436: }
1.8 www 2437: }
2438: for (kj=1;kj<dtl;kj++) {
1.3 www 2439: if (data2[kj]==data1[0]) {
2440: for (ij=1;ij<dol;ij++) {
1.8 www 2441: data2[data2.length]=data1[ij];
2442: }
2443: }
2444: }
2445: objsort[k]=data1.join(':');
2446: objsort[j]=data2.join(':');
1.3 www 2447: }
2448: }
2449: }
1.2 www 2450: }
1.8 www 2451: message("Sorting Resources: finishing up.");
1.3 www 2452: return objsort.sort(rescompare).join('&');
2453: } else {
2454: return objsort.join('&');
2455: }
1.2 www 2456: }
2457:
1.3 www 2458: // ----------------------------------------------------------- Straighten graph
1.1 www 2459: function graphopt() {
1.3 www 2460: var k;
2461: var kj;
2462: var ij;
2463: var objsorted=new Array();
2464: condense();
2465: graphreset();
2466: objsorted=(sortobjs()).split('&');
2467: if (objsorted.length==0) { return; }
2468: message("Creating Optimized Graph");
1.1 www 2469: var thisnewobj=''+(objsorted[0].split(':'))[0];
2470: rowcont[1]=thisnewobj;
2471: var thiscolmax=1;
2472: obj[thisnewobj]='b&1&'+thiscolmax+':0:0:0';
2473: var allcolmax=0;
2474: for (k=1;k<objsorted.length;k++) {
2475: thisnewobj=(objsorted[k].split(':'))[0];
2476: if (rescompare(objsorted[k-1],objsorted[k])==0) {
2477: rowcont[rowcont.length-1]+=':'+thisnewobj;
2478: thiscolmax++;
2479: } else {
2480: rowcont[rowcont.length]=thisnewobj;
2481: thiscolmax=1;
2482: }
2483: kj=rowcont.length-1;
1.5 www 2484: obj[thisnewobj]='b&'+kj+'&'+thiscolmax+':0:0:0';
2485: if (thiscolmax>allcolmax) { allcolmax=thiscolmax; }
1.1 www 2486: }
2487: for (k=0;k<obj.length;k++) {
2488: if (!obj[k]) { obj[k]=''; }
2489: }
2490: for (k=0;k<=allcolmax;k++) { insertcol(0); }
2491: for (k=0;k<rowcont.length;k++) {
2492: row[k]=k;
2493: }
2494: maxrow=rowcont.length-1;
2495: var oldlinks=new Array();
1.11 www 2496: for (k=0;k<objlinks.length;k++) {
2497: oldlinks[k]=objlinks[k];
2498: objlinks[k]='';
2499: }
1.1 www 2500: objlinks.length=0;
2501: objlinks[0]='';
1.11 www 2502: graphdef='yes';
2503: save();
2504:
1.1 www 2505: for (k=0;k<objsorted.length;k++) {
1.11 www 2506: wheelswitch();
2507: message("Connecting Resources: "+funny);
2508: kj=(objsorted[k].split(':'))[0];
1.1 www 2509: for (ij=1;ij<oldlinks.length;ij++) {
2510: if (oldlinks[ij]) {
2511: data1=oldlinks[ij].split(':');
2512: if (data1[0]==kj) {
2513: joinres(data1[0],data1[1],data1[2]);
1.11 www 2514: save();
1.1 www 2515: }
2516: }
2517: }
2518: }
2519: }
2520:
2521: // ----------------------------------------------------------- Remove e-objects
2522: function condense() {
1.3 www 2523: message("Condensing");
1.1 www 2524: var j;
2525: for (j=0;j<=maxrow;j++) {
1.43 harris41 2526: if ((rowcont[j]!='') && (typeof(rowcont[j])!="undefined")) {
1.1 www 2527: data1=rowcont[j].split(':');
2528: rowcont[j]='';
2529: for (k=0;k<data1.length;k++) {
2530: if (obj[data1[k]].substring(0,2)!='e&') {
1.43 harris41 2531: if ((rowcont[j]!='') && (typeof(rowcont[j])!="undefined")) {
1.13 www 2532: rowcont[j]+=':';
2533: }
1.1 www 2534: rowcont[j]+=data1[k];
2535: }
2536: }
2537: }
2538: }
2539: }
2540:
2541: // ---------------------------------------------------- Load from hidden fields
2542: function load() {
1.4 www 2543: message("Loading");
1.8 www 2544: schedule('load');
2545: }
2546:
2547: function finishload() {
1.4 www 2548: var k;
2549: for (k=0;k<objcont.length;k++) { objcont[k]=''; }
1.1 www 2550: objcont.length=0;
1.4 www 2551: for (k=0;k<objlinks.length;k++) { objlinks[k]=''; }
1.1 www 2552: objlinks.length=0;
2553: objlinks[0]='';
2554: objcont[0]='';
2555: editmode=0;
2556: notclear=0;
2557: lastinfo='';
2558: graphreset();
1.2 www 2559: var inputstr=parent.server.document.forms.storage.output.value;
1.43 harris41 2560: if ((inputstr!='') && (typeof(inputstr)!="undefined")) {
1.1 www 2561: data1=inputstr.split('<&>');
2562: var k;
2563: for (k=0;k<data1.length;k++) {
1.41 www 2564: data2=data1[k].split(':').join(':').split('<:>');
1.1 www 2565: if (data2[0]=='graphdef') { graphdef=data2[1]; }
2566: if (data2[0]=='maxcol') { maxcol=1*data2[1]; }
2567: if (data2[0]=='maxrow') { maxrow=1*data2[1]; }
2568: if (data2[0]=='obj') { obj[data2[1]]=data2[2]; }
2569: if (data2[0]=='objcont') { objcont[data2[1]]=data2[2]; }
2570: if (data2[0]=='objlinks') { objlinks[data2[1]]=data2[2]; }
1.36 www 2571: if (data2[0]=='objparms') {
1.43 harris41 2572: if (typeof(objparms[data2[1]])=="undefined") {
1.37 www 2573: objparms[data2[1]]=data2[2];
1.36 www 2574: } else {
1.37 www 2575: objparms[data2[1]]+=':'+data2[2];
1.36 www 2576: }
2577: }
1.1 www 2578: if (data2[0]=='rowcont') { rowcont[data2[1]]=data2[2]; }
2579: if (data2[0]=='row') { row[data2[1]]=1*data2[2]; }
2580: if (data2[0]=='col') { col[data2[1]]=1*data2[2]; }
1.6 www 2581: if (data2[0]=='mode') { mode=data2[1]; }
1.3 www 2582: if (data2[0]=='tablemode') { tablemode=1*data2[1]; }
1.4 www 2583: if (data2[0]=='zscale') { zscale=1*data2[1]; }
1.1 www 2584: }
1.9 www 2585: }
2586: if (graphdef=='yes') {
2587: for (k=1;k<=maxrow;k++) {
1.43 harris41 2588: if (typeof(rowcont[k])=="undefined") { rowcont[k]=''; }
1.9 www 2589: }
1.3 www 2590: }
1.1 www 2591: }
2592:
1.14 www 2593: // -------------------------------------------------------------- Parameter set
2594: function setparms(resid) {
1.34 www 2595: var options="scrollbars=1,resizable=1,menubar=0";
2596: parmflag=1;
2597: data1=objcont[resid].split(':');
1.35 www 2598: parm=open("/adm/ratparms?url="+data1[1]+"&parms="+objparms[resid]+
2599: "&resid="+resid,"parmout",options);
1.34 www 2600: parm.focus();
1.14 www 2601: }
2602:
1.2 www 2603: // -------------------------------------------------------------- Undo function
2604: function undo() {
2605: if (undopointer>1) {
2606: undopointer--;
2607: parent.server.document.forms.storage.output.value
2608: =undostack[undopointer];
1.8 www 2609: finishload();
1.2 www 2610: undopointer--;
2611: draw();
2612: stored=0;
2613: } else {
2614: alert("Cannot undo: reached beginning of edit session");
2615: }
2616: }
2617:
2618: // -------------------------------------------------------------- Redo function
2619: function redo() {
2620: if (undopointer<undostack.length-1) {
2621: undopointer++;
2622: parent.server.document.forms.storage.output.value
2623: =undostack[undopointer];
1.8 www 2624: finishload();
1.2 www 2625: undopointer--;
2626: draw();
2627: stored=0;
2628: } else {
2629: alert("Cannot redo: reached end of edit session");
2630: }
2631: }
2632:
2633: // ------------------------------------------------------------ Revert function
2634: function revert() {
2635: if (confirm("Revert to beginning of edit session?")) {
2636: undopointer=2;
2637: undo();
2638: }
2639: }
2640:
1.8 www 2641: // ---------------------------------------------------------------- Wheelswitch
2642: function wheelswitch() {
2643: if (funny=='|') {
2644: funny='/';
2645: } else {
2646: if (funny=='/') {
2647: funny='-';
2648: } else {
2649: if (funny=='-') {
2650: funny='\\';
2651: } else {
2652: if (funny=='\\') { funny='|'; }
2653: }
2654: }
2655: }
2656: }
2657:
2658: // --------------------------------------------- Checks if server frame defined
2659: function checkdef() {
1.30 harris41 2660: if (parent.flag==1) {
2661: srvloaded();
1.8 www 2662: }
2663: if ((finishdone==0) && (tim==0)) { setTimeout('checkdef()',100); }
2664: }
2665:
2666: // ---------------------------------------------------------- The wait function
2667: function wait() {
2668: if ((finishdone==1) || (tim==1)) {
2669: if (tim==0) {
2670: clearTimeout(canceltim);
2671: if (reqaction=='save') { finishsave(); }
2672: if (reqaction=='load') { finishload(); draw(); }
2673: } else {
2674: alert("Server Communication Timed Out.");
2675: }
2676: } else {
2677: wheelswitch();
2678: message('Waiting for server reply: '+funny);
2679: setTimeout('wait();',100);
2680: }
2681: }
2682:
2683: // ---------------------------------------------------------- Schedule function
2684: function schedule(action) {
2685: reqaction=action;
2686: tim=0;
2687: finishdone=0;
1.31 www 2688: canceltim=setTimeout('tim=1;',20000);
2689: checkdef();
1.8 www 2690: wait();
2691: }
2692:
1.32 harris41 2693: // ----------------------------------------------------- launch indexer browser
1.33 harris41 2694: function groupsearch() {
1.46 harris41 2695: srchcheck('groupsearch');
1.32 harris41 2696: }
2697:
2698: function groupimport() {
1.33 harris41 2699: idxcheck('groupimport');
1.32 harris41 2700: }
2701:
1.56 www 2702: function groupcopy() {
2703: copydxcheck('groupsec');
2704: }
2705:
1.2 www 2706: // -------------------------------------------------------------- Store changes
2707: function storechange() {
1.8 www 2708: var k;
1.31 www 2709: parent.flag=0;
1.2 www 2710: parent.server.document.forms.storage.submit();
1.8 www 2711: schedule('save');
2712: }
2713:
2714: function finishsave() {
2715: finishload();
1.7 www 2716: draw();
1.2 www 2717: stored=1;
2718: }
2719:
1.8 www 2720: // --------------------------------------- Gets called when submission finished
2721: function srvloaded() {
2722: finishdone=1;
2723: message("Server replied.");
2724: }
2725:
1.2 www 2726: // ---------------------------------------------------------------- Toggle Mode
2727: function togglemode() {
1.4 www 2728: if (tablemode==0) {
2729: tablemode=1;
2730: } else {
2731: if (tablemode==1) {
2732: tablemode=2;
2733: } else {
2734: tablemode=0;
2735: }
2736: }
2737: notclear=0;
2738: infoclear();
1.2 www 2739: draw();
2740: }
2741:
1.1 www 2742: // -------------------------------------------------------- Main program onLoad
2743: function main() {
2744: if (mainrun==0) {
1.5 www 2745: infopen();
2746: infoclear();
1.1 www 2747: load();
1.2 www 2748: stored=1;
1.1 www 2749: mainrun=1;
2750: }
2751: }
2752:
1.14 www 2753: // ---------------------------------------------------------- Close the window?
1.2 www 2754: function leave() {
1.5 www 2755: if (!inf.closed) {
2756: inf.close();
1.17 harris41 2757: }
1.24 harris41 2758: if (srch && !srch.closed) {
1.22 harris41 2759: srchclose();
1.2 www 2760: }
1.32 harris41 2761: if (idx && !idx.closed) {
1.56 www 2762: idxclose();
2763: }
2764: if (copydx && !copydx.closed) {
2765: copydxclose();
1.32 harris41 2766: }
1.2 www 2767: }
2768:
1.1 www 2769: </script>
2770: </head>
2771:
1.43 harris41 2772: <body bgcolor="#FFFFFF" onUnload="leave();">
1.42 ng 2773: <table border=0><tr><td bgcolor="#aaaaaa">
2774: <table border=0><tr>
2775: <td bgcolor="#ffffcc"><a href="javascript:togglemode();"><b>T</b>oggle display</a> </td>
2776: <td bgcolor="#ffffcc"><a href="javascript:if (zscale>1) { zscale--; draw();}"><b>Z</b>oom out</a> </td>
2777: <td bgcolor="#ffffcc"><a href="javascript:if (zscale<3) { zscale++; draw();}"><b>Z</b>oom in</a> </td>
2778: <td bgcolor="#ffffcc"><a href="javascript:condense();draw();"><b>C</b>ondense</a> </td>
2779: <td bgcolor="#ffffcc"><a href="javascript:graphopt();draw();"><b>S</b>traighten</a> </td>
2780: <td bgcolor="#ffffcc"><a href="javascript:revert();"><b>R</b>evert</a> </td>
2781: <td bgcolor="#ffffcc"><a href="javascript:undo();"><b>U</b>ndo</a> </td>
2782: <td bgcolor="#ffffcc"><a href="javascript:redo();"><b>R</b>edo</a> </td>
2783: <td bgcolor="#ffffcc"><a href="javascript:groupsearch();"><b>G</b>roup search</a> </td>
2784: <td bgcolor="#ffffcc"><a href="javascript:groupimport();"><b>G</b>roup import</a> </td>
1.56 www 2785: <td bgcolor="#ffffcc"><a href="javascript:groupcopy();"><b>G</b>roup copy</a> </td>
1.52 www 2786: <td bgcolor="#ffffcc"><a href="javascript:graphdef='no';save();storechange();"><b>S</b>ave map</a> </td>
2787: <td bgcolor="#ccffcc"><a href="javascript:storechange();"><b>S</b>ave map and layout</a> </td>
1.42 ng 2788: </tr></table>
2789: </td></tr></table>
1.43 harris41 2790: <script>
2791: main();
2792: </script>
1.1 www 2793: </body>
1.2 www 2794: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>