1 |
--- smeserver-mailsorting-1.2/root/etc/e-smith/web/functions/userpanel-mailsort.removedropdown 2009-02-22 00:24:56.000000000 +1100 |
2 |
+++ smeserver-mailsorting-1.2/root/etc/e-smith/web/functions/userpanel-mailsort 2009-02-22 00:29:05.000000000 +1100 |
3 |
@@ -123,14 +123,6 @@ |
4 |
|
5 |
<field |
6 |
type="select" |
7 |
- id="mbox" |
8 |
- options="get_mbox()" |
9 |
- value=""> |
10 |
- <label>MAIL_FOLDER</label> |
11 |
- </field> |
12 |
- |
13 |
- <field |
14 |
- type="select" |
15 |
id="copy" |
16 |
options="'no' => 'NO', |
17 |
'yes' => 'YES'," |
18 |
@@ -154,15 +146,7 @@ |
19 |
id="deliver2" |
20 |
value="" |
21 |
validation="nonblankWithForward2()"> |
22 |
- <label>2ND_DELIVER</label> |
23 |
- </field> |
24 |
- |
25 |
- <field |
26 |
- type="select" |
27 |
- id="mbox2" |
28 |
- options="get_mbox2()" |
29 |
- value=""> |
30 |
- <label>MAIL_FOLDER</label> |
31 |
+ <label>DELIVER</label> |
32 |
</field> |
33 |
|
34 |
<subroutine src="priority" /> |
35 |
--- smeserver-mailsorting-1.2/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/userpanel-mailsort.removedropdown 2009-02-22 00:23:58.000000000 +1100 |
36 |
+++ smeserver-mailsorting-1.2/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/userpanel-mailsort 2009-02-22 00:39:23.000000000 +1100 |
37 |
@@ -78,11 +78,7 @@ |
38 |
</entry> |
39 |
<entry> |
40 |
<base>DELIVER</base> |
41 |
- <trans>Forwarding email address</trans> |
42 |
- </entry> |
43 |
- <entry> |
44 |
- <base>2ND_DELIVER</base> |
45 |
- <trans>2nd Forwarding address</trans> |
46 |
+ <trans>Folder or email address</trans> |
47 |
</entry> |
48 |
<entry> |
49 |
<base>COPY_TO</base> |
50 |
@@ -113,10 +109,6 @@ |
51 |
<trans>Send to my inbox</trans> |
52 |
</entry> |
53 |
<entry> |
54 |
- <base>MAIL_FOLDER</base> |
55 |
- <trans>Existing mail folders</trans> |
56 |
- </entry> |
57 |
- <entry> |
58 |
<base>PRIORITY</base> |
59 |
<trans>Order of rule execution</trans> |
60 |
</entry> |
61 |
@@ -146,11 +138,7 @@ |
62 |
</entry> |
63 |
<entry> |
64 |
<base>ERROR_FORWARD_NO_EMAIL</base> |
65 |
- <trans>Error: You attempted to forward but failed to enter an email address</trans> |
66 |
- </entry> |
67 |
- <entry> |
68 |
- <base>ERROR_2ND_FORWARD_NO_EMAIL</base> |
69 |
- <trans>Error: You attempted to forward but failed to enter an email address for your copy</trans> |
70 |
+ <trans>Error: Requires a folder to sort to or email address to forward to</trans> |
71 |
</entry> |
72 |
<entry> |
73 |
<base>NO_RULES</base> |
74 |
--- smeserver-mailsorting-1.2/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/mailsort.pm.removedropdown 2009-02-22 00:30:25.000000000 +1100 |
75 |
+++ smeserver-mailsorting-1.2/root/usr/lib/perl5/site_perl/esmith/FormMagick/Panel/mailsort.pm 2009-02-22 01:03:46.000000000 +1100 |
76 |
@@ -64,7 +64,7 @@ |
77 |
|
78 |
stripe => "#D4D0C8", |
79 |
|
80 |
- fields => [ qw(b1 criterion b2 criterion2 deliver copy copyto Modify Remove) ], |
81 |
+ fields => [ qw(b1 criterion b2 criterion2 deliver copy deliver2 Modify Remove) ], |
82 |
|
83 |
labels => 1, |
84 |
|
85 |
@@ -81,7 +81,7 @@ |
86 |
|
87 |
copy => { label => $self->localise("COPY") }, |
88 |
|
89 |
- copyto => { label => $self->localise("COPY_TO") }, |
90 |
+ deliver2 => { label => $self->localise("DESTINATION") }, |
91 |
|
92 |
Modify => { |
93 |
label => $self->localise("MODIFY"), |
94 |
@@ -137,8 +137,6 @@ |
95 |
basis2 => $basis2, |
96 |
criterion => $rule->prop("criterion") || '', |
97 |
criterion2 => $rule->prop("criterion2") || '', |
98 |
- mbox => $rule->prop("mbox") || '', |
99 |
- mbox2 => $rule->prop("mbox2") || '', |
100 |
deliver => $deliver, |
101 |
deliver2 => $deliver2, |
102 |
action => $action, |
103 |
@@ -242,10 +240,9 @@ |
104 |
"criterion2=" . $row->{criterion2}, |
105 |
"deliver=" . $row->{deliver}, |
106 |
"deliver2=" . $row->{deliver2}, |
107 |
- "mbox=" . $row->{mbox}, |
108 |
- "mbox2=" . $row->{mbox2}, |
109 |
"action=" . $row->{action}, |
110 |
"action2=" . $row->{action2}, |
111 |
+ "copy=" . $row->{copy}, |
112 |
"wherenext=RULE_MODIFY"); |
113 |
} |
114 |
|
115 |
@@ -301,8 +298,6 @@ |
116 |
my $deliver = $q->param ('deliver') || ''; |
117 |
my $deliver2 = $q->param ('deliver2') || ''; |
118 |
my $copy = $q->param ('copy') || ''; |
119 |
- my $mbox = $q->param ('mbox') || ''; |
120 |
- my $mbox2 = $q->param ('mbox2') || ''; |
121 |
my $oldkey = $q->param ('oldkey') || ''; |
122 |
|
123 |
if ($basis eq 'sizelt') { $basis = '<'; } |
124 |
@@ -310,8 +305,6 @@ |
125 |
if ($basis2 eq 'sizelt') { $basis2 = '<'; } |
126 |
if ($basis2 eq 'sizegt') { $basis2 = '>'; } |
127 |
|
128 |
- if ($action eq 'sort') { $deliver = $mbox; } |
129 |
- if ($action2 eq 'sort') { $deliver2 = $mbox2; } |
130 |
if ($copy eq 'no') { $deliver2 = ''; $action2 = ''; } |
131 |
|
132 |
# keys are different but rule at least has part of users name so is likely changed |
133 |
@@ -323,65 +316,15 @@ |
134 |
$rec->delete; |
135 |
} |
136 |
|
137 |
- foreach ("criterion","criterion2","action","copy","mbox","mbox2" ) |
138 |
+ foreach ("criterion","criterion2","action","action2","copy","basis","basis2","deliver","deliver2" ) |
139 |
{ $pdb->set_prop($rule, "$_", $q->param("$_")); } |
140 |
|
141 |
- $pdb->set_prop($rule, 'basis', $basis); |
142 |
- $pdb->set_prop($rule, 'basis2', $basis2); |
143 |
- $pdb->set_prop($rule, 'deliver', $deliver); |
144 |
- $pdb->set_prop($rule, 'deliver2', $deliver2); |
145 |
- $pdb->set_prop($rule, 'action2', $action2); |
146 |
- |
147 |
unless ( system ("/sbin/e-smith/signal-event mailsorting-conf $PanelUser") == 0 ) |
148 |
{ return $self->error('ERROR_UPDATING'); } |
149 |
|
150 |
return $self->success("SUCCESS"); |
151 |
} |
152 |
|
153 |
-our %dirs = (); |
154 |
- |
155 |
-sub get_mbox2 |
156 |
-{ |
157 |
- return \%dirs; |
158 |
-} |
159 |
- |
160 |
-sub get_mbox |
161 |
-{ |
162 |
- my $self = shift; |
163 |
- my $q = $self->{cgi}; |
164 |
- use File::Find; |
165 |
- |
166 |
- sub finddirs |
167 |
- { |
168 |
- my $path = $File::Find::name; |
169 |
- my $strip = "/home/e-smith/files/users/$PanelUser/Maildir"; |
170 |
- |
171 |
- if (-d) |
172 |
- { |
173 |
- # Remove leading path |
174 |
- $path =~ s:^$strip/\.::; |
175 |
- $path =~ s:^$strip::; |
176 |
- |
177 |
- # don't bother to collect Maildir folders, or sent/drafts/trash |
178 |
- foreach (qw( cur tmp new )) |
179 |
- { |
180 |
- return if $path =~ /\/$_\b/; |
181 |
- } |
182 |
- |
183 |
- return if $path =~ "\(Junk|INBOX|INBOX.Sent|INBOX.Trash|INBOX.Drafts)\$"; |
184 |
- return if $path =~ "\(Sent|Trash|sent-mail|Sent Items|Drafts|drafts)\$"; |
185 |
- |
186 |
- $path = GetDisplayName($path); |
187 |
- $dirs{$path} = $path; |
188 |
- } |
189 |
- } |
190 |
- |
191 |
- # find all the Maildirs |
192 |
- find({wanted => \&finddirs, no_chdir => 1}, "/home/e-smith/files/users/$PanelUser/Maildir" ); |
193 |
- |
194 |
- return \%dirs; |
195 |
-} |
196 |
- |
197 |
sub GetDisplayName ($) |
198 |
{ |
199 |
my $s = shift; |
200 |
@@ -399,7 +342,7 @@ |
201 |
my $action = $q->param ('action') || ''; |
202 |
my $deliver = $q->param ('deliver') || ''; |
203 |
|
204 |
- if ( $action eq 'forward') |
205 |
+ if ( $action ne 'delete') |
206 |
{ |
207 |
if (not $deliver) |
208 |
{ return "ERROR_FORWARD_NO_EMAIL"; } |
209 |
@@ -420,12 +363,12 @@ |
210 |
my $action = $q->param ('action2') || ''; |
211 |
my $deliver = $q->param ('deliver2') || ''; |
212 |
|
213 |
- if (( $action eq 'forward') && ( $copy eq 'yes')) |
214 |
+ if (( $action ne 'delete') && ( $copy eq 'yes')) |
215 |
{ |
216 |
if (not $deliver) |
217 |
- { return "ERROR_2ND_FORWARD_NO_EMAIL"; } |
218 |
+ { return "ERROR_FORWARD_NO_EMAIL"; } |
219 |
elsif ( $deliver =~ /^\s+$/ ) |
220 |
- { return "ERROR_2ND_FORWARD_NO_EMAIL"; } |
221 |
+ { return "ERROR_FORWARD_NO_EMAIL"; } |
222 |
else |
223 |
{ return "OK"; } |
224 |
} |