Make webmin post-login notifications generic

This commit is contained in:
Jamie Cameron
2008-10-13 22:18:05 +00:00
parent a86c335c4b
commit 2197c34894
4 changed files with 27 additions and 41 deletions

View File

@@ -130,22 +130,10 @@ if ($level == 0) {
print "</table>\n";
# Check for incorrect OS
if (&foreign_available("webmin")) {
if (&foreign_check("webmin")) {
&foreign_require("webmin", "webmin-lib.pl");
%realos = &webmin::detect_operating_system(undef, 1);
if ($realos{'os_version'} ne $gconfig{'os_version'} ||
$realos{'os_type'} ne $gconfig{'os_type'}) {
print "<form action=webmin/fix_os.cgi>\n";
print "<p><center>",&webmin::text('os_incorrect',
$realos{'real_os_type'},
$realos{'real_os_version'}),"<p>\n";
print "<input type=submit ",
"value='$webmin::text{'os_fix'}'>\n";
print "</center>\n";
print "</form>\n";
}
&webmin::show_webmin_notifications();
}
}
elsif ($level == 3) {
# Show Usermin user's information

View File

@@ -180,20 +180,9 @@ else {
}
# Check for incorrect OS
if (&foreign_available("webmin")) {
if (&foreign_check("webmin")) {
&foreign_require("webmin", "webmin-lib.pl");
%realos = &webmin::detect_operating_system(undef, 1);
if ($realos{'os_version'} ne $gconfig{'os_version'} ||
$realos{'os_type'} ne $gconfig{'os_type'}) {
print "<form action=webmin/fix_os.cgi>\n";
print "<p><center>",&webmin::text('os_incorrect',
$realos{'real_os_type'},
$realos{'real_os_version'}),"<p>\n";
print "<input type=submit ",
"value='$webmin::text{'os_fix'}'>\n";
print "</center>\n";
print "</form>\n";
}
&webmin::show_webmin_notifications();
}
if ($miniserv{'logout'} && !$gconfig{'alt_startpage'} &&

View File

@@ -138,21 +138,9 @@ if ($miniserv{'logout'} && !$gconfig{'alt_startpage'} &&
}
# Check for incorrect OS
if (&foreign_available("webmin")) {
if (&foreign_check("webmin")) {
&foreign_require("webmin", "webmin-lib.pl");
%realos = &webmin::detect_operating_system(undef, 1);
if ($realos{'os_version'} ne $gconfig{'os_version'} ||
$realos{'os_type'} ne $gconfig{'os_type'}) {
print "<form action=webmin/fix_os.cgi>\n";
print "<table width=95% align=center><tr><td width=100%><b><font color='#FFFFFF'>&nbsp;&nbsp;";
print &webmin::text('os_incorrect',
$realos{'real_os_type'},
$realos{'real_os_version'}),"\n";
print "<input type=submit ",
"value='$webmin::text{'os_fix'}'>\n";
print "</tr></table>\n";
print "</form>\n";
}
&webmin::show_webmin_notifications();
}
print $text{'main_footer'};

View File

@@ -829,6 +829,27 @@ $rv{'time'} = time();
return %rv;
}
# show_webmin_notifications()
# Print various notifications for the current user, if needed
sub show_webmin_notifications
{
# Need OS upgrade
local %realos = &detect_operating_system(undef, 1);
if (($realos{'os_version'} ne $gconfig{'os_version'} ||
$realos{'os_type'} ne $gconfig{'os_type'}) &&
&foreign_available("webmin")) {
print "<center>\n";
print &ui_form_start("$gconfig{'webprefix'}/webmin/fix_os.cgi");
print &text('os_incorrect', $realos{'real_os_type'},
$realos{'real_os_version'}),"<p>\n";
print &ui_form_end([ [ undef, $text{'os_fix'} ] ]);
print "</center>\n";
}
# Password close to expiry
# XXX
}
# get_system_uptime()
# Returns the number of seconds the system has been up, or undef if un-available
sub get_system_uptime