set_lx_office_erp_web_admin_password() {
- if ! [ -f /etc/lx-office-erp/lx_office.conf ] ; then
- cp /etc/lx-office-erp/lx_office.conf.default /etc/lx-office-erp/lx_office.conf
- fi
db_get lx-office-erp/admin-password
ADMINPASSWORD="$RET"
- cat /etc/lx-office-erp/lx_office.conf | \
- sed --expression "s/admin_password = /admin_password = $ADMINPASSWORD/g" \
+ cat /etc/lx-office-erp/authentication.pl | \
+ sed --expression "s/{admin_password} = /{admin_password} = '$ADMINPASSWORD';#/g" \
> /tmp/1.txt
- mv /tmp/1.txt /etc/lx-office-erp/lx_office.conf
+ mv /tmp/1.txt /etc/lx-office-erp/authentication.pl
}
db_get lx-office-erp/lx-office-erp-user-postgresql-password
PASSWORD="$RET"
- cat /etc/lx-office-erp/lx_office.conf | \
- sed --expression "s/^password = /password = $PASSWORD/g" \
+ cat /etc/lx-office-erp/authentication.pl | \
+ sed --expression "s/'password' => /'password' => '$PASSWORD', #/g" \
> /tmp/1.txt
cat /tmp/1.txt | \
sed --expression "s/^user = postgres/user = lxoffice/g" \
- > /etc/lx-office-erp/lx_office.conf
+ > /etc/lx-office-erp/authentication.pl
}
set_user_rights() {
chown -R www-data:www-data /usr/lib/lx-office-erp/users
chown -R www-data:www-data /usr/lib/lx-office-erp/templates
- chown www-data:www-data /etc/lx-office-erp/lx_office.conf
+ chown www-data:www-data /etc/lx-office-erp/lx-erp.conf
+ chown www-data:www-data /etc/lx-office-erp/authentication.pl
+ chown www-data:www-data /etc/lx-office-erp/console.conf
chown www-data:www-data /usr/lib/lx-office-erp/menu.ini
- chmod 0600 /etc/lx-office-erp/lx_office.conf
+ chmod 0600 /etc/lx-office-erp/lx-erp.conf
+ chmod 0600 /etc/lx-office-erp/authentication.pl
}
disable_ipv6_on_lo_interface() {
}
mk_new_config() {
- if ! [ -f /etc/lx-office-erp/lx_office.conf ] ; then
- cp /etc/lx-office-erp/lx_office.conf.default /etc/lx-office-erp/lx_office.conf
+ if ! [ -f /etc/lx-office-erp/lx-erp.conf ] ; then
+ cp /etc/lx-office-erp/lx-erp.conf.default /etc/lx-office-erp/lx-erp.conf
+ fi
+ if ! [ -f /etc/lx-office-erp/authentication.pl ] ; then
+ cp /etc/lx-office-erp/authentication.pl.default /etc/lx-office-erp/authentication.pl
+ fi
+ if ! [ -f /etc/lx-office-erp/console.conf ] ; then
+ cp /etc/lx-office-erp/console.conf.default /etc/lx-office-erp/console.conf
fi
}
mk_links() {
- if ! [ -f /usr/lib/lx-office-erp/config/lx_office.conf ] ; then
- ln -s /etc/lx-office-erp/lx_office.conf /usr/lib/lx-office-erp/config/lx_office.conf
- fi;
- if ! [ -f /usr/lib/lx-office-erp/config/lx_office.conf.default ] ; then
- ln -s /etc/lx-office-erp/lx_office.conf.default /usr/lib/lx-office-erp/config/lx_office.conf.default
+ if ! [ -f /usr/lib/lx-office-erp/config/lx-erp.conf ] ; then
+ ln -s /etc/lx-office-erp/lx-erp.conf /usr/lib/lx-office-erp/config/lx-erp.conf
fi;
- if [ -e /etc/lx-office-erp/authentication.pl ] ; then
- rm /etc/lx-office-erp/authentication.pl
+ if ! [ -f /usr/lib/lx-office-erp/config/authentication.pl ] ; then
+ ln -s /etc/lx-office-erp/authentication.pl /usr/lib/lx-office-erp/config/authentication.pl
fi
if [ -e /etc/apache2 ] ; then
if ! [ -f /etc/apache2/conf.d/lx-office-erp.apache2.conf ] ; then
use parent qw(Rose::Object);
use Carp;
+use IO::File;
use List::Util qw(first);
#
return $output;
}
+sub send_file {
+ my ($self, $file_name, %params) = @_;
+
+ my $file = IO::File->new($file_name, 'r') || croak("Cannot open file '${file_name}'");
+ my $content_type = $params{type} || 'application/octet_stream';
+ my $attachment_name = $params{name} || $file_name;
+ $attachment_name =~ s:.*//::g;
+
+ print $::form->create_http_response(content_type => $content_type,
+ content_disposition => 'attachment; filename="' . $attachment_name . '"',
+ content_length => -s $file);
+
+ $::locale->with_raw_io(\*STDOUT, sub { print while <$file> });
+ $file->close;
+}
+
#
# Before/after run hooks
#
$self->render('todo/single_item', { type => 'js' },
item => $employee->most_important_todo_item);
+=item C<send_file $file_name, [%params]>
+
+Sends the file C<$file_name> to the browser including appropriate HTTP
+headers for a download. C<%params> can include the following:
+
+=over 2
+
+=item * C<type> -- the file's content type; defaults to
+'application/octet_stream'
+
+=item * C<name> -- the name presented to the browser; defaults to
+C<$file_name>
+
+=back
+
=item C<url_for $url>
=item C<url_for $params>