/****************************************************************************** This page: defines images and formatting served by vserver.js ================================================================== Passed Runtime Variables: Optional defined in calling html, defaults set here: docTitle = ''; ================================================================== Programming conventions: vars are local to this script library vArs, Vars, vaRs are global to all script libraries ******************************************************************************/ /* debugmessage */ //alert('Start dataf.js'); /****************************************************************************** Declare default global system variables ******************************************************************************/ baseUrl = 'apnswpg1.htm'; searchField = '2'; // $uri field for use by showTitle(), search utilities indexField = '2'; // sort field for use by showTitle(), search utilities docText = 'Making Sex Work Safe in Asia and the Pacific'; docFootTxt = 'Making Sex Work Safe in Asia and the Pacific
© 2003-2007 APNSW'; docCss = cssRoot+'apnsw.css'; docPrint = (printPrompt()); docRoot = ''; helpmenu = 0; pgLngth = new Array('tdx',20,'mdx',30,'pdx',10); breaks = new Array('0','1','2'); folders = new Array('nc'); hilite = '"style background-color:'+hColor+'"'; icons = new Array(); icons['spc'] = new Array('spc2','nl'); icons['node0'] = new Array('nc0','no0'); icons['node1'] = new Array('nc1','no1'); icons['node2'] = new Array('nc1','no1'); icons['folder'] = new Array('nfc','nfo'); /****************************************************************************** Preload images ******************************************************************************/ pic = new Image(); pic.src = imgRoot+'pic.gif'; pic2 = new Image(); pic2.src = imgRoot+'pic2.gif'; ndoc = new Image(); ndoc.src = imgRoot+'ndoc.gif'; ndoc2 = new Image(); ndoc2.src= imgRoot+'ndoc2.gif'; www = new Image(); www.src = imgRoot+'www.gif'; www2 = new Image(); www2.src = imgRoot+'www2.gif'; spc2 = new Image(); spc2.src = imgRoot+'spacer.gif'; nl = new Image(); nl.src = imgRoot+'nl.gif'; nfc = new Image(); nfc.src = imgRoot+'nfc.gif'; nfo = new Image(); nfo.src = imgRoot+'nfo.gif'; no0 = new Image(); no0.src = imgRoot+'no0.gif'; no1 = new Image(); no1.src = imgRoot+'no1.gif'; no2 = new Image(); no2.src = imgRoot+'no2.gif'; nc0 = new Image(); nc0.src = imgRoot+'nc0.gif'; nc1 = new Image(); nc1.src = imgRoot+'nc1.gif'; nc2 = new Image(); nc2.src = imgRoot+'nc2.gif'; nd1 = new Image(); nd1.src = imgRoot+'nd1.gif'; nd2 = new Image(); nd2.src = imgRoot+'nd2.gif'; //proprietry icons pdf = new Image(); pdf.src = imgRoot+'pdf.gif'; pdf2 = new Image(); pdf2.src = imgRoot+'pdf2.gif'; doc = new Image(); doc.src = imgRoot+'doc.gif'; doc2 = new Image(); doc2.src = imgRoot+'doc2.gif'; function defineFields() { /****************************************************************************** Syntax: defineFields(recnum) Retrieve & format data values performed for each record in dataset ******************************************************************************/ $field = Array(''); $name = ' • '; $uri = ''; $descr = ' '; $descr2 = ' '; $descr3 = ' '; $ext = ''; $ur = ' '; $imgsrc = new Image(); $img = spc2.src; $publ = ''; $author = ''; $date = ''; $size = ''; dLink = ''; //link to document iLink = ''; //interLink to next menu branch fwd/back sLink = ''; //link to display selected menu branch iconStr = ''; icons['doc'] = pics; //set default icon //confirm(self_url()+'/defineFields:'+ '\narguments[0] = '+ arguments[0] ); if(parseInt(arguments[0])>=0){ $field = dBase[arguments[0]].split('|'); $docAddr = $field[0].split('.')[0]; $name = $field[1]; $uri = $field[2]; if($field[3]!=''){$publ='Publisher: '+$field[3]+' ';} if($field[4]!=''){$author='Author: '+$field[4]+' ';} if($field[5]!=''){$date='Date: '+$field[5]+' ';} if($field[6]!=''){$size='File Size: '+$field[6]+' ';} if($field[7]!=''){$descr= dBase[arguments[0]].split('|')[7]+' ';} if($field[8]!=''){$descr2= dBase[arguments[0]].split('|')[8]+' ';} if($uri.length>0){ $ext = getDoctype($uri); icons['fol0'] = icons['folder']; icons['fol1'] = icons['folder']; icons['fol2'] = icons['folder']; icons['doc0'] = icons['doc']; icons['doc1'] = icons['doc']; icons['doc2'] = icons['doc']; icons['doc3'] = icons['doc']; $uri.indexOf("?")<0?$ur=$uri:$ur=$uri.substring(0,$uri.indexOf("?")); if(arguments[1]!='idx'){dLink="javascript:parent.vPage('"+$uri+"');";} //dLink = "javascript:parent.vPage('"+$uri+"');"; if($ext==''){ $target = 'main'; $imgsrc.src = imgRoot+$field[2]+'.jpg'; $img = $imgsrc.src; }else{ if(avis[2].indexOf($ext)!=-1){ dLink = "javascript:parent.hplay('"+$uri+"','"+$thumb+"');"; }else{ $ext=='html'?$target='top':wwws[2].indexOf($ext)!=-1?$target='top':$target='main';; } if($ext=='shtml'){ $ext=''; }else{ $ext='Format: '+$ext+' '; } } } if($field[9]!=''){ //if field9 exist-overwrite any previous images $imgsrc.src = imgRoot+$field[9]; $img = $imgsrc.src; } } //alert('defineFields:'+ '\narguments[0] = '+ arguments[0]+ '\n$field[0] = '+ $field[0]+ '\n$ur = '+ $ur); } function definePage() { /****************************************************************************** Format Page headers & footers Syntax: definePage(target,calling_obj) Called only once at top of loop ******************************************************************************/ last1=0;last2=0;last3=0; docInit = '\n\n'+docTitle+'\n\n' + '\n\n
'; docExit = '\n
\n\n'; docHead = '\n'; docFoot = '
'; if (arguments[0].indexOf("main")!=-1){ docInTable = '\n
'; if(document.layers){docInTable = '
';} docHead= docInTable+'\n'; if (arguments[1]!="idx"){ docHead+= '\n'} docHead+= '\n
' +'' +'Back to previous page' +'' +'

'+docTitle+'

'; docHead+= '
 
\n'; if (arguments[1]!="idx"){ docHead+= '\n'; docFoot='' +'
 
' + '\n' + '\n' + '\n' + '\n
 
' + '\n\n' +'' + '' + '\n
 

'+docFootTxt+'

' +printPagePrompt() + '
'; } docFoot = '\n
'+ docFoot; } } function definePrintPage() { /****************************************************************************** Format Print headers & footers Syntax: defineHeader(target,calling_obj) Performed for each print page Called at top of dataset loop ******************************************************************************/ prnHead = prnTable + '\n
' + '\n' + '' + '
 
\n

'+ docTitle+'

'+(printPrompt())+'

\n
' + '\n
' + '\n' + ''; prnFoot = '' + '

'+navObj+'


'+navObj+'

\n' //+ '\n' + '\n
' + '' //+ '
\n

'+docFootTxt+'

\n
'+prnTablend; } function textFormat(){ /****************************************************************************** Format menu text output ******************************************************************************/ mTree(); xx=$name;if($uri != ''){xx=''+$name+'';} return('' + ' '+iconStr+' '+xx + ''); } function mtextFormat(){ /****************************************************************************** Format textbox ******************************************************************************/ mTree(); iconStr = ''; xx=$name;if($uri.length>0){xx=''+$name+'';} return('' + iconStr +$field[0].substring(0,1)+'.'+$field[0].substring(1,2)+'.'+$field[0].substring(2,3)+'.'+$field[0].substring(3,4) + '' +xx+'
'+$publ+' '+$author+' '+$date+' '+$ext+' '+$size + '' + ' ' + '' + $descr+ '
' + '' //+ $descr2+ '
' + '
' + ''); } function printFormat(){ /****************************************************************************** Format printed output ******************************************************************************/ mTree($field[0]); iconStr = ''; xx=$name;if($ur!= ''){xx=''+$name+'';} return('' + iconStr + '

' + $field[0].substring(0,1)+'.'+$field[0].substring(1,2)+'.'+$field[0].substring(2,3)+'.'+$field[0].substring(3,4) + '

' +xx+'
'+$publ+' '+$author+' '+$date+' '+$ext+' '+$size + '' + ' ' + '' + $descr+ '
' + '' + $descr2+ '
' + ''); } function showRes(){ /****************************************************************************** setup default search str for showres() ******************************************************************************/ if(findDataSet('',arguments[0],'0','0')>0){ for (sn=0; sn