template: custom themes for agenda
For agenda a custom theme can be configured in locations/theme. Templates are read from the subdirectory "templates/<theme>/". The default theme is "default". All Templates are moved to templates/default.
This commit is contained in:
@@ -169,8 +169,6 @@ sub setRelativeUrls {
|
|||||||
return $params;
|
return $params;
|
||||||
}
|
}
|
||||||
|
|
||||||
#requires read config
|
|
||||||
#TODO:add config
|
|
||||||
sub check($;$$) {
|
sub check($;$$) {
|
||||||
my $config = shift;
|
my $config = shift;
|
||||||
my $template = shift || '';
|
my $template = shift || '';
|
||||||
@@ -195,12 +193,14 @@ sub check($;$$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$template = ( split( /\//, $template ) )[-1];
|
$template = ( split( /\//, $template ) )[-1];
|
||||||
my $cwd = Cwd::getcwd();
|
|
||||||
|
|
||||||
$template .= '.html' unless ( $template =~ /\./ );
|
$template .= '.html' unless ( $template =~ /\./ );
|
||||||
log::error( $config, "template not found: '$cwd/$template'" )
|
my $dir = "templates";
|
||||||
unless -e $cwd . '/templates/' . $template;
|
my $cwd = Cwd::getcwd();
|
||||||
$template = $cwd . '/templates/' . $template;
|
my $theme = $config->{locations}->{theme} //= 'default';
|
||||||
|
$dir .= "/$theme" if $cwd =~ m{/agenda$} && $theme;
|
||||||
|
log::error( $config, "template not found: '$dir'" )
|
||||||
|
unless -e "$cwd/$dir/$template";
|
||||||
|
$template = "$cwd/$dir/$template";
|
||||||
|
|
||||||
return $template;
|
return $template;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ domain ${DOMAIN}
|
|||||||
# multi language support
|
# multi language support
|
||||||
admin_pot_dir ${BASE_DIR}/agenda/planung/pot/
|
admin_pot_dir ${BASE_DIR}/agenda/planung/pot/
|
||||||
email info@${DOMAIN}
|
email info@${DOMAIN}
|
||||||
|
theme default
|
||||||
</locations>
|
</locations>
|
||||||
|
|
||||||
<permissions>
|
<permissions>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
Access-Control-Allow-Origin: *
|
Access-Control-Allow-Origin: *
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<TMPL_IF extern_access><TMPL_INCLUDE ../index.html>gesucht und gefunden...<TMPL_ELSE>
|
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<TMPL_IF no_result>
|
<TMPL_IF no_result>
|
||||||
@@ -90,5 +89,3 @@ Access-Control-Allow-Origin: *
|
|||||||
</TMPL_LOOP>
|
</TMPL_LOOP>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
</TMPL_IF>
|
|
||||||
|
|
||||||
@@ -3,7 +3,6 @@
|
|||||||
Access-Control-Allow-Origin: *
|
Access-Control-Allow-Origin: *
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<TMPL_IF extern_access><TMPL_INCLUDE ../index.html>gesucht und gefunden...<TMPL_ELSE>
|
|
||||||
<html>
|
<html>
|
||||||
<body>
|
<body>
|
||||||
<TMPL_IF no_result>
|
<TMPL_IF no_result>
|
||||||
@@ -77,7 +76,6 @@ Access-Control-Allow-Origin: *
|
|||||||
<TMPL_UNLESS __last__><hr /></TMPL_UNLESS>
|
<TMPL_UNLESS __last__><hr /></TMPL_UNLESS>
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
</TMPL_LOOP>
|
</TMPL_LOOP>
|
||||||
</TMPL_IF>
|
|
||||||
|
|
||||||
<!--end of content -->
|
<!--end of content -->
|
||||||
|
|
||||||
Reference in New Issue
Block a user