* Started adding in front-end support for managing email servers and alert recipients. Added the new 'Email' module to (later) habdle all email-related tasks.
* Fixed a bug in Accounts->read_cookies where, when a user's hash had expired, the logged error message didn't show the user's name. Signed-off-by: Digimer <digimer@alteeve.ca>main
parent
2f81275551
commit
c3869a2ff6
17 changed files with 293 additions and 20 deletions
@ -0,0 +1,121 @@ |
||||
package Anvil::Tools::Email; |
||||
# |
||||
# This module contains methods used to manage the local postfix server and handle and dispatch email via |
||||
# mailx. |
||||
# |
||||
|
||||
use strict; |
||||
use warnings; |
||||
use Scalar::Util qw(weaken isweak); |
||||
use Data::Dumper; |
||||
|
||||
our $VERSION = "3.0.0"; |
||||
my $THIS_FILE = "Email.pm"; |
||||
|
||||
### Methods; |
||||
|
||||
=pod |
||||
|
||||
=encoding utf8 |
||||
|
||||
=head1 NAME |
||||
|
||||
Anvil::Tools::Email |
||||
|
||||
Provides all methods used to manage the local C<< postfix >> server and handle and dispatch email via C<< mailx >> |
||||
|
||||
=head1 SYNOPSIS |
||||
|
||||
use Anvil::Tools; |
||||
|
||||
# Get a common object handle on all Anvil::Tools modules. |
||||
my $anvil = Anvil::Tools->new(); |
||||
|
||||
# Access to methods using '$anvil->Email->X'. |
||||
# |
||||
# |
||||
|
||||
=head1 METHODS |
||||
|
||||
Methods in this module; |
||||
|
||||
=cut |
||||
sub new |
||||
{ |
||||
my $class = shift; |
||||
my $self = { |
||||
}; |
||||
|
||||
bless $self, $class; |
||||
|
||||
return ($self); |
||||
} |
||||
|
||||
# Get a handle on the Anvil::Tools object. I know that technically that is a sibling module, but it makes more |
||||
# sense in this case to think of it as a parent. |
||||
sub parent |
||||
{ |
||||
my $self = shift; |
||||
my $parent = shift; |
||||
|
||||
$self->{HANDLE}{TOOLS} = $parent if $parent; |
||||
|
||||
# Defend against memory leads. See Scalar::Util'. |
||||
if (not isweak($self->{HANDLE}{TOOLS})) |
||||
{ |
||||
weaken($self->{HANDLE}{TOOLS}); |
||||
} |
||||
|
||||
return ($self->{HANDLE}{TOOLS}); |
||||
} |
||||
|
||||
############################################################################################################# |
||||
# Public methods # |
||||
############################################################################################################# |
||||
|
||||
=head2 check_postfix |
||||
|
||||
This method checks the current postfix server configuration to see if it needs to be updated, then checks to see if the local C<< postfix >> daemin is enabled and started. |
||||
|
||||
If any problem is encountered, C<< 1 >> is returned. Otherwise, if all is well, C<< 0 >> is returned. |
||||
|
||||
Parameters; |
||||
|
||||
=head3 config (optional, default '1') |
||||
|
||||
If set to C<< 0 >>, the configuration is not checked or updated. |
||||
|
||||
=head3 daemon (optional, default '1') |
||||
|
||||
If set to C<< 0 >>, the C<< postfix >> daemon is not checked or started. |
||||
|
||||
=cut |
||||
sub check_postfix |
||||
{ |
||||
my $self = shift; |
||||
my $parameter = shift; |
||||
my $anvil = $self->parent; |
||||
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3; |
||||
|
||||
my $problem = 0; |
||||
my $config = defined $parameter->{config} ? $parameter->{config} : 1; |
||||
my $daemon = defined $parameter->{daemon} ? $parameter->{daemon} : 1; |
||||
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { |
||||
config => $config, |
||||
daemon => $daemon, |
||||
}}); |
||||
|
||||
|
||||
|
||||
return($problem); |
||||
} |
||||
|
||||
# =head3 |
||||
# |
||||
# Private Functions; |
||||
# |
||||
# =cut |
||||
|
||||
############################################################################################################# |
||||
# Private functions # |
||||
############################################################################################################# |
@ -0,0 +1,37 @@ |
||||
<!-- start main-menu --> |
||||
<table align="center" class="anvil_main_menu"> |
||||
<script type="text/javascript" src="/skins/alteeve/email.js"></script> |
||||
<tr> |
||||
<td colspan="2"> |
||||
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2" class="title"> |
||||
#!string!striker_0165!# |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td colspan="2"> |
||||
|
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td class="main_option_icon"> |
||||
<a href="?email=true&task=email_server"><img src="#!data!skin::url!#/images/email_server.png" class="top_icon" ></a> |
||||
</td> |
||||
<td class="main_option"> |
||||
<a href="?email=true&task=email_server">#!string!striker_0166!#</a> |
||||
</td> |
||||
</tr> |
||||
<tr> |
||||
<td class="main_option_icon"> |
||||
<a href="?email=true&task=email_recipient"><img src="#!data!skin::url!#/images/email_recipient.png" class="top_icon" ></a> |
||||
</td> |
||||
<td class="main_option"> |
||||
<a href="?email=true&task=email_recipient">#!string!striker_0167!#</a> |
||||
</td> |
||||
</tr> |
||||
</table> |
||||
<!-- end main-menu --> |
||||
|
@ -0,0 +1,6 @@ |
||||
$.ajaxSetup({ |
||||
cache: false |
||||
}); |
||||
$(function() {
|
||||
|
||||
}); |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 13 KiB |
Loading…
Reference in new issue