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