home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
ppwizard.zip
/
ftplike.ih
< prev
next >
Wrap
Text File
|
2000-02-19
|
15KB
|
314 lines
;----------------------------------------------------------------------------
; MODULE NAME: FTPLIKE.IH
;
; $Author: Dennis_Bareis $
; $Revision: 1.13 $
; $Date: 19 Feb 2000 15:05:50 $
; $Logfile: E:/DB/PVCS.IT/OS2/PPWIZARD/FTPLIKE.IHV $
;
; DESCRIPTION: Please see End of the "FTPLIKEI.IH" file for
; details.
;----------------------------------------------------------------------------
;--- First time through? ----------------------------------------------------
#ifndef _FTPLIKE_INITIALIZED
#define FTPLIKE_CALLED_CORRECTLY
#include "FTPLIKEI.IH" ;;Perform initialization
#endif
;--- Simple processing message ----------------------------------------------
#evaluate '' ^ShortOutName = _filespec('Name', '<?OutputFile>')^
#info ^Generating <??ShortOutName> <= <$FTPLIKE_DIRECTORY>^
;--- Initialization for this FTP page ---------------------------------------
#RexxVar FtpDirCnt = 0 ;;Number of directories on this html page
#RexxVar FtpFileCnt = 0 ;;Number of files on this html page
;--- Generate start of HTML -------------------------------------------------
#if <?OutputLevel> <> FtpStartLevel | defined('FTPLIKE_NO_HEADER_FOOTER_ON_1ST_PAGE') = 'N'
<$FTPLIKE_START_HTML_PAGE>
#endif
<$FTPLIKE_START_PAGE_AFTER_TITLE>
;--- Process directories? (need to be careful as we include ourself) --------
#ifdef FTPLIKE_FOLLOW_SUBDIRECTORIES
;--- Want ".." (parent) link? --------------------------------------
#if <?OutputLevel> = FtpStartLevel
#define+ InDirTable NO
#elseif
;--- Start HTML table ------------------------------------------
<$FTPLIKE_BEFORE_ALL_DIRS>
#define+ InDirTable YES
;--- Generate ".." ---------------------------------------------
<$FTPLIKE_GENERATE_DOT_DOT URL="<$ParentHtml>">
#endif
;--- Get a directory list -------------------------------------------
#DefineRexx ''
;--- Get list of directories ---------------------------------
FtpArray<?OutputLevel>.0 = 0;
call _SysFileTree '<$FTPLIKE_DIRECTORY $$SQx2><?DirSlash><$FTPLIKE_DIR_MASKS>', 'FtpArray<?OutputLevel>', 'DO';
;--- Set defaults for these "primary" directories ------------
do DirIndex = 1 to FtpArray<?OutputLevel>.0
;--- This is not a virtual link --------------------------
FtpArray<?OutputLevel>.DirIndex.!RealDirTree = '';
;--- No description --------------------------------------
FtpArray<?OutputLevel>.DirIndex.!Description = '';
end;
;--- Add any linked directories -----------------------------
FtpKey = DirStore || 'ADDDIRS';
if RexxVarDefined(FtpKey) then
do
DirList = _valueG(FtpKey);
TheCnt = FtpArray<?OutputLevel>.0;
do while DirList <> ''
;--- Get next dir ------------------------------------
parse var DirList NextDir '00'x DirList;
TheCnt = TheCnt + 1;
;--- Override description (shortname/EA attrib)? -----
if left(NextDir, 1) <> '|' then
DirDescription = ''; ;;No override
else
do
;--- We want to override description -------------
EndPos = pos('|', NextDir, 2);
if EndPos = 0 then
call Error 'The directory description not correctly specified', 'Directory = "' || NextDir || '"';
DirDescription = substr(NextDir, 2, EndPos-2);
NextDir = substr(NextDir, EndPos+1);
end;
FtpArray<?OutputLevel>.TheCnt.!Description = DirDescription;
;--- Is it an alias? ---------------------------------
if left(NextDir,1) = '@' then
do
;--- It is an alias, resolve it ------------------
NextDirKey = substr(NextDir, 2);
<$c2x ResultVar="KeyCode" KeyVar="NextDirKey">
FullVar = "FtpAlias2Dir.!" || KeyCode;
if symbol(FullVar) <> 'VAR' then
error('Trying to link to undefined ALIAS of "' || NextDirKey || '"!');
NextDir = _valueG(FullVar);
end;
;--- This is not a primary directory (its "virtual") ---
FtpArray<?OutputLevel>.TheCnt.!RealDirTree = 'N';
;--- Add directory to list ---------------------------
FtpArray<?OutputLevel>.TheCnt = NextDir;
end;
FtpArray<?OutputLevel>.0 = TheCnt;
end;
;--- Set up some stuff! --------------------------------------
do DirIndex = 1 to FtpArray<?OutputLevel>.0
;--- Handle real shortname -------------------------------
FtpFile = FtpArray<?OutputLevel>.DirIndex;
FtpShortR = _filespec('name', FtpFile);
FtpArray<?OutputLevel>.DirIndex.!FtpShortR = FtpShortR;
;--- Description already specified? If not work it out ---
if FtpArray<?OutputLevel>.DirIndex.!Description = '' then
do
;--- No so either use shortname or EA value ----------
<$FTPLIKE_GET_SHORT_DESC>;
FtpArray<?OutputLevel>.DirIndex.!Description = FtpShortD;
end;
;--- Set up the sort key ---------------------------------
FtpArray<?OutputLevel>.DirIndex.!SortKey = translate(FtpArray<?OutputLevel>.DirIndex.!Description);
end;
;--- Sort the directory list ---------------------------------
if FtpArray<?OutputLevel>.0 <> 0 then
do
<$FTPLIKE_DIRECTORY_SORT_REXX ArrayName="FtpArray<?OutputLevel>">
end;
#DefineRexx
;--- Any directories to display? ------------------------------------
#if [FtpArray<?OutputLevel>.0 <> 0]
;--- Save pointer to current directories extra info! -------------
#RexxVar PUSH DirStore
;--- Process DIRECTORIES -----------------------------------------
#RexxVar FtpIndex<?OutputLevel> = 1
#{
;--- Finished? -----------------------------------------------
#if [FtpIndex<?OutputLevel> > FtpArray<?OutputLevel>.0]
#break
#endif
;--- Get Basic Directory information -------------------------
#RexxVar PUSH RealDirTree
#RexxVar Override = FtpArray<?OutputLevel>.FtpIndex<?OutputLevel>.!RealDirTree
#if [Override <> '']
#RexxVar RealDirTree = Override
#endif
#RexxVar FtpShortR = FtpArray<?OutputLevel>.FtpIndex<?OutputLevel>.!FtpShortR
#RexxVar FtpShortD = FtpArray<?OutputLevel>.FtpIndex<?OutputLevel>.!Description
#RexxVar FtpDir = FtpArray<?OutputLevel>.FtpIndex<?OutputLevel>
;--- Generate the files --------------------------------------
#RexxVar FtpDoThisDir = 'Y'
<$FTPLIKE_DO_THIS_DIR> ;;User want this dir to be seen?
#if [FtpDoThisDir = 'Y']
;--- User does want this dir to be seen ------------------
#RexxVar FtpDirCnt + 1
#if [FtpDirCnt = 1]
;--- Start DIRECTORY output --------------------------
#if ['<$InDirTable>' = 'NO']
<$FTPLIKE_BEFORE_ALL_DIRS>
#define+ InDirTable YES
#endif
#endif
;--- Do stuff --------------------------------------------
#evaluate+ '' "<$FTPLIKE_GET_DIR_HTMLNAME>"
;--- Override some directory defaults --------------------
<$MacroPush Macro='FTPLIKE_BODY_BG_IMG'>
<$MacroPush Macro='FTPLIKE_BODY_BG_COLOR'>
<$MacroPush Macro='FTPLIKE_BODY_LINK_COLOR'>
<$MacroPush Macro='FTPLIKE_BODY_ALINK_COLOR'>
<$MacroPush Macro='FTPLIKE_BODY_VLINK_COLOR'>
<$MacroPush Macro='FTPLIKE_BODY_ATTR_OTHER'>
<$MacroPush Macro='FTPLIKE_MINI_DIR_IMG_TAG'>
<$FTPLIKE_USER_DIR_ATTRIB_PUSH_CHANGE>
#evaluate+ '' "<$FTPLIKE_UPDATE_DEFAULT_DIR_INFO>"
;--- Save some variables ---------------------------------
#RexxVar PUSH FtpDirCnt FtpFileCnt FtpTotalDirCnt FtpTotalFileCnt
;--- Reset totals ----------------------------------------
#RexxVar FtpTotalDirCnt = 0
#RexxVar FtpTotalFileCnt = 0
;--- Process all subdirectories (generating HTML as we go)
<$FTPLIKE_GENERATE_HTML_FOR_DIR_TREE>
;--- Remember subdirectory counts ------------------------
#RexxVar FtpSubdirTotalFileCnt = FtpTotalFileCnt
#RexxVar FtpSubdirTotalDirCnt = FtpTotalDirCnt
;--- Display directory details on this page --------------
<$FTPLIKE_DIR_HANDLER>
;--- Restore other variables -----------------------------
#RexxVar POP FtpDirCnt FtpFileCnt FtpTotalDirCnt FtpTotalFileCnt
;--- Add to totals ---------------------------------------
#RexxVar FtpTotalFileCnt + FtpSubdirTotalFileCnt
#RexxVar FtpTotalDirCnt + FtpSubdirTotalDirCnt
;--- Restore some directory defaults ---------------------
<$FTPLIKE_USER_DIR_ATTRIB_POP>
<$MacroPop Macro='FTPLIKE_MINI_DIR_IMG_TAG'>
<$MacroPop Macro='FTPLIKE_BODY_ATTR_OTHER'>
<$MacroPop Macro='FTPLIKE_BODY_VLINK_COLOR'>
<$MacroPop Macro='FTPLIKE_BODY_ALINK_COLOR'>
<$MacroPop Macro='FTPLIKE_BODY_LINK_COLOR'>
<$MacroPop Macro='FTPLIKE_BODY_BG_COLOR'>
<$MacroPop Macro='FTPLIKE_BODY_BG_IMG'>
#endif
;--- Restore value -------------------------------------------
#RexxVar POP RealDirTree
;--- Prepare for next directory ------------------------------
#RexxVar FtpIndex<?OutputLevel> + 1
#}
;--- Save pointer to current directories extra info! -------------
#RexxVar POP DirStore
#endif
;--- Generate end DIRECTORY stuff -----------------------------------
#if ['<$InDirTable>' = 'YES']
<$FTPLIKE_AFTER_ALL_DIRS>
#define+ InDirTable NO
#endif
;--- Hook for displaying stuff --------------------------------------
<$FTPLIKE_BETWEEN_DIRS_AND_FILES>
#endif
;--- Get sorted list of files -----------------------------------------------
#DefineRexx ''
;--- Get List of files ---------------------------------------------------
FtpArray<?OutputLevel>.0 = 0;
call _SysFileTree '<$FTPLIKE_DIRECTORY $$SQx2><?DirSlash><$FTPLIKE_FILE_MASKS>', 'FtpArray', 'FO';
;--- Sort the list -------------------------------------------------------
<$FTPLIKE_FILE_SORT_REXX ArrayName="FtpArray">
#DefineRexx
;--- Any files in this directory? -------------------------------------------
#if [FtpArray.0 <> 0]
;--- Process files -------------------------------------------------------
#RexxVar FtpIndex = 1
#{
;--- Finished? -------------------------------------------------------
#if [FtpIndex > FtpArray.0]
#break
#endif
;--- Get Filename ----------------------------------------------------
#RexxVar FtpFile = FtpArray.FtpIndex
;--- Generate the files ----------------------------------------------
#RexxVar FtpDoThisFile = 'Y'
<$FTPLIKE_DO_THIS_FILE> ;;User want this file to be seen?
#if [FtpDoThisFile = 'Y']
;--- User does want this file to be seen -------------------------
#RexxVar FtpFileCnt + 1
#if [FtpFileCnt = 1]
;--- Start FILE output ---------------------------------------
<$FTPLIKE_BEFORE_ALL_FILES>
#endif
;--- Output details for this file --------------------------------
<$FTPLIKE_FILE_HANDLER>
<$FTPLIKE_FILE_DETAILS_HANDLER>
#endif
;--- Prepare for next file -------------------------------------------
#RexxVar FtpIndex + 1
#}
;--- Generate end FILES stuff --------------------------------------------
#if [FtpFileCnt <> 0]
<$FTPLIKE_AFTER_ALL_FILES>
#endif
#endif
;--- Generate END of HTML ---------------------------------------------------
<$FTPLIKE_END_PAGE_ABOVE_FOOTER>
#if <?OutputLevel> <> FtpStartLevel | defined('FTPLIKE_NO_HEADER_FOOTER_ON_1ST_PAGE') = 'N'
;--- User has not set up their own alternative -----------------------
<$FTPLIKE_FOOTER> ;;Footer ends body and html
#endif
;--- Update totals ----------------------------------------------------------
#RexxVar FtpTotalFileCnt + FtpFileCnt
#RexxVar FtpTotalDirCnt + FtpDirCnt
;--- Output summary ---------------------------------------------------------
#if [<?OutputLevel> = FtpStartLevel]
#ifndef FTPLIKE_FOLLOW_SUBDIRECTORIES
#info ^FTPLIKE processed <??FtpTotalFileCnt> file(s)^
#elseif
#info ^FTPLIKE processed <??FtpTotalFileCnt> file(s) in <??FtpTotalDirCnt> directories^
#endif
#endif