--- rat/client/Attic/code.html 2001/01/17 19:48:33 1.13 +++ rat/client/Attic/code.html 2001/08/08 02:59:17 1.45 @@ -3,6 +3,7 @@ @@ -30,6 +38,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 +80,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 +123,7 @@ function insertrow(j,ex1,ex2) { objects=objects1+':'+objects2; data1=objects.split(':'); for (kj=0;kj'); - if ((what!='') && (what!=undefined)) { - if ((obj1!='') && (obj1!=undefined)) { - 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 @@ -932,14 +993,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 { @@ -1005,7 +1113,7 @@ if (rowtype[jid]!=0) { } parent.mapout.document.writeln(''); - if ((rowcont[jid]!='') && (rowcont[jid]!=undefined)) { + if ((rowcont[jid]!='') && (typeof(rowcont[jid])!="undefined")) { data2=rowcont[jid].split(':'); for (jk=0;jkmiddle) { for (k=middle+1;kleftin;k--) { - if ((colmap4[k]!='') && (colmap4[k]!=undefined)) { + if ((colmap4[k]!='') && (typeof(colmap4[k])!="undefined")) { colmap[k]='lrt'; } else { colmap[k]='lr'; @@ -1092,7 +1200,7 @@ if (rowtype[jid]!=0) { if (rightoutmiddle) { - if ((colmap3[middle]!='') && (colmap3[middle]!=undefined)) { + if ((colmap3[middle]!='') && (typeof(colmap3[middle])!="undefined")) { colmap2[middle]='rtdl'; } else { colmap2[middle]='rtl'; @@ -1101,7 +1209,7 @@ if (rowtype[jid]!=0) { } if (leftoutleftout;k--) { - if ((colmap3[k]!='') && (colmap3[k]!=undefined)) { + if ((colmap3[k]!='') && (typeof(colmap3[k])!="undefined")) { colmap2[k]='rld'; } else { colmap2[k]='rl'; @@ -1111,7 +1219,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=''; @@ -1305,6 +1422,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(); @@ -1335,7 +1456,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'); @@ -1373,7 +1505,7 @@ function info(infostr) { } inf.document.writeln(''); inf.document.close(); - parent.focus(); + parent.top.focus(); parent.mapout.focus(); notclear=0; lastinfo=infostr; @@ -1452,6 +1584,98 @@ function insertcondlink(cid,lnr) { 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?catalogmode=interactive","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(); + } + 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) { @@ -1499,7 +1723,7 @@ function handler(infostr) { } inf.document.writeln( 'opener.infoclear();opener.editmode=0;opener.draw(' - +');">Change to above values  ' + +');">Save Changes  ' +' Reset
' +''); @@ -1539,16 +1763,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')) { @@ -1593,6 +1816,11 @@ function handler(infostr) { +'opener.linkmode='+data1[1]+';' +'opener.infoclear();">Link Resource'); } + inf.document.writeln( + '
Set Parameters'); + } } else { linkmode=0; @@ -1613,7 +1841,7 @@ function handler(infostr) { } inf.document.writeln( '
Done'); + +'opener.infoclear();">Cancel'); inf.document.writeln('
'); inf.document.close(); inf.focus(); @@ -1643,7 +1871,7 @@ function empty(rid,k) { +');">Insert resource'); if ((mostrecent!=0) && (objcont[mostrecent]!='') && - (objcont[mostrecent]!=undefined)) { + (typeof(objcont[mostrecent])!="undefined")) { inf.document.writeln('
Done'); + +'opener.infoclear();">Cancel'); inf.document.writeln(''); inf.document.close(); inf.focus(); @@ -1724,7 +1952,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(''); } @@ -1842,14 +2094,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')) { @@ -1894,8 +2143,13 @@ function tabledraw() { parent.mapout.document.writeln( ''+ - 'Link resource
'); for (j=2;j' +'Insert resource linked to from above
'); @@ -1972,7 +2227,9 @@ function insrestab(irow,be,af,typ) { '' +'Insert resource linked to from above and linking to below
'); @@ -1982,6 +2239,7 @@ function insrestab(irow,be,af,typ) { '' +'Insert resource linking to below
'); @@ -2000,9 +2258,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!='') && (sortstr!=undefined)) { + 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(''); } @@ -2100,7 +2374,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]; } @@ -2278,11 +2558,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() { @@ -2345,8 +2636,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); } } @@ -2375,14 +2666,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() { + alert('not yet implemented'); +} + +function groupimport() { + idxcheck('groupimport'); +} + // -------------------------------------------------------------- Store changes function storechange() { var k; + parent.flag=0; parent.server.document.forms.storage.submit(); schedule('save'); } @@ -2431,31 +2734,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 
+
+ - - - - -