--- rat/client/Attic/code.html 2000/08/19 19:47:30 1.11 +++ rat/client/Attic/code.html 2001/11/29 19:15:37 1.48 @@ -3,14 +3,47 @@ @@ -30,6 +63,7 @@ var colmap5=new Array(); var colmap6=new Array(); var obj=new Array(); var objcont=new Array(); +var objparms=new Array(); var objlinks=new Array(); var rowcont=new Array(); var rowtype=new Array(); @@ -71,6 +105,28 @@ var data4=new Array(1024); var data5=new Array(1024); var inf; +var srch; +var srchflag=-1; // 1 means currently open + // 0 means closed (but has been open) + // -1 means never yet opened/defined +var srchmode=''; + +var idx; +var idxflag=-1; // 1 means currently open + // 0 means closed (but has been open) + // -1 means never yet opened/defined +var idxmode=''; + +var parm; +var parmflag=-1; // 1 means currently open + // 0 means closed (but has been open) + // -1 means never yet opened/defined + +var iconpath='/adm/lonIcons/'; + +function testfunction() { + inf.document.forms.resinfo.elements.t.value="ABC"; +} // ------------------------------------------------ Insert a row into the table @@ -92,7 +148,7 @@ function insertrow(j,ex1,ex2) { objects=objects1+':'+objects2; data1=objects.split(':'); for (kj=0;kj'); - if (what!='') { - if (obj1!='') { - obj1="'"+obj1+"'"; + if ((what!='') && (typeof(what)!="undefined")) { + if ((obj1!='') && (typeof(obj1)!="undefined")) { + objref="'"+obj1+"'"; parent.mapout.document.write - (''); + (''); } if (what=='r:') { + mime=''; + objnum=(obj1.split('&'))[1]; + if (typeof(objcont[objnum])!="undefined") { + urlparts=objcont[objnum].split(':'); + url=urlparts[1]; + ext=urlparts[2]; + urlparts=url.split('.'); + mime=urlparts[urlparts.length-1]; + if (typeof(mime)=="undefined") { mime=''; } + } parent.mapout.document.write - (''); + if ((mime!='') && (ext!='true')) { + parent.mapout.document.write + ('
'+ + ''); + } else { + parent.mapout.document.write + ('
'); + } + parent.mapout.document.write + ('
'); } else { if (what=='c:') { parent.mapout.document.write @@ -915,14 +1018,61 @@ function drawcell (rtype,ctype,what,cm,o +' src="condition.gif">'); } else { if (what=='rs:') { + mime=''; + objnum=(obj1.split('&'))[1]; + if (typeof(objcont[objnum])!="undefined") { + urlparts=objcont[objnum].split(':'); + url=urlparts[1]; + ext=urlparts[2]; + urlparts=url.split('.'); + mime=urlparts[urlparts.length-1]; + if (typeof(mime)=="undefined") { mime=''; } + } parent.mapout.document.write - (''); + if ((mime!='') && (ext!='true')) { + parent.mapout.document.write + ('
'+ + ''); + } else { + parent.mapout.document.write + ('
'); + } + parent.mapout.document.write + ('
'); + } else { if (what=='rf:') { + mime=''; + objnum=(obj1.split('&'))[1]; + if (typeof(objcont[objnum])!="undefined") { + urlparts=objcont[objnum].split(':'); + url=urlparts[1]; + ext=urlparts[2]; + urlparts=url.split('.'); + mime=urlparts[urlparts.length-1]; + if (typeof(mime)=="undefined") { mime=''; } + } parent.mapout.document.write - (''); + if ((mime!='') && (ext!='true')) { + parent.mapout.document.write + ('
'+ + ''); + } else { + parent.mapout.document.write + ('
'); + } + parent.mapout.document.write + ('
'); } else { parent.mapout.document.write (''); } } else { @@ -988,7 +1138,7 @@ if (rowtype[jid]!=0) { } parent.mapout.document.writeln(''); - if (rowcont[jid]!='') { + if ((rowcont[jid]!='') && (typeof(rowcont[jid])!="undefined")) { data2=rowcont[jid].split(':'); for (jk=0;jkmiddle) { for (k=middle+1;kleftin;k--) { - if (colmap4[k]!='') { + if ((colmap4[k]!='') && (typeof(colmap4[k])!="undefined")) { colmap[k]='lrt'; } else { colmap[k]='lr'; @@ -1075,7 +1225,7 @@ if (rowtype[jid]!=0) { if (rightoutmiddle) { - if (colmap3[middle]!='') { + if ((colmap3[middle]!='') && (typeof(colmap3[middle])!="undefined")) { colmap2[middle]='rtdl'; } else { colmap2[middle]='rtl'; @@ -1084,7 +1234,7 @@ if (rowtype[jid]!=0) { } if (leftoutleftout;k--) { - if (colmap3[k]!='') { + if ((colmap3[k]!='') && (typeof(colmap3[k])!="undefined")) { colmap2[k]='rld'; } else { colmap2[k]='rl'; @@ -1094,7 +1244,7 @@ if (rowtype[jid]!=0) { } if (rightout>middle) { for (k=middle+1;k'); inf.document.close(); - parent.focus(); + if (srchflag==1) { + srchclose(); + } + if (idxflag==1) { + idxclose(); + } + if (parmflag==1) { + parmclose(); + } + parent.top.focus(); parent.mapout.focus(); notclear=1; lastinfo=''; @@ -1288,6 +1447,10 @@ function infcheck() { // --------------------------------------------------- Prints out resource info function info(infostr) { + var mime=''; + var ext; + var urlparts=new Array; + var url=''; if ((editmode!=1) && (infostr!=lastinfo)) { notclear=1; infcheck(); @@ -1318,7 +1481,18 @@ function info(infostr) { } else { if (data1[0]=='r') { data2=objcont[data1[1]].split(':'); - inf.document.write(''); + url=data2[1]; + ext=data2[2]; + urlparts=url.split('.'); + mime=urlparts[urlparts.length-1]; + if (typeof(mime)=="undefined") { mime=''; } + if (ext=='true') { mime=''; } + if (mime!='') { + inf.document.write + ('
  '); + } + inf.document.write(''); if (data2[2]=='true') { inf.document.write('External '); } if (data2[3]=='start') { inf.document.writeln('Start'); @@ -1356,7 +1530,7 @@ function info(infostr) { } inf.document.writeln(''); inf.document.close(); - parent.focus(); + parent.top.focus(); parent.mapout.focus(); notclear=0; lastinfo=infostr; @@ -1407,7 +1581,9 @@ function insertreslink(infostr) { dellink(lnr); newresource(rid,cid,'','','false','normal'); nobj=obj.length-1; + save(); joinres(fobj,nobj,cobj); + save(); joinres(nobj,tobj,0); } @@ -1427,10 +1603,104 @@ function insertcondlink(cid,lnr) { dellink(lnr); newresource(maxrow,cid,'','','false','normal'); nobj=obj.length-1; + save(); joinres(fobj,nobj,cobj); + save(); joinres(nobj,tobj,0); } + + + +// ------------------------------------------------------ Clears indexer window + +function idxclear() { + idx.document.clear(); +} + +// ------------------------------------------------------- Clears search window + +function srchclear() { + srch.document.clear(); +} + +// --------------------------------------------------------- Clears parm window + +function parmclear() { + parm.document.clear(); +} + +// ------------------------------------------------------ Closes indexer window + +function idxclose() { + if (idx && !idx.closed) { + idxflag=0; + idx.close(); + } +} + +// ------------------------------------------------------- Closes search window + +function srchclose() { + if (srch && !srch.closed) { + srchflag=0; + srch.close(); + } +} + +// ------------------------------------------------------- Closes search window + +function parmclose() { + if (parm && !parm.closed) { + parmflag=0; + parm.close(); + } +} + +// -------------------------------------------------------- Open indexer window + +function idxopen(mode) { + var options="scrollbars=1,resizable=1,menubar=0"; + idxmode=mode; + idxflag=1; + idx=open("/res/?launch=1&catalogmode="+mode,"idxout",options); + idx.focus(); +} + +// --------------------------------------------------------- Open search window + +function srchopen(mode) { + var options="scrollbars=1,resizable=1,menubar=0"; + srchmode=mode; + srchflag=1; + srch=open("/adm/searchcat?launch=1&catalogmode="+mode,"srchout",options); + srch.focus(); +} + +// -------------------------------------------- Interface function to searching + +function search() { + alert("Searching not yet implemented"); +} + +// ------------------------------------------------------- Do srch status check + +function srchcheck(mode) { + if (!srch || srch.closed || srchmode!=mode) { + srchopen(mode); + } + srch.focus(); +} + +// -------------------------------------------------------- Do idx status check + +function idxcheck(mode) { + if (!idx || idx.closed || idxmode!=mode) { + idxopen(mode); + } + idx.focus(); +} + // ---------------------------------------------------- Handles "click to edit" function handler(infostr) { @@ -1478,7 +1748,7 @@ function handler(infostr) { } inf.document.writeln( 'opener.infoclear();opener.editmode=0;opener.draw(' - +');">Change to above values  ' + +');">Save Changes  ' +' Reset
' +''); @@ -1518,16 +1788,19 @@ function handler(infostr) { } } inf.document.write( - '
Title:' + ''); - if ((data2[3]!='start') && (data2[3]!='finish')) { - inf.document.write('' +'' - +''); + if ((data2[3]!='start') && (data2[3]!='finish')) { + inf.document.write(''); - } else { - inf.document.write( - ''); - } + } inf.document.writeln( - '
Title:' +'
URL:' + inf.document.write('
URL:' +'
External:
' + inf.document.write('>' + +'Browse ' + +'Search
' +' Optional
' - +'
' - +'Change to above values  ' + +'Save Changes  ' +' Reset' +'
'); if ((data2[3]!='start') && (data2[3]!='finish')) { @@ -1572,6 +1841,11 @@ function handler(infostr) { +'opener.linkmode='+data1[1]+';' +'opener.infoclear();">Link Resource'); } + inf.document.writeln( + '
Set Parameters'); + } } else { linkmode=0; @@ -1592,7 +1866,7 @@ function handler(infostr) { } inf.document.writeln( '
Done'); + +'opener.infoclear();">Cancel'); inf.document.writeln('
'); inf.document.close(); inf.focus(); @@ -1621,7 +1895,8 @@ function empty(rid,k) { 'opener.editmode=0;opener.notclear=0;opener.infoclear();opener.draw(' +');">Insert resource'); - if ((mostrecent!=0) && (objcont[mostrecent]!='')) { + if ((mostrecent!=0) && (objcont[mostrecent]!='') && + (typeof(objcont[mostrecent])!="undefined")) { inf.document.writeln('
Done'); + +'opener.infoclear();">Cancel'); inf.document.writeln(''); inf.document.close(); inf.focus(); @@ -1702,7 +1977,13 @@ function save() { } parent.server.document.forms.storage.output.value+= '<&>tablemode<:>'+tablemode; - + + for (k=0;kobjparms<:>'+k+'<:>'+objparms[k]; + } + } for (k=0;k'); + url=data1[1]; + ext=data1[2]; + urlparts=url.split('.'); + mime=urlparts[urlparts.length-1]; + if (typeof(mime)=="undefined") { mime=''; } + if ((mime!='') && (ext!='true')) { + parent.mapout.document.write + ('

'+ + '

'); + } + parent.mapout.document.write( + '

'); data2=obj[i].split('&'); parent.mapout.document.write(''); + if (data1[3]=='start') { parent.mapout.document.writeln(''); } @@ -1820,14 +2119,15 @@ function tabledraw() { ''); - if ((data1[3]!='start') && (data1[3]!='finish')) { parent.mapout.document.write( '' +'' - +''); + if ((data1[3]!='start') && (data1[3]!='finish')) { + parent.mapout.document.write( + ''); - } else { - parent.mapout.document.write( - ''); - } + } parent.mapout.document.write( ''); + 'Link resource'); } + parent.mapout.document.writeln( + '
Set Parameters'); + + parent.mapout.document.writeln(''); parent.mapout.document.writeln('
Start
Title:
URL:
External:
Optional
' - +'
' - +'Change to above values  ' + +'Save Changes  ' +' Reset
'); if ((data1[3]!='start') && (data1[3]!='finish')) { @@ -1872,8 +2168,13 @@ function tabledraw() { parent.mapout.document.writeln( ''+ - 'Link resource
'); for (j=2;j' +'Insert resource linked to from above
'); @@ -1950,7 +2252,9 @@ function insrestab(irow,be,af,typ) { '' +'Insert resource linked to from above and linking to below
'); @@ -1960,6 +2264,7 @@ function insrestab(irow,be,af,typ) { '' +'Insert resource linking to below
'); @@ -1978,9 +2283,13 @@ function simpletabledraw() { var nr; var ck; var cck; + var mime; + var ext; + var url; + var urlparts=new Array; var condid; var sortstr=sortobjs(); - if (sortstr!='') { + if ((sortstr!='') && (typeof(sortstr)!="undefined")) { objsorted=sortstr.split('&'); for (k=0;k
'+k+''); + parent.mapout.document.write('
'); + url=data1[1]; + ext=data1[2]; + urlparts=url.split('.'); + mime=urlparts[urlparts.length-1]; + if (typeof(mime)=="undefined") { mime=''; } + if ((mime!='') && (ext!='true')) { + parent.mapout.document.write + ('

'+ + '

'); + } + parent.mapout.document.write(''+k+'

'); data2=obj[i].split('&'); parent.mapout.document.write(''); + if (data1[3]=='start') { parent.mapout.document.writeln(''); } @@ -2078,7 +2399,7 @@ function sortobjs() { for (k=1;k'); var k; for (k=0;k'); + data2=data1[k].split(':').join(':').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]=='objparms') { + if (typeof(objparms[data2[1]])=="undefined") { + objparms[data2[1]]=data2[2]; + } else { + objparms[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]; } @@ -2254,11 +2583,22 @@ function finishload() { } if (graphdef=='yes') { for (k=1;k<=maxrow;k++) { - if (rowcont[k]==undefined) { rowcont[k]=''; } + if (typeof(rowcont[k])=="undefined") { rowcont[k]=''; } } } } +// -------------------------------------------------------------- Parameter set + +function setparms(resid) { + var options="scrollbars=1,resizable=1,menubar=0"; + parmflag=1; + data1=objcont[resid].split(':'); + parm=open("/adm/ratparms?url="+data1[1]+"&parms="+objparms[resid]+ + "&resid="+resid,"parmout",options); + parm.focus(); +} + // -------------------------------------------------------------- Undo function function undo() { @@ -2321,8 +2661,8 @@ function wheelswitch() { // --------------------------------------------- Checks if server frame defined function checkdef() { - if (parent.server.document.forms.storage.output.value!=undefined) { - srvloaded(); + if (parent.flag==1) { + srvloaded(); } if ((finishdone==0) && (tim==0)) { setTimeout('checkdef()',100); } } @@ -2351,14 +2691,26 @@ function schedule(action) { reqaction=action; tim=0; finishdone=0; - canceltim=setTimeout('tim=1;',20000) + canceltim=setTimeout('tim=1;',20000); + checkdef(); wait(); } +// ----------------------------------------------------- launch indexer browser + +function groupsearch() { + srchcheck('groupsearch'); +} + +function groupimport() { + idxcheck('groupimport'); +} + // -------------------------------------------------------------- Store changes function storechange() { var k; + parent.flag=0; parent.server.document.forms.storage.submit(); schedule('save'); } @@ -2407,31 +2759,41 @@ function main() { } -// ------------------------------------------------------------- Save on leave? +// ---------------------------------------------------------- Close the window? function leave() { if (!inf.closed) { inf.close(); } + if (srch && !srch.closed) { + srchclose(); + } + if (idx && !idx.closed) { + srchclose(); + } } - -Toggle Display Mode -Zoom Out -Zoom In -Condense -Straighten -Revert -Undo -Redo -Store + +
Start
+ + + + + + + + + + + + +
Toggle display Zoom out Zoom in Condense Straighten Revert Undo Redo Group search Group import Save map 
+
+ - - - - -