diff --git a/blue-theme/theme.pl.old b/blue-theme/theme.pl.old deleted file mode 100644 index a816249f5..000000000 --- a/blue-theme/theme.pl.old +++ /dev/null @@ -1,406 +0,0 @@ -# Functions for the simple blue theme - -# Generate the list of category links, the title and the page body -# XXX sponsor link -sub theme_header -{ -local ($title, $image, $help, $config, $nomodule, $nowebmin, $right, - $header, $body, $below) = @_; - -# HTML header -print "\n"; -print "\n"; -print "\n"; -local $charset = defined($force_charset) ? $force_charset : &get_charset(); -if ($charset) { - print "\n"; - } -print "\n"; - -# Page title, with hostname and username in it -local $pagetitle; -if ($gconfig{'sysinfo'} == 1) { - $pagetitle = sprintf "%s : %s on %s (%s %s)\n", - $_[0], $remote_user, &get_display_hostname(), - $os_type, $os_version; - } -elsif ($gconfig{'sysinfo'} == 4) { - $pagetitle = sprintf "%s on %s (%s %s)\n", - $remote_user, &get_display_hostname(), - $os_type, $os_version; - } -else { - $pagetitle = $title; - } -if ($gconfig{'showlogin'} && $remote_user) { - $pagetitle = $remote_user." : ".$pagetitle; - } -print "$pagetitle\n"; -print $header; -print "\n"; - -# HTML body start -local $dir = $current_lang_info->{'dir'} ? - "dir=\"$current_lang_info->{'dir'}\"" : ""; -print "\n"; - -# Work out current category -local $currentcat; -if ($theme_index_page) { - # Can get category from param to index page - if (defined($in{'cat'})) { - $currentcat = $in{'cat'}; - } - else { - $currentcat = $gconfig{'deftab'}; - } - } -else { - # Can get category from current module - $currentcat = $module_info{'category'}; - } - -# Category links, plus logout and sponsor buttons -local @blue_modules = &get_visible_module_infos(); -local %cats = &list_categories(\@blue_modules); -local @cats = sort { $b cmp $a } keys %cats; -if (!defined($cats{$currentcat})) { - $currentcat = $cats[0]; - } -local $one = @blue_modules == 1 && $gconfig{'gotoone'}; -local $notabs = $gconfig{"notabs_${base_remote_user}"} == 2 || - $gconfig{"notabs_${base_remote_user}"} == 0 && $gconfig{'notabs'}; -local $shown_cats = 0; -print "\n"; -if (@_ > 1 && !$one && $remote_user && !$notabs) { - # Show module categories - foreach my $c (@cats) { - print "\n"; - $shown_cats++; - } - } - -local $logout = $main::session_id ? "/session_login.cgi?logout=1" - : "/switch_user.cgi"; -local $lotext = $main::session_id ? $text{'main_logout'} - : $text{'main_switch'}; -if ($remote_user && @_ > 1 && $shown_cats) { - # Show webmin.com link, sponsor link and logout link - print "\n"; - print "\n"; - } -elsif ($remote_user) { - # Defer logout link till right side - $right .= "
" if ($right); - $right .= "$lotext"; - } -print "
\n"; - if ($currentcat eq $c) { - print &blue_theme_box( - "$cats{$c}"); - } - else { - print &blue_theme_box( - "$cats{$c}"); - } - print "\n"; - print &blue_theme_box("Webmin Home", "width=100%"); - print "\n"; - print &blue_theme_box("$lotext"); - print "
\n"; - -# Module index link, module config link, help link, page title and right -# side links -local @left; -if (!$nomodule) { - # Module index link - local $idx = $module_info{'index_link'}; - local $mi = $module_index_link || "/$module_name/$idx"; - local $mt = $module_index_name || $text{'header_module'}; - push(@left, "$mt"); - } -if (!$ENV{'ANONYMOUS_USER'} && $help) { - if (ref($help)) { - push(@left, &hlink($text{'header_help'}, - $help->[0], $help->[1])); - } - else { - push(@left, &hlink($text{'header_help'}, $help)); - } - } -if ($config) { - # Module config link - local %access = &get_module_acl(); - if (!$access{'noconfig'} && !$config{'noprefs'}) { - local $cprog = $user_module_config_directory ? - "uconfig.cgi" : "config.cgi"; - push(@left, "$text{'header_config'}"); - } - } -if ($ENV{'HTTP_WEBMIN_SERVERS'}) { - push(@left, "". - "$text{'header_servers'}"); - } -if (@_ > 1 && (@left || $right || $title || $image)) { - local $ttable = "\n"; - if (@left || $right) { - $ttable .= "\n"; - } - # Title or image - local $w = @left || $right ? 70 : 100; - $ttable .= "\n"; - # Right-side stuff, supplied by module - if ($right || @left) { - $ttable .= "\n"; - } - $ttable .= "
". - join("
\n", @left). - "
"; - $ttable .= $image || - "$title"; - if ($ui_header_subtext) { - $ttable .= "
$ui_header_subtext\n"; - } - if ($below) { - $ttable .= "
$below\n"; - } - $ttable .= "
". - $right. - "
\n"; - print &blue_theme_box($ttable, "width=100%"); - } - -# Start box for the entire page -if (!$theme_no_table) { - local $ua = "$gconfig{'webprefix'}/unauthenticated"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "
\n"; - } -} - -sub theme_footer -{ -# Return links, in a blue box -local $returns; -for(my $i=0; $i+1<@_; $i+=2) { - local $url = $_[$i]; - if ($url eq '/') { - $url = "/?cat=$module_info{'category'}"; - } - elsif ($url eq '' && $module_name) { - local $idx = $module_info{'index_link'}; - $url = "/$module_name/$idx"; - } - elsif ($url =~ /^\?/ && $module_name) { - $url = "/$module_name/$url"; - } - $url = "$gconfig{'webprefix'}$url" if ($url =~ /^\//); - if ($i == 0) { - $returns .= " \"<-\"\n"; - } - else { - $returns .= " |\n"; - } - $returns .= " ".&text('main_return', $_[$i+1])."\n"; - } - -# End box for the entire page -if (!$theme_no_table) { - local $ua = "$gconfig{'webprefix'}/unauthenticated"; - print "
\n"; - } -if ($returns) { - print $returns,"
\n"; - } - -print "\n"; -} - -# theme_ui_print_header(subtext, args...) -# Print HTML for a header with the post-header line. The args are the same -# as those passed to header() -sub theme_ui_print_header -{ -local ($ui_header_subtext, @args) = @_; -&header(@args); -if ($theme_no_table) { - print "
\n"; - } -} - -sub theme_ui_pre_footer -{ -local $rv; -if ($theme_no_table) { - $rv .= "
\n"; - } -return $rv; -} - -# theme_ui_columns_row(&columns, &tdtags) -# Returns HTML for a row in a multi-column table -sub theme_ui_columns_row -{ -local ($cols, $tdtags) = @_; -local $rv; -$rv .= "\n"; -local $i; -for($i=0; $i<@$cols; $i++) { - $rv .= "[$i].">". - ($cols->[$i] eq "" ? "
" : $cols->[$i])."\n"; - } -$rv .= "\n"; -return $rv; -} - -# theme_select_all_link(field, form, text) -# Adds support for row highlighting to the normal select all -sub theme_select_all_link -{ -local ($field, $form, $text) = @_; -$form = int($form); -$text ||= $text{'ui_selall'}; -return "$text"; -} - -# theme_select_invert_link(field, form, text) -# Adds support for row highlighting to the normal invert selection -sub theme_select_invert_link -{ -local ($field, $form, $text) = @_; -$form = int($form); -$text ||= $text{'ui_selinv'}; -return "$text"; -} - -sub theme_ui_checked_columns_row -{ -local ($cols, $tdtags, $checkname, $checkvalue) = @_; -local $rv; -local $cbid = "e_escape("${checkname}_${checkvalue}"); -local $rid = "e_escape("row_${checkname}_${checkvalue}"); -$rv .= "\n"; -$rv .= "[0].">". - &ui_checkbox($checkname, $checkvalue, undef, 0, "onClick=\"document.getElementById('$rid').className = this.checked ? 'mainhighsel' : 'mainhigh';\""). - "\n"; -local $i; -for($i=0; $i<@$cols; $i++) { - $rv .= "[$i+1].">"; - if ($cols->[$i] !~ /"; - } - $rv .= ($cols->[$i] eq "" ? "
" : $cols->[$i]); - if ($cols->[$i] !~ /\n"; -$rv .= "[0].">". - &ui_oneradio($checkname, $checkvalue, undef, 0, "onClick=\"for(i=0; i\n"; -local $i; -for($i=0; $i<@$cols; $i++) { - $rv .= "[$i+1].">"; - if ($cols->[$i] !~ /"; - } - $rv .= ($cols->[$i] eq "" ? "
" : $cols->[$i]); - if ($cols->[$i] !~ /".join("", @_)."
\n"; -} - -# theme_popup_header(title, headstuff, bodystuff) -sub theme_popup_header -{ -local ($title, $headstuff, $bodystuff) = @_; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "$title\n"; -print $headstuff; -print "\n"; -print "\n"; -} - -sub theme_popup_footer -{ -print "\n"; -} - -sub theme_error -{ -&header($text{'error'}, ""); -print "

\n"; -print "

",($main::whatfailed ? "$main::whatfailed : " : ""),@_,"

\n"; -print "

\n"; -if ($ENV{'HTTP_REFERER'} && $main::completed_referers_check) { - &footer($ENV{'HTTP_REFERER'}, $text{'error_previous'}); - } -else { - &footer(); - } -} - -sub blue_theme_box -{ -local ($text, $tabletags, $align) = @_; -$align ||= "center"; -local $ua = "$gconfig{'webprefix'}/unauthenticated"; -local $rv; -$rv .= ""; -$rv .= "\n"; -$rv .= "\n"; -$rv .= "\n"; -$rv .= "
$text
\n"; -return $rv; -} - -# theme_generate_icon(image, title, link, [href], [width], [height], -# [before-title], [after-title]) -# Prints HTML for an icon image -sub theme_generate_icon -{ -local ($icon, $title, $link, $href, $w, $h, $before, $after) = @_; -local $wtag = !defined($w) ? "width=24" : $w ? "width=$w" : ""; -local $htag = !defined($h) ? "height=25" : $w ? "height=$h" : ""; -print ""; -if ($link) { - print ""; - } -else { - print ""; - } -print "
 $before$title$after  $before$title$after
\n"; -} -