.*?<\/pre>/$pretty_json<\/pre>/s;
}
return [
(
(
$description && (
$k =~ /level_navigation|leftmenu_width/ ? undef :
'')
) .
'' .
$theme_text{$k} .
''
.
(
$description && (
$k =~ /level_navigation|leftmenu_width/ ?
'' . $description . '
' :
$k =~ /sysinfo_theme_updates/ &&
''
))
),
"$v"];
}
sub theme_controls
{
my ($section) = @_;
my $changelog_contents = read_file_contents($root_directory . '/' . $current_theme . "/CHANGELOG.md");
my @changelog_stable_versions =
($changelog_contents =~ /####\s+Version\s+((?|\d+.\d+\s+|\d+.\d+.\d+\s+)\([\d\w\s,]+\))/g);
my $stable_versions_dropdown_submenu;
my $stable_versions_dropdown_submenu_content;
if (@changelog_stable_versions) {
$stable_versions_dropdown_submenu = ' class="dropdown-submenu prelocked clickable"';
$stable_versions_dropdown_submenu_content = '';
}
my $update_dropdown = (
(&webmin_user_is_admin() && $section eq $theme_text{'settings_right_soft_updates_page_options'}) ?
' '
:
'');
return (
"",
(&webmin_user_is_admin() ?
"" :
""
));
}
sub settings_get_select_navigation_color
{
my ($v, $k) = @_;
return '';
}
sub settings_get_select_editor_color
{
my ($v, $k) = @_;
return '';
}
sub settings_get_select_document_title
{
my ($v, $k) = @_;
my $prod_name =
get_product_name() ne 'webmin' ? $theme_text{'theme_xhred_titles_um'} : $theme_text{'theme_xhred_titles_wm'};
return '';
}
sub settings_get_select_default_module
{
my ($name, $value) = @_;
my @modules = get_available_module_infos();
@modules = grep {!$_->{'hidden'} && !$_->{'webmin_hidden'}} @modules;
if ($get_user_level eq '3') {
@modules = grep {$_->{'dir'} ne 'mailbox'} @modules;
}
my $select = ui_select($name,
$value,
[["", $theme_text{'theme_xhred_titles_dashboard'}],
map {[$_->{'dir'}, $_->{'desc'}]}
sort {$a->{'desc'} cmp $b->{'desc'}} @modules
]);
return $select;
}
sub theme_settings_data
{
my @settings = theme_settings_raw();
my @excluded_options = theme_settings_filter();
my @sections;
my @config_quick_access;
# Format options for display and build quick access filter
foreach my $sections (0 .. $#settings) {
foreach my $section ($settings[$sections]) {
for (my $i = 0; $i < scalar(@{ $section->[0]->{'data'} }); $i++) {
my $key_value = @{ $section->[0]->{'data'} }[$i];
my @key_value_formated =
theme_settings_format(@{ $section->[0]->{'data'} }[$i],
$theme_config{ @{ $section->[0]->{'data'} }[$i] },
\@excluded_options);
if (!$key_value_formated[0][0]) {
delete $section->[0]->{'data'}[$i];
next;
}
$section->[0]->{'data'}[$i] = [$key_value_formated[0][0], $key_value_formated[0][1]];
$key_value_formated[0][0] =~ s/.*?<\/div>//gm;
$key_value_formated[0][0] =~ s/(.*?)<\/span>/$1/gm;
$key_value_formated[0][0] =~ s/.*?<\/span>//gm;
$key_value_formated[0][0] =~ s/.*?<\/sup>//gm;
$key_value_formated[0][0] =~ s/(.*?)<\/code>.*/$1/;
$key_value_formated[0][0] = entities_to_ascii($key_value_formated[0][0]);
push(@config_quick_access,
{ 'value' => $key_value_formated[0][0],
'key' => $key_value,
'section' => $section->[0]->{'id'},
'data' => { category => $section->[0]->{'title'} }
});
}
# Remove undefined values which where previously discarded
@{ $section->[0]->{'data'} } = grep(defined, @{ $section->[0]->{'data'} });
# If section happened to be empty, remove it as well
if (!scalar(@{ $section->[0]->{'data'} })) {
delete $settings[$sections];
} else {
push(@sections, [$section->[0]->{'id'}, $section->[0]->{'title'}]);
}
}
}
return { 'sections' => \@sections,
'config_quick_access' => \@config_quick_access,
'settings' => \@settings,
'excluded_options' => \@excluded_options };
}
1;