1 |
brianr |
1.1 |
diff -urN smeserver-vacation-1.1.old/root/etc/cron.d/vacation smeserver-vacation-1.1/root/etc/cron.d/vacation |
2 |
|
|
--- smeserver-vacation-1.1.old/root/etc/cron.d/vacation 1970-01-01 01:00:00.000000000 +0100 |
3 |
|
|
+++ smeserver-vacation-1.1/root/etc/cron.d/vacation 2015-09-04 21:50:28.364085037 +0200 |
4 |
|
|
@@ -0,0 +1,6 @@ |
5 |
|
|
+# Check each user account if a vacation message should be enabled |
6 |
|
|
+# or disabled based on the given From/To vacation dates |
7 |
|
|
+# Do it shortly after midnight on every day |
8 |
|
|
+SHELL=/bin/sh |
9 |
|
|
+PATH=/sbin/e-smith:/sbin:/bin:/usr/sbin:/usr/bin |
10 |
|
|
+5 0 * * * root /sbin/e-smith/vacation/check_vacation_dates.sh |
11 |
|
|
diff -urN smeserver-vacation-1.1.old/root/etc/e-smith/locale/de/etc/e-smith/web/functions/uservacations smeserver-vacation-1.1/root/etc/e-smith/locale/de/etc/e-smith/web/functions/uservacations |
12 |
|
|
--- smeserver-vacation-1.1.old/root/etc/e-smith/locale/de/etc/e-smith/web/functions/uservacations 2015-09-04 10:53:45.506912186 +0200 |
13 |
|
|
+++ smeserver-vacation-1.1/root/etc/e-smith/locale/de/etc/e-smith/web/functions/uservacations 2015-09-04 20:05:53.405096692 +0200 |
14 |
|
|
@@ -21,7 +21,39 @@ |
15 |
|
|
</entry> |
16 |
|
|
<entry> |
17 |
|
|
<base>MODIFY_DESCRIPTION</base> |
18 |
|
|
- <trans><![CDATA[ <p> Enter a vacation message here. You can use "$SUBJECT" anywhere in the text to be replaced with the subject line from the email that activated the auto-reply. </p> <p> This message must be composed of two parts separated by a blank line. The first will be integrated into the headings of the email reply, you must thus ensure you leave at least a blank line before typing your message. </p> <p> The primary domain is added to the address automatically, or you can insert a virtual domain. To change the vacation message back to the default type "reset". </p> ]]></trans> |
19 |
|
|
+ <trans><![CDATA[ |
20 |
|
|
+ <p> |
21 |
|
|
+ Geben Sie hier eine Abwesenheitsnachricht an. Sie können die Variable "$SUBJECT" an beliebiger Stelle im Nachrichtentext einfügen. An dieser Stelle wird in der generierten Abwsenheitsnachricht der Betreff derjenigen empfangenen Nachricht erscheinen, welche die automatische Abwesenheitsnachricht ausgelöst hat. |
22 |
|
|
+ </p> |
23 |
|
|
+ <p> |
24 |
|
|
+ Der Text der Abwesenheitsnachricht sollte aus zwei Teilen bestehen, die voneinander durch eine Leerzeile getrennt sind. |
25 |
|
|
+ Der obere Teil wird in den Header der generierten Abwesenheitsnachricht eingefügt. |
26 |
|
|
+ Vor dem eigentlichen Inhalt der Abwesenheitsnachricht muss also auf jeden Fall eine Leerzeile stehen. |
27 |
|
|
+ </p> |
28 |
|
|
+ <p> |
29 |
|
|
+ Die primäre Domain wird der Absenderadresse automatisch hinzugefügt. Sie können aber im "From:"-Header auch eine virtuelle Domäne verwenden. |
30 |
|
|
+ Um die Abwesenheitsnachricht auf den Standardtext zurückzusetzen geben Sie bitte "reset" ein. |
31 |
|
|
+ </p> |
32 |
|
|
+ <p> |
33 |
|
|
+ Sie können zusätzlich die entsprechenden Felder ausfüllen, um das Versenden der Abwesenheitsnachricht |
34 |
|
|
+ für diesen Benutzer-Account zum jeweiligen Datum automatisch zu aktivieren und zu deaktivieren. |
35 |
|
|
+ </p> |
36 |
|
|
+ <p> |
37 |
|
|
+ Bitte verwenden Sie dafür das Format JJJJMMTT (vierstellige Jahreszahl, zweistellige Monatszahl, zweistellige Tageszahl) |
38 |
|
|
+ und beachten Sie, dass die Sie in die beiden Felder nicht das gleiche Datum eintragen dürfen. |
39 |
|
|
+ </p> |
40 |
|
|
+ <p> |
41 |
|
|
+ Wenn Sie diese Funktionalität verwenden möchten dann belassen Sie den Eintrag "Abwesenheitsnotiz aktivieren" auf "Nein"; die Aktivierung erfolgt dann automatisch am gewünschten Datum. |
42 |
|
|
+ </p> |
43 |
|
|
+ ]]></trans> |
44 |
|
|
+ </entry> |
45 |
|
|
+ <entry> |
46 |
|
|
+ <base>VACATION_FROM</base> |
47 |
|
|
+ <trans>Abwesenheitsnotiz aktivieren am (JJJJMMTT)</trans> |
48 |
|
|
+ </entry> |
49 |
|
|
+ <entry> |
50 |
|
|
+ <base>VACATION_TO</base> |
51 |
|
|
+ <trans>Abwesenheitsnotiz deaktivieren am (JJJJMMTT)</trans> |
52 |
|
|
</entry> |
53 |
|
|
<entry> |
54 |
|
|
<base>MESSAGE</base> |
55 |
|
|
@@ -29,7 +61,7 @@ |
56 |
|
|
</entry> |
57 |
|
|
<entry> |
58 |
|
|
<base>VACATION_STATUS</base> |
59 |
|
|
- <trans>Abwesenheitsnotiz aktivieren</trans> |
60 |
|
|
+ <trans>Abwesenheitsnotiz aktiviert</trans> |
61 |
|
|
</entry> |
62 |
|
|
<entry> |
63 |
|
|
<base>FROM</base> |
64 |
|
|
diff -urN smeserver-vacation-1.1.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/uservacations smeserver-vacation-1.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/uservacations |
65 |
|
|
--- smeserver-vacation-1.1.old/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/uservacations 2015-09-04 10:53:45.507912125 +0200 |
66 |
|
|
+++ smeserver-vacation-1.1/root/etc/e-smith/locale/en-us/etc/e-smith/web/functions/uservacations 2015-09-04 19:35:46.599092069 +0200 |
67 |
|
|
@@ -42,10 +42,28 @@ |
68 |
|
|
"From: user@primary.domain" with "From: user@virtual.domain"). |
69 |
|
|
To change the vacation message back to the default type "reset". |
70 |
|
|
</p> |
71 |
|
|
+ <p> |
72 |
|
|
+ You can also fill out the "Enable vacation on" and "Disable vacation on" fields in order to |
73 |
|
|
+ automatically enable and disable sending of the vacation message for this user account on the given dates. |
74 |
|
|
+ </p> |
75 |
|
|
+ <p> |
76 |
|
|
+ The format used is YYYYMMDD (four digit year, two digit month, two digit day) |
77 |
|
|
+ and the dates in the two fields must not be the same. |
78 |
|
|
+ If you want to use this functionality, leave the "Enable vacation messages" setting at "No" - it will be automatically activated based on the date given. |
79 |
|
|
+ </p> |
80 |
|
|
+ </p> |
81 |
|
|
]]> |
82 |
|
|
</trans> |
83 |
|
|
</entry> |
84 |
|
|
<entry> |
85 |
|
|
+ <base>VACATION_FROM</base> |
86 |
|
|
+ <trans>Enable vacation on (YYYYMMDD)</trans> |
87 |
|
|
+ </entry> |
88 |
|
|
+ <entry> |
89 |
|
|
+ <base>VACATION_TO</base> |
90 |
|
|
+ <trans>Disable vacation on (YYYYMMDD)</trans> |
91 |
|
|
+ </entry> |
92 |
|
|
+ <entry> |
93 |
|
|
<base>MESSAGE</base> |
94 |
|
|
<trans>Vacation message</trans> |
95 |
|
|
</entry> |
96 |
|
|
diff -urN smeserver-vacation-1.1.old/root/etc/e-smith/web/functions/uservacations smeserver-vacation-1.1/root/etc/e-smith/web/functions/uservacations |
97 |
|
|
--- smeserver-vacation-1.1.old/root/etc/e-smith/web/functions/uservacations 2015-09-04 10:53:45.503912372 +0200 |
98 |
|
|
+++ smeserver-vacation-1.1/root/etc/e-smith/web/functions/uservacations 2015-09-04 18:12:18.853099056 +0200 |
99 |
|
|
@@ -54,6 +54,14 @@ |
100 |
|
|
<field type="literal" id="FullName"> |
101 |
|
|
<label>USER_NAME</label> |
102 |
|
|
</field> |
103 |
|
|
+ |
104 |
|
|
+ <field type="text" id="EmailVacationFrom"> |
105 |
|
|
+ <label>VACATION_FROM</label> |
106 |
|
|
+ </field> |
107 |
|
|
+ |
108 |
|
|
+ <field type="text" id="EmailVacationTo"> |
109 |
|
|
+ <label>VACATION_TO</label> |
110 |
|
|
+ </field> |
111 |
|
|
|
112 |
|
|
<subroutine src="get_vacation_text()" /> |
113 |
|
|
|
114 |
|
|
diff -urN smeserver-vacation-1.1.old/root/sbin/e-smith/vacation/check_vacation_dates.sh smeserver-vacation-1.1/root/sbin/e-smith/vacation/check_vacation_dates.sh |
115 |
|
|
--- smeserver-vacation-1.1.old/root/sbin/e-smith/vacation/check_vacation_dates.sh 1970-01-01 01:00:00.000000000 +0100 |
116 |
|
|
+++ smeserver-vacation-1.1/root/sbin/e-smith/vacation/check_vacation_dates.sh 2015-09-04 18:39:09.929079461 +0200 |
117 |
|
|
@@ -0,0 +1,37 @@ |
118 |
|
|
+#!/bin/bash |
119 |
|
|
+CURRENT_DATE=`date +%Y%m%d` |
120 |
|
|
+ |
121 |
|
|
+echo "Checking vacation changes on $CURRENT_DATE" |
122 |
|
|
+ |
123 |
|
|
+# iterate over users |
124 |
|
|
+for key in `db accounts keys` |
125 |
|
|
+do |
126 |
|
|
+ if [ `db accounts gettype $key` == "user" ] |
127 |
|
|
+ then |
128 |
|
|
+ # check for EmailVacationProperty |
129 |
|
|
+ if [ -z `db accounts getprop $key EmailVacation` ] |
130 |
|
|
+ then |
131 |
|
|
+ echo "$key never went on vacation before." |
132 |
|
|
+ |
133 |
|
|
+ # if both fields are empty or contain the same value, do nothing |
134 |
|
|
+ elif [ `db accounts getprop $key EmailVacationFrom` == `db accounts getprop $key EmailVacationTo` ] |
135 |
|
|
+ then |
136 |
|
|
+ echo "Both fields empty or same date, not changing anything for $key" |
137 |
|
|
+ # db accounts setprop $key EmailVacation no |
138 |
|
|
+ |
139 |
|
|
+ elif [ `db accounts getprop $key EmailVacationFrom` == $CURRENT_DATE ] |
140 |
|
|
+ then |
141 |
|
|
+ echo "Happy holidays, $key" |
142 |
|
|
+ db accounts setprop $key EmailVacation yes |
143 |
|
|
+ |
144 |
|
|
+ elif [ `db accounts getprop $key EmailVacationTo` == $CURRENT_DATE ] |
145 |
|
|
+ then |
146 |
|
|
+ echo "Back to work, $key" |
147 |
|
|
+ db accounts setprop $key EmailVacation no |
148 |
|
|
+ |
149 |
|
|
+ else |
150 |
|
|
+ echo "Nothing to do for $key" |
151 |
|
|
+ |
152 |
|
|
+ fi |
153 |
|
|
+ fi |
154 |
|
|
+done |
155 |
|
|
diff -urN smeserver-vacation-1.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm smeserver-vacation-1.1/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm |
156 |
|
|
--- smeserver-vacation-1.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm 2015-09-04 10:53:45.503912372 +0200 |
157 |
|
|
+++ smeserver-vacation-1.1/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm 2015-09-04 11:47:21.004897212 +0200 |
158 |
|
|
@@ -85,6 +85,8 @@ |
159 |
|
|
{ |
160 |
|
|
# make it clearer which uses have vacation |
161 |
|
|
my $EmailVacation = $user->prop('EmailVacation') || ''; |
162 |
|
|
+ my $EmailVacationFrom = $user->prop('EmailVacationFrom') || ''; |
163 |
|
|
+ my $EmailVacationTo = $user->prop('EmailVacationTo') || ''; |
164 |
|
|
my $status = $user->prop('EmailVacation') || ''; |
165 |
|
|
if ($status eq 'yes') { $status = 'YES'; } else { $status = ''; } |
166 |
|
|
|
167 |
|
|
@@ -94,6 +96,8 @@ |
168 |
|
|
$user->prop('LastName'), |
169 |
|
|
status => $self->localise($status), |
170 |
|
|
EmailVacation => $EmailVacation, |
171 |
|
|
+ EmailVacationFrom => $EmailVacationFrom, |
172 |
|
|
+ EmailVacationTo => $EmailVacationTo, |
173 |
|
|
Modify => $self->localise('MODIFY'), |
174 |
|
|
} |
175 |
|
|
} |
176 |
|
|
@@ -115,6 +119,8 @@ |
177 |
|
|
"User=" . $row->{User}, |
178 |
|
|
"FullName=" . $row->{FullName}, |
179 |
|
|
"EmailVacation=" . $row->{EmailVacation}, |
180 |
|
|
+ "EmailVacationFrom=" . $row->{EmailVacationFrom}, |
181 |
|
|
+ "EmailVacationTo=" . $row->{EmailVacationTo}, |
182 |
|
|
"wherenext=VACATION_PAGE_MODIFY"); |
183 |
|
|
} |
184 |
|
|
|
185 |
|
|
@@ -177,6 +183,8 @@ |
186 |
|
|
my $user = $q->param('User'); |
187 |
|
|
|
188 |
|
|
my $EmailVacation = $q->param('EmailVacation'); |
189 |
|
|
+ my $EmailVacationFrom = $q->param('EmailVacationFrom'); |
190 |
|
|
+ my $EmailVacationTo = $q->param('EmailVacationTo'); |
191 |
|
|
my $new_message = $q->param('new_message'); |
192 |
|
|
my $vfile = "/home/e-smith/files/users/$user/.vacation.msg"; |
193 |
|
|
|
194 |
|
|
@@ -228,6 +236,8 @@ |
195 |
|
|
"/home/e-smith/files/users/$user/.vacation.msg"); |
196 |
|
|
|
197 |
|
|
$adb->set_prop($user, 'EmailVacation', $EmailVacation); |
198 |
|
|
+ $adb->set_prop($user, 'EmailVacationFrom', $EmailVacationFrom); |
199 |
|
|
+ $adb->set_prop($user, 'EmailVacationTo', $EmailVacationTo); |
200 |
|
|
|
201 |
|
|
#the first is more correct but is slower |
202 |
|
|
#system ("/sbin/e-smith/signal-event", "email-update", $user) == 0 |
203 |
|
|
@@ -260,6 +270,16 @@ |
204 |
|
|
return $adb->get_prop($PanelUser, "EmailVacation"); |
205 |
|
|
} |
206 |
|
|
|
207 |
|
|
+sub get_vacation_date_from |
208 |
|
|
+{ |
209 |
|
|
+ return $adb->get_prop($PanelUser, "EmailVacationFrom"); |
210 |
|
|
+} |
211 |
|
|
+ |
212 |
|
|
+sub get_vacation_date_to |
213 |
|
|
+{ |
214 |
|
|
+ return $adb->get_prop($PanelUser, "EmailVacationTo"); |
215 |
|
|
+} |
216 |
|
|
+ |
217 |
|
|
# this formats the text to display on screen |
218 |
|
|
sub userpanel_get_vacation_text |
219 |
|
|
{ |
220 |
|
|
|