Skip to content

Commit

Permalink
Add support for new announcement system
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Nov 14, 2018
1 parent a38b73d commit f14e4bc
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 29 deletions.
38 changes: 24 additions & 14 deletions authentic-lib.pm
Original file line number Diff line number Diff line change
Expand Up @@ -340,18 +340,23 @@ sub print_sysinfo_link

sub get_sysinfo_warning
{
my (@info) = @_;
my ($info_ref) = @_;
my $returned_data = '';

# Show notifications first
@info =
sort {($b->{'type'} eq 'warning') <=> ($a->{'type'} eq 'warning')} @info;
$returned_data .= '<br>';
foreach my $info (@info) {
if ($info->{'type'} eq 'warning') {
$returned_data .= replace("ui_submit ui_form_end_submit",
"btn-tiny ui_submit ui_form_end_submit",
&ui_alert_box($info->{'warning'}, $info->{'level'} || 'warn', undef, 1));
if (ref($info_ref)) {
@{$info_ref} =
sort {($b->{'type'} eq 'warning') <=> ($a->{'type'} eq 'warning')} @{$info_ref};
$returned_data .= '<br>';
foreach my $info (@{$info_ref}) {
if ($info->{'type'} eq 'warning') {
$returned_data .= replace("ui_submit ui_form_end_submit",
"btn-tiny ui_submit ui_form_end_submit",
&ui_alert_box($info->{'warning'}, $info->{'level'} || 'warn',
undef, 1,
$info->{'desc'} || undef
));
}
}
}
return $returned_data;
Expand All @@ -370,6 +375,7 @@ sub get_extended_sysinfo
$info->{'type'} ne 'link' &&
$info->{'module'} ne 'mailbox' &&
$info->{'module'} ne 'system-status' &&
$info->{'type'} ne 'warning' &&
$a->{'type'} ne 'warning' &&
$b->{'type'} ne 'warning')
{
Expand All @@ -383,14 +389,15 @@ sub get_extended_sysinfo
}

if ($info->{'id'} && $charts_not_supported eq 'no') {

my $open =
($info->{'open'} || $info->{'id'} eq 'domain') ? ' in' :
($theme_config{'settings_sysinfo_expand_all_accordions'} eq 'true' ? ' in' : '');

$returned_sysinfo .= '
<div data-referrer="' . $info->{'id'} . '" data-sorter="' . $info->{'module'} .
'" class="panel panel-default' . ($info->{'level'} ? ' panel-' . $info->{'level'} . '' : undef) . ''
<div data-referrer="' . $info->{'id'} . '" data-sorter="' . $info->{'module'} . '" class="panel ' .
($info->{'level'} ? (' panel-' . ($info->{'level'} ne 'warn' ? $info->{'level'} : 'warning') . '') :
'panel-default') .
''
.
( $theme_config{'settings_animation_tabs'} ne 'false' ? '' :
' disable-animations'
Expand Down Expand Up @@ -447,7 +454,10 @@ sub get_extended_sysinfo
<div id="'
. $info->{'id'} . '-' . $info->{'module'} . $x . '-collapse" class="panel-collapse collapse' .
$open . '" role="tabpanel" aria-labelledby="' . $info->{'id'} . '-' . $info->{'module'} . $x . '">
<div class="panel-body">';
<div class="panel-body ' .
($info->{'level'} ? ' alert-' . ($info->{'level'} ne 'warn' ? $info->{'level'} : 'warning') . '' :
undef) .
'">';

if ($info->{'id'} ne 'plugin_virtualmin-notes' && $info->{'id'} ne 'acl_logins') {
$returned_sysinfo .=
Expand Down Expand Up @@ -3156,7 +3166,7 @@ sub get_xhr_request
"csf_deny" => csf_temporary_list(),
"collect_interval" => get_module_config_data('system-status', 'collect_interval'),
"extended_si" => get_extended_sysinfo(\@info, undef),
"warning_si" => get_sysinfo_warning(@info), };
"warning_si" => get_sysinfo_warning(\@info), };
print convert_to_json(\@updated_info);
} elsif ($in{'xhr-search-in-file'} eq '1') {
set_user_level();
Expand Down
7 changes: 6 additions & 1 deletion authentic.pm
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ sub theme_ui_hr

sub theme_ui_alert_box
{
my ($msg, $class, $style, $new_line) = @_;
my ($msg, $class, $style, $new_line, $desc_to_title) = @_;
my ($rv, $type, $tmsg, $fa);

if ($class eq "success") {
Expand All @@ -816,6 +816,10 @@ sub theme_ui_alert_box
$type = 'alert-danger', $tmsg = ($theme_text{'theme_global_error'} . '!'), $fa = 'fa-bolt';
}

if ($desc_to_title) {
$tmsg = $desc_to_title;
}

$rv .= '<div class="alert ' . $type . '" style="margin-bottom: 4px; ' . $style . '">' . "\n";
$rv .= '<i class="fa fa-fw ' . $fa . '"></i> <strong>' . $tmsg . '</strong>';
$rv .= ($new_line ? '<br>' : '&nbsp;') . "\n";
Expand Down Expand Up @@ -1170,6 +1174,7 @@ sub theme_header_redirect_download
($delay ? $delay . "000" : 0) . ');</script>';
print "<body>\n";
print $script . "\n";

if ($message) {
print $message . "\n";
}
Expand Down
2 changes: 1 addition & 1 deletion sysinfo.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ if ($has_stats) {
print '</tbody></table>' . "\n";

# Print System Warning
print get_sysinfo_warning(@info);
print get_sysinfo_warning(\@info);

print_sysstats_panel_end();

Expand Down
2 changes: 1 addition & 1 deletion theme.info
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
desc=Authentic Theme
longdesc=Webmin/Usermin/Virtualmin/Cloudmin theme based on Bootstrap and Font Awesome (https://github.com/authentic-theme/authentic-theme)
version=19.20-beta6
mversion=51
mversion=52
depends=1.894 1.742
webmin=1
usermin=1
2 changes: 1 addition & 1 deletion unauthenticated/css/bundle.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion unauthenticated/css/palettes/nightrider.min.css

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions unauthenticated/js/bundle.min.js

Large diffs are not rendered by default.

0 comments on commit f14e4bc

Please sign in to comment.