diff --git a/Targets/Emailsettings/Emailsettings-Custom.pm b/Targets/Emailsettings/Emailsettings-Custom.pm new file mode 100644 index 0000000..785bc9f --- /dev/null +++ b/Targets/Emailsettings/Emailsettings-Custom.pm @@ -0,0 +1,1096 @@ +# +# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +# +# +# 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::UTF8; +use esmith::AccountsDB; +use esmith::NetworksDB::UTF8; +use esmith::HostsDB; +use esmith::DomainsDB::UTF8; + +use constant FALSE => 0; +use constant TRUE => 1; + + +#The most common ones - open DB when required. +my $cdb; +my $adb; +my $ndb; +my $hdb; +my $ddb; + +#The most common ones - you might want to use these if you need to make sure that the DB is refreshed. +#$cdb = esmith::ConfigDB::UTF8->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::UTF8->open() || die("Couldn't open Hosts db"); +#$ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); + + +# Validation routines - parameters for each panel + + sub validate_FRONT { + my $c = shift; + my $mai_data = shift; #Data hash as parameter + # Validation for each field + my $ret = ''; + + if ($ret eq '') {$ret = 'ok';} + return $ret; + } + + sub validate_ACC { + my $c = shift; + my $mai_data = shift; #Data hash as parameter + # Validation for each field + my $ret = ''; + + if ($ret eq '') {$ret = 'ok';} + return $ret; + } + + sub validate_FIL { + my $c = shift; + my $mai_data = shift; #Data hash as parameter + # Validation for each field + my $ret = ''; + + if ($ret eq '') {$ret = 'ok';} + return $ret; + } + + sub validate_REC { + my $c = shift; + my $mai_data = shift; #Data hash as parameter + # Validation for each field + my $ret = ''; + + if ($ret eq '') {$ret = 'ok';} + return $ret; + } + + sub validate_DEL { + my $c = shift; + my $mai_data = shift; #Data hash as parameter + # Validation for each field + my $ret = ''; + + if ($ret eq '') {$ret = 'ok';} + return $ret; + } + + +# Get singleton data for each panel + + sub get_data_for_panel_FRONT { + # Return a hash with the fields required which will be loaded into the shared data + my $c = shift; + my %ret = ( + 'Data1'=>'Data for FRONT', #Example + # fields from Inputs in FRONT $fields['FRONT'] + + ); + return %ret; + } + + sub get_data_for_panel_ACC { + # Return a hash with the fields required which will be loaded into the shared data + my $c = shift; + my %ret = ( + 'Data1'=>'Data for ACC', #Example + # fields from Inputs in ACC $fields['ACC'] + + ); + return %ret; + } + + sub get_data_for_panel_FIL { + # Return a hash with the fields required which will be loaded into the shared data + my $c = shift; + my %ret = ( + 'Data1'=>'Data for FIL', #Example + # fields from Inputs in FIL $fields['FIL'] + + ); + return %ret; + } + + sub get_data_for_panel_REC { + # Return a hash with the fields required which will be loaded into the shared data + my $c = shift; + my %ret = ( + 'Data1'=>'Data for REC', #Example + # fields from Inputs in REC $fields['REC'] + + ); + return %ret; + } + + sub get_data_for_panel_DEL { + # Return a hash with the fields required which will be loaded into the shared data + my $c = shift; + my %ret = ( + 'Data1'=>'Data for DEL', #Example + # fields from Inputs in DEL $fields['DEL'] + + ); + return %ret; + } + + + +# Get control data for table(s) + + + +# Return hash with values from row in which link clicked on table + + sub get_selected_FRONT { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = (); + #gather the values here + return %ret; + } + + sub get_selected_ACC { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = (); + #gather the values here + return %ret; + } + + sub get_selected_FIL { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = (); + #gather the values here + return %ret; + } + + sub get_selected_REC { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = (); + #gather the values here + return %ret; + } + + sub get_selected_DEL { + my $c = shift; + my $selected = shift; #Parameter is name of selected row. + my $is_new_record = shift; #Indicates new record required (defaults) + my %ret = (); + #gather the values here + return %ret; + } + + +#after sucessful modify or create or whatever and submit then perfom (if the params validate) + + sub perform_FRONT { + my $c = shift; + my $mai_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 ($ret eq '') {$ret = 'ok';} + return $ret; + } + + sub perform_ACC { + my $c = shift; + my $mai_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 ($ret eq '') {$ret = 'ok';} + return $ret; + } + + sub perform_FIL { + my $c = shift; + my $mai_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 ($ret eq '') {$ret = 'ok';} + return $ret; + } + + sub perform_REC { + my $c = shift; + my $mai_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 ($ret eq '') {$ret = 'ok';} + return $ret; + } + + sub perform_DEL { + my $c = shift; + my $mai_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 ($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_virus_status { + my ($c, $localise) = @_; + my $status = $cdb->get_prop("qpsmtpd", 'VirusScan') || 'disabled'; + return $localise ? $c->localise_status($status) : $status; +} ## end sub get_virus_status + +sub get_spam_status { + my ($c, $localise) = @_; + my $status = $cdb->get_prop('spamassassin', 'status') || 'disabled'; + return $localise ? $c->localise_status($status) : $status; +} ## end sub get_spam_status + +sub localise_status { + my ($c, $status) = @_; + return $c->l($status eq 'enabled' ? $c->l('ENABLED') : $c->l('DISABLED')); +} + +sub get_db_prop { + my ($c, $item, $prop, $default) = @_; + return $cdb->get_prop($item, $prop) || $default; +} + +sub get_value { + my $c = shift; + my $item = shift; + return $cdb->get_value($item) || ''; +} ## end sub get_value + +sub get_emailunknownuser_status { + my ($c, $localise) = @_; + my $options = $c->get_emailunknownuser_options(); + my $val = $cdb->get_value('EmailUnknownUser') || "returntosender"; + return $localise ? $c->l($options->{$val}) : $val; +} ## end sub get_emailunknownuser_status + +sub get_patterns_status { + my ($c, $localise) = @_; + my $status = $cdb->get_prop("qpsmtpd", 'PatternsScan') || 'disabled'; + return $localise ? $c->localise_status($status) : $status; +} ## end sub get_patterns_status + +sub adjust_patterns { + my $c = shift; + my @selected = @{ $c->every_param('BlockExecutableContent') }; + $pattern_db = esmith::ConfigDB::UTF8->open("mailpatterns"); + foreach my $pattern ($pattern_db->get_all_by_prop(type => "pattern")) { + my $status + = (grep $pattern->key eq $_, @selected) + ? 'enabled' + : 'disabled'; + $pattern->set_prop('Status', $status); + } ## end foreach my $pattern ($pattern_db...) + $pattern_db->reload; + return scalar @selected; +} ## end sub adjust_patterns + +sub get_current_pop3_access { + my ($c, $localise) = @_; + my $pop3Status = $cdb->get_prop('pop3', 'status') || 'enabled'; + my $pop3Access = $cdb->get_prop('pop3', 'access') || 'private'; + my $pop3sStatus = $cdb->get_prop('pop3s', 'status') || 'enabled'; + my $pop3sAccess = $cdb->get_prop('pop3s', 'access') || 'private'; + my $options = get_pop_options(); + + if ($pop3Status ne 'enabled' && $pop3sStatus ne 'enabled') { + return $localise ? $c->l($options->{disabled}) : 'disabled'; + } elsif ($pop3Status eq 'enabled' && $pop3Access eq 'public') { + return $localise ? $c->l($options->{public}) : 'public'; + } elsif ($pop3sStatus eq 'enabled' && $pop3sAccess eq 'public') { + return $localise ? $c->l($options->{publicSSL}) : 'publicSSL'; + } + return $localise ? $c->l($options->{private}) : 'private'; +} ## end sub get_current_pop3_access + +sub get_current_imap_access { + my ($c, $localise) = @_; + my $imapStatus = $cdb->get_prop('imap', 'status') || 'enabled'; + my $imapAccess = $cdb->get_prop('imap', 'access') || 'private'; + my $imapsStatus = $cdb->get_prop('imaps', 'status') || 'enabled'; + my $imapsAccess = $cdb->get_prop('imaps', 'access') || 'private'; + my $options = get_imap_options(); + + if (($imapStatus ne 'enabled' || $imapAccess eq 'localhost') && $imapsStatus ne 'enabled') { + return $localise ? $c->l($options->{disabled}) : 'disabled'; + } + + if ($imapStatus eq 'enabled' && $imapAccess eq 'public') { + return $localise ? $c->l($options->{public}) : 'public'; + } elsif ($imapsStatus eq 'enabled' && $imapsAccess eq 'public') { + return $localise ? $c->l($options->{publicSSL}) : 'publicSSL'; + } + return $localise ? $c->l($options->{private}) : 'private'; +} ## end sub get_current_imap_access + +sub get_current_smtp_ssl_auth { + my ($c, $localise, $soru, $debug) = @_; + die "Error: \$soru must be either 's' or 'u':$soru.\n" unless $soru eq 's' || $soru eq 'u'; + $cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; + + # Initialize variables with default values + my $smtpStatus = 'none'; + my $smtpAccess = 'none'; + my $smtpAuth = 'disabled'; # assuming 'disabled' as a default + + # Fetch SMTP settings based on the value of `$soru` + if ($soru eq "u") { + $smtpStatus = $cdb->get_prop('uqpsmtpd', 'status') || 'enabled'; # Fetch from uqpsmtpd + $smtpAccess = $cdb->get_prop('uqpsmtpd', 'access') || 'public'; + $smtpAuth = 'enabled'; # Assuming authentication is enabled in this context + } else { + $smtpStatus = $cdb->get_prop('sqpsmtpd', 'status') || 'enabled'; # Fetch from sqpsmtpd + $smtpAccess = $cdb->get_prop('sqpsmtpd', 'access') || 'public'; + $smtpAuth = 'enabled'; # Assuming authentication is enabled in this context + } + + # Retrieve SMTP SSL authentication options + my $options = $c->get_smtp_ssl_auth_options(); + + if ($soru eq "u" && $debug) { + $c->stash('smtp' => + [ $smtpStatus, $smtpAccess, $smtpAuth, $soru, $options->{$smtpAccess}, $c->l($options->{$smtpAccess}) ] + ); + + # die "Stop $soru in get_current_smtp_ssl_auth"; + } ## end if ($soru eq "u" && $debug) + + # Return appropriate message based on SMTP settings + if ($smtpStatus eq 'enabled' && $smtpAuth eq 'enabled') { + return $localise ? $c->l($options->{$smtpAccess}) : $smtpAccess; + } + return $localise ? $c->l($options->{disabled}) : 'disabled'; +} ## end sub get_current_smtp_ssl_auth + +sub get_current_smtp_auth { + my ($c, $localise) = @_; + my $smtpStatus = $cdb->get_prop('qpsmtpd', 'status') || 'enabled'; + my $smtpAuth = $cdb->get_prop('qpsmtpd', 'Authentication') || 'enabled'; + my $options = get_smtp_auth_options(); + + if ($smtpStatus eq 'enabled' && $smtpAuth eq 'disabled') { + return $localise ? $c->l($options->{public}) : 'public'; + } elsif ($smtpStatus eq 'enabled' && $smtpAuth eq 'enabled') { + return $localise ? $c->l($options->{publicSSL}) : 'publicSSL'; + } + return $localise ? $c->l($options->{disabled}) : 'disabled'; +} ## end sub get_current_smtp_auth + +sub get_current_webmail_status { + my ($c, $localise) = @_; + + # determine status of webmail + my $WebmailStatus = "disabled"; + my $RoundcubeStatus = $cdb->get_prop('roundcube', 'status') || 'disabled'; + my $MysqlStatus = $cdb->get_prop('mariadb', 'status') || 'disabled'; + my $PHPStatus = $cdb->get_prop('php81-php-fpm', 'status') || 'disabled'; + my $Networkaccess = $cdb->get_prop('roundcube', 'access') || 'disabled'; + + # all 3 components must be on for webmail to be working + if ( ($RoundcubeStatus eq "enabled") + && ($MysqlStatus eq "enabled") + && ($PHPStatus eq "enabled") + && ($Networkaccess eq "public")) + { + $WebmailStatus = "enabledSSL"; + } elsif (($RoundcubeStatus eq "enabled") + && ($MysqlStatus eq "enabled") + && ($PHPStatus eq "enabled") + && ($Networkaccess eq "private")) + { + $WebmailStatus = "localnetworkSSL"; + } ## end elsif (($RoundcubeStatus ...)) + my $options = get_webmail_options(); + return $localise + ? $c->l($options->{$WebmailStatus}) + : $WebmailStatus; +} ## end sub get_current_webmail_status + +sub get_pop_opt { + my $c = shift; + return [ + [ $c->l('DISABLED') => 'disabled' ], + [ $c->l('NETWORKS_ALLOW_LOCAL') => 'private' ], + [ $c->l('mai_SECURE_POP3') => 'publicSSL' ], + [ $c->l('mai_INSECURE_POP3') => 'public' ] + ]; +} ## end sub get_pop_opt + +sub get_pop_options { + my $c = @_; + my %options = ( + disabled => 'DISABLED', + private => 'NETWORKS_ALLOW_LOCAL', + publicSSL => 'mai_SECURE_POP3' + ); + my $access = $cdb->get_prop('pop3', 'access') || 'private'; + $options{public} = 'mai_INSECURE_POP3' if ($access eq 'public'); + \%options; +} ## end sub get_pop_options + +sub get_imap_opt { + my $c = shift; + return [ + [ $c->l('DISABLED') => 'disabled' ], + [ $c->l('NETWORKS_ALLOW_LOCAL') => 'private' ], + [ $c->l('mai_SECURE_IMAP') => 'publicSSL' ], + [ $c->l('mai_INSECURE_IMAP') => 'public' ] + ]; +} ## end sub get_imap_opt + +sub get_imap_options { + my $c = shift; + my %options = ( + disabled => 'DISABLED', + private => 'NETWORKS_ALLOW_LOCAL', + publicSSL => 'mai_SECURE_IMAP' + ); + my $access = $cdb->get_prop('imap', 'access') || 'private'; + $options{public} = 'mai_INSECURE_IMAP' if ($access eq 'public'); + \%options; +} ## end sub get_imap_options + +sub get_smtp_auth_opt { + my $c = shift; + return [ + [ $c->l('mai_SECURE_SMTP') => 'publicSSL' ], + [ $c->l('Only allow insecure access') => 'public' ], + [ $c->l('DISABLED') => 'disabled' ] + ]; +} ## end sub get_smtp_auth_opt + +sub get_smtp_auth_options { + my $c = shift; + my %options = (publicSSL => 'mai_SECURE_SMTP', public => 'Only allow insecure access', disabled => 'DISABLED'); + return \%options; +} ## end sub get_smtp_auth_options + +sub get_smtp_ssl_auth_options { + my $c = shift; + my %options = (public => 'Allow public access', local => 'Allow local access only', disabled => 'DISABLED'); + return \%options; +} ## end sub get_smtp_ssl_auth_options + +sub get_smtp_ssl_auth_opt { + my $c = shift; + return [ + [ $c->l('Allow public access') => 'public' ], + [ $c->l('Allow local access only') => 'local' ], + [ $c->l('DISABLED') => 'disabled' ] + ]; +} ## end sub get_smtp_ssl_auth_opt + +sub get_key_by_value { + my ($hash_ref, $target_value) = @_; + + # Iterate over the hash + while (my ($key, $value) = each %$hash_ref) { + return $key if $value eq $target_value; + } + return undef; # Return undef if no match is found +} ## end sub get_key_by_value + +sub get_value_by_key { + my ($hash_ref, $key) = @_; + return $hash_ref->{$key}; # Return the value associated with the key +} + +sub get_webmail_opt { + my $c = shift; + return [ + [ $c->l('DISABLED') => 'disabled' ], + [ $c->l('mai_ENABLED_SECURE_ONLY') => 'enabledSSL' ], + [ $c->l('mai_ONLY_LOCAL_NETWORK_SSL') => 'localnetworkSSL' ] + ]; +} ## end sub get_webmail_opt + +sub get_webmail_options { + my $c = shift; + my %options = ( + disabled => 'DISABLED', + enabledSSL => 'mai_ENABLED_SECURE_ONLY', + localnetworkSSL => 'mai_ONLY_LOCAL_NETWORK_SSL' + ); + return \%options; +} ## end sub get_webmail_options + +sub get_retrieval_opt { + my $c = shift; + return $cdb->get("SystemMode")->value eq "servergateway-private" + ? [ $c->l('mai_MULTIDROP') => 'multidrop' ] + : [ + [ $c->l('mai_STANDARD') => 'standard' ], + [ $c->l('mai_ETRN') => 'etrn' ], + [ $c->l('mai_MULTIDROP') => 'multidrop' ] + ]; +} ## end sub get_retrieval_opt + +sub get_emailunknownuser_options { + my $c = shift; + my $accounts = esmith::AccountsDB::UTF8->open_ro(); + my %existingAccounts = ( + 'admin' => $c->l("mai_FORWARD_TO_ADMIN"), + 'returntosender' => $c->l("mai_RETURN_TO_SENDER") + ); + + foreach my $account ($accounts->get_all) { + next if $account->key eq 'everyone'; + + if ($account->prop('type') =~ /(user|group|pseudonym)/) { + $existingAccounts{ $account->key } = $c->l("mai_FORWARD_TO") . " " . $account->key; + } + } ## end foreach my $account ($accounts...) + return (\%existingAccounts); +} ## end sub get_emailunknownuser_options + +sub get_emailunknownuser_opt { + my $c = shift; + my $accounts = esmith::AccountsDB::UTF8->open_ro(); + my @existingAccounts + = ([ $c->l("mai_FORWARD_TO_ADMIN") => 'admin' ], [ $c->l("mai_RETURN_TO_SENDER") => 'returntosender' ]); + + foreach my $account ($accounts->get_all) { + next if $account->key eq 'everyone'; + + if ($account->prop('type') =~ /(user|group|pseudonym)/) { + push @existingAccounts, [ $c->l("mai_FORWARD_TO") . " " . $account->key => $account->key ]; + } + } ## end foreach my $account ($accounts...) + return (\@existingAccounts); +} ## end sub get_emailunknownuser_opt + +sub get_patterns_opt { + my $c = shift; + my @options; + + foreach my $pattern ($pattern_db->get_all_by_prop(type => "pattern")) { + my %props = $pattern->props; + push @options, [ $props{'Description'} => $pattern->key ]; + } + return \@options; +} ## end sub get_patterns_opt + +sub get_patterns_current_opt { + my $c = shift; + my @selected; + + foreach my $pattern ($pattern_db->get_all_by_prop(type => "pattern")) { + my %props = $pattern->props; + push @selected, $pattern->key if ($props{'Status'} eq 'enabled'); + } + return \@selected; +} ## end sub get_patterns_current_opt + +sub get_spam_level_options { + return [ 0 .. 20 ]; +} + +sub get_spam_sensitivity_opt { + my $c = shift; + return [ + [ $c->l('mai_VERYLOW') => 'verylow' ], + [ $c->l('mai_LOW') => 'low' ], + [ $c->l('mai_MEDIUM') => 'medium' ], + [ $c->l('mai_HIGH') => 'high' ], + [ $c->l('mai_VERYHIGH') => 'veryhigh' ], + [ $c->l('mai_CUSTOM') => 'custom' ] + ]; +} ## end sub get_spam_sensitivity_opt + +sub fetchmail_freq { + my $c = shift; + return [ + [ $c->l('mai_NEVER') => 'never' ], + [ $c->l('mai_EVERY5MIN') => 'every5min' ], + [ $c->l('mai_EVERY15MIN') => 'every15min' ], + [ $c->l('mai_EVERY30MIN') => 'every30min' ], + [ $c->l('mai_EVERYHOUR') => 'everyhour' ], + [ $c->l('mai_EVERY2HRS') => 'every2hrs' ] + ]; +} ## end sub fetchmail_freq + +sub display_multidrop { + my $status = $cdb->get_prop('fetchmail', 'status') || 'disabled'; + + # XXX FIXME - WIP + # Only display ETRN/multidrop settings if relevant + # To do this, we need an "Show ETRN/multidrop settings" button + # in standard mode. + # return ($status eq 'enabled'); + return 1; +} ## end sub display_multidrop + +sub change_settings_reception { + my $c = shift; + $cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; + my $FetchmailMethod = ($c->param('FetchmailMethod') || 'standard'); + my $FetchmailFreqOffice = ($c->param('FreqOffice') || 'every15min'); + my $FetchmailFreqOutside = ($c->param('FreqOutside') || 'everyhour'); + my $FetchmailFreqWeekend = ($c->param('FreqWeekend') || 'everyhour'); + my $SpecifyHeader = ($c->param('SpecifyHeader') || 'off'); + my $fetchmail = $cdb->get('fetchmail') || $cdb->new_record("fetchmail", { type => "service", status => "disabled" }); + + if ($FetchmailMethod eq 'standard') { + $fetchmail->set_prop('status', 'disabled'); + $fetchmail->set_prop('Method', $FetchmailMethod); + } else { + $fetchmail->set_prop('status', 'enabled'); + $fetchmail->set_prop('Method', $FetchmailMethod); + $fetchmail->set_prop('SecondaryMailServer', $c->param('SecondaryMailServer')) + unless ($c->param('SecondaryMailServer') eq ''); + $fetchmail->set_prop('FreqOffice', $FetchmailFreqOffice); + $fetchmail->set_prop('FreqOutside', $FetchmailFreqOutside); + $fetchmail->set_prop('FreqWeekend', $FetchmailFreqWeekend); + $fetchmail->set_prop('SecondaryMailAccount', $c->param('SecondaryMailAccount')) + unless ($c->param('SecondaryMailAccount') eq ''); + $fetchmail->set_prop('SecondaryMailPassword', $c->param('SecondaryMailPassword')) + unless ($c->param('SecondaryMailPassword') eq ''); + + if ($SpecifyHeader eq 'on') { + $fetchmail->merge_props('SecondaryMailEnvelope' => $c->param('SecondaryMailEnvelope')); + } else { + $fetchmail->delete_prop('SecondaryMailEnvelope'); + } + } ## end else [ if ($FetchmailMethod eq...)] + + # Need code here for all 3 options - 25, 465 ad 587 + # Options for 25 are enabled and disabled + # for 465 and 587 are (access) public, local and (status) disabled + #my $smtpAuth = ($c->param('SMTPAuth') || 'public'); + #if ($smtpAuth eq 'public') { + #$cdb->set_prop("qpsmtpd", "Authentication", "enabled" ); + #$cdb->set_prop("sqpsmtpd", "Authentication", "enabled" ); + #} elsif ($smtpAuth eq 'publicSSL') { + #$cdb->set_prop("qpsmtpd", "Authentication", "disabled" ); + #$cdb->set_prop("sqpsmtpd", "Authentication", "enabled" ); + #} else { + #$cdb->set_prop("qpsmtpd", "Authentication", "disabled" ); + #$cdb->set_prop("sqpsmtpd", "Authentication", "disabled" ); + #} + my @keys = qw(qpsmtpd uqpsmtpd sqpsmtpd); + + foreach my $key (@keys) { + my $param_name + = $key eq 'qpsmtpd' ? 'SMTPAuth' + : $key eq 'uqpsmtpd' ? 'uSMTPAuth' + : 'sSMTPAuth'; # Defaults to 'sSMTPAuth' for 'sqpsmtpd' + my $SMTPAuth = $c->param($param_name); + + if ($SMTPAuth eq 'disabled') { + $cdb->set_prop($key, 'status', 'disabled'); + $cdb->set_prop($key, 'access', 'disabled'); + } else { + $cdb->set_prop($key, 'status', 'enabled'); + + if ($key eq 'qpsmtpd') { + my $auth_status = $SMTPAuth eq 'publicSSL' ? 'enabled' : 'disabled'; + $cdb->set_prop($key, 'Authentication', $auth_status); + $cdb->set_prop($key, 'access', 'public'); + } else { + $cdb->set_prop($key, 'Authentication', 'enabled'); + my $auth_key = ($key eq 'uqpsmtpd') ? 'uSMTPAuth' : 'sSMTPAuth'; + my $access_value = $c->param($auth_key) eq 'public' ? 'public' : 'local'; + $cdb->set_prop($key, 'access', $access_value); + } ## end else [ if ($key eq 'qpsmtpd')] + } ## end else [ if ($SMTPAuth eq 'disabled')] + } ## end foreach my $key (@keys) + + unless (system("/sbin/e-smith/signal-event", "email-update") == 0) { + return $c->l('mai_ERROR_UPDATING_CONFIGURATION'); + } + return 'OK'; +} ## end sub change_settings_reception + +sub change_settings_delivery { + my ($c) = shift; + $cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; + my $EmailUnknownUser = ($c->param('EmailUnknownUser') || 'returntosender'); + $cdb->set_value('SMTPSmartHost', $c->param('SMTPSmartHost')); + $cdb->set_value('DelegateMailServer', $c->param('DelegateMailServer')); + $cdb->set_value('EmailUnknownUser', $EmailUnknownUser); + my $proxy = $cdb->get('smtp-auth-proxy'); + my %props = $proxy->props; + + for (qw(Userid Passwd status)) { + $props{$_} = $c->param("SMTPAUTHPROXY_$_"); + } + $proxy->merge_props(%props); + + unless (system("/sbin/e-smith/signal-event", "email-update") == 0) { + return $c->l('mai_ERROR_UPDATING_CONFIGURATION'); + } + return 'OK'; +} ## end sub change_settings_delivery + +sub change_settings_access { + my $c = shift; + $cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; + my $pop3Access = ($c->param('POPAccess') || 'private'); + + if ($pop3Access eq 'disabled') { + $cdb->set_prop('pop3', "status", "disabled"); + $cdb->set_prop('pop3s', "status", "disabled"); + } else { + $cdb->set_prop('pop3', "status", "enabled"); + $cdb->set_prop('pop3s', "status", "enabled"); + } + + if ($pop3Access eq 'public') { + $cdb->set_prop('pop3', "access", "public"); + $cdb->set_prop('pop3s', "access", "public"); + } elsif ($pop3Access eq 'publicSSL') { + $cdb->set_prop('pop3', "access", "private"); + $cdb->set_prop('pop3s', "access", "public"); + } else { + $cdb->set_prop('pop3', "access", "private"); + $cdb->set_prop('pop3s', "access", "private"); + } + my $imapAccess = ($c->param('IMAPAccess') || 'private'); + + if ($imapAccess eq 'disabled') { + $cdb->set_prop('imap', "status", "enabled"); + $cdb->set_prop('imap', "access", "localhost"); + $cdb->set_prop('imaps', "status", "disabled"); + } elsif ($imapAccess eq 'public') { + $cdb->set_prop('imap', "status", "enabled"); + $cdb->set_prop('imap', "access", "public"); + $cdb->set_prop('imaps', "status", "enabled"); + $cdb->set_prop('imaps', "access", "public"); + } elsif ($imapAccess eq 'publicSSL') { + $cdb->set_prop('imap', "status", "enabled"); + $cdb->set_prop('imap', "access", "private"); + $cdb->set_prop('imaps', "status", "enabled"); + $cdb->set_prop('imaps', "access", "public"); + } else { + $cdb->set_prop('imap', "status", "enabled"); + $cdb->set_prop('imap', "access", "private"); + $cdb->set_prop('imaps', "status", "enabled"); + $cdb->set_prop('imaps', "access", "private"); + } ## end else [ if ($imapAccess eq 'disabled')] + + #------------------------------------------------------------ + # Set webmail state in configuration database, and access + # type for SSL + # PHP and MySQL should always be on, and are enabled by default + # We don't do anything with them here. + #------------------------------------------------------------ + my $webmail = ($c->param('WebMail') || 'disabled'); + + if ($webmail eq "enabledSSL") { + $cdb->set_prop('php81-php-fpm', "status", "enabled"); + $cdb->set_prop('mariadb', "status", "enabled"); + $cdb->set_prop('roundcube', "status", 'enabled'); + $cdb->set_prop('roundcube', "access", "public"); + } elsif ($webmail eq "localnetworkSSL") { + $cdb->set_prop('php81-php-fpm', "status", "enabled"); + $cdb->set_prop('mariadb', "status", "enabled"); + $cdb->set_prop('roundcube', "status", 'enabled'); + $cdb->set_prop('roundcube', "access", "private"); + } else { + $cdb->set_prop('roundcube', "status", 'disabled'); + } + + unless (system("/sbin/e-smith/signal-event", "email-update") == 0) { + return $c->l('mai_ERROR_UPDATING_CONFIGURATION'); + } + return 'OK'; +} ## end sub change_settings_access + +sub change_settings_filtering { + my $c = shift; + $cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; + my $virus_status = ($c->param('VirusStatus') || 'disabled'); + $cdb->set_prop("qpsmtpd", 'VirusScan', $virus_status); + + for my $param ( + qw( + status + Sensitivity + TagLevel + RejectLevel + SortSpam + Subject + SubjectTag) + ) + { + $cdb->set_prop('spamassassin', $param, $c->param("Spam$param")); + } ## end for my $param (qw( status...)) + my $patterns_status = $c->adjust_patterns() ? 'enabled' : 'disabled'; + $cdb->set_prop("qpsmtpd", 'PatternsScan', $patterns_status); + + unless (system("/sbin/e-smith/signal-event", "email-update") == 0) { + return $c->l('mai_ERROR_UPDATING_CONFIGURATION'); + } + return 'OK'; +} ## end sub change_settings_filtering + +#sub blank_or_ip_number { +# my ($c, $value) = @_; +# return 'OK' unless (defined $value); # undef is blank +# return 'OK' if ($value =~ /^$/); # blank is blank +# return $c->call_fm_validation("ip_number",$value,''); # otherwise, validate the input +#} +sub nonblank_if_smtpauth { + my ($c, $value) = @_; + return "OK" unless ($c->param("SMTPAUTHPROXY_status") eq 'enabled'); + return ($value =~ /\S+/) ? "OK" : $c->l('mai_VALIDATION_SMTPAUTH_NONBLANK'); +} + +sub get_secondary_mail_use_envelope { + my $use_envelope = $cdb->get_prop('fetchmail', 'SecondaryMailEnvelope'); + + if (defined $use_envelope) { + return ('on'); + } else { + return ('off'); + } +} ## end sub get_secondary_mail_use_envelope + +sub validate_smarthost { + my $c = shift; + my $smarthost = shift; + return ('OK') if ($smarthost =~ /^(\S+\.\S+)$/); + return ('OK') if ($smarthost eq ''); + return "mai_INVALID_SMARTHOST"; +} ## end sub validate_smarthost + + +sub validate_ip_or_blank { + my ($c,$ip) = @_; + + return "OK" if $ip eq ''; + + return "OK" if is_ipv4($ip) || is_ipv6($ip); + + return "mai_INVALID_DELEGATE"; +} + +# From earlier version - delete this once conversion is done. +#sub main { + #my $c = shift; + #$c->app->log->info($c->log_req); + #$pattern_db = esmith::ConfigDB::UTF8->open("mailpatterns"); + #$cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; + #my %mai_datas = (); + #my $title = $c->l('mai_FORM_TITLE'); + #$mai_datas{'trt'} = 'LIST'; + #$mai_datas{fetchmailmethod} = $c->l($cdb->get_prop('fetchmail', 'Method')); + #$c->stash(title => $title, notif => '', mai_datas => \%mai_datas); + #$c->render(template => 'emailsettings'); +#} ## end sub main + +#sub do_display { + #my $c = shift; + #my $rt = $c->current_route; + #my $trt = ($c->param('trt') || 'LIST'); + #my %mai_datas = (); + #my $title = $c->l('mai_FORM_TITLE'); + #my ($notif, $dest) = ''; + #$mai_datas{'trt'} = $trt; + #$cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; + + #if ($trt eq 'ACC') { + #$dest = 'emailaccess'; + #$mai_datas{fetchmailmethod} = $cdb->get_prop('fetchmail', 'Method'); + #} + + #if ($trt eq 'FIL') { + #$dest = 'emailfilter'; + #$mai_datas{'virusstatus'} = $c->get_virus_status(); + #$mai_datas{'spamstatus'} = $cdb->get_prop('spamassassin', 'status'); + #$mai_datas{'spamsensitivity'} = $cdb->get_prop('spamassassin', 'Sensitivity', 'medium'); + #$mai_datas{'spamtaglevel'} = $cdb->get_prop('spamassassin', 'TagLevel') || '0'; + #$mai_datas{'spamrejectlevel'} = $cdb->get_prop('spamassassin', 'RejectLevel') || '0'; + #$mai_datas{spamsortspam} = $cdb->get_prop('spamassassin', 'SortSpam'); + #$mai_datas{spamsubjecttag} = $cdb->get_prop('spamassassin', 'SubjectTag'); + #$mai_datas{spamsubject} = $cdb->get_prop('spamassassin', 'Subject'); + #} ## end if ($trt eq 'FIL') + + #if ($trt eq 'REC') { + #$dest = 'emailreceive'; + #$mai_datas{fetchmailmethod} = $cdb->get_prop('fetchmail', 'Method'); + #$mai_datas{freqoffice} = $cdb->get_prop('fetchmail', 'FreqOffice'); + #$mai_datas{freqoutside} = $cdb->get_prop('fetchmail', 'FreqOutside'); + #$mai_datas{freqweekend} = $cdb->get_prop('fetchmail', 'FreqWeekend'); + #$mai_datas{secondarymailserver} = $cdb->get_prop('fetchmail', 'SecondaryMailServer'); + #$mai_datas{secondarymailaccount} = $cdb->get_prop('fetchmail', 'SecondaryMailAccount'); + #$mai_datas{secondarymailpassword} = $cdb->get_prop('fetchmail', 'SecondaryMailPassword'); + #$mai_datas{specifyheader} = get_secondary_mail_use_envelope(); + #$mai_datas{secondarymailenvelope} = $cdb->get_prop('fetchmail', 'SecondaryMailEnvelope'); + #} ## end if ($trt eq 'REC') + + #if ($trt eq 'DEL') { + #$dest = 'emaildeliver'; + #$mai_datas{emailunknownuser} = $cdb->get_value('EmailUnknownUser') || '"returntosender'; + #$mai_datas{delegatemailserver} = $cdb->get_value('DelegateMailServer'); + #$mai_datas{smtpsmarthost} = $cdb->get_value('SMTPSmartHost'); + #$mai_datas{smtpauthproxystatus} = $cdb->get_prop('smtp-auth-proxy', 'status') || 'disabled'; + #$mai_datas{smtpauthproxyuserid} = $cdb->get_prop('smtp-auth-proxy', 'Userid') || ''; + #$mai_datas{smtpauthproxypassword} = $cdb->get_prop('smtp-auth-proxy', 'Passwd') || ''; + #} ## end if ($trt eq 'DEL') + #$c->stash(title => $title, notif => $notif, mai_datas => \%mai_datas); + #return $c->render(template => $dest); +#} ## end sub do_display + +#sub do_update { + #my $c = shift; + #$c->app->log->info($c->log_req); + #my $rt = $c->current_route; + #my $trt = $c->param('trt'); + #my %mai_datas = (); + #$mai_datas{trt} = $trt; + #$cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; + #my $title = $c->l('mai_FORM_TITLE'); + #my ($dest, $res, $result) = ''; + #$dest = "/emailsettings&trt=$trt"; + + #if ($trt eq 'ACC') { + ##$dest = 'emailaccess'; + + ## $mai_datas{xxx} = $c->param('XXX'); + ## controls + ## $res = xxxxxxx( $c ); + ## $result .= $res unless $res eq 'OK'; + #if (!$result) { + #$res = $c->change_settings_access(); + #$result .= $res unless $res eq 'OK'; + + #if (!$result) { + #$result = $c->l('mai_SUCCESS'); + #} + #} ## end if (!$result) + #} ## end if ($trt eq 'ACC') + + #if ($trt eq 'FIL') { + ##$dest = 'emailfilter'; + + ## $mai_datas{xxx} = $c->param('XXX'); + ## controls + ## $res = zzzzzz( $c ); + ## $result .= $res unless $res eq 'OK'; + #if (!$result) { + #$res = $c->change_settings_filtering(); + #$result .= $res unless $res eq 'OK'; + + #if (!$result) { + #$result = $c->l('mai_SUCCESS'); + #} + #} ## end if (!$result) + #} ## end if ($trt eq 'FIL') + + #if ($trt eq 'REC') { + ##$dest = 'emailreceive'; + + ## $mai_datas{xxx} = $c->param('XXX'); + ## controls + ## $res = yyyyyyyyy( $c ); + ## $result .= $res unless $res eq 'OK'; + #if (!$result) { + #$res = $c->change_settings_reception(); + #$result .= $res unless $res eq 'OK'; + + #if (!$result) { + #$result = $c->l('mai_SUCCESS'); + #} + #} ## end if (!$result) + #} ## end if ($trt eq 'REC') + + #if ($trt eq 'DEL') { + ##$dest = 'emaildeliver'; + + #my ($result,$res) = ''; + + #CHECKS: { + #$res = $c->validate_ip_or_blank($c->param('DelegateMailServer')); + #if ($res ne 'OK') { + #$result = $c->l($res); + #last CHECKS; + #} + + #$res = $c->validate_smarthost($c->param('SMTPSmartHost')); + #if ($res ne 'OK') { + #$result = $c->l($res); + #last CHECKS; + #} + + #$res = $c->nonblank_if_smtpauth($c->param('SMTPSmartHost')); + #if ($res ne 'OK') { + #$result = $c->l($res); + #last CHECKS; + #} + + #$res = $c->nonblank_if_smtpauth($c->param('SMTPAUTHPROXY_Userid')); + #if ($res ne 'OK') { + #$result = $c->l($res); + #last CHECKS; + #} + + #$res = $c->nonblank_if_smtpauth($c->param('SMTPAUTHPROXY_Passwd')); + #if ($res ne 'OK') { + #$result = $c->l($res); + #last CHECKS; + #} + + #$res = $c->change_settings_delivery(); + #if ($res ne 'OK') { + #$result = $res; + #last CHECKS; + #} + + #$result = $c->l('mai_SUCCESS'); + #} + ## $result now contains the first error or the success message + #} ## end if ($trt eq 'DEL') + + ## common part + #if ($res ne 'OK') { + #$c->stash(error => $result); + #$c->stash(title => $title, mai_datas => \%mai_datas); + #return $c->redirect_to($dest); + #} else { + #my $message = "emailsettings updates $trt DONE"; + #$c->app->log->info($message); + #$c->flash(success => $result); + #} + #$c->redirect_to("/emailsettings"); +#} ## end sub do_update + + +1; \ No newline at end of file diff --git a/Targets/Emailsettings/Emailsettings.pm b/Targets/Emailsettings/Emailsettings.pm new file mode 100644 index 0000000..011ee2b --- /dev/null +++ b/Targets/Emailsettings/Emailsettings.pm @@ -0,0 +1,440 @@ +package SrvMngr::Controller::Emailsettings; +# +# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +# Remember that each route must be unique (else they just overwrite each other). +# you cannot have get and post on the same name and url. +# +#---------------------------------------------------------------------- +# heading : System +# description : E-Mail +# navigation : 4000 400 +# +# name : emailsettings, method : get, url : /emailsettings, ctlact : Emailsettings#main +# name : emailsettingsu, method : post, url : /emailsettingsu, ctlact : Emailsettings#do_update +# name : emailsettingsd, method : get, url : /emailsettingsd, ctlact : Emailsettings#do_display +# +# routes : end +# +# Documentation: https://wiki.contribs.org/Emailsettings +#---------------------------------------------------------------------- + +# +# 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::UTF8; +use esmith::AccountsDB; +use esmith::NetworksDB::UTF8; +use esmith::HostsDB; +use esmith::DomainsDB::UTF8; + +my $cdb; +my $adb; +my $ndb; +my $hdb; +my $ddb; + +my %mai_data; + +require '/usr/share/smanager/lib/SrvMngr/Controller/Emailsettings-Custom.pm'; #The code that is to be added by the developer + +sub main { +# +# Initial entry - route is "/" +# +#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 - you might want to delete some of these if they are not used. + $cdb = esmith::ConfigDB::UTF8->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::UTF8->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); + + %mai_data = (); + my $title = $c->l('mai_E-Mail'); + my $modul = ''; + + $mai_data{'trt'} = 'FRONT'; + + #Load any DB entries into the _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($mai_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 "/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--update exists + #signal_event smeserver--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 delete some of these if they are not used. + $cdb = esmith::ConfigDB::UTF8->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::UTF8->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); + + my $title = $c->l('mai_E-Mail'); + + # 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}) { + # $mai_data{$key} = $value; + #} + + # the value of trt will tell you which panel has returned + my $trt = $c->param('trt') || 'FRONT'; #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 'FRONT'){ + #Validate form parameters for panel FRONT + $ret = $c->validate_FRONT(\%mai_data); + $thispanel = 'FRONT'; + } + + if ($trt eq 'ACC'){ + #Validate form parameters for panel ACC + $ret = $c->validate_ACC(\%mai_data); + $thispanel = 'ACC'; + } + + if ($trt eq 'FIL'){ + #Validate form parameters for panel FIL + $ret = $c->validate_FIL(\%mai_data); + $thispanel = 'FIL'; + } + + if ($trt eq 'REC'){ + #Validate form parameters for panel REC + $ret = $c->validate_REC(\%mai_data); + $thispanel = 'REC'; + } + + if ($trt eq 'DEL'){ + #Validate form parameters for panel DEL + $ret = $c->validate_DEL(\%mai_data); + $thispanel = 'DEL'; + } + + if ($ret ne 'ok'){ + $c->stash(error => $c->l($ret)); + $c->do_display($thispanel); + } else { + #Do whatever is needed, including writing values to the DB + + + if ($trt eq 'FRONT'){ + #do whatever is required ... + $ret = $c->perform_FRONT(\%mai_data); + if ($ret ne 'ok') { + # return to the panel with error message + $c->stash(error => $c->l($ret)); + $c->stash( + title => $title, + modul => $modul, + mai_data => \%mai_data + ); + $c->render(template => "emailsettings"); + return + } else { + $c->stash( success => $c->l('mai_FRONT_panel_action_was_successful')); #A bit bland - edit it in the lex file + } + } + + if ($trt eq 'ACC'){ + #do whatever is required ... + $ret = $c->perform_ACC(\%mai_data); + if ($ret ne 'ok') { + # return to the panel with error message + $c->stash(error => $c->l($ret)); + $c->stash( + title => $title, + modul => $modul, + mai_data => \%mai_data + ); + $c->render(template => "emailsettings"); + return + } else { + $c->stash( success => $c->l('mai_ACC_panel_action_was_successful')); #A bit bland - edit it in the lex file + } + } + + if ($trt eq 'FIL'){ + #do whatever is required ... + $ret = $c->perform_FIL(\%mai_data); + if ($ret ne 'ok') { + # return to the panel with error message + $c->stash(error => $c->l($ret)); + $c->stash( + title => $title, + modul => $modul, + mai_data => \%mai_data + ); + $c->render(template => "emailsettings"); + return + } else { + $c->stash( success => $c->l('mai_FIL_panel_action_was_successful')); #A bit bland - edit it in the lex file + } + } + + if ($trt eq 'REC'){ + #do whatever is required ... + $ret = $c->perform_REC(\%mai_data); + if ($ret ne 'ok') { + # return to the panel with error message + $c->stash(error => $c->l($ret)); + $c->stash( + title => $title, + modul => $modul, + mai_data => \%mai_data + ); + $c->render(template => "emailsettings"); + return + } else { + $c->stash( success => $c->l('mai_REC_panel_action_was_successful')); #A bit bland - edit it in the lex file + } + } + + if ($trt eq 'DEL'){ + #do whatever is required ... + $ret = $c->perform_DEL(\%mai_data); + if ($ret ne 'ok') { + # return to the panel with error message + $c->stash(error => $c->l($ret)); + $c->stash( + title => $title, + modul => $modul, + mai_data => \%mai_data + ); + $c->render(template => "emailsettings"); + return + } else { + $c->stash( success => $c->l('mai_DEL_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') { + $mai_data{'trt'} = 'FRONT'; + } else { + $mai_data{'trt'} = 'none'; + } + $c->do_display($mai_data{'trt'}); + } +} + +sub do_display { +# +# Return after link clicked in table (this is a get) - route is "/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 delete some of these if they are not used. + $cdb = esmith::ConfigDB::UTF8->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::UTF8->open() || die("Couldn't open Hosts db"); + $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); + + my $title = $c->l('mai_E-Mail'); + 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}) { + # $mai_data{$key} = $value; + #} + + # the value of trt will tell you which panel has returned + if (! $trt){ + $trt = $c->param('trt') || 'FRONT'; #Indicates where to go now + } + + # Now add in the params from the selected row from the table + + my %selectedrow; + + if ($trt eq 'FRONT'){ + #Validate Get selected row (if applicable) FRONT + %selectedrow = $c->get_selected_FRONT($mai_data{'Selected'},$is_new_record); + } + + if ($trt eq 'ACC'){ + #Validate Get selected row (if applicable) ACC + %selectedrow = $c->get_selected_ACC($mai_data{'Selected'},$is_new_record); + } + + if ($trt eq 'FIL'){ + #Validate Get selected row (if applicable) FIL + %selectedrow = $c->get_selected_FIL($mai_data{'Selected'},$is_new_record); + } + + if ($trt eq 'REC'){ + #Validate Get selected row (if applicable) REC + %selectedrow = $c->get_selected_REC($mai_data{'Selected'},$is_new_record); + } + + if ($trt eq 'DEL'){ + #Validate Get selected row (if applicable) DEL + %selectedrow = $c->get_selected_DEL($mai_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){ + $mai_data{$key} = $value; + } + # Where to go now + $mai_data{'trt'} = $trt; + + # Set up other shared data according to the panel to go to + + if ($trt eq 'FRONT'){ + # 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_FRONT(); + # Copy each key-value pair from the returned hash to the prefix data hash + while (my ($key, $value) = each %returned_hash) { + $mai_data{$key} = $value; + } + } + + if ($trt eq 'ACC'){ + # 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_ACC(); + # Copy each key-value pair from the returned hash to the prefix data hash + while (my ($key, $value) = each %returned_hash) { + $mai_data{$key} = $value; + } + } + + if ($trt eq 'FIL'){ + # 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_FIL(); + # Copy each key-value pair from the returned hash to the prefix data hash + while (my ($key, $value) = each %returned_hash) { + $mai_data{$key} = $value; + } + } + + if ($trt eq 'REC'){ + # 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_REC(); + # Copy each key-value pair from the returned hash to the prefix data hash + while (my ($key, $value) = each %returned_hash) { + $mai_data{$key} = $value; + } + } + + if ($trt eq 'DEL'){ + # 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_DEL(); + # Copy each key-value pair from the returned hash to the prefix data hash + while (my ($key, $value) = each %returned_hash) { + $mai_data{$key} = $value; + } + } + + + # and table control fields + + + # Data for panel + $c->stash( + title => $title, + modul => $modul, + mai_data => \%mai_data + ); + $c->render(template => "emailsettings"); +} +1; \ No newline at end of file diff --git a/Targets/Emailsettings/_mai_ACC.html.ep b/Targets/Emailsettings/_mai_ACC.html.ep new file mode 100644 index 0000000..ec0b0d2 --- /dev/null +++ b/Targets/Emailsettings/_mai_ACC.html.ep @@ -0,0 +1,56 @@ +%# +%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +%# +
+%# + % if (config->{debug} == 1) { +
+			%= dumper $mai_data
+		
+ % } + % my $btn = l('mai_SAVE'); + % $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table + + %= form_for "emailsettingsu" => (method => 'POST') => begin + % param 'trt' => $mai_data->{trt} unless param 'trt'; + %= hidden_field 'trt' => $mai_data->{trt} + %# Inputs etc in here. + %=l 'mai_DESC_POP_ACCESS_CONTROL' + +

+ %=l 'mai_LABEL_POP_ACCESS_CONTROL' + + % param 'POPAccess' => $c->get_current_pop3_access() unless param 'POPAccess'; + %= select_field 'POPAccess' => $c->get_pop_opt(), class => 'input' +

+ + %=l 'mai_DESC_IMAP_ACCESS_CONTROL' + +

+ %=l 'mai_LABEL_IMAP_ACCESS_CONTROL' + + % param 'IMAPAccess' => $c->get_current_imap_access() unless param 'IMAPAccess'; + %= select_field 'IMAPAccess' => $c->get_imap_opt(), class => 'input' +

+ + %=l 'mai_DESC_WEBMAIL' + +

+ %=l 'mai_LABEL_WEBMAIL' + + % param 'WebMail' => $c->get_current_webmail_status() unless param 'WebMail'; + %= select_field 'WebMail' => $c->get_webmail_opt(), class => 'input' +

+ + % my $btn = l('SAVE'); + %= submit_button "$btn", class => 'action' + + %# .... + %# Probably finally by a submit. + %= submit_button $btn, class => 'action' + %end +
\ No newline at end of file diff --git a/Targets/Emailsettings/_mai_DEL.html.ep b/Targets/Emailsettings/_mai_DEL.html.ep new file mode 100644 index 0000000..b9849fd --- /dev/null +++ b/Targets/Emailsettings/_mai_DEL.html.ep @@ -0,0 +1,89 @@ +%# +%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +%# +
+%# + % if (config->{debug} == 1) { +
+			%= dumper $mai_data
+		
+ % } + % my $btn = l('mai_SAVE'); + % $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table + + %= form_for "emailsettingsu" => (method => 'POST') => begin + % param 'trt' => $mai_data->{trt} unless param 'trt'; + %= hidden_field 'trt' => $mai_data->{trt} + %# Inputs etc in here. +

+ %=l 'mai_TITLE_UNKNOWN' +

+ + %=l 'mai_DESC_UNKNOWN' + +

+ %=l 'mai_LABEL_UNKNOWN' + + % param 'EmailUnknownUser' => $mai_datas->{emailunknownuser} unless param 'EmailUnknownUser'; + %= select_field 'EmailUnknownUser' => $c->get_emailunknownuser_opt(), class => 'input' +

+ + +

+ %=l 'mai_TITLE_DELEGATE' +

+ + %=l 'mai_DESC_DELEGATE' + +

+ %=l 'mai_LABEL_DELEGATE' + + % param 'DelegateMailServer' => $mai_datas->{delegatemailserver} unless param 'DelegateMailServer'; + %= text_field 'DelegateMailServer', class => 'input' +

+ + +

+ %=l 'mai_TITLE_SMARTHOST' +

+ + %=l 'mai_DESC_SMARTHOST' + +

+ %=l 'mai_LABEL_SMARTHOST' + + % param 'SMTPSmartHost' => $mai_datas->{smtpsmarthost} unless param 'SMTPSmartHost'; + %= text_field 'SMTPSmartHost', class => 'input' +

+ +

+ %=l 'mai_LABEL_SMARTHOST_SMTPAUTH_STATUS' + + % param 'SMTPAUTHPROXY_status' => $mai_datas->{smtpauthproxystatus} unless param 'SMTPAUTHPROXY_status'; + %= select_field 'SMTPAUTHPROXY_status' => [[(l 'DISABLED') => 'disabled'], [(l 'ENABLED') => 'enabled']], class => 'input' +

+ +

+ %=l 'mai_LABEL_SMARTHOST_SMTPAUTH_USERID' + + % param 'SMTPAUTHPROXY_Userid' => $mai_datas->{smtpauthproxyuserid} unless param 'SMTPAUTHPROXY_Userid'; + %= text_field 'SMTPAUTHPROXY_Userid', class => 'input' +

+ +

+ %=l 'mai_LABEL_SMARTHOST_SMTPAUTH_PASSWD' + + % param 'SMTPAUTHPROXY_Passwd' => $mai_datas->{smtpauthproxypassword} unless param 'SMTPAUTHPROXY_Passwd'; + %= password_field 'SMTPAUTHPROXY_Passwd', class => 'input' +

+ + + %# .... + %# Probably finally by a submit. + %= submit_button $btn, class => 'action' + %end +
\ No newline at end of file diff --git a/Targets/Emailsettings/_mai_FIL.html.ep b/Targets/Emailsettings/_mai_FIL.html.ep new file mode 100644 index 0000000..d60dc42 --- /dev/null +++ b/Targets/Emailsettings/_mai_FIL.html.ep @@ -0,0 +1,97 @@ +%# +%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +%# +
+%# + % if (config->{debug} == 1) { +
+			%= dumper $mai_data
+		
+ % } + % my $btn = l('mai_SAVE'); + % $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table + + %= form_for "emailsettingsu" => (method => 'POST') => begin + % param 'trt' => $mai_data->{trt} unless param 'trt'; + %= hidden_field 'trt' => $mai_data->{trt} + %# Inputs etc in here. + %=l 'mai_DESC_VIRUS_SCAN' + +

+ %=l 'mai_LABEL_VIRUS_SCAN' + + % param 'VirusStatus' => $mai_datas->{virusstatus} unless param 'VirusStatus'; + %= select_field 'VirusStatus' => [[(l 'DISABLED') => 'disabled'], [ (l 'ENABLED') => 'enabled']], class => 'input' +

+ + %=l 'mai_DESC_SPAM_SCAN' + +

+ %=l 'mai_LABEL_SPAM_SCAN' + + % param 'Spamstatus' => $mai_datas->{spamstatus} unless param 'Spamstatus'; + %= select_field 'Spamstatus' => [[(l 'DISABLED') => 'disabled'], [ (l 'ENABLED') => 'enabled']], class => 'input' +

+ +

+ %=l 'mai_LABEL_SPAM_SENSITIVITY' + + % param 'SpamSensitivity' => $mai_datas->{spamsensitivity} unless param 'SpamSensitivity'; + %= select_field 'SpamSensitivity' => $c->get_spam_sensitivity_opt(), class => 'input' +

+ +

+ %=l 'mai_LABEL_SPAM_TAGLEVEL' + + % param 'SpamTagLevel' => $mai_datas->{spamtaglevel} unless param 'SpamTagLevel'; + %= select_field 'SpamTagLevel' => $c->get_spam_level_options(), class => 'input' +

+ +

+ %=l 'mai_LABEL_SPAM_REJECTLEVEL' + + % param 'SpamRejectLevel' => $mai_datas->{spamrejectlevel} unless param 'SpamRejectLevel'; + %= select_field 'SpamRejectLevel' => $c->get_spam_level_options(), class => 'input' +

+ +

+ %=l 'mai_LABEL_SORTSPAM' + + % param 'SpamSortSpam' => $mai_datas->{spamsortspam} unless param 'SpamSortSpam'; + %= select_field 'SpamSortSpam' => [[(l 'DISABLED') => 'disabled'], [ (l 'ENABLED') => 'enabled']], class => 'input' +

+ + %=l 'mai_DESC_SPAM_SUBJECT' + +

+ %=l 'mai_LABEL_SPAM_SUBJECTTAG' + + % param 'SpamSubjectTag' => $mai_datas->{spamsubjecttag} unless param 'SpamSubjectTag'; + %= select_field 'SpamSubjectTag' => [[(l 'DISABLED') => 'disabled'], [ (l 'ENABLED') => 'enabled']], class => 'input' +

+ +

+ %=l 'mai_LABEL_SPAM_SUBJECT' + + % param 'SpamSubject' => $mai_datas->{spamsubject} unless param 'SpamSubject'; + %= text_field 'SpamSubject' => class => 'input' +

+ + %=l 'mai_DESC_BLOCK_EXECUTABLE_CONTENT' + +

+ %=l 'mai_LABEL_CONTENT_TO_BLOCK' + + % param 'BlockExecutableContent' => $c->get_patterns_current_opt() unless param 'BlockExecutableContent'; + %= select_field 'BlockExecutableContent' => $c->get_patterns_opt(), class => 'input', multiple => "1" +

+ + %# .... + %# Probably finally by a submit. + %= submit_button $btn, class => 'action' + %end +
\ No newline at end of file diff --git a/Targets/Emailsettings/_mai_FRONT.html.ep b/Targets/Emailsettings/_mai_FRONT.html.ep new file mode 100644 index 0000000..2bf6920 --- /dev/null +++ b/Targets/Emailsettings/_mai_FRONT.html.ep @@ -0,0 +1,155 @@ +%# +%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +%# +
+%# + % if (config->{debug} == 1) { +
+			%= dumper $mai_data
+		
+ % } + % $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table +

<%= $title%>

+
+
+ % my $btn = l('Modify'); + +
+ <%= $c->l('mai_DESC_STATE_ACCESS_BUTTON') %> + %= form_for 'emailsettings' => (method => 'POST') => begin +

+ %=l 'mai_LABEL_POP_ACCESS_CONTROL' + + %= $c->get_current_pop3_access( TRUE ) +

+ +

+ %=l 'mai_LABEL_IMAP_ACCESS_CONTROL' + + %= $c->get_current_imap_access( TRUE ) +

+ +

+ %=l 'mai_LABEL_WEBMAIL' + + %= $c->get_current_webmail_status( TRUE ) +

+ +
+
+ %= submit_button "$btn", class => 'action' +
+ + %= hidden_field 'trt' => 'ACC' + % end +
+
+ + +
+ <%= $c->l('mai_DESC_STATE_FILTERING_BUTTON') %> + %= form_for 'emailsettings' => (method => 'POST') => begin +

+ %=l 'mai_LABEL_VIRUS_SCAN' + + %= $c->get_virus_status(TRUE) +

+ +

+ %=l 'mai_LABEL_SPAM_SCAN' + + %= $c->get_spam_status(TRUE) +

+ +

+ %=l 'mai_LABEL_BLOCK_EXECUTABLE_CONTENT' + + %= $c->get_patterns_status(TRUE) +

+ +
+
+ %= submit_button "$btn", class => 'action' +
+ + %= hidden_field 'trt' => 'FIL' + % end +
+
+ +
+ <%= $c->l('mai_DESC_STATE_RECEPTION_BUTTON') %> + %= form_for 'emailsettings' => (method => 'POST') => begin +

+ %=l 'mai_LABEL_MODE' + + %= $mai_datas->{fetchmailmethod} +

+ + % my $smtp_mesg; + + % $smtp_mesg=l('SMTP port %u allow client to authenticate:'); +

+ %= sprintf($smtp_mesg,$c->get_db_prop('qpsmtpd','TCPPort',25)); + + %= $c->get_current_smtp_auth( TRUE ) +

+ + % $smtp_mesg=l('SMTPS SSL/TLS auth: port %u status:'); +

+ %= sprintf($smtp_mesg,$c->get_db_prop('sqpsmtpd','TCPPort',465)); + + %= $c->get_current_smtp_ssl_auth( TRUE, 's', FALSE ) +

+ + % $smtp_mesg=l 'Submission port %u status:'; +

+ %= sprintf($smtp_mesg,$c->get_db_prop('uqpsmtpd','TCPPort',587)); + + %= $c->get_current_smtp_ssl_auth( TRUE,'u', FALSE ) +

+
+ +
+ %= submit_button "$btn", class => 'action' +
+ + %= hidden_field 'trt' => 'REC' + % end +
+
+ +
+ <%= $c->l('mai_DESC_STATE_DELIVERY_BUTTON') %> + %= form_for 'emailsettings' => (method => 'POST') => begin +

+ %=l 'mai_LABEL_UNKNOWN' + + %= $c->get_emailunknownuser_status( TRUE ) +

+ +

+ %=l 'mai_LABEL_DELEGATE' + + %= $c->get_value('DelegateMailServer') +

+ +

+ %=l 'mai_LABEL_SMARTHOST' + + %= $c->get_value('SMTPSmartHost') +

+ +
+
+ %= submit_button "$btn", class => 'action' +
+ + %= hidden_field 'trt' => 'DEL' + % end +
+
\ No newline at end of file diff --git a/Targets/Emailsettings/_mai_REC.html.ep b/Targets/Emailsettings/_mai_REC.html.ep new file mode 100644 index 0000000..5f480d4 --- /dev/null +++ b/Targets/Emailsettings/_mai_REC.html.ep @@ -0,0 +1,158 @@ +%# +%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +%# +
+%# + % if (config->{debug} == 1) { +
+			%= dumper $mai_data
+		
+ % } + % my $btn = l('mai_SAVE'); + % $c->param(Selected => undef); #This may need deleting for a params panel - only needed for a table + + %= form_for "emailsettingsu" => (method => 'POST') => begin + % param 'trt' => $mai_data->{trt} unless param 'trt'; + %= hidden_field 'trt' => $mai_data->{trt} + %# Inputs etc in here. + %=l 'mai_DESC_MODE' + +

+ %=l 'mai_LABEL_MODE' + + % param 'FetchmailMethod' => $mai_datas->{fetchmailmethod} unless param 'FetchmailMethod'; + + %= select_field 'FetchmailMethod' => $c->get_retrieval_opt(), class => 'input' +

+ + %#=l 'mai_DESC_SMTP_AUTH_CONTROL' +
+ %= l "SMTP port (25) main purpose is to receive emails from another server, STARTTLS is always offered, but auth if offered is only if STARTTLS is also used by client." +
+ %= l "SMTPS port (465) will require implicit SSL/TLS then authenticate to send." +
+ %= l "SMTP Submission port (587) will require STARTTLS, then authenticate to send." +
+ + % my $smtp_mesg=l('SMTP port %u allow client to authenticate:'); +

+ %= sprintf($smtp_mesg,$c->get_db_prop('qpsmtpd','TCPPort',25)); + + % param 'SMTPAuth' => $c->get_current_smtp_auth( FALSE ) unless param 'SMTPAuth'; + + %= select_field 'SMTPAuth' => $c->get_smtp_auth_opt(), class => 'input' +

+ + % my $smtp_mesg=l('SMTPS SSL/TLS auth: port %u status:'); +

+ %= sprintf($smtp_mesg,$c->get_db_prop('sqpsmtpd','TCPPort',465)); + + % param 'sSMTPAuth' => $c->get_current_smtp_ssl_auth(FALSE,'s', TRUE) unless param 'sSMTPAuth'; + + %= select_field 'sSMTPAuth' => $c->get_smtp_ssl_auth_opt(), class => 'input' +

+ + %my $smtp_mesg=l('Submission port %u status:'); +

+ %= sprintf($smtp_mesg,$c->get_db_prop('uqpsmtpd','TCPPort',587)); + + % param 'uSMTPAuth' => $c->get_current_smtp_ssl_auth(FALSE,'u', TRUE) unless param 'uSMTPAuth'; + + %= select_field 'uSMTPAuth' => $c->get_smtp_ssl_auth_opt(), class => 'input' +

+ + +

+ %=l 'mai_TITLE_SECONDARY' +

+ + %=l 'mai_DESC_SECONDARY' + +

+ %=l 'mai_LABEL_SECONDARY' + + % param 'SecondaryMailServer' => $mai_datas->{secondarymailserver} unless param 'SecondaryMailServer'; + %= text_field 'SecondaryMailServer', class => 'input' +

+ + %=l 'mai_DESC_FETCH_PERIOD' + +

+ %=l 'mai_LABEL_FETCH_PERIOD' + + % param 'FreqOffice' => $mai_datas->{freqoffice} unless param 'FreqOffice'; + %= select_field 'FreqOffice' => $c->fetchmail_freq(), class => 'input' +

+ +

+ %=l 'mai_LABEL_FETCH_PERIOD_NIGHTS' + + % param 'FreqOutside' => $mai_datas->{freqoutside} unless param 'FreqOutside'; + %= select_field 'FreqOutside' => $c->fetchmail_freq(), class => 'input' +

+ +

+ %=l 'mai_LABEL_FETCH_PERIOD_WEEKENDS' + + % param 'FreqWeekend' => $mai_datas->{freqweekend} unless param 'FreqWeekend'; + %= select_field 'FreqWeekend' => $c->fetchmail_freq(), class => 'input' +

+ +

+ %=l 'mai_LABEL_POP_ACCOUNT' + + % param 'SecondaryMailAccount' => $mai_datas->{secondarymailaccount} unless param 'SecondaryMailAccount'; + %= text_field 'SecondaryMailAccount', class => 'input' +

+ +

+ %=l 'mai_LABEL_POP_PASS' + + % param 'SecondaryMailPassword' => $mai_datas->{secondarymailpassword} unless param 'SecondaryMailPassword'; + %= password_field 'SecondaryMailPassword', class => 'input' +

+ +

+ %=l 'mai_LABEL_SORT_METHOD' + + % param 'SpecifyHeader' => $mai_datas->{specifyheader} unless param 'SpecifyHeader'; + %= select_field 'SpecifyHeader' => [[(l 'mai_DEFAULT') => 'off'], [(l 'mai_SPECIFY_BELOW') => 'on']], class => 'input' +

+ +

+ %=l 'mai_LABEL_SORT_HEADER' + + % param 'SecondaryMailEnvelope' => $mai_datas->{secondarymailenvelope} unless param 'SecondaryMailEnvelope'; + %= text_field 'SecondaryMailEnvelope', class => 'input' +

+ + %# .... + %# Probably finally by a submit. + %= submit_button $btn, class => 'action' + %end +
\ No newline at end of file diff --git a/Targets/Emailsettings/emailsettings.css b/Targets/Emailsettings/emailsettings.css new file mode 100644 index 0000000..7a9223d --- /dev/null +++ b/Targets/Emailsettings/emailsettings.css @@ -0,0 +1,14 @@ +/* +Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +*/ +.Emailsettings-panel {} +.name {} +.rout {} +.name {} +.rout {} +.name {} +.rout {} +.name {} +.rout {} +.name {} +.rout {} diff --git a/Targets/Emailsettings/emailsettings.html.ep b/Targets/Emailsettings/emailsettings.html.ep new file mode 100644 index 0000000..f0c24a7 --- /dev/null +++ b/Targets/Emailsettings/emailsettings.html.ep @@ -0,0 +1,68 @@ +%# +%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +%# +% layout 'default', title => "Sme server 2 - E-Mail", share_dir => './'; +%# css specific to this panel: +% content_for 'module' => begin +%= stylesheet '/css/emailsettings.css' +%= javascript '/js/emailsettings.js' +
+ + % if (config->{debug} == 1) { +
+		%= dumper $c->current_route
+		%= dumper $mai_data->{trt}
+	
+ % } + +

<%=$title%>

+ + % if ( stash('modul')) { + %= $c->render_to_string(inline => stash('modul') ); + % } + + %if ($c->stash('first')) { +

+ %=$c->render_to_string(inline =>$c->l($c->stash('first'))) +

+ + %} elsif ($c->stash('success')) { +
+ %= $c->l($c->stash('success')); +
+
+ + %} elsif ($c->stash('error')) { +
+ %= $c->l($c->stash('error')); +
+
+ %} + + %#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 ($mai_data->{trt} eq "FRONT") { + %= include 'partials/_mai_FRONT' + %} + + % if ($mai_data->{trt} eq "ACC") { + %= include 'partials/_mai_ACC' + %} + + % if ($mai_data->{trt} eq "FIL") { + %= include 'partials/_mai_FIL' + %} + + % if ($mai_data->{trt} eq "REC") { + %= include 'partials/_mai_REC' + %} + + % if ($mai_data->{trt} eq "DEL") { + %= include 'partials/_mai_DEL' + %} + + + +
+%end \ No newline at end of file diff --git a/Targets/Emailsettings/emailsettings.js b/Targets/Emailsettings/emailsettings.js new file mode 100644 index 0000000..6d99c37 --- /dev/null +++ b/Targets/Emailsettings/emailsettings.js @@ -0,0 +1,5 @@ +// +//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:53:20 +// +$(document).ready(function() { +}); diff --git a/Targets/Emailsettings/emailsettings_en.lex b/Targets/Emailsettings/emailsettings_en.lex new file mode 100644 index 0000000..fd90a6e --- /dev/null +++ b/Targets/Emailsettings/emailsettings_en.lex @@ -0,0 +1,152 @@ +'mai_FORM_TITLE' => 'E-mail settings', +'E-mail' => 'E-mail', +'mai_SUCCESS' => 'The new e-mail settings have been saved.', +'mai_NEVER' => 'not at all', +'mai_EVERY5MIN' => 'Every 5 minutes', +'mai_EVERY15MIN' => 'Every 15 minutes', +'mai_EVERY30MIN' => 'Every 30 minutes', +'mai_EVERYHOUR' => 'Every hour', +'mai_EVERY2HRS' => 'Every 2 hours', +'mai_STANDARD' => 'Standard (SMTP)', +'mai_ETRN' => 'ETRN (SMTP with client request)', +'mai_DEFAULT' => 'Default', +'mai_SPECIFY_BELOW' => 'Specify below', +'mai_MULTIDROP' => 'multi-drop', +'mai_LABEL_MODE' => 'E-mail retrieval mode', +'mai_DESC_MODE' => 'The e-mail retrieval mode can be set to +standard (for dedicated Internet connections), ETRN (recommended +for dialup connections), or multi-drop (for dialup connections if +ETRN is not supported by your Internet provider). Note that +multi-drop mode is the only option available when the server is +configured in private server and gateway mode.', +'mai_LABEL_DELEGATE' => 'Address of internal mail server', +'mai_TITLE_DELEGATE' => 'Delegate mail servers', +'mai_DESC_DELEGATE' => 'Your server includes a complete, full-featured e-mail server. However, +if for some reason you wish to delegate e-mail processing to +another system, specify the IP address of the delegate system +here. For normal operation, leave this field blank.', +'mai_LABEL_SECONDARY' => 'Secondary mail server', +'mai_TITLE_SECONDARY' => 'ETRN or multi-drop settings', +'mai_DESC_SECONDARY' => 'For ETRN or multi-drop, specify the hostname or IP address of your +secondary mail server. (If using the standard e-mail setup, this +field can be left blank.)', +'mai_DESC_FETCH_PERIOD' => 'For ETRN or multi-drop, you can control how frequently this server +contacts your secondary e-mail server to fetch e-mail. More +frequent connections mean that you receive your e-mail more +quickly, but also cause Internet requests to be sent more often, +possibly increasing your phone and Internet charges.', +'mai_LABEL_FETCH_PERIOD' => 'During office hours (8:00 AM to 6:00 PM) on weekdays', +'mai_LABEL_FETCH_PERIOD_NIGHTS' => 'Outside office hours (6:00 PM to 8:00 AM) on weekdays', +'mai_LABEL_FETCH_PERIOD_WEEKENDS' => 'During the weekend', +'mai_DESC_POP_ACCOUNT' => 'For multi-drop e-mail, specify the POP user account and password. +(If using standard or ETRN e-mail, these fields can be blank.) +Also, for multi-drop, you can either use the default mail sorting +method, or you can specify a particular message header to use for +mail sorting.', +'mai_LABEL_POP_PASS' => 'POP user password (for multi-drop)', +'mai_LABEL_POP_ACCOUNT' => 'POP user account (for multi-drop)', +'mai_LABEL_SORT_METHOD' => 'Select sort method (for multi-drop)', +'mai_LABEL_SORT_HEADER' => 'Select sort header (for multi-drop)', +'mai_LABEL_FETCH_PROTO' => 'Protocol (for multi-drop)', +'mai_LABEL_FETCH_SECURE' => 'Tunnel over SSL (for multi-drop)', +'mai_AUTO' => 'Automatic', +'mai_ENABLED_BOTH' => 'Allow both HTTP and HTTPS', +'mai_ENABLED_SECURE_ONLY' => 'Allow HTTPS (secure)', +'mai_ONLY_LOCAL_NETWORK_SSL' => 'Allow HTTPS (secure) from local networks', +'mai_INSECURE_POP3' => 'Allow both POP3 and POP3S', +'mai_ALLOW_PRIVATE' => 'Allow private', +'mai_SECURE_POP3' => 'Allow private and public (secure POP3S)', +'mai_INSECURE_IMAP' => 'Allow both IMAP and IMAPS', +'mai_SECURE_IMAP' => 'Allow private and public (secure IMAPS)', +'mai_INSECURE_SMTP' => 'Allow both SMTP and SSMTP', +'mai_SECURE_SMTP' => 'Allow SSMTP (secure)', +'mai_LABEL_POP_ACCESS_CONTROL' => 'POP3 server access', +'mai_LABEL_IMAP_ACCESS_CONTROL' => 'IMAP server access', +'mai_LABEL_SMTP_AUTH_CONTROL' => 'SMTP authentication', +'mai_FORWARD_TO_ADMIN' => 'Send to administrator', +'mai_FORWARD_TO' => 'Send to', +'mai_RETURN_TO_SENDER' => 'Reject', +'mai_LABEL_UNKNOWN' => 'E-mail to unknown users', +'mai_TITLE_UNKNOWN' => 'Unknown Users', +'mai_DESC_UNKNOWN' => 'Selecting Reject (recommended setting) will configure the server to only +accept mail for valid email addresses (for example users, groups, pseudonyms). +Mail for other addresses will be rejected.', +'mai_LABEL_SMARTHOST' => 'Address of Internet provider\'s mail server', +'mai_TITLE_SMARTHOST' => 'SMTP server', +'mai_DESC_SMARTHOST' => 'The server can deliver outgoing messages directly to their +destination (recommended in most cases) or can deliver them via +your Internet provider\'s SMTP server (recommended if you have an +unreliable Internet connection or are using a residential Internet +service). If using your Internet provider\'s SMTP server, specify +its hostname or IP address below. Otherwise leave this field blank.', +'mai_INVALID_SMARTHOST' => 'The smarthost name you entered is not a valid internet domain name and is not blank', +'mai_INVALID_DELEGATE' => 'The delegate host name you entered is not a valid internet domain name and is not blank', +'mai_DESC_POP_ACCESS_CONTROL' => 'You can control POP3 server access. The setting \'Allow access +only from local networks\' allows POP3 access only from your +local network(s). The POP3S setting can be used to provide +encrypted external access to your POP3 server. We recommend +leaving this setting \'Allow access only from local networks\' +unless you have a specific reason to do otherwise.', +'mai_DESC_IMAP_ACCESS_CONTROL' => 'You can control IMAP server access. The setting \'Allow access +only from local networks\' allows IMAP access only from your +local network(s). The IMAPS setting can be used to provide +encrypted external access to your IMAP server. We recommend +leaving this setting \'Allow access only from local networks\' +unless you have a specific reason to do otherwise.', +'mai_DESC_SMTP_AUTH_CONTROL' => 'You can provide authenticated access to your SMTP server, or +set it to Disabled. +The SSMTP setting requires all users to use SSL/TLS +authentication. The SMTP and SSMTP option additionally allows +STARTTLS to be used to ensure secure authentication.', +'mai_DESC_WEBMAIL' => 'You can enable or disable webmail on this system. Webmail allows +users to access their mail through a regular web browser by +pointing the browser to https://[_1]/webmail,and + logging in to their account.', +'mai_LABEL_WEBMAIL' => 'Webmail access', +'mai_LABEL_BLOCK_EXECUTABLE_CONTENT' => 'Executable content blocking', +'mai_LABEL_CONTENT_TO_BLOCK' => 'Content to block', +'mai_DESC_BLOCK_EXECUTABLE_CONTENT' => 'You can block executable content in e-mail attachments +by highlighting the executable attachment types you wish to +block. E-mail containing these attachment types will +be automatically returned to the sender.', +'mai_UNACCEPTABLE_CHARS' => 'This field requires a valid e-mail address, which must include +the @ symbol and a domain name.', +'mai_DESC_STATE_ACCESS' => 'E-mail access', +'mai_DESC_STATE_ACCESS_BUTTON' => 'Change e-mail access settings', +'mai_DESC_STATE_RECEPTION' => 'E-mail reception', +'mai_DESC_STATE_RECEPTION_BUTTON' => 'Change e-mail reception settings', +'mai_DESC_STATE_DELIVERY' => 'E-mail delivery', +'mai_DESC_STATE_DELIVERY_BUTTON' => 'Change e-mail delivery settings', +'mai_DESC_STATE_FILTERING_BUTTON' => 'Change e-mail filtering settings', +'mai_LABEL_VIRUS_SCAN' => 'Virus scanning', +'mai_DESC_VIRUS_SCAN' => 'You can scan incoming and outgoing e-mail for viruses. If scanning is enabled and a virus is detected, the e-mail will be rejected and returned to the +sender.', +'mai_LABEL_SPAM_SCAN' => 'Spam filtering', +'mai_DESC_SPAM_SCAN' => 'You can scan e-mail for spam. If Spam filtering is +enabled, an X-Spam-Status: header is added to each +message, which can be used for filtering spam. +You can adjust the sensitivity of the Spam detection +process from the default of medium. For fine-grained +control, you can set the Spam sensitivity to Custom +and then choose a custom tagging level, and +optionally a level at which to reject the message.', +'mai_LABEL_SPAM_SUBJECT' => 'SPAM subject prefix', +'mai_DESC_SPAM_SUBJECT' => 'You can enable to add a tag to the subject of each +message that is classified as SPAM. +The value for this tag can be defined below.', +'mai_LABEL_SPAM_SENSITIVITY' => 'Spam sensitivity', +'mai_LABEL_SPAM_TAGLEVEL' => 'Custom spam tagging level', +'mai_LABEL_SPAM_REJECTLEVEL' => 'Custom spam rejection level', +'mai_LABEL_SPAM_SUBJECTTAG' => 'Modify subject of spam messages', +'mai_LABEL_SORTSPAM' => 'Sort spam into junkmail folder', +'mai_VERYHIGH' => 'Very high', +'mai_HIGH' => 'High', +'mai_MEDIUM' => 'Medium', +'mai_LOW' => 'Low', +'mai_VERYLOW' => 'Very low', +'mai_CUSTOM' => 'Custom', +'mai_LABEL_SMARTHOST_SMTPAUTH_STATUS' => 'SMTP Authentication for Internet provider', +'mai_LABEL_SMARTHOST_SMTPAUTH_USERID' => 'Mail server user id', +'mai_LABEL_SMARTHOST_SMTPAUTH_PASSWD' => 'Mail server password', +'mai_VALIDATION_SMTPAUTH_NONBLANK' => 'This field cannot be left blank if SMTP Authentication is +enabled.', \ No newline at end of file diff --git a/html/mai-ACC.html b/html/mai-ACC.html new file mode 100644 index 0000000..28bf96a --- /dev/null +++ b/html/mai-ACC.html @@ -0,0 +1,49 @@ +
+ + +

E-mail settings

+ +
+ + You can control POP3 server access. The setting 'Allow access +only from local networks' allows POP3 access only from your +local network(s). The POP3S setting can be used to provide +encrypted external access to your POP3 server. We recommend +leaving this setting 'Allow access only from local networks' +unless you have a specific reason to do otherwise. + +

+ POP3 server access + + +

+ + You can control IMAP server access. The setting 'Allow access +only from local networks' allows IMAP access only from your +local network(s). The IMAPS setting can be used to provide +encrypted external access to your IMAP server. We recommend +leaving this setting 'Allow access only from local networks' +unless you have a specific reason to do otherwise. + +

+ IMAP server access + + +

+ + You can enable or disable webmail on this system. Webmail allows +users to access their mail through a regular web browser by +pointing the browser to https:///webmail,and + logging in to their account. + +

+ Webmail access + + +

+ + + + +
+
diff --git a/html/mai-DEL.html b/html/mai-DEL.html new file mode 100644 index 0000000..3be2ec7 --- /dev/null +++ b/html/mai-DEL.html @@ -0,0 +1,79 @@ +
+ + + +

E-mail settings

+ +
+ +

+ Unknown Users +

+ + Selecting Reject (recommended setting) will configure the server to only +accept mail for valid email addresses (for example users, groups, pseudonyms). +Mail for other addresses will be rejected. + +

+ E-mail to unknown users + + +

+ + +

+ Delegate mail servers +

+ + Your server includes a complete, full-featured e-mail server. However, +if for some reason you wish to delegate e-mail processing to +another system, specify the IP address of the delegate system +here. For normal operation, leave this field blank. + +

+ Address of internal mail server + + +

+ + +

+ SMTP server +

+ + The server can deliver outgoing messages directly to their +destination (recommended in most cases) or can deliver them via +your Internet provider's SMTP server (recommended if you have an +unreliable Internet connection or are using a residential Internet +service). If using your Internet provider's SMTP server, specify +its hostname or IP address below. Otherwise leave this field blank. + +

+ Address of Internet provider's mail server + + +

+ +

+ SMTP Authentication for Internet provider + + +

+ +

+ Mail server user id + + +

+ +

+ Mail server password + + +

+ + + + +
+
diff --git a/html/mai-FIL.html b/html/mai-FIL.html new file mode 100644 index 0000000..341a232 --- /dev/null +++ b/html/mai-FIL.html @@ -0,0 +1,88 @@ +
+ + + +

E-mail settings

+ +
+ + You can scan incoming and outgoing e-mail for viruses. If scanning is enabled and a virus is detected, the e-mail will be rejected and returned to the +sender. + +

+ Virus scanning + + +

+ + You can scan e-mail for spam. If Spam filtering is +enabled, an X-Spam-Status: header is added to each +message, which can be used for filtering spam. +You can adjust the sensitivity of the Spam detection +process from the default of medium. For fine-grained +control, you can set the Spam sensitivity to Custom +and then choose a custom tagging level, and +optionally a level at which to reject the message. + +

+ Spam filtering + + +

+ +

+ Spam sensitivity + + +

+ +

+ Custom spam tagging level + + +

+ +

+ Custom spam rejection level + + +

+ +

+ Sort spam into junkmail folder + + +

+ + You can enable to add a tag to the subject of each +message that is classified as SPAM. +The value for this tag can be defined below. + +

+ Modify subject of spam messages + + +

+ +

+ SPAM subject prefix + + +

+ + You can block executable content in e-mail attachments +by highlighting the executable attachment types you wish to +block. E-mail containing these attachment types will +be automatically returned to the sender. + +

+ Content to block + + +

+ + + + +
+
diff --git a/html/mai-FRONT.html b/html/mai-FRONT.html new file mode 100644 index 0000000..0e6348d --- /dev/null +++ b/html/mai-FRONT.html @@ -0,0 +1,137 @@ +
+ + + +

E-mail settings

+
+
+ +
+ Change e-mail access settings +
+

+ POP3 server access + + Allow access only from local networks +

+ +

+ IMAP server access + + Allow access only from local networks +

+ +

+ Webmail access + + Allow HTTPS (secure) +

+ +
+
+ +
+ + +
+
+ + +
+ Change e-mail filtering settings +
+

+ Virus scanning + + Enabled +

+ +

+ Spam filtering + + Disabled +

+ +

+ Executable content blocking + + Disabled +

+ +
+
+ +
+ + +
+
+ +
+ Change e-mail reception settings +
+

+ E-mail retrieval mode + + standard +

+ + +

+ SMTP port 25 allow client to authenticate: + + Only allow insecure access +

+ +

+ SMTPS SSL/TLS auth: port 465 status: + + Allow public access +

+ +

+ Submission port 587 status: + + Allow public access +

+
+ +
+ +
+ + +
+
+ +
+ Change e-mail delivery settings +
+

+ E-mail to unknown users + + Reject +

+ +

+ Address of internal mail server + + +

+ +

+ Address of Internet provider's mail server + + +

+ +
+
+ +
+ + +
+ +
+ diff --git a/html/mai-REC.html b/html/mai-REC.html new file mode 100644 index 0000000..2abfb39 --- /dev/null +++ b/html/mai-REC.html @@ -0,0 +1,188 @@ +
+ + + +

E-mail settings

+ +
+ + The e-mail retrieval mode can be set to +standard (for dedicated Internet connections), ETRN (recommended +for dialup connections), or multi-drop (for dialup connections if +ETRN is not supported by your Internet provider). Note that +multi-drop mode is the only option available when the server is +configured in private server and gateway mode. + +

+ E-mail retrieval mode + + + +

+ +
+ SMTP port (25) main purpose is to receive emails from another server, STARTTLS is always offered, but auth if offered is only if STARTTLS is also used by client. +
+ SMTPS port (465) will require implicit SSL/TLS then authenticate to send. +
+ SMTP Submission port (587) will require STARTTLS, then authenticate to send. +
+ +

+ SMTP port 25 allow client to authenticate: + + + +

+ +

+ SMTPS SSL/TLS auth: port 465 status: + + + +

+ +

+ Submission port 587 status: + + + +

+ + +

+ ETRN or multi-drop settings +

+ + For ETRN or multi-drop, specify the hostname or IP address of your +secondary mail server. (If using the standard e-mail setup, this +field can be left blank.) + +

+ Secondary mail server + + +

+ + For ETRN or multi-drop, you can control how frequently this server +contacts your secondary e-mail server to fetch e-mail. More +frequent connections mean that you receive your e-mail more +quickly, but also cause Internet requests to be sent more often, +possibly increasing your phone and Internet charges. + +

+ During office hours (8:00 AM to 6:00 PM) on weekdays + + +

+ +

+ Outside office hours (6:00 PM to 8:00 AM) on weekdays + + +

+ +

+ During the weekend + + +

+ +

+ POP user account (for multi-drop) + + +

+ +

+ POP user password (for multi-drop) + + +

+ +

+ Select sort method (for multi-drop) + + +

+ +

+ Select sort header (for multi-drop) + + +

+ + + + +
+
diff --git a/json5/Emailsettings.json5 b/json5/Emailsettings.json5 new file mode 100644 index 0000000..3d40b28 --- /dev/null +++ b/json5/Emailsettings.json5 @@ -0,0 +1,33 @@ +// +// Generated by sm1-html-2-json5 version:0.5 Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:35:42 +// +{ + 'PackageName': 'Emailsettings', + 'prefix': 'mai', + 'MenuHeading': 'System', + 'MenuDescription': 'E-Mail', + 'MenuNavigation': '4000 400', + 'firstPanel': 'FRONT', + 'html': [ + { + 'Name': 'front', + 'route': 'FRONT', + }, + { + 'Name': 'acc', + 'route': 'ACC', + }, + { + 'Name': 'file', + 'route': 'FIL', + }, + { + 'Name': 'rec', + 'route': 'REC', + }, + { + 'Name': 'del', + 'route': 'DEL', + }, + ] +} \ No newline at end of file diff --git a/json5/mai-ACC.json5 b/json5/mai-ACC.json5 new file mode 100644 index 0000000..9fa2fe6 --- /dev/null +++ b/json5/mai-ACC.json5 @@ -0,0 +1,97 @@ +// +// Generated by sm1-html-2-json5 version:0.5 Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:36:06 +// +{ + 'PackageName': 'mai-ACC', + 'prefix': 'acc', + 'MenuHeading': 'Miscellaneous', + 'MenuDescription': 'mai- A C C', + 'MenuNavigation': '2000 400', + 'firstPanel': 'PARAMS', + 'signalEvent': 'smeserver-mai-acc-update', + 'html': [ + { + 'Name': 'params', + 'route': 'PARAMS', + 'Header': 'E-mail settings', + 'SubHeader': 'Manage mai-ACC settings:', + 'Paragraph1': 'POP3 server accessDisabledAllow access only from local networksAllow private and public (secure POP3S)Allow both POP3 and POP3S', + 'Input1': { + 'Type': 'Select', + 'Value': '', + 'Name': 'POPAccess', + 'Label': 'POPAccess', + 'Options': [ + { + 'Value': 'disabled', + 'Text': 'Disabled' + }, + { + 'Value': 'private', + 'Text': 'Allow access only from local networks' + }, + { + 'Value': 'publicSSL', + 'Text': 'Allow private and public (secure POP3S)' + }, + { + 'Value': 'public', + 'Text': 'Allow both POP3 and POP3S' + } + ] + }, + 'Paragraph2': 'IMAP server accessDisabledAllow access only from local networksAllow private and public (secure IMAPS)Allow both IMAP and IMAPS', + 'Input2': { + 'Type': 'Select', + 'Value': '', + 'Name': 'IMAPAccess', + 'Label': 'IMAPAccess', + 'Options': [ + { + 'Value': 'disabled', + 'Text': 'Disabled' + }, + { + 'Value': 'private', + 'Text': 'Allow access only from local networks' + }, + { + 'Value': 'publicSSL', + 'Text': 'Allow private and public (secure IMAPS)' + }, + { + 'Value': 'public', + 'Text': 'Allow both IMAP and IMAPS' + } + ] + }, + 'Paragraph3': 'Webmail accessDisabledAllow HTTPS (secure)Allow HTTPS (secure) from local networks', + 'Input3': { + 'Type': 'Select', + 'Value': '', + 'Name': 'WebMail', + 'Label': 'WebMail', + 'Options': [ + { + 'Value': 'disabled', + 'Text': 'Disabled' + }, + { + 'Value': 'enabledSSL', + 'Text': 'Allow HTTPS (secure)' + }, + { + 'Value': 'localnetworkSSL', + 'Text': 'Allow HTTPS (secure) from local networks' + } + ] + }, + 'Input4': { + 'Type': 'Submit', + 'Value': 'Save', + 'Name': null, + 'Label': null + } + } + ] +} \ No newline at end of file diff --git a/json5/mai-DEL.json5 b/json5/mai-DEL.json5 new file mode 100644 index 0000000..42f96cb --- /dev/null +++ b/json5/mai-DEL.json5 @@ -0,0 +1,120 @@ +// +// Generated by sm1-html-2-json5 version:0.5 Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:37:08 +// +{ + 'PackageName': 'mai-DEL', + 'prefix': 'del', + 'MenuHeading': 'Miscellaneous', + 'MenuDescription': 'mai- D E L', + 'MenuNavigation': '2000 400', + 'firstPanel': 'PARAMS', + 'signalEvent': 'smeserver-mai-del-update', + 'html': [ + { + 'Name': 'params', + 'route': 'PARAMS', + 'Header': 'E-mail settings', + 'SubHeader': 'SMTP server', + 'Paragraph1': 'E-mail to unknown usersSend to administratorRejectSend to abuseSend to admin_raidreportSend to anonymousSend to brian.readSend to brian_readSend to brianrSend to mailer-daemonSend to postmaster', + 'Input1': { + 'Type': 'Select', + 'Value': '', + 'Name': 'EmailUnknownUser', + 'Label': 'EmailUnknownUser', + 'Options': [ + { + 'Value': 'admin', + 'Text': 'Send to administrator' + }, + { + 'Value': 'returntosender', + 'Text': 'Reject' + }, + { + 'Value': 'abuse', + 'Text': 'Send to abuse' + }, + { + 'Value': 'admin_raidreport', + 'Text': 'Send to admin_raidreport' + }, + { + 'Value': 'anonymous', + 'Text': 'Send to anonymous' + }, + { + 'Value': 'brian.read', + 'Text': 'Send to brian.read' + }, + { + 'Value': 'brian_read', + 'Text': 'Send to brian_read' + }, + { + 'Value': 'brianr', + 'Text': 'Send to brianr' + }, + { + 'Value': 'mailer-daemon', + 'Text': 'Send to mailer-daemon' + }, + { + 'Value': 'postmaster', + 'Text': 'Send to postmaster' + } + ] + }, + 'Paragraph2': 'Address of internal mail server', + 'Input2': { + 'Type': 'Text', + 'Value': '', + 'Name': 'DelegateMailServer', + 'Label': 'DelegateMailServer' + }, + 'Paragraph3': 'Address of Internet providers mail server', + 'Input3': { + 'Type': 'Text', + 'Value': '', + 'Name': 'SMTPSmartHost', + 'Label': 'SMTPSmartHost' + }, + 'Paragraph4': 'SMTP Authentication for Internet providerDisabledEnabled', + 'Input4': { + 'Type': 'Select', + 'Value': '', + 'Name': 'SMTPAUTHPROXY_status', + 'Label': 'SMTPAUTHPROXY_status', + 'Options': [ + { + 'Value': 'disabled', + 'Text': 'Disabled' + }, + { + 'Value': 'enabled', + 'Text': 'Enabled' + } + ] + }, + 'Paragraph5': 'Mail server user id', + 'Input5': { + 'Type': 'Text', + 'Value': '', + 'Name': 'SMTPAUTHPROXY_Userid', + 'Label': 'SMTPAUTHPROXY_Userid' + }, + 'Paragraph6': 'Mail server password', + 'Input6': { + 'Type': 'Password', + 'Value': '', + 'Name': 'SMTPAUTHPROXY_Passwd', + 'Label': 'SMTPAUTHPROXY_Passwd' + }, + 'Input7': { + 'Type': 'Submit', + 'Value': 'Save', + 'Name': null, + 'Label': null + } + } + ] +} \ No newline at end of file diff --git a/json5/mai-FIL.json5 b/json5/mai-FIL.json5 new file mode 100644 index 0000000..b97e2f0 --- /dev/null +++ b/json5/mai-FIL.json5 @@ -0,0 +1,441 @@ +// +// Generated by sm1-html-2-json5 version:0.5 Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:35:55 +// +{ + 'PackageName': 'mai-FIL', + 'prefix': 'fil', + 'MenuHeading': 'Miscellaneous', + 'MenuDescription': 'mai- F I L', + 'MenuNavigation': '2000 400', + 'firstPanel': 'PARAMS', + 'signalEvent': 'smeserver-mai-fil-update', + 'html': [ + { + 'Name': 'params', + 'route': 'PARAMS', + 'Header': 'E-mail settings', + 'SubHeader': 'Manage mai-FIL settings:', + 'Paragraph1': 'Virus scanningDisabledEnabled', + 'Input1': { + 'Type': 'Select', + 'Value': '', + 'Name': 'VirusStatus', + 'Label': 'VirusStatus', + 'Options': [ + { + 'Value': 'disabled', + 'Text': 'Disabled' + }, + { + 'Value': 'enabled', + 'Text': 'Enabled' + } + ] + }, + 'Paragraph2': 'Spam filteringDisabledEnabled', + 'Input2': { + 'Type': 'Select', + 'Value': '', + 'Name': 'Spamstatus', + 'Label': 'Spamstatus', + 'Options': [ + { + 'Value': 'disabled', + 'Text': 'Disabled' + }, + { + 'Value': 'enabled', + 'Text': 'Enabled' + } + ] + }, + 'Paragraph3': 'Spam sensitivityVery lowLowMediumHighVery highCustom', + 'Input3': { + 'Type': 'Select', + 'Value': '', + 'Name': 'SpamSensitivity', + 'Label': 'SpamSensitivity', + 'Options': [ + { + 'Value': 'verylow', + 'Text': 'Very low' + }, + { + 'Value': 'low', + 'Text': 'Low' + }, + { + 'Value': 'medium', + 'Text': 'Medium' + }, + { + 'Value': 'high', + 'Text': 'High' + }, + { + 'Value': 'veryhigh', + 'Text': 'Very high' + }, + { + 'Value': 'custom', + 'Text': 'Custom' + } + ] + }, + 'Paragraph4': 'Custom spam tagging level01234567891011121314151617181920', + 'Input4': { + 'Type': 'Select', + 'Value': '', + 'Name': 'SpamTagLevel', + 'Label': 'SpamTagLevel', + 'Options': [ + { + 'Value': '0', + 'Text': '0' + }, + { + 'Value': '1', + 'Text': '1' + }, + { + 'Value': '2', + 'Text': '2' + }, + { + 'Value': '3', + 'Text': '3' + }, + { + 'Value': '4', + 'Text': '4' + }, + { + 'Value': '5', + 'Text': '5' + }, + { + 'Value': '6', + 'Text': '6' + }, + { + 'Value': '7', + 'Text': '7' + }, + { + 'Value': '8', + 'Text': '8' + }, + { + 'Value': '9', + 'Text': '9' + }, + { + 'Value': '10', + 'Text': '10' + }, + { + 'Value': '11', + 'Text': '11' + }, + { + 'Value': '12', + 'Text': '12' + }, + { + 'Value': '13', + 'Text': '13' + }, + { + 'Value': '14', + 'Text': '14' + }, + { + 'Value': '15', + 'Text': '15' + }, + { + 'Value': '16', + 'Text': '16' + }, + { + 'Value': '17', + 'Text': '17' + }, + { + 'Value': '18', + 'Text': '18' + }, + { + 'Value': '19', + 'Text': '19' + }, + { + 'Value': '20', + 'Text': '20' + } + ] + }, + 'Paragraph5': 'Custom spam rejection level01234567891011121314151617181920', + 'Input5': { + 'Type': 'Select', + 'Value': '', + 'Name': 'SpamRejectLevel', + 'Label': 'SpamRejectLevel', + 'Options': [ + { + 'Value': '0', + 'Text': '0' + }, + { + 'Value': '1', + 'Text': '1' + }, + { + 'Value': '2', + 'Text': '2' + }, + { + 'Value': '3', + 'Text': '3' + }, + { + 'Value': '4', + 'Text': '4' + }, + { + 'Value': '5', + 'Text': '5' + }, + { + 'Value': '6', + 'Text': '6' + }, + { + 'Value': '7', + 'Text': '7' + }, + { + 'Value': '8', + 'Text': '8' + }, + { + 'Value': '9', + 'Text': '9' + }, + { + 'Value': '10', + 'Text': '10' + }, + { + 'Value': '11', + 'Text': '11' + }, + { + 'Value': '12', + 'Text': '12' + }, + { + 'Value': '13', + 'Text': '13' + }, + { + 'Value': '14', + 'Text': '14' + }, + { + 'Value': '15', + 'Text': '15' + }, + { + 'Value': '16', + 'Text': '16' + }, + { + 'Value': '17', + 'Text': '17' + }, + { + 'Value': '18', + 'Text': '18' + }, + { + 'Value': '19', + 'Text': '19' + }, + { + 'Value': '20', + 'Text': '20' + } + ] + }, + 'Paragraph6': 'Sort spam into junkmail folderDisabledEnabled', + 'Input6': { + 'Type': 'Select', + 'Value': '', + 'Name': 'SpamSortSpam', + 'Label': 'SpamSortSpam', + 'Options': [ + { + 'Value': 'disabled', + 'Text': 'Disabled' + }, + { + 'Value': 'enabled', + 'Text': 'Enabled' + } + ] + }, + 'Paragraph7': 'Modify subject of spam messagesDisabledEnabled', + 'Input7': { + 'Type': 'Select', + 'Value': '', + 'Name': 'SpamSubjectTag', + 'Label': 'SpamSubjectTag', + 'Options': [ + { + 'Value': 'disabled', + 'Text': 'Disabled' + }, + { + 'Value': 'enabled', + 'Text': 'Enabled' + } + ] + }, + 'Paragraph8': 'SPAM subject prefix', + 'Input8': { + 'Type': 'Text', + 'Value': '[SPAM]', + 'Name': 'SpamSubject', + 'Label': 'SpamSubject' + }, + 'Paragraph9': 'Content to blockPIF file (AHhIYW5k)PIF file (AHhUYXgg)PIF file (AMkgICAg)PIF file (AMlIbDk5Lm)GIF file from old virusPC executables (TVoAAAAAA)PC executables (TVoAAAEAAA)PC executables (TVoAAAQAA)PC executables (TVoAACoAG)PC executables (TVoAAD8AA)PC executables (TVoFAQUAA)PC executables (TVoIARMAA)PC executables (TVouARsAA)PC executables (TVp1AQEAAAAE)PC executables (TVpAALQAc)PC executables (TVpLRVJOR)PC executables (TVpQAAIAA)PC executables (TVpyAXkAX)PC executables (TVqQAAMAA)PC executables (TVqgAAEAAAAFAAAA)PC executables (TVrQAT8AA)PC executables (TVrhARwAk)PC executables (TVrmAU4AA)Rar archive (UmFyIRoHA)Zip archive data, at least v1.0 to extractZip archive data, at least v2.0 to extractZip archive data, variant 3Zip archive data, created on OSX', + 'Input9': { + 'Type': 'Select', + 'Value': '', + 'Name': 'BlockExecutableContent', + 'Label': 'BlockExecutableContent', + 'Options': [ + { + 'Value': 'AHhIYW5k', + 'Text': 'PIF file (AHhIYW5k)' + }, + { + 'Value': 'AHhUYXgg', + 'Text': 'PIF file (AHhUYXgg)' + }, + { + 'Value': 'AMkgICAg', + 'Text': 'PIF file (AMkgICAg)' + }, + { + 'Value': 'AMlIbDk5Lm', + 'Text': 'PIF file (AMlIbDk5Lm)' + }, + { + 'Value': 'GIF01', + 'Text': 'GIF file from old virus' + }, + { + 'Value': 'TVoAAAAAA', + 'Text': 'PC executables (TVoAAAAAA)' + }, + { + 'Value': 'TVoAAAEAAA', + 'Text': 'PC executables (TVoAAAEAAA)' + }, + { + 'Value': 'TVoAAAQAA', + 'Text': 'PC executables (TVoAAAQAA)' + }, + { + 'Value': 'TVoAACoAG', + 'Text': 'PC executables (TVoAACoAG)' + }, + { + 'Value': 'TVoAAD8AA', + 'Text': 'PC executables (TVoAAD8AA)' + }, + { + 'Value': 'TVoFAQUAA', + 'Text': 'PC executables (TVoFAQUAA)' + }, + { + 'Value': 'TVoIARMAA', + 'Text': 'PC executables (TVoIARMAA)' + }, + { + 'Value': 'TVouARsAA', + 'Text': 'PC executables (TVouARsAA)' + }, + { + 'Value': 'TVp1AQEAAAAE', + 'Text': 'PC executables (TVp1AQEAAAAE)' + }, + { + 'Value': 'TVpAALQAc', + 'Text': 'PC executables (TVpAALQAc)' + }, + { + 'Value': 'TVpLRVJOR', + 'Text': 'PC executables (TVpLRVJOR)' + }, + { + 'Value': 'TVpQAAIAA', + 'Text': 'PC executables (TVpQAAIAA)' + }, + { + 'Value': 'TVpyAXkAX', + 'Text': 'PC executables (TVpyAXkAX)' + }, + { + 'Value': 'TVqQAAMAA', + 'Text': 'PC executables (TVqQAAMAA)' + }, + { + 'Value': 'TVqgAAEAAAAFAAAA', + 'Text': 'PC executables (TVqgAAEAAAAFAAAA)' + }, + { + 'Value': 'TVrQAT8AA', + 'Text': 'PC executables (TVrQAT8AA)' + }, + { + 'Value': 'TVrhARwAk', + 'Text': 'PC executables (TVrhARwAk)' + }, + { + 'Value': 'TVrmAU4AA', + 'Text': 'PC executables (TVrmAU4AA)' + }, + { + 'Value': 'UmFyIRoHA', + 'Text': 'Rar archive (UmFyIRoHA)' + }, + { + 'Value': 'ZIPV1', + 'Text': 'Zip archive data, at least v1.0 to extract' + }, + { + 'Value': 'ZIPV2', + 'Text': 'Zip archive data, at least v2.0 to extract' + }, + { + 'Value': 'ZIPV3', + 'Text': 'Zip archive data, variant 3' + }, + { + 'Value': 'ZIPVOSX', + 'Text': 'Zip archive data, created on OSX' + } + ] + }, + 'Input10': { + 'Type': 'Submit', + 'Value': 'Save', + 'Name': null, + 'Label': null + } + } + ] +} \ No newline at end of file diff --git a/json5/mai-FRONT.json5 b/json5/mai-FRONT.json5 new file mode 100644 index 0000000..e9fe99b --- /dev/null +++ b/json5/mai-FRONT.json5 @@ -0,0 +1,57 @@ +// +// Generated by sm1-html-2-json5 version:0.5 Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:35:42 +// +{ + 'PackageName': 'mai-FRONT', + 'prefix': 'front', + 'MenuHeading': 'Miscellaneous', + 'MenuDescription': 'mai- F R O N T', + 'MenuNavigation': '2000 400', + 'firstPanel': 'PARAMS', + 'signalEvent': 'smeserver-mai-front-update', + 'html': [ + { + 'Name': 'params', + 'route': 'PARAMS', + 'Header': 'E-mail settings', + 'SubHeader': 'Manage mai-FRONT settings:', + 'Paragraph1': 'POP3 server accessAllow access only from local networks', + 'Paragraph2': 'IMAP server accessAllow access only from local networks', + 'Paragraph3': 'Webmail accessAllow HTTPS (secure)', + 'Input1': { + 'Type': 'Submit', + 'Value': 'Modify', + 'Name': null, + 'Label': null + }, + 'Paragraph4': 'Virus scanningEnabled', + 'Paragraph5': 'Spam filteringDisabled', + 'Paragraph6': 'Executable content blockingDisabled', + 'Input2': { + 'Type': 'Submit', + 'Value': 'Modify', + 'Name': null, + 'Label': null + }, + 'Paragraph7': 'E-mail retrieval modestandard', + 'Paragraph8': 'SMTP port 25 allow client to authenticate:Only allow insecure access', + 'Paragraph9': 'SMTPS SSL/TLS auth: port 465 status:Allow public access', + 'Paragraph10': 'Submission port 587 status:Allow public access', + 'Input3': { + 'Type': 'Submit', + 'Value': 'Modify', + 'Name': null, + 'Label': null + }, + 'Paragraph11': 'E-mail to unknown usersReject', + 'Paragraph12': 'Address of internal mail server', + 'Paragraph13': 'Address of Internet providers mail server', + 'Input4': { + 'Type': 'Submit', + 'Value': 'Modify', + 'Name': null, + 'Label': null + } + } + ] +} \ No newline at end of file diff --git a/json5/mai-REC.json5 b/json5/mai-REC.json5 new file mode 100644 index 0000000..849b97d --- /dev/null +++ b/json5/mai-REC.json5 @@ -0,0 +1,254 @@ +// +// Generated by sm1-html-2-json5 version:0.5 Chameleon version:4.5.4 On Python:3.12.3 at 2025-06-29 08:36:01 +// +{ + 'PackageName': 'mai-REC', + 'prefix': 'rec', + 'MenuHeading': 'Miscellaneous', + 'MenuDescription': 'mai- R E C', + 'MenuNavigation': '2000 400', + 'firstPanel': 'PARAMS', + 'signalEvent': 'smeserver-mai-rec-update', + 'html': [ + { + 'Name': 'params', + 'route': 'PARAMS', + 'Header': 'E-mail settings', + 'SubHeader': 'ETRN or multi-drop settings', + 'Paragraph1': 'E-mail retrieval modeStandard (SMTP)ETRN (SMTP with client request)multi-drop', + 'Input1': { + 'Type': 'Select', + 'Value': '', + 'Name': 'FetchmailMethod', + 'Label': 'FetchmailMethod', + 'Options': [ + { + 'Value': 'standard', + 'Text': 'Standard (SMTP)' + }, + { + 'Value': 'etrn', + 'Text': 'ETRN (SMTP with client request)' + }, + { + 'Value': 'multidrop', + 'Text': 'multi-drop' + } + ] + }, + 'Paragraph2': 'SMTP port 25 allow client to authenticate:Allow SSMTP (secure)Only allow insecure accessDisabled', + 'Input2': { + 'Type': 'Select', + 'Value': '', + 'Name': 'SMTPAuth', + 'Label': 'SMTPAuth', + 'Options': [ + { + 'Value': 'publicSSL', + 'Text': 'Allow SSMTP (secure)' + }, + { + 'Value': 'public', + 'Text': 'Only allow insecure access' + }, + { + 'Value': 'disabled', + 'Text': 'Disabled' + } + ] + }, + 'Paragraph3': 'SMTPS SSL/TLS auth: port 465 status:Allow public accessAllow local access onlyDisabled', + 'Input3': { + 'Type': 'Select', + 'Value': '', + 'Name': 'sSMTPAuth', + 'Label': 'sSMTPAuth', + 'Options': [ + { + 'Value': 'public', + 'Text': 'Allow public access' + }, + { + 'Value': 'local', + 'Text': 'Allow local access only' + }, + { + 'Value': 'disabled', + 'Text': 'Disabled' + } + ] + }, + 'Paragraph4': 'Submission port 587 status:Allow public accessAllow local access onlyDisabled', + 'Input4': { + 'Type': 'Select', + 'Value': '', + 'Name': 'uSMTPAuth', + 'Label': 'uSMTPAuth', + 'Options': [ + { + 'Value': 'public', + 'Text': 'Allow public access' + }, + { + 'Value': 'local', + 'Text': 'Allow local access only' + }, + { + 'Value': 'disabled', + 'Text': 'Disabled' + } + ] + }, + 'Paragraph5': 'Secondary mail server', + 'Input5': { + 'Type': 'Text', + 'Value': 'mail.myisp.xxx', + 'Name': 'SecondaryMailServer', + 'Label': 'SecondaryMailServer' + }, + 'Paragraph6': 'During office hours (8:00 AM to 6:00 PM) on weekdaysnot at allEvery 5 minutesEvery 15 minutesEvery 30 minutesEvery hourEvery 2 hours', + 'Input6': { + 'Type': 'Select', + 'Value': '', + 'Name': 'FreqOffice', + 'Label': 'FreqOffice', + 'Options': [ + { + 'Value': 'never', + 'Text': 'not at all' + }, + { + 'Value': 'every5min', + 'Text': 'Every 5 minutes' + }, + { + 'Value': 'every15min', + 'Text': 'Every 15 minutes' + }, + { + 'Value': 'every30min', + 'Text': 'Every 30 minutes' + }, + { + 'Value': 'everyhour', + 'Text': 'Every hour' + }, + { + 'Value': 'every2hrs', + 'Text': 'Every 2 hours' + } + ] + }, + 'Paragraph7': 'Outside office hours (6:00 PM to 8:00 AM) on weekdaysnot at allEvery 5 minutesEvery 15 minutesEvery 30 minutesEvery hourEvery 2 hours', + 'Input7': { + 'Type': 'Select', + 'Value': '', + 'Name': 'FreqOutside', + 'Label': 'FreqOutside', + 'Options': [ + { + 'Value': 'never', + 'Text': 'not at all' + }, + { + 'Value': 'every5min', + 'Text': 'Every 5 minutes' + }, + { + 'Value': 'every15min', + 'Text': 'Every 15 minutes' + }, + { + 'Value': 'every30min', + 'Text': 'Every 30 minutes' + }, + { + 'Value': 'everyhour', + 'Text': 'Every hour' + }, + { + 'Value': 'every2hrs', + 'Text': 'Every 2 hours' + } + ] + }, + 'Paragraph8': 'During the weekendnot at allEvery 5 minutesEvery 15 minutesEvery 30 minutesEvery hourEvery 2 hours', + 'Input8': { + 'Type': 'Select', + 'Value': '', + 'Name': 'FreqWeekend', + 'Label': 'FreqWeekend', + 'Options': [ + { + 'Value': 'never', + 'Text': 'not at all' + }, + { + 'Value': 'every5min', + 'Text': 'Every 5 minutes' + }, + { + 'Value': 'every15min', + 'Text': 'Every 15 minutes' + }, + { + 'Value': 'every30min', + 'Text': 'Every 30 minutes' + }, + { + 'Value': 'everyhour', + 'Text': 'Every hour' + }, + { + 'Value': 'every2hrs', + 'Text': 'Every 2 hours' + } + ] + }, + 'Paragraph9': 'POP user account (for multi-drop)', + 'Input9': { + 'Type': 'Text', + 'Value': 'popaccount', + 'Name': 'SecondaryMailAccount', + 'Label': 'SecondaryMailAccount' + }, + 'Paragraph10': 'POP user password (for multi-drop)', + 'Input10': { + 'Type': 'Password', + 'Value': '', + 'Name': 'SecondaryMailPassword', + 'Label': 'SecondaryMailPassword' + }, + 'Paragraph11': 'Select sort method (for multi-drop)DefaultSpecify below', + 'Input11': { + 'Type': 'Select', + 'Value': '', + 'Name': 'SpecifyHeader', + 'Label': 'SpecifyHeader', + 'Options': [ + { + 'Value': 'off', + 'Text': 'Default' + }, + { + 'Value': 'on', + 'Text': 'Specify below' + } + ] + }, + 'Paragraph12': 'Select sort header (for multi-drop)', + 'Input12': { + 'Type': 'Text', + 'Value': '', + 'Name': 'SecondaryMailEnvelope', + 'Label': 'SecondaryMailEnvelope' + }, + 'Input13': { + 'Type': 'Submit', + 'Value': 'Save', + 'Name': null, + 'Label': null + } + } + ] +} \ No newline at end of file diff --git a/lex_scan_py_spec_for_llm b/lex_scan_py_spec_for_llm new file mode 100644 index 0000000..7a16440 --- /dev/null +++ b/lex_scan_py_spec_for_llm @@ -0,0 +1,58 @@ +I need a python program to scan for lexical strings in a set of files from a mojolicious application. +I use chevrons to enclose a meta symbol in the context of this spec. + +Initially establish a parameter -p (panel)for the name of the Mojolicious panel (call it ), no default, error if not supplied. +create second parameter -s (system) - call it , default "SME11" + +Establish logging.basicConfig. + +Check is capitalised and that /usr/share/smanager/lib/SrvMngr/Controller/.pm exists log error and exit otherwise. + +Scan the file /usr/share/smanager/lib/SrvMngr/Controller/.pm looking for my $title = $c->("") or my $title = $c->('') (ignore spaces). + will be of the form _. will be 2..4 alphas. Save and log the . log Error and exit if not found. + +Scanning: +/usr/share/smanager/lib/SrvMngr/Controller/.pm +/usr/share/smanager/themes//templates/lowercase().html.ep +/usr/share/smanager/themes//templates/partials/__.html.ep + +Extract all strings of _ into a structure and save filename(s) in which it was found (may be more than one) +Deduplicate it. + +Look in /usr/share/smanager/lib/SrvMngr/I128N//lowercase()_en.lex for each of the _ found earlier and create a new file /usr/share/smanager/lib/SrvMngr/I128N//lowercase()_en.lex.new of the corresponding lines from the .lex file that match. + +For all _ ones not found in the .lex file write them into the .new in the format '_' => ' with underlines mapped to spaces', + +Log the number of lines in the .new file versus number of lines in the .lex file. + +Read in from a JSON file (*Templates/languages.json) a list of country codes - example - {"language": "Bulgarian", "code": "bg"} + +Scan /usr/share/smanager/lib/SrvMngr/I128N//lowercase()_ for all the _ retained from above, creating the .new file from the ones found, and creating new lines: +'_' => '', where is taken from the _en.lex.new file. + +As each language is done, log the number of lines in the .new file versus number of lines in the .lex file. + +Rescan all +/usr/share/smanager/lib/SrvMngr/Controller/.pm +/usr/share/smanager/themes//templates/lowercase().html.ep +/usr/share/smanager/themes//templates/partials/__.html.ep + using the regex string pattern = r"l[\s|(][\'|\"](.*)[\'|\"]\)". +For each one found: + if it has _ in front then discard it + Otherwise look in /usr/share/smanager/lib/SrvMngr/I128N/general/general_en.lex + and if found it copy line from .lex across to /usr/share/smanager/lib/SrvMngr/I128N/general/general_en.lex.new (which may already exist) + otherwise create a line in .new as follows: '' =>' with underline mapped to space.', +When finished, log line counts for the general .lex and .new file. + +As before, Scan /usr/share/smanager/lib/SrvMngr/I128N/general/general_ for all the _, creating the .new file from the ones found in the retained ones above, and creating new lines: +'_' => '', where is taken from the _en.lex.new file. + +As each language is done, log the number of lines in the .new file versus number of lines in the .lex file. + +Scan the lex strings found structure, looking for ones with _. scan the general lex file (new one) for the , and if not found, drop it in: +'' => '', and scan the general other language files for it, creating it if necessary. +edit the original file(s) in which that lexical string was found to map _ to + +Log the number of lines per languge per general .lex and .new file. + +