diff --git a/createlinks b/createlinks index 0387dbf..65db52d 100644 --- a/createlinks +++ b/createlinks @@ -8,6 +8,7 @@ $event = 'smeserver-mailstats-update'; foreach my $file (qw( /etc/systemd/system-preset/49-koozali.preset /etc/e-smith/sql/init/99smeserver-mailstats.sql + /etc/httpd/conf/httpd.conf )) { templates2events( $file, $event ); @@ -18,7 +19,7 @@ event_link('systemd-reload', $event, '50'); #action specific to this package #event_link('action', $event, '30'); #services we need to restart -#safe_symlink('restart', 'root/etc/e-smith/events/$event/services2adjust/) +safe_symlink('restart', "root/etc/e-smith/events/$event/services2adjust/httpd-e-smith"); #and Server Mmanager panel link #panel_link('somefunction', 'manager'); diff --git a/root/opt/mailstats/templates/mailstats.html.pt b/root/opt/mailstats/templates/mailstats.html.pt index c9c598b..49d6a77 100644 --- a/root/opt/mailstats/templates/mailstats.html.pt +++ b/root/opt/mailstats/templates/mailstats.html.pt @@ -1,7 +1,7 @@ SMEServer Mailstats @@ -39,28 +39,27 @@ +

${title}


-
- - - - - - - - - - - - - - - -
Date/TimeHeader
TotalsPercentHourCell
-
+ + + + + + + + + + + + + + + +
Date/TimeHeader
TotalsPercentHourCell

${version}
@@ -78,6 +77,6 @@ src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />

- +
diff --git a/root/usr/bin/mailstats.py b/root/usr/bin/mailstats.py index c9b1307..4d06297 100644 --- a/root/usr/bin/mailstats.py +++ b/root/usr/bin/mailstats.py @@ -588,7 +588,14 @@ def send_email(subject, from_email, to_email, smtp_server, smtp_port, HTML_conte if smtp_user and smtp_password: server.login(smtp_user, smtp_password) # Authenticate only if credentials are provided server.sendmail(from_email, to_email, msg.as_string()) - + +def replace_between(text, start, end, replacement): + # Escaping start and end in case they contain special regex characters + pattern = re.escape(start) + '.*?' + re.escape(end) + # Using re.DOTALL to match any character including newline + replaced_text = re.sub(pattern, replacement, text, flags=re.DOTALL) + return replaced_text + if __name__ == "__main__": try: chameleon_version = pkg_resources.get_distribution("Chameleon").version @@ -897,7 +904,7 @@ if __name__ == "__main__": previous_date_str = previous_date.strftime(day_format) navigation_str_html = "
\ Previous\ -\ +\ Next\
" template = PageTemplate(navigation_str_html) @@ -923,6 +930,9 @@ if __name__ == "__main__": # Send html email (default)) filepath = html_page_dir+"mailstats_for_"+formatted_yesterday+".html" html_content = read_html_from_file(filepath) + # Replace the Navigation by a "See in browser" prompt + replace_str = f"
See in browser
" + html_content = replace_between(html_content, "
", ">Next
", replace_str) if EmailTextOrHTML == "Text" or EmailTextOrHTML == "Both": filepath = html_page_dir+"mailstats_for_"+formatted_yesterday+".txt" text_content = read_text_from_file(filepath)