Unverified Commit 44c5d1c6 authored by IKEDA Soji's avatar IKEDA Soji Committed by GitHub
Browse files

Merge pull request #204 from xavierba/css_dir

Allow configurable css and pictures directories by xavierba
parents a248c462 afe2e4ef
......@@ -61,6 +61,8 @@ if test "$fhs" = "yes"; then
execcgidir=$libdir/sympa/cgi
expldir=$localstatedir/lib/sympa/list_data
staticdir=$localstatedir/lib/sympa/static_content
cssdir=$localstatedir/lib/sympa/static_content/css
picturesdir=$localstatedir/lib/sympa/static_content/pictures
spooldir=$localstatedir/spool/sympa
arcdir=$localstatedir/lib/sympa/arc
bouncedir=$localstatedir/lib/sympa/bounce
......@@ -94,6 +96,8 @@ else
expldir=$prefix/list_data
spooldir=$prefix/spool
staticdir=$prefix/static_content
cssdir=$prefix/static_content/css
picturesdir=$prefix/static_content/pictures
arcdir=$prefix/arc
bouncedir=$prefix/bounce
confdir=/etc/sympa
......@@ -112,6 +116,8 @@ AC_SUBST(execcgidir)
AC_SUBST(expldir)
AC_SUBST(spooldir)
AC_SUBST(staticdir)
AC_SUBST(cssdir)
AC_SUBST(picturesdir)
AC_SUBST(arcdir)
AC_SUBST(bouncedir)
AC_SUBST(localedir)
......@@ -335,6 +341,24 @@ AC_ARG_WITH(
[staticdir="$withval"]
)
AC_ARG_WITH(
cssdir,
AS_HELP_STRING(
[--with-cssdir=DIR],
[generated css @<:@PREFIX/static_content/css@:>@]
),
[cssdir="$withval"]
)
AC_ARG_WITH(
picturesdir,
AS_HELP_STRING(
[--with-picturesdir=DIR],
[subscribers pictures @<:@PREFIX/static_content/pictures@:>@]
),
[picturesdir="$withval"]
)
CONFIG=$confdir/sympa.conf
AC_SUBST(CONFIG)
WWSCONFIG=$confdir/wwsympa.conf
......
......@@ -854,7 +854,7 @@ sub checkfiles {
# Create pictures dir if useful for each robot.
foreach my $robot (keys %{$Conf{'robots'}}) {
my $dir = get_robot_conf($robot, 'static_content_path');
my $dir = get_robot_conf($robot, 'pictures_path');
if ($dir ne '' && -d $dir) {
unless (-f $dir . '/index.html') {
unless (open(FF, ">$dir" . '/index.html')) {
......@@ -870,8 +870,7 @@ sub checkfiles {
# create picture dir
if (get_robot_conf($robot, 'pictures_feature') eq 'on') {
my $pictures_dir =
get_robot_conf($robot, 'static_content_path')
. '/pictures';
get_robot_conf($robot, 'pictures_path');
unless (-d $pictures_dir) {
unless (mkdir($pictures_dir, 0775)) {
$log->syslog('err', 'Unable to create directory %s',
......@@ -2037,11 +2036,11 @@ sub _infer_robot_parameter_values {
my $final_separator = '';
$final_separator = '/' if ($param->{'config_hash'}{'robot_name'});
$param->{'config_hash'}{'css_url'} ||=
$param->{'config_hash'}{'static_content_url'} . '/css'
$param->{'config_hash'}{'css_url'}
. $final_separator
. $param->{'config_hash'}{'robot_name'};
$param->{'config_hash'}{'css_path'} ||=
$param->{'config_hash'}{'static_content_path'} . '/css'
$param->{'config_hash'}{'css_path'}
. $final_separator
. $param->{'config_hash'}{'robot_name'};
......
......@@ -220,6 +220,8 @@ Sympa/Constants.pm: Sympa/Constants.pm.in Makefile
-e 's|--modulesdir--|$(modulesdir)|' \
-e 's|--defaultdir--|$(defaultdir)|' \
-e 's|--staticdir--|$(staticdir)|' \
-e 's|--cssdir--|$(cssdir)|' \
-e 's|--picturesdir--|$(picturesdir)|' \
-e 's|--arcdir--|$(arcdir)|' \
-e 's|--bouncedir--|$(bouncedir)|' \
< $(srcdir)/$@.in > $@
......
......@@ -1306,6 +1306,7 @@ our @params = (
'optional' => '1',
},
{ 'name' => 'css_path',
'default_s' => '$CSSDIR',
'gettext_id' => 'Directory for static style sheets (CSS)',
'gettext_comment' =>
'After an upgrade, static CSS files are upgraded with the newly installed "css.tt2" template. Therefore, this is not a good place to store customized CSS files.',
......@@ -1313,12 +1314,25 @@ our @params = (
'vhost' => '1',
},
{ 'name' => 'css_url',
'default' => '/static-sympa/css',
'gettext_id' => 'URL for style sheets (CSS)',
'gettext_comment' =>
'To use auto-generated static CSS, HTTP server have to map it with "css_path".',
'optional' => '1',
'vhost' => '1',
},
{ 'name' => 'pictures_path',
'default_s' => '$PICTURESDIR',
'gettext_id' => 'Directory for subscribers pictures',
'vhost' => '1',
},
{ 'name' => 'pictures_url',
'default' => '/static-sympa/pictures',
'gettext_id' => 'URL for subscribers pictures',
'gettext_comment' =>
'HTTP server have to map it with "pictures_path" directory.',
'vhost' => '1',
},
{ 'name' => 'color_0',
'gettext_id' => 'Colors for web interface',
'gettext_comment' =>
......
......@@ -34,19 +34,21 @@ use constant CONFIG => '--CONFIG--';
use constant WWSCONFIG => '--WWSCONFIG--';
use constant SENDMAIL_ALIASES => '--SENDMAIL_ALIASES--';
use constant PIDDIR => '--piddir--';
use constant EXPLDIR => '--expldir--';
use constant SPOOLDIR => '--spooldir--';
use constant SYSCONFDIR => '--sysconfdir--';
use constant LOCALEDIR => '--localedir--';
use constant LIBEXECDIR => '--libexecdir--';
use constant SBINDIR => '--sbindir--';
use constant SCRIPTDIR => '--scriptdir--';
use constant MODULEDIR => '--modulesdir--';
use constant DEFAULTDIR => '--defaultdir--';
use constant STATICDIR => '--staticdir--';
use constant ARCDIR => '--arcdir--';
use constant BOUNCEDIR => '--bouncedir--';
use constant PIDDIR => '--piddir--';
use constant EXPLDIR => '--expldir--';
use constant SPOOLDIR => '--spooldir--';
use constant SYSCONFDIR => '--sysconfdir--';
use constant LOCALEDIR => '--localedir--';
use constant LIBEXECDIR => '--libexecdir--';
use constant SBINDIR => '--sbindir--';
use constant SCRIPTDIR => '--scriptdir--';
use constant MODULEDIR => '--modulesdir--';
use constant DEFAULTDIR => '--defaultdir--';
use constant STATICDIR => '--staticdir--';
use constant CSSDIR => '--cssdir--';
use constant PICTURESDIR => '--picturesdir--';
use constant ARCDIR => '--arcdir--';
use constant BOUNCEDIR => '--bouncedir--';
use constant EMAIL_LEN => 100;
use constant FAMILY_LEN => 50;
......
......@@ -1773,16 +1773,16 @@ sub send_notify_to_owner {
sub get_picture_path {
my $self = shift;
return join '/',
Conf::get_robot_conf($self->{'domain'}, 'static_content_path'),
'pictures', $self->get_id, @_;
Conf::get_robot_conf($self->{'domain'}, 'pictures_path'),
$self->get_id, @_;
}
# Note: This would be moved to Robot package.
sub get_picture_url {
my $self = shift;
return join '/',
Conf::get_robot_conf($self->{'domain'}, 'static_content_url'),
'pictures', $self->get_id, @_;
Conf::get_robot_conf($self->{'domain'}, 'pictures_url'),
$self->get_id, @_;
}
=over 4
......
......@@ -414,8 +414,15 @@ EXTRA_DIST = $(nobase_static_DATA)
install-data-hook:
cd $(DESTDIR)$(staticdir); \
rm -f external/foundation/js/vendor/jquery.js
@echo "Creating static_content directory"
-@for dir in $(staticdir); do \
if [ ! -d $(DESTDIR)$$dir ] ; then \
echo "Creating $(DESTDIR)$$dir"; \
$(INSTALL) -d -m 644 $(DESTDIR)$$dir; \
fi; \
done
@echo "Creating writable directories"
-@for dir in $(staticdir)/css $(staticdir)/pictures; do \
-@for dir in $(cssdir) $(picturesdir); do \
if [ ! -d $(DESTDIR)$$dir ] ; then \
echo "Creating $(DESTDIR)$$dir"; \
$(INSTALL) -d -m 755 $(DESTDIR)$$dir; \
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment