diff -urN smeserver-vacation-1.1.old/root/etc/cron.d/vacation smeserver-vacation-1.1/root/etc/cron.d/vacation
--- smeserver-vacation-1.1.old/root/etc/cron.d/vacation 1970-01-01 01:00:00.000000000 +0100
+++ smeserver-vacation-1.1/root/etc/cron.d/vacation 2015-09-04 18:19:50.007131821 +0200
@@ -0,0 +1,4 @@
+# Check each user account if a vacation message should be enabled
+# or disabled based on the given From/To vacation dates
+# Do it shortly after midnight on every day
+0 01 * * * root /sbin/e-smith/vacation/check_vacation_dates.sh
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
--- 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
+++ smeserver-vacation-1.1/root/etc/e-smith/locale/de/etc/e-smith/web/functions/uservacations 2015-09-04 20:05:53.405096692 +0200
@@ -21,7 +21,39 @@
MODIFY_DESCRIPTION
- 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.
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.
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".
]]>
+
+ 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.
+
+
+ Der Text der Abwesenheitsnachricht sollte aus zwei Teilen bestehen, die voneinander durch eine Leerzeile getrennt sind.
+ Der obere Teil wird in den Header der generierten Abwesenheitsnachricht eingefügt.
+ Vor dem eigentlichen Inhalt der Abwesenheitsnachricht muss also auf jeden Fall eine Leerzeile stehen.
+
+
+ Die primäre Domain wird der Absenderadresse automatisch hinzugefügt. Sie können aber im "From:"-Header auch eine virtuelle Domäne verwenden.
+ Um die Abwesenheitsnachricht auf den Standardtext zurückzusetzen geben Sie bitte "reset" ein.
+
+
+ Sie können zusätzlich die entsprechenden Felder ausfüllen, um das Versenden der Abwesenheitsnachricht
+ für diesen Benutzer-Account zum jeweiligen Datum automatisch zu aktivieren und zu deaktivieren.
+
+
+ Bitte verwenden Sie dafür das Format JJJJMMTT (vierstellige Jahreszahl, zweistellige Monatszahl, zweistellige Tageszahl)
+ und beachten Sie, dass die Sie in die beiden Felder nicht das gleiche Datum eintragen dürfen.
+
+
+ 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.
+
+ ]]>
+
+
+ VACATION_FROM
+ Abwesenheitsnotiz aktivieren am (JJJJMMTT)
+
+
+ VACATION_TO
+ Abwesenheitsnotiz deaktivieren am (JJJJMMTT)MESSAGE
@@ -29,7 +61,7 @@
VACATION_STATUS
- Abwesenheitsnotiz aktivieren
+ Abwesenheitsnotiz aktiviertFROM
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
--- 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
+++ 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
@@ -42,10 +42,28 @@
"From: user@primary.domain" with "From: user@virtual.domain").
To change the vacation message back to the default type "reset".
+
+ You can also fill out the "Enable vacation on" and "Disable vacation on" fields in order to
+ automatically enable and disable sending of the vacation message for this user account on the given dates.
+
+
+ The format used is YYYYMMDD (four digit year, two digit month, two digit day)
+ and the dates in the two fields must not be the same.
+ 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.
+
+
]]>
+ VACATION_FROM
+ Enable vacation on (YYYYMMDD)
+
+
+ VACATION_TO
+ Disable vacation on (YYYYMMDD)
+
+ MESSAGE
Vacation message
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
--- smeserver-vacation-1.1.old/root/etc/e-smith/web/functions/uservacations 2015-09-04 10:53:45.503912372 +0200
+++ smeserver-vacation-1.1/root/etc/e-smith/web/functions/uservacations 2015-09-04 18:12:18.853099056 +0200
@@ -54,6 +54,14 @@
+
+
+
+
+
+
+
+
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
--- smeserver-vacation-1.1.old/root/sbin/e-smith/vacation/check_vacation_dates.sh 1970-01-01 01:00:00.000000000 +0100
+++ smeserver-vacation-1.1/root/sbin/e-smith/vacation/check_vacation_dates.sh 2015-09-04 18:39:09.929079461 +0200
@@ -0,0 +1,37 @@
+#!/bin/bash
+CURRENT_DATE=`date +%Y%m%d`
+
+echo "Checking vacation changes on $CURRENT_DATE"
+
+# iterate over users
+for key in `db accounts keys`
+do
+ if [ `db accounts gettype $key` == "user" ]
+ then
+ # check for EmailVacationProperty
+ if [ -z `db accounts getprop $key EmailVacation` ]
+ then
+ echo "$key never went on vacation before."
+
+ # if both fields are empty or contain the same value, do nothing
+ elif [ `db accounts getprop $key EmailVacationFrom` == `db accounts getprop $key EmailVacationTo` ]
+ then
+ echo "Both fields empty or same date, not changing anything for $key"
+ # db accounts setprop $key EmailVacation no
+
+ elif [ `db accounts getprop $key EmailVacationFrom` == $CURRENT_DATE ]
+ then
+ echo "Happy holidays, $key"
+ db accounts setprop $key EmailVacation yes
+
+ elif [ `db accounts getprop $key EmailVacationTo` == $CURRENT_DATE ]
+ then
+ echo "Back to work, $key"
+ db accounts setprop $key EmailVacation no
+
+ else
+ echo "Nothing to do for $key"
+
+ fi
+ fi
+done
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
--- smeserver-vacation-1.1.old/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm 2015-09-04 10:53:45.503912372 +0200
+++ smeserver-vacation-1.1/root/usr/share/perl5/vendor_perl/esmith/FormMagick/Panel/uservacations.pm 2015-09-04 11:47:21.004897212 +0200
@@ -85,6 +85,8 @@
{
# make it clearer which uses have vacation
my $EmailVacation = $user->prop('EmailVacation') || '';
+ my $EmailVacationFrom = $user->prop('EmailVacationFrom') || '';
+ my $EmailVacationTo = $user->prop('EmailVacationTo') || '';
my $status = $user->prop('EmailVacation') || '';
if ($status eq 'yes') { $status = 'YES'; } else { $status = ''; }
@@ -94,6 +96,8 @@
$user->prop('LastName'),
status => $self->localise($status),
EmailVacation => $EmailVacation,
+ EmailVacationFrom => $EmailVacationFrom,
+ EmailVacationTo => $EmailVacationTo,
Modify => $self->localise('MODIFY'),
}
}
@@ -115,6 +119,8 @@
"User=" . $row->{User},
"FullName=" . $row->{FullName},
"EmailVacation=" . $row->{EmailVacation},
+ "EmailVacationFrom=" . $row->{EmailVacationFrom},
+ "EmailVacationTo=" . $row->{EmailVacationTo},
"wherenext=VACATION_PAGE_MODIFY");
}
@@ -177,6 +183,8 @@
my $user = $q->param('User');
my $EmailVacation = $q->param('EmailVacation');
+ my $EmailVacationFrom = $q->param('EmailVacationFrom');
+ my $EmailVacationTo = $q->param('EmailVacationTo');
my $new_message = $q->param('new_message');
my $vfile = "/home/e-smith/files/users/$user/.vacation.msg";
@@ -228,6 +236,8 @@
"/home/e-smith/files/users/$user/.vacation.msg");
$adb->set_prop($user, 'EmailVacation', $EmailVacation);
+ $adb->set_prop($user, 'EmailVacationFrom', $EmailVacationFrom);
+ $adb->set_prop($user, 'EmailVacationTo', $EmailVacationTo);
#the first is more correct but is slower
#system ("/sbin/e-smith/signal-event", "email-update", $user) == 0
@@ -260,6 +270,16 @@
return $adb->get_prop($PanelUser, "EmailVacation");
}
+sub get_vacation_date_from
+{
+ return $adb->get_prop($PanelUser, "EmailVacationFrom");
+}
+
+sub get_vacation_date_to
+{
+ return $adb->get_prop($PanelUser, "EmailVacationTo");
+}
+
# this formats the text to display on screen
sub userpanel_get_vacation_text
{