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