Add in SM2 panel - wip and re-work IMAP-UTF7 conversion

This commit is contained in:
2025-05-05 20:55:02 +01:00
parent c2d210c7d2
commit c3a2201fae
12 changed files with 1209 additions and 16 deletions

View File

@@ -0,0 +1,39 @@
/*
Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-04 12:59:05
*/
.Mailsorting-panel {}
.name {}
.rout {}
.head {}
.para1 {}
.text97 {}
.text96 {}
.link1 {}
.subh {}
.tabl1 {}
thead .tabl1 {}
tbody .tabl1 {}
.name {}
.rout {}
.head {}
.subh {}
.para1 {}
.para2 {}
.sele1 {}
.text2 {}
.sele3 {}
.text4 {}
.sele5 {}
.text6 {}
.sele7 {}
.sele8 {}
.sele9 {}
.text10 {}
.text11 {}
.subm12 {}
.name {}
.rout {}
.head {}
.subh {}
.text94 {}
.subm95 {}

View File

@@ -0,0 +1,5 @@
//
//Generated by: SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-04 12:59:05
//
$(document).ready(function() {
});

View File

@@ -0,0 +1,64 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-04 12:59:05
%#
% layout 'default', title => "Sme server 2 - Process Mail", share_dir => './';
%# css specific to this panel:
% content_for 'module' => begin
%= stylesheet '/css/mailsorting.css'
%= javascript '/js/mailsorting.js'
<div id="module" class="module Mailsorting-panel">
% if (config->{debug} == 1) {
<pre>
%= dumper $c->current_route
%= dumper $ms_data->{trt}
</pre>
% }
<h1><%=$title%></h1>
% if ( stash('modul')) {
%= $c->render_to_string(inline => stash('modul') );
% }
%if ($c->stash('first')) {
<br><p>
%=$c->render_to_string(inline =>$c->l($c->stash('first')))
</p>
%} elsif ($c->stash('success')) {
<div class='success '>
<p>
%= $c->l($c->stash('success'));
</p>
</div>
<br />
%} elsif ($c->stash('error')) {
<div class='sme-error'>
<p>
%= $c->l($c->stash('error'));
</p>
</div>
<br />
%}
%#Routing to partials according to trt parameter.
%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
% if ($ms_data->{trt} eq "TABLE") {
%= include 'partials/_ms_TABLE'
%}
% if ($ms_data->{trt} eq "RULES") {
%= include 'partials/_ms_RULES'
%}
% if ($ms_data->{trt} eq "REMOVE") {
%= include 'partials/_ms_REMOVE'
%}
</div>
%end

View File

@@ -0,0 +1,38 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-04 12:59:05
%#
<div id="Mailsorting-REMOVE" class="partial Mailsorting-REMOVE">
<script>
window.onload = function() {
SelectInput();
};
</script>
% if (config->{debug} == 1) {
<pre>
%= dumper $ms_data
</pre>
% }
% my $btn = l('ms_APPLY');
%= form_for "mailsortingu" => (method => 'POST') => begin
% param 'trt' => $ms_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $ms_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('ms_Mail_sorting_rules')%></h1>
<h2 class='subh'><%=l('ms_You_are_about_to_remove')%></h2>
<span class=label>
%=l('ms_Rule_contents')
</span><span class=data>
% param 'RemoveRule' => $ms_data->{RemoveRule} unless param 'RemoveRule';
%= text_area 'RemoveRule', cols=>40, rows=>10, Readonly=>'true','
</span><br>
<span class='data'>
%= submit_button l('ms_Remove'), class => 'action subm95'
</span>
%# Probably finally by a submit.
%end
</div>

View File

@@ -0,0 +1,122 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-04 12:59:05
%#
<div id="Mailsorting-RULES" class="partial Mailsorting-RULES">
<script>
window.onload = function() {
SelectInput();
};
</script>
% if (config->{debug} == 1) {
<pre>
%= dumper $ms_data
</pre>
% }
% my $btn = l('ms_APPLY');
%= form_for "mailsortingu" => (method => 'POST') => begin
% param 'trt' => $ms_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $ms_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('ms_Mail_sorting_rules')%></h1>
<h2 class='subh'><%=l('ms_Manage_mailsortingModifyRule_settings:')%></h2>
<p class='paragraph para1'>
%=l('ms_Modify_your_rule.')
</p>
<p class='paragraph para2'>
%=l('ms_You_can_change_the_order')
</p>
<p><span class=label>
%=l('ms_basis')
</span><span class=data>
% my @basis_options = [['Subject' => 'Subject'], ['To' => 'TO_'], ['From' => 'From'], ['Email Headers' => 'headers'], ['Size greater than' => 'sizegt'], ['Size less than' => 'sizelt']];
% param 'basis' => $ms_data->{basis} unless param 'basis';
%= select_field 'basis' => @basis_options, class => 'input', id => 'basis_select'
<br></span> </p>
<p><span class=label>
%=l('ms_criterion')
</span><span class=data>
% param 'criterion' => $ms_data->{criterion} unless param 'criterion';
%= text_field 'criterion', size => '50', class => 'textinput criterion' , pattern=>'.*' , placeholder=>'criterion', title =>'Pattern regex mismatch', id => 'criterion_text'
<br></span></p>
<p><span class=label>
%=l('ms_basis2')
</span><span class=data>
% my @basis2_options = [['' => ''], ['Subject' => 'Subject'], ['To' => 'TO_'], ['From' => 'From'], ['Email Headers' => 'headers']];
% param 'basis2' => $ms_data->{basis2} unless param 'basis2';
%= select_field 'basis2' => @basis2_options, class => 'input', id => 'basis2_select'
<br></span> </p>
<p><span class=label>
%=l('ms_criterion2')
</span><span class=data>
% param 'criterion2' => $ms_data->{criterion2} unless param 'criterion2';
%= text_field 'criterion2', size => '50', class => 'textinput criterion2' , pattern=>'.*' , placeholder=>'criterion2', title =>'Pattern regex mismatch', id => 'criterion2_text'
<br></span></p>
<p><span class=label>
%=l('ms_action')
</span><span class=data>
% my @action_options = [['Delete email' => 'delete'], ['Forward email' => 'forward'], ['Sort to mail folder' => 'sort']];
% param 'action' => $ms_data->{action} unless param 'action';
%= select_field 'action' => @action_options, class => 'input', id => 'action_select'
<br></span> </p>
<p><span class=label>
%=l('ms_deliver')
</span><span class=data>
% param 'deliver' => $ms_data->{deliver} unless param 'deliver';
%= text_field 'deliver', size => '50', class => 'textinput deliver' , pattern=>'.*' , placeholder=>'deliver', title =>'Pattern regex mismatch', id => 'deliver_text'
<br></span></p>
<p><span class=label>
%=l('ms_folder')
</span><span class=data>
% my @folder_options = $c->get_Folders();
% param 'folder' => $ms_data->{folder} unless param 'folder';
%= select_field 'folder' => @folder_options, class => 'input', id => 'folder_select'
<br></span> </p>
<p><span class=label>
%=l('ms_copy')
</span><span class=data>
% my @copy_options = [['No' => 'no'], ['Yes' => 'yes']];
% param 'copy' => $ms_data->{copy} unless param 'copy';
%= select_field 'copy' => @copy_options, class => 'input', id => 'copy_select'
<br></span> </p>
<p><span class=label>
%=l('ms_action2')
</span><span class=data>
% my @action2_options = [['' => ''], ['Delete email' => 'delete'], ['Forward email' => 'forward'], ['Send to my inbox' => 'inbox']];
% param 'action2' => $ms_data->{action2} unless param 'action2';
%= select_field 'action2' => @action2_options, class => 'input', id => 'action2_select'
<br></span> </p>
<p><span class=label>
%=l('ms_deliver2')
</span><span class=data>
% param 'deliver2' => $ms_data->{deliver2} unless param 'deliver2';
%= text_field 'deliver2', size => '50', class => 'textinput deliver2' , pattern=>'.*' , placeholder=>'deliver2', title =>'Pattern regex mismatch', id => 'deliver2_text'
<br></span></p>
<p><span class=label>
%=l('ms_key')
</span><span class=data>
% param 'key' => $ms_data->{key} unless param 'key';
%= text_field 'key', size => '50', class => 'textinput key' , pattern=>'.*' , placeholder=>'key', title =>'Pattern regex mismatch', id => 'key_text'
<br></span></p>
<span class='data'>
%= submit_button l('ms_Save'), class => 'action subm12'
</span>
%# Probably finally by a submit.
%end
</div>

View File

@@ -0,0 +1,88 @@
%#
%# Generated by SM2Gen version:0.9(20Jan2025) Chameleon version:4.5.4 On Python:3.12.3 at 2025-05-04 12:59:05
%#
<div id="Mailsorting-TABLE" class="partial Mailsorting-TABLE">
<script>
window.onload = function() {
SelectInput();
};
</script>
% if (config->{debug} == 1) {
<pre>
%= dumper $ms_data
</pre>
% }
% my $btn = l('ms_APPLY');
%= form_for "mailsortingu" => (method => 'POST') => begin
% param 'trt' => $ms_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $ms_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('ms_Mail_sorting_rules')%></h1>
<p class='paragraph para1'>
%=l('ms_Rules_are_executed_as_email')
</p>
<p><span class=label>
%=l('ms_Account')
</span><span class=data>
% param 'account' => $ms_data->{account} unless param 'account';
%= text_field 'account', size => '50', class => 'textinput account' , pattern=>'.*' , placeholder=>'account', title =>'Pattern regex mismatch', id => 'account_text'
<br></span></p>
<p><span class=label>
%=l('ms_User_Name')
</span><span class=data>
% param 'username' => $ms_data->{username} unless param 'username';
%= text_field 'username', size => '50', class => 'textinput username' , pattern=>'.*' , placeholder=>'username', title =>'Pattern regex mismatch', id => 'username_text'
<br></span></p>
<a href='mailsortingdd?trt=RULES' class='link link1'>
%= l('ms_Add_new_rule')
</a>
%#= link_to l('ms_Add_new_rule'), 'mailsortingdd?trt=RULES' , class=>'link link1'
<h2 class='subh'><%=l('ms_Current_rules')%></h2>
<br /><table class="sme-border TableSort sme-table tabl1 ">
<thead class='tabl1'>
<tr table-head-row>
<th class='sme-border table-head-col table-head-col-Match Against '><%=l('ms_Match_Against')%></th>
<th class='sme-border table-head-col table-head-col-The Rule '><%=l('ms_The_Rule')%></th>
<th class='sme-border table-head-col table-head-col-2nd Match '><%=l('ms_2nd_Match')%></th>
<th class='sme-border table-head-col table-head-col-2nd Rule '><%=l('ms_2nd_Rule')%></th>
<th class='sme-border table-head-col table-head-col-Action '><%=l('ms_Action')%></th>
<th class='sme-border table-head-col table-head-col-Destination '><%=l('ms_Destination')%></th>
<th class='sme-border table-head-col table-head-col-Copy '><%=l('ms_Copy')%></th>
<th class='sme-border table-head-col table-head-col-Destination '><%=l('ms_Destination')%></th>
<th class='sme-border table-head-col table-head-col-Serial Number '><%=l('ms_Serial_Number')%></th>
<th class='sme-border table-head-col table-head-col-Modify '><%=l('ms_Modify')%></th>
<th class='sme-border table-head-col table-head-col-Remove '><%=l('ms_Remove')%></th>
</tr>
</thead>
<tbody class='tabl1'>
% my $control_data = $c->stash('getAllRules');
% foreach my $row (@$control_data) {
<tr class='table-row'>
<td class='sme-border table-col table-col-MatchAgainst'><%=$c->render_to_string(inline=>$row->{'MatchAgainst'})%></td>
<td class='sme-border table-col table-col-TheRule'><%=$c->render_to_string(inline=>$row->{'TheRule'})%></td>
<td class='sme-border table-col table-col-c2ndMatch'><%=$c->render_to_string(inline=>$row->{'c2ndMatch'})%></td>
<td class='sme-border table-col table-col-c2ndRule'><%=$c->render_to_string(inline=>$row->{'c2ndRule'})%></td>
<td class='sme-border table-col table-col-Action'><%=$c->render_to_string(inline=>$row->{'Action'})%></td>
<td class='sme-border table-col table-col-Destination'><%=$c->render_to_string(inline=>$row->{'Destination'})%></td>
<td class='sme-border table-col table-col-Copy'><%=$c->render_to_string(inline=>$row->{'Copy'})%></td>
<td class='sme-border table-col table-col-Destination'><%=$c->render_to_string(inline=>$row->{'Destination2'})%></td>
<td class='sme-border table-col table-col-Serial Number'><%=$c->render_to_string(inline=>$row->{'Serial Number'})%></td>
<td class='sme-border table-col table-col-Modify'><%=$c->render_to_string(inline=>$row->{'Modify'})%></td>
<td class='sme-border table-col table-col-Remove'><%=$c->render_to_string(inline=>$row->{'Remove'})%></td>
</tr>
%}
</tbody>
</table>
%# Probably finally by a submit.
%end
</div>