To turn on the TEAPOT feature, all you need to do is to define the scheme file "teapot" (scheme%teapot&). At the moment, the only object to present is data records. In the "teapot" scheme file, only one variable is needed: DatabaseObject. For example, if you have
DatabaseObject=dbo
then scheme%dbo& contains the database object defination. Here is an example:
table=Product
keyfield=ID
encode:IssuedDate=strtotime decode:IssuedDate=strftime:%d-%b-%Y
match:Name=substr match:IssuedDateFrom=min:IssuedDate match:IssuedDateTo=max:IssuedDate match:PriceFrom=min:Price match:PriceTo=max:Price match:RecordPath=rlike
Default:RecordPath={_recordpath}
rpp:view=5 ppb:view=10 rpp:edit=10 ppb:edit=10
The first part is the database object (dbobj) initialisers. The other part starting from Default is for the Data Record Browser (DRB).
The variable "rpp" stands for "records per page" and "ppb" "pages per block". (Block loosely means the navigation bar.)
There are two modes: "view" and "edit". Mode "view" is for the visitor to display data records from, say, a search result, and mode "edit" is for the "data editor" to update data records in the database.
There are two quantities: "one" and "many". Quantity "one" means the layout contains only one data record, and quantity "many" is for multiple data records.
So instead of only one layout as in TCB, you have four layouts in DRB: "view one", "view many", "edit one" and "edit many".
The designer specifies the layout with the curly bracketed variables (e.g. {Price}). Any applications that process those values should get it from session%teapot:var. For example, session%teapot:Price contains the Price value of the data record after a "view one" page is shown.
|