/[smecontribs]/rpms/smeserver-vacation/contribs10/smeserver-vacation-1.1-Update-for-Apache-Mod-Proxy-based-server2.patch
ViewVC logotype

Contents of /rpms/smeserver-vacation/contribs10/smeserver-vacation-1.1-Update-for-Apache-Mod-Proxy-based-server2.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Fri Jun 12 05:52:09 2020 UTC (4 years, 5 months ago) by brianr
Branch: MAIN
CVS Tags: smeserver-vacation-1_1-34_el7_sme, smeserver-vacation-1_1-31_el7_sme, smeserver-vacation-1_1-32_el7_sme, smeserver-vacation-1_1-30_el7_sme, smeserver-vacation-1_1-35_el7_sme, smeserver-vacation-1_1-36_el7_sme, smeserver-vacation-1_1-33_el7_sme, smeserver-vacation-1_1-29_el7_sme, HEAD
Error occurred while calculating annotation data.
* Thu Jun 11 2020 Brian Read <brianr@bjsystems.co.uk> 1.1-29.sme
- Update for Apache-Mod-Proxy mode Server2 [SME:10927]

1 diff -urN smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Uservacations.pm smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Uservacations.pm
2 --- smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Uservacations.pm 2020-06-11 06:33:21.401187446 +0100
3 +++ smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/Controller/Uservacations.pm 1970-01-01 01:00:00.000000000 +0100
4 @@ -1,379 +0,0 @@
5 -package SrvMngr::Controller::Uservacations;
6 -#----------------------------------------------------------------------
7 -# heading : Collaboration
8 -# description : User Vacations
9 -# navigation : 3000 3150
10 -#
11 -# name : Uservacationsget, method : get, url : /uservacations, ctlact : Uservacations#main
12 -# name : Uservacationspost,method : post, url : /Uservacations, ctlact : Uservacations#do_display
13 -# name : Uservacations1, method : get, url : /Uservacations1, ctlact : Uservacations#do_display
14 -# name : Uservacations2, method : post, url : /Uservacations2, ctlact : Uservacations#do_display
15 -# routes : end
16 -#----------------------------------------------------------------------
17 -
18 -use strict;
19 -use warnings;
20 -use Mojo::Base 'Mojolicious::Controller';
21 -
22 -#use DateTime; #Not part of SME10 mix
23 -use POSIX;
24 -
25 -use Locale::gettext;
26 -use SrvMngr::I18N;
27 -use SrvMngr qw(theme_list init_session_cgi);
28 -
29 -use Data::Dumper;
30 -use esmith::util;
31 -use esmith::HostsDB;
32 -use esmith::AccountsDB;
33 -
34 -our $db = esmith::ConfigDB->open();
35 -our $adb = esmith::AccountsDB->open();
36 -
37 -our $PanelUser = $ENV{'REMOTE_USER'} ||'';
38 -$PanelUser = $1 if ($PanelUser =~ /^([a-z][\.\-a-z0-9]*)$/);
39 -
40 -our %delegatedVacations;
41 -
42 -use constant FALSE => 0;
43 -use constant TRUE => 1;
44 -
45 -sub main {
46 -
47 - my $c = shift;
48 - $c->app->log->info( $c->log_req );
49 -
50 - my %vac_datas = ();
51 - my $title = $c->l('vac_FORM_TITLE');
52 - my $modul = '';
53 -
54 - $vac_datas{trt} = 'LIST';
55 -
56 - my @vacations = get_vacation_table($c);
57 - my $empty = (scalar @vacations == 0);
58 -
59 - $vac_datas{"first"} = 'vac_MODIFY_DESCRIPTION';
60 -
61 - $c->stash(
62 - title => $title,
63 - modul => $modul,
64 - vac_datas => \%vac_datas,
65 - vacations =>\@vacations,
66 - empty => $empty
67 - );
68 - $c->render( template => 'uservacations' );
69 -}
70 -
71 -sub do_display {
72 -
73 - my $c = shift;
74 - $c->app->log->info( $c->log_req );
75 -
76 - my $rt = $c->current_route;
77 - my $trt = ( $c->param('trt') || 'LIST' );
78 -
79 - $trt = 'ADD' if ( $rt eq 'Uservacations1' );
80 - $trt = 'ADD1' if ( $rt eq 'Uservacations2' );
81 -
82 - my %vac_datas = ();
83 - my $title = $c->l('vac_FORM_TITLE');
84 - my $modul = '';
85 -
86 -
87 - if ( $trt eq 'ADD' ) {
88 - # Add or change a vacation message - called from the list panel
89 - # Get the data and pass it across.
90 - my $account = $c->param("account");
91 - my $user = $adb->get($account);
92 - my $username = $user->prop("FirstName")." ".$user->prop("LastName");
93 - my $EmailVacation = $user->prop('EmailVacation') || '';
94 - my $EmailVacationFrom = $user->prop('EmailVacationFrom') || '';
95 - my $EmailVacationTo = $user->prop('EmailVacationTo') || '';
96 - my $VacText = get_vacation_text($c);
97 - $c->stash(account=>$account,
98 - username=>$username,
99 - EmailVacation=>$EmailVacation,
100 - EmailVacationFrom=>$EmailVacationFrom,
101 - EmailVacationTo=>$EmailVacationTo,
102 - VacText=>$VacText
103 - );
104 - }
105 -
106 - if ( $trt eq 'ADD1' ) {
107 - #Add or edit vacation message.
108 - my $ret = add_vac_message($c);
109 - #Return to list page if success
110 - if ($ret eq "OK") {
111 - $trt = "LIST";
112 - $vac_datas{success} = "vac_SUCCESS";
113 -
114 - } else {
115 - my $account = $c->param("account");
116 - my $user = $adb->get($account);
117 - my $username = $user->prop("FirstName")." ".$user->prop("LastName");
118 - my $EmailVacationFrom = $c->param('EmailVacationFrom') || '';
119 - my $EmailVacationTo = $c->param('EmailVacationTo') || '';
120 - my $EmailVacation = $c->param('EmailVacation') || '';
121 - my $VacText = $c->param("VacText");
122 - $c->stash(account=>$account,
123 - username=>$username,
124 - EmailVacation=>$EmailVacation,
125 - EmailVacationFrom=>$EmailVacationFrom,
126 - EmailVacationTo=>$EmailVacationTo,
127 - VacText=>$VacText
128 - );
129 - #Error - return to Add page
130 - $trt = "ADD";
131 - $vac_datas{error} = $ret;
132 - }
133 - }
134 -
135 - if ( $trt eq 'LIST' ) {
136 -
137 - #List all the users and vacation message details.
138 - my @vacations = get_vacation_table($c);
139 - my $empty = (scalar @vacations == 0);
140 - $c->stash(
141 - empty => $empty,
142 - vacations =>\@vacations
143 - );
144 - }
145 -
146 -
147 - $vac_datas{'trt'} = $trt;
148 - $c->stash( title => $title, modul => $modul, vac_datas => \%vac_datas );
149 - $c->render( template => 'uservacations' );
150 -}
151 -
152 -sub user_accounts_exist
153 -{
154 - my $q = shift;
155 - #return scalar $adb->users;
156 - if (scalar $adb->users)
157 - { return $q->l('vac_DESCRIPTION'); }
158 -}
159 -
160 -sub get_vacation_table
161 -{
162 - my $self = shift;
163 - #my $q = $self->{cgi};
164 -
165 -#We want to retrieve granted group from DB, and retrieve users of groups
166 - my $record = $adb->get($PanelUser);
167 - my $dg=$record->prop('delegatedVacations')||'';
168 - $dg =~ s/ //g;
169 - my @g = split(/,/, $dg);
170 - my @visiblemembers = ();
171 -
172 - foreach my $g (@g) {
173 - my $members = $adb->get_prop("$g",'Members');
174 - next unless defined $members;
175 - $members =~ s/ //g;
176 - my @members = split(/,/, $members);
177 - push @visiblemembers , @members ;
178 - }
179 -
180 - foreach my $k ( @visiblemembers )
181 - {
182 - $delegatedVacations{$k}=1;
183 - }
184 -
185 -
186 - my @users = $adb->users;
187 - return () if (@users == 0); ##$self->l("ACCOUNT_USER_NONE")
188 - return () if (@visiblemembers == 0 && $dg ne '');#; #$self->l("NO_USERS_IN_GRANTED_GROUPS")
189 -
190 - my @data = ();
191 -
192 - for my $user (@users)
193 - {
194 - next if %delegatedVacations and not $delegatedVacations{$user->key};
195 - # make it clearer which uses have vacation
196 - my $EmailVacation = $user->prop('EmailVacation') || '';
197 - my $EmailVacationFrom = $user->prop('EmailVacationFrom') || '';
198 - my $EmailVacationTo = $user->prop('EmailVacationTo') || '';
199 - my $status = $user->prop('EmailVacation') || '';
200 - if ($status eq 'yes') { $status = 'YES'; } else { $status = ''; }
201 -
202 - push @data,
203 - { User => $user->key,
204 - FullName => $user->prop('FirstName') . " " .$user->prop('LastName'),
205 - status => $self->l($status),
206 - EmailVacation => $EmailVacation,
207 - EmailVacationFrom => showDate($EmailVacationFrom),
208 - EmailVacationTo => showDate($EmailVacationTo),
209 - Modify => $self->l('vac_MODIFY'),
210 - }
211 - }
212 - return @data;
213 -}
214 -
215 -sub showDate
216 -{
217 - my $strDate = shift;
218 - my ($Year,$Month,$Day) = ($strDate =~ /(\d{4})(\d{2})(\d{2})/);
219 - #my $Unix = mktime(0,0,0,$Day,$Month,$Year);
220 - return "$Year-$Month-$Day";
221 -}
222 -
223 -
224 -sub modify_link
225 -{
226 - my ($data_item, $row, $field) = @_;
227 -
228 - return "uservacations?" .
229 - join("&",
230 - "page=0",
231 - "page_stack=",
232 - "Next=Next",
233 - "User=" . $row->{User},
234 - "FullName=" . $row->{FullName},
235 - "EmailVacation=" . $row->{EmailVacation},
236 - "EmailVacationFrom=" . $row->{EmailVacationFrom},
237 - "EmailVacationTo=" . $row->{EmailVacationTo},
238 - "wherenext=VACATION_PAGE_MODIFY");
239 -}
240 -
241 -# this formats the text to display on screen
242 -sub get_vacation_text
243 -{
244 - my $q = shift;
245 - my $domain = $db->get_value('DomainName');
246 - my $user = $q->param('account');
247 -
248 - my $fullname = $adb->get_prop($user, "FirstName") . " " .
249 - $adb->get_prop($user, "LastName");
250 -
251 - my $vfile = "/home/e-smith/files/users/$user/.vacation.msg";
252 -
253 - my $from = $q->l('vac_FROM');
254 - my $Subject = $q->l('vac_SUBJECT');
255 - my $away = $q->l('vac_AWAY_FROM_MAIL');
256 - my $return = $q->l('vac_ANSWER_TO_OBJECT_SENDER');
257 -
258 - my $ExistingMessage = "$from $fullname &lt\;$user\@$domain&gt\;\n"."$Subject $return\n".
259 - "\n$away\n"."\n--\n$fullname";
260 -
261 - # if exists and is not empty
262 - if (( -e $vfile ) && (! -z $vfile ))
263 - {
264 - open (VACATION, "<$vfile")
265 - or die "Error: Could not open file: $vfile\n";
266 - my @vacationTemp;
267 -
268 - #reformat so email address isn't hidden inside < >
269 - while (<VACATION>)
270 - {
271 - $_ =~ s/</&lt\;/;
272 - $_ =~ s/>/&gt\;/;
273 - push (@vacationTemp, $_);
274 - }
275 -
276 - $ExistingMessage = join ("", @vacationTemp);
277 -
278 - close VACATION;
279 - }
280 - return $ExistingMessage;
281 -}
282 -
283 -# saves the text to .vacation.msg
284 -sub add_vac_message
285 -{
286 - my $q = shift;
287 -
288 - my $domain = $db->get_value('DomainName');
289 - my $user = $q->param('account');
290 -
291 - my $EmailVacation = $q->param('EmailVacation')||"no";
292 - #die($EmailVacation);
293 - #if ($EmailVacation eq "yes") {$EmailVacation = "yes";} else {$EmailVacation = "no";}
294 -
295 - #Decode To and FROM to standard format - comes over in html5 iso format yyyy-mm-dd
296 - my $EmailVacationFrom = trim($q->param('EmailVacationFrom'));
297 - my ($fromYear,$fromMonth,$fromDay) = ($EmailVacationFrom =~ /(\d{4})-(\d{2})-(\d{2})/);
298 - $EmailVacationFrom = $fromYear.$fromMonth.$fromDay;
299 - if ($EmailVacationFrom !~ m/^2[0-9]{3}[0|1][0-9][0-3][0-9]$/ and $EmailVacationFrom ne "") {return "vac_FROM_DATE_INCORRECT";}
300 - my $EmailVacationTo = trim($q->param('EmailVacationTo'));
301 - my ($toYear,$toMonth,$toDay) = ($EmailVacationTo =~ /(\d{4})-(\d{2})-(\d{2})/);
302 - $EmailVacationTo = $toYear.$toMonth.$toDay;
303 -# $EmailVacationTo =~ s/-//g; #Just take out "-".
304 - if ($EmailVacationTo !~ m/^2[0-9]{3}[0|1][0-9][0-3][0-9]$/ and $EmailVacationFrom ne "") {return "vac_TO_DATE_INCORRECT";}
305 - #Check not the same or From follows To.
306 - if ($EmailVacationTo ne "" and $EmailVacationTo eq $EmailVacationFrom) {return "vac_DATES_THE_SAME";}
307 - my $UnixFrom = mktime(0,0,0,$fromDay,$fromMonth,$fromYear);
308 - my $UnixTo = mktime(0,0,0,$toDay,$toMonth,$toYear);
309 - if ($UnixTo < $UnixFrom) {return "vac_TO_DATE_MUST_BE_LATER";}
310 -
311 -
312 - my $new_message = $q->param('VacText');
313 - my $vfile = "/home/e-smith/files/users/$user/.vacation.msg";
314 -
315 - my $fullname = $adb->get_prop($user, "FirstName") . " " .
316 - $adb->get_prop($user, "LastName");
317 -
318 - my $from = 'From:';
319 - my $away = $q->l('vac_AWAY_FROM_MAIL');
320 - my $return = $q->l('vac_ANSWER_TO_OBJECT_SENDER');
321 -
322 - my $vacation_text = "$from $fullname \<$user\@$domain\>\n"."Subject: $return\n".
323 - "\n$away \n"."\n--\n$fullname";
324 -
325 - my $reset = $vacation_text;
326 -
327 - # if exists and is not empty
328 - if (( -e $vfile ) && (! -z $vfile ))
329 - {
330 - open (VACATION, "<$vfile")
331 - or die "Error: Could not open file: $vfile\n";
332 - my @vacationTemp = <VACATION>;
333 - $vacation_text = join ("", @vacationTemp);
334 -
335 - close VACATION;
336 - }
337 -
338 - chomp $new_message;
339 -
340 - # reset msg to default,
341 - if ($new_message =~ /reset/)
342 - { $vacation_text = $reset; }
343 - else
344 - {
345 - #or save new_message
346 - unless ($new_message eq "")
347 - { $vacation_text = $new_message; }
348 - }
349 -
350 - # Strip out DOS Carriage Returns (CR)
351 - $vacation_text =~ s/\r//g;
352 -
353 - unlink $vfile;
354 - open (VACATION, ">$vfile")
355 - or die ("Error opening vacation message.\n");
356 -
357 - print VACATION "$vacation_text";
358 - close VACATION;
359 -
360 - esmith::util::chownFile($user, $user,
361 - "/home/e-smith/files/users/$user/.vacation.msg");
362 -
363 - $adb->set_prop($user, 'EmailVacation', $EmailVacation);
364 - $adb->set_prop($user, 'EmailVacationFrom', $EmailVacationFrom);
365 - $adb->set_prop($user, 'EmailVacationTo', $EmailVacationTo);
366 -
367 - #the first is more correct but is slower
368 - #system ("/sbin/e-smith/signal-event", "email-update", $user) == 0
369 - system ("/etc/e-smith/events/actions/qmail-update-user event $user") == 0
370 - or die ("Error occurred updating .qmail\n");
371 -
372 - if (($EmailVacation eq 'no') && ( -e "/home/e-smith/files/users/$user/.vacation"))
373 - {
374 - system ("/bin/rm /home/e-smith/files/users/$user/.vacation") == 0
375 - or die ("Error resetting vacation db.\n");
376 - }
377 -
378 - return "OK";
379 -}
380 -
381 -sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
382 -
383 -1;
384 diff -urN smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Uservacations/en.pm smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Uservacations/en.pm
385 --- smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Uservacations/en.pm 2020-06-11 06:33:21.401187446 +0100
386 +++ smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/lib/SrvMngr/I18N/Modules/Uservacations/en.pm 1970-01-01 01:00:00.000000000 +0100
387 @@ -1,63 +0,0 @@
388 -package SrvMngr::I18N::Modules::Uservacations::en;
389 -use strict;
390 -use warnings;
391 -use utf8;
392 -use Mojo::Base 'SrvMngr::I18N';
393 -
394 -use SrvMngr::I18N::Modules::General::en;
395 -
396 -my %lexicon = (
397 -'vac_User vacations' =>'User vacations',
398 -'vac_Vacation Message' =>'Vacation Message',
399 -'vac_FORM_TITLE' =>'Change user vacation settings',
400 -'vac_DESCRIPTION' =>' You can modify a users vacation message by clicking
401 - on the link to the right of their name below.
402 -',
403 -'vac_LABEL_VACATION' =>'Vacation',
404 -'vac_NO_FORWARDS'=>'No users found for forwarding',
405 -'vac_VACATION_FROM' =>'Vacation starts on <br>(YYYY-MM-DD)',
406 -'vac_VACATION_TO' =>'Vacation finishes on <br>(YYYY-MM-DD)',
407 -'vac_VACATION_FROM1' =>'Vacation starts on',
408 -'vac_VACATION_TO1' =>'Vacation finishes on',
409 -'vac_MESSAGE' =>'Vacation message',
410 -'vac_VACATION_STATUS' =>'Enable vacation messages',
411 -'vac_FROM' =>'From:',
412 -'vac_SUBJECT' =>'Subject:',
413 -'vac_AWAY_FROM_MAIL' =>'I will not be reading my mail for a while. Your mail regarding $SUBJECT will be read when I return.',
414 -'vac_NO_USERS_IN_GRANTED_GROUPS' =>'There are no users in the group(s) that you are granted to manage.',
415 -'vac_ANSWER_TO_OBJECT_SENDER' => 'Re: $SUBJECT - Away from my email ',
416 -'vac_FROM_DATE_INCORRECT'=>'From date must have YYYYMMDD format',
417 -'vac_TO_DATE_INCORRECT'=>'To date must have YYYYMMDD format',
418 -'vac_DATES_THE_SAME'=>"The Start and Finish dates cannot be the same",
419 -'vac_TO_DATE_MUST_BE_LATER'=>"The Finish dates cannot be earlier than the Start date",
420 -'vac_SUCCESS'=>'Vacation message saved sucessfully',
421 -'vac_MODIFY_DESCRIPTION' =>'
422 - <p>
423 - Enter a vacation message here. You can use $SUBJECT
424 - anywhere in the text to be replaced with the subject line
425 - from the email that activated the auto-reply.</p>
426 -
427 - <p>
428 - This message must be composed of two parts separated by a blank line.
429 - The first will be integrated into the headings of the email reply,
430 - you must thus ensure you leave at least a blank line before typing your message.
431 - The primary domain is added to the address automatically,or you can insert a virtual domain by replacing the domain part of the sender address
432 - in the first line of the message with the virtual domain name (eg. replace the default From: user@primary.domain with From: user@virtual.domain).
433 - To change the vacation message back to the default type reset.</p>
434 - <p>
435 - You can also fill out the Enable vacation on and Disable vacation on fields in order to
436 - automatically enable and disable sending of the vacation message for this user account on the given dates.
437 - </p>
438 - <p>
439 - The dates in the two fields must not be the same.<br>
440 - 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.
441 - </p>'
442 -);
443 -
444 -our %Lexicon = (
445 - %{ SrvMngr::I18N::Modules::General::en::Lexicon },
446 - %lexicon
447 -);
448 -
449 -
450 -1;
451 diff -urN smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_vac_add.html.ep smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_vac_add.html.ep
452 --- smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_vac_add.html.ep 2020-06-11 06:33:21.397187406 +0100
453 +++ smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_vac_add.html.ep 1970-01-01 01:00:00.000000000 +0100
454 @@ -1,54 +0,0 @@
455 -<div id='vac_add'>
456 -
457 - % my $btn = l('ADD');
458 -
459 - % if ($config->{debug} == 1) {
460 - <p>
461 - %= dumper $c->current_route
462 - %= dumper $EmailVacation
463 - </p>
464 - % }
465 -
466 - %= form_for '/Uservacations2' => (method => 'POST') => begin
467 -
468 - <span class=label>
469 - %=l 'ACCOUNT'
470 - </span><span class=data>
471 - %= $account
472 - </span><br><br>
473 - <span class=label>
474 - %=l 'USER_NAME'
475 - </span><span class=data>
476 - %=$username
477 - </span><br><br>
478 - <span class=label>
479 - %=$c->render_to_string(inline =>$c->l('vac_VACATION_FROM1'))
480 - </span>
481 - <span class=data>
482 - %=date_field 'EmailVacationFrom' =>$EmailVacationFrom
483 - </span><br><br>
484 - <span class=label>
485 - %=$c->render_to_string(inline =>$c->l('vac_VACATION_TO1'))
486 - </span>
487 - <span class=data>
488 - %=date_field 'EmailVacationTo' =>$EmailVacationTo
489 - </span><br><br>
490 - <span class=label>
491 - %=l 'vac_MESSAGE'
492 - </span>
493 - <span class=data>
494 - %=text_area 'VacText' => $VacText, cols=>55, rows=>15
495 - </span><br><br>
496 - <span class=label>
497 - %=l 'vac_VACATION_STATUS'
498 - </span>
499 - <span class=data>
500 - % param EmailVacation => "$EmailVacation";
501 - %=select_field EmailVacation =>[['Yes'=>'yes'],['No'=>'no']]
502 - </span><br><br>
503 - %= hidden_field 'account' => $account
504 -
505 - %= submit_button "$btn", class => 'action'
506 - %end
507 -
508 -</div>
509 diff -urN smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_vac_list.html.ep smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_vac_list.html.ep
510 --- smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_vac_list.html.ep 2020-06-11 06:33:21.397187406 +0100
511 +++ smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/partials/_vac_list.html.ep 1970-01-01 01:00:00.000000000 +0100
512 @@ -1,50 +0,0 @@
513 -<div id='vac_list'>
514 -
515 - %# my $btn = l('vac_CREATE_RULE');
516 -
517 - %= form_for '/Uservacations1' => (method => 'POST') => begin
518 - <br><br>
519 -
520 - % if ($empty){
521 - <br>
522 - %=l 'vac_NO_FORWARDS'
523 - % } else {
524 - <table class="sme-border"><tbody>
525 - <tr>
526 - <th class='sme-border'>
527 - %=l 'ACCOUNT'
528 - </th>
529 - <th class='sme-border'>
530 - %=l 'USER_NAME'
531 - </th>
532 - <th class='sme-border'>
533 - %=l 'vac_LABEL_VACATION'
534 - </th>
535 -
536 - <th class='sme-border'>
537 - %=$c->render_to_string(inline =>l('vac_VACATION_FROM'))
538 - </th>
539 - <th class='sme-border'>
540 - %=$c->render_to_string(inline =>l('vac_VACATION_TO'))
541 - </th>
542 - <th class='sme-border' '>
543 - %=l 'ACTION'
544 - </th>
545 - </tr>
546 - % foreach my $vacation (@$vacations) {
547 - <tr>
548 - %= t td => (class => 'sme-border') => $vacation->{"User"}
549 - %= t td => (class => 'sme-border') => $vacation->{"FullName"}
550 - %= t td => (class => 'sme-border') => $vacation->{"status"}
551 - %= t td => (class => 'sme-border') => $vacation->{"EmailVacationFrom"}
552 - %= t td => (class => 'sme-border') => $vacation->{"EmailVacationTo"}
553 - <td>
554 - <a href="/server-manager2/Uservacations1?trt=ADD&account=<%= $vacation->{"User"}%>"><%=l 'MODIFY'%></a>
555 - </td>
556 - </tr>
557 - %}
558 - </tbody>
559 - </table>
560 - %}
561 - % end
562 -</div>
563 diff -urN smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/uservacations.html.ep smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/uservacations.html.ep
564 --- smeserver-vacation-1.1.old/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/uservacations.html.ep 2020-06-11 06:33:21.397187406 +0100
565 +++ smeserver-vacation-1.1/root/etc/e-smith/web/panels/manager2/cgi-bin/srvmngr/themes/default/templates/uservacations.html.ep 1970-01-01 01:00:00.000000000 +0100
566 @@ -1,42 +0,0 @@
567 -% layout 'default', title => "Sme server 2 - User Vacations", share_dir => './';
568 -
569 -% content_for 'module' => begin
570 -<div id="module">
571 -
572 - % if ($config->{debug} == 1) {
573 - <p>
574 - %= dumper $c->current_route
575 - </p>
576 - % }
577 -
578 - <h1><%=$title%></h1>
579 - %= $modul
580 -
581 - %if ($vac_datas->{first}) {
582 - <br>
583 - %=$c->render_to_string(inline =>$c->l($vac_datas->{first}))
584 -
585 - %} elsif ($vac_datas->{success}) {
586 - <div class='"success"'>
587 - <h2> Operation Status Report</h2>
588 - %= $c->l($vac_datas->{success});
589 - </div>
590 -
591 - %} elsif ($vac_datas->{error}) {
592 - <div class='sme-error'>
593 - <h2> Operation Status Report - error</h2>
594 - %= $c->l($vac_datas->{error});
595 - </div>
596 - %}
597 -
598 -
599 - % if ($vac_datas->{trt} eq 'ADD') {
600 - %= include 'partials/_vac_add'
601 - %} elsif ($vac_datas->{trt} eq 'ADD1') {
602 - %= include 'partials/_vac_add'
603 - %} else {
604 - %= include 'partials/_vac_list'
605 - %}
606 -
607 -</div>
608 -%end
609 diff -urN smeserver-vacation-1.1.old/root/usr/share/smanager/lib/SrvMngr/Controller/Uservacations.pm smeserver-vacation-1.1/root/usr/share/smanager/lib/SrvMngr/Controller/Uservacations.pm
610 --- smeserver-vacation-1.1.old/root/usr/share/smanager/lib/SrvMngr/Controller/Uservacations.pm 1970-01-01 01:00:00.000000000 +0100
611 +++ smeserver-vacation-1.1/root/usr/share/smanager/lib/SrvMngr/Controller/Uservacations.pm 2020-06-10 18:28:00.000000000 +0100
612 @@ -0,0 +1,380 @@
613 +package SrvMngr::Controller::Uservacations;
614 +#----------------------------------------------------------------------
615 +# heading : Collaboration
616 +# description : User Vacations
617 +# navigation : 3000 3150
618 +#
619 +# name : Uservacationsget, method : get, url : /uservacations, ctlact : Uservacations#main
620 +# name : Uservacationspost,method : post, url : /Uservacations, ctlact : Uservacations#do_display
621 +# name : Uservacations1, method : get, url : /Uservacations1, ctlact : Uservacations#do_display
622 +# name : Uservacations2, method : post, url : /Uservacations2, ctlact : Uservacations#do_display
623 +# routes : end
624 +#----------------------------------------------------------------------
625 +
626 +use strict;
627 +use warnings;
628 +use Mojo::Base 'Mojolicious::Controller';
629 +
630 +#use DateTime; #Not part of SME10 mix
631 +use POSIX;
632 +
633 +use Locale::gettext;
634 +use SrvMngr::I18N;
635 +use SrvMngr qw(theme_list init_session);
636 +
637 +use Data::Dumper;
638 +use esmith::util;
639 +use esmith::HostsDB;
640 +use esmith::AccountsDB;
641 +
642 +our $db = esmith::ConfigDB->open();
643 +our $adb = esmith::AccountsDB->open();
644 +
645 +our $PanelUser = $ENV{'REMOTE_USER'} ||'';
646 +$PanelUser = $1 if ($PanelUser =~ /^([a-z][\.\-a-z0-9]*)$/);
647 +
648 +our %delegatedVacations;
649 +
650 +use constant FALSE => 0;
651 +use constant TRUE => 1;
652 +
653 +sub main {
654 +
655 + my $c = shift;
656 + $c->app->log->info( $c->log_req );
657 +
658 + my %vac_datas = ();
659 + my $title = $c->l('vac_FORM_TITLE');
660 + my $modul = '';
661 +
662 + $vac_datas{trt} = 'LIST';
663 +
664 + my @vacations = get_vacation_table($c);
665 + my $empty = (scalar @vacations == 0);
666 +
667 + $vac_datas{"first"} = 'vac_MODIFY_DESCRIPTION';
668 +
669 + $c->stash(
670 + title => $title,
671 + modul => $modul,
672 + vac_datas => \%vac_datas,
673 + vacations =>\@vacations,
674 + empty => $empty
675 + );
676 + $c->render( template => 'uservacations' );
677 +}
678 +
679 +sub do_display {
680 +
681 + my $c = shift;
682 + $c->app->log->info( $c->log_req );
683 +
684 + my $rt = $c->current_route;
685 + my $trt = ( $c->param('trt') || 'LIST' );
686 +
687 + $trt = 'ADD' if ( $rt eq 'Uservacations1' );
688 + $trt = 'ADD1' if ( $rt eq 'Uservacations2' );
689 +
690 + my %vac_datas = ();
691 + my $title = $c->l('vac_FORM_TITLE');
692 + my $modul = '';
693 +
694 +
695 + if ( $trt eq 'ADD' ) {
696 + # Add or change a vacation message - called from the list panel
697 + # Get the data and pass it across.
698 + my $account = $c->param("account");
699 + my $user = $adb->get($account);
700 + my $username = $user->prop("FirstName")." ".$user->prop("LastName");
701 + my $EmailVacation = $user->prop('EmailVacation') || '';
702 + my $EmailVacationFrom = $user->prop('EmailVacationFrom') || '';
703 + my $EmailVacationTo = $user->prop('EmailVacationTo') || '';
704 + my $VacText = get_vacation_text($c);
705 + $c->stash(account=>$account,
706 + username=>$username,
707 + EmailVacation=>$EmailVacation,
708 + EmailVacationFrom=>$EmailVacationFrom,
709 + EmailVacationTo=>$EmailVacationTo,
710 + VacText=>$VacText
711 + );
712 + }
713 +
714 + if ( $trt eq 'ADD1' ) {
715 + #Add or edit vacation message.
716 + my $ret = add_vac_message($c);
717 + #Return to list page if success
718 + if ($ret eq "OK") {
719 + $trt = "LIST";
720 + $vac_datas{success} = "vac_SUCCESS";
721 +
722 + } else {
723 + my $account = $c->param("account");
724 + my $user = $adb->get($account);
725 + my $username = $user->prop("FirstName")." ".$user->prop("LastName");
726 + my $EmailVacationFrom = $c->param('EmailVacationFrom') || '';
727 + my $EmailVacationTo = $c->param('EmailVacationTo') || '';
728 + my $EmailVacation = $c->param('EmailVacation') || '';
729 + my $VacText = $c->param("VacText");
730 + $c->stash(account=>$account,
731 + username=>$username,
732 + EmailVacation=>$EmailVacation,
733 + EmailVacationFrom=>$EmailVacationFrom,
734 + EmailVacationTo=>$EmailVacationTo,
735 + VacText=>$VacText
736 + );
737 + #Error - return to Add page
738 + $trt = "ADD";
739 + $vac_datas{error} = $ret;
740 + }
741 + }
742 +
743 + if ( $trt eq 'LIST' ) {
744 +
745 + #List all the users and vacation message details.
746 + my @vacations = get_vacation_table($c);
747 + my $empty = (scalar @vacations == 0);
748 + $c->stash(
749 + empty => $empty,
750 + vacations =>\@vacations
751 + );
752 + }
753 +
754 +
755 + $vac_datas{'trt'} = $trt;
756 + $c->stash( title => $title, modul => $modul, vac_datas => \%vac_datas );
757 + $c->render( template => 'uservacations' );
758 +}
759 +
760 +sub user_accounts_exist
761 +{
762 + my $q = shift;
763 + #return scalar $adb->users;
764 + if (scalar $adb->users)
765 + { return $q->l('vac_DESCRIPTION'); }
766 +}
767 +
768 +sub get_vacation_table
769 +{
770 + my $self = shift;
771 +
772 +#We want to retrieve granted group from DB, and retrieve users of groups
773 + my $record = $adb->get($PanelUser);
774 + my $dg;
775 + if ($record) {$dg=$record->prop('delegatedVacations')||'';}
776 + else {$dg = '';}
777 + $dg =~ s/ //g;
778 + my @g = split(/,/, $dg);
779 + my @visiblemembers = ();
780 +
781 + foreach my $g (@g) {
782 + my $members = $adb->get_prop("$g",'Members');
783 + next unless defined $members;
784 + $members =~ s/ //g;
785 + my @members = split(/,/, $members);
786 + push @visiblemembers , @members ;
787 + }
788 +
789 + foreach my $k ( @visiblemembers )
790 + {
791 + $delegatedVacations{$k}=1;
792 + }
793 +
794 +
795 + my @users = $adb->users;
796 + return () if (@users == 0); ##$self->l("ACCOUNT_USER_NONE")
797 + return () if (@visiblemembers == 0 && $dg ne '');#; #$self->l("NO_USERS_IN_GRANTED_GROUPS")
798 +
799 + my @data = ();
800 +
801 + for my $user (@users)
802 + {
803 + next if %delegatedVacations and not $delegatedVacations{$user->key};
804 + # make it clearer which uses have vacation
805 + my $EmailVacation = $user->prop('EmailVacation') || '';
806 + my $EmailVacationFrom = $user->prop('EmailVacationFrom') || '';
807 + my $EmailVacationTo = $user->prop('EmailVacationTo') || '';
808 + my $status = $user->prop('EmailVacation') || '';
809 + if ($status eq 'yes') { $status = 'YES'; } else { $status = ''; }
810 +
811 + push @data,
812 + { User => $user->key,
813 + FullName => $user->prop('FirstName') . " " .$user->prop('LastName'),
814 + status => $self->l($status),
815 + EmailVacation => $EmailVacation,
816 + EmailVacationFrom => showDate($EmailVacationFrom),
817 + EmailVacationTo => showDate($EmailVacationTo),
818 + Modify => $self->l('vac_MODIFY'),
819 + }
820 + }
821 + return @data;
822 +}
823 +
824 +sub showDate
825 +{
826 + my $strDate = shift;
827 + my ($Year,$Month,$Day) = ($strDate =~ /(\d{4})(\d{2})(\d{2})/);
828 + #my $Unix = mktime(0,0,0,$Day,$Month,$Year);
829 + return "$Year-$Month-$Day";
830 +}
831 +
832 +
833 +sub modify_link
834 +{
835 + my ($data_item, $row, $field) = @_;
836 +
837 + return "uservacations?" .
838 + join("&",
839 + "page=0",
840 + "page_stack=",
841 + "Next=Next",
842 + "User=" . $row->{User},
843 + "FullName=" . $row->{FullName},
844 + "EmailVacation=" . $row->{EmailVacation},
845 + "EmailVacationFrom=" . $row->{EmailVacationFrom},
846 + "EmailVacationTo=" . $row->{EmailVacationTo},
847 + "wherenext=VACATION_PAGE_MODIFY");
848 +}
849 +
850 +# this formats the text to display on screen
851 +sub get_vacation_text
852 +{
853 + my $q = shift;
854 + my $domain = $db->get_value('DomainName');
855 + my $user = $q->param('account');
856 +
857 + my $fullname = $adb->get_prop($user, "FirstName") . " " .
858 + $adb->get_prop($user, "LastName");
859 +
860 + my $vfile = "/home/e-smith/files/users/$user/.vacation.msg";
861 +
862 + my $from = $q->l('vac_FROM');
863 + my $Subject = $q->l('vac_SUBJECT');
864 + my $away = $q->l('vac_AWAY_FROM_MAIL');
865 + my $return = $q->l('vac_ANSWER_TO_OBJECT_SENDER');
866 +
867 + my $ExistingMessage = "$from $fullname &lt\;$user\@$domain&gt\;\n"."$Subject $return\n".
868 + "\n$away\n"."\n--\n$fullname";
869 +
870 + # if exists and is not empty
871 + if (( -e $vfile ) && (! -z $vfile ))
872 + {
873 + open (VACATION, "<$vfile")
874 + or die "Error: Could not open file: $vfile\n";
875 + my @vacationTemp;
876 +
877 + #reformat so email address isn't hidden inside < >
878 + while (<VACATION>)
879 + {
880 + $_ =~ s/</&lt\;/;
881 + $_ =~ s/>/&gt\;/;
882 + push (@vacationTemp, $_);
883 + }
884 +
885 + $ExistingMessage = join ("", @vacationTemp);
886 +
887 + close VACATION;
888 + }
889 + return $ExistingMessage;
890 +}
891 +
892 +# saves the text to .vacation.msg
893 +sub add_vac_message
894 +{
895 + my $q = shift;
896 +
897 + my $domain = $db->get_value('DomainName');
898 + my $user = $q->param('account');
899 +
900 + my $EmailVacation = $q->param('EmailVacation')||"no";
901 + #die($EmailVacation);
902 + #if ($EmailVacation eq "yes") {$EmailVacation = "yes";} else {$EmailVacation = "no";}
903 +
904 + #Decode To and FROM to standard format - comes over in html5 iso format yyyy-mm-dd
905 + my $EmailVacationFrom = trim($q->param('EmailVacationFrom'));
906 + my ($fromYear,$fromMonth,$fromDay) = ($EmailVacationFrom =~ /(\d{4})-(\d{2})-(\d{2})/);
907 + $EmailVacationFrom = $fromYear.$fromMonth.$fromDay;
908 + if ($EmailVacationFrom !~ m/^2[0-9]{3}[0|1][0-9][0-3][0-9]$/ and $EmailVacationFrom ne "") {return "vac_FROM_DATE_INCORRECT";}
909 + my $EmailVacationTo = trim($q->param('EmailVacationTo'));
910 + my ($toYear,$toMonth,$toDay) = ($EmailVacationTo =~ /(\d{4})-(\d{2})-(\d{2})/);
911 + $EmailVacationTo = $toYear.$toMonth.$toDay;
912 +# $EmailVacationTo =~ s/-//g; #Just take out "-".
913 + if ($EmailVacationTo !~ m/^2[0-9]{3}[0|1][0-9][0-3][0-9]$/ and $EmailVacationFrom ne "") {return "vac_TO_DATE_INCORRECT";}
914 + #Check not the same or From follows To.
915 + if ($EmailVacationTo ne "" and $EmailVacationTo eq $EmailVacationFrom) {return "vac_DATES_THE_SAME";}
916 + my $UnixFrom = mktime(0,0,0,$fromDay,$fromMonth,$fromYear);
917 + my $UnixTo = mktime(0,0,0,$toDay,$toMonth,$toYear);
918 + if ($UnixTo < $UnixFrom) {return "vac_TO_DATE_MUST_BE_LATER";}
919 +
920 +
921 + my $new_message = $q->param('VacText');
922 + my $vfile = "/home/e-smith/files/users/$user/.vacation.msg";
923 +
924 + my $fullname = $adb->get_prop($user, "FirstName") . " " .
925 + $adb->get_prop($user, "LastName");
926 +
927 + my $from = 'From:';
928 + my $away = $q->l('vac_AWAY_FROM_MAIL');
929 + my $return = $q->l('vac_ANSWER_TO_OBJECT_SENDER');
930 +
931 + my $vacation_text = "$from $fullname \<$user\@$domain\>\n"."Subject: $return\n".
932 + "\n$away \n"."\n--\n$fullname";
933 +
934 + my $reset = $vacation_text;
935 +
936 + # if exists and is not empty
937 + if (( -e $vfile ) && (! -z $vfile ))
938 + {
939 + open (VACATION, "<$vfile")
940 + or die "Error: Could not open file: $vfile\n";
941 + my @vacationTemp = <VACATION>;
942 + $vacation_text = join ("", @vacationTemp);
943 +
944 + close VACATION;
945 + }
946 +
947 + chomp $new_message;
948 +
949 + # reset msg to default,
950 + if ($new_message =~ /reset/)
951 + { $vacation_text = $reset; }
952 + else
953 + {
954 + #or save new_message
955 + unless ($new_message eq "")
956 + { $vacation_text = $new_message; }
957 + }
958 +
959 + # Strip out DOS Carriage Returns (CR)
960 + $vacation_text =~ s/\r//g;
961 +
962 + unlink $vfile;
963 + open (VACATION, ">$vfile")
964 + or die ("Error opening vacation message.\n");
965 +
966 + print VACATION "$vacation_text";
967 + close VACATION;
968 +
969 + esmith::util::chownFile($user, $user,
970 + "/home/e-smith/files/users/$user/.vacation.msg");
971 +
972 + $adb->set_prop($user, 'EmailVacation', $EmailVacation);
973 + $adb->set_prop($user, 'EmailVacationFrom', $EmailVacationFrom);
974 + $adb->set_prop($user, 'EmailVacationTo', $EmailVacationTo);
975 +
976 + #the first is more correct but is slower
977 + #system ("/sbin/e-smith/signal-event", "email-update", $user) == 0
978 + system ("/etc/e-smith/events/actions/qmail-update-user event $user") == 0
979 + or die ("Error occurred updating .qmail\n");
980 +
981 + if (($EmailVacation eq 'no') && ( -e "/home/e-smith/files/users/$user/.vacation"))
982 + {
983 + system ("/bin/rm /home/e-smith/files/users/$user/.vacation") == 0
984 + or die ("Error resetting vacation db.\n");
985 + }
986 +
987 + return "OK";
988 +}
989 +
990 +sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
991 +
992 +1;
993 diff -urN smeserver-vacation-1.1.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Uservacations/en.pm smeserver-vacation-1.1/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Uservacations/en.pm
994 --- smeserver-vacation-1.1.old/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Uservacations/en.pm 1970-01-01 01:00:00.000000000 +0100
995 +++ smeserver-vacation-1.1/root/usr/share/smanager/lib/SrvMngr/I18N/Modules/Uservacations/en.pm 2020-05-19 15:36:00.000000000 +0100
996 @@ -0,0 +1,63 @@
997 +package SrvMngr::I18N::Modules::Uservacations::en;
998 +use strict;
999 +use warnings;
1000 +use utf8;
1001 +use Mojo::Base 'SrvMngr::I18N';
1002 +
1003 +use SrvMngr::I18N::Modules::General::en;
1004 +
1005 +my %lexicon = (
1006 +'vac_User vacations' =>'User vacations',
1007 +'vac_Vacation Message' =>'Vacation Message',
1008 +'vac_FORM_TITLE' =>'Change user vacation settings',
1009 +'vac_DESCRIPTION' =>' You can modify a users vacation message by clicking
1010 + on the link to the right of their name below.
1011 +',
1012 +'vac_LABEL_VACATION' =>'Vacation',
1013 +'vac_NO_FORWARDS'=>'No users found for forwarding',
1014 +'vac_VACATION_FROM' =>'Vacation starts on <br>(YYYY-MM-DD)',
1015 +'vac_VACATION_TO' =>'Vacation finishes on <br>(YYYY-MM-DD)',
1016 +'vac_VACATION_FROM1' =>'Vacation starts on',
1017 +'vac_VACATION_TO1' =>'Vacation finishes on',
1018 +'vac_MESSAGE' =>'Vacation message',
1019 +'vac_VACATION_STATUS' =>'Enable vacation messages',
1020 +'vac_FROM' =>'From:',
1021 +'vac_SUBJECT' =>'Subject:',
1022 +'vac_AWAY_FROM_MAIL' =>'I will not be reading my mail for a while. Your mail regarding $SUBJECT will be read when I return.',
1023 +'vac_NO_USERS_IN_GRANTED_GROUPS' =>'There are no users in the group(s) that you are granted to manage.',
1024 +'vac_ANSWER_TO_OBJECT_SENDER' => 'Re: $SUBJECT - Away from my email ',
1025 +'vac_FROM_DATE_INCORRECT'=>'From date must have YYYYMMDD format',
1026 +'vac_TO_DATE_INCORRECT'=>'To date must have YYYYMMDD format',
1027 +'vac_DATES_THE_SAME'=>"The Start and Finish dates cannot be the same",
1028 +'vac_TO_DATE_MUST_BE_LATER'=>"The Finish dates cannot be earlier than the Start date",
1029 +'vac_SUCCESS'=>'Vacation message saved sucessfully',
1030 +'vac_MODIFY_DESCRIPTION' =>'
1031 + <p>
1032 + Enter a vacation message here. You can use $SUBJECT
1033 + anywhere in the text to be replaced with the subject line
1034 + from the email that activated the auto-reply.</p>
1035 +
1036 + <p>
1037 + This message must be composed of two parts separated by a blank line.
1038 + The first will be integrated into the headings of the email reply,
1039 + you must thus ensure you leave at least a blank line before typing your message.
1040 + The primary domain is added to the address automatically,or you can insert a virtual domain by replacing the domain part of the sender address
1041 + in the first line of the message with the virtual domain name (eg. replace the default From: user@primary.domain with From: user@virtual.domain).
1042 + To change the vacation message back to the default type reset.</p>
1043 + <p>
1044 + You can also fill out the Enable vacation on and Disable vacation on fields in order to
1045 + automatically enable and disable sending of the vacation message for this user account on the given dates.
1046 + </p>
1047 + <p>
1048 + The dates in the two fields must not be the same.<br>
1049 + 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.
1050 + </p>'
1051 +);
1052 +
1053 +our %Lexicon = (
1054 + %{ SrvMngr::I18N::Modules::General::en::Lexicon },
1055 + %lexicon
1056 +);
1057 +
1058 +
1059 +1;
1060 diff -urN smeserver-vacation-1.1.old/root/usr/share/smanager/themes/default/templates/partials/_vac_add.html.ep smeserver-vacation-1.1/root/usr/share/smanager/themes/default/templates/partials/_vac_add.html.ep
1061 --- smeserver-vacation-1.1.old/root/usr/share/smanager/themes/default/templates/partials/_vac_add.html.ep 1970-01-01 01:00:00.000000000 +0100
1062 +++ smeserver-vacation-1.1/root/usr/share/smanager/themes/default/templates/partials/_vac_add.html.ep 2020-05-19 15:36:00.000000000 +0100
1063 @@ -0,0 +1,54 @@
1064 +<div id='vac_add'>
1065 +
1066 + % my $btn = l('ADD');
1067 +
1068 + % if ($config->{debug} == 1) {
1069 + <p>
1070 + %= dumper $c->current_route
1071 + %= dumper $EmailVacation
1072 + </p>
1073 + % }
1074 +
1075 + %= form_for '/Uservacations2' => (method => 'POST') => begin
1076 +
1077 + <span class=label>
1078 + %=l 'ACCOUNT'
1079 + </span><span class=data>
1080 + %= $account
1081 + </span><br><br>
1082 + <span class=label>
1083 + %=l 'USER_NAME'
1084 + </span><span class=data>
1085 + %=$username
1086 + </span><br><br>
1087 + <span class=label>
1088 + %=$c->render_to_string(inline =>$c->l('vac_VACATION_FROM1'))
1089 + </span>
1090 + <span class=data>
1091 + %=date_field 'EmailVacationFrom' =>$EmailVacationFrom
1092 + </span><br><br>
1093 + <span class=label>
1094 + %=$c->render_to_string(inline =>$c->l('vac_VACATION_TO1'))
1095 + </span>
1096 + <span class=data>
1097 + %=date_field 'EmailVacationTo' =>$EmailVacationTo
1098 + </span><br><br>
1099 + <span class=label>
1100 + %=l 'vac_MESSAGE'
1101 + </span>
1102 + <span class=data>
1103 + %=text_area 'VacText' => $VacText, cols=>55, rows=>15
1104 + </span><br><br>
1105 + <span class=label>
1106 + %=l 'vac_VACATION_STATUS'
1107 + </span>
1108 + <span class=data>
1109 + % param EmailVacation => "$EmailVacation";
1110 + %=select_field EmailVacation =>[['Yes'=>'yes'],['No'=>'no']]
1111 + </span><br><br>
1112 + %= hidden_field 'account' => $account
1113 +
1114 + %= submit_button "$btn", class => 'action'
1115 + %end
1116 +
1117 +</div>
1118 diff -urN smeserver-vacation-1.1.old/root/usr/share/smanager/themes/default/templates/partials/_vac_list.html.ep smeserver-vacation-1.1/root/usr/share/smanager/themes/default/templates/partials/_vac_list.html.ep
1119 --- smeserver-vacation-1.1.old/root/usr/share/smanager/themes/default/templates/partials/_vac_list.html.ep 1970-01-01 01:00:00.000000000 +0100
1120 +++ smeserver-vacation-1.1/root/usr/share/smanager/themes/default/templates/partials/_vac_list.html.ep 2020-06-10 18:22:00.000000000 +0100
1121 @@ -0,0 +1,50 @@
1122 +<div id='vac_list'>
1123 +
1124 + %# my $btn = l('vac_CREATE_RULE');
1125 +
1126 + %= form_for '/Uservacations1' => (method => 'POST') => begin
1127 + <br><br>
1128 +
1129 + % if ($empty){
1130 + <br>
1131 + %=l 'vac_NO_FORWARDS'
1132 + % } else {
1133 + <table class="sme-border"><tbody>
1134 + <tr>
1135 + <th class='sme-border'>
1136 + %=l 'ACCOUNT'
1137 + </th>
1138 + <th class='sme-border'>
1139 + %=l 'USER_NAME'
1140 + </th>
1141 + <th class='sme-border'>
1142 + %=l 'vac_LABEL_VACATION'
1143 + </th>
1144 +
1145 + <th class='sme-border'>
1146 + %=$c->render_to_string(inline =>l('vac_VACATION_FROM'))
1147 + </th>
1148 + <th class='sme-border'>
1149 + %=$c->render_to_string(inline =>l('vac_VACATION_TO'))
1150 + </th>
1151 + <th class='sme-border' '>
1152 + %=l 'ACTION'
1153 + </th>
1154 + </tr>
1155 + % foreach my $vacation (@$vacations) {
1156 + <tr>
1157 + %= t td => (class => 'sme-border') => $vacation->{"User"}
1158 + %= t td => (class => 'sme-border') => $vacation->{"FullName"}
1159 + %= t td => (class => 'sme-border') => $vacation->{"status"}
1160 + %= t td => (class => 'sme-border') => $vacation->{"EmailVacationFrom"}
1161 + %= t td => (class => 'sme-border') => $vacation->{"EmailVacationTo"}
1162 + <td>
1163 + <a href="/smanager/Uservacations1?trt=ADD&account=<%= $vacation->{"User"}%>"><%=l 'MODIFY'%></a>
1164 + </td>
1165 + </tr>
1166 + %}
1167 + </tbody>
1168 + </table>
1169 + %}
1170 + % end
1171 +</div>
1172 diff -urN smeserver-vacation-1.1.old/root/usr/share/smanager/themes/default/templates/uservacations.html.ep smeserver-vacation-1.1/root/usr/share/smanager/themes/default/templates/uservacations.html.ep
1173 --- smeserver-vacation-1.1.old/root/usr/share/smanager/themes/default/templates/uservacations.html.ep 1970-01-01 01:00:00.000000000 +0100
1174 +++ smeserver-vacation-1.1/root/usr/share/smanager/themes/default/templates/uservacations.html.ep 2020-05-19 15:36:00.000000000 +0100
1175 @@ -0,0 +1,42 @@
1176 +% layout 'default', title => "Sme server 2 - User Vacations", share_dir => './';
1177 +
1178 +% content_for 'module' => begin
1179 +<div id="module">
1180 +
1181 + % if ($config->{debug} == 1) {
1182 + <p>
1183 + %= dumper $c->current_route
1184 + </p>
1185 + % }
1186 +
1187 + <h1><%=$title%></h1>
1188 + %= $modul
1189 +
1190 + %if ($vac_datas->{first}) {
1191 + <br>
1192 + %=$c->render_to_string(inline =>$c->l($vac_datas->{first}))
1193 +
1194 + %} elsif ($vac_datas->{success}) {
1195 + <div class='"success"'>
1196 + <h2> Operation Status Report</h2>
1197 + %= $c->l($vac_datas->{success});
1198 + </div>
1199 +
1200 + %} elsif ($vac_datas->{error}) {
1201 + <div class='sme-error'>
1202 + <h2> Operation Status Report - error</h2>
1203 + %= $c->l($vac_datas->{error});
1204 + </div>
1205 + %}
1206 +
1207 +
1208 + % if ($vac_datas->{trt} eq 'ADD') {
1209 + %= include 'partials/_vac_add'
1210 + %} elsif ($vac_datas->{trt} eq 'ADD1') {
1211 + %= include 'partials/_vac_add'
1212 + %} else {
1213 + %= include 'partials/_vac_list'
1214 + %}
1215 +
1216 +</div>
1217 +%end

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed