From efe97411bc76f895b65d38645e033e2926841f0b Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 5 Nov 2008 08:44:39 +1300 Subject: [PATCH] Fixes for HTML report support. --- inc/method/m-txtrep.i | 115 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 39 deletions(-) diff --git a/inc/method/m-txtrep.i b/inc/method/m-txtrep.i index e6ccc0e..d7c6842 100644 --- a/inc/method/m-txtrep.i +++ b/inc/method/m-txtrep.i @@ -34,7 +34,7 @@ DEF VAR pclrep-between-pages AS LOGICAL NO-UNDO INITIAL No. DEF VAR pclrep-footer-height AS DEC NO-UNDO. -DEF VAR htmlrep-browser AS CHAR NO-UNDO INITIAL 'C:~\Program Files~\Internet Explorer~\iexplore.exe'. +DEF VAR htmlrep-browser AS CHAR NO-UNDO INITIAL 'START C:~\Program Files~\Internet Explorer~\iexplore.exe'. DEF VAR wine-printing AS LOGICAL NO-UNDO INITIAL NO. DEF VAR apms-spool AS CHAR NO-UNDO. @@ -50,7 +50,7 @@ END. apms-spool = OS-GETENV( "APMSSPOOL" ). IF apms-spool NE ? AND apms-spool NE "" THEN DO: wine-printing = YES. - htmlrep-browser = 'C:~\browser.exe'. + htmlrep-browser = 'xxiexplore.exe'. END. {inc/ofc-set.i "PDF-Output-Directory" "pdf-output-directory"} @@ -95,6 +95,17 @@ FUNCTION pclrep-test-bottom RETURNS LOGICAL &ENDIF +&IF DEFINED(EXCLUDE-tag) = 0 &THEN + +&ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION-FORWARD tag Method-Library +FUNCTION tag RETURNS CHARACTER + ( INPUT tagtype AS CHAR, INPUT tagtext AS CHAR, INPUT attributes AS CHAR ) FORWARD. + +/* _UIB-CODE-BLOCK-END */ +&ANALYZE-RESUME + +&ENDIF + /* *********************** Procedure Settings ************************ */ @@ -113,8 +124,8 @@ FUNCTION pclrep-test-bottom RETURNS LOGICAL &ANALYZE-SUSPEND _CREATE-WINDOW /* DESIGN Window definition (used by the UIB) CREATE WINDOW Method-Library ASSIGN - HEIGHT = 29.05 - WIDTH = 77.6. + HEIGHT = .45 + WIDTH = 30.86. /* END WINDOW DEFINITION */ */ &ANALYZE-RESUME @@ -305,24 +316,27 @@ PROCEDURE htmlrep-finish : /*------------------------------------------------------------------------------ Purpose: ------------------------------------------------------------------------------*/ -OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES APPEND PAGE-SIZE 0. -PUT CONTROL "". +/* OUTPUT TO VALUE(txtrep-print-file) KEEP-MESSAGES APPEND PAGE-SIZE 0. */ +PUT CONTROL "~n~n". OUTPUT CLOSE. /* MESSAGE '"' + htmlrep-browser + '" ' + txtrep-print-file . */ -OS-COMMAND SILENT VALUE( 'START "' + htmlrep-browser + '" ' + txtrep-print-file ). - -PAUSE 10 NO-MESSAGE. +IF apms-spool EQ ? OR apms-spool EQ "" THEN DO: + OS-COMMAND VALUE( htmlrep-browser + '" ' + txtrep-print-file ). +END. DEF VAR dir-name AS CHAR NO-UNDO. dir-name = SUBSTRING( txtrep-print-file, 1, R-INDEX(txtrep-print-file, txtrep-delim) ). /* Save the file so we can see it later */ +OS-DELETE VALUE( dir-name + 'lastrep.html' ) NO-ERROR. OS-COMMAND SILENT VALUE( 'COPY "' + txtrep-print-file + '" "' + dir-name + 'lastrep.html"~n'). OS-DELETE VALUE( txtrep-control-file ) NO-ERROR. +/* OS-DELETE VALUE( txtrep-print-file ) NO-ERROR. +*/ END PROCEDURE. @@ -340,9 +354,9 @@ PROCEDURE htmlrep-start : ------------------------------------------------------------------------------*/ DEF INPUT PARAMETER page-title AS CHAR NO-UNDO. - - -PUT CONTROL "~n~n" + page-title + "~n". +PUT CONTROL '~n' + + '~n~n' + page-title + "~n" + + '~n'. txtrep-output-mode = "htmlrep". pclrep-preview-mode = TRUE. @@ -998,6 +1012,32 @@ END PROCEDURE. &ENDIF +&IF DEFINED(EXCLUDE-txtrep-do-email) = 0 &THEN + +&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE txtrep-do-email Method-Library +PROCEDURE txtrep-do-email : +/*------------------------------------------------------------------------------ + Purpose: +------------------------------------------------------------------------------*/ +DEF INPUT PARAMETER email-string AS CHAR NO-UNDO. +DEF INPUT PARAMETER email-subject AS CHAR NO-UNDO. +DEF INPUT PARAMETER email-template AS CHAR NO-UNDO. + +IF email-string <> "" AND email-template <> "" THEN DO: + IF txtrep-output-mode = "pdf" THEN + PUT CONTROL "[-pdf-]>EMAIL:" + email-string + "|" + email-subject + "|" + email-template + "[-pdf-]". +END. +ELSE + MESSAGE "Email and email template parameters required" + VIEW-AS ALERT-BOX ERROR TITLE "Email or template blank". + +END PROCEDURE. + +/* _UIB-CODE-BLOCK-END */ +&ANALYZE-RESUME + +&ENDIF + &IF DEFINED(EXCLUDE-txtrep-initialise) = 0 &THEN &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE txtrep-initialise Method-Library @@ -1007,7 +1047,9 @@ PROCEDURE txtrep-initialise : ------------------------------------------------------------------------------*/ DEF VAR temp-dir AS CHAR NO-UNDO. - temp-dir = OS-GETENV("TEMP":U). + temp-dir = OS-GETENV("APMSTEMP":U). + IF temp-dir = ? OR temp-dir = "" THEN temp-dir = OS-GETENV("TMP":U). + IF temp-dir = ? OR temp-dir = "" THEN temp-dir = OS-GETENV("TEMP":U). IF temp-dir = ? OR temp-dir = "" THEN temp-dir = SESSION:TEMP-DIRECTORY . temp-dir = temp-dir + txtrep-delim. @@ -1051,32 +1093,6 @@ END PROCEDURE. &ENDIF -&IF DEFINED(EXCLUDE-txtrep-do-email) = 0 &THEN - -&ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE txtrep-do-email Method-Library -PROCEDURE txtrep-do-email : -/*------------------------------------------------------------------------------ - Purpose: -------------------------------------------------------------------------------*/ -DEF INPUT PARAMETER email-string AS CHAR NO-UNDO. -DEF INPUT PARAMETER email-subject AS CHAR NO-UNDO. -DEF INPUT PARAMETER email-template AS CHAR NO-UNDO. - -IF email-string <> "" AND email-template <> "" THEN DO: - IF txtrep-output-mode = "pdf" THEN - PUT CONTROL "[-pdf-]>EMAIL:" + email-string + "|" + email-subject + "|" + email-template + "[-pdf-]". -END. -ELSE - MESSAGE "Email and email template parameters required" - VIEW-AS ALERT-BOX ERROR TITLE "Email or template blank". - -END PROCEDURE. - -/* _UIB-CODE-BLOCK-END */ -&ANALYZE-RESUME - -&ENDIF - &IF DEFINED(EXCLUDE-txtrep-pdf-filename) = 0 &THEN &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE txtrep-pdf-filename Method-Library @@ -1215,3 +1231,24 @@ END FUNCTION. &ENDIF +&IF DEFINED(EXCLUDE-tag) = 0 &THEN + +&ANALYZE-SUSPEND _UIB-CODE-BLOCK _FUNCTION tag Method-Library +FUNCTION tag RETURNS CHARACTER + ( INPUT tagtype AS CHAR, INPUT tagtext AS CHAR, INPUT attributes AS CHAR ) : +/*------------------------------------------------------------------------------ + Purpose: Enclose the tagtext value in quotes + Notes: +------------------------------------------------------------------------------*/ + + RETURN "<" + tagtype + " " + attributes + ">" + + tagtext + + "". + +END FUNCTION. + +/* _UIB-CODE-BLOCK-END */ +&ANALYZE-RESUME + +&ENDIF + -- 2.11.4.GIT