package DADA::App::Error;
=pod
=head1 NAME
DADA::App::Error
=head1 SYNOPSIS
use DADA::App::Error
This module basically has error messages in HTML and spits 'em back at ya.
=cut
use lib './';
use lib '../';
use DADA::Config;
use DADA::App::Guts;
use DADA::Template::HTML;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(cgi_user_error);
use strict;
use vars qw(@EXPORT);
my %error;
require CGI;
my $q = new CGI;
if(($PROGRAM_URL eq "") || ($PROGRAM_URL eq 'http://www.changetoyoursite.com/cgi-bin/dada/mail.cgi')){
$PROGRAM_URL = $q->url();
}
if(($S_PROGRAM_URL eq "") || ($S_PROGRAM_URL eq 'http://www.changetoyoursite.com/cgi-bin/dada/mail.cgi')){
$S_PROGRAM_URL = $q->url();
}
$error{no_list} = < I had trouble fetching [list_name] from this server.
It's possible that it has been deleted or moved
and the form you used is a bit out of date. Please refer to the error logs for more information. The password you gave me doesn't seem to be correct.
You might have typed it in wrong. Try typing it in again.
If you forgot your password, have it emailed back to you. Try signing into [list_name] again If you keep getting bounced back to this screen,
make sure that cookies are turned 'on' in your Web browser. I didn't catch the name of your list or its password.
I need those to let you into your administration control panel. Your email address, [email], has already been subscribed to: This may be because: If you would like to subscribe to a different list, please visit the $PROGRAM_NAME main screen,
which will have a list of all available lists. If you want to unsubscribe from this list instead, please visit
this list's main screen.
Your email address, [email], is not subscribed to: This may be because: If you would like to unsubscribe from a different list, please visit the $PROGRAM_NAME main screen,
which will have a list of all available lists. If you want to subscribe to this list instead, please visit
this list's main screen.
The address you gave, [email],
doesn't seem to pass verification. It's possible that you just typed it in
incorrectly. You may go back and
resubmit your address or use the form below: The address you gave, [email],
doesn't seem to pass our verification because we couldn't find the hostname.
It's possible that you just typed it in
incorrectly. You may go back
and resubmit your address or use the form below: The new password you typed isn't the same as the second time you typed it,
or you didn't enter a new password at all. Press the back button
to fix the problem. The pin number you gave wasn't correct for your email address.
You might have copied the confirmation or unsubscription address incorrectly.
Be sure to copy the entire address into the address bar in your browser. If you'd like, you may resubmit your email address: The root password you gave me didn't match up to the one one I have for
your $PROGRAM_NAME script. Please try again:
[list_name].
[list_name].
The archived message you're trying to find isn't there. It may have been removed by the list owner.
EOF ; $error{no_archive} = <I couldn't find an archive for [list_name]. Either the archive database is corrupted, or you never sent a message to be archived.
EOF ; $error{list_already_exists} = <So as not to overwrite the list that's already set up, please pick a new name.
EOF ; $error{no_show_archives} = <There are no messages archived for this list that are available to be viewed.
EOF ; $error{no_display_attachments} = <Attachments for messages of this list are not displayed.
EOF ; $error{closed_list} = <This list you are trying to subscribe to is closed. Only the list administrator can subscribe people to the list.
EOF ; $error{over_subscription_quota} = <This list currently cannot have any more subscribers.
EOF ; $error{over_list_quota} = <The limit to the amount of lists that can be created has been reached.
EOF ; $error{stupid_programmer} = <Um, I have no idea whats wrong with what, whatever you did, um.... I'd close all programs and restart, usually that does the trick. You might want to give me a word or two about my laziness - write to: justin\@skazat.com and tell me how I should just stick to drawing pretty pictures.
*thanks*
EOF ; $error{no_permissions_to_write} = <It seems I'm having trouble writing a new list to the directory you specified your lists to be:
$FILES
this might be because that directory doesn't exist, or I don't have permission to write to it. Make sure the directory path is correct. If your still getting this error, chmod 777 the directory and then setup a new list.
EOF ; $error{black_listed} = <It seems that your not allowed to subscribe to [list_name] for some reason or another. This list may be closed to particular participants.
EOF ; $error{too_busy} = <Our apologies, but the server is too overloaded to take your request. Please try again in a few minutes and see if the server status has cleared up.
EOF ; $error{no_admin_permissions} = <It seems that you have not been given the permission to use/view this screen. It's most likely that this feature has been shut off by the Main Administrator.
EOF ; $error{no_root_password} = <The $PROGRAM_NAME Root Password has not been set to a valid value. List creation is not allowed with the $PROGRAM_NAME Root Password left blank.
EOF ; $error{bad_setup} = <$PROGRAM_NAME is running correctly, but is not configured properly - if you haven't configured the program, please do so now.
Click here for more information.
EOF ; $error{settings_possibly_corrupted} = <Viewing the message source of an archived message is not supported.
EOF ; =pod =head1 SUBROUTINES =head2 cgi_user_error print cgi_user_error(-List => 'my_list', -Error => 'some_error', -Email => 'some@email.com'); Gives back an HTML friendly error message. =cut sub cgi_user_error { my %args = (-List => undef, -Error => undef, -Email => undef, @_); my $return_html; my $available_lists_ref; my $li = {}; my $list_exists = 0; my $list_login_form = ""; if($args{-Error} ne 'bad_setup'){ $list_exists = check_if_list_exists( -List=> $args{-List}) || 0; if($list_exists > 0) { require DADA::MailingList::Settings; my $ls = DADA::MailingList::Settings->new(-List => $args{-List}); $li = $ls->get; } } $return_html .= (the_html(-Part => "header", -Title => "There seems to be a problem", -List => $li->{list}, -Start_Form => 0, )); if(defined($error{$args{-Error}})) { my $error_msg = $error{$args{-Error}}; require DADA::Template::Widgets; if($args{-Error} ne 'bad_setup'){ if($LOGIN_WIDGET eq 'popup_menu'){ $list_login_form = DADA::Template::Widgets::list_popup_login_form(); } elsif($LOGIN_WIDGET eq 'text_box') { $list_login_form = DADA::Template::Widgets::screen(-screen => 'text_box_login_form.tmpl', -expr => 1); }else{ warn "'$LOGIN_WIDGET' misconfigured!" } } my $list_popup_subscription_form; my $list_popup_unsubscription_form; if($args{-List}){ $list_popup_subscription_form = DADA::Template::Widgets::screen(-screen => 'list_subscribe_form.tmpl', -list => $args{-List}, -expr => 1, -vars => {-email => $args{-Email}}); $list_popup_unsubscription_form = DADA::Template::Widgets::screen(-screen => 'list_subscribe_form.tmpl', -list => $args{-List}, -expr => 1, -vars => {-email => $args{-Email}, -set_flavor => 'u'} ); }else{ $list_popup_subscription_form = DADA::Template::Widgets::list_popup_subscription_form(-email => $args{-Email}, -show_hidden =>1); $list_popup_unsubscription_form = DADA::Template::Widgets::list_popup_subscription_form(-email => $args{-Email}, -set_flavor => 'u', -show_hidden => 1); } $error_msg =~ s/\[list_popup_subscription_form\]/$list_popup_subscription_form/g; $error_msg =~ s/\[list_popup_unsubscription_form\]/$list_popup_unsubscription_form/g; $error_msg =~ s/\[list_login_form\]/$list_login_form/g; $error_msg =~ s/\[email\]/$args{-Email}/g; $error_msg = interpolate_string(-String => $error_msg, -List_Db_Ref => $li); $return_html .= $error_msg; }else{ $return_html .= $args{-Error}; } if($args{-Error} eq 'bad_setup'){ my $error_report; my @tests = ($FILES, $TEMPLATES, $TMP); if($PROGRAM_CONFIG_FILE_DIR){ push(@tests, $PROGRAM_CONFIG_FILE_DIR); } my %sift; foreach(@tests){$sift{$_}++} @tests = keys %sift; foreach my $test_dir(@tests){ unless(-d $test_dir){ $error_report .= "'$test_dir' is NOT a directory.
\n"; } unless(-e $test_dir){ $error_report .= "'$test_dir' DOES NOT exist.
\n"; } } $return_html .= $error_report; } if(keys %$li){ if (($list_exists > 0) && ($li->{list_owner_email})) { $return_html .= 'If you would like to receive more assistance, please email the '; $return_html .= 'list owner with your problem.
'; } } $return_html .= (the_html( -Part => "footer", -List => $li->{list}, -End_Form => 0, -Site_Name => $li->{website_name}, -Site_URL => $li->{website_url}, )); return $return_html; }