Consultor Eletrônico



Kbase P111586: How to display static images from different folders based on the WebSpeed environment
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   03/09/2008
Status: Verified

GOAL:

How to display static images from different folders based on the WebSpeed environment

GOAL:

How to display static images from different folders based on the WebSpeed Application Service Name

GOAL:

How to display static images from different folders based on the different WebSpeed broker

FACT(s) (Environment):

WebSpeed 3.x
WebSpeed 2.x
OpenEdge 10.x
All Supported Operating Systems

FIX:

The following code is a very simple demonstration of the SpeedScript example that shows how to display images from different folders that maps to web server's default virtual directory, wwwroot.  It uses  NUM-ENTRIES and ENTRY functions to isolate "WService=wsbroker1" from WebSpeed variable, appURL.  This way one can use IF..., THEN... logic to reference the image source from different sub directories on the wwwroot.  The URL used to run the .html page is

http://localhost/scripts/cgiip.exe/WService=wsbroker1/mytest.html

/**************************************************************************/
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<META NAME="AUTHOR" CONTENT="Your Name">
<TITLE>WebSpeed Dynamic Environment</TITLE>
<SCRIPT LANGUAGE="SpeedScript">
/* 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.
</SCRIPT>
</HEAD> <BODY>
<SCRIPT LANGUAGE="SpeedScript">
  /*------------------------------------------------------------------
    File:
    Description:
    Created:
  -------------------------------------------------------------------*/ DEFINE VARIABLE i AS INTEGER NO-UNDO. DEFINE VARIABLE AppService AS CHAR NO-UNDO. REPEAT i = 1 TO NUM-ENTRIES(AppUrl, "/" ):
       AppService= ENTRY(4,AppURL, '/'). END. /* {&OUT} appService "<br>" . */ IF appService = "WService=wsbroker1" THEN
    DO:
</SCRIPT> <img src= "/dev.gif" > <SCRIPT LANGUAGE="SpeedScript">     END.     ELSE DO:
   
</SCRIPT> <img src= "/images/prod.gif" > <SCRIPT LANGUAGE="SpeedScript">

    END.

</SCRIPT> </BODY>
</HTML>

/**************************************************************************/