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