Table of Contents
In this chapter, we're going to take a slightly different tack, we're going to just look at code segments you could choose to include within your application, primarily user interface components taken from the User Interface toolkit, WacsUI. This is not going to be an exhaustive review of what is available as that is covered in detail in the reference section, Chapter 9, WACS API: User Interface Module. Instead this is just a quick taster of just a few of the calls provided by the WacsUI toolkit.
So far we've been dealing with the various routines that are provided by the Core Wacs module - and these relate primarily to configuration parameters and security. There is a second module available for you to use called WacsUI, the WACS User Interface Toolkit. This concerns itself primarily with providing utility functions to ease the tasks of formatting and preparing data from the database into a form more suitable for use in web pages.
To include support for the WACS User Interface (WacsUI) toolkit within your application, you need to add the following extra lines to your code, ideally just after the Wacs core module.
and here's the perl dialect of the same activity...
NB: From Wacs 0.8.6, the WacsUI module now lives in a Wacs sub-directory and so needs to be called as Wacs::WacsUI instead of just WacsUI.
The first function from WacsUI that we're going to look at is called describeher and it is designed to take the output of the very regemented values of the model attributes fields of the database and turn them into something much more readable. Although not implemented yet this provides a good mechanism for doing other translations or providing an attribute table rather than a textual description.
Example 6.2. Using WacsUI: describeher
print $wacsui->describeher( array( 'hair'=>$results, 'length'=>results, 'titsize'=>results, 'pussy'=>results, 'race'=>results, 'build'=>results, 'height'=>results, 'weight'=>results, 'occupation'=>results))."\n";
We have to package up our parameter list as an array in order to pass it in Php; perl is somewhat simpler with a simple sequence of named parameters.
print describeher( hair=>$results, length=>$results, titsize=>$results, pussy=>$results, race=>$results, build=>$results, height=>$results, weight=>$results, occupation=>$results )."\n";
The above example is based upon modifying the MySimple example program
from in the second chapter (Chapter 2, Basics: Getting Started) to add the following
extra fields into the query:
mhair, mlength, mtitsize, mpussy, mrace, mbuild, mheight, mweight,
moccupation after the mimage (with a comma of course) and before
the from clause.
As with the previous
whatshedoes is designed to make a readable sentence from a
number of fixed format database fields. In this case however, it's a
little different as the values passed in are typically either Y for
yes, or N for no, and they are translated to a text phrase based upon
what they're value is. This also means that if you're using array
subscripts to fetch the database field values you need to be careful
about positioning. Give a yes to the wrong field and the error will
not be as obvious - while “blonde breasts” would be easy
to spot, the fact that each model who did masturbation scenes was
listed as doing straight scenes would be less apparent.
For the purposes of this example, we're adding yet more fields
to the select statement in the original MySimple program shown in the
second chapter (Chapter 2, Basics: Getting Started). In this case
mstraight, mlesbian, mfetish, mtoys, mmast and
Example 6.3. Using WacsUI: whatshedoes
print $wacsui->whatshedoes( array( 'solo'=>$results, 'straight'=>$results, 'lesbian'=>$results, 'fetish'=>$results, 'toys'=>$results, 'masturbation'=>$results, 'other'=>$results ) )."\n";
The same function works just the same in perl without the need for the array declaration wrapper:
print whatshedoes( solo=>$results, straight=>$results, lesbian=>$results, fetish=>$results, toys=>$results, masturbation=>$results, other=>$results)."\n";
feature fields that contain a space seperated list of keywords that mark
certain attributes found within that set. These can be quickly turned
into a small HTML table of icons using the routine addkeyicons. The fields
suitable for use with this are
scatinfo from the sets
mattributes from the models table. These are
passed as the first attribute; the second being the displayed size of the
icons which for the default icons would be a maximum of 48 x 48 pixels. The
function is called simply with:
In WACS 0.9.0 and later,
Where possible please update your existing code to pass