Penguin Greetings is copyright © Edouard Lagache, 2003-2005. Penguin Greetings is released under the GNU General Public License, Version 2. For more information, see the COPYING file included with this software or visit: http://www.gnu.org/copyleft/gpl.html
The artistic content included with this software is also
copyright © Edouard Lagache, 2003-2005. It is released
under the Design Science License. For more information, see
the DSL.txt file included with the software or visit: http://www.dsl.org/copyleft/.
Powered by Penguin Greetings
web badge
If you use Penguin
Greetings in your own web cards application.
Please give credit were credit is due by displaying the
following web badge or something equivalent on your web
site:
There are now quite a few different badges included in Penguin Greetings with the various secondary ecard sites, so take a look if you want something different. Better still, if you make a nicer web badge, please share it with me so that I can spread the wealth!
# File: cards.conf ###################################################################### # Greeting card configuration file for # # ** PENGUIN GREETINGS (pgreet) ** # # A Perl CGI-based web card application for LINUX and probably any # other UNIX system supporting standard Perl extensions. # # Edouard Lagache, elagache@canebas.org, April 2003 # # # The pgreet system uses the Perl Config::General module for # reading in configuration file information. The file format # is the same as for the Apache web server. The general # configuration module contains information for both the # CGI script and the system daemon. These are kept in # separate categories for simplicity of management. # ###################################################################### # Card category definitions: # .... <category Birthday> caption = "Birthday Cards" cards = Birthday_blooms_on_trail cards = Bay_bridge_birthday cards = Fishing_Birthday </category> # .... # 21 <card Fishing_Birthday> caption = "Fishing around for a way to say: Happy Birthday!" template = "picture_frame_card.tpl.html" image = "Fishing_Birthday.jpg" thumb = "Fishing_Birthday.thb.jpg" </card> # .... |
[# # Penguin Greetings HTML/Embperl template for an HTML formatted # greeting card. # # This template is usually called from within # other template either for previewing or displaying a card. # # E. Lagache, 3/2003 #] [# Set Embperl options to avoid interpreting characters that could be URLs #] [* $ENV{'optRawInput'} = 16; *] [* $escmode = 0; *] [# Interface with Penguin Greeting script (pgreet.pl.cgi) #] [$ var $trans %card_hash %card $] [- # Retrieve parameters from Penguin Greetings script (pgreet.pl.cgi) $trans = shift(@param); # $trans is a hash reference # All card configuration data %card_hash = %{$trans->{'card_hash'}}; # "record" for selected card. %card = %{$card_hash{'card'}->{$trans->{'card'}}}; -] <center> <table cellpadding="2" cellspacing="4" border="2" style= "text-align: left; width: 400px;"> <tbody> <tr align="center"> <td style="vertical-align: top;"> [# retrieve image URL and image name #] <img src="[+ $trans->{'imageurl'} +]/[+ $card{'image'} +]"><br> </td> </tr> <tr> <td style="vertical-align: top;"> <table cellpadding="2" cellspacing="2" border="0" style="text-align: left; width: 100%;"> <tbody> <tr> <td style="vertical-align: top;"><span style= "font-family: times new roman,times,serif; font-style: italic;"> [# Insert the message text #] [+ $trans->{'html_message'} +] </span><br> </td> </tr> <tr> <td style="vertical-align: top;"> <br> <font size="-1"><br> </font> <table cellpadding="2" cellspacing="2" border="1" style= "text-align: left; width: 100%;"> <tbody> <tr> <td style= "vertical-align: top; width: 50%;"> <font size="-1"> [# Insert the sender's name and email #] From: [+ $trans->{'sender_name'} +]<br> [+ $trans->{'sender_email'} +]</font><br> </td> <td style="vertical-align: top;"> <font size="-1"> [# Insert recipients name and email #] To: [+ $trans->{'recipient_name'} +]<br> [+ $trans->{'recipient_email'} +]</font></td> </tr> </tbody> </table> <br> <div style="text-align: center;"> <a href="http://www.canebas.org/pgreet/"> <img src="[+ $trans->{'imageurl'} +]/powered_by_pgreet.gif" border="0" align="center"></a> </div> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </center> |
[*
$ENV{'optRawInput'} = 16; *] [* $escmode = 0; *] [- # Retrieve parameters from Penguin Greetings script (pgreet.pl.cgi) $trans = shift(@param); -] Dear [+ $trans->{'recipient_name'} +], [+ $trans->{'sender_name'} +] has sent you a Penguin Greeting! If your email reader doesn't support email with images, you can view your Penguin Greeting on the world wide web. Just point your browser to: [+ $trans->{'URL_short_cut'} +] and, if needed, enter the following information: Card ID: [+ $trans->{'number'} +] Password: [+ $trans->{'password'} +] The text of the message from [+ $trans->{'sender_name'} +] is provided below: ----------------------------------------------------------------- [+ $trans->{'message'} +] ----------------------------------------------------------------- We hope you enjoy your Penguin Greeting! |
%card_hash = ( 'card' => { 'Flower_in_rocks' => { 'template' => 'picture_frame_card.tpl.html', 'caption' => 'Californian Poppy in rocky ground', 'thumb' => 'Flower_in_rocks.thb.jpg', 'image' => 'Flower_in_rocks.jpg' }, 'Barrel_of_cheer' => { 'template' => 'picture_frame_card.tpl.html', 'caption' => 'A barrel of cheerful flowers', 'thumb' => 'Barrel_of_cheer.thb.jpg', 'image' => 'Barrel_of_cheer.jpg' }, }, 'cards' => [ 'Barrel_of_cheer', 'Flower_in_rocks', ], 'category' => { 'Encouragement' => { 'caption' => 'Cards for encouragement', 'cards' => [ 'Barrel_of_cheer', 'Flower_in_rocks' ] }, }, 'categories' => [ 'Encouragement', ] ); |
CGI Variable |
Purpose |
state_file |
Name of state file where
user's previous entries are stored on the server |
action |
Action that pgreet.pl.cgi should do
on its next call. See discussion on action
below. |
next_template |
Name of the next
template to be displayed by the CGI script. Do not
include a filename extension, the default extension
defined in pgreet.conf is appended
to the filename. |
message |
Text of message |
sender_name |
Name of sender |
sender_email |
Email of sender |
recipient_name | Name of recipient
(primary) |
recipient_name-2 to 5 | Names of any
supplemental recipients (up to 4 additional) |
recipient_email | Email of recipient (primary) |
recipient_email-2 to 5 | Emails of any supplemental recipients (up to 4 additional) |
code |
access code for card
(old WebGrams number) |
password |
access password for
card |
card | The name of the card selected |
login |
User login for accessing
Penguin
Greetings on this server |
UserPassword |
User password for
accessing Penguin
Greetings on this server |
schedule |
Binary flag - should
card be scheduled to emailing later |
day |
Day to email card
later |
month |
Month to email card
later |
year |
Year to email card
later |
copy_for_you |
Binary flag - do you
want a copy of ecard emailed to sender? |
site |
Name of a secondary
ecard site if your server has more than one ecard site
running at the same time. |
subject |
Contains text of a
user-supplied subject for the email message. The
subject text will be appended after the identifying tag
[pgreet]. If the
user does not supply a subject line, the line Penguin Greeting from
user name
will be used. |
Action |
Notes |
<none> |
This is the screen that
will be displayed if a user accesses Penguin Greetings
without any action specified. |
build |
These are the templates
to select and outfit a card. You can have any
number of build stages. Each time, the CGI script
will collect the variables from the previous stage, and
output the template specified by the variable next_template. |
login |
Display login and
password page for installations of Penguin Greetings were
only authorized users may create cards. |
preview |
State to review the
resulting card and schedule when it will be sent. |
send |
Confirmation that a
Penguin Greeting has been sent. A link from this
page can be added to go back to build state so to allow
users to send multiple cards during the same session. |
view |
State and template for a user who has already received a Penguin Greeting and wants to view the card via the web site. This is the page that this also displayed if URL_short_cut is enabled. |
<tr> <td style="text-align: center; vertical-align: middle;"> [# The URL will be the general URL above + card selected #] <a href="[+ $script_URL +]&card=[+ $card +]"> [# The image is the image URL + the image name #] <img src="[+ $trans->{'imageurl'} +]/[+ $card_data{$card}->{'thumb'} +]" > </a> </td> </tr> |
<HTML> <HEAD> <TITLE>Penguin Greetings - Select a picture</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF"> [* $ENV{'optRawInput'} = 16; *] [* $escmode = 0; *] [$ var $trans $script_URL %card_hash %category_hash @cards_list %card_data $card $image_ref $] [- # Retrieve parameters from Penguin Greetings script (pgreet.pl.cgi) $trans = shift(@param); # Get the contents of card.conf into a single hash. %card_hash = %{$trans->{'card_hash'}}; # Get the category hash %category_hash = %{$card_hash{'category'}}; # Get the hash of card data %card_data = %{$card_hash{'card'}}; # Get the list of all the card names in the category chosen. @cards_list = @{$category_hash{$trans->{'category'}}->{'cards'}}; # Build up pieces of URLs to simplify represention. $script_URL = join('', $trans->{'cgiurl'}, "/", $trans->{'cgi_script'}, "?action=build&", "next_template=text&", $trans->{'varstring'} ); -] <CENTER> <table cellpadding="2" cellspacing="2" border="0" style="text-align: left; width: 640px;"> <tbody> <tr> <td style="vertical-align: top;"> <td style="vertical-align: top;"> <img src="[+ $trans->{'imageurl'} +]/pgreet_CGI_banner.jpg" align="center"> <img src="[+ $trans->{'imageurl'} +]/pgreet_status_bar-2.jpg" align="left"><br> <center> <FONT FACE="Arial"><b><small>Please select a picture for your Penguin Greeting below.</b></small></FONT></CENTER> <br><br><hr> <CENTER> <H3>[+ $category_hash{$trans->{'category'}}->{'caption'} +]</H3><br> <table cellpadding="2" cellspacing="2" border="0" style="text-align: left; width: 600px;"> <tbody> [# Loop through every card in the category #] [$ foreach $card (@cards_list) $] <tr> <td style="text-align: center; vertical-align: middle;"> [# The URL will be the general URL above + card selected #] <a href="[+ $script_URL +]&card=[+ $card +]"> [# The image is the image URL + the image name #] <img src="[+ $trans->{'imageurl'} +]/[+ $card_data{$card}->{'thumb'} +]" > </a> </td> </tr> [$ endforeach $] </tbody> </table> </CENTER> </td> </tr> </tbody> </table> </center> [- Execute($trans->{'templatedir'} . "/pgreet_credit.tpl.html", $trans) -] </BODY> </HTML> |
# Request that all card entries
be array references. <category Force_to_array> fields = cards </category> # 01 <category Hello> caption = "Hello and general interest cards" cards = Camel_racers_unite cards = Camel_fun_yet </category> # 02 <category Love> caption = "Cards for Love and Romance" cards = Sweet_camel_two </category> |
# # File: PgPoppy.conf ###################################################################### # Main configuration file for # # ** PENGUIN GREETINGS (pgreet) California Poppy Collection** # # This is a sample configuration file for a secondary pgreet ecard # web site to be used with Penguin Greetings. Penguin Greeting is # a Perl CGI-based web card application for LINUX and probably any # other UNIX system supporting standard Perl extensions. # # Edouard Lagache, elagache@canebas.org, February 2004 # For Penguin Greetings 0.9.7 release # # # The pgreet system uses the Perl Config::General module for # reading in configuration file information. The file format # is the same as for the Apache web server. The general # configuration module contains information for both the # CGI script and the system daemon. These are kept in # separate categories for simplicity of management. # ###################################################################### # $Id: PgPoppy.conf,v 1.2 2004/02/05 21:41:02 elagache Exp $ ### Directory and URL defaults # Path to image files. imagedir = "/home/httpd/htdocs/pgreet/PgPoppy/en-us/images" # URL to images on server imageurl = "http://www.canebas.org/pgreet/PgPoppy/en-us/images" # Path to directory where dbm databases are stored datadir = "/home/agent-workspace/PgPoppy/en-us/data" # Path to configuration files confdir = "/home/agent-workspace/PgPoppy/en-us/conf" # Path to HTML templates templatedir = "/home/httpd/htdocs/pgreet/PgPoppy/en-us/templates" # Parameters for Object-Oriented version of Embperl <Embperl_Object> object_addpath = "/home/httpd/htdocs/pgreet/PgPoppy" object_base = "PgPoppy_template.epl" appname = "PgPoppy" bypass_object = "Text_email.tpl.html" </Embperl_Object> ### Misc CGI script settings. # Is Penguin Greetings available only to login/password users? login_only = 0 # Allow encoding of card number and password in URL. # (turn off - if you want users to come to your central page) allow_quick_views = 1 # Prevent users from inserting any HTML tags in their messages no_html_tags = 1 ### Days ecards are kept on server. cards_remain = "forever" |
Parameter |
Description |
object_addpath | A string of directory
paths where the base template pages may be found to that
are context in which to interpret the page to be
converted into HTML. When more than one directory
is to be included, separate each one by a colon in the
same manner as a UNIX path statement. |
object_base | The name of a base
template to use as the basis for interpreting the
template system. |
appname | Unique name to
differentiate a given site - Putting the site name in
this field will avoid conflicts. Otherwise, the
object-oriented hierarchy of one site would be used for
another. |
bypass_object | This is the only setting
that is not passed on directly to Embperl. This
allows the developer to specify templates that are to be
NOT processed by
Embperl::Object, but
instead processed by the "flat" Embperl
interpreter. This is provided for templates that
should not be created in the same style as the rest of
the ecard website. The most obvious example is the
plain-text message sent to the user as part of the MIME
multipart email message. To exclude more than one
template, simply add to the <Embperl_Object>
configuration group additional bypass template requests
(e.g. bypass_object
= template1, bypass_object =
template2, etc.) each on their own line.
Penguin
Greetings will create a list of these and bypass
Embperl::Object
processing for all in the list. |
[#
####################################################################
#] [# #] [# Penguin Greetings - California Poppy Collection website #] [# #] [# A demonstration ecard website using the Penguin Greetings #] [# Embperl::Object implementation so that the website can be built #] [# out of reusable components. #] [# #] [# For more information on Penguin Greetings project go: #] [# http://pgreet.sourceforge.net/ #] [# #] [# File: PgPoppy_template.epl #] [# The file containing the general structure of a web site #] [# page. #] [# #] [# #################################################################### #] [# Set environment to avoid HTML reformatting #] [* $ENV{'optRawInput'} = 16; *] [* $escmode = 0; *] [# Embperl Variables #] [$ var $req_obj $trans $LN $pgreet_info_string $pgreet_title_string $] [! sub new { # # Initialization for Object-oriented page structure: # Internationalization, etc. # my $self = shift; my $trans = shift; # Create language handle for this rendering. use Pgreet::I18N; $self->{'LN'} = Pgreet::I18N->get_handle($trans->{'lang_code'}); $self->{'trans'} = $trans; return($self); } sub access { # # Access methods to store and retrieve items from object # my $self = shift; my $property = shift; my $value = shift; if ($value) { return($self->{$property} = $value); } else { return($self->{$property}); } } sub title { # # Baseline title # return("Penguin Greetings - Califorina Poppy collection"); } !] [# Initialize base page #] [- # Retrieve request object of current page. $req_obj = shift; # Initialize object-oriented page. $req_obj->new(@param); # Retrieve parameters from CGI App pgreet.pl.(s)cgi and save in object $trans = shift(@param); # Retrieve Locale::Maketext handle $LN = $req_obj->access('LN'); # Spare long text in the middle of HTML $pgreet_info_string = $LN->maketext("For more information on the <i>Penguin Greetings (pgreet)</i> web cards software go to, <a href=\"http://www.canebas.org/pgreet/\">http://www.canebas.org/pgreet/</a>"); $pgreet_title_string = $LN->maketext("Penguin Greetings - Califorina Poppy collection"); -] <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta name="generator" content="HTML Tidy, see www.w3.org"> <meta http-equiv="content-type" content= "text/html; charset=ISO-8859-1"> <title>[+ $LN->maketext($req_obj->title()) +]</title> </head> <!-- Colors are for the black background where content will actually be --> <body style= "color: rgb(255, 204, 0); background-color: rgb(255, 255, 255); background-image: url([+ $trans->{'imageurl'} +]/Poppy_wallpaper.jpg);" link="#9999ff" vlink="#3333ff" alink="#3366ff"> <!-- Content appears in a centered black table against poppy wallpaper --> <center> <table cellpadding="2" cellspacing="2" border="0" style= "font-family: times new roman,times,serif; text-align: left; background-color: rgb(51, 0, 51); width: 650px;"> <tbody> <tr> <td style="vertical-align: top;"> <img style="width: 649px; height: 108px;" alt="[+ $pgreet_title_string +]" title="[+ $pgreet_title_string +]" src="[+ $trans->{'imageurl'} +]/Poppy_upper_banner.jpg"> <br> [# Insert particular content file here #] [- Execute({inputfile =>'*', param => [$trans]}) -] <!-- Table for giving credit to Pgreet software --> <table style= "width: 100%; text-align: left; margin-left: auto; margin-right: auto;" border="1" cellspacing="2" cellpadding="2"> <tbody> <tr> <td style="text-align: center;"><font size= "-2">[+ $pgreet_info_string +]</font> </td> <td style="text-align: right; vertical-align: bottom; width: 90px;"><a href="http://www.canebas.org/pgreet/"><img src= "[+ $trans->{'imageurl'} +]/powered_by_pgreet.jpg" alt="Powered by pgreet" title="Powered by pgreet" style= "border: 0px solid ; width: 90px; height: 42px;"> </a> </td> </tr> </tbody> </table> <img style="width: 649px; height: 27px;" alt="[+ $pgreet_title_string +]" title="[+ $pgreet_title_string +]" src="[+ $trans->{'imageurl'} +]/Poppy_lower_banner.jpg"> </td> </tr> </tbody> </table> </center> <br> <br> </body> </html> |
[#
####################################################################
#] [# #] [# Penguin Greetings - California Poppy Collection website #] [# #] [# A demonstration ecard website using the Penguin Greetings #] [# Embperl::Object implementation so that the website can be built #] [# out of reusable components. #] [# #] [# For more information on Penguin Greetings project go: #] [# http://pgreet.sourceforge.net/ #] [# #] [# File: view.tpl.html #] [# HTML template to that renders the ecard for those seeking #] [# to see their card via the web rather than directly via their #] [# email readers. #] [# #] [# #################################################################### #] [# Declare Embperl variables needed to process page #] [$ var $req_obj $trans $template $card $lang_URL $LN $] [# Set environment to avoid HTML reformatting #] [* $ENV{'optRawInput'} = 16; *] [* $escmode = 0; *] [# Subroutine declaration #] [! sub title { # # Override page title # return("Your Penguin Greeting"); } !] [# Transfer data from application and create shortcuts #] [- # Retrieve request object of current page. $req_obj = shift; # Retrieve parameters from Penguin Greetings script (pgreet.pl.cgi) $trans = shift(@param); # $trans is a hash reference # Retrieve Locale::Maketext handle $LN = $req_obj->access('LN'); # card name $card = $trans->{'card'}; # template to use $template = $trans->{'card_hash'}->{'card'}->{$card}->{'template'}; # Shortcut for URL to card site. $lang_URL = join('', $trans->{'cgiurl'}, "/", $trans->{'cgi_script'}, "?site=", $trans->{'site'} ); -] [# ##### End of Embperl initialization ##### #] <!-- Start of ecard - Give a title and state sender --> <br> <div style="text-align: center;"><font size="+1" style="font-style: italic;">[+ $LN->maketext("Your Penguin Greeting") +] <br><br> </font><font style="font-style: italic;"> [+ $LN->maketext("A Penguin Greetings ecard.<br>Sent to you from [_1]", $trans->{'sender_name'}) +]</font><br><br> </div> <!-- Template inserted using Embperl --> [- Execute ({inputfile => join('', $trans->{'templatedir'}, "/$template"), param => [$trans, $LN] } ) -] <br> <br> <br> <div style="text-align: center;"><span style="font-style: italic;"> [+ $LN->maketext("Would you like to send a California Poppy card?") +] </span><br><br> <a href="[+ $lang_URL +]"><font size="-1"> [+ $LN->maketext("Click here to access the California Poppy ecard site") +] </font></a><br> <br> <hr style="width: 50%; height: 2px;"> <br> <br> <div style="text-align: center;"><font size="-1"><span style="font-style: italic;"> [+ $LN->maketext("We hope you enjoy your Penguin Greeting!") +] </span></font></div> <br> <br> |
Error No. |
Description of Error |
0 |
'Catch-all' error in
case a non-existent error code is given. This code
should never be reached unless "your's truly"
accidentally makes an call to the subroutine
'Report_error' with an non-existent error code. |
SEVERE UNKNOWN ERRORS
(1-19) |
|
1 |
Unknown operation
requested of pgreet.pl.cgi. Either an action was
specified that isn't recognized or some sort of other
unknown error. |
2 |
No template to display
specified or file is unreadable. Either the
configuration variables 'default_template' or
'default_login' are in error, or the state variable
'next_template' or 'var_error_template' did not contain a
valid template. As noted in the installation guide,
'default_login' must be set correctly or pgreet.pl.cgi
will go into an infinite recursion trying to report an
error without any template to report the error with. |
3 |
Penguin Greetings has
encountered an error attempting to save your selections
in between menu screens. Possible causes are
improperly set ownership and/or permissions on the
temporary directory. |
4 |
You are attempting to
access a Penguin Greetings e-card site that either no
longer exists on this server or has been relocated.
This means either a secondary site is not listed in the
primary configuration file or perhaps an attempt has been
made to access a secondary site belonging to a user that
doesn't exist on the system which makes it impossible to
look up a home directory. |
5 |
The secondary ecard site
you are trying to access has encountered an unrecoverable
configuration error. One possible way to
generate this error is to try to set a parameter in a
secondary configuration file that can only be set in the
primary configuration file. |
FILE SYSTEM RELATED
ERRORS (20-39) |
|
20 |
Some sort of file open
error (details in web server error log) |
21 |
Some sort of file close
error (details in web server error log) |
22 |
Some sort of file read error (details in web server error log) |
23 |
Some sort of file write
error (details in web server error log) |
24 |
Data file corrupted
error (details in web server error log) |
CARD CONTENT RELATED
ERRORS (40-49) |
|
40 |
The card requested
didn't exist in the 'cards' array reference
supplied in the cards.conf file (New
to version 0.9.8) |
DATE RELATED ERRORS
(100-109) |
|
100 |
Unknown date related
error (internal failure most likely) |
101 |
Impossible date (e.g.
Feb 31.) |
102 |
Date not in the
future. |
LOGIN RELATED ERRORS
(110-119) |
|
110 |
User login and password
do not match |
111 |
Card login and card
password do not match |
FILE STATE ERRORS
(120-129) |
|
120 |
Attempt to use a state
file that does not exist. Could be a catastrophic
failure, but most likely a user has left a card creating
session for more than the period allocated to complete a
card (default 1 hour) and the system daemon has deleted
the associated state file. |
Expectation |
Description of Expectation |
allow_empty | Never fails but if the string is indeed blank, all other tests will be skipped and true will be returned. |
disallow_empty | Fails if the input string is either undef or empty. |
min | Fails if the length of the input string is less than the numeric value of it's single argument. |
max | Fails if the length of the input string is more than the numeric value of it's single argument. |
want_int | Fails if the input string does not solely consist of numeric characters. |
want_float | Fails if the argument does not solely consist of numeric characters, plus an optional single '.'. |
allow_chars | Fails if the input string contains characters other than those in its argument. |
disallow_chars | Fails if the input string contains any of the characters in its argument. |
enum | Fails if the input string does not precisely match at least one of the elements of the array reference it takes as an argument. |
match | Fails if the input string does not match the regular expression it takes as an argument. |
want_email | Fails if the input string does not match the regular expression: ^\S+\@@[\w-]+\.[\w\.-]+$ |
want_phone | Fails if the input string does not match the regular expression ^[0-9+.()-]*$ |
want_date | Interprets the input string as a date, if possible. This will fail if it can't figure out a date from the input. In addition, it is possible to use this to standardize date input. Pass a formatting string (see the strftime(3) man page) as an argument to this check, and the string will be formatted appropriately if possible. This is based on the Date::Manip(1) module, so that module must be installed if you wish to use that test and that module's documentation might prove valuable if you're using this check. |
<form
method="post" action="[+ $trans->{'cgiurl'} +]/[+ $trans->{'cgi_script'} +]"> <p> </p> <div align="center"> <center> <table border="0"> <tbody> <tr> <td align="right"><font face="Arial" size="-1">Card Login:</font></td> <td><input type="text" size="20" name="code"value=""></td> </tr> <tr> <td align="right"><font face="Arial" size="-1">Code Word:</font></td> <td><input type="password" size="20" name="password"value=""></td> </tr> </tbody> </table> </center> </div> <div align="center"> <center> <table border="0"> <tbody> <tr> <td><input type="submit" value="Submit"></td> <td><input type="reset" value="Reset"></td> </tr> </tbody> </table> </center> </div> <input type="hidden" name="action" value="view"> <input type="hidden" name="next_template" value="view"> <input type="hidden" name="code+ArgCheck" value="disallow_empty"> <input type="hidden" name="password+ArgCheck" value="disallow_empty"> <input type="hidden" name="var_error_template" value="fields_error"> </form> |
$error_hash =
{ |
Penguin Greetings
0.8.1 (file -
fields_error.tpl.html
:)<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
# Location of configuration
files # LOCALIZE TO YOUR OWN SETTINGS!! $conf_dir = "/home/agent-workspace/pgreet/conf/"; |
# # File: PgTemplateTest.conf ###################################################################### # PgTemplateTest configuration file for # # ** PENGUIN GREETINGS (pgreet) ** # # A Perl CGI-based web card application for LINUX and probably any # other UNIX system supporting standard Perl extensions. # # Edouard Lagache, elagache@canebas.org, September 2003 # For Penguin Greetings 0.9.2 release # # This file allows users to choose the defaults for the CGI state # variables that are emulated by PgTemplateTest.pl when previewing # a template. # # The pgreet system uses the Perl Config::General module for # reading in configuration file information. The file format # is the same as for the Apache web server. The general # configuration module contains information for both the # CGI script and the system daemon. These are kept in # separate categories for simplicity of management. # ###################################################################### # $Id: pgreet_content_guide.html,v 1.34 2004/03/05 18:08:02 elagache Exp $ # PgTemplateTest configuration parameters # mozilla -remote 'openURL("http://www.canebas.org/",new-tab)' browser = "/usr/bin/mozilla" prefix = -remote 'openURL("file:// suffix = ", new-tab)' tmp_path = "/tmp/pgreet/PgTemplateTest" # CGI State variables that may be needed in the average template. <pgreet_CGI> varstring = "PgTemplateTest=true" hiddenfields = "<!-- Templatetest hiddenfields -->" URL_short_cut = "http://www.PgTemplateTest.org/pgreet.cgi?URL_short_cut=true" sender_name = "Test Sender Name" sender_email = "test_sender_email@PgTemplateTest.org" recipient_name = "Test Recipient Name" recipient_email = "test_recipient_email@PgTemplateTest.org" message = "This is a test message. This is a test message. This is a test message. This is a test message. " html_message = "This is a test message. This is a test message.<br> This is a test message. This is a test message. " login = "test_login" UserPassword = "test_password" password = "test_card_password" number = "SWAP-number" hostname = "www.PgTemplateTest.org" error_no = 11 # The Error checking hash created using Config::General conventions. <error_hash> recipient_email = "disallow_empty" recipient_email = "want_email" </error_hash> # SpeedyCGI state variables SpeedyCGI = 1 StartTime = 1058122148 Invocations = 10 </pgreet_CGI> |
PgTemplateTest [-b] \ [-c .../pgreet.conf] \ [-d] \ [-p .../cards.conf] \ [-s SiteName] \ [-t PgTemplateTest.conf] \ [-x] template.tpl.html var1=value1 var2=value2 ... |
=
. So for example, to process the file
MyTemplate.tpl.html
with the variable
penguin
equal to 5
and the
variable camel
equal to 2_hump
the command would be:
PgTemplateTest MyTemplate.tpl.html penguin=5 camel=2_humpVariables or values should be quotes as necessary to avoid being misinterpreted by your command shell. Normally,
PgTemplateTest
displays the dumped variables
or the resulting HTML to standard out. If you use the
-b
option, it will instead save the rendered
HTML to a temporary file and launch a browser so that you
may view the resulting page. The command line options
are as follows:
Option |
Description |
-b |
Render the template
into an HTML page, save as a temporary file, and
launch a browser to view the resulting page. In order
for this to work you must set the variables:
$browser , $prefix , $suffix, and
$tmp_path to appropriate values for your
system. |
-c |
Use the specified file instead of the default file for the Penguin Greetings cards.conf card configuration file. |
-d |
Do not render any template page, just dump what the state variables for this arrangement would be. The -d option will ignore any template filename and process only command line arguments with embedded equals signs as additional state variables. |
-p |
Use the specified file instead of the default file for the Penguin Greetings pgreet.conf general configuration file. |
-s |
Load the
configuration information of the secondary site SiteName instead
of the primary site. This can be used to test a
secondary site using the same configuration file
conventions used by the application itself. |
-t |
Use the specified
file instead of the default file for the PgTemplateTest
configuration file. |
-x |
Purge any temporary
HTML files that are older than the configuration
variable purge_after . Nothing else is
done if -x and it provides no output
whatsoever,so it can be placed in a cron job to
remove files from all users. When not used as root,
it will silently only remove files that you have
permission to delete. |
PgTemplateTest MyTemplate.tpl.html > /dev/nullEmbperl will send error messages to standard error with line numbers for the offending statements (if any.) To actually look at the resulting HTML, pipe the output into a file for your inspection. If you want to actually look at the resulting page, use the -b option:
PgTemplateTest -b MyTemplate.tpl.html penguin=5 camel=2_humpThis will create a temporary file in $tmp_path and then launch your browser to render the page. There is one unfortunate "bad habit" in the browser rendering mode. Since there is no obvious way of knowing when you will be finished with a given temporary file, there is no strategy for deleting them. Therefore you must "clean up" your $tmp_path directory from time to time (by using the -x option or manually) to avoid clutter.
[#
######################################################
#] [# Penguin Greetings Holy ecard website #] [# #] [# For more information on Penguin Greetings project go: #] [# http://pgreet.sourceforge.net/ #] [# #] [# File: default.tpl.html - Template for display of card #] [# image thumbnails. #] [# ###################################################### #] <html> <head> <title>Penguin Greetings - Holy ecard collection</title> </head> [* $ENV{'optRawInput'} = 16; *] [* $escmode = 0; *] [$ var $trans $script_URL %card_hash @cards_list $card $sample_URL $text_URL %card_data $lang_URL $] [- # Retrieve parameters from Penguin Greetings script (pgreet.pl.cgi) $trans = shift(@param); %card_hash = %{$trans->{'card_hash'}}; %card_data = %{$card_hash{'card'}}; @cards_list = @{$card_hash{'cards'}}; # Build up pieces of URLs to simplify represention. $script_URL = join('', $trans->{'cgiurl'}, "/", $trans->{'cgi_script'}, "?action=build&", $trans->{'varstring'}, '&' ); $lang_URL = join('', $trans->{'cgiurl'}, "/", $trans->{'cgi_script'}, "?site=" ); $sample_URL = $script_URL . "next_template=sample_view"; $text_URL = $script_URL . "next_template=text"; -] <body style="background-image: url([+ $trans->{'imageurl'} +]/PgSaints_wallpaper.jpg);"> <center> <table cellpadding="0" cellspacing="0" border="0" style="text-align: left; width: 630px;"> <tbody> <tr> <td style="vertical-align: top; text-align: center;" colspan="3"><img src="[+ $trans->{'imageurl'} +]/PgSaints_upper_banner.gif" title="" alt="" style="width: 642px; height: 38px;"><br> <img src="[+ $trans->{'imageurl'} +]/PgSaints_middle_banner.gif" title="" alt="" style="width: 641px; height: 73px;"> </td> </tr> <tr> <td style="vertical-align: top; background-color: rgb(0, 0, 0); width: 2px;"> <br> </td> <td style="vertical-align: top;"> <div style="text-align: center;"> </div> <table cellpadding="2" cellspacing="2" border="0" style="text-align: left; width: 100%;"> <tbody> <tr> <td style="vertical-align: top; text-align: center;"> <!-- Links to alternative language site --> <a href="[+ $lang_URL +]PgSaint!en-us"> <img src="[+ $trans->{'imageurl'} +]/US_flag.jpg" title="[English-US site]" alt="[English-US site]" align="left" style="width: 39px; height: 24px;" border="0"> </a> <a href="[+ $lang_URL +]PgSaint!fr-fr"> <img src="[+ $trans->{'imageurl'} +]/French_flag.jpg" title="[French-France Site]" alt="[French-France Site]" align="right" style="width: 39px; height: 24px;" border="0"> </a> |
. . . [# Embperl Variables #] [$ var $trans $LN $] [- # Retrieve parameters from Penguin Greetings script (pgreet.pl.cgi) $trans = shift(@param); use Pgreet::I18N; $LN = Pgreet::I18N->get_handle($trans->{'lang_code'}); -] [+ $LN->maketext("Dear [_1],",$trans->{'recipient_name'}) +] . . . |
<center> <span style="font-weight: bold;">Email subject</span> (optional)<br> Give your recipient a personalized subject<br> line for the email they will receive<br> <code>[pgreet]</code> <input type="text" name="subject" size=45 value="[+ $trans->{subject} +]"> </center> |
<!-- Form to implement CGI "Back" button
--> <form action="[+ $trans->{'cgiurl'} +]/[+ $trans->{'cgi_script'} +]" method="post"> [# Include the hidden fields to retrieve previous state #] [+ $trans->{'BackHiddenFields'} +] <input type="submit" value="Back"> </form> |
one_col_thumb.tpl.html, two_col_thumb.tpl.html |
templates to display
one column or two columns of card thumbnail images
with the associated links. |
email_text_data.tpl.html |
Produces the HTML
form entries to enter the textual information needed
to send the card (names, email addresses, passwords,
etc.) |
schedule.tpl.html |
HTML forms that
allow users to schedule their card to be send
sometime in the future. |
return_home.tpl.html |
Produces the HTML
code that allows a user to return to start of the
ecard site preserving their login information for
password restricted sites so that they don't need to
login again to send another card. |
[#
####################################################################
#] [# #] [# Penguin Greetings - Embperl templates of common HTML/Perl code #] [# #] [# These HTML/Embperl templates contain elements that are commonly #] [# within an ecard site (in particular the demonstration sites #] [# included with Penguin greetings.) This common code is maintained #] [# independently and included into the demonstration sites via #] [# symbolic links to the sites that use the code. #] [# #] [# Edouard Lagache, elagache@canebas.org, April 2005 #] [# For Penguin Greetings 0.9.9 release #] [# #] [# For more information on Penguin Greetings project go: #] [# http://pgreet.sourceforge.net/ #] [# #] [# #] [# File: two_col_thumb.tpl.html #] [# Template to display thumbnail images of cards in two columns #] [# with the caption above the thumbnail. Suitable for sites #] [# with a modest number of cards and no categories. #] [# #] [# #################################################################### #] [# Set environment to avoid HTML reformatting #] [* $ENV{'optRawInput'} = 16; *] [* $escmode = 0; *] [# Declare Embperl variables needed to process page #] [$ var $trans @lang_codes $default_lang_code $italic $LN $next_thumbs $script_URL %card_hash @cards_list $card $sample_URL $text_URL %card_data $lang_URL @lang_codes $lang_code %send_prompt %sample_prompt $send_string $sample_string $] [! sub new_row { # # Helper subroutine create a new row in table of thumbnails # (Use straight Perl to bypass Embperl table tag interpretation.) # my $next_thumbs = shift; if (($next_thumbs % 2) == 0) { print OUT " </tr>"; print OUT " <tr>"; } } !] [- # Retrieve parameters from Penguin Greetings script (pgreet.pl.cgi) $trans = shift(@param); $LN = shift(@param); # Locale::Maketext handle $italic = shift(@param); %card_hash = %{$trans->{'card_hash'}}; %card_data = %{$card_hash{'card'}}; @cards_list = @{$card_hash{'cards'}}; # Build up pieces of URLs to simplify represention. $script_URL = join('', $trans->{'cgiurl'}, "/", $trans->{'cgi_script'}, "?action=build&", $trans->{'varstring'}, '&' ); $next_thumbs = 0; $send_string = $LN->maketext("Send this card"); $sample_string = $LN->maketext("See sample of this card"); $sample_URL = $script_URL . "next_template=sample_view"; $text_URL = $script_URL . "next_template=text"; -] [# ##### End of Embperl initialization ##### #] <!-- Table of card thumbnails --> <table cellpadding="2" cellspacing="2" border="0" style= "text-align: left; width: 100%; margin-left: auto; margin-right: auto;"> <tbody> <tr> [# Loop through every card in collection #] [$ foreach my $card (@cards_list) $] [- $next_thumbs++ -] <td style="text-align: center; vertical-align: top;"> <b>[$ if ($italic) $]<i>[$ endif $]<small> [+ $card_data{$card}->{'caption'} +] [$ if ($italic) $]</i>[$ endif $]</b><br> [# The URL will be the general URL above + card selected #] <a href="[+ $sample_URL +]&card=[+ $card +]"> [# The image is the image URL + the image name #] <img src= "[+ $trans->{'imageurl'} +]/[+ $card_data{$card}->{'thumb'} +]" alt="[+ $card_data{$card}->{'caption'} +]" title="[+ $card_data{$card}->{'caption'} +]"> </a><br> <a href="[+ $text_URL +]&card=[+ $card +]">[+ $send_string +]</a><br> <a href="[+ $sample_URL +]&card=[+ $card +]">[+ $sample_string +]</a> <br> </small> </td> [- new_row($next_thumbs) -] [$ endforeach $] </tr> </tbody> </table> <!-- End of thumbnails --> |
<%doc> # #################################################################### # # # # Penguin Greetings - Savoring Seattle Collection # # # # Demonstration ecard site implemented in HTML::Mason as an # # alternative embedded Perl environment and featuring photographs # # Taken in the greater Seattle Washington area. # # # # For more information on Penguin Greetings project go: # # http://pgreet.sourceforge.net/ # # # # # # File: default.mtpl.html # # The file to present users with thumbnails of images. # # Also login page for retrieving a card. # # # # #################################################################### # </%doc> <%method title> %# %# Override the text of page title %# <%args> $LN </%args> <% $LN->maketext("Penguin Greetings - Welcome to the Savoring the sights of Seattle Collection") %> </%method> <%perl> # # ##### Transfer data from CGI app and create shortcuts ##### # # my $trans = shift; my $add_row = 1; my $image_path = $trans->{'imageurl'}; my %card_hash = %{$trans->{'card_hash'}}; my %card_data = %{$card_hash{'card'}}; my @cards_list = @{$card_hash{'cards'}}; # Build up pieces of URLs to simplify represention. my $script_URL = join('', $trans->{'cgiurl'}, "/", $trans->{'cgi_script'}, "?action=build&", $trans->{'varstring'}, '&' ); my $lang_URL = join('', $trans->{'cgiurl'}, "/", $trans->{'cgi_script'}, "?site=" ); my $sample_URL = $script_URL . "next_template=sample_view"; my $text_URL = $script_URL . "next_template=text"; use Pgreet::I18N; my $LN = Pgreet::I18N->get_handle($trans->{'lang_code'}); # ##### End initialization ##### # </%perl> <!-- Template: default.mtpl.html --> <!-- Introduction to website --> <table style="width: 100%; text-align: center;" border="0"> <tr> <td style="width 40px"> <a href="<% $lang_URL %>PgSeattle!en-us"> <img src="<% $trans->{'imageurl'} %>/US_flag.jpg" title="<% $LN->maketext("~[English-US site~]") %>" alt="<% $LN->maketext("~[English-US site~]") %>" style="width: 39px; height: 24px;" border="0"> </a> </td> <td> <div align="center"> <font style="font-style: italic;" size="-1"> <% $LN->maketext("Welcome to a selection of notecards featuring images of the greater Seattle Washington area and powered by Penguin Greetings") %> </font></div> </td> <td> <a href="<% $lang_URL %>PgSeattle!fr-fr"> <img src="<% $trans->{'imageurl'} %>/French_flag.jpg" title= "<% $LN->maketext("~[French-France Site~]") %>" alt= "<% $LN->maketext("~[French-France Site~]") %>" style="width: 39px; height: 24px;" border="0"> </a> </td> </tr> </table> <p align=center> <a href="#Retrieve"><font size="-1">(<% $LN->maketext("Received a Savoring Seattle note card?") %> <% $LN->maketext("click here to retrieve your card") %>) </font></a></p> <hr style="width: 100%; height: 2px;"> <p align="center"><font size="-1"> <% $LN->maketext("Note: clicking on an image will take to you sample preview of the card.") %> <% $LN->maketext("To send a card with that image click on the "Send this card" link below the image.") %> </font></p> <table style="width: 100%; text-align: left;" border="0" cellpadding="2" cellspacing="2"> <tbody> <tr> % foreach my $card (@cards_list) { % my $thumb = $card_data{$card}->{'thumb'}; <td style="vertical-align: top; text-align: center;"> <font size="-1"> <span style="font-family: helvetica,arial,sans-serif;"> <% $card_data{$card}->{'caption'} %> </span></font><br> <a href="<% $sample_URL %>&card=<% $card %>"> <img alt="<% $card_data{$card}->{'caption'} %>" src="<% $image_path %>/<% $thumb %>"></a><br> <small> <a href="<% $text_URL %>&card=<% $card %>"><% $LN->maketext("Send this card") %></a><br> <a href="<% $sample_URL %>&card=<% $card %>"><% $LN->maketext("See sample of this card") %></a></small><br> </td> % if ($add_row % 2 == 0) { </tr> <tr> % } % $add_row++ % } </tr> </tbody> </table> <br><br> <hr style="width: 100%; height: 2px;"> <!-- Code to handle picking up a card sent by someone previously --> <a name="Retrieve"></a> <table cellpadding="2" cellspacing="2" border="0" style="text-align: left; width: 100%;"> <tbody> <tr> <td style="vertical-align: top; text-align: center;"> <b><% $LN->maketext("Have you received a Penguin Greeting?") %></b><br><br> <small><small><% $LN->maketext("Fill in the information to the right to view your Penguin Greeting!") %></small> </small> </td> <td style="vertical-align: top; text-align: right;"> <form method="post" action="<% $trans->{'cgiurl'} %>/<% $trans->{'cgi_script'} %>"> <table border="0" style="margin-left: auto; margin-right: 0px;"> <tbody> <tr> <td align="right"><font size="-1"><% $LN->maketext("Card ID:") %></font></td> <td><input type="text" size="15" name="code" value=""></td> <td style="text-align: right;"><input type="reset" value="<% $LN->maketext("Reset") %>"></td> </tr> <tr> <td align="right"><font size="-1"><% $LN->maketext("Password:") %></font></td> <td><input type="password" size="15" name="password" value=""></td> <td style="text-align: right;"><input type="submit" value="<% $LN->maketext("Submit") %>"></td> </tr> </tbody> </table> <input type="hidden" name="action" value="view"> <input type="hidden" name="next_template" value="view"> <input type="hidden" name="code+ArgCheck" value="disallow_empty"> <input type="hidden" name="password+ArgCheck" value="disallow_empty"> <input type="hidden" name="var_error_template" value="fields_error"> <% $trans->{'hiddenfields'} %> </form> </td> </tr> </tbody> </table> <!-- End of table to retrieve a card --> <hr style="width: 100%; height: 2px;"> |