Specifications
She can also click on the View Mail button, which will show her all the unsent newsletters in
the system, if she wants to preview and send mail later. The View Mail button activates the
view-mail action, which triggers the following code:
case ‘view-mail’ :
{
display_items(“Unsent Mail”, get_unsent_mail(get_email()),
‘preview-html’, ‘preview-text’, ‘send’);
break;
}
As you can see, this again uses the display_items() function with buttons for the
preview-html, preview-text, and send actions.
One interesting point to note is that the “Preview” buttons do not actually trigger an action, but
instead link directly to the newsletter in the archive. If you look back at Listings 28.6 and
28.15, you will see that we use the
display_preview_button() function to create these
buttons, instead of the usual display_button() function.
The display_button() function creates an image link to a script with GET parameters where
required; the display_preview_button() function gives a plain link into the archive. This link
will pop up in a new window, achieved using the target=new attribute of the HTML anchor
tag. You can see the result of previewing the HTML version of a newsletter in Figure 28.14.
Building a Mailing List Manager
C
HAPTER 28
28
BUILDING A
MAILING LIST
MANAGER
703
FIGURE 28.14
A preview of an HTML newsletter, complete with images.
34 7842 CH28 3/6/01 3:46 PM Page 703