# ODP::Passport::HTML - HTML generation part of ODP::Passport (Version 0.01) # Copyright (C)2002 Richard P. Fuller # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package ODP::Passport::HTML; use strict; # new - Initialises a new ODP::Passport::HTML object # Parameters: none # Returns: none sub new () { my $object = {}; return bless $object; } # needtologin - Returns a 'need to login' message # Parameters: URL modifier, language strings # Returns: 'need to login' message sub needtologin ($$) { my ($modifier, $strings) = @_; my %strings = %{$strings}; my $message = $strings{'strings.ppclient.login_required_txt'}; my $url = "$ODP::Passport::ServerURL/"; $message =~ s!\%v1\%!$url!; return message($strings{'strings.ppclient.login_required'}, $message); } # loginfailed - Returns an 'invalid login key' message # Parameters: Language Strings # Returns: 'invalid login key' message sub loginfailed($) { my %strings = %{$_[0]}; return message($strings{'strings.ppclient.invalid_key'}, $strings{'strings.ppclient.invalid_key_txt_1'}."

".$strings{'strings.ppclient.invalid_key_txt_2'}."

Back to ODP::Passport"); } # insufficientprivs - Returns 'an insufficient privileges' message # Parameters: Language Strings # Returns: HTML sub insufficientprivs($) { my %strings = %{$_[0]}; return message($strings{'strings.ppclient.insufficient_privileges'}, $strings{'strings.ppclient.insufficient_privileges_txt'}."

ODP::Passport"); } # message # Parameters: title, body # Returns: HTML message box sub message ($$) { my $title = $_[0]; my $body = $_[1]; return < $title
$title
$body
END_HTML } # Returns the HTML for the client CGI header (this is an example more than anything else) # Parameters: title, user, expiry time, strings # Returns: HTML sub c_header_html($$$$) { my $title = $_[0]; my $user = $_[1]; my $expires = gmtime($_[2]); my %strings = %{$_[3]}; my $col1='#5588dd'; my $col2='#77aadd'; return CGI::header().< $title
$title     ODP::Passport
$strings{'strings.ppclient.logged_in'}: $user | $strings{'strings.ppclient.logout'} | $strings{'strings.ppclient.current_key_expires'}: $expires GMT
END } # Returns the HTML for the client CGI footer (this is an example more than anything else) # Parameters: # Returns: HTML sub c_footer_html() { my $col1='#5588dd'; my $col2='#77aadd'; return <
   
END } 1;