The following XML file (emailsubmit.xml) is the initial file loaded (version 2.0)
The following program will call the script 'emailsubmit.php' script while passing the
values from taken from the widgets named, 'email', 'emailfrom', 'emailto' and 'subject'
On line 11 is the actuall attribute that makes the call to the script, it reads:
execute the method 'loadGui' on the 'mainpanel' widget (Line 02) whenever
the 'action' event is triggered (the action event is triggered on the mousereleased
or the keyreleased event on the button).
The values passed are set on Line 03 in the widget 'mainpanel',
and is set by the setData attribute (the %2c is an encoded comma, this is
necessary otherwise it would appear to the parser that your are trying to
call the method setData that takes four parameters (i.e. setData(string,string,string,string) )
however setData ONLY takes a single parameter, so as not to confuse the Bambookit parser,
we encode the commas
Note: for version 1.6 the setData attribute would be set at Line 10, this is due to the limitation
of the old addActionTarget event which 'assumed' it would be executed from the widget
it was called from, and it also 'assumed' the event it would be listening for is an action
The following php file (emailsubmit.php) is the script that is called to process the file (version 2.0)
The output of this script is an
XML file that is loaded by the Bambookit GUI. We will highlight specific aspects
of this script
Line 02 retrieves the client IP (sometimes this IP is the address of the ISP that the client
is dialing from, to obtain a more comprehensive check, check the various refrences available
Line 03 retrieves the data passed in the URL string (PHP 4 and higher requires that you specify
the values you wish to retrieve, in older versions this was not necessary)
Line 04 does a very simple check to verify a valid email address, if the email string contains
the '@' sign then we would assume it is a valid email address
Line 09, this is the actual call to send an email notification to $emailto with the body of $email
and the IP address $domain passed along
Line 11, do NOT name the widget 'mainpanel', this is important because this widget is a child of
the original widget named 'mainpanel'. Also if we name it 'mainpanel' we would get the undesirable
effect of nested children, by executing the loadGui method it would add itself to the child 'mainpanel'
and not the parent 'mainpanel'.
Line 13 could easily be updated to reflect the current $email value instead of hardcoding the
string 'firstname.lastname@example.org'. This is left as an exercise (for guidance look at line 19)
Line 17 since this email was succesfully sent we disabled the button, setEnabled="false"
Line 19 in the status bar we indicate that the email was successfully sent and we also post the
client IP address.
Line 24 this widget is sent if the email is invalid (missing the '@' symbol), the only difference
is that the submit button remains enabled and the label in the statusbar is different