Can someone help with new user to webspeed?

sxgt

New Member
I have recently been assigned to pretty up the presentation of a webspeed store. I looked as some of the code saw where the html was and thought it should be pretty easy to modify the .p files to include my new html template.

Whenever I modified the code and had someone else compile it the site quit working. So I started investigating. This is what I have found so far:

Site runs a transaction webserver (Apache) running webspeed 2.1 running E-Framework by ISS. There is a separate progress db server. I am not sure if the programs I am trying to modify are HTML Mapped or just 4gl markup. I think the latter since I do not see any speedscript and the web site directly accesses the .p files like they are html files.

Can someone review this code and tell me if I should be able to write simple html directly or does it need to be sent thru a compiler like Workshop? Again after I make my changes I ahve to send to someone who is compiling it somehow. Not sure how yet. They are being a little difficult about the site setup and webspeed. Probably due to lack of knowledge. Once they compile and upload to the site the site breaks. My modifications were pretty simple. I tried to add a image reference at the bottom of the file to test my syntax.
The rules I am using are all html must start with {&out} and end with a period. Also I am not quite sure when I have to use a skip. Anytime I need a double quote I must use a singlequote instead. Other than than that I cannot find the syntax rules that match what this file is doing. Documentation for 2.1 is hard to find.

Questions I have:
1. What type of code is this? I assume a 4gl type versus the HTML Mapped.
2. Where can I get reference materials that look like this. I cannot find definition for {&out} on Progoress site anywhere. Am I looking in the wrong place.
3. Based on the code how should I modify it just to add my HTML syntax.
4. Is there any online formal documentation for 2.1 or do I just try to use 3.1d?



The error messages I get are like:

*********************Error Messages from the site:
Content-Type: text/plain ** Unable to understand after -- "<". (247) ** Invalid statement. (254) ** /pt/wt/wtapp/tpt/tpthome/storefront/custom2/catdisp2.p Could not understand line 1. (198) ** Named stream WebStream must be defined before using. (593) ** /pt/wt/wtapp/tpt/tpthome/storefront/custom2/catdisp2.p Could not understand line 64. (196) ** Named stream WebStream must be defined before using. (593) ** /pt/wt/wtapp/tpt/tpthome/storefront/src/cathist1.i Could not understand line 34. (196) ** Named stream WebStream must be defined before using. (593) ** /pt/wt/wtapp/tpt/tpthome/storefront/src/cathist1.i Could not understand line 41. (196) ** Named stream WebStream must be defined before using. (593) ** /pt/wt/wtapp/tpt/tpthome/storefront/src/cathist1.i Could not understand line 53. (196) ** Named stream WebStream must be defined before using. (593) ** /pt/wt/wtapp/tpt/tpthome/storefront/src/cathist1.i Could not understand line 79. (196) ** Named stream WebStream must be defined before using. (593) ** /pt/wt/wtapp/tpt/tpthome/storefront/src/cathist1.i Could not understand line 82. (196) ** Named stream WebStream must be defined before using. (593) ** /pt/wt/wtapp/tpt/tpthome/storefront/custom2/catdisp2.p Could not understand line 71. (196) ** Named stream WebStream must be defined before using. (593) ** /pt/wt/wtapp/tpt/tpthome/storefront/custom2/catdisp2.p Could not understand line 74. (196) ** Named stream WebStream must be defined before using. (593) ** /pt/wt/wtapp/tpt/tpthome/storefront/custom2/catdisp2.p Could not understand line 123. (196)

*****************End of Error Messages.

*****************Begin .p file code for review
/*

catdisp2.p: Display the catalog metaschema (super-categories).

History:

--------

09/01/98: PJG Initial coding.

ISS01 09/04/98 BH Added zoom logic to end item.

03/16/01 JCW(ISS) Add Suggested Retail Price and change the price to

discounted price



Function:

---------

Displays the catalog metaschema hierarchy. It is called from catdisp0.p

which has already retrieved the records to display in order in the

tt-cat temporary table.

TO DO:

------

Handle error situation of bad tt-rowid.



*/

{src/web/method/wrap-cgi.i}

{wdmdeclr.i}

{catdisp.i} /* Definition of stt-cat temporary table. */

{catdisp2.i} /* Function definitions. */

define variable vl-has-options as logical no-undo.

define variable vl-has-stock as logical no-undo.

define variable vi-counter as integer no-undo.

define variable vl-do-show-link as logical no-undo.

define variable vc-history as character no-undo.

/*ISS01*/ define variable vc-run-pgm as character no-undo.

define variable vc-short-link as character no-undo.

define variable vd-qty-avl as integer no-undo.

define variable vl-error as logical no-undo.

define variable vl-err-msg as character no-undo.

define variable vc-site as character no-undo.

define variable vd-list-price as decimal no-undo format "$>,>>9.99".

define variable vd-price as decimal no-undo format "$>,>>9.99".

define variable vc-price-msg as character no-undo.

define variable vc-qty-msg as character no-undo.

define variable vi-end-item-count as integer no-undo.

define variable vc-end-category as character no-undo.

define variable vc-prior-category as character no-undo.

define variable vl-is-display-only as logical no-undo.

/* define variable vc-temp-char as character no-undo. */

/*mwk*/ define variable vd-qty as decimal no-undo.

/*mwk*/ define variable vc-part as character no-undo.

MAIN-BLOCK:

do:



/* Output a standard HTTP Header */

output-content-type (" text/html").





find pf_mstr where

pf_us_id = "WEB_STORE" and

pf_group = get-value("h_store_id") and

pf_attr = "CATALOG_BGCOLOR" no-lock no-error.

if avail pf_mstr then

vc-temp-char = pf_value.



/* this has to come from envcolorl.i */

{&out}

"<html>" skip

"<body " vc-temp-char ">" skip.

{cathist1.i} /* Display catalog history */



/* Output the form tag. */

{&out} "<form action=wssod.w method=post>" skip.



/* Output the table which displays the end items and categories */

{&out} "<table border=0>" skip.



/*

/* Display a horizontal rule to separate the history */

{&out}

"<tr>" skip

"<td colspan=2>" skip

"<hr>" skip

"</td>" skip

"</tr>" skip.



*/

CAT-LOOP:

for each stt-cat exclusive-lock:

accumulate 1 (count).



find catd_det where

rowid(catd_det) eq tt-rowid

no-lock no-error.

/* Need logic for when not available */



vl-do-show-link =

get-value("h_text_only") eq "No" and

catd_short_link <> "".



/* in a search? show the pictures */

if substr(entry(1,vc-history),1,14) eq "Search results"

/*cGetSessValue("h_keywords") ne "" and

cGetSessValue("h_keywords") ne ? */ and

catd_short_link <> ""

then

vl-do-show-link = yes.

vl-is-display-only = can-do(catd_flags,"display-only":U).

vc-short-link = if catd_short_link = ""

then

"/tptimage/noimage.gif"

else

catd_short_link.

/* Categories */

if not lIsEndItem(tt-rowid) then

do:

/* This is a category and cannot be purchased. */

{&out} "<tr>"

"<td colspan=2 >"

"<font face=arial size=3><b>".

/* Generate a "zoom" tag. */

{&out}

"<a href='"

"catdisp0.p"

"~?h_text_only="

string(get-value("h_text_only") eq "Yes"

and (cGetSessValue("h_keywords") eq "" or

cGetSessValue("h_keywords") eq ?))

"~&h_cat=" url-encode(catd_end_item,'query')

"~&h_max_level=0"

"~&h_current_level="

string(

integer(get-value('h_current_level')) + 1)

"~&h_token=" url-encode(get-value("h_token"),'query')

"&h_lang=" get-value("h_lang")

"&h_store_id="

url-encode(get-value("h_store_id"),'query')

"' target=f_cat_detail>" skip.

if vl-do-show-link

then

{&out}

"<img border=0 " skip

" src=" vc-short-link skip

" alt='" catd_short_desc "'>" skip

"<font face=arial size=1>"

"Click on image for more details"

"</font></font>" skip.

else

{&out}

catd_short_desc skip.



/* Close the link, the cell and the row. */

{&out}

"</a>" skip

"</td>" skip

"</tr>" skip.

/* Display a horizontal rule */

{&out}

"<tr><td colspan=2><hr></td></tr>" skip.

end. /* Category */

else

END-ITEM-BLOCK:

do:



/*

Here we are displaying the end item and an action bar

to allow the user to buy this item.

*/

/* Show the short picture with zoom capability */



/* Start the row and the image cell */

{&out} "<tr>" skip.

if vl-is-display-only then

{&out} "<td colspan=2 align=center>" skip.

else

{&out} "<td rowspan=2 align=center>" skip.

/*

If this is an end-item and it flag is not "display-only"

then generate a "zoom" tag.

*/

if not vl-is-display-only then

do:

/* Add to the end item count */

vi-end-item-count = vi-end-item-count + 1.

{&out}

"<a href=catdisp4.p"

"~?h_text_only="

string(get-value("h_text_only") eq "Yes"

and (cGetSessValue("h_keywords") eq "" or

cGetSessValue("h_keywords") eq ?))

"~&h_cat=" url-encode(catd_end_item,'query')

"~&h_max_level=0"

"~&h_current_level="

string(

integer(get-value('h_current_level')) + 1)

"~&h_token=" url-encode(get-value("h_token"),'query')

"&h_lang=" get-value("h_lang")

"&h_store_id="

url-encode(get-value("h_store_id"),'query')

" target=f_cat_detail>" skip.



/* Show the description or the image */

if vl-do-show-link

then

{&out}

"<img border=0 " skip

" src=" vc-short-link skip

" alt='" catd_short_desc "'></a><br>" skip

"<font face=arial size=1>"

"Click on image for more details"

"</font></font>" skip.

else

{&out} "<font size=-1>" catd_short_desc "</a>" skip.



end. /* if we are not a "display-only" item. */

else

do:

{&out} catd_long_desc.



end. /* we are a display-only item. */

/* End the image cell */

{&out}

"</td>" skip.



/*

Start the action bar cell with description underneath.

However, skip this for a "display-only" end item.

*/

if not vl-is-display-only then

do:

{&out}

"<td nowrap>" skip.



/* Show the Action Bar */

/* If there are any simple options, display them now.

Set the options flag. */

{catopt0.i}

/* Check the stock status if there were no options.

If there is no stock, do not allow the user to

purchase the product. */

vd-qty-avl = 0.

vl-error = no.

vl-err-msg = "".

if not vl-has-options then

/*mwk run catqty1.p

(input catd_reference, /* Part */

input-output vc-site, /* Site */

output vd-qty-avl, /* Quantity available */

output vl-error, /* Error flag */

output vl-err-msg). /* Error message */

*/

/*fjs

/* Get the price and qty from Portal */

run ircatpric1.p

(input catd_reference, /* Part */

output vd-price, /* Item price */

output vd-qty, /* Qty */

output vc-part, /* Part */

output vl-error, /* Error flag */

output vl-err-msg). /* Error message */

*/

vd-price = decimal(entry(4,catd_reference,":")) no-error.

vd-qty = decimal(entry(5,catd_reference,":")) no-error.

if num-entries(catd_reference,":") >= 6 then

vd-list-price = decimal(entry(6,catd_reference,":")) no-error.

else vd-list-price = 0.



/*(xxx)*/ if can-find(first pf_mstr where

pf_us_id = "WEB_STORE" and

pf_group = "CATALOG_OPTIONS" and

pf_attr = "ALLOW_OVER_STOCK" and

pf_value = "YES") OR

/*mwk vd-qty-avl > 0 or vl-has-stock */

vd-qty > 0 or vl-has-stock

then

do:



/* Display the quantity. */

{&out}

"<font color=#000099><b>Quantity:</b></font>" skip

"<input type=text " skip

" name=h_wssod_qty" vi-end-item-count skip

" maxlength=6 " skip

" align=bottom " skip

" size=6>" skip.



/* Display the "add to cart" button. */

{&out}

"<input type=image " skip

" name=b_add_to_cart " skip

" alt='Add to Cart'" skip

" src=/tptimage/add_cart.gif " skip

" border=0" skip

" align=top>" skip.



end. /* if the qty_avail > 0 */

else

do:



/* Display a message */

{&out}

"<font face=arial size=2><b>"

"This item is currently out of stock."

"</b></font>" skip.

/* Display the fill-in as a hidden field. */

{&out}

"<input type=hidden " skip

" name=h_wssod_qty" vi-end-item-count ">" skip.



end. /* If the item is out of stock. */



/* End the action bar cell and the row holding it. */

{&out}

"</td>" skip

"</tr>" skip.



/* Show the short description and item number */

{&out}

"<tr>" skip

"<td valign=top>" skip

"<font size=-1>" skip

catd_short_desc skip

"<br>" skip

"<b><font color=#000099>Item Number:</b></font>" skip

catd_end_item skip

"<br>" skip.



/*(001)*/ /* For option items, display a table with the options

prices and the stock status. */

{catopt1.i}







/* Show the stock status */

/*mwk run catqty1.p

(input catd_reference, /* Part */

input-output vc-site, /* Site */

output vd-qty-avl, /* Quantity available */

output vl-error, /* Error flag */

output vl-err-msg). /* Error message */



if vl-error then

vc-qty-msg = "N/A".

else

vc-qty-msg = string(vd-qty-avl).

*/

if vl-error then

vc-qty-msg = "N/A".

else

vc-qty-msg = string(vd-qty).

/*(xxx)*/ if can-find(first pf_mstr where

pf_us_id = "WEB_STORE" and

pf_group = "CATALOG_OPTIONS" and

pf_attr = "SHOW_STOCK_QTY" and

pf_value = "YES") AND

vc-qty-msg ne "N/A" then

/*(xxx)*/ do:



{&out}

"<b><font color=#000099>"

"Quantity in stock:"

"</b></font>" skip

vc-qty-msg skip

"<br>" skip.



/*(xxx)*/ end. /* if vc-qty-msg ne "N/A" */

/*mwk



/* Get the price */

run catpric1.p

(input catd_reference, /* Part */

output vd-price, /* Item price */

output vl-error, /* Error flag */

output vl-err-msg). /* Error message */

*/

/* JCW */

if vl-error then

vc-price-msg = "N/A".

else vc-price-msg = string(vd-list-price,"$>>,>>9.99").

if vc-price-msg ne "N/A" then

{&out}

"<b><font color=#000099>Suggested Retail Price:"

"</font></b>" skip

vc-price-msg "<br>" skip.

if vl-error then

vc-price-msg = "N/A".

else

vc-price-msg = string(vd-price,"$>>,>>9.99").



if vc-price-msg ne "N/A" then

{&out}

"<b><font color=#000099>Your Discounted Price:</b></font>" skip

vc-price-msg skip

"<br>" skip

"</td>" skip

"</tr>" skip.

end. /* if we are supposed to show the detailed information.*/



/* Display a Horizontal Rule */

{&out}

"<tr><td colspan=2><hr></td></tr>" skip.



/* Display the required form elements when not

display only. */

if not vl-is-display-only

then

{&out}

"<input type=hidden "

" name=h_wssod_end_item" vi-end-item-count

/*(pxg)*/ " value=""" catd_end_item """>" skip.

/* /*(pxg)*/ " value='" url-encode(catd_end_item,"query") "'>" skip.

*/

end. /* END-ITEM-BLOCK */



delete stt-cat.

end. /* for each stt-cat (CAT-LOOP) */

if (accum count (1)) eq 0 then

do:

{&out} "There are no more sub-categories or end items "

"to display." skip.

end.

/* Close the body and html */

{&out}

"</table>" skip

"<input type=hidden name=h_count value="

vi-end-item-count ">" skip

"<!-- Standard fields -->" skip

"<input type=hidden name=m-token value="

get-value("h_token") ">" skip

"<input type=hidden name=h_token value="

get-value("h_token") ">" skip

"<input type=hidden name=h_form value='catalog'>" skip

"<input type=hidden name=h_end_category value=" vc-end-category

">" skip.

/* Close the form */

{&out} "</form>" skip.

{cathist1.i} /* Display catalog history */



{&out}

"<table border='0' cellpadding='0' cellspacing='0' width='722'>" skip

"<tr>" skip

"<td valign='top' width='58' height='20'><img" skip

"src='/sykes/assets/images/auto_generated_images/clearpixel.gif'"

"width='58' height='1'></td>" skip

"<td valign='top' width='469'><img" skip

"src='/sykes/assets/images/auto_generated_images/clearpixel.gif'"

"width='469' height='1'></td>" skip

"<td valign='top' width='195'><img" skip

"src='/sykes/assets/images/auto_generated_images/clearpixel.gif'" skip

"width='195' height='1'></td>" skip

"</tr>"

"<tr>"

"<td valign='top'></td>" skip

"<td valign='top' width='469'><p align='center'><font" skip

"size='1' face='Arial, Helvetica, sans-serif'>If you have" skip

"questions or comments about this site please contact the" skip

"webmaster. Copyright ) 2000 Ingersoll-Rand Company, All" skip

"rights reserved.</font></p>" skip

"<p align='left'><font size='1'" skip

"face='Arial, Helvetica, sans-serif'><img" skip

"src='/irpeg/footer.gif'>Ingersoll-Rand Company/Tool and" skip

"Hoist <br>" skip

"xBusiness Development Center 1467 Route 31 South P.O. Box" skip

"970 Annandale, NJ 08801 USA</font></p>" skip

"</td>" skip

"<td valign='top'></td>" skip

"</tr>" skip

"</table>" skip

"</body>" skip

"</html>" skip.



end. /* MAIN-BLOCK */

 

Casper

ProgressTalk.com Moderator
Staff member
Hi sxgt,

I'll try to answer (some of) your quetions:
1: The code you are using is Progress. (4GL).
2: &Out is a so called preprocessor which is a predefined constant. It stands for: Output stream webstream unformatted. A stream is written to a file. In this case it's html. So everything you write after &out will be written as a line to a file. Every progress statement has to end with a period. so that's why you have to put a period at the end of each line.
3. To change only the html you only have to change everything which starts with &out. it's also posible to write multiple lines of html with 1 &out if you want a nweline you just write something like: ".... html first line... " + CHR(10) + "..... html second line... " + CHR(10) + etc......
4 try also looking at the progress library psdn.progress.com

The problem with quotes is that progress has to now where a quote starts and where it ends so if you want a " in &Out you can do 2 things:
&out ' this is a double quote: " '. or
&Out " this is a double quote: ~" ".
with the ~ you tell progress to read this caharacter explicitly as a character.


There are two ways in writing html pages with webspeed:
1 with a so called cgi-wrapper (the example you send) this is progress which streams out the html (&OUT)
2 A more elegant way: make a procedure which generates the data needed for a specific pages and run a html page from this procedure with the progress emebedded in the html page (kinda like jsp pages).

I think you may need help of a progress programmer to simplify your work. Try to make a plan of action. Your work should be altering the html pages and his/her work should be making the progress code for the proper working of the programs.

Any changes you make in the program results in compliling the programm 4 the effects of changes to take place. Unless you are using static html pages which have no progress in them.

Casper.
 
Top