/* o Added special processing for WebExplorer_Url objects, so that one can dynamically build a hotlist page from a folder(s) containing these objects dragged off of the WebExplorer. This processing is built into the dynamic directory building that already exists. It is recognized that this processing (every file's EAs are checked for .TYPE at least) will slow things down, though I haven't really looked into it since I'm not running a high-volume server anyway. o The variable MaxFilenameLength was added to make the space allocated to the filename easily changable. o I also added a few filetypes in the "imagetype" procedure. o There are a couple of places where a hard-coded icon size was replaced with ImageSize, and a hard-coded icon path was replaced with ImagePath */ /******* BuildDir.Rxx ***********/ /*ALC-- Albert Crosby's Directory Indexing code. */ /* modified by R. Korte (korte@sabine.acs.psu.edu), 09Sep1995 */ /* ----------------------------------------------------------------------- */ /* BUILDDIR: Builds a directory map on the fly. */ /* ----------------------------------------------------------------------- */ /*builddir: procedure expose Dir. tempfile sel */ parse arg dir, sel, Dir.Describe, Dir.Info, Dir.Exclude MaxFilenameLength = 40 ImageSize = 'width=20 height=23' ImagePath = '/icons/' fulldir=translate(dir,'\','/') message = '' description.="" if Dir.Describe\="" then do while lines(fulldir||Dir.Describe) line=linein(fulldir||Dir.Describe) if left(line,1)='"' then parse var line '"'name'"' desc else parse var line name desc name=translate(translate(name,'_',' ')) description.name=desc end /* crlf = '0a0d'x */ crlf = '0a'x message = ''crlf, "Contents of "sel""crlf, "

Contents of "sel"

"crlf, "
"crlf

  if (stream(fulldir||Dir.Info, 'c', 'query exists') \= '') then do
    msg = charin(fulldir||Dir.Info,,chars(fulldir||Dir.Info))
    stream(fulldir||Dir.Info, 'c', 'close')
    message = message || msg || "
" || crlf end call SysFileTree fulldir||'*.*','files.','D','*+-*-' message = message || '      ' left("Name",MaxFilenameLength) left("Last Modified",17) right("Size",10) crlf parent=translate(filespec('path',left(fulldir,length(dir)-1)),'/','\') if (length(sel) > 0) then _sel = left(sel, length(sel) -1) else _sel = sel if dir\=sel then parent='/'||translate( filespec('path', _sel),'/','\') message = message || '
[back] Parent directory' crlf do i=1 to files.0 parse var files.i date time size attribs fullname name=filespec('name',fullname) dname=name||"/" message = message || '[dir] 'dname'' crlf name=translate(translate(name,'_',' ')) if description.name\='' then message = message || ' 'description.name'' end call SysFileTree fulldir||'*.*','files.','F','**-*-' do i=1 to files.0 say 'in file loop' parse var files.i date time size attribs name name=filespec('name',name) /* Don't display excluded files */ if (wordpos(translate(name),translate(Dir.Exclude)) \= 0) then iterate /* * If file is a URL object, then do special processing: * Put URL icon, then filename (which will be the document title) * followed by the URL from the file. * * The .longname extended attribute must be used instead of the * file's name because of the possibility of the objects residing * on a FAT drive. On an HPFS drive, the .longname and file name * will be the same. (Note: I haven't actually tested this on a FAT * drive 'cuz I don't have one! -RK) * * URLNAME is first truncated at the first CR, since in the WPS one * can split the name across lines. I (RK) do this to put the URL * into the title as well, on a second line. Spaces are then stripped * from the beginning and end of the URLNAME, because if they aren't, * the alignment gets off (though I don't really understand why). * */ cr = '0a'x special = 0 /* flag set if special processing was done */ if( SysGetEA( fulldir||name, ".type", "TYPEINFO" ) = 0 ) then do parse var TYPEINFO 11 FILETYPE if( FILETYPE = 'WebExplorer_Url' ) then do url = linein(fulldir||name) rc = stream(fulldir||name,'c','CLOSE') if( SysGetEA( fulldir||name, ".longname", "LONGNAME" ) = 0 ) then parse var LONGNAME 5 URLNAME else URLNAME = name crpos = pos(cr,URLNAME) if( crlfpos \= 0 ) then URLNAME = LEFT( URLNAME, crpos-2 ) URLNAME = STRIP(URLNAME,'L') URLNAME = STRIP(URLNAME,'T') message = message || '', '', strip(left(URLNAME,MaxFilenameLength)), '', copies(' ',max(0,MaxFilenameLength-length(URLNAME))) name=translate(translate(name,'_',' ')) description.name = url special = 1 end end if( special = 0 ) then do message = message || imagetype(name), ''strip(left(name,MaxFilenameLength))''copies(' ',max(0,MaxFilenameLength-length(name))), right(date,8) right(time,8) right(size,10) name=translate(translate(name,'_',' ')) end /* end special processing */ name=translate(translate(name,'_',' ')) if description.name\='' then message = message || ' 'description.name'' crlf else message = message || crlf end return message || "crlf /*******/ /* IMAGETYPE: Return the name of the image file to use based on file type */ /*******/ imagetype: procedure expose ImagePath ImageSize size = ImageSize e=extension(arg(1)) select when e='TXT' | e='CMD' | e='DOC' | e='FAQ' | e='SAS' | e='TEX' then return '' when e='HTM' | e='HTML' then return '' when e='PS' then return '' when e='EXE' | e='ZIP' | e='ARC' | e='ARJ' | e='Z' | e='GZ' then return '' when e='TAR' then return '' when e="AU" | e="WAV" | e="MID" | e="SND" then return '' when e="GIF" | e="JPG" | e="JPEG" | e="TIF" | e="TIFF" | e="BMP" | e="XBM" then return '' when e="MPG" | e="MPEG" | e="AVI" then return '' otherwise return '' end extension: procedure arg filename /* If no period or only period is first char, then return "" */ if lastpos(".",filename)<2 then return "" return translate(substr(filename, lastpos('.',filename)+1)) /*ALC-- Albert Crosby's Directory Indexing code. --End */