<html>
<!--
The LearningOnline Network
Resource Assembly Tool
7/23,7/24,7/26,
8/11,8/14,8/18,8/19,8/20,8/21,8/22,8/25,8/26,8/28,8/30,8/31,
9/1,9/2,9/4,9/5,9/6,
1/7,1/8,1/10,1/14,1/15,1/16,1/21,1/22,1/29,1/30,1/31,
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,
5/2,5/3,5/4 Gerd Kortemeyer with Scott Harrison
-->
<head>
<script language="JavaScript">
var row=new Array();
var maxrow=-1;
var col=new Array();
var maxcol=-1;
var colmap=new Array();
var colmap2=new Array();
var colmap3=new Array();
var colmap4=new Array();
var colmap5=new Array();
var colmap6=new Array();
var obj=new Array();
var objcont=new Array();
var objlinks=new Array();
var rowcont=new Array();
var rowtype=new Array();
var coltype=new Array();
var rcol=new Array();
var rrow=new Array();
var cw=new Array();
var rh=new Array();
var undostack=new Array();
var undopointer=0;
var stored=0;
var editmode=0;
var notclear=0;
var linkmode=0;
var lastinfo='';
var graphdef='no';
var mainrun=0;
var tablemode=0;
var data1=new Array(1024);
var data2=new Array(1024);
var data3=new Array(1024);
var data4=new Array(1024);
var data5=new Array(1024);
// ------------------------------------------------ Insert a row into the table
function insertrow(j,ex1,ex2) {
var kj;
stored=0;
objects1='';
objects2='';
for (kj=0;kj<=maxrow;kj++) {
if ( row[kj]==j ) { objects1=rowcont[kj]; }
if ( row[kj]==j+1 ) { objects2=rowcont[kj]; }
if ( row[kj]>j ) { row[kj]++; }
}
maxrow++;
row[maxrow]=j+1;
rowcont[maxrow]=':';
colcover=':'+ex1+':'+ex2+':';
objects=objects1+':'+objects2;
data1=objects.split(':');
for (kj=0;kj<data1.length;kj++) {
if (data1[kj]!='') {
thisisobj=obj[data1[kj]];
thisobjtype=thisisobj.split('&')[0];
if (thisobjtype=='v') {
if (rowcont[maxrow].indexOf(':'+data1[kj]+':',0)==-1) {
thisobjcol=thisisobj.split('&')[1];
if (colcover.indexOf(':'+thisobjcol+':',0)==-1) {
colcover+=thisobjcol+':';
rowcont[maxrow]+=data1[kj]+':';
}
}
}
if (thisobjtype=='h') {
updown=thisisobj.split('&')[4];
leftupdown=updown.split(':')[0];
rightupdown=updown.split(':')[1];
thisobjdest=thisisobj.split('&')[3];
thisobjtofrom=thisisobj.split('&')[2];
thisobjfrom=thisobjtofrom.split(':')[0];
thisobjto=thisobjtofrom.split(':')[1];
thisobjdir=col[thisobjto]-col[thisobjfrom];
thisobjrow=row[thisisobj.split('&')[1]];
topbottom=thisobjrow-j-1;
newobj='';
if (leftupdown==-1) {
if (topbottom<0) {
if (thisobjdir<0) {
newobj='v&'+thisobjto+'&'+thisobjdest+'&-1';
} else {
newobj='v&'+thisobjfrom+'&'+thisobjdest+'&1';
}
}
} else {
if (topbottom>0) {
if (thisobjdir<0) {
newobj='v&'+thisobjto+'&'+thisobjdest+'&1';
} else {
newobj='v&'+thisobjfrom+'&'+thisobjdest+'&-1';
}
}
}
if (newobj!='') {
thisobjcol=newobj.split('&')[1];
if (colcover.indexOf(':'+thisobjcol+':',0)==-1) {
colcover+=thisobjcol+':';
rowcont[maxrow]+=obj.length+':';
obj[obj.length]=newobj;
}
}
newobj='';
if (rightupdown==-1) {
if (topbottom<0) {
if (thisobjdir<0) {
newobj='v&'+thisobjfrom+'&'+thisobjdest+'&1';
} else {
newobj='v&'+thisobjto+'&'+thisobjdest+'&-1';
}
}
} else {
if (topbottom>0) {
if (thisobjdir<0) {
newobj='v&'+thisobjfrom+'&'+thisobjdest+'&-1';
} else {
newobj='v&'+thisobjto+'&'+thisobjdest+'&1';
}
}
}
if (newobj!='') {
thisobjcol=newobj.split('&')[1];
if (colcover.indexOf(':'+thisobjcol+':',0)==-1) {
colcover+=thisobjcol+':';
rowcont[maxrow]+=obj.length+':';
obj[obj.length]=newobj;
}
}
}
}
}
if (rowcont[maxrow]!=':') {
rowcont[maxrow]=rowcont[maxrow].substring(1,rowcont[maxrow].length-1);
} else {
rowcont[maxrow]='';
}
}
// --------------------------------------------- Creates a new condition object
function newcondition(content,type) {
var ko;
stored=0;
ko=obj.length;
obj[ko]='c';
objcont[ko]=content+':'+type+':cond';
return ko;
}
// ---------------------------------------------- Creates a new resource object
function newresource(rid,cid,text,url) {
stored=0;
objcont[addobj(rid,'b&'+rid+'&'+cid+':0:0:0')]=text+':'+url+':res';
}
// -------------------------------- Insert a condition into a port of an object
function insertcond(obj1,portnr,cond) {
var k;
stored=0;
data1=obj[obj1].split('&');
for (k=2;k<data1.length;k++) {
data2=data1[k].split(':');
if (data2[0]==portnr) {
data2[3]=cond;
data1[k]=data2.join(':');
}
}
obj[obj1]=data1.join('&');
}
// --------------------------------------------- Insert a column into the table
// Inserts a new table column after table column j
function insertcol(j) {
var kj;
stored=0;
for (kj=0;kj<=maxcol;kj++) {
if ( col[kj]>j ) { col[kj]++; }
}
maxcol++;
col[maxcol]=j+1;
}
// --------------------------------------------------------------- Find the row
function findrow(jid) {
var j;
for (j=0;j<=maxrow;j++) { if (row[j]==jid) { return j; } }
return -1;
}
// --------------------------------------------------------------- Find the col
function findcol(jid) {
var j;
for (j=0;j<=maxcol;j++) { if (col[j]==jid) { return j; } }
return -1;
}
// -------------------------------------------------------------- Map out a row
//
// b&rowID&colID:inObj:outObj:outCond&...
// h&rowID&incolID:outcolID&inObj:outObj&inupdown:outupdown
// v&colID&inObj:outObj&updown
//
// returns middle (col number of middle of obj1)
// sets colmap (map of cols with object numbers)
function maprow (jid,obj1,ign) {
var j; var k; var left; var right; var middle;
middle=-1;
for (j=0;j<=maxcol;j++) { colmap[j]=0; }
if (rowcont[jid]!='') {
data2=rowcont[jid].split(':');
for (j=0;j<data2.length;j++) {
data3=obj[data2[j]].split('&');
if (data3[0]=='b') {
left=maxcol;
right=0;
for (k=2;k<data3.length;k++) {
thiscol=col[data3[k].split(':')[0]];
if (thiscol<left) { left=thiscol; }
if (thiscol>right) { right=thiscol; }
}
}
if (data3[0]=='h') {
data4=data3[2].split(':');
if (col[data4[1]]>col[data4[0]]) {
left=col[data4[0]];
right=col[data4[1]];
} else {
right=col[data4[0]];
left=col[data4[1]];
}
}
if (data3[0]=='v') { left=col[data3[1]]; right=left; }
if (data2[j]==obj1) { middle=Math.round((left+right)/2); }
if ((data3[0]!='h') || (ign!=1)) {
for (k=left;k<=right;k++) { colmap[k]=data2[j]; }
} else {
colmap[left]=data2[j];
colmap[right]=data2[j];
}
}
}
return middle;
}
// --------------------------------------------------------- Find hole in a row
// jid: rowID
// kid: colID, find point close to this
// dkid: destination colID
// returns colID
function comingthru (jid,kid,dkid) {
var k;
maprow(jid,-1,1);
knum=col[kid];
if (colmap[knum]==0) { return kid; }
right=-1;
for (k=knum+1;(k<colmap.length) && (right==-1);k++) {
if ((right==-1) && (colmap[k]!=colmap[knum])) { right=k; }
}
left=-1;
for (k=knum-1;(k>=0) && (left==-1);k--) {
if ((left==-1) && (colmap[k]!=colmap[knum])) { left=k; }
}
kup=-1;
if ((left==-1) && (right==-1)) { right=colmap.length; }
dknum=col[dkid];
dleft=left-dknum;
dright=right-dknum;
if (dleft<0) { dleft=-dleft; }
if (dright<0) { dright=-dright; }
if ((dright<=dleft) && (right!=-1)) { kup=right; }
if ((dright>=dleft) && (left!=-1)) { kup=left; }
if (colmap[kup]==0) { return findcol(kup); }
if (kup==right) { kup--; }
if (kup<0) {
insertcol(-1);
insertcol(0);
} else {
insertcol(kup);
}
return maxcol;
}
// ----------------------------------------------------- Insert port into block
// obj1: object number
// d: direction from middle (>0: right, <0 left)
// inout: in or out port (1: in, 2: out)
// linkobj: object that the link goes to/comes from
// sets inrow or outrow
// return column
function insertport (obj1,d,inout,linkobj) {
var k; var port; var revport;
stored=0;
data1=obj[obj1].split('&');
middle=maprow(data1[1],obj1,0);
if (inout==1) {
inrow=data1[1];
} else {
outrow=data1[1];
}
if (d>0) {
for (k=middle;(colmap[k]==obj1) && (k<colmap.length);k++) { data3[k]=0; }
} else {
for (k=middle;(colmap[k]==obj1) && (k>=0);k--) { data3[k]=0; }
}
for (k=2;k<data1.length;k++) {
data2=data1[k].split(':');
data3[col[data2[0]]]=data2[inout];
}
port=-1;
if (d>0) {
for (k=middle;(colmap[k]==obj1) && (k<colmap.length);k++) {
if ((data3[k]==0) && (colmap[k]==obj1) && (port==-1)) { port=k; }
}
} else {
for (k=middle;(colmap[k]==obj1) && (k>=0);k--) {
if ((data3[k]==0) && (colmap[k]==obj1) && (port==-1)) { port=k; }
}
}
if (port==-1) {
if (colmap[k]==0) {
revport=findcol(k);
if (inout==1) {
data1[data1.length]=revport+":"+linkobj+":0:0";
} else {
data1[data1.length]=revport+":0:"+linkobj+":0";
}
} else {
if (d>0) {
insertcol(k-1);
} else {
insertcol(k);
}
revport=maxcol;
if (inout==1) {
data1[data1.length]=revport+":"+linkobj+":0:0";
} else {
data1[data1.length]=revport+":0:"+linkobj+":0";
}
}
} else {
portfound=-1;
for (k=2;k<data1.length;k++) {
data2=data1[k].split(':');
if (col[data2[0]]==port) {
data2[inout]=linkobj;
data1[k]=data2.join(':');
portfound=1;
}
}
revport=findcol(port);
if (portfound==-1) {
if (inout==1) {
data1[data1.length]=revport+":"+linkobj+":0:0";
} else {
data1[data1.length]=revport+":0:"+linkobj+":0";
}
}
}
obj[obj1]=data1.join('&');
return revport;
}
// ---------------------------- Make a new object and add it to the row content
// returns object number of generated object
function addobj(kjid,objs) {
stored=0;
if (rowcont[kjid]!='') { rowcont[kjid]+=':'; }
rowcont[kjid]+=obj.length;
obj[obj.length]=objs;
return obj.length-1;
}
// ---------------------------------------- Make horizontal connection for hrid
// hoffs=-1: this line goes on top of hrid
function horizontal(hrid,hoffs,hfcol,htcol,hdest,hends) {
hcrid=-1;
if (hoffs==-1) {
hbrid=findrow(row[hrid]-1);
} else {
hbrid=findrow(row[hrid]+1);
}
if (hbrid!=-1) {
maprow(hbrid,-1,0);
hcrid=hbrid;
if (col[hfcol]>col[htcol]) { left=col[htcol]; right=col[hfcol]; }
else { right=col[htcol]; left=col[hfcol]; }
if (colmap[left]!=0) {
hcrid=-1;
} else {
if (colmap[right]!=0) {
hcrid=-1;
} else {
for (kh=left+1;kh<right;kh++) {
if (colmap[kh]!=0) {
if (obj[colmap[kh]].split('&')[0]!='v') { hcrid=-1; }
}
}
}
}
}
if (hcrid==-1) {
insertrow(row[hrid]+hoffs,hfcol,htcol);
addobj(maxrow,'h&'+maxrow+'&'+hfcol+':'+htcol+'&'+hdest+'&'+hends);
} else {
addobj(hcrid,'h&'+hcrid+'&'+hfcol+':'+htcol+'&'+hdest+'&'+hends);
}
}
// --------------------------------------- Deletes all references to object obj
function delobj(obj1) {
var k;
stored=0;
for (k=0;k<rowcont.length;k++) {
data4=rowcont[k].split(':');
rowcont[k]='';
for (k2=0;k2<data4.length;k2++) {
if (data4[k2]!=obj1) {
if (rowcont[k]!='') { rowcont[k]+=':'; }
rowcont[k]+=data4[k2];
}
}
}
}
// --------------------------------------------------------- Garbage collection
function cleanup () {
var j,kj,i;
insertrow(maxrow);
insertcol(maxcol);
addobj(maxrow,'e&'+maxcol);
for (kj=0;kj<=maxcol;kj++) { data1[kj]=0; }
for (kj=0;kj<=maxrow;kj++) {
rowtype[kj]=0;
if (rowcont[kj]!='') {
data2=rowcont[kj].split(':');
for (j=0;j<data2.length;j++) {
if (obj[data2[j]].substring(0,2)=='e&') {
rowtype[kj]=2;
data1[(obj[data2[j]].split('&'))[1]]=2;
}
}
maprow(kj,-1,1);
for (j=0;j<=maxcol;j++) {
if (colmap[j]!=0) {
if (data1[j]==0) { data1[j]=1; }
if (rowtype[kj]==0) {
if (obj[colmap[j]].substring(0,2)!='v&') {
rowtype[kj]=1;
}
}
if (obj[colmap[j]].substring(0,2)=='b&') {
data1[j]=2;
rowtype[kj]=2;
}
}
}
}
}
for (j=0;j<=maxcol;j++) {
coltype[j]=data1[col[j]];
}
}
// -------------------------------------------- Delete a condition from a block
function delcond(obj1,colid) {
var k;
stored=0;
data3=obj[obj1].split('&');
obj[obj1]=data3[0]+'&'+data3[1];
for (k=2;k<data3.length;k++) {
data4=data3[k].split(':');
if (data4[0]==colid) { data4[3]=0; }
if ((data4[1]!=0) || (data4[2]!=0) || (data3.length==3)) {
obj[obj1]+='&'+data4[0]+':'+data4[1]+':'+data4[2]+':'+data4[3];
}
}
}
// ----------------------------------------- Creates a new condition in a block
function crecond(obj1,colid,condtext,condtype) {
var k;
data3=obj[obj1].split('&');
obj[obj1]=data3[0]+'&'+data3[1];
for (k=2;k<data3.length;k++) {
data4=data3[k].split(':');
if (data4[0]==colid) {
data4[3]=newcondition(condtext,condtype);
data2=objlinks[data4[2]].split(':');
objlinks[data4[2]]=data2[0]+':'+data2[1]+':'+data4[3];
}
if ((data4[1]!=0) || (data4[2]!=0) || (data3.length==3)) {
obj[obj1]+='&'+data4[0]+':'+data4[1]+':'+data4[2]+':'+data4[3];
}
}
}
// ---------------------------------------- Delete the path between two objects
// deletes the link linknr
// h&rowID&incolID:outcolID&inObj:outObj&inupdown:outupdown
// v&colID&inObj:outObj&updown
function dellink (linknr) {
var k; var obj1; var obj2;
stored=0;
if (objlinks[linknr]!='') {
data3=objlinks[linknr].split(':');
obj1=data3[0];
obj2=data3[1];
data3=obj[obj1].split('&');
obj[obj1]=data3[0]+'&'+data3[1];
for (k=2;k<data3.length;k++) {
data4=data3[k].split(':');
if (data4[2]==linknr) { data4[2]=0; data4[3]==0; }
if ((data4[1]!=0) || (data4[2]!=0) || (data3.length==3)) {
obj[obj1]+='&'+data4[0]+':'+data4[1]+':'+data4[2]+':'+data4[3];
}
}
data3=obj[obj2].split('&');
obj[obj2]=data3[0]+'&'+data3[1];
for (k=2;k<data3.length;k++) {
data4=data3[k].split(':');
if (data4[1]==linknr) { data4[1]=0; }
if ((data4[1]!=0) || (data4[2]!=0) || (data3.length==3)) {
obj[obj2]+='&'+data4[0]+':'+data4[1]+':'+data4[2]+':'+data4[3];
}
}
for (k=0;k<obj.length;k++) {
if (obj[k]!='') {
data3=obj[k].split('&');
if (((data3[0]=='v') || (data3[0]=='h')) &&
(data3[data3.length-2]==linknr)) {
delobj(k);
}
}
}
objlinks[linknr]='';
}
}
// ----------------------------------------------------------- Join two objects
// Links obj1 with obj2, creates new objlink, marks all elements with number
function joinres (obj1,obj2,cond) {
var k; var kr; var outcol; var incol; var d;
stored=0;
dest=objlinks.length;
objlinks[dest]=obj1+':'+obj2+':'+cond;
data3=obj[obj1].split('&');
sum=0;
for (k=2;k<data3.length;k++) { sum+=col[data3[k].split(':')[0]]; }
outmiddle=sum/(data3.length-2);
data3=obj[obj2].split('&');
sum=0;
for (k=2;k<data3.length;k++) { sum+=col[data3[k].split(':')[0]]; }
inmiddle=sum/(data3.length-2);
d=inmiddle-outmiddle;
outcol=insertport(obj1,d,2,dest);
insertcond(obj1,outcol,cond);
incol=insertport(obj2,-d,1,dest);
if (row[inrow]==(row[outrow]+1)) {
insertrow(row[outrow],-1,-1);
}
if (row[inrow]<row[outrow]) {
updown=1;
tcol=comingthru(inrow,incol,outcol);
horizontal(inrow,-1,tcol,incol,dest,'-1:-1');
addobj(inrow,'v&'+tcol+'&'+dest+'&1');
incol=tcol;
tcol=comingthru(outrow,outcol,incol);
horizontal(outrow,0,outcol,tcol,dest,'1:1');
addobj(outrow,'v&'+tcol+'&'+dest+'&1');
outcol=tcol;
} else {
updown=-1;
}
if (inrow==outrow) {
tcol=comingthru(inrow,incol,outcol);
horizontal(inrow,-1,tcol,incol,dest,'-1:-1');
addobj(inrow,'v&'+tcol+'&'+dest+'&1');
horizontal(outrow,0,outcol,tcol,dest,'1:1');
} else {
if (updown==-1) {
for (kr=row[outrow]+1;kr<row[inrow];kr++) {
rid=findrow(kr);
ncol=comingthru(rid,outcol,incol);
if (ncol!=outcol) {
insertrow(kr-1,outcol,ncol);
kr++;
if (col[outcol]>col[ncol]) {
addobj(maxrow,
'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&-1:1');
} else {
addobj(maxrow,
'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&1:-1');
}
}
addobj(rid,'v&'+ncol+'&'+dest+'&-1');
outcol=ncol;
}
if (incol!=outcol) {
insertrow(row[inrow]-1,outcol,incol);
if (col[outcol]>col[incol]) {
addobj(maxrow,
'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&-1:1');
} else {
addobj(maxrow,
'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&1:-1');
}
}
} else {
for (kr=row[outrow]-1;kr>row[inrow];kr--) {
rid=findrow(kr);
ncol=comingthru(rid,outcol,incol);
if (ncol!=outcol) {
insertrow(kr,outcol,ncol);
if (col[outcol]>col[ncol]) {
addobj(maxrow,
'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&1:-1');
} else {
addobj(maxrow,
'h&'+maxrow+'&'+outcol+':'+ncol+'&'+dest+'&-1:1');
}
}
addobj(rid,'v&'+ncol+'&'+dest+'&1');
outcol=ncol;
}
if (incol!=outcol) {
insertrow(row[inrow],outcol,incol);
if (col[outcol]>col[incol]) {
addobj(maxrow,
'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&1:-1');
} else {
addobj(maxrow,
'h&'+maxrow+'&'+outcol+':'+incol+'&'+dest+'&-1:1');
}
}
}
}
}
// ---------------------------------------------------------- Delete a resource
// Deletes resource obj1
// Reconnects resources going thru this one if recon=1
function delres (obj1,recon) {
var infromobj=new Array();
var inwithcon=new Array();
var inwithlink=new Array();
var outtoobj=new Array();
var outwithcon=new Array();
var outwithlink=new Array();
var inobjs=new Array();
var inobjscond=new Array();
var outobjs=new Array();
var outobjscond=new Array();
var k; var k1; var k2; var found;
stored=0;
data1=obj[obj1].split('&');
for (k=2;k<data1.length;k++) {
data2=data1[k].split(':');
if (data2[1]!=0) {
k2=inwithlink.length;
inwithlink[k2]=data2[1];
data3=objlinks[data2[1]].split(':');
infromobj[k2]=data3[0];
inwithcon[k2]=data3[2];
}
if (data2[2]!=0) {
k2=outwithlink.length;
outwithlink[k2]=data2[2];
data3=objlinks[data2[2]].split(':');
outtoobj[k2]=data3[1];
outwithcon[k2]=data3[2];
}
}
for (k=0;k<inwithlink.length;k++) { dellink(inwithlink[k]); }
for (k=0;k<outwithlink.length;k++) { dellink(outwithlink[k]); }
delobj(obj1);
if (recon==1) {
for (k=0;k<inwithlink.length;k++) {
if (infromobj[k]!=obj1) {
found=0;
for (k2=0;k2<inobjs.length;k2++) {
if (inobjs[k2]==infromobj[k]) {
if (inwithcon[k]!=0) {
if (inobjscond[k2]!='') { inobjscond[k2]+='||'; }
inobjscond[k2]+=
'('+(objcont[inwithcon[k]].split(':'))[0]+')';
}
found=1;
}
}
if (found==0) {
k2=inobjs.length;
inobjs[k2]=infromobj[k];
if (inwithcon[k]==0) {
inobjscond[k2]='';
} else {
inobjscond[k2]=
'('+(objcont[inwithcon[k]].split(':'))[0]+')';
}
}
}
}
for (k=0;k<outwithlink.length;k++) {
if (outtoobj[k]!=obj1) {
found=0;
for (k2=0;k2<outobjs.length;k2++) {
if (outobjs[k2]==outtoobj[k]) {
if (outwithcon[k]!=0) {
if (outobjscond[k2]!='') { outobjscond[k2]+='||'; }
outobjscond[k2]+=
'('+(objcont[outwithcon[k]].split(':'))[0]+')';
}
found=1;
}
}
if (found==0) {
k2=outobjs.length;
outobjs[k2]=outtoobj[k];
if (outwithcon[k]==0) {
outobjscond[k2]='';
} else {
outobjscond[k2]=
'('+(objcont[outwithcon[k]].split(':'))[0]+')';
}
}
}
}
for (k=0;k<inobjs.length;k++) {
cond='';
if (inobjscond[k]!='') { cond='('+inobjscond[k]+')'; }
for (k2=0;k2<outobjs.length;k2++) {
thiscond=cond;
if (outobjscond[k2]!='') {
if (thiscond!='') { thiscond+='&&'; }
thiscond+='('+outobjscond[k2]+')';
}
condnr=0;
if (thiscond!='') { condnr=newcondition(thiscond,'normal'); }
joinres(inobjs[k],outobjs[k2],condnr);
}
}
}
}
// -------------------------------------------------------------- Draw an entry
function drawcell (rtype,ctype,what,cm,obj1,ej,ek,ne) {
var bgcolor;
if (ctype!=0) {
parent.mapout.document.write('<td bgcolor='+cm+' width='+cw[ctype]+'>');
if (what!='') {
if (obj1!='') {
obj1="'"+obj1+"'";
parent.mapout.document.write
('<a href="javascript:parent.code.handler('+obj1
+');" onMouseOver="parent.code.info('+obj1+');">');
}
if (what=='r:') {
parent.mapout.document.write
('<img border=0 src="resource.gif">');
} else {
if (what=='c:') {
parent.mapout.document.write
('<img border=0 src="condition.gif">');
} else {
parent.mapout.document.write
('<img border=0 src="'+rtype+'.'+ctype+'.'+what+'.gif">');
}
}
if (obj1!='') {
parent.mapout.document.write('</a>');
}
} else {
if (ne!=1) {
parent.mapout.document.write
('<a href="javascript:parent.code.empty('+ej+','+ek+');" ');
} else {
parent.mapout.document.write
('<a href="javascript:parent.code.infoclear();" ');
}
parent.mapout.document.write
('onMouseOver="parent.code.infoclear();">');
parent.mapout.document.write
('<img border=0 src="'+rtype+'.'+ctype+'.empty.gif"></a>');
}
parent.mapout.document.write('</td>');
}
}
// ----------------------------------------------------------------- Draw a row
function drawrow (jid) {
var j; var jk; var k; var rc; var gc; var bc; var ck;
var objd1=new Array();
var objd2=new Array();
var notempty=new Array();
var condtype;
if (rowtype[jid]!=0) {
for (j=0;j<=maxcol;j++) {
colmap[j]=''; colmap2[j]=''; colmap3[j]=''; colmap4[j]='';
colmap5[j]='#FFFFFF'; colmap6[j]='#FFFFFF';
objd1[j]=''; objd2[j]=''; notempty[j]=0;
}
parent.mapout.document.writeln('<tr height='+rh[rowtype[jid]]+'>');
if (rowcont[jid]!='') {
data2=rowcont[jid].split(':');
for (jk=0;jk<data2.length;jk++) {
data3=obj[data2[jk]].split('&');
if (data3[0]=='b') {
rc=(data2[jk]+'F').substr(0,2);
gc=('9'+data2[jk]).substr(0,2);
bc=(data2[jk]+data2[jk]).substr(0,2);
ck='#'+rc+gc+bc;
left=maxcol;
leftin=maxcol;
leftout=maxcol;
right=0;
rightin=0;
rightout=0;
anyout=0;
for (k=2;k<data3.length;k++) {
data1=data3[k].split(':');
thiscol=col[data1[0]];
if (thiscol<left) { left=thiscol; }
if (thiscol>right) { right=thiscol; }
if (data1[1]!=0) {
if (thiscol<leftin) { leftin=thiscol; }
if (thiscol>rightin) { rightin=thiscol; }
colmap4[thiscol]=data1[1];
}
if (data1[2]!=0) {
if (thiscol<leftout) { anyout=1; leftout=thiscol; }
if (thiscol>rightout) { anyout=1; rightout=thiscol; }
if (data1[3]!=0) {
colmap3[thiscol]='c:';
condtype=(objcont[data1[3]].split(':'))[1];
colmap6[thiscol]='#FFFFAA';
if (condtype=='stop') { colmap6[thiscol]='#FFAAAA'; }
if (condtype=='force') { colmap6[thiscol]='#AAAAFF'; }
objd2[thiscol]='c&'
+data1[0]+'&'+data2[jk]+'&'+data1[2]+'&'+data1[3];
} else {
colmap3[thiscol]='ctd';
colmap6[thiscol]=ck;
objd2[thiscol]='c&'
+data1[0]+'&'+data2[jk]+'&'+data1[2]+'&-';
}
}
}
for (k=left;k<=right;k++) { notempty[k]=1; colmap5[k]=ck; }
middle=Math.round((left+right)/2);
colmap[middle]='r:';
objd1[middle]+='r&'+data2[jk];
if (rightin>middle) {
for (k=middle+1;k<rightin;k++) {
if (colmap4[k]!='') {
colmap[k]='rlt';
} else {
colmap[k]='rl';
}
}
colmap[rightin]='tl';
}
if (leftin<middle) {
for (k=middle-1;k>leftin;k--) {
if (colmap4[k]!='') {
colmap[k]='lrt';
} else {
colmap[k]='lr';
}
}
colmap[leftin]='tr';
}
if ((leftout>middle) && (anyout)) {
colmap2[middle]='tr';
}
if (leftout==middle) {
if (rightout==middle) { colmap2[middle]='td'; }
if (rightout>middle) { colmap2[middle]='rtd'; }
}
if (leftout<middle) {
if (rightout<middle) { colmap2[middle]='tl'; }
if (rightout==middle) { colmap2[middle]='tdl'; }
if (rightout>middle) {
if (colmap3[middle]!='') {
colmap2[middle]='rtdl';
} else {
colmap2[middle]='rtl';
}
}
}
if (leftout<middle) {
for (k=middle-1;k>leftout;k--) {
if (colmap3[k]!='') {
colmap2[k]='rld';
} else {
colmap2[k]='rl';
}
}
colmap2[leftout]='rd';
}
if (rightout>middle) {
for (k=middle+1;k<rightout;k++) {
if (colmap3[k]!='') {
colmap2[k]='lrd';
} else {
colmap2[k]='lr';
}
}
colmap2[rightout]='ld';
}
}
if (data3[0]=='h') {
data4=data3[2].split(':');
if (col[data4[1]]>col[data4[0]]) {
left=col[data4[0]];
right=col[data4[1]];
thisarrow='lr';
} else {
right=col[data4[0]];
left=col[data4[1]];
thisarrow='rl';
}
if (data3[4].split(':')[0]==1) {
colmap[left]='tr';
} else {
colmap[left]='rd'; colmap2[left]='utd'; colmap3[left]='utd';
}
for (k=left+1;k<right;k++) {
if (colmap[k]=='') {
colmap[k]=thisarrow;
objd1[k]=data2[jk];
} else {
colmap[k]='tdrl';
objd1[k]='';
}
}
if (data3[4].split(':')[1]==1) {
colmap[right]='tl';
} else {
colmap[right]='ld'; colmap2[right]='utd'; colmap3[right]='utd';
}
objd1[left]=data2[jk];
objd1[right]=data2[jk];
}
if (data3[0]=='v') {
left=col[data3[1]];
if (colmap[left]=='') {
if (data3[3]==1) { colmap[left]='dt'; } else { colmap[left]='td'; }
objd1[left]=data2[jk];
objd2[left]=objd1[left];
} else {
colmap[left]='tdrl';
objd1[left]='';
}
colmap2[left]='utd'; colmap3[left]='utd';
}
}
rtype=rowtype[jid];
for (k=0;k<=maxcol;k++) {
drawcell(rtype,coltype[rcol[k]],colmap[k],colmap5[k],objd1[k],jid,k,
notempty[k]);
}
if (rowtype[jid]==2) {
parent.mapout.document.writeln('</tr><tr>');
for (k=0;k<=maxcol;k++) {
drawcell(1,coltype[rcol[k]],colmap2[k],colmap5[k],objd2[k],jid,k,1);
}
parent.mapout.document.writeln('</tr><tr>');
for (k=0;k<=maxcol;k++) {
drawcell(1,coltype[rcol[k]],colmap3[k],colmap6[k],objd2[k],jid,k,1);
}
}
}
parent.mapout.document.writeln('</tr>');
}
}
// ------------------------------------------------------------- Draw the table
function draw () {
var k; var kr;
cleanup();
save();
for (k=0;k<=maxrow;k++) { rrow[row[k]]=k; }
for (k=0;k<=maxcol;k++) { rcol[col[k]]=k; }
rh[0]=0;
rh[1]=30;
rh[2]=60;
cw[0]=0;
cw[1]=30;
cw[2]=60;
parent.mapout.document.open('text/html','replace');
parent.mapout.document.writeln('<html><body bgcolor="#FFFFFF">');
parent.mapout.document.writeln(
'<table cellpadding=0 cellspacing=0 border=0>');
if (tablemode==0) {
for (kr=0;kr<=maxrow;kr++) { drawrow(rrow[kr]); }
} else {
tabledraw();
}
parent.mapout.document.writeln('</table>');
parent.mapout.document.writeln('</body></html>');
parent.mapout.document.close();
parent.focus();
parent.mapout.focus();
}
// --------------------------------------------------------- Clears info window
function infoclear() {
if (notclear!=1) {
var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300";
var inf=open("","infout",options);
inf.document.clear();
inf.document.writeln
('<html><body bgcolor="#FFFFFF"><table><tr><td>'+
'<img src="/adm/lonIcons/lonlogos.gif"></td>');
if (linkmode!=0) {
inf.document.writeln(
'<td><b>Link Mode</b><hr>Click on a resource to link it with<br><b>'+
(objcont[linkmode].split(':'))[0]+
'</b><br>click anywhere else to cancel.</td>');
}
inf.document.writeln('</tr></table></body></html>');
inf.document.close();
parent.focus();
parent.mapout.focus();
notclear=1;
lastinfo='';
}
}
// --------------------------------------------------- Prints out resource info
function info(infostr) {
if ((editmode!=1) && (infostr!=lastinfo)) {
notclear=1;
var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300";
var inf=open("","infout",options);
inf.document.clear();
inf.document.writeln(
'<html><body bgcolor="#FFFFFF">'+
'<table><tr><td width=32><img src="info.gif"></td><td bgcolor="#AAFFAA">');
data1=infostr.split('&');
if (data1[0]=='c') {
inf.document.write('<b>Condition (');
data3=objlinks[data1[3]].split(':');
if (data1[4]=='-') {
inf.document.write('not set');
} else {
data2=objcont[data1[4]].split(':');
if (data2[1]=='force') {
inf.document.write('Blocking Other Links');
} else {
if (data2[1]=='stop') {
inf.document.write('Blocking This Link');
} else {
inf.document.write('Recommendation');
}
}
}
inf.document.writeln(')</b><hr>From <b>'+objcont[data3[0]].split(':')[0]+
'</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
} else {
if (data1[0]=='r') {
inf.document.writeln('<b>Resource</b><hr>');
data2=objcont[data1[1]].split(':');
inf.document.writeln('<b>'+data2[0]+'</b><br>');
inf.document.writeln((data2[1].split('/')).join(' / '));
} else {
inf.document.writeln('<b>Link</b><hr>');
data2=obj[data1[0]].split('&');
data3=objlinks[data2[data2.length-2]].split(':');
inf.document.writeln('From <b>'+objcont[data3[0]].split(':')[0]+
'</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
}
}
if (linkmode==0) {
inf.document.writeln('<p>(click to edit)');
} else {
if (data1[0]=='r') {
inf.document.writeln('<p>(click to link)');
} else {
inf.document.writeln('<p>(click to cancel linking and edit)');
}
}
inf.document.writeln('</td></tr></table></body></html>');
inf.document.close();
parent.focus();
parent.mapout.focus();
notclear=0;
lastinfo=infostr;
}
}
// ------------------------------------------------ "Escapes" out special chars
function escape(instring) {
var outstring='';
var thischar;
var k;
for (k=0;k<instring.length;k++) {
thischar=instring.charAt(k);
if (thischar==':') { thischar=':'; }
if (thischar=='"') { thischar='"'; }
if (thischar=="'") { thischar='''; }
if (thischar==',') { thischar=','; }
outstring+=thischar;
}
return outstring;
}
// -------------------------------------------------- Insert resource into link
function insertreslink(infostr) {
alert(infostr);
}
// ---------------------------------------------------- Handles "click to edit"
function handler(infostr) {
var k;
editmode=1;
notclear=1;
var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300";
var inf=open("","infout",options);
inf.document.clear();
inf.document.writeln(
'<html><body bgcolor="#FFFFFF">'+
'<table><tr><td width=32><img src="edit.gif"></td><td bgcolor="#AAFFAA">');
data1=infostr.split('&');
if (data1[0]=='c') {
inf.document.writeln('<b>Condition</b><hr>');
linkmode=0;
if (data1[4]=='-') {
data2[0]=''; data2[1]='normal';
} else {
data2=objcont[data1[4]].split(':');
}
inf.document.writeln(
'<form name=condinfo><textarea name=c cols=40 rows=4>'
+data2[0]+'</textarea><br><input type=radio name=s value=normal '+
'onClick="self.document.forms.condinfo.elements.h.value='+"'normal'"+'"');
if (data2[1]=='normal') { inf.document.write(' checked'); }
inf.document.write(
'> Recommendation if true<br><input type=radio name=s value=stop '+
'onClick="self.document.forms.condinfo.elements.h.value='+"'stop'"+'"');
if (data2[1]=='stop') { inf.document.write(' checked'); }
inf.document.write(
'> Blocking this link if false<br><input type=radio name=s value=force '+
'onClick="self.document.forms.condinfo.elements.h.value='+"'force'"+'"');
if (data2[1]=='force') { inf.document.write(' checked'); }
inf.document.write(
'> Blocking other links if true<br><a href="javascript:opener.editmode=0;'
+'opener.notclear=0;');
if (data1[4]=='-') {
inf.document.write('opener.crecond('+data1[2]+','+data1[1]+','
+'opener.escape(self.document.forms.condinfo.elements.c.value),'
+'self.document.forms.condinfo.elements.h.value);');
} else {
inf.document.write('opener.objcont['+data1[4]+']='
+'opener.escape(self.document.forms.condinfo.elements.c.value)+'+"':'"
+'+self.document.forms.condinfo.elements.h.value+'+"':cond';");
}
inf.document.writeln(
'opener.infoclear();opener.editmode=0;opener.draw('
+');">Change to above values</a> '
+' <a href="javascript:self.document.forms.condinfo.reset()">Reset</a>'
+'<input type=hidden name=h value='+data2[1]
+'></form>');
inf.document.writeln(
'<a href="javascript:opener.notclear=0;opener.infoclear();'
+'opener.delcond('+data1[2]+','+data1[1]+');opener.editmode=0;opener.draw('
+');">Delete Condition</a>');
} else {
if (data1[0]=='r') {
if (linkmode!=0) {
joinres(linkmode,data1[1],0);
editmode=0;
notclear=0;
linkmode=0;
inf.document.writeln('<b>Linked Resources</b>');
draw();
} else {
inf.document.writeln('<b>Resource</b>');
data2=objcont[data1[1]].split(':');
inf.document.write(
'<form name=resinfo><table><tr><td>Title:</td><td>'
+'<input type=text name=t size=40 value="'
+data2[0]+'"></td></tr><tr><td>URL:</td><td>'
+'<input type=text name=u size=40 value="'+data2[1]+'"></td></tr>'
+'<tr><td>External:</td><td><input type=checkbox name=e');
if (data2[2]=='true') { inf.document.write(' checked'); }
inf.document.writeln('></td></tr>'
+'<tr><td colspan=2><a href="javascript:opener.editmode=0;'
+'opener.notclear=0;opener.objcont['+data1[1]
+']=opener.escape(self.document.forms.resinfo.elements.t.value)+'+"':'"
+'+opener.escape(self.document.forms.resinfo.elements.u.value)+'+"':'"
+'+self.document.forms.resinfo.elements.e.checked+'+"':res'"
+';opener.infoclear();">'
+'Change to above values</a> '
+' <a href="javascript:self.document.forms.resinfo.reset()">Reset</a>'
+'</td></tr></table></form>');
inf.document.writeln(
'<a href="javascript:opener.notclear=0;opener.infoclear();'
+'opener.delres('+data1[1]+',0);opener.editmode=0;opener.draw('
+');">Delete Resource (cutting links)</a>');
inf.document.writeln(
'<br><a href="javascript:opener.notclear=0;opener.infoclear();'
+'opener.delres('+data1[1]+',1);opener.editmode=0;opener.draw('
+');">Delete Resource (preserving links)</a>');
inf.document.writeln(
'<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
+'opener.linkmode='+data1[1]+';'
+'opener.infoclear();">Link Resource</a>');
}
} else {
linkmode=0;
inf.document.writeln('<b>Link</b><hr>');
data2=obj[data1[0]].split('&');
k=data2[data2.length-2];
data3=objlinks[k].split(':');
inf.document.writeln('From <b>'+objcont[data3[0]].split(':')[0]+
'</b><br>to <b>'+objcont[data3[1]].split(':')[0]+'</b>');
inf.document.writeln('<br><a href="javascript:opener.dellink('+
k+');opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
+');">Delete Link</a>');
inf.document.writeln('<br><a href="javascript:'+
'opener.insertreslink('+infostr+');'+
'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
+');">Insert Resource Into Link</a>');
}
}
inf.document.writeln(
'<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
+'opener.infoclear();">Done</a>');
inf.document.writeln('</td></tr></table></body></html>');
inf.document.close();
inf.focus();
}
// ----------------------------------------------------- Clicks on empty fields
function empty(rid,k) {
var cid=findcol(k);
var lcol=k-1;
trow=row[rid];
lrow=trow-1;
editmode=1;
notclear=1;
linkmode=0;
var options="scrollbars=1,resizable=1,menubar=0,width=400,height=300";
var inf=open("","infout",options);
inf.document.clear();
inf.document.writeln(
'<html><body bgcolor="#FFFFFF">'+
'<table><tr><td width=32><img src="edit.gif"></td><td bgcolor="#AAFFAA">'+
'<b>Empty Field</b><hr>');
inf.document.writeln('<br><a href="javascript:opener.newresource('+
rid+','+cid+",'','');"+
'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
+');">Insert Resource</a>');
inf.document.writeln('<hr>Insert column:');
inf.document.writeln('<a href="javascript:opener.insertcol('+
lcol+');opener.addobj('+rid+",'e&'+opener.maxcol);"
+'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
+');">left</a>');
inf.document.writeln('<a href="javascript:opener.insertcol('+
k+');opener.addobj('+rid+",'e&'+opener.maxcol);"
+'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
+');">right</a> ');
inf.document.writeln('<br>Insert row:');
inf.document.writeln('<a href="javascript:opener.insertrow('+
trow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
+'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
+');">below</a>');
inf.document.writeln('<a href="javascript:opener.insertrow('+
lrow+');opener.addobj(opener.maxrow'+",'e&"+cid+"');"
+'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw('
+');">above</a> ');
inf.document.writeln(
'<br><a href="javascript:opener.editmode=0;opener.notclear=0;'
+'opener.infoclear();">Done</a>');
inf.document.writeln('</td></tr></table></body></html>');
inf.document.close();
inf.focus();
}
// ---------------------------------------------------- Save into hidden fields
function save() {
var k;
parent.server.document.forms.storage.output.value='graphdef<:>yes';
for (k=0;k<obj.length;k++) {
parent.server.document.forms.storage.output.value+=
'<&>obj<:>'+k+'<:>'+obj[k];
}
for (k=0;k<row.length;k++) {
parent.server.document.forms.storage.output.value+=
'<&>row<:>'+k+'<:>'+row[k];
}
for (k=0;k<col.length;k++) {
parent.server.document.forms.storage.output.value+=
'<&>col<:>'+k+'<:>'+col[k];
}
for (k=0;k<rowcont.length;k++) {
if (rowcont[k]) {
parent.server.document.forms.storage.output.value+=
'<&>rowcont<:>'+k+'<:>'+rowcont[k];
}
}
parent.server.document.forms.storage.output.value+=
'<&>maxcol<:>'+maxcol;
parent.server.document.forms.storage.output.value+=
'<&>maxrow<:>'+maxrow;
for (k=0;k<objcont.length;k++) {
if (objcont[k]) {
parent.server.document.forms.storage.output.value+=
'<&>objcont<:>'+k+'<:>'+objcont[k];
}
}
for (k=0;k<objlinks.length;k++) {
if (objlinks[k]) {
parent.server.document.forms.storage.output.value+=
'<&>objlinks<:>'+k+'<:>'+objlinks[k];
}
}
undopointer++;
undostack[undopointer]=
parent.server.document.forms.storage.output.value;
}
// ----------------------------------------------- Reset all layout information
function graphreset() {
obj.length=0;
obj[0]='';
obj[1]='e&1';
rowcont.length=0;
rowcont[0]='';
rowcont[1]='1';
row.length=0;
row[0]=0;
row[1]=1;
maxrow=1;
col.length=0;
colmap.length=0;
maxcol=-1;
insertcol(-1);
insertcol(0);
graphdef='no';
}
// --------------------- Compare two resources with each other for "straighten"
function rescompare(a,b) {
data1=a.split(':');
data2=b.split(':');
var rvalue=0;
var k;
for (k=1;k<data1.length;k++) {
if (data1[k]==data2[0]) { rvalue--; }
}
for (k=1;k<data3.length;k++) {
if (data2[k]==data1[0]) { rvalue++; }
}
if (rvalue==0) { rvalue=data2.length-data1.length; }
return rvalue;
}
// -------------------------------------------- Draw the table instead of graph
function tabledraw() {
var k;
var ij;
var kj;
var objsort=new Array();
var objsorted=new Array();
for (k=1;k<objcont.length;k++) {
if (objcont[k]) {
data1=objcont[k].split(':');
if (data1[data1.length-1]=='res') {
objsort[objsort.length]=''+k;
}
}
}
for (k=1;k<objlinks.length;k++) {
data1=objlinks[k].split(':');
kj=-1;
for (j=0;j<objsort.length;j++) {
if ((objsort[j].split(':'))[0]==data1[0]) {
kj=j;
}
}
objsort[kj]+=':'+data1[1];
}
objsorted=objsort.sort(rescompare);
for (ij=0;ij<objsorted.length;ij++) {
}
alert("Table mode not yet implemented");
}
// ------------------------------------------- Sort objects to straighten graph
function graphopt() {
var k;
var ij;
var kj;
var objsort=new Array();
var objsorted=new Array();
condense();
graphreset();
for (k=1;k<objcont.length;k++) {
if (objcont[k]) {
data1=objcont[k].split(':');
if (data1[data1.length-1]=='res') {
objsort[objsort.length]=''+k;
}
}
}
for (k=1;k<objlinks.length;k++) {
data1=objlinks[k].split(':');
kj=-1;
for (j=0;j<objsort.length;j++) {
if ((objsort[j].split(':'))[0]==data1[0]) {
kj=j;
}
}
objsort[kj]+=':'+data1[1];
}
objsorted=objsort.sort(rescompare);
var thisnewobj=''+(objsorted[0].split(':'))[0];
rowcont[1]=thisnewobj;
var thiscolmax=1;
obj[thisnewobj]='b&1&'+thiscolmax+':0:0:0';
var allcolmax=0;
for (k=1;k<objsorted.length;k++) {
thisnewobj=(objsorted[k].split(':'))[0];
if (rescompare(objsorted[k-1],objsorted[k])==0) {
rowcont[rowcont.length-1]+=':'+thisnewobj;
thiscolmax++;
} else {
rowcont[rowcont.length]=thisnewobj;
if (thiscolmax>allcolmax) { allcolmax=thiscolmax; }
thiscolmax=1;
}
kj=rowcont.length-1;
obj[thisnewobj]='b&'+kj+'&'+thiscolmax+':0:0:0';
}
for (k=0;k<obj.length;k++) {
if (!obj[k]) { obj[k]=''; }
}
for (k=0;k<=allcolmax;k++) { insertcol(0); }
for (k=0;k<rowcont.length;k++) {
row[k]=k;
}
maxrow=rowcont.length-1;
var oldlinks=new Array();
for (k=0;k<objlinks.length;k++) { oldlinks[k]=objlinks[k]; }
objlinks.length=0;
objlinks[0]='';
for (k=0;k<objsorted.length;k++) {
kj=(objsorted[k].split(':'))[0];
for (ij=1;ij<oldlinks.length;ij++) {
if (oldlinks[ij]) {
data1=oldlinks[ij].split(':');
if (data1[0]==kj) {
joinres(data1[0],data1[1],data1[2]);
}
}
}
}
}
// ----------------------------------------------------------- Remove e-objects
function condense() {
var j;
for (j=0;j<=maxrow;j++) {
if (rowcont[j]!='') {
data1=rowcont[j].split(':');
rowcont[j]='';
for (k=0;k<data1.length;k++) {
if (obj[data1[k]].substring(0,2)!='e&') {
if (rowcont[j]!='') { rowcont[j]+=':'; }
rowcont[j]+=data1[k];
}
}
}
}
}
// ---------------------------------------------------- Load from hidden fields
function load() {
objcont.length=0;
objlinks.length=0;
objlinks[0]='';
objcont[0]='';
editmode=0;
notclear=0;
lastinfo='';
graphreset();
var inputstr=parent.server.document.forms.storage.output.value;
data1=inputstr.split('<&>');
var k;
for (k=0;k<data1.length;k++) {
data2=data1[k].split('<:>');
if (data2[0]=='graphdef') { graphdef=data2[1]; }
if (data2[0]=='maxcol') { maxcol=1*data2[1]; }
if (data2[0]=='maxrow') { maxrow=1*data2[1]; }
if (data2[0]=='obj') { obj[data2[1]]=data2[2]; }
if (data2[0]=='objcont') { objcont[data2[1]]=data2[2]; }
if (data2[0]=='objlinks') { objlinks[data2[1]]=data2[2]; }
if (data2[0]=='rowcont') { rowcont[data2[1]]=data2[2]; }
if (data2[0]=='row') { row[data2[1]]=1*data2[2]; }
if (data2[0]=='col') { col[data2[1]]=1*data2[2]; }
}
}
// -------------------------------------------------------------- Undo function
function undo() {
if (undopointer>1) {
undopointer--;
parent.server.document.forms.storage.output.value
=undostack[undopointer];
load();
undopointer--;
draw();
stored=0;
} else {
alert("Cannot undo: reached beginning of edit session");
}
}
// -------------------------------------------------------------- Redo function
function redo() {
if (undopointer<undostack.length-1) {
undopointer++;
parent.server.document.forms.storage.output.value
=undostack[undopointer];
load();
undopointer--;
draw();
stored=0;
} else {
alert("Cannot redo: reached end of edit session");
}
}
// ------------------------------------------------------------ Revert function
function revert() {
if (confirm("Revert to beginning of edit session?")) {
undopointer=2;
undo();
}
}
// -------------------------------------------------------------- Store changes
function storechange() {
parent.server.document.forms.storage.submit();
stored=1;
alert("Stored changes");
}
// ---------------------------------------------------------------- Toggle Mode
function togglemode() {
if (tablemode==0) { tablemode=1; } else { tablemode=0; }
draw();
}
// -------------------------------------------------------- Main program onLoad
function main() {
if (mainrun==0) {
load();
draw();
stored=1;
mainrun=1;
}
}
// ------------------------------------------------------------- Save on leave?
function leave() {
if (stored==0) {
if (confirm('Store changes?')) {
storechange();
}
}
}
</script>
</head>
<body bgcolor="#FFFFFF" onLoad="main();" onUnload="leave();">
<a href="javascript:togglemode();">Toggle Display Mode</a>
<a href="javascript:condense();draw();">Condense</a>
<a href="javascript:graphopt();draw();">Straighten</a>
<a href="javascript:revert();">Revert</a>
<a href="javascript:undo();">Undo</a>
<a href="javascript:redo();">Redo</a>
<a href="javascript:storechange();">Store</a>
</body>
</html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>