@@ -3680,6 +3680,20 @@ sub get_page_title {
3680
3680
return $title ;
3681
3681
}
3682
3682
3683
+ sub get_content_type_html {
3684
+ # require explicit support from the UA if we are to send the page as
3685
+ # 'application/xhtml+xml', otherwise send it as plain old 'text/html'.
3686
+ # we have to do this because MSIE sometimes globs '*/*', pretending to
3687
+ # support xhtml+xml but choking when it gets what it asked for.
3688
+ if (defined $cgi -> http(' HTTP_ACCEPT' ) &&
3689
+ $cgi -> http(' HTTP_ACCEPT' ) =~ m / (,|;|\s |^)application\/ xhtml\+ xml(,|;|\s |$ )/ &&
3690
+ $cgi -> Accept(' application/xhtml+xml' ) != 0) {
3691
+ return ' application/xhtml+xml' ;
3692
+ } else {
3693
+ return ' text/html' ;
3694
+ }
3695
+ }
3696
+
3683
3697
sub print_feed_meta {
3684
3698
if (defined $project ) {
3685
3699
my %href_params = get_feed_info();
@@ -3725,24 +3739,90 @@ sub print_feed_meta {
3725
3739
}
3726
3740
}
3727
3741
3742
+ sub print_header_links {
3743
+ my $status = shift ;
3744
+
3745
+ # print out each stylesheet that exist, providing backwards capability
3746
+ # for those people who defined $stylesheet in a config file
3747
+ if (defined $stylesheet ) {
3748
+ print ' <link rel="stylesheet" type="text/css" href="' .esc_url($stylesheet ).' "/>' ." \n " ;
3749
+ } else {
3750
+ foreach my $stylesheet (@stylesheets ) {
3751
+ next unless $stylesheet ;
3752
+ print ' <link rel="stylesheet" type="text/css" href="' .esc_url($stylesheet ).' "/>' ." \n " ;
3753
+ }
3754
+ }
3755
+ print_feed_meta()
3756
+ if ($status eq ' 200 OK' );
3757
+ if (defined $favicon ) {
3758
+ print qq( <link rel="shortcut icon" href=") .esc_url($favicon ).qq( " type="image/png" />\n ) ;
3759
+ }
3760
+ }
3761
+
3762
+ sub print_nav_breadcrumbs {
3763
+ my %opts = @_ ;
3764
+
3765
+ print $cgi -> a({-href => esc_url($home_link )}, $home_link_str ) . " / " ;
3766
+ if (defined $project ) {
3767
+ print $cgi -> a({-href => href(action => " summary" )}, esc_html($project ));
3768
+ if (defined $action ) {
3769
+ my $action_print = $action ;
3770
+ if (defined $opts {-action_extra}) {
3771
+ $action_print = $cgi -> a({-href => href(action => $action )},
3772
+ $action );
3773
+ }
3774
+ print " / $action_print " ;
3775
+ }
3776
+ if (defined $opts {-action_extra}) {
3777
+ print " / $opts {-action_extra}" ;
3778
+ }
3779
+ print " \n " ;
3780
+ }
3781
+ }
3782
+
3783
+ sub print_search_form {
3784
+ if (!defined $searchtext ) {
3785
+ $searchtext = " " ;
3786
+ }
3787
+ my $search_hash ;
3788
+ if (defined $hash_base ) {
3789
+ $search_hash = $hash_base ;
3790
+ } elsif (defined $hash ) {
3791
+ $search_hash = $hash ;
3792
+ } else {
3793
+ $search_hash = " HEAD" ;
3794
+ }
3795
+ my $action = $my_uri ;
3796
+ my $use_pathinfo = gitweb_check_feature(' pathinfo' );
3797
+ if ($use_pathinfo ) {
3798
+ $action .= " /" .esc_url($project );
3799
+ }
3800
+ print $cgi -> startform(-method => " get" , -action => $action ) .
3801
+ " <div class=\" search\" >\n " .
3802
+ (!$use_pathinfo &&
3803
+ $cgi -> input({-name => " p" , -value => $project , -type => " hidden" }) . " \n " ) .
3804
+ $cgi -> input({-name => " a" , -value => " search" , -type => " hidden" }) . " \n " .
3805
+ $cgi -> input({-name => " h" , -value => $search_hash , -type => " hidden" }) . " \n " .
3806
+ $cgi -> popup_menu(-name => ' st' , -default => ' commit' ,
3807
+ -values => [' commit' , ' grep' , ' author' , ' committer' , ' pickaxe' ]) .
3808
+ $cgi -> sup($cgi -> a({-href => href(action => " search_help" )}, " ?" )) .
3809
+ " search:\n " ,
3810
+ $cgi -> textfield(-name => " s" , -value => $searchtext ) . " \n " .
3811
+ " <span title=\" Extended regular expression\" >" .
3812
+ $cgi -> checkbox(-name => ' sr' , -value => 1, -label => ' re' ,
3813
+ -checked => $search_use_regexp ) .
3814
+ " </span>" .
3815
+ " </div>" .
3816
+ $cgi -> end_form() . " \n " ;
3817
+ }
3818
+
3728
3819
sub git_header_html {
3729
3820
my $status = shift || " 200 OK" ;
3730
3821
my $expires = shift ;
3731
3822
my %opts = @_ ;
3732
3823
3733
3824
my $title = get_page_title();
3734
- my $content_type ;
3735
- # require explicit support from the UA if we are to send the page as
3736
- # 'application/xhtml+xml', otherwise send it as plain old 'text/html'.
3737
- # we have to do this because MSIE sometimes globs '*/*', pretending to
3738
- # support xhtml+xml but choking when it gets what it asked for.
3739
- if (defined $cgi -> http(' HTTP_ACCEPT' ) &&
3740
- $cgi -> http(' HTTP_ACCEPT' ) =~ m / (,|;|\s |^)application\/ xhtml\+ xml(,|;|\s |$ )/ &&
3741
- $cgi -> Accept(' application/xhtml+xml' ) != 0) {
3742
- $content_type = ' application/xhtml+xml' ;
3743
- } else {
3744
- $content_type = ' text/html' ;
3745
- }
3825
+ my $content_type = get_content_type_html();
3746
3826
print $cgi -> header(-type => $content_type , -charset => ' utf-8' ,
3747
3827
-status => $status , -expires => $expires )
3748
3828
unless ($opts {' -no_http_header' });
@@ -3764,22 +3844,7 @@ sub git_header_html {
3764
3844
if ($ENV {' PATH_INFO' }) {
3765
3845
print " <base href=\" " .esc_url($base_url )." \" />\n " ;
3766
3846
}
3767
- # print out each stylesheet that exist, providing backwards capability
3768
- # for those people who defined $stylesheet in a config file
3769
- if (defined $stylesheet ) {
3770
- print ' <link rel="stylesheet" type="text/css" href="' .esc_url($stylesheet ).' "/>' ." \n " ;
3771
- } else {
3772
- foreach my $stylesheet (@stylesheets ) {
3773
- next unless $stylesheet ;
3774
- print ' <link rel="stylesheet" type="text/css" href="' .esc_url($stylesheet ).' "/>' ." \n " ;
3775
- }
3776
- }
3777
- print_feed_meta()
3778
- if ($status eq ' 200 OK' );
3779
- if (defined $favicon ) {
3780
- print qq( <link rel="shortcut icon" href=") .esc_url($favicon ).qq( " type="image/png" />\n ) ;
3781
- }
3782
-
3847
+ print_header_links($status );
3783
3848
print " </head>\n " .
3784
3849
" <body>\n " ;
3785
3850
@@ -3796,59 +3861,12 @@ sub git_header_html {
3796
3861
-alt => " git" ,
3797
3862
-class => " logo" }));
3798
3863
}
3799
- print $cgi -> a({-href => esc_url($home_link )}, $home_link_str ) . " / " ;
3800
- if (defined $project ) {
3801
- print $cgi -> a({-href => href(action => " summary" )}, esc_html($project ));
3802
- if (defined $action ) {
3803
- my $action_print = $action ;
3804
- if (defined $opts {-action_extra}) {
3805
- $action_print = $cgi -> a({-href => href(action => $action )},
3806
- $action );
3807
- }
3808
- print " / $action_print " ;
3809
- }
3810
- if (defined $opts {-action_extra}) {
3811
- print " / $opts {-action_extra}" ;
3812
- }
3813
- print " \n " ;
3814
- }
3864
+ print_nav_breadcrumbs(%opts );
3815
3865
print " </div>\n " ;
3816
3866
3817
3867
my $have_search = gitweb_check_feature(' search' );
3818
3868
if (defined $project && $have_search ) {
3819
- if (!defined $searchtext ) {
3820
- $searchtext = " " ;
3821
- }
3822
- my $search_hash ;
3823
- if (defined $hash_base ) {
3824
- $search_hash = $hash_base ;
3825
- } elsif (defined $hash ) {
3826
- $search_hash = $hash ;
3827
- } else {
3828
- $search_hash = " HEAD" ;
3829
- }
3830
- my $action = $my_uri ;
3831
- my $use_pathinfo = gitweb_check_feature(' pathinfo' );
3832
- if ($use_pathinfo ) {
3833
- $action .= " /" .esc_url($project );
3834
- }
3835
- print $cgi -> startform(-method => " get" , -action => $action ) .
3836
- " <div class=\" search\" >\n " .
3837
- (!$use_pathinfo &&
3838
- $cgi -> input({-name => " p" , -value => $project , -type => " hidden" }) . " \n " ) .
3839
- $cgi -> input({-name => " a" , -value => " search" , -type => " hidden" }) . " \n " .
3840
- $cgi -> input({-name => " h" , -value => $search_hash , -type => " hidden" }) . " \n " .
3841
- $cgi -> popup_menu(-name => ' st' , -default => ' commit' ,
3842
- -values => [' commit' , ' grep' , ' author' , ' committer' , ' pickaxe' ]) .
3843
- $cgi -> sup($cgi -> a({-href => href(action => " search_help" )}, " ?" )) .
3844
- " search:\n " ,
3845
- $cgi -> textfield(-name => " s" , -value => $searchtext ) . " \n " .
3846
- " <span title=\" Extended regular expression\" >" .
3847
- $cgi -> checkbox(-name => ' sr' , -value => 1, -label => ' re' ,
3848
- -checked => $search_use_regexp ) .
3849
- " </span>" .
3850
- " </div>" .
3851
- $cgi -> end_form() . " \n " ;
3869
+ print_search_form();
3852
3870
}
3853
3871
}
3854
3872
0 commit comments