Apache-CVS

 view release on metacpan or  search on metacpan

CVS/HTML.pm  view on Meta::CPAN

        };
        /$file_sorting{'date'}/ && do {
            @sorted_revisions = sort { $a->date() <=> $b->date() }
                                @{ $revisions };
            last;
        };
        @sorted_revisions = @{ $revisions };
    }
    @sorted_revisions = reverse @sorted_revisions if $ascending;
    return \@sorted_revisions;
}

sub print_error {
    my $self = shift;
    my $error = shift;
    $self->print_http_header();
    $self->print_page_header();
    $error =~ s/\n/<br>/g;
    $self->request()->print($error);
    $self->print_page_footer();
}

sub print_page_header {
    my $self = shift;
    return if $self->page_headers_sent();
    $self->request()->print('<html>
                             <head>
                                <link rel="stylesheet" type="text/css" href="');
    $self->request()->print($self->{css_file});
    $self->request()->print('">
                                <title>Apache::CVS</title>
                             </head>
                             <body bgcolor=white>');
    $self->print_path_links();
    $self->page_headers_sent(1);
}

sub print_page_footer {
    shift->{request}->print('</body></html>');
}

sub print_path_links {
    my $self = shift;
    my ($is_revision) = @_;

    my $rpath = $self->request()->parsed_uri->rpath();
    my $cvsroot = $self->current_root();
    my $filename = $self->path();
    my $cvsroot_path = $self->current_root_path();
    # strip out unnecessary stuff
    $filename =~ s/$cvsroot_path//;
#    $filename =~ s#[^/]*/?$## unless $is_revision;

    # top / root / file
    my $path = qq($rpath/$cvsroot$filename);

    my $link = qq(<a class=$css_class{path_link} href=$rpath>top</a>);
    $link .= qq(:: <a class=$css_class{path_link} href=$rpath/$cvsroot>$cvsroot</a>);

    my $parents;
    foreach ( split m#/#, $filename ) {

        next unless $_;
        $link .= qq(:: <a class=$css_class{path_link} href="$rpath/$cvsroot$parents/$_">$_</a>);
        $parents .= qq(/$_) if $_;
    }

    $link .= q(<p>);

    $self->request()->print($link);
}

sub print_root {
    my $self = shift;
    my $root = shift;
    $self->request()->print('<a class=$css_class{root_link} href="' .
                            $self->request()->parsed_uri->rpath() .
                            qq(/$root">$_</a><br>));
}

sub print_root_list_header {
    my $self = shift;
    $self->request()->print('available cvs roots<p>');
}

sub print_root_list_footer {
    return;
}

sub _print_sortable_headers {
    my $self = shift;
    my ($uri_base, $criterion, $sort_direction, $headers, $sorting,
        $th_css_class, $a_css_class) = @_;
    foreach my $header (@{ $headers}) {

        $self->request()->print(qq|<th class=$th_css_class>|);

        # check to see if this is a sortable field
        if (exists($sorting->{$header})) {

            $self->request()->print(qq|<a class=$a_css_class href="$uri_base?o=|);
            $self->request()->print($sorting->{$header});

            if ($sorting->{$header} eq $criterion) {
                # if we already sorting by this criterion, offer to sort the
                # other way
                my $ascending = ($sort_direction + 1) % 2;
                $self->request()->print(qq|&asc=$ascending|);
            }
            $self->request()->print(qq|">$header</a>|);
        } else {
            $self->request()->print($header);
        }
        $self->request()->print('</th>');
    }
}

sub print_directory_list_header {
    my $self = shift;
    my ($uri_base, $criterion, $sort_direction) = @_;



( run in 0.852 second using v1.01-cache-2.11-cpan-6aa56a78535 )