fix template configuration

This commit is contained in:
Milan
2018-09-06 23:06:48 +02:00
parent 2481490e7d
commit e043493847
30 changed files with 4482 additions and 4487 deletions

View File

@@ -5,7 +5,6 @@ use strict;
use Data::Dumper;
use URI::Escape();
use Encode();
use params();
use config();
@@ -29,12 +28,12 @@ my ( $user, $expires ) = auth::get_user( $cgi, $config );
return if ( ( !defined $user ) || ( $user eq '' ) );
my $user_presets = uac::get_user_presets(
$config,
{
user => $user,
project_id => $params->{project_id},
studio_id => $params->{studio_id}
}
$config,
{
user => $user,
project_id => $params->{project_id},
studio_id => $params->{studio_id}
}
);
$params->{default_studio_id} = $user_presets->{studio_id};
$params->{studio_id} = $params->{default_studio_id}
@@ -43,11 +42,11 @@ $params->{project_id} = $user_presets->{project_id}
if ( ( !( defined $params->{action} ) ) || ( $params->{action} eq '' ) || ( $params->{action} eq 'login' ) );
my $request = {
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params($params),
},
url => $ENV{QUERY_STRING} || '',
params => {
original => $params,
checked => check_params( $config, $params ),
},
};
$request = uac::prepare_request( $request, $user_presets );
@@ -56,7 +55,7 @@ $params = $request->{params}->{checked};
#process header
my $headerParams = uac::set_template_permissions( $request->{permissions}, $params );
$headerParams->{loc} = localization::get( $config, { user => $user, file => 'menu' } );
template::process($config, 'print', template::check($config, 'default.html'), $headerParams );
template::process( $config, 'print', template::check( $config, 'default.html' ), $headerParams );
return unless uac::check( $config, $params, $user_presets ) == 1;
my $toc = $headerParams->{loc}->{toc};
@@ -129,13 +128,13 @@ $( document ).ready(function() {
print markup::creole_to_html( getHelp( $headerParams->{loc}->{region} ) );
sub getHelp {
my $region = shift;
return getGermanHelp() if $region eq 'de';
return getEnglishHelp();
my $region = shift;
return getGermanHelp() if $region eq 'de';
return getEnglishHelp();
}
sub getGermanHelp {
return q{
return q{
<div id="toc"><h1 class="hide">Inhaltsverzeichnis</h1></div>
@@ -379,7 +378,7 @@ Folgende Status-Felder gibt es:
}
sub getEnglishHelp {
return q{
return q{
<div id="toc"><h1 class="hide">Table of Contents</h1></div>
= Menu
@@ -617,29 +616,30 @@ There are following status fields:
}
sub check_params {
my $params = shift;
my $config = shift;
my $params = shift;
my $checked = {};
my $checked = {};
my $debug = $params->{debug} || '';
if ( $debug =~ /([a-z\_\,]+)/ ) {
$debug = $1;
}
$checked->{debug} = $debug;
my $debug = $params->{debug} || '';
if ( $debug =~ /([a-z\_\,]+)/ ) {
$debug = $1;
}
$checked->{debug} = $debug;
#numeric values
$checked->{exclude} = 0;
for my $param ( 'id', 'project_id', 'studio_id', 'default_studio_id' ) {
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
$checked->{$param} = $params->{$param};
}
}
if ( defined $checked->{studio_id} ) {
$checked->{default_studio_id} = $checked->{studio_id};
} else {
$checked->{studio_id} = -1;
}
#numeric values
$checked->{exclude} = 0;
for my $param ( 'id', 'project_id', 'studio_id', 'default_studio_id' ) {
if ( ( defined $params->{$param} ) && ( $params->{$param} =~ /^\d+$/ ) ) {
$checked->{$param} = $params->{$param};
}
}
if ( defined $checked->{studio_id} ) {
$checked->{default_studio_id} = $checked->{studio_id};
} else {
$checked->{studio_id} = -1;
}
return $checked;
return $checked;
}