A few fixups in ptyhon, plus mailstats panel json 1st pass
This commit is contained in:
		
							
								
								
									
										215
									
								
								Targets/Mailstats/Mailstats-Custom.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										215
									
								
								Targets/Mailstats/Mailstats-Custom.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,215 @@
 | 
			
		||||
#
 | 
			
		||||
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-04-04 12:46:00 
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# Routines to be edited by the developer to provide content and validation for parameters
 | 
			
		||||
# and provison of the control data for table(s)
 | 
			
		||||
#
 | 
			
		||||
use esmith::util;
 | 
			
		||||
use esmith::util::network;
 | 
			
		||||
use esmith::ConfigDB;
 | 
			
		||||
use esmith::HostsDB;
 | 
			
		||||
use esmith::AccountsDB;
 | 
			
		||||
use esmith::NetworksDB;
 | 
			
		||||
use esmith::DomainsDB;
 | 
			
		||||
 | 
			
		||||
use constant FALSE => 0;
 | 
			
		||||
use constant TRUE  => 1;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#The most common ones
 | 
			
		||||
#my $cdb 
 | 
			
		||||
#my $adb 
 | 
			
		||||
#my $ndb 
 | 
			
		||||
#my $hdb 
 | 
			
		||||
#my $ddb 
 | 
			
		||||
 | 
			
		||||
# Validation routines - parameters for each panel
 | 
			
		||||
 | 
			
		||||
	sub validate_TABLE {
 | 
			
		||||
		my $c = shift;
 | 
			
		||||
		my $prefix_data = shift; #Data hash as parameter
 | 
			
		||||
		# Validation for each field 
 | 
			
		||||
		my $ret = "";
 | 
			
		||||
		
 | 
			
		||||
		if (! TRUE) #validate $c->param('StatsDate')
 | 
			
		||||
			{$ret .= 'Validation for StatsDate failed';}	
 | 
			
		||||
		if ($ret eq "") {$ret = 'ok';}
 | 
			
		||||
		return $ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sub validate_CONFIG {
 | 
			
		||||
		my $c = shift;
 | 
			
		||||
		my $prefix_data = shift; #Data hash as parameter
 | 
			
		||||
		# Validation for each field 
 | 
			
		||||
		my $ret = "";
 | 
			
		||||
		
 | 
			
		||||
		if (! TRUE) #validate $c->param('TextorHTML')
 | 
			
		||||
			{$ret .= 'Validation for TextorHTML failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('Email')
 | 
			
		||||
			{$ret .= 'Validation for Email failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('EmailHost')
 | 
			
		||||
			{$ret .= 'Validation for EmailHost failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('EmailUser')
 | 
			
		||||
			{$ret .= 'Validation for EmailUser failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('DBSave')
 | 
			
		||||
			{$ret .= 'Validation for DBSave failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('DBHost')
 | 
			
		||||
			{$ret .= 'Validation for DBHost failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('DBUser')
 | 
			
		||||
			{$ret .= 'Validation for DBUser failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('CountrySelect')
 | 
			
		||||
			{$ret .= 'Validation for CountrySelect failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('AccumCountryCodes')
 | 
			
		||||
			{$ret .= 'Validation for AccumCountryCodes failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('EnableRHSBL')
 | 
			
		||||
			{$ret .= 'Validation for EnableRHSBL failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('EnableRHSBL')
 | 
			
		||||
			{$ret .= 'Validation for EnableRHSBL failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('RBLLIST')
 | 
			
		||||
			{$ret .= 'Validation for RBLLIST failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('SBLLIST')
 | 
			
		||||
			{$ret .= 'Validation for SBLLIST failed';}	
 | 
			
		||||
		if (! TRUE) #validate $c->param('UBLLIST')
 | 
			
		||||
			{$ret .= 'Validation for UBLLIST failed';}	
 | 
			
		||||
		if ($ret eq "") {$ret = 'ok';}
 | 
			
		||||
		return $ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Get singleton data for each panel
 | 
			
		||||
 | 
			
		||||
	sub get_data_for_panel_TABLE {
 | 
			
		||||
		# Return a hash with the fields required which will be loaded into the shared data 
 | 
			
		||||
		my $c = shift;
 | 
			
		||||
		my %ret = (
 | 
			
		||||
			'Data1'=>'Data for TABLE', #Example
 | 
			
		||||
			# fields from Inputs in TABLE $fields['TABLE']
 | 
			
		||||
			'StatsDate'=>'StatsDate contents',
 | 
			
		||||
			
 | 
			
		||||
		);
 | 
			
		||||
		return %ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sub get_data_for_panel_CONFIG {
 | 
			
		||||
		# Return a hash with the fields required which will be loaded into the shared data 
 | 
			
		||||
		my $c = shift;
 | 
			
		||||
		my %ret = (
 | 
			
		||||
			'Data1'=>'Data for CONFIG', #Example
 | 
			
		||||
			# fields from Inputs in CONFIG $fields['CONFIG']
 | 
			
		||||
			'TextorHTML'=>'TextorHTML contents',
 | 
			
		||||
			'Email'=>'Email contents',
 | 
			
		||||
			'EmailHost'=>'EmailHost contents',
 | 
			
		||||
			'EmailUser'=>'EmailUser contents',
 | 
			
		||||
			'DBSave'=>'DBSave contents',
 | 
			
		||||
			'DBHost'=>'DBHost contents',
 | 
			
		||||
			'DBUser'=>'DBUser contents',
 | 
			
		||||
			'CountrySelect'=>'CountrySelect contents',
 | 
			
		||||
			'AccumCountryCodes'=>'AccumCountryCodes contents',
 | 
			
		||||
			'EnableRHSBL'=>'EnableRHSBL contents',
 | 
			
		||||
			'EnableRHSBL'=>'EnableRHSBL contents',
 | 
			
		||||
			'RBLLIST'=>'RBLLIST contents',
 | 
			
		||||
			'SBLLIST'=>'SBLLIST contents',
 | 
			
		||||
			'UBLLIST'=>'UBLLIST contents',
 | 
			
		||||
			
 | 
			
		||||
		);
 | 
			
		||||
		return %ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Get control data for table(s)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Return hash with values from row in which link clicked on table
 | 
			
		||||
 | 
			
		||||
	sub get_selected_TABLE {
 | 
			
		||||
		my $c = shift;
 | 
			
		||||
		my $selected = shift; #Parameter is name of selected row.
 | 
			
		||||
		my $is_new_record = shift; #Indicates new record required (defaults)
 | 
			
		||||
		my %ret = {};
 | 
			
		||||
		return %ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sub get_selected_CONFIG {
 | 
			
		||||
		my $c = shift;
 | 
			
		||||
		my $selected = shift; #Parameter is name of selected row.
 | 
			
		||||
		my $is_new_record = shift; #Indicates new record required (defaults)
 | 
			
		||||
		my %ret = {};
 | 
			
		||||
		return %ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#after sucessful modify or create or whatever and submit then perfom (if the params validate)
 | 
			
		||||
 | 
			
		||||
	sub perform_TABLE {
 | 
			
		||||
		my $c = shift;
 | 
			
		||||
		my $prefix_data = shift; #Data hash as parameter
 | 
			
		||||
		my $ret = "";
 | 
			
		||||
		my $db = $cdb; #maybe one of the others
 | 
			
		||||
		my $dbkey = 'ChangeThis';
 | 
			
		||||
		# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
 | 
			
		||||
		
 | 
			
		||||
		if (! TRUE) #copy or perform with value: StatsDate e.g. $db->set_prop($dbkey,'StatsDate',$c->param('StatsDate'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for StatsDate';}
 | 
			
		||||
		if ($ret eq "") {$ret = 'ok';}
 | 
			
		||||
		return $ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	sub perform_CONFIG {
 | 
			
		||||
		my $c = shift;
 | 
			
		||||
		my $prefix_data = shift; #Data hash as parameter
 | 
			
		||||
		my $ret = "";
 | 
			
		||||
		my $db = $cdb; #maybe one of the others
 | 
			
		||||
		my $dbkey = 'ChangeThis';
 | 
			
		||||
		# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
 | 
			
		||||
		
 | 
			
		||||
		if (! TRUE) #copy or perform with value: TextorHTML e.g. $db->set_prop($dbkey,'TextorHTML',$c->param('TextorHTML'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for TextorHTML';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: Email e.g. $db->set_prop($dbkey,'Email',$c->param('Email'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for Email';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: EmailHost e.g. $db->set_prop($dbkey,'EmailHost',$c->param('EmailHost'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for EmailHost';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: EmailUser e.g. $db->set_prop($dbkey,'EmailUser',$c->param('EmailUser'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for EmailUser';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: DBSave e.g. $db->set_prop($dbkey,'DBSave',$c->param('DBSave'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for DBSave';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: DBHost e.g. $db->set_prop($dbkey,'DBHost',$c->param('DBHost'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for DBHost';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: DBUser e.g. $db->set_prop($dbkey,'DBUser',$c->param('DBUser'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for DBUser';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: CountrySelect e.g. $db->set_prop($dbkey,'CountrySelect',$c->param('CountrySelect'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for CountrySelect';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: AccumCountryCodes e.g. $db->set_prop($dbkey,'AccumCountryCodes',$c->param('AccumCountryCodes'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for AccumCountryCodes';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: EnableRHSBL e.g. $db->set_prop($dbkey,'EnableRHSBL',$c->param('EnableRHSBL'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for EnableRHSBL';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: EnableRHSBL e.g. $db->set_prop($dbkey,'EnableRHSBL',$c->param('EnableRHSBL'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for EnableRHSBL';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: RBLLIST e.g. $db->set_prop($dbkey,'RBLLIST',$c->param('RBLLIST'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for RBLLIST';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: SBLLIST e.g. $db->set_prop($dbkey,'SBLLIST',$c->param('SBLLIST'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for SBLLIST';}
 | 
			
		||||
		if (! TRUE) #copy or perform with value: UBLLIST e.g. $db->set_prop($dbkey,'UBLLIST',$c->param('UBLLIST'),type=>'service'))
 | 
			
		||||
			{$ret .= 'Perform/save failed for UBLLIST';}
 | 
			
		||||
		if ($ret eq "") {$ret = 'ok';}
 | 
			
		||||
		return $ret;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
sub create_link{
 | 
			
		||||
	# WIP
 | 
			
		||||
	my ($c,$route, $panel, $index) = @_;
 | 
			
		||||
	my $link = "$route?trt=$panel&Selected=$index";
 | 
			
		||||
	return $link;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub get_StatsDate{
 | 
			
		||||
	return ['yesterday']
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub get_CountrCodes{
 | 
			
		||||
	return ['UK']
 | 
			
		||||
}
 | 
			
		||||
1;
 | 
			
		||||
							
								
								
									
										315
									
								
								Targets/Mailstats/Mailstats.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										315
									
								
								Targets/Mailstats/Mailstats.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,315 @@
 | 
			
		||||
package SrvMngr::Controller::Mailstats;
 | 
			
		||||
#
 | 
			
		||||
# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-04-04 13:12:40 
 | 
			
		||||
#
 | 
			
		||||
#----------------------------------------------------------------------
 | 
			
		||||
# heading     : Investigation
 | 
			
		||||
# description : Mailstats
 | 
			
		||||
# navigation  : 4000 700
 | 
			
		||||
#
 | 
			
		||||
# name : mailstats,    method : get,   url : /mailstats,   ctlact : Mailstats#main
 | 
			
		||||
# name : mailstatsu,   method : post,  url : /mailstatsu,  ctlact : Mailstats#do_update
 | 
			
		||||
# name : mailstatsd,   method : get,   url : /mailstatsd,  ctlact : Mailstats#do_display
 | 
			
		||||
#
 | 
			
		||||
# routes : end
 | 
			
		||||
#
 | 
			
		||||
# Documentation: https://wiki.contribs.org/Mailstats
 | 
			
		||||
#----------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Scheme of things:
 | 
			
		||||
#
 | 
			
		||||
# TBA!!
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
use warnings;
 | 
			
		||||
use Mojo::Base 'Mojolicious::Controller';
 | 
			
		||||
 | 
			
		||||
use constant FALSE => 0;
 | 
			
		||||
use constant TRUE  => 1;
 | 
			
		||||
 | 
			
		||||
use Locale::gettext;
 | 
			
		||||
use SrvMngr::I18N;
 | 
			
		||||
use SrvMngr qw(theme_list init_session);
 | 
			
		||||
 | 
			
		||||
use Data::Dumper;
 | 
			
		||||
 | 
			
		||||
use esmith::util;
 | 
			
		||||
use esmith::util::network;
 | 
			
		||||
use esmith::ConfigDB;
 | 
			
		||||
use esmith::AccountsDB;
 | 
			
		||||
use esmith::NetworksDB;
 | 
			
		||||
use esmith::HostsDB;
 | 
			
		||||
use esmith::DomainsDB;
 | 
			
		||||
 | 
			
		||||
my $cdb;
 | 
			
		||||
my $adb;
 | 
			
		||||
my $ndb; 
 | 
			
		||||
my $hdb; 
 | 
			
		||||
my $ddb; 
 | 
			
		||||
 | 
			
		||||
require '/usr/share/smanager/lib/SrvMngr/Controller/Mailstats-Custom.pm';  #The code that is to be added by the developer
 | 
			
		||||
 | 
			
		||||
sub main {
 | 
			
		||||
#
 | 
			
		||||
# Initial entry - route is "/<whatever>"
 | 
			
		||||
#
 | 
			
		||||
#set initial panel
 | 
			
		||||
#for initial panel:
 | 
			
		||||
	#Specifiy panel to enter
 | 
			
		||||
	#load up _data hash with DB fields
 | 
			
		||||
	#load up stash with pointer(s) to control fields hash(= get-))
 | 
			
		||||
		#and a pointer to the prefix_data hash
 | 
			
		||||
#render initial panel
 | 
			
		||||
 | 
			
		||||
    my $c = shift;
 | 
			
		||||
    $c->app->log->info( $c->log_req );
 | 
			
		||||
 | 
			
		||||
	#The most common ones
 | 
			
		||||
	 $cdb = esmith::ConfigDB->open()   || die("Couldn't open config db");
 | 
			
		||||
	 $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
 | 
			
		||||
	 $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
 | 
			
		||||
	 $hdb = esmith::HostsDB->open() 	  || die("Couldn't open Hosts db");
 | 
			
		||||
	 $ddb = esmith::DomainsDB->open()  || die("Couldn't open Domains db");
 | 
			
		||||
 | 
			
		||||
    my %mst_data = ();
 | 
			
		||||
    my $title = $c->l('mst_Mailstats');
 | 
			
		||||
    my $modul = '';
 | 
			
		||||
 | 
			
		||||
    $mst_data{'trt'} = 'TABLE';
 | 
			
		||||
    
 | 
			
		||||
    #Load any DB entries into the <prefix>_data area so as they are preset in the form
 | 
			
		||||
    # which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
 | 
			
		||||
    my $db = $cdb; #pickup local or global db or Default to config
 | 
			
		||||
    
 | 
			
		||||
	
 | 
			
		||||
	$c->do_display($mst_data{'trt'});
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Post request with params - submit from the form 
 | 
			
		||||
sub do_update {
 | 
			
		||||
#
 | 
			
		||||
# Return after submit pushed on panel (this is a post) - route is "/<whatever>u"
 | 
			
		||||
# parameters in the params hash.
 | 
			
		||||
#
 | 
			
		||||
#load up all params into prefix_data hash:
 | 
			
		||||
#By panel (series of if statements - only one executed):
 | 
			
		||||
		#call validate-PANEL() - return ret = ok or error message
 | 
			
		||||
			
 | 
			
		||||
#if validation not ok:
 | 
			
		||||
	#render back to current panel with error message in stash
 | 
			
		||||
#otherwise:
 | 
			
		||||
	#By panel (series of if statements - only one executed):
 | 
			
		||||
		#do whatever is required: call perform-PANEL() - return "ok" or Error Message
 | 
			
		||||
			#call signal-event for any global actions specified (check it exists - error and continue?)
 | 
			
		||||
			#if action smeserver-<whatever>-update exists
 | 
			
		||||
				#signal_event smeserver-<whatever>-update
 | 
			
		||||
			#call signal-event for any specific actions for thids panel (check it exists first - error and continue)
 | 
			
		||||
		#set success in stash
 | 
			
		||||
		#if no "nextpanel" entry:
 | 
			
		||||
			#set firstpanel
 | 
			
		||||
		#else 
 | 
			
		||||
			#set nextpanel
 | 
			
		||||
		#call render
 | 
			
		||||
	
 | 
			
		||||
    my $c = shift;
 | 
			
		||||
    $c->app->log->info($c->log_req);
 | 
			
		||||
	my $modul = '';
 | 
			
		||||
 | 
			
		||||
	#The most common ones - you might want to comment out any not used.
 | 
			
		||||
	$cdb = esmith::ConfigDB->open()   || die("Couldn't open config db");
 | 
			
		||||
	$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
 | 
			
		||||
	$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
 | 
			
		||||
	$hdb = esmith::HostsDB->open() 	  || die("Couldn't open Hosts db");
 | 
			
		||||
	$ddb = esmith::DomainsDB->open()  || die("Couldn't open Domains db");
 | 
			
		||||
 | 
			
		||||
    my %mst_data = ();
 | 
			
		||||
    my $title = $c->l('mst_Mailstats');
 | 
			
		||||
 | 
			
		||||
	# Accessing all POST/GET parameters
 | 
			
		||||
    my $params = $c->req->params->to_hash;
 | 
			
		||||
 | 
			
		||||
    # Get number of POST parameters
 | 
			
		||||
    #my $num_params = keys scaler %$params;
 | 
			
		||||
    
 | 
			
		||||
    #Params are available in the hash "params" - copy to the prefix_data hash
 | 
			
		||||
    #while (my ($key, $value) = each %{$c->req->params->to_hash}) {
 | 
			
		||||
    #    $mst_data{$key} = $value;
 | 
			
		||||
    #}
 | 
			
		||||
 | 
			
		||||
    # the value of trt will tell you which panel has returned    
 | 
			
		||||
    my $trt = $c->param('trt') || 'TABLE'; #hidden control on every form.
 | 
			
		||||
    my $ret = 'ok';
 | 
			
		||||
 | 
			
		||||
    #Validate the parameters in a custom sub one for each panel (although only one of these will be executed)
 | 
			
		||||
    my $thispanel;
 | 
			
		||||
    
 | 
			
		||||
		if ($trt eq 'TABLE'){
 | 
			
		||||
			#Validate form parameters for panel TABLE
 | 
			
		||||
			$ret = $c->validate_TABLE(\%mst_data);
 | 
			
		||||
			$thispanel = 'TABLE';
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
		if ($trt eq 'CONFIG'){
 | 
			
		||||
			#Validate form parameters for panel CONFIG
 | 
			
		||||
			$ret = $c->validate_CONFIG(\%mst_data);
 | 
			
		||||
			$thispanel = 'CONFIG';
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	if ($ret ne "ok"){
 | 
			
		||||
		$c->do_display($thispanel);
 | 
			
		||||
	} else {
 | 
			
		||||
		#Do whatever is needed, including writing values to the DB
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
			if ($trt eq 'TABLE'){
 | 
			
		||||
				#do whatever is required ...
 | 
			
		||||
				$ret = $c->perform_TABLE(\%mst_data);
 | 
			
		||||
				if ($ret ne "ok") {
 | 
			
		||||
					# return to the panel with error message
 | 
			
		||||
					$c->stash(error => $c->l($ret));
 | 
			
		||||
					$c->stash( 
 | 
			
		||||
						title => $title, 
 | 
			
		||||
						modul => $modul,
 | 
			
		||||
						mst_data  => \%mst_data
 | 
			
		||||
					);
 | 
			
		||||
					$c->render(template => "mailstats");	
 | 
			
		||||
				} else {
 | 
			
		||||
					$c->stash( success => $c->l('mst_TABLE_panel_action_was_successful')); #A bit bland - edit it in the lex file
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
			if ($trt eq 'CONFIG'){
 | 
			
		||||
				#do whatever is required ...
 | 
			
		||||
				$ret = $c->perform_CONFIG(\%mst_data);
 | 
			
		||||
				if ($ret ne "ok") {
 | 
			
		||||
					# return to the panel with error message
 | 
			
		||||
					$c->stash(error => $c->l($ret));
 | 
			
		||||
					$c->stash( 
 | 
			
		||||
						title => $title, 
 | 
			
		||||
						modul => $modul,
 | 
			
		||||
						mst_data  => \%mst_data
 | 
			
		||||
					);
 | 
			
		||||
					$c->render(template => "mailstats");	
 | 
			
		||||
				} else {
 | 
			
		||||
					$c->stash( success => $c->l('mst_CONFIG_panel_action_was_successful')); #A bit bland - edit it in the lex file
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
		# and call any signal-events needed
 | 
			
		||||
		#TBD
 | 
			
		||||
		# Setup shared data and call panel
 | 
			
		||||
		if ('none' eq 'none') {
 | 
			
		||||
			$mst_data{'trt'} = 'TABLE';
 | 
			
		||||
		} else {
 | 
			
		||||
			$mst_data{'trt'} = 'none';
 | 
			
		||||
		}	
 | 
			
		||||
		$c->do_display($mst_data{'trt'});
 | 
			
		||||
	} 
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub do_display {
 | 
			
		||||
#
 | 
			
		||||
# Return after link clicked in table (this is a get) - route is "/<whatever>d"
 | 
			
		||||
# Expects ?trt=PANEL&selected="TableRowName" plus any other required
 | 
			
		||||
#
 | 
			
		||||
# OR it maybe a post from the main panel to add a new record 
 | 
			
		||||
#
 | 
			
		||||
#load up all supplied params into prefix_data hash
 | 
			
		||||
#call get-selected-PANEL() - returns hash of all relevent parameters
 | 
			
		||||
#load up returned hash into prefix_data
 | 
			
		||||
#render - to called panel
 | 
			
		||||
 | 
			
		||||
    my ($c,$trt) = @_;
 | 
			
		||||
    $c->app->log->info($c->log_req);
 | 
			
		||||
 | 
			
		||||
	#The most common ones - you might want to comment out any not used.
 | 
			
		||||
	$cdb = esmith::ConfigDB->open()   || die("Couldn't open config db");
 | 
			
		||||
	$adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
 | 
			
		||||
	$ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
 | 
			
		||||
	$hdb = esmith::HostsDB->open() 	  || die("Couldn't open Hosts db");
 | 
			
		||||
	$ddb = esmith::DomainsDB->open()  || die("Couldn't open Domains db");
 | 
			
		||||
    
 | 
			
		||||
    my %mst_data = ();
 | 
			
		||||
    my $title = $c->l('mst_Mailstats');
 | 
			
		||||
    my $modul = "";
 | 
			
		||||
 | 
			
		||||
	# Accessing all parameters
 | 
			
		||||
    my %params = $c->req->params->to_hash;
 | 
			
		||||
 | 
			
		||||
    # Get number of parameters
 | 
			
		||||
    my $num_params = keys %params;
 | 
			
		||||
    
 | 
			
		||||
    #Tag as Post or Get (ie. create new entry or edit existing one
 | 
			
		||||
    my $is_new_record = ($c->req->method() eq 'POST');
 | 
			
		||||
    
 | 
			
		||||
    #Params are available in the hash "params" - copy to the prefix_data hash
 | 
			
		||||
    #while (my ($key, $value) = each %{$c->req->params->to_hash}) {
 | 
			
		||||
    #    $mst_data{$key} = $value;
 | 
			
		||||
    #}
 | 
			
		||||
 | 
			
		||||
    # the value of trt will tell you which panel has returned   
 | 
			
		||||
    if (! $trt){ 
 | 
			
		||||
		$trt = $c->param('trt') || 'TABLE'; #Indicates where to go now
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
    # Now add in the params from the selected row from the table
 | 
			
		||||
		
 | 
			
		||||
    my %selectedrow;
 | 
			
		||||
    
 | 
			
		||||
		if ($trt eq 'TABLE'){
 | 
			
		||||
			#Validate Get selected row (if applicable)  TABLE
 | 
			
		||||
				%selectedrow = $c->get_selected_TABLE($mst_data{'Selected'},$is_new_record);
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
		if ($trt eq 'CONFIG'){
 | 
			
		||||
			#Validate Get selected row (if applicable)  CONFIG
 | 
			
		||||
				%selectedrow = $c->get_selected_CONFIG($mst_data{'Selected'},$is_new_record);
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
	#Copy in the selected row params to the prefix_data hash to pass to the panel
 | 
			
		||||
	while (my ($key, $value) = each %selectedrow){
 | 
			
		||||
        $mst_data{$key} = $value;
 | 
			
		||||
    }
 | 
			
		||||
	# Where to go now
 | 
			
		||||
	$mst_data{'trt'} = $trt;
 | 
			
		||||
	
 | 
			
		||||
	# Set up other shared data according to the panel to go to
 | 
			
		||||
    
 | 
			
		||||
		if ($trt eq 'TABLE'){
 | 
			
		||||
			# pickup any other contents needed and load them into hash shared with panel
 | 
			
		||||
			my %returned_hash;
 | 
			
		||||
			# subroutine returns a hash directly
 | 
			
		||||
			%returned_hash = $c->get_data_for_panel_TABLE();
 | 
			
		||||
			# Copy each key-value pair from the returned hash to the prefix data hash
 | 
			
		||||
			while (my ($key, $value) = each %returned_hash) {
 | 
			
		||||
				$mst_data{$key} = $value;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
		if ($trt eq 'CONFIG'){
 | 
			
		||||
			# pickup any other contents needed and load them into hash shared with panel
 | 
			
		||||
			my %returned_hash;
 | 
			
		||||
			# subroutine returns a hash directly
 | 
			
		||||
			%returned_hash = $c->get_data_for_panel_CONFIG();
 | 
			
		||||
			# Copy each key-value pair from the returned hash to the prefix data hash
 | 
			
		||||
			while (my ($key, $value) = each %returned_hash) {
 | 
			
		||||
				$mst_data{$key} = $value;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	# and table control fields
 | 
			
		||||
     
 | 
			
		||||
	
 | 
			
		||||
	# Data for panel
 | 
			
		||||
	$c->stash( 
 | 
			
		||||
		title 			=> $title, 
 | 
			
		||||
		modul => $modul,
 | 
			
		||||
		mst_data  => \%mst_data
 | 
			
		||||
	);
 | 
			
		||||
	$c->render(template => "mailstats");
 | 
			
		||||
}    
 | 
			
		||||
1;
 | 
			
		||||
							
								
								
									
										195
									
								
								Targets/Mailstats/_mst_CONFIG.html.ep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										195
									
								
								Targets/Mailstats/_mst_CONFIG.html.ep
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,195 @@
 | 
			
		||||
%#
 | 
			
		||||
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-04-04 13:12:40 
 | 
			
		||||
%#
 | 
			
		||||
<div id="Mailstats-CONFIG" class="partial Mailstats-CONFIG">
 | 
			
		||||
	<script>
 | 
			
		||||
		window.onload = function() {
 | 
			
		||||
		SelectInput();
 | 
			
		||||
	};
 | 
			
		||||
	</script>
 | 
			
		||||
	% if (config->{debug} == 1) {
 | 
			
		||||
		<pre>
 | 
			
		||||
			%= dumper $mst_data
 | 
			
		||||
		</pre>
 | 
			
		||||
	% }
 | 
			
		||||
	% my $btn = l('mst_APPLY');
 | 
			
		||||
	%= form_for "mailstatsu" => (method => 'POST') => begin
 | 
			
		||||
		% param 'trt' => $mst_data->{trt} unless param 'trt';
 | 
			
		||||
		%= hidden_field 'trt' => $mst_data->{trt}
 | 
			
		||||
		%# Inputs etc in here.
 | 
			
		||||
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Specify_if_you_would_like')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% my @TextorHTML_options = [['HTML' => 'HTML'], ['Text' => 'Text'], ['Both' => 'Both'], ['Neither' => 'Neither']];
 | 
			
		||||
			% param 'TextorHTML' => $mst_data->{TextorHTML} unless param 'TextorHTML';
 | 
			
		||||
			%= select_field 'TextorHTML' => @TextorHTML_options, class => 'input', id => 'TextorHTML_select'
 | 
			
		||||
		<br></span>	</p>
 | 
			
		||||
	
 | 
			
		||||
		<div class=emailwanted>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<h2 class='subh'><%=l('mst_Email_details')%></h2>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Email_for_stats')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'Email' => $mst_data->{Email} unless param 'Email';
 | 
			
		||||
			%=email_field 'Email', class => 'emai3'
 | 
			
		||||
		</span></p>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Hostname_for_email_server')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'EmailHost' => $mst_data->{EmailHost} unless param 'EmailHost';
 | 
			
		||||
			%= text_field 'EmailHost', size => '50', class => 'textinput EmailHost' , pattern=>'.*' , placeholder=>'EmailHost', title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class='label'>
 | 
			
		||||
			%=l('mst_Port_number_for_email_server')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'EmailPort' => $mst_data->{EmailPort} unless param 'EmailPort';
 | 
			
		||||
			%=number_field 'EmailPort', class => 'numb6'
 | 
			
		||||
		</span></p>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_User_name_for_email_sending')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'EmailUser' => $mst_data->{EmailUser} unless param 'EmailUser';
 | 
			
		||||
			%= text_field 'EmailUser', size => '50', class => 'textinput EmailUser' , pattern=>'.*' , placeholder=>'EmailUser', title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class='label'>
 | 
			
		||||
			%=l('mst_User_Password_for_email_sending')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'EmailPassword' => $mst_data->{EmailPassword} unless param 'EmailPassword';
 | 
			
		||||
			%=password_field 'EmailPassword', class => 'pass8 sme-password', autocomplete => 'off'
 | 
			
		||||
		</span></p>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		</div>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Would_you_like_to_save')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% my @DBSave_options = [['yes' => 'yes'], ['no' => 'no']];
 | 
			
		||||
			% param 'DBSave' => $mst_data->{DBSave} unless param 'DBSave';
 | 
			
		||||
			%= select_field 'DBSave' => @DBSave_options, class => 'input', id => 'DBSave_select'
 | 
			
		||||
		<br></span>	</p>
 | 
			
		||||
	
 | 
			
		||||
		<div class=dbwanted>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<h2 class='subh2'><%=l('mst_Details_for_connection_to_database')%></h2>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Hostname_for_DB_server')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'DBHost' => $mst_data->{DBHost} unless param 'DBHost';
 | 
			
		||||
			%= text_field 'DBHost', size => '50', class => 'textinput DBHost' , pattern=>'.*' , placeholder=>'DBHost', title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class='label'>
 | 
			
		||||
			%=l('mst_Port_number_for_DB_server')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'DBPort' => $mst_data->{DBPort} unless param 'DBPort';
 | 
			
		||||
			%=number_field 'DBPort', class => 'numb11'
 | 
			
		||||
		</span></p>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_User_name_for_DB_sending')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'DBUser' => $mst_data->{DBUser} unless param 'DBUser';
 | 
			
		||||
			%= text_field 'DBUser', size => '50', class => 'textinput DBUser' , pattern=>'.*' , placeholder=>'DBUser', title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class='label'>
 | 
			
		||||
			%=l('mst_User_Password_for_DB_sending')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'DBPassword' => $mst_data->{DBPassword} unless param 'DBPassword';
 | 
			
		||||
			%=password_field 'DBPassword', class => 'pass13 sme-password', autocomplete => 'off'
 | 
			
		||||
		</span></p>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		</div>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<h2 class='subh3'><%=l('mst_Email_filtering_/_exclusion')%></h2>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Select_the_countries_you_would')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% my @CountrySelect_options = [['$c->get_CountryCodes()' => '$c->get_CountryCodes()']];
 | 
			
		||||
			% param 'CountrySelect' => $mst_data->{CountrySelect} unless param 'CountrySelect';
 | 
			
		||||
			%= select_field 'CountrySelect' => @CountrySelect_options, class => 'input', id => 'CountrySelect_select'
 | 
			
		||||
		<br></span>	</p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Accumlated_country_codes_(editable)')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'AccumCountryCodes' => $mst_data->{AccumCountryCodes} unless param 'AccumCountryCodes';
 | 
			
		||||
			%= text_field 'AccumCountryCodes', size => '50', class => 'textinput AccumCountryCodes' , pattern=>'.*' , placeholder=>'AccumCountryCodes', title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Enable_RHSBL_checking')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% my @EnableRHSBL_options = [['yes' => 'yes'], ['no' => 'no']];
 | 
			
		||||
			% param 'EnableRHSBL' => $mst_data->{EnableRHSBL} unless param 'EnableRHSBL';
 | 
			
		||||
			%= select_field 'EnableRHSBL' => @EnableRHSBL_options, class => 'input', id => 'EnableRHSBL_select'
 | 
			
		||||
		<br></span>	</p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Enable_DNSBL_checking')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% my @EnableDNSBL_options = [['yes' => 'yes'], ['no' => 'no']];
 | 
			
		||||
			% param 'EnableDNSBL' => $mst_data->{EnableDNSBL} unless param 'EnableDNSBL';
 | 
			
		||||
			%= select_field 'EnableDNSBL' => @EnableDNSBL_options, class => 'input', id => 'EnableDNSBL_select'
 | 
			
		||||
		<br></span>	</p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_RBL_Servers_to_use')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'RBLLIST' => $mst_data->{RBLLIST} unless param 'RBLLIST';
 | 
			
		||||
			%= text_field 'RBLLIST', size => '50', class => 'textinput RBLLIST' , pattern=>'.*' , placeholder=>'RBLLIST', title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_SBL_Servers_to_use')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'SBLLIST' => $mst_data->{SBLLIST} unless param 'SBLLIST';
 | 
			
		||||
			%= text_field 'SBLLIST', size => '50', class => 'textinput SBLLIST' , pattern=>'.*' , placeholder=>'SBLLIST', title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_UBL_Servers_to_use')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'UBLLIST' => $mst_data->{UBLLIST} unless param 'UBLLIST';
 | 
			
		||||
			%= text_field 'UBLLIST', size => '50', class => 'textinput UBLLIST' , pattern=>'.*' , placeholder=>'UBLLIST', title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	
 | 
			
		||||
		<h2 class='subh4'><%=l('mst_Spamassassin_parameters_for_rejecting_email')%></h2>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class='label'>
 | 
			
		||||
			%=l('mst_Score_over_which_email_will')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'RejectLevel' => $mst_data->{RejectLevel} unless param 'RejectLevel';
 | 
			
		||||
			%=number_field 'RejectLevel', class => 'numb21'
 | 
			
		||||
		</span></p>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<p><span class='label'>
 | 
			
		||||
			%=l('mst_Score_over_which_email_will')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param 'TagLevel' => $mst_data->{TagLevel} unless param 'TagLevel';
 | 
			
		||||
			%=number_field 'TagLevel', class => 'numb22'
 | 
			
		||||
		</span></p>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		%# Probably finally by a submit.
 | 
			
		||||
	%end    
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										52
									
								
								Targets/Mailstats/_mst_TABLE.html.ep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								Targets/Mailstats/_mst_TABLE.html.ep
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
			
		||||
%#
 | 
			
		||||
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-04-04 13:12:40 
 | 
			
		||||
%#
 | 
			
		||||
<div id="Mailstats-TABLE" class="partial Mailstats-TABLE">
 | 
			
		||||
	<script>
 | 
			
		||||
		window.onload = function() {
 | 
			
		||||
		SelectInput();
 | 
			
		||||
	};
 | 
			
		||||
	</script>
 | 
			
		||||
	% if (config->{debug} == 1) {
 | 
			
		||||
		<pre>
 | 
			
		||||
			%= dumper $mst_data
 | 
			
		||||
		</pre>
 | 
			
		||||
	% }
 | 
			
		||||
	% my $btn = l('mst_APPLY');
 | 
			
		||||
	%= form_for "mailstatsu" => (method => 'POST') => begin
 | 
			
		||||
		% param 'trt' => $mst_data->{trt} unless param 'trt';
 | 
			
		||||
		%= hidden_field 'trt' => $mst_data->{trt}
 | 
			
		||||
		%# Inputs etc in here.
 | 
			
		||||
 | 
			
		||||
		<div class=inline-buttons>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<a href='mailstatsd?trt=CONFIG' class='link link1'>
 | 
			
		||||
			%= l('mst_Configure_Mailstats')
 | 
			
		||||
		</a>
 | 
			
		||||
		%#= link_to l('mst_Configure_Mailstats'), 'mailstatsd?trt=CONFIG' , class=>'link link1'
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
		</div>
 | 
			
		||||
		
 | 
			
		||||
	
 | 
			
		||||
		<h2 class='subh1'><%=l('mst_Table_of_email_status')%></h2>
 | 
			
		||||
	
 | 
			
		||||
		<p class='paragraph para1'>
 | 
			
		||||
			%=l('mst_Descriptive_paragraph')
 | 
			
		||||
		</p>
 | 
			
		||||
	
 | 
			
		||||
		<p><span class=label>
 | 
			
		||||
			%=l('mst_Date_for_Stats_display')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% my @StatsDate_options = [['$c->get_StatsDate()' => '$c->get_StatsDate()']];
 | 
			
		||||
			% param 'StatsDate' => $mst_data->{StatsDate} unless param 'StatsDate';
 | 
			
		||||
			%= select_field 'StatsDate' => @StatsDate_options, class => 'input', id => 'StatsDate_select'
 | 
			
		||||
		<br></span>	</p>
 | 
			
		||||
	
 | 
			
		||||
		<object data="<%='mailstats/$c->stash("url")' %>" title="<%= $c->stash('title') %>"  type="text/html" ><%= $c->stash('title') %> not found</object>
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
		%# Probably finally by a submit.
 | 
			
		||||
	%end    
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										43
									
								
								Targets/Mailstats/mailstats.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								Targets/Mailstats/mailstats.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
/*
 | 
			
		||||
Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-04-04 13:12:40
 | 
			
		||||
*/
 | 
			
		||||
.Mailstats-panel {}
 | 
			
		||||
.name {}
 | 
			
		||||
.rout {}
 | 
			
		||||
.grou1 {}
 | 
			
		||||
.link1 {}
 | 
			
		||||
.endg1 {}
 | 
			
		||||
.subh1 {}
 | 
			
		||||
.para1 {}
 | 
			
		||||
.sele1 {}
 | 
			
		||||
.obje2 {}
 | 
			
		||||
.name {}
 | 
			
		||||
.rout {}
 | 
			
		||||
.sele4 {}
 | 
			
		||||
.grou1 {}
 | 
			
		||||
.subh {}
 | 
			
		||||
.emai3 {}
 | 
			
		||||
.text5 {}
 | 
			
		||||
.numb6 {}
 | 
			
		||||
.text7 {}
 | 
			
		||||
.pass8 {}
 | 
			
		||||
.endg1 {}
 | 
			
		||||
.sele9 {}
 | 
			
		||||
.grou2 {}
 | 
			
		||||
.subh2 {}
 | 
			
		||||
.text10 {}
 | 
			
		||||
.numb11 {}
 | 
			
		||||
.text12 {}
 | 
			
		||||
.pass13 {}
 | 
			
		||||
.endg2 {}
 | 
			
		||||
.subh3 {}
 | 
			
		||||
.sele14 {}
 | 
			
		||||
.text15 {}
 | 
			
		||||
.sele16 {}
 | 
			
		||||
.sele17 {}
 | 
			
		||||
.text18 {}
 | 
			
		||||
.text19 {}
 | 
			
		||||
.text20 {}
 | 
			
		||||
.subh4 {}
 | 
			
		||||
.numb21 {}
 | 
			
		||||
.numb22 {}
 | 
			
		||||
							
								
								
									
										60
									
								
								Targets/Mailstats/mailstats.html.ep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								Targets/Mailstats/mailstats.html.ep
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
%#
 | 
			
		||||
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-04-04 13:12:40 
 | 
			
		||||
%#
 | 
			
		||||
% layout 'default', title => "Sme server 2 - Mailstats", share_dir => './';
 | 
			
		||||
%# css specific to this panel:
 | 
			
		||||
% content_for 'module' => begin
 | 
			
		||||
%= stylesheet '/css/mailstats.css'
 | 
			
		||||
%= javascript '/js/mailstats.js'
 | 
			
		||||
<div id="module" class="module Mailstats-panel">
 | 
			
		||||
 | 
			
		||||
    % if (config->{debug} == 1) {
 | 
			
		||||
	<pre>
 | 
			
		||||
		%= dumper $c->current_route
 | 
			
		||||
		%= dumper $mst_data->{trt}
 | 
			
		||||
	</pre>
 | 
			
		||||
    % }
 | 
			
		||||
    
 | 
			
		||||
    <h1><%=$title%></h1>
 | 
			
		||||
 | 
			
		||||
    % if ( stash('modul')) {
 | 
			
		||||
	%= $c->render_to_string(inline => stash('modul') );
 | 
			
		||||
    % }
 | 
			
		||||
 | 
			
		||||
   	%if ($c->stash('first')) {
 | 
			
		||||
	    <br><p>
 | 
			
		||||
		%=$c->render_to_string(inline =>$c->l($c->stash('first')))
 | 
			
		||||
		</p>
 | 
			
		||||
 | 
			
		||||
	%} elsif ($c->stash('success')) {
 | 
			
		||||
		<div class='success '>
 | 
			
		||||
			<p>
 | 
			
		||||
				%= $c->l($c->stash('success'));
 | 
			
		||||
			</p>
 | 
			
		||||
		</div>
 | 
			
		||||
		<br />
 | 
			
		||||
 | 
			
		||||
	%} elsif ($c->stash('error')) { 
 | 
			
		||||
	   <div class='sme-error'>
 | 
			
		||||
			<p>
 | 
			
		||||
				%= $c->l($c->stash('error'));
 | 
			
		||||
			</p>
 | 
			
		||||
    	</div>
 | 
			
		||||
		<br />
 | 
			
		||||
	%}
 | 
			
		||||
 | 
			
		||||
	%#Routing to partials according to trt parameter.
 | 
			
		||||
	%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
 | 
			
		||||
	
 | 
			
		||||
	% if ($mst_data->{trt} eq "TABLE") {
 | 
			
		||||
		%= include 'partials/_mst_TABLE'
 | 
			
		||||
	%}
 | 
			
		||||
	
 | 
			
		||||
	% if ($mst_data->{trt} eq "CONFIG") {
 | 
			
		||||
		%= include 'partials/_mst_CONFIG'
 | 
			
		||||
	%}
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
</div>
 | 
			
		||||
%end
 | 
			
		||||
							
								
								
									
										5
									
								
								Targets/Mailstats/mailstats.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								Targets/Mailstats/mailstats.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
//
 | 
			
		||||
//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-04-04 13:12:40
 | 
			
		||||
//
 | 
			
		||||
$(document).ready(function() {
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										35
									
								
								Targets/Mailstats/mailstats_en.lex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Targets/Mailstats/mailstats_en.lex
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
#
 | 
			
		||||
# Generated by SM2Gen version: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-04-04 13:12:40
 | 
			
		||||
#
 | 
			
		||||
'mst_Score_over_which_email_will' => 'Score over which email will be fully rejected',
 | 
			
		||||
'mst_User_Password_for_DB_sending' => 'User Password for DB sending',
 | 
			
		||||
'mst_Hostname_for_email_server' => 'hostage for email server',
 | 
			
		||||
'mst_User_name_for_email_sending' => 'User name for email sending',
 | 
			
		||||
'mst_Email_details' => 'Email details',
 | 
			
		||||
'mst_Mailstats' => 'mailshots',
 | 
			
		||||
'mst_Email_filtering_/_exclusion' => 'Email filtering / exclusion',
 | 
			
		||||
'mst_CONFIG_panel_action_was_successful' => 'CONFIG panel action was successful',
 | 
			
		||||
'mst_Table_of_email_status' => 'Table of email status',
 | 
			
		||||
'mst_User_Password_for_email_sending' => 'User Password for email sending',
 | 
			
		||||
'mst_UBL_Servers_to_use' => 'UBL Servers to use',
 | 
			
		||||
'mst_Hostname_for_DB_server' => 'hostage for DB server',
 | 
			
		||||
'mst_Accumlated_country_codes_(editable)' => 'accumulated country codes editable',
 | 
			
		||||
'mst_Date_for_Stats_display' => 'Date for Stats display',
 | 
			
		||||
'mst_Enable_DNSBL_checking' => 'Enable DNSBL checking',
 | 
			
		||||
'mst_Details_for_connection_to_database' => 'Details for connection to database for saving email status',
 | 
			
		||||
'mst_SBL_Servers_to_use' => 'SBL Servers to use',
 | 
			
		||||
'mst_APPLY' => 'Apply',
 | 
			
		||||
'mst_Port_number_for_DB_server' => 'Port number for DB server',
 | 
			
		||||
'mst_Select_the_countries_you_would' => 'Select the countries you would like to reject',
 | 
			
		||||
'mst_Descriptive_paragraph' => 'Descriptive paragraph',
 | 
			
		||||
'mst_Port_number_for_email_server' => 'Port number for email server',
 | 
			
		||||
'mst_Email_for_stats' => 'Email for stats',
 | 
			
		||||
'mst_Would_you_like_to_save' => 'Would you like to save data in the DB?',
 | 
			
		||||
'mst_Score_over_which_email_will' => 'Score over which email will be tagged as spam But queued',
 | 
			
		||||
'mst_Spamassassin_parameters_for_rejecting_email' => 'Spamassassin parameters for rejecting email',
 | 
			
		||||
'mst_TABLE_panel_action_was_successful' => 'TABLE panel action was successful',
 | 
			
		||||
'mst_Enable_RHSBL_checking' => 'Enable RHSBL checking',
 | 
			
		||||
'mst_Specify_if_you_would_like' => 'Specify if you would like to receive email in text for HTML form',
 | 
			
		||||
'mst_RBL_Servers_to_use' => 'RBL Servers to use',
 | 
			
		||||
'mst_User_name_for_DB_sending' => 'User name for DB sending',
 | 
			
		||||
'mst_Configure_Mailstats' => 'Configure mailshots',
 | 
			
		||||
@@ -42,11 +42,11 @@ use esmith::NetworksDB;
 | 
			
		||||
use esmith::HostsDB;
 | 
			
		||||
use esmith::DomainsDB;
 | 
			
		||||
 | 
			
		||||
my $cdb 
 | 
			
		||||
my $adb 
 | 
			
		||||
my $ndb 
 | 
			
		||||
my $hdb 
 | 
			
		||||
my $ddb 
 | 
			
		||||
my $cdb;
 | 
			
		||||
my $adb;
 | 
			
		||||
my $ndb; 
 | 
			
		||||
my $hdb; 
 | 
			
		||||
my $ddb; 
 | 
			
		||||
 | 
			
		||||
require '/usr/share/smanager/lib/SrvMngr/Controller/${PackageName}-Custom.pm';  #The code that is to be added by the developer
 | 
			
		||||
 | 
			
		||||
@@ -133,7 +133,7 @@ sub do_update {
 | 
			
		||||
    my $params = $c->req->params->to_hash;
 | 
			
		||||
 | 
			
		||||
    # Get number of POST parameters
 | 
			
		||||
    my $num_params = keys scaler %$params;
 | 
			
		||||
    #my $num_params = keys scaler %$params;
 | 
			
		||||
    
 | 
			
		||||
    #Params are available in the hash "params" - copy to the prefix_data hash
 | 
			
		||||
    #while (my ($key, $value) = each %{$c->req->params->to_hash}) {
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								Templates/html_controls.html.ep.xml
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										37
									
								
								Templates/html_controls.html.ep.xml
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							@@ -25,7 +25,7 @@
 | 
			
		||||
		<span class=label>
 | 
			
		||||
			%=l('${prefix}_${Label}')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			%=date_field '${Name}' =>$$${Name}, pattern=>${regexp | .*}, title = 'Pattern regex mismatch'
 | 
			
		||||
			%=date_field '${Name}' =>$$${Name}, pattern=>${regexp | .*}, title =>'Pattern regex mismatch'
 | 
			
		||||
		</span><br>
 | 
			
		||||
	]]></Date>
 | 
			
		||||
 | 
			
		||||
@@ -33,7 +33,7 @@
 | 
			
		||||
		<span class=label>
 | 
			
		||||
			%=l('${prefix}_${Label}')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			%=time_field '${Name}' =>$$${Name}, pattern=>${regexp | .*}, title = 'Pattern regex mismatch'
 | 
			
		||||
			%=time_field '${Name}' =>$$${Name}, pattern=>${regexp | .*}, title =>'Pattern regex mismatch'
 | 
			
		||||
		</span><br>
 | 
			
		||||
	]]></Time>
 | 
			
		||||
 | 
			
		||||
@@ -43,7 +43,7 @@
 | 
			
		||||
			%=l('${prefix}_${Label}')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%= text_field '${Name}', size => '${size | 50}', class => 'textinput ${Name}' , pattern=>'${regexp | ".*"}' , placeholder=>'${placeholder | Name}', title = 'Pattern regex mismatch'
 | 
			
		||||
			%= text_field '${Name}', size => '${size | 50}', class => 'textinput ${Name}' , pattern=>'${regexp | ".*"}' , placeholder=>'${placeholder | Name}', title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	]]></Text>
 | 
			
		||||
 | 
			
		||||
@@ -52,7 +52,7 @@
 | 
			
		||||
			%=l('${prefix}_${Label}')
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%= text_field '${Name}', size => '${size | 50}', class => 'textinput ${Name}' , pattern=>'${regexp | ".*"}' , placeholder=>'${placeholder | Name}', Readonly=>'true' , title = 'Pattern regex mismatch'
 | 
			
		||||
			%= text_field '${Name}', size => '${size | 50}', class => 'textinput ${Name}' , pattern=>'${regexp | ".*"}' , placeholder=>'${placeholder | Name}', Readonly=>'true' , title =>'Pattern regex mismatch'
 | 
			
		||||
		<br></span></p>
 | 
			
		||||
	]]></ReadonlyText>
 | 
			
		||||
 | 
			
		||||
@@ -83,7 +83,7 @@
 | 
			
		||||
		%=Search field
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=search_field '${Name}' , class => 'searc${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Search>
 | 
			
		||||
	
 | 
			
		||||
@@ -93,7 +93,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=URL_field '${Name}' , class => 'url${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Url>
 | 
			
		||||
 | 
			
		||||
@@ -103,7 +103,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=tel_field '${Name}', class => 'tel${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Tel>
 | 
			
		||||
 | 
			
		||||
@@ -133,7 +133,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=timedate_field '${Name}', class => 'time${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Timedate>
 | 
			
		||||
 | 
			
		||||
@@ -143,7 +143,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=week_field '${Name}', class => 'week${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Week>
 | 
			
		||||
 | 
			
		||||
@@ -153,7 +153,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=month_field '${Name}', class => 'mont${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Month>
 | 
			
		||||
	
 | 
			
		||||
@@ -163,7 +163,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=range_field '${Name}', class => 'rang${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Range>
 | 
			
		||||
 | 
			
		||||
@@ -173,7 +173,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=radio_field '${Name}', class => 'radi${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Radio>
 | 
			
		||||
 | 
			
		||||
@@ -183,7 +183,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=number_field '${Name}', class => 'numb${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Number>
 | 
			
		||||
 | 
			
		||||
@@ -193,7 +193,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=file_field '${Name}', class => 'file${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</File>
 | 
			
		||||
	
 | 
			
		||||
@@ -203,7 +203,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=color_field '${Name}', class => 'colo${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Color>
 | 
			
		||||
	
 | 
			
		||||
@@ -213,7 +213,7 @@
 | 
			
		||||
		</span><span class=data>
 | 
			
		||||
			% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
 | 
			
		||||
			%=checkbox_field '${Name}', class => 'chec${type_serial}'
 | 
			
		||||
		</span>span></p>
 | 
			
		||||
		</span></p>
 | 
			
		||||
		]]>
 | 
			
		||||
	</Checkbox>
 | 
			
		||||
 | 
			
		||||
@@ -276,7 +276,10 @@
 | 
			
		||||
		]]>
 | 
			
		||||
	</Endgroup>
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	<object><![CDATA[
 | 
			
		||||
		<object data="<%='${url}' %>" title="<%= $c->stash('title') %>"  type="text/html" ><%= $c->stash('title') %> not found</object>
 | 
			
		||||
	]]>
 | 
			
		||||
	</object>
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
</root>
 | 
			
		||||
							
								
								
									
										2
									
								
								Templates/partial.html.ep.tem
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						
									
										2
									
								
								Templates/partial.html.ep.tem
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							@@ -7,7 +7,7 @@
 | 
			
		||||
		SelectInput();
 | 
			
		||||
	};
 | 
			
		||||
	</script>
 | 
			
		||||
	% if ($config->{debug} == 1) {
 | 
			
		||||
	% if (config->{debug} == 1) {
 | 
			
		||||
		<pre>
 | 
			
		||||
			%= dumper $$${prefix}_data
 | 
			
		||||
		</pre>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										211
									
								
								json5/Mailstats.json5
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										211
									
								
								json5/Mailstats.json5
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,211 @@
 | 
			
		||||
{
 | 
			
		||||
    PackageName: 'Mailstats',
 | 
			
		||||
    prefix: 'mst',
 | 
			
		||||
    MenuHeading: 'Investigation',
 | 
			
		||||
    MenuDescription: 'Mailstats',
 | 
			
		||||
    MenuNavigation: '4000 700',
 | 
			
		||||
    firstPanel: 'TABLE',
 | 
			
		||||
    signalEvent: 'smeserver-mailstats-update',
 | 
			
		||||
    html: [
 | 
			
		||||
			{Name: 'Table',
 | 
			
		||||
            route: 'TABLE',
 | 
			
		||||
			Group1: 'class=inline-buttons',
 | 
			
		||||
			Link1: {
 | 
			
		||||
				Type: 'Link',
 | 
			
		||||
				href: 'mailstatsd?trt=CONFIG',
 | 
			
		||||
				title: 'Configure Mailstats'
 | 
			
		||||
			},
 | 
			
		||||
			Endgroup1: '',
 | 
			
		||||
			SubHeader1: 'Table of email status',
 | 
			
		||||
			Paragraph1: 'Descriptive paragraph',
 | 
			
		||||
			Input1: {
 | 
			
		||||
				Name: 'StatsDate',
 | 
			
		||||
				Type: 'Select',
 | 
			
		||||
				Label: 'Date for Stats display',
 | 
			
		||||
				Value: '',
 | 
			
		||||
				Options: [{'Value':'$c->get_StatsDate()',
 | 
			
		||||
							'Text':'$c->get_StatsDate()'}]
 | 
			
		||||
			},
 | 
			
		||||
			Input2:{
 | 
			
		||||
				Name:'StatsTable',
 | 
			
		||||
				Type:'object',
 | 
			
		||||
				url:'mailstats/$c->stash("url")'
 | 
			
		||||
			}
 | 
			
		||||
		},
 | 
			
		||||
		{Name: 'Configuration',
 | 
			
		||||
            route: 'CONFIG',
 | 
			
		||||
			Input4:{
 | 
			
		||||
				Name:'TextorHTML',
 | 
			
		||||
				Type:'Select',
 | 
			
		||||
				Label: 'Specify if you would like to receive email in text for HTML form',
 | 
			
		||||
				Options: [
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'HTML',
 | 
			
		||||
                        'Text': 'HTML'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'Text',
 | 
			
		||||
                        'Text': 'Text'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'Both',
 | 
			
		||||
                        'Text': 'Both'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'Neither',
 | 
			
		||||
                        'Text': 'Neither'
 | 
			
		||||
                    }                   
 | 
			
		||||
                ]
 | 
			
		||||
			},
 | 
			
		||||
			Group1:'class=emailwanted',
 | 
			
		||||
				SubHeader:'Email details',
 | 
			
		||||
				Input3:{
 | 
			
		||||
					Name:'Email',
 | 
			
		||||
					Type:'Email',
 | 
			
		||||
					Label:'Email for stats'
 | 
			
		||||
				},
 | 
			
		||||
				Input5:{
 | 
			
		||||
					Name:'EmailHost',
 | 
			
		||||
					Label:'Hostname for email server',
 | 
			
		||||
					Type:'Text',
 | 
			
		||||
					Value:'localhost'
 | 
			
		||||
				},
 | 
			
		||||
				Input6:{
 | 
			
		||||
					Name:'EmailPort',
 | 
			
		||||
					Label:'Port number for email server',
 | 
			
		||||
					Type:'Number',
 | 
			
		||||
					Value:'25'
 | 
			
		||||
				},
 | 
			
		||||
				Input7:{
 | 
			
		||||
					Name:'EmailUser',
 | 
			
		||||
					Type:'Text',
 | 
			
		||||
					Label:'User name for email sending',
 | 
			
		||||
					Value:'admin'
 | 
			
		||||
				},
 | 
			
		||||
				Input8:{
 | 
			
		||||
					Name:'EmailPassword',
 | 
			
		||||
					Type:'Password',
 | 
			
		||||
					Label:'User Password for email sending',
 | 
			
		||||
					Value:''
 | 
			
		||||
				},
 | 
			
		||||
			Endgroup1: '',
 | 
			
		||||
			Input9:{
 | 
			
		||||
				Name:'DBSave',
 | 
			
		||||
				Label:'Would you like to save data in the DB?',
 | 
			
		||||
				Type:'Select',
 | 
			
		||||
				Options: [
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'yes',
 | 
			
		||||
                        'Text': 'yes'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'no',
 | 
			
		||||
                        'Text': 'no'
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
			},
 | 
			
		||||
			Group2:'class=dbwanted',
 | 
			
		||||
			SubHeader2:'Details for connection to database for saving email status',
 | 
			
		||||
				Input10:{
 | 
			
		||||
					Name:'DBHost',
 | 
			
		||||
					Label:'Hostname for DB server',
 | 
			
		||||
					Type:'Text',
 | 
			
		||||
					Value:'localhost'
 | 
			
		||||
				},
 | 
			
		||||
				Input11:{
 | 
			
		||||
					Name:'DBPort',
 | 
			
		||||
					Label:'Port number for DB server',
 | 
			
		||||
					Type:'Number',
 | 
			
		||||
					Value:'25'
 | 
			
		||||
				},
 | 
			
		||||
				Input12:{
 | 
			
		||||
					Name:'DBUser',
 | 
			
		||||
					Type:'Text',
 | 
			
		||||
					Label:'User name for DB sending',
 | 
			
		||||
					Value:'admin'
 | 
			
		||||
				},
 | 
			
		||||
				Input13:{
 | 
			
		||||
					Name:'DBPassword',
 | 
			
		||||
					Type:'Password',
 | 
			
		||||
					Label:'User Password for DB sending',
 | 
			
		||||
					Value:''
 | 
			
		||||
				},
 | 
			
		||||
			Endgroup2: '',
 | 
			
		||||
			SubHeader3: 'Email filtering / exclusion',
 | 
			
		||||
			Input14:{
 | 
			
		||||
				Name:'CountrySelect',
 | 
			
		||||
				Label:'Select the countries you would like to reject',
 | 
			
		||||
				Type:'Select',
 | 
			
		||||
				Options:[{'Value':'$c->get_CountryCodes()',
 | 
			
		||||
							'Text':'$c->get_CountryCodes()'}]
 | 
			
		||||
			},
 | 
			
		||||
			Input15:{
 | 
			
		||||
				Name:'AccumCountryCodes',
 | 
			
		||||
				Type:'Text',
 | 
			
		||||
				Label:'Accumlated country codes (editable)',
 | 
			
		||||
				Value:''
 | 
			
		||||
			},
 | 
			
		||||
			Input16:{
 | 
			
		||||
				Name:'EnableRHSBL',
 | 
			
		||||
				Label:'Enable RHSBL checking',
 | 
			
		||||
				Type:'Select',
 | 
			
		||||
				Options: [
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'yes',
 | 
			
		||||
                        'Text': 'yes'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'no',
 | 
			
		||||
                        'Text': 'no'
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
			},
 | 
			
		||||
			Input17:{
 | 
			
		||||
				Name:'EnableDNSBL',
 | 
			
		||||
				Label:'Enable DNSBL checking',
 | 
			
		||||
				Type:'Select',
 | 
			
		||||
				Options: [
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'yes',
 | 
			
		||||
                        'Text': 'yes'
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        'Value': 'no',
 | 
			
		||||
                        'Text': 'no'
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
			},
 | 
			
		||||
			Input18:{
 | 
			
		||||
				Name:'RBLLIST',
 | 
			
		||||
				Type:'Text',
 | 
			
		||||
				Label:'RBL Servers to use',
 | 
			
		||||
				Value:''
 | 
			
		||||
			},
 | 
			
		||||
			Input19:{
 | 
			
		||||
				Name:'SBLLIST',
 | 
			
		||||
				Type:'Text',
 | 
			
		||||
				Label:'SBL Servers to use',
 | 
			
		||||
				Value:''
 | 
			
		||||
			},
 | 
			
		||||
			Input20:{
 | 
			
		||||
				Name:'UBLLIST',
 | 
			
		||||
				Type:'Text',
 | 
			
		||||
				Label:'UBL Servers to use',
 | 
			
		||||
				Value:''
 | 
			
		||||
			},
 | 
			
		||||
			SubHeader4:'Spamassassin parameters for rejecting email',
 | 
			
		||||
				Input21:{
 | 
			
		||||
					Name:'RejectLevel',
 | 
			
		||||
					Label:'Score over which email will be fully rejected',
 | 
			
		||||
					Type:'Number',
 | 
			
		||||
					Value:'12'
 | 
			
		||||
			},
 | 
			
		||||
				Input22:{
 | 
			
		||||
					Name:'TagLevel',
 | 
			
		||||
					Label:'Score over which email will be tagged as spam, but queued',
 | 
			
		||||
					Type:'Number',
 | 
			
		||||
					Value:'4'
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
    ]
 | 
			
		||||
 }
 | 
			
		||||
		Reference in New Issue
	
	Block a user