/* Set the web-request trigger. */
ON "WEB-NOTIFY":U ANYWHERE DO: OUTPUT {&WEBSTREAM} TO "WEB":U. /* Parse the request/CGI from the web server. */ RUN init-cgi IN web-utilities-hdl. /* Initialize for web-request. */ RUN init-request IN web-utilities-hdl. AppProgram = (IF AppProgram = "debug":U THEN "webutil/debug.p":U ELSE (IF AppProgram = "ping":U THEN "webutil/ping.p":U ELSE (IF AppProgram = "reset":U THEN "webutil/reset.p":U ELSE AppProgram))). RUN run-web-object IN web-utilities-hdl (AppProgram) NO-ERROR. /* Run clean up and maintenance code */ RUN end-request IN web-utilities-hdl NO-ERROR. /* Output any pending messages queued up by queue-message() */ IF available-messages(?) THEN output-messages("all", ?, "Messages:"). OUTPUT {&WEBSTREAM} CLOSE. END. /* ON "WEB-NOTIFY" */ /* Wait for a web-request to come in */ WAIT-FOR-BLOCK: REPEAT ON ERROR UNDO WAIT-FOR-BLOCK, LEAVE WAIT-FOR-BLOCK ON QUIT UNDO WAIT-FOR-BLOCK, LEAVE WAIT-FOR-BLOCK ON STOP UNDO WAIT-FOR-BLOCK, NEXT WAIT-FOR-BLOCK: WAIT-FOR "WEB-NOTIFY":U OF DEFAULT-WINDOW. END. /* WAIT-FOR-BLOCK: REPEAT... */ |
/* Set the web-request trigger. */
ON "WEB-NOTIFY":U ANYWHERE DO: DEFINE VARIABLE vLocn AS INTEGER NO-UNDO. OUTPUT {&WEBSTREAM} TO "WEB":U. /* Parse the request/CGI from the web server. */ RUN init-cgi IN web-utilities-hdl. /* Initialize for web-request. */ RUN init-request IN web-utilities-hdl. /* Remove current extension */ vLocn = R-INDEX (AppProgram, "."). IF vLocn > 0 THEN AppProgram = SUBSTR (AppProgram, 1, vLocn - 1). /* Add a .R */ AppProgram = AppProgram + ".r". /* Can this User run this program OR does it exist? */ IF NOT CAN-FIND (UserPrograms WHERE UserPrograms.UserID = UserID AND UserPrograms.Program = AppProgram) OR SEARCH (AppProgram) = ? THEN AppProgram = "NotValidProgram.r". RUN run-web-object IN web-utilities-hdl (AppProgram) NO-ERROR. /* Run clean up and maintenance code */ RUN end-request IN web-utilities-hdl NO-ERROR. /* Output any pending messages queued up by queue-message() */ IF available-messages(?) THEN output-messages("all", ?, "Messages:"). OUTPUT {&WEBSTREAM} CLOSE. END. /* ON "WEB-NOTIFY" */ |