|
|
|
@ -259,99 +259,6 @@ sub _buildApplicationHash { |
|
|
|
|
return $applicationHash; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
## @method string _displayConfCategory(string catname, hashref cathash, int catlevel) |
|
|
|
|
# Creates and returns HTML code for a category (recursive). |
|
|
|
|
# @param catname Category name |
|
|
|
|
# @param cathash Hash of category elements |
|
|
|
|
# @param catlevel Category level |
|
|
|
|
# @return HTML string |
|
|
|
|
sub _displayConfCategory { |
|
|
|
|
my ( $self, $catname, $cathash, $catlevel ) = @_; |
|
|
|
|
my $key; |
|
|
|
|
my $subcat = ''; |
|
|
|
|
my $apps = ''; |
|
|
|
|
my $apphash = {}; |
|
|
|
|
|
|
|
|
|
# Increase category level |
|
|
|
|
$catlevel++; |
|
|
|
|
|
|
|
|
|
# Search for subcategory or applications |
|
|
|
|
foreach $key ( sort keys %$cathash ) { |
|
|
|
|
next if $key =~ /(type|options|catname)/; |
|
|
|
|
if ( $cathash->{$key}->{type} ) { |
|
|
|
|
if ( $cathash->{$key}->{type} eq "category" ) { |
|
|
|
|
$subcat .= |
|
|
|
|
$self->_displayConfCategory( $key, $cathash->{$key}, |
|
|
|
|
$catlevel ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Extract applications from hash |
|
|
|
|
elsif ( $cathash->{$key}->{type} eq "application" ) { |
|
|
|
|
$apphash->{$key} = $cathash->{$key}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# applications list |
|
|
|
|
if ( scalar keys %$apphash > 0 ) { |
|
|
|
|
foreach $key ( sort keys %$apphash ) { |
|
|
|
|
$apps .= $self->_displayConfApplication( $key, $apphash->{$key} ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $self->loadTemplate( |
|
|
|
|
'menuCat', |
|
|
|
|
params => { |
|
|
|
|
class => "cat-level-$catlevel", |
|
|
|
|
catname => $catname // '', |
|
|
|
|
apps => $apps, |
|
|
|
|
subcat => $subcat, |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
## @method private string _displayConfApplication(string appid, hashref apphash) |
|
|
|
|
# Creates HTML code for an application. |
|
|
|
|
# @param $appid Application ID |
|
|
|
|
# @param $apphash Hash of application elements |
|
|
|
|
# @return HTML string |
|
|
|
|
sub _displayConfApplication { |
|
|
|
|
my ( $self, $appid, $apphash ) = @_; |
|
|
|
|
my $subapp; |
|
|
|
|
my $subapphash = {}; |
|
|
|
|
my $key; |
|
|
|
|
|
|
|
|
|
# Get application items |
|
|
|
|
my $appname = $apphash->{options}->{name} || $appid; |
|
|
|
|
my $appuri = $apphash->{options}->{uri} || ""; |
|
|
|
|
|
|
|
|
|
# Detect sub applications |
|
|
|
|
foreach $key ( sort keys %$apphash ) { |
|
|
|
|
next if $key =~ /(type|options|catname)/; |
|
|
|
|
if ( $apphash->{$key}->{type} eq "application" ) { |
|
|
|
|
$subapphash->{$key} = $apphash->{$key}; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
# Display sub applications |
|
|
|
|
if ( scalar keys %$subapphash > 0 ) { |
|
|
|
|
foreach $key ( sort keys %$subapphash ) { |
|
|
|
|
$subapp .= |
|
|
|
|
$self->_displayConfApplication( $key, $subapphash->{$key} ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $self->loadTemplate( |
|
|
|
|
'menuApp', |
|
|
|
|
params => { |
|
|
|
|
id => $appid, |
|
|
|
|
uri => $apphash->{options}->{uri} // '', |
|
|
|
|
name => $apphash->{options}->{name} || $appid, |
|
|
|
|
subapp => $subapp, |
|
|
|
|
} |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
## @method private string _filter(hashref apphash) |
|
|
|
|
# Duplicate hash reference |
|
|
|
|
# Remove unauthorized menu elements |
|
|
|
|