Use common function for main page header
authorJamie Cameron <jcameron@webmin.com>
Mon, 22 Mar 2010 04:52:49 +0000 (21:52 -0700)
committerJamie Cameron <jcameron@webmin.com>
Mon, 22 Mar 2010 04:52:49 +0000 (21:52 -0700)
blue-theme/index.cgi
web-lib-funcs.pl

index 1cb4b6f..29a2f79 100755 (executable)
@@ -26,21 +26,18 @@ if ($in{'page'}) {
 $title = &get_html_framed_title();
 &PrintHeader();
 $cols = &get_product_name() eq 'usermin' ? 180 : 230;
-print <<EOF;
-<html>
-<head> <title>$title</title> </head>
+&popup_header($title, undef, undef, 1);
 
+print <<EOF;
 <frameset cols="$cols,*" border=0>
        <frame name="left" src="left.cgi$cat" scrolling="auto">
        <frame name="right" src="$goto" noresize>
 <noframes>
 <body>
-
 <p>This page uses frames, but your browser doesn't support them.</p>
-
 </body>
 </noframes>
 </frameset>
-</html>
 EOF
+&popup_footer();
 
index 43ccadf..3d95f9c 100755 (executable)
@@ -789,12 +789,8 @@ if (@_ > 0) {
        }
 print "$tconfig{'headhtml'}\n" if ($tconfig{'headhtml'});
 if ($tconfig{'headinclude'}) {
-       local $_;
-       open(INC, "$theme_root_directory/$tconfig{'headinclude'}");
-       while(<INC>) {
-               print;
-               }
-       close(INC);
+       print &read_file_contents(
+               "$theme_root_directory/$tconfig{'headinclude'}");
        }
 print "</head>\n";
 my $bgcolor = defined($tconfig{'cs_page'}) ? $tconfig{'cs_page'} :
@@ -1021,7 +1017,7 @@ else {
        }
 }
 
-=head2 popup_header([title], [head-stuff], [body-stuff])
+=head2 popup_header([title], [head-stuff], [body-stuff], [no-body])
 
 Outputs a page header, suitable for a popup window. If no title is given,
 absolutely no decorations are output. Also useful in framesets. The parameters
@@ -1033,6 +1029,8 @@ are :
 
 =item body-stuff - HTML attributes to be include in the <body> tag.
 
+=item no-body - If set to 1, don't generate a body tag
+
 =cut
 sub popup_header
 {
@@ -1056,12 +1054,8 @@ print "<title>$_[0]</title>\n";
 print $_[1];
 print "$tconfig{'headhtml'}\n" if ($tconfig{'headhtml'});
 if ($tconfig{'headinclude'}) {
-       local $_;
-       open(INC, "$theme_root_directory/$tconfig{'headinclude'}");
-       while(<INC>) {
-               print;
-               }
-       close(INC);
+       print &read_file_contents(
+               "$theme_root_directory/$tconfig{'headinclude'}");
        }
 print "</head>\n";
 my $bgcolor = defined($tconfig{'cs_page'}) ? $tconfig{'cs_page'} :
@@ -1072,10 +1066,12 @@ my $text = defined($tconfig{'cs_text'}) ? $tconfig{'cs_text'} :
              defined($gconfig{'cs_text'}) ? $gconfig{'cs_text'} : "000000";
 my $bgimage = defined($tconfig{'bgimage'}) ? "background=$tconfig{'bgimage'}"
                                              : "";
-print "<body id='popup' bgcolor=#$bgcolor link=#$link vlink=#$link ",
-      "text=#$text $bgimage $tconfig{'inbody'} $_[2]>\n";
-if (defined(&theme_popup_prebody)) {
-       &theme_popup_prebody(@_);
+if (!$_[3]) {
+       print "<body id='popup' bgcolor=#$bgcolor link=#$link vlink=#$link ",
+             "text=#$text $bgimage $tconfig{'inbody'} $_[2]>\n";
+       if (defined(&theme_popup_prebody)) {
+               &theme_popup_prebody(@_);
+               }
        }
 }
 
@@ -1152,7 +1148,7 @@ if (!$_[$i]) {
        }
 }
 
-=head2 popup_footer
+=head2 popup_footer([no-body])
 
 Outputs html for a footer for a popup window, started by popup_header.
 
@@ -1164,7 +1160,10 @@ if (defined(&theme_popup_footer)) {
        &theme_popup_footer(@_);
        return;
        }
-print "</body></html>\n";
+if (!$_[0]) {
+       print "</body>\n";
+       }
+print "</html>\n";
 }
 
 =head2 load_theme_library