&ANALYZE-SUSPEND _VERSION-NUMBER AB_v9r12 GUI /* Procedure Description "Custom CGI Wrapper Template Use this template to create a new Custom CGI Wrapper Procedure and write WebSpeed code that dynamically generates HTML. No associated static HTML file is needed." */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _DEFINITIONS Procedure /*------------------------------------------------------------------------ File: Description: Input Parameters: Output Parameters: Author: Created: ------------------------------------------------------------------------*/ /* This .W file was created with the Progress AppBuilder. */ /*----------------------------------------------------------------------*/ /* Create an unnamed pool to store all the widgets created by this procedure. This is a good default which assures that this procedure's triggers and internal procedures will execute in this procedure's storage, and that proper cleanup will occur on deletion of the procedure. */ CREATE WIDGET-POOL. /* *************************** Definitions ************************** */ /* Parameters Definitions --- */ /* Local Variable Definitions --- */ /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-PREPROCESSOR-BLOCK /* ******************** Preprocessor Definitions ******************** */ &Scoped-define PROCEDURE-TYPE Procedure /* _UIB-PREPROCESSOR-BLOCK-END */ &ANALYZE-RESUME /* *********************** Procedure Settings ************************ */ &ANALYZE-SUSPEND _PROCEDURE-SETTINGS /* Settings for THIS-PROCEDURE Type: Procedure Template Allow: Frames: 0 Add Fields to: Neither Other Settings: CODE-ONLY */ &ANALYZE-RESUME _END-PROCEDURE-SETTINGS /* ************************* Create Window ************************** */ &ANALYZE-SUSPEND _CREATE-WINDOW /* DESIGN Window definition (used by design tool only) CREATE WINDOW Procedure ASSIGN HEIGHT = 14.15 WIDTH = 60.57. */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _XFTR "Cue Card" Procedure _INLINE /* Actions: adecomm/_so-cue.w ? adecomm/_so-cued.p ? adecomm/_so-cuew.p */ /* Custom CGI Wrapper Procedure,wdt,49681 A Custom CGI Wrapper Procedure allows you to write WebSpeed code to dynamically generate HTML. No associated static HTML file is needed. CREATING A MASTER Step 1 Write code that sends HTML to the "webstream". Step 2 Save this Master file as a new .w file. TO USE THE NEW MASTER FILE WITH YOUR TRANSACTION SERVER Step 1 Copy the .w file to the computer running the Transaction Server. Step 2 Compile the .w file to .r code using the WebSpeed compiler. Step 3 Test it with your favorite WEB browser. */ /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _INCLUDED-LIB Procedure /* ************************* Included-Libraries *********************** */ {src/web/method/wrap-cgi.i} /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _CUSTOM _MAIN-BLOCK Procedure /* ************************ Main Code Block *********************** */ /* Process the latest WEB event. */ RUN process-web-request. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME /* ********************** Internal Procedures *********************** */ &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE output-header Procedure PROCEDURE output-header : /*------------------------------------------------------------------------------ Purpose: Output the MIME header, and any "cookie" information needed by this procedure. Parameters: Notes: In the event that this Web object is State-Aware, this is also a good place to set the "Web-State" and "Web-Timeout" attributes. ------------------------------------------------------------------------------*/ /* * To make this a state-aware Web object, pass in the procedure handle and * timeout period (in minutes). If you supply a timeout period greater than * 0, the Web object becomes state-aware and the following happens: * * - 4GL variables web-state and web-timeout are set * - a cookie is created for the broker to id the client on the return trip * - a cookie is created to id the correct procedure on the return trip * * If you supply a timeout period less than 1, the following happens: * * - 4GL variables web-state and web-timeout are set to an empty string * - a cookie is killed for the broker to id the client on the return trip * - a cookie is killed to id the correct procedure on the return trip * * Example: Timeout period of 5 minutes for this Web object. * * RUN set-web-state IN web-utilities-hdl (THIS-PROCEDURE, 5.0). * */ /* * Output additional cookie information here before running outputContentType. * For more information about the Netscape Cookie Specification, see * http://home.netscape.com/newsref/std/cookie_spec.html * * Name - name of the cookie * Value - value of the cookie * Expires date - Date to expire (optional). See TODAY function. * Expires time - Time to expire (optional). See TIME function. * Path - Override default URL path (optional) * Domain - Override default domain (optional) * Secure - "secure" or unknown (optional) * * The following example sets cust-num=23 and expires tomorrow at (about) the * same time but only for secure (https) connections. * * RUN SetCookie IN web-utilities-hdl * ("cust-num":U, "23":U, today + 1, time, ?, ?, "secure":U). */ output-content-type ("text/html":U). END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME &ANALYZE-SUSPEND _UIB-CODE-BLOCK _PROCEDURE process-web-request Procedure PROCEDURE process-web-request : /*------------------------------------------------------------------------------ Purpose: Process the web request. Parameters: Notes: ------------------------------------------------------------------------------*/ /* * Output the MIME header and set up the object as state-less or state-aware. * This is required if any HTML is to be returned to the browser. */ RUN output-header. {&OUT} "":U SKIP "":U SKIP " {&FILE-NAME} ":U SKIP "":U SKIP "":U SKIP . /* Output your custom HTML to WEBSTREAM here (using {&OUT}). */ {&OUT} "":U SKIP "":U SKIP . END PROCEDURE. /* _UIB-CODE-BLOCK-END */ &ANALYZE-RESUME